Example #1
0
 /**
  * Reindex the category tree
  */
 public static function reindex()
 {
     parent::reindex(__CLASS__);
 }
Example #2
0
 private function toStringRecursive(ActiveTreeNode $node, $level, $output)
 {
     $node->load();
     $parentID = $node->getFieldValue(self::PARENT_NODE_FIELD_NAME) ? $node->getFieldValue(self::PARENT_NODE_FIELD_NAME)->getID() : 'root';
     $lft = $node->getFieldValue(self::LEFT_NODE_FIELD_NAME);
     $rgt = $node->getFieldValue(self::RIGHT_NODE_FIELD_NAME);
     $name = $node->getFieldValue('name');
     $name = isset($name['en']) ? $name['en'] : '';
     $output .= str_repeat(" ", $level * 4) . "{$name}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   [ID=" . $node->getID() . "; PID={$parentID}; LFT={$lft}; RGT={$rgt}] \n";
     $childNodes = $node->getChildNodes(true, true);
     foreach ($childNodes as $child) {
         $output = $this->toStringRecursive($child, $level + 1, $output);
     }
     return $output;
 }
Example #3
0
 public function reindex()
 {
     ActiveTreeNode::reindex("Category");
 }
Example #4
0
 public function toArray()
 {
     $array = parent::toArray();
     if ($this->subConditions) {
         foreach ($this->subConditions as $sub) {
             $array['sub'][] = $sub->toArray();
         }
     }
     if ($this->records) {
         foreach ($this->records as $record) {
             $array['records'][] = $record->toArray();
         }
     }
     return $array;
 }