protected function generateContent() { /***********/ /* Infobox */ /***********/ $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); if ($this->subject->getField('side') == SIDE_ALLIANCE) { $infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-alliance]' . Lang::game('si', SIDE_ALLIANCE) . '[/span]'; } else { if ($this->subject->getField('side') == SIDE_HORDE) { $infobox[] = Lang::main('side') . Lang::main('colon') . '[span class=icon-horde]' . Lang::game('si', SIDE_HORDE) . '[/span]'; } else { $infobox[] = Lang::main('side') . Lang::main('colon') . Lang::game('si', SIDE_BOTH); } } if ($g = $this->subject->getField('gender')) { $infobox[] = Lang::main('gender') . Lang::main('colon') . '[span class=icon-' . ($g == 2 ? 'female' : 'male') . ']' . Lang::main('sex', $g) . '[/span]'; } if ($e = $this->subject->getField('holidayId')) { $infobox[] = Lang::game('eventShort') . Lang::main('colon') . '[url=?event=' . $e . ']' . WorldEventList::getName($e) . '[/url]'; } /****************/ /* Main Content */ /****************/ $this->infobox = $infobox ? '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]' : null; $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; $this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => ['name' => $this->nameFixed]); // factionchange-equivalent if ($pendant = DB::World()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_titles WHERE alliance_id = ?d OR horde_id = ?d', $this->typeId, $this->typeId, $this->typeId)) { $altTitle = new TitleList(array(['id', abs($pendant)])); if (!$altTitle->error) { $this->transfer = sprintf(Lang::title('_transfer'), $altTitle->id, $altTitle->getHtmlizedName(), $pendant > 0 ? 'alliance' : 'horde', $pendant > 0 ? Lang::game('si', 1) : Lang::game('si', 2)); } } /**************/ /* Extra Tabs */ /**************/ // tab: quest source $quests = new QuestList(array(['rewardTitleId', $this->typeId])); if (!$quests->error) { $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_REWARDS)); $this->lvTabs[] = array('file' => 'quest', 'data' => $quests->getListviewData(), 'params' => array('id' => 'reward-from-quest', 'name' => '$LANG.tab_rewardfrom', 'hiddenCols' => "\$['experience', 'money']", 'visibleCols' => "\$['category']")); } // tab: achievement source if ($aIds = DB::World()->selectCol('SELECT entry FROM achievement_reward WHERE title_A = ?d OR title_H = ?d', $this->typeId, $this->typeId)) { $acvs = new AchievementList(array(['id', $aIds])); if (!$acvs->error) { $this->extendGlobalData($acvs->getJSGlobals()); $this->lvTabs[] = array('file' => 'achievement', 'data' => $acvs->getListviewData(), 'params' => array('id' => 'reward-from-achievement', 'name' => '$LANG.tab_rewardfrom', 'visibleCols' => "\$['category']", 'sort' => "\$['reqlevel', 'name']")); } } // tab: criteria of (to be added by TC) }
protected function postCache() { // recalculate dates with now() foreach ($this->lvTabs 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']; } } }
private function _searchWorldEvent($cndBase) { $result = []; $cnd = array_merge($cndBase, array(array('OR', $this->createLookup(['h.name_loc' . User::$localeId]), ['AND', $this->createLookup(['e.description']), ['e.holidayId', 0]]))); $wEvents = new WorldEventList($cnd); if ($data = $wEvents->getListviewData()) { if ($this->searchMask & SEARCH_TYPE_REGULAR) { $this->extendGlobalData($wEvents->getJSGlobals()); } // as allways: dates are updated in postCache-step $result = array('type' => TYPE_WORLDEVENT, 'appendix' => ' (World Event)', 'matches' => $wEvents->getMatches(), 'file' => WorldEventList::$brickFile, 'data' => $data, 'params' => []); if ($wEvents->getMatches() > $this->maxResults) { // $result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $wEvents->getMatches(), $this->maxResults); $result['params']['_truncated'] = 1; } } return $result; }
private function _searchWorldEvent($cndBase) { $cnd = array_merge($cndBase, array(array('OR', $this->createLookup(['h.name_loc' . User::$localeId]), ['AND', $this->createLookup(['e.description']), ['e.holidayId', 0]]))); $wEvents = new WorldEventList($cnd); if ($data = $wEvents->getListviewData()) { if ($this->searchMask & SEARCH_TYPE_REGULAR) { $this->extendGlobalData($wEvents->getJSGlobals()); } $result['data'] = array_values($data); $osInfo = [TYPE_WORLDEVENT, ' (World Event)', $wEvents->getMatches()]; // as allways: dates are updated in postCache-step if ($wEvents->getMatches() > $this->maxResults) { // $result['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $wEvents->getMatches(), $this->maxResults); $result['_truncated'] = 1; } return ['event', $result, null, $osInfo]; } return false; }
protected function postCache() { // update dates to now() $updated = WorldEventList::updateDates($this->dates); if ($this->mode == CACHE_TYPE_TOOLTIP) { return array(date(Lang::main('dateFmtLong'), $updated['start']), date(Lang::main('dateFmtLong'), $updated['end'])); } else { if ($this->hId) { Util::$wowheadLink = 'http://' . Util::$subDomains[User::$localeId] . '.wowhead.com/event=' . $this->hId; } /********************/ /* finalize infobox */ /********************/ // start if ($updated['start']) { array_push($this->infobox, Lang::event('start') . Lang::main('colon') . date(Lang::main('dateFmtLong'), $updated['start'])); } // end if ($updated['end']) { array_push($this->infobox, Lang::event('end') . Lang::main('colon') . date(Lang::main('dateFmtLong'), $updated['end'])); } // occurence if ($updated['rec'] > 0) { array_push($this->infobox, Lang::event('interval') . Lang::main('colon') . Util::formatTime($updated['rec'] * 1000)); } // in progress if ($updated['start'] < time() && $updated['end'] > time()) { array_push($this->infobox, '[span class=q2]' . Lang::event('inProgress') . '[/span]'); } $this->infobox = '[ul][li]' . implode('[/li][li]', $this->infobox) . '[/li][/ul]'; /***************************/ /* finalize related events */ /***************************/ foreach ($this->lvTabs as &$view) { if ($view[0] != WorldEventList::$brickFile) { continue; } foreach ($view[1]['data'] as &$data) { $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']; } } } }
protected function postCache() { /********************/ /* finalize infobox */ /********************/ // update dates to now() $updated = WorldEventList::updateDates($this->dates); // start if ($updated['start']) { array_push($this->infobox, Lang::event('start') . Lang::main('colon') . date(Lang::main('dateFmtLong'), $updated['start'])); } // end if ($updated['end']) { array_push($this->infobox, Lang::event('end') . Lang::main('colon') . date(Lang::main('dateFmtLong'), $updated['end'])); } // occurence if ($updated['rec'] > 0) { array_push($this->infobox, Lang::event('interval') . Lang::main('colon') . Util::formatTime($updated['rec'] * 1000)); } // in progress if ($updated['start'] < time() && $updated['end'] > time()) { array_push($this->infobox, '[span class=q2]' . Lang::event('inProgress') . '[/span]'); } $this->infobox = '[ul][li]' . implode('[/li][li]', $this->infobox) . '[/li][/ul]'; /***************************/ /* finalize related events */ /***************************/ foreach ($this->lvTabs as &$view) { if ($view['file'] != WorldEventList::$brickFile) { continue; } foreach ($view['data'] as &$data) { $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']; } } }