public function getChildren(&$pathArray, $requestParams) { $pid = null; /* should start with path check and see if child request is for a real db node*/ if (empty($pathArray)) { if (empty($requestParams['query'])) { return; } } else { $lastNode = @$pathArray[sizeof($pathArray) - 1]; if ($lastNode instanceof Dbnode || get_class($lastNode) == 'CB\\TreeNode\\Base') { $pid = $lastNode->id; } else { //we are under another node type $cfg = $lastNode->getConfig(); if (!empty($cfg['realNodeId']) && $lastNode instanceof RealSubnode) { $pid = $cfg['realNodeId']; } else { return array(); } } } if (empty($pid)) { return array(); } /* end of check */ $p =& $requestParams; $folderTemplates = \CB\Config::get('folder_templates'); $p['fl'] = 'id,pid,system,path,name,case_id,date,date_end,size,cid,' . 'oid,cdate,uid,udate,template_id,acl_count,cls,status,task_status,versions,' . 'comment_user_id,comment_date'; if (empty($p['showFoldersContent'])) { $p['templates'] = $folderTemplates; } if (empty($p['descendants'])) { $p['pid'] = $pid; } else { $p['pids'] = $pid; } $s = new \CB\Search(); $rez = $s->query($p); if (!empty($rez['data'])) { for ($i = 0; $i < sizeof($rez['data']); $i++) { $d =& $rez['data'][$i]; $r = DM\Tree::read($d['id']); if (!empty($r['cfg']) && $p['from'] == 'tree') { if (isset($r['cfg']['loaded'])) { $d['loaded'] = $r['cfg']['loaded']; } if (isset($r['cfg']['expanded'])) { $d['expanded'] = $r['cfg']['expanded']; } if (isset($r['cfg']['leaf'])) { $d['leaf'] = $r['cfg']['leaf']; } } } \CB\Tasks::setTasksActionFlags($rez['data']); } return $rez; }
/** * 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); }
public function getData($id = false) { $rez = array('success' => true); if (empty(parent::getData($id))) { return $rez; } $params = array('pid' => $this->id, 'fq' => array('(template_type:task) OR (target_type:task)'), 'fl' => 'id,pid,name,template_id,date,date_end,cid,cdate,status', 'sort' => 'cdate', 'dir' => 'desc'); $s = new \CB\Search(); $sr = $s->query($params); foreach ($sr['data'] as $d) { $d['ago_text'] = @Util\formatDateTimePeriod($d['date'], null, @$_SESSION['user']['cfg']['timezone']); $d['user'] = User::getDisplayName($d['cid'], true); \CB\Tasks::setTaskActionFlags($d); $rez['data'][] = $d; } return $rez; }