protected function generateContent() { $tabData = array('data' => [], 'name' => Util::ucFirst(Lang::game('enchantments'))); $conditions = []; if (!User::isInGroup(U_GROUP_EMPLOYEE)) { $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; } if ($_ = $this->filterObj->getConditions()) { $conditions[] = $_; } $ench = new EnchantmentList($conditions); $tabData['data'] = array_values($ench->getListviewData()); $this->extendGlobalData($ench->getJSGlobals()); // recreate form selection $this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $this->filter['fi'] = $this->filterObj->getForm(); $xCols = $this->filterObj->getForm('extraCols', true); foreach (Util::$itemFilter as $fiId => $str) { if (array_column($tabData['data'], $str)) { $xCols[] = $fiId; } } if (array_column($tabData['data'], 'dmg')) { $xCols[] = 34; } if ($xCols) { $this->filter['fi']['extraCols'] = "fi_extraCols = " . Util::toJSON(array_values(array_unique($xCols))) . ";"; } if (!empty($this->filter['fi']['extraCols'])) { $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; } if ($ench->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_enchantmentsfound', $ench->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['_truncated'] = 1; } if (array_filter(array_column($tabData['data'], 'spells'))) { $tabData['visibleCols'] = ['trigger']; } if (!$ench->hasSetFields(['skillLine'])) { $tabData['hiddenCols'] = ['skill']; } if ($this->filterObj->error) { $tabData['_errors'] = '$1'; } $this->lvTabs[] = ['enchantment', $tabData, 'enchantment']; }
private function _searchEnchantment($cndBase) { $result = []; $cnd = array_merge($cndBase, [$this->createLookup(['name_loc' . User::$localeId])]); $enchantment = new EnchantmentList($cnd); if ($data = $enchantment->getListviewData()) { $this->extendGlobalData($enchantment->getJSGlobals()); $result = array('type' => TYPE_ENCHANTMENT, 'appendix' => ' (Enchantment)', 'matches' => $enchantment->getMatches(), 'file' => EnchantmentList::$brickFile, 'data' => $data, 'params' => []); if (array_filter(array_column($result['data'], 'spells'))) { $result['params']['visibleCols'] = '$[\'trigger\']'; } if (!$enchantment->hasSetFields(['skillLine'])) { $result['params']['hiddenCols'] = '$[\'skill\']'; } if ($enchantment->getMatches() > $this->maxResults) { $result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_enchantmentsfound', $enchantment->getMatches(), $this->maxResults); $result['params']['_truncated'] = 1; } } return $result; }
private function _searchEnchantment($cndBase) { $cnd = array_merge($cndBase, [$this->createLookup(['name_loc' . User::$localeId])]); $enchantment = new EnchantmentList($cnd); if ($data = $enchantment->getListviewData()) { $this->extendGlobalData($enchantment->getJSGlobals()); $osInfo = [TYPE_ENCHANTMENT, ' (Enchantment)', $enchantment->getMatches()]; $result = array('data' => array_values($data), 'name' => Util::ucFirst(Lang::game('enchantments'))); if (array_filter(array_column($result['data'], 'spells'))) { $result['visibleCols'] = ['trigger']; } if (!$enchantment->hasSetFields(['skillLine'])) { $result['hiddenCols'] = ['skill']; } if ($enchantment->getMatches() > $this->maxResults) { $result['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_enchantmentsfound', $enchantment->getMatches(), $this->maxResults); $result['_truncated'] = 1; } return ['enchantment', $result, 'enchantment', $osInfo]; } return false; }