protected function generateContent() { $condition = []; if (!User::isInGroup(U_GROUP_EMPLOYEE)) { $condition[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; } 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; } } $data = array_values($events->getListviewData()); $this->lvTabs[] = ['event', ['data' => $data]]; if ($_ = array_filter($data, function ($x) { return $x['id'] > 0; })) { $this->lvTabs[] = ['calendar', array('data' => $_, 'hideCount' => 1)]; } }
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 generateContent() { $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); /***********/ /* Infobox */ /***********/ $this->infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')); // boss if ($_ = $this->subject->getField('bossCreature')) { $this->extendGlobalIds(TYPE_NPC, $_); $this->infobox[] = Lang::npc('rank', 3) . Lang::main('colon') . '[npc=' . $_ . ']'; } // display internal id to staff if (User::isInGroup(U_GROUP_STAFF)) { $this->infobox[] = 'Event-Id' . Lang::main('colon') . $this->eId; } /****************/ /* Main Content */ /****************/ // no entry in ?_articles? use default HolidayDescription if ($this->hId && empty($this->article)) { $this->article = ['text' => Util::jsEscape($this->subject->getField('description', true)), 'params' => []]; } $this->headIcons = [$this->subject->getField('iconString')]; $this->redButtons = array(BUTTON_WOWHEAD => $this->hId > 0, BUTTON_LINKS => true); /**************/ /* Extra Tabs */ /**************/ $hasFilter = in_array($this->hId, [372, 283, 285, 353, 420, 400, 284, 201, 374, 409, 141, 324, 321, 424, 335, 327, 341, 181, 404, 398, 301]); // tab: npcs if ($npcIds = DB::World()->selectCol('SELECT id AS ARRAY_KEY, IF(ec.eventEntry > 0, 1, 0) AS added FROM creature c, game_event_creature ec WHERE ec.guid = c.guid AND ABS(ec.eventEntry) = ?d', $this->eId)) { $creatures = new CreatureList(array(['id', array_keys($npcIds)])); if (!$creatures->error) { $data = $creatures->getListviewData(); foreach ($data as &$d) { $d['method'] = $npcIds[$d['id']]; } $tabData = ['data' => array_values($data)]; if ($hasFilter) { $tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=38;crs=' . $this->hId . ';crv=0'); } $this->lvTabs[] = ['creature', $tabData]; } } // tab: objects if ($objectIds = DB::World()->selectCol('SELECT id AS ARRAY_KEY, IF(eg.eventEntry > 0, 1, 0) AS added FROM gameobject g, game_event_gameobject eg WHERE eg.guid = g.guid AND ABS(eg.eventEntry) = ?d', $this->eId)) { $objects = new GameObjectList(array(['id', array_keys($objectIds)])); if (!$objects->error) { $data = $objects->getListviewData(); foreach ($data as &$d) { $d['method'] = $objectIds[$d['id']]; } $tabData = ['data' => array_values($data)]; if ($hasFilter) { $tabData['note'] = sprintf(Util::$filterResultString, '?objects&filter=cr=16;crs=' . $this->hId . ';crv=0'); } $this->lvTabs[] = ['object', $tabData]; } } // tab: achievements if ($_ = $this->subject->getField('achievementCatOrId')) { $condition = $_ > 0 ? [['category', $_]] : [['id', -$_]]; $acvs = new AchievementList($condition); if (!$acvs->error) { $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $tabData = array('data' => array_values($acvs->getListviewData()), 'visibleCols' => ['category']); if ($hasFilter) { $tabData['note'] = sprintf(Util::$filterResultString, '?achievements&filter=cr=11;crs=' . $this->hId . ';crv=0'); } $this->lvTabs[] = ['achievement', $tabData]; } } $itemCnd = []; if ($this->hId) { $itemCnd = array('OR', ['eventId', $this->eId]); // tab: quests (by table, go & creature) $quests = new QuestList(array(['eventId', $this->eId])); if (!$quests->error) { $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS)); $tabData = ['data' => array_values($quests->getListviewData())]; if ($hasFilter) { $tabData['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=33;crs=' . $this->hId . ';crv=0'); } $this->lvTabs[] = ['quest', $tabData]; $questItems = []; foreach (array_column($quests->rewards, TYPE_ITEM) as $arr) { $questItems = array_merge($questItems, $arr); } foreach (array_column($quests->requires, TYPE_ITEM) as $arr) { $questItems = array_merge($questItems, $arr); } if ($questItems) { $itemCnd[] = ['id', $questItems]; } } } // items from creature if ($npcIds && !$creatures->error) { // vendor $cIds = $creatures->getFoundIDs(); if ($sells = DB::World()->selectCol('SELECT item FROM npc_vendor nv WHERE entry IN (?a) UNION SELECT item FROM game_event_npc_vendor genv JOIN creature c ON genv.guid = c.guid WHERE c.id IN (?a)', $cIds, $cIds)) { $itemCnd[] = ['id', $sells]; } } // tab: items // not checking for loot ... cant distinguish between eventLoot and fillerCrapLoot if ($itemCnd) { $eventItems = new ItemList($itemCnd); if (!$eventItems->error) { $this->extendGlobalData($eventItems->getJSGlobals(GLOBALINFO_SELF)); $tabData = ['data' => array_values($eventItems->getListviewData())]; if ($hasFilter) { $tabData['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=160;crs=' . $this->hId . ';crv=0'); } $this->lvTabs[] = ['item', $tabData]; } } // tab: see also (event conditions) if ($rel = DB::World()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, prerequisite_event, -eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $this->eId, $this->eId, $this->eId)) { $list = []; array_walk($rel, function ($v, $k) use(&$list) { if ($v > 0) { $list[] = $v; } else { if ($v === null) { trigger_error('game_event_prerequisite: this event has itself as prerequisite', E_USER_WARNING); } } }); if ($list) { $relEvents = new WorldEventList(array(['id', $list])); $this->extendGlobalData($relEvents->getJSGlobals()); $relData = $relEvents->getListviewData(); foreach ($relEvents->getFoundIDs() as $id) { $relData[$id]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, $this->eId]]; } $this->extendGlobalData($this->subject->getJSGlobals()); foreach ($rel as $r) { if ($r <= 0) { continue; } $this->extendGlobalIds(TYPE_WORLDEVENT, $r); $d = $this->subject->getListviewData(); $d[$this->eId]['condition'][0][$this->typeId][] = [[-CND_ACTIVE_EVENT, $r]]; $relData = array_merge($relData, $d); } $this->lvTabs[] = ['event', array('data' => array_values($relData), 'id' => 'see-also', 'name' => '$LANG.tab_seealso', 'hiddenCols' => ['date'], 'extraCols' => ['$Listview.extraCols.condition'])]; } } }