Example #1
0
File: pets.php Project: saqar/aowow
 protected function generateContent()
 {
     $conditions = [];
     if (!User::isInGroup(U_GROUP_EMPLOYEE)) {
         $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
     }
     if ($this->category) {
         $conditions[] = ['type', (int) $this->category[0]];
     }
     $pets = new PetList($conditions);
     if (!$pets->error) {
         $this->extendGlobalData($pets->getJSGlobals(GLOBALINFO_RELATED));
         $params = ['visibleCols' => "\$['abilities']"];
         if (!$pets->hasDiffFields(['type'])) {
             $params['hiddenCols'] = "\$['type']";
         }
         $this->lvTabs[] = array('file' => 'pet', 'data' => $pets->getListviewData(), 'params' => $params);
     }
 }
Example #2
0
 private function _searchPet($cndBase)
 {
     $result = [];
     $cnd = array_merge($cndBase, [$this->createLookup()]);
     $pets = new PetList($cnd);
     if ($data = $pets->getListviewData()) {
         if ($this->searchMask & SEARCH_TYPE_OPEN) {
             foreach ($pets->iterate() as $__) {
                 $data[$pets->id]['param1'] = $pets->getField('iconString');
             }
         }
         $result = array('type' => TYPE_PET, 'appendix' => ' (Pet)', 'matches' => $pets->getMatches(), 'file' => PetList::$brickFile, 'data' => $data, 'params' => []);
         if ($pets->getMatches() > $this->maxResults) {
             $result['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_petsfound', $pets->getMatches(), $this->maxResults);
             $result['params']['_truncated'] = 1;
         }
     }
     return $result;
 }
Example #3
0
 private function _searchPet($cndBase)
 {
     $cnd = array_merge($cndBase, [$this->createLookup()]);
     $pets = new PetList($cnd);
     if ($data = $pets->getListviewData()) {
         $osInfo = [TYPE_PET, ' (Pet)', $pets->getMatches(), []];
         $result = array('data' => array_values($data), 'computeDataFunc' => '$_');
         if ($this->searchMask & SEARCH_TYPE_OPEN) {
             foreach ($pets->iterate() as $id => $__) {
                 $osInfo[3][$id] = $pets->getField('iconString');
             }
         }
         if ($pets->getMatches() > $this->maxResults) {
             $result['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_petsfound', $pets->getMatches(), $this->maxResults);
             $result['_truncated'] = 1;
         }
         return ['pet', $result, 'petFoodCol', $osInfo];
     }
     return false;
 }