/** * load custom data for tasks * Note: should be removed after tasks upgraded and custom task tables removed */ protected function loadCustomData() { parent::loadCustomData(); $d =& $this->data; if (empty($d['data'])) { $d['data'] = array(); } // $cd = &$d['data']; //custom data // $sd = &$d['sys_data']; //sys_data /* add possible action flags*/ \CB\Tasks::setTaskActionFlags($d); }
/** * load template custom data */ protected function loadCustomData() { parent::loadCustomData(); $d =& $this->data; if (empty($d['target_id'])) { return; } if (empty($d['data'])) { $d['data'] = array(); } $d['target_type'] = Objects::getType($d['target_id']); }
/** * load custom data for $this->id * * @return void */ protected function loadCustomData() { parent::loadCustomData(); $d =& $this->data; $cd = DM\Files::getContentData($this->id); if (!empty($cd)) { $d['content_id'] = $cd['id']; $d['size'] = $cd['size']; $d['pages'] = $cd['pages']; $d['content_type'] = $cd['type']; $d['content_path'] = $cd['path']; $d['md5'] = $cd['md5']; } $this->data['versions'] = DM\FilesVersions::getFileVersions($this->id); }
/** * load template custom data */ protected function loadCustomData() { parent::loadCustomData(); $res = DB\dbQuery('SELECT l' . \CB\Config::get('user_language_index') . ' `title` ,`' . implode('`,`', $this->tableFields) . '` FROM templates_structure WHERE id = $1', $this->id) or die(DB\dbQueryError()); if ($r = $res->fetch_assoc()) { $r['cfg'] = Util\toJSONArray($r['cfg']); $this->data = array_merge($this->data, $r); } else { \CB\debug("Template field load error: no field found with id = " . $this->id); // throw new \Exception("Template field load error: no field found with id = ".$this->id); } $res->close(); }
/** * load template custom data */ protected function loadCustomData() { parent::loadCustomData(); $r = DM\Objects::read($this->id); if (!empty($r)) { $r = $r['data']; } else { //read from templates_structure if object not present in tree // for backward compatibility $r = DM\TemplatesStructure::read($this->id); } if (!empty($r)) { if (isset($r['cfg'])) { $r['cfg'] = Util\toJSONArray($r['cfg']); } $r['title'] = Util\detectTitle($r); $this->data = array_merge($this->data, $r); } else { \CB\debug("Template field load error: no field found with id = " . $this->id); // throw new \Exception("Template field load error: no field found with id = ".$this->id); } }
/** * load custom data for $this->id * * @return void */ protected function loadCustomData() { parent::loadCustomData(); /* load custom data from objects table */ $res = DB\dbQuery('SELECT f.content_id ,fc.size ,fc.pages ,fc.type `content_type` ,fc.path `content_path` ,fc.md5 FROM files f LEFT JOIN files_content fc ON f.content_id = fc.id WHERE f.id = $1', $this->id) or die(DB\dbQueryError()); if ($r = $res->fetch_assoc()) { $this->data = array_merge($this->data, $r); } $res->close(); /* get versions */ $res = DB\dbQuery('SELECT v.id ,v.`date` ,v.`name` ,v.cid ,v.uid ,v.cdate ,v.udate ,fc.size ,fc.pages ,fc.type content_type FROM files_versions v LEFT JOIN files_content fc on fc.id = v.content_id WHERE v.file_id = $1 ORDER BY v.cdate DESC', $this->id) or die(DB\dbQueryError()); while ($r = $res->fetch_assoc()) { $this->data['versions'][] = $r; } $res->close(); }
/** * load template custom data */ protected function loadCustomData() { parent::loadCustomData(); $r = DM\Templates::read($this->id); if (!empty($r)) { //dont override name from tree with name from templates table unset($r['name']); $this->data = array_merge($this->data, $r); } else { throw new \Exception("Template load error: no template found with id = " . $this->id); } /* loading template fields */ $this->data['fields'] = array(); $this->data['fieldsByIndex'] = array(); $this->fieldsOrder = array(); $recs = DM\TemplatesStructure::getFields($this->id); foreach ($recs as &$r) { $this->data['fields'][$r['id']] =& $r; $this->data['fieldsByIndex'][] =& $r; $this->fieldsOrder[$r['name']] = intval($r['order']); unset($r); } }
/** * load template custom data */ protected function loadCustomData() { parent::loadCustomData(); $userLanguageIndex = \CB\Config::get('user_language_index'); $res = DB\dbQuery('SELECT id ,is_folder ,`type` ,name ,l' . $userLanguageIndex . ' `title` ,l1 ,l2 ,l3 ,l4 ,`order` ,`visible` ,iconCls ,default_field ,cfg ,title_template ,info_template FROM templates WHERE is_folder = 0 AND id = $1', $this->id) or die(DB\dbQueryError()); if ($r = $res->fetch_assoc()) { $r['cfg'] = Util\toJSONArray($r['cfg']); $this->data = array_merge($this->data, $r); } else { throw new \Exception("Template load error: no template found with id = " . $this->id); } $res->close(); /* loading template fields */ $this->data['fields'] = array(); $res = DB\dbQuery('SELECT ts.id ,ts.pid ,ts.name ,ts.l' . $userLanguageIndex . ' `title` ,ts.l1 ,ts.l2 ,ts.l3 ,ts.l4 ,ts.`type` ,ts.`level` ,ts.`order` ,ts.cfg ,ts.solr_column_name FROM templates_structure ts JOIN tree t on ts.id = t.id AND t.dstatus = 0 WHERE ts.template_id = $1 ORDER BY ts.`order`', $this->id) or die(DB\dbQueryError()); while ($r = $res->fetch_assoc()) { $r['cfg'] = Util\toJSONArray($r['cfg']); $this->data['fields'][$r['id']] = $r; $this->fieldsOrder[$r['name']] = intval($r['order']); } $res->close(); }