Beispiel #1
0
 public function getContentItems()
 {
     $p =& $this->requestParams;
     $folderTemplates = \CB\Config::get('folder_templates');
     $p['fl'] = 'id,system,path,name,case,date,date_end,size,cid,oid,cdate,uid,udate,template_id,acl_count,cls,status,task_status,dstatus';
     if (@$p['from'] == 'tree') {
         $p['templates'] = $folderTemplates;
     }
     if (is_numeric($this->lastNode->id)) {
         $p['pid'] = $pid;
     }
     $p['dstatus'] = 1;
     $p['fq'] = $this->fq;
     $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)) {
                 $d['cfg'] = $r['cfg'];
                 $r = DM\Tree::getChildCount($d['id'], @$p['from'] == 'tree' ? $folderTemplates : false);
                 $d['has_childs'] = !empty($r[$d['id']]);
             }
         }
     }
     return $rez;
 }
Beispiel #2
0
 public function getChildren($p)
 {
     $p['from'] = 'tree';
     $rez = parent::getChildren($p);
     //collect resulting record ids and get their children
     $ids = array();
     foreach ($rez['data'] as &$d) {
         $ids[] = $d['nid'];
     }
     $children = DM\Tree::getChildCount($ids);
     foreach ($rez['data'] as &$d) {
         if (!isset($d['loaded'])) {
             if (!isset($d['has_childs'])) {
                 $d['has_childs'] = !empty($children[$d['nid']]);
             }
             $d['loaded'] = empty($d['has_childs']);
         }
     }
     return $rez['data'];
 }