From: Reini U. <ru...@us...> - 2008-01-24 19:32:59
|
Update of /cvsroot/phpwiki/phpwiki/lib/wikilens In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2068/lib/wikilens Modified Files: Buddy.php Log Message: simple adhoc buddies - SQL Index: Buddy.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/wikilens/Buddy.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -2 -b -p -d -r1.3 -r1.4 --- Buddy.php 21 Nov 2004 11:59:26 -0000 1.3 +++ Buddy.php 24 Jan 2008 19:33:03 -0000 1.4 @@ -39,10 +39,38 @@ function getBuddies($fromUser, $dbi, $th $START_DELIM = $thePage . _("Buddies:"); $DELIM = ","; - $buddies_array = getPageTextData($fromUser, $dbi, $START_DELIM, $DELIM); if (count($buddies_array) == 0 and $thePage !== "") { $buddies_array = getPageTextData($fromUser, $dbi, _("Buddies:"), $DELIM); } - return $buddies_array; + if (empty($buddies_array)) { + // 1. calculate buddies automatically from the 10 top raters with the most numratings (min. 5 ratings). + // of all pages (only SQL) + // or 2. from 10 random raters of this page (non-SQL) + // or 3. from all members of your group (department) if <= 20 + $rdbi = RatingsDb::getTheRatingsDb(); + $dimension = ''; + if (RATING_STORAGE == 'SQL') { + //$result = $this->_sql_get_rating_result($dimension, null, null, 'numrating', "rater"); + $dbh = &$rdbi->_sqlbackend; + extract($dbh->_table_names); + $query = "SELECT raterpage, COUNT(rateepage) as numrating" + . " FROM $rating_tbl r, $page_tbl p " + . " WHERE ratingvalue > 0 AND numrating > 5" + . " GROUP BY raterpage" + . " ORDER BY numrating" + . " LIMIT 10"; + $result = $dbh->query($query); + } else { + // from 10 random raters of this page (non-SQL) + ; + } + + } + $result = array(); + if (is_array($buddies_array)) + foreach ($buddies_array as $userid) { + $result[] = new RatingsUser($userid); + } + return $result; } @@ -142,4 +170,7 @@ function AverageRating($dbi, $page, $use // $Log$ +// Revision 1.4 2008/01/24 19:33:03 rurban +// simple adhoc buddies - SQL +// // Revision 1.3 2004/11/21 11:59:26 rurban // remove final \n to be ob_cache independent |