123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class FavoritedAction extends Action
- {
- var $page = null;
-
- function title()
- {
- if ($this->page == 1) {
-
- return _('Popular notices');
- } else {
-
-
- return sprintf(_('Popular notices, page %d'), $this->page);
- }
- }
-
- function getInstructions()
- {
-
- return _('The most popular notices on the site right now.');
- }
-
- function isReadOnly($args)
- {
- return true;
- }
-
- function prepare(array $args = array())
- {
- parent::prepare($args);
- $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
- common_set_returnto($this->selfUrl());
- return true;
- }
-
- function handle()
- {
- parent::handle();
- $this->showPage();
- }
-
- function showPageNotice()
- {
- $instr = $this->getInstructions();
- $output = common_markup_to_html($instr);
- $this->elementStart('div', 'instructions');
- $this->raw($output);
- $this->elementEnd('div');
- }
- function showEmptyList()
- {
-
- $message = _('Favorite notices appear on this page but no one has favorited one yet.') . ' ';
- if (common_logged_in()) {
-
- $message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.');
- }
- else {
-
-
- $message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!');
- }
- $this->elementStart('div', 'guide');
- $this->raw(common_markup_to_html($message));
- $this->elementEnd('div');
- }
-
- function showContent()
- {
- $stream = new PopularNoticeStream($this->scoped);
- $notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE+1);
- $nl = new NoticeList($notice, $this);
- $cnt = $nl->show();
- if ($cnt == 0) {
- $this->showEmptyList();
- }
- $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
- $this->page, 'favorited');
- }
- }
|