/** * @param $db * @param $dca * @param $table * @return array|bool */ public function prepareIndexData($db, $dca, $table) { // create do string $doStr = Helper::getDoParam($table); $doTable = $doStr != '' ? $doStr : ''; // if (!$db['id'] || !$table || !$doTable) { return false; } // set config $arr = array('dca' => $table, 'tstamp' => time(), 'doTable' => $doTable, 'ptable' => $dca['config']['ptable'] ? $dca['config']['ptable'] : '', 'ctable' => $dca['config']['ctable'] ? serialize($dca['config']['ctable']) : '', 'docId' => $db['id'], 'pid' => isset($db['pid']) ? $db['pid'] : 0, 'extension' => $db['extension'] ? $db['extension'] : '', 'tags' => $db['ps_tags'] ? $db['ps_tags'] : '', 'blocked' => $db['ps_block_item'] ? $db['ps_block_item'] : '', 'blocked_ug' => $db['ps_block_usergroup'] ? $db['ps_block_usergroup'] : ''); /** * set shortcut */ $shortcut = ''; if ($this->modules[$doTable]) { $shortcut = $this->modules[$doTable]['shortcut'] ? $this->modules[$doTable]['shortcut'] : ''; } $arr['shortcut'] = $shortcut; if ($this->modules[$doTable] && is_array($this->modules[$doTable]['setCustomShortcut'])) { foreach ($this->modules[$doTable]['setCustomShortcut'] as $callable) { $this->import($callable[0]); $arr['shortcut'] = $this->{$callable[0]}->{$callable[1]}($table, $db, $arr, $dca); } } /** * set custom icon callbacks */ if ($this->modules[$doTable] && is_array($this->modules[$doTable]['setCustomIcon'])) { foreach ($this->modules[$doTable]['setCustomIcon'] as $callable) { $this->import($callable[0]); $this->modules[$doTable]['icon'] = $this->{$callable[0]}->{$callable[1]}($table, $db, $arr, $dca); } } //add icon $arr['icon'] = $this->getIcon($doTable); /** * exception callbacks */ if ($this->modules[$doTable] && is_array($this->modules[$doTable]['prepareDataException'])) { foreach ($this->modules[$doTable]['prepareDataException'] as $callable) { $this->import($callable[0]); $arr = $this->{$callable[0]}->{$callable[1]}($arr, $db, $table); } } // set type $sType = $this->setType($db); $arr['type'] = $sType ? $sType : ''; // set search content $sCntent = $this->setSearchContent($db, $arr['doTable']); $arr['search_content'] = $sCntent ? $sCntent : ''; $sTitle = $this->setTitle($db, $arr['doTable'], $table); // set title $arr['title'] = $sTitle ? $sTitle : 'no title'; // add be module dyn if useParentAsBE is true if ($this->modules[$doTable]['useParentAsBE']) { $do = Helper::getDoParam($arr['ptable']); $arr['doTable'] = $do; if (!$arr['doTable']) { return false; } } return $arr; }