mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
- rewrote currencies, achievements, events, factions - GenericPage: * moved more checks from Util * structured and commented GenericPage to be easier to comprehend * added GenericPage::postCache() to modify cached data before display (e.g. update time for events) - fixed: * parsing events from markdown (e.g. articles) * huge padding of minibox headings (css) * Loot passing jsGlobals to template * ItemList::getExtendedCost passing jsGlobals to template * categories for factions * conflicting GenericPage::$subject when displaying 'notFound' * load of typos
107 lines
3.1 KiB
PHP
107 lines
3.1 KiB
PHP
<?php
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
|
|
// menuId 11: Event g_initPath()
|
|
// tabId 0: Database g_initHeader()
|
|
class EventsPage extends GenericPage
|
|
{
|
|
use ListPage;
|
|
|
|
protected $type = TYPE_WORLDEVENT;
|
|
protected $tpl = 'list-page-generic';
|
|
protected $path = [0, 11];
|
|
protected $tabId = 0;
|
|
protected $mode = CACHETYPE_PAGE;
|
|
protected $validCats = [0, 1, 2, 3];
|
|
|
|
public function __construct($pageCall, $pageParam)
|
|
{
|
|
$this->getCategoryFromUrl($pageParam);;
|
|
|
|
parent::__construct();
|
|
|
|
$this->name = Util::ucFirst(Lang::$game['events']);
|
|
}
|
|
|
|
protected function generateContent()
|
|
{
|
|
$condition = [];
|
|
|
|
if ($this->category)
|
|
{
|
|
switch ($this->category[0])
|
|
{
|
|
case 0: $condition[] = ['e.holidayId', 0]; break;
|
|
case 1: $condition[] = ['h.scheduleType', -1]; break;
|
|
case 2: $condition[] = ['h.scheduleType', [0, 1]]; break;
|
|
case 3: $condition[] = ['h.scheduleType', 2]; break;
|
|
}
|
|
}
|
|
|
|
$events = new WorldEventList($condition);
|
|
$this->extendGlobalData($events->getJSGlobals());
|
|
|
|
$this->deps = [];
|
|
foreach ($events->iterate() as $__)
|
|
if ($d = $events->getField('requires'))
|
|
$this->deps[$events->id] = $d;
|
|
|
|
$this->lvData[] = array(
|
|
'file' => 'event',
|
|
'data' => $events->getListviewData(),
|
|
'params' => ['tabs' => '$myTabs']
|
|
);
|
|
|
|
$this->lvData[] = array(
|
|
'file' => 'calendar',
|
|
'data' => array_filter($events->getListviewData(), function($x) {return $x['id'] > 0;}),
|
|
'params' => array(
|
|
'tabs' => '$myTabs',
|
|
'hideCount' => 1
|
|
)
|
|
);
|
|
}
|
|
|
|
protected function generateTitle()
|
|
{
|
|
array_unshift($this->title, $this->name);
|
|
if ($this->category)
|
|
array_unshift($this->title, Lang::$event['category'][$this->category[0]]);
|
|
}
|
|
|
|
protected function generatePath()
|
|
{
|
|
if ($this->category)
|
|
$this->path[] = $this->category[0];
|
|
}
|
|
|
|
protected function postCache()
|
|
{
|
|
// recalculate dates with now()
|
|
foreach ($this->lvData as &$views)
|
|
{
|
|
foreach ($views['data'] as &$data)
|
|
{
|
|
// is a followUp-event
|
|
if (!empty($this->deps[$data['id']]))
|
|
{
|
|
$data['startDate'] = $data['endDate'] = false;
|
|
unset($data['_date']);
|
|
continue;
|
|
}
|
|
|
|
$updated = WorldEventList::updateDates($data['_date']);
|
|
unset($data['_date']);
|
|
$data['startDate'] = $updated['start'] ? date(Util::$dateFormatInternal, $updated['start']) : false;
|
|
$data['endDate'] = $updated['end'] ? date(Util::$dateFormatInternal, $updated['end']) : false;
|
|
$data['rec'] = $updated['rec'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|