* @category Widget
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009,2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
*/
class PopularNoticeSection extends NoticeSection
{
+ protected $viewer;
+
+ function __construct($out, $viewer)
+ {
+ parent::__construct($out);
+ $this->viewer = $viewer;
+ }
+
function getNotices()
{
- $pop = new Popularity();
- if (!empty($this->out->tag)) {
- $pop->tag = $this->out->tag;
- }
- $pop->limit = NOTICES_PER_SECTION;
- $pop->expiry = 1200;
- return $pop->getNotices();
+ $stream = new PopularNoticeStream($this->viewer);
+ return $stream->getNotices(0, NOTICES_PER_SECTION + 1);
}
function title()
function moreUrl()
{
- return common_local_url('favorited');
+ if (common_config('singleuser', 'enabled')) {
+ $user = User::singleUser();
+ common_local_url('showfavorites', array('nickname' =>
+ $user->nickname));
+ } else {
+ return common_local_url('favorited');
+ }
}
}