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();
 }
Example #2
0
 /**
  * Content area
  *
  * Shows the list of popular notices
  *
  * @return void
  */
 function showContent()
 {
     $pop = new Popularity();
     $pop->offset = ($this->page - 1) * NOTICES_PER_PAGE;
     $pop->limit = NOTICES_PER_PAGE;
     $pop->expiry = 600;
     $notice = $pop->getNotices();
     $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');
 }
Example #3
0
<?php

Route::get('popularity/{timeRange?}', array('as' => 'popularity', function ($timeRange = null) {
    $items = null;
    switch ($timeRange) {
        case 'day':
            $items = Popularity::getStats()->paginate();
            break;
        case 'week':
            $items = Popularity::getStats('seven_days_stats')->paginate();
            break;
        case 'month':
            $items = Popularity::getStats('thirty_days_stats')->paginate();
            break;
        case 'all_time':
            $items = Popularity::getStats('all_time_stats')->paginate();
            break;
        default:
            return Redirect::to('popularity/day');
    }
    $topItems = Popularity::getStats('one_day_stats', 'DESC', '', 3)->get();
    return View::make('popularity::item_list')->with(array('items' => $items, 'topItems' => $topItems));
}));