package WebGUI::Macro::KarmaImage; =head1 DESCRIPTION Macro for displaying the amount of karma the current user has =head2 process =head3 text The text to be displayed to the user. The text will be processed by sprintf, using %d to represent the integer karma. =cut use WebGUI::User; #------------------------------------------------------------------- sub process { my $session = shift; my $userId = shift || $session->user->userId; my $user = WebGUI::User->new($session,$userId); my $karma = $user->karma; my $groupId = "3"; my $karmaClass; if ($user->isInGroup($groupId)) { $karmaClass="Staff"; } else { if ($karma<500) { $karmaClass="Beginner"; } elsif ($karma=>500 && $karma<1000) { $karmaClass="Novice"; } elsif ($karma=>1000 && $karma<2500) { $karmaClass="Skilled"; } elsif ($karma=>2500 && $karma<5000) { $karmaClass="Professional"; } elsif ($karma=>5000 && $karma<7500) { $karmaClass="Expert"; } elsif ($karma=>7500 && $karma<10000) { $karmaClass="Master"; } else { $karmaClass="Guru"; } } my $image = ''; return $image; } 1;