Example #1
0
File: core.php Project: umaxfun/x4m
 private function basicPathCalculate(&$nodes)
 {
     if ($this->query['pathCache']) {
         $query = 'select id,basic  from ' . $this->treeStructName . '  where  `id` in ("' . implode('","', $this->query['pathCache']) . '")';
         if ($pdoResult = $this->PDO->query($query)) {
             while ($bsc = $pdoResult->fetch(PDO::FETCH_ASSOC)) {
                 $basics[$bsc['id']] = $bsc['basic'];
             }
         }
         unset($basics[1]);
         while (list($key, $val) = each($nodes)) {
             if ($val['path']) {
                 foreach ($val['path'] as $pathElement) {
                     if ($basics[$pathElement]) {
                         $nodes[$key]['basicPath'][$pathElement] = $basics[$pathElement];
                     }
                 }
                 $nodes[$key]['basicPath'][$val['id']] = $val['basic'];
                 if ($this->query['basicpath']['separator']) {
                     $nodes[$key]['basicPathValue'] = implode($this->query['basicpath']['separator'], $nodes[$key]['basicPath']);
                 }
             }
         }
         /*порядок по возрастанию уровня вложенности если не указано другое*/
         if (!$this->query['sortByAncestorLevel']) {
             $nodes = XARRAY::sortByField($nodes, 'ancestorLevel');
         }
     }
 }