protected function generateContent() { $conditions = []; if (!User::isInGroup(U_GROUP_EMPLOYEE)) { $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; } if ($_ = $this->filterObj->getConditions()) { $conditions[] = $_; } $itemsets = new ItemsetList($conditions); $this->extendGlobalData($itemsets->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(); $this->addJS('?data=weight-presets&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']); $lv = array('file' => 'itemset', 'data' => $itemsets->getListviewData(), 'params' => []); if (!empty($this->filter['fi']['extraCols'])) { $lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; } // create note if search limit was exceeded if ($itemsets->getMatches() > CFG_SQL_LIMIT_DEFAULT) { $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), CFG_SQL_LIMIT_DEFAULT); $lv['params']['_truncated'] = 1; } if ($this->filterObj->error) { $lv['params']['_errors'] = '$1'; } $this->lvTabs[] = $lv; // sort for dropdown-menus Lang::sort('itemset', 'notes', SORT_NATURAL); Lang::sort('game', 'si'); }
private function _searchItemset($cndBase, &$shared) { $result = []; $cnd = array_merge($cndBase, [is_int($this->query) ? ['id', $this->query] : $this->createLookup()]); $sets = new ItemsetList($cnd); if ($data = $sets->getListviewData()) { if ($this->searchMask & SEARCH_TYPE_REGULAR) { $this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF)); } if ($this->searchMask & SEARCH_TYPE_OPEN) { foreach ($sets->iterate() as $__) { $data[$sets->id]['param1'] = $sets->getField('quality'); } } $result = array('type' => TYPE_ITEMSET, 'appendix' => ' (Item Set)', 'matches' => $sets->getMatches(), 'file' => ItemsetList::$brickFile, 'data' => $data, 'params' => []); $shared['pcsToSet'] = $sets->pieceToSet; if ($sets->getMatches() > $this->maxResults) { $result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsetsfound', $sets->getMatches(), $this->maxResults); $result['params']['_truncated'] = 1; } if (isset($result['params']['note'])) { $result['params']['note'] .= ' + LANG.dash + $WH.sprintf(LANG.lvnote_filterresults, \'?itemsets&filter=na=' . urlencode($this->search) . '\')'; } else { $result['params']['note'] = '$$WH.sprintf(LANG.lvnote_filterresults, \'?itemsets&filter=na=' . urlencode($this->search) . '\')'; } } return $result; }
private function _searchItemset($cndBase, &$shared) { $cnd = array_merge($cndBase, [is_int($this->query) ? ['id', $this->query] : $this->createLookup()]); $sets = new ItemsetList($cnd); if ($data = $sets->getListviewData()) { if ($this->searchMask & SEARCH_TYPE_REGULAR) { $this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF)); } $result['data'] = array_values($data); $osInfo = [TYPE_ITEMSET, ' (Item Set)', $sets->getMatches()]; if ($this->searchMask & SEARCH_TYPE_OPEN) { foreach ($sets->iterate() as $id => $__) { $osInfo[3][$id] = $sets->getField('quality'); } } $shared['pcsToSet'] = $sets->pieceToSet; if ($sets->getMatches() > $this->maxResults) { $result['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsetsfound', $sets->getMatches(), $this->maxResults); $result['_truncated'] = 1; } if (isset($result['note'])) { $result['note'] .= ' + LANG.dash + $WH.sprintf(LANG.lvnote_filterresults, \'?itemsets&filter=na=' . urlencode($this->search) . '\')'; } else { $result['note'] = '$$WH.sprintf(LANG.lvnote_filterresults, \'?itemsets&filter=na=' . urlencode($this->search) . '\')'; } return ['itemset', $result, null, $osInfo]; } return false; }