false, 'exclude' => false, 'info' => 'pagename,top3recs', 'dimension' => 0, ); } // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); if (in_array('top3recs', split(',', $info))) { require_once('lib/wikilens/Buddy.php'); require_once('lib/wikilens/PageListColumns.php'); $active_user = $request->getUser(); $active_userid = $active_user->_userid; // if userids is null or empty, fill it with just the active user if (!isset($userids) || !is_array($userids) || !count($userids)) { // TKL: moved getBuddies call inside if statement because it was // causing the userids[] parameter to be ignored if (is_string($active_userid) && strlen($active_userid) && $active_user->isSignedIn()) { $userids = getBuddies($active_userid, $dbi); } else { $userids = array(); // XXX: this wipes out the category caption... $caption = _("You must be logged in to view ratings."); } } // find out which users we should show ratings for $allowed_users = array(); foreach ($userids as $userid) { $user = new RatingsUser($userid); if ($user->allow_view_ratings($active_user)) { array_push($allowed_users, $user); } // PHP's silly references... (the behavior with this line commented // out is... odd) unset($user); } //DONE: //What we really want is passing the pagelist object to the column //$top3 = new _PageList_Column_top3recs('top3recs', _("Top Recommendations"), // 'left', 0, $allowed_users); $options = array('dimension' => $dimension, 'users' => $allowed_users); } else { $options = array(); } if (empty($pages)) return ''; $pagelist = new PageList($info, false, $options); // FIXME: This should be not neccessary with the new custom pagelist columns /* if (!empty($options)) { $pagelist->addColumnObject(new _PageList_Column_top3recs('custom:top3recs', _("Top Recommendations"), 'left', $pagelist)); } */ if (is_string($exclude) and !empty($exclude)) { $exclude = explodePageList($exclude); // $argstr = preg_replace("/exclude=\S*\s/", "", $argstr); } $pages_array = is_string($pages) ? explodePageList($pages) : (is_array($pages) ? $pages : array()); foreach ($pages_array as $pagename) { if (empty($exclude) or !in_array($pagename, $exclude)) { $page = $dbi->getPage($pagename); $pagelist->addPage($page); } } return $pagelist; } }; // $Log: not supported by cvs2svn $ // Revision 1.4 2004/07/08 20:30:07 rurban // plugin->run consistency: request as reference, added basepage. // encountered strange bug in AllPages (and the test) which destroys ->_dbi // // Revision 1.3 2004/06/28 18:58:18 rurban // fixed another pass-by-reference // // Revision 1.2 2004/06/18 14:42:17 rurban // added wikilens libs (not yet merged good enough, some work for DanFr) // // Revision 1.1 2004/06/08 13:49:43 rurban // List pages that are explicitly given as the pages argument, by DanFr // // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>