public function getEntries() { $offset = $this->request->getInt('offset', 0); $weeks = $this->request->getInt('weeks', 2); $entries = GamingCalendar::loadEntries($offset, $weeks); $this->response->setVal('entries', $entries); $this->response->setCacheValidity(3600, 3600, array(WikiaResponse::CACHE_TARGET_BROWSER, WikiaResponse::CACHE_TARGET_VARNISH)); }
public function index() { //@todo move this to init when init supports exceptions // Boilerplate special page permissions if ($this->wg->user->isBlocked()) { $this->wg->out->blockedPage(); return false; // skip rendering } if (!$this->wg->user->isAllowed('specialgamingcalendar')) { $this->displayRestrictionError(); return false; } if (wfReadOnly() && !wfAutomaticReadOnly()) { $this->wg->out->readOnlyPage(); return false; } $this->response->addAsset('resources/wikia/libraries/jquery-ui/jquery-ui-1.8.14.custom.js'); $this->response->addAsset('extensions/wikia/GamingCalendar/js/GamingCalendarSpecialPage.js'); $this->response->addAsset('extensions/wikia/GamingCalendar/css/GamingCalendarSpecialPage.scss'); $type = $this->getVal('type', null); $year = $this->getVal('year', null); $month = $this->getVal('month', null); $date = null; $entries = array(); if (!empty($type) && !empty($year) && !empty($month)) { // get entries $date = date_create(); date_date_set($date, $year, $month, 1); $entries = GamingCalendar::loadEntries(0, 5, $type, date_timestamp_get($date), false); } $typeName = GamingCalendar::getCalendarName($type); $this->setVal('typeName', $typeName); $this->setVal('type', $type); $this->setVal('year', $year); $this->setVal('month', $month); $this->setVal('date', $date ? date_timestamp_get($date) : ''); $this->setVal('types', GamingCalendar::getCalendarTypes()); $this->setVal('entries', $entries); }