@@ 732-753 (lines=22) @@ | ||
729 | /** |
|
730 | * @return array |
|
731 | */ |
|
732 | function Smallworld_worstratedusers() |
|
733 | { |
|
734 | global $xoopsUser, $xoopsDB; |
|
735 | $array = []; |
|
736 | $counter = 1; |
|
737 | $sql = 'SELECT owner, ('; |
|
738 | $sql .= 'sum( up ) - sum( down )'; |
|
739 | $sql .= ') AS total'; |
|
740 | $sql .= ' FROM ' . $xoopsDB->prefix('smallworld_vote') . ''; |
|
741 | $sql .= ' GROUP BY owner ORDER by total ASC LIMIT 5'; |
|
742 | $result = $xoopsDB->queryF($sql); |
|
743 | while ($row = $xoopsDB->fetchArray($result)) { |
|
744 | $array[$counter]['counter'] = $counter; |
|
745 | $array[$counter]['img'] = smallworld_getAvatarLink($row['owner'], Smallworld_Gravatar($row['owner'])); |
|
746 | $array[$counter]['user'] = $xoopsUser->getUnameFromId($row['owner']); |
|
747 | $array[$counter]['rating'] = $row['total']; |
|
748 | $array[$counter]['user_link'] = "<a href = '" . XOOPS_URL . '/modules/smallworld/userprofile.php?username=' . $array[$counter]['user'] . "'>"; |
|
749 | $array[$counter]['user_link'] .= $array[$counter]['user'] . ' (' . $array[$counter]['rating'] . ')</a>'; |
|
750 | ++$counter; |
|
751 | } |
|
752 | return $array; |
|
753 | } |
|
754 | ||
755 | // Find best rated users overall |
|
756 | /** |
|
@@ 759-780 (lines=22) @@ | ||
756 | /** |
|
757 | * @return array |
|
758 | */ |
|
759 | function Smallworld_topratedusers() |
|
760 | { |
|
761 | global $xoopsUser, $xoopsDB; |
|
762 | $array = []; |
|
763 | $counter = 1; |
|
764 | $sql = 'SELECT owner, ('; |
|
765 | $sql .= 'sum( up ) - sum( down )'; |
|
766 | $sql .= ') AS total'; |
|
767 | $sql .= ' FROM ' . $xoopsDB->prefix('smallworld_vote') . ''; |
|
768 | $sql .= ' GROUP BY owner ORDER by total DESC LIMIT 5'; |
|
769 | $result = $xoopsDB->queryF($sql); |
|
770 | while ($row = $xoopsDB->fetchArray($result)) { |
|
771 | $array[$counter]['counter'] = $counter; |
|
772 | $array[$counter]['img'] = smallworld_getAvatarLink($row['owner'], Smallworld_Gravatar($row['owner'])); |
|
773 | $array[$counter]['user'] = $xoopsUser->getUnameFromId($row['owner']); |
|
774 | $array[$counter]['rating'] = $row['total']; |
|
775 | $array[$counter]['user_link'] = "<a href = '" . XOOPS_URL . '/modules/smallworld/userprofile.php?username=' . $array[$counter]['user'] . "'>"; |
|
776 | $array[$counter]['user_link'] .= $array[$counter]['user'] . ' (' . $array[$counter]['rating'] . ')</a>'; |
|
777 | ++$counter; |
|
778 | } |
|
779 | return $array; |
|
780 | } |
|
781 | ||
782 | /** |
|
783 | * @return array |