Skip to content

Instantly share code, notes, and snippets.

@hakre
Created February 28, 2012 17:35
Show Gist options
  • Save hakre/1933872 to your computer and use it in GitHub Desktop.
Save hakre/1933872 to your computer and use it in GitHub Desktop.
Getting nested set model into a <ul> but hiding “closed” subtrees
<?php
/**
* Getting nested set model into a <ul> but hiding “closed” subtrees
*
* @link http://stackoverflow.com/a/7786733/367456
*/
// $categories = get_categories();
$categories = get_categories_large();
$current = array('lft' => '14', 'rgt' => '13');
$start = microtime(TRUE);
$sequence = new SequenceTreeIterator($categories);
echo '<ul><!-- start -->', "\n";
$hasChildren = FALSE;
foreach($sequence as $node)
{
if ($close = $sequence->getCloseLevels())
{
echo str_repeat('</ul></li>', $close), "\n";
$hasChildren = FALSE;
}
if (!$node && $hasChildren)
{
echo '</li>', "\n";
}
if (!$node) break; # terminator
$hasChildren = $node->hasChildren();
$childCount = $node->childCount();
$isSelected = $node->isSupersetOf($current);
$classes = array();
$isSelected && ($classes[] = 'selected') && $hasChildren && $classes[] = 'open';
$node->isSame($current) && $classes[] = 'current';
$label = sprintf('%s (%d/%d)', $node['name'], $hasChildren, $childCount);
printf('<li class="%s">%s', implode(' ', $classes), $label);
if ($hasChildren)
if ($isSelected)
echo "\n", '<ul>';
else
$sequence->skipChildren()
;
else
echo '</li>', "\n"
;
}
echo '</ul>';
echo "\n", microtime(TRUE) - $start, "\n";
class SequenceTreeIterator extends ArrayIterator
{
private $keyDepth = 'depth';
private $skipDepth;
private $depth;
private $prevDepth;
private $index;
public function __construct(array $array)
{
parent::__construct($array);
parent::append(NULL); // add terminator
}
public function rewind()
{
$this->skipDepth = FALSE;
$this->terminate = FALSE;
$this->prevDepth = 0;
$this->index = 0;
parent::rewind();
}
public function current()
{
$current = parent::current();
if ($current)
{
$current = new Node($current);
$this->depth = $current[$this->keyDepth];
}
else
{
$this->depth = 0;
}
return $current;
}
public function next()
{
$current = parent::current();
$prevDepth = (int) $current[$this->keyDepth];
assert('$prevDepth>=0');
$this->prevDepth = $prevDepth;
$skipDepth = $this->skipDepth;
$this->skipDepth = FALSE;
do
{
$this->index++;
parent::next();
if (NULL === $next = parent::current())
break;
$nextDepth = $next[$this->keyDepth];
}
while(FALSE !== $skipDepth && $nextDepth > $skipDepth);
}
public function skipChildren()
{
$this->skipDepth = $this->depth;
}
public function getPrevDepth()
{
return $this->prevDepth;
}
public function getDepth()
{
return $this->depth;
}
public function getCloseLevels()
{
return max(0, $this->prevDepth - $this->depth);
}
public function getIndex()
{
return $this->index;
}
public function hasNext()
{
return ($this->index+1) < count($this);
}
}
class Node extends ArrayObject
{
public function __construct(array $node)
{
if (!isset($node['name'])) $node['name'] = '(unnamed)';
parent::__construct($node);
}
public function getLeftRight()
{
return array($this['lft'], $this['rgt']);
}
public function childCount()
{
list($left, $right) = $this->getLeftRight();
$count = $right - $left - 1;
assert('$count > -1');
return $count >> 1;
}
public function hasChildren()
{
return (bool) $this->childCount();
}
private function compare($node, $mode)
{
if (is_array($node))
$node = new self($node);
list($left, $right) = $this->getLeftRight();
list($nodeLeft, $nodeRight) = $node->getLeftRight();
switch($mode)
{
case '<==>':
return $left <= $nodeLeft && $right >= $nodeRight;
case '<>':
return $left < $nodeLeft && $right > $nodeRight;
case '==':
return $left == $nodeLeft && $right == $nodeRight;
case '><':
return $left > $nodeLeft && $right < $nodeRight;
default:
throw new InvalidArgumentException(sprintf('Invalid mode "%s".', $mode));
}
}
public function isParentOf($node)
{
return $this->compare($node, '<>');
}
public function isSupersetOf($node)
{
return $this->compare($node, '<==>');
}
public function isSame($node)
{
return $this->compare($node, '==');
}
public function isChildOf($node)
{
return $this->compare($node, '><');
}
}
function get_categories()
{
$categories = array(
array('name' => '1. item',
'depth' => '0',
'lft' => '1',
'rgt' => '2'),
array('name' => '2. item',
'depth' => '0',
'lft' => '3',
'rgt' => '22'),
array('name' => '2.1 item',
'depth' => '1',
'lft' => '4',
'rgt' => '5'),
array('name' => '2.2 item',
'depth' => '1',
'lft' => '6',
'rgt' => '13'),
array('name' => '2.2.1 item',
'depth' => '2',
'lft' => '7',
'rgt' => '8'),
array('name' => '2.2.2 item',
'depth' => '2',
'lft' => '9',
'rgt' => '10'),
array('name' => '2.2.3 item',
'depth' => '2',
'lft' => '11',
'rgt' => '12'),
array('name' => '2.3 item',
'depth' => '1',
'lft' => '14',
'rgt' => '15'),
array('name' => '2.4 item',
'depth' => '1',
'lft' => '16',
'rgt' => '21'),
array('name' => '2.4.1 item',
'depth' => '2',
'lft' => '17',
'rgt' => '18'),
array('name' => '2.4.2 item',
'depth' => '2',
'lft' => '19',
'rgt' => '20'),
array('name' => '3. item',
'depth' => '0',
'lft' => '23',
'rgt' => '24'),
array('name' => '4. item',
'depth' => '0',
'lft' => '25',
'rgt' => '34'),
array('name' => '4.1 item',
'depth' => '1',
'lft' => '26',
'rgt' => '27'),
array('name' => '4.2 item',
'depth' => '1',
'lft' => '28',
'rgt' => '33'),
array('name' => '4.2.1 item',
'depth' => '2',
'lft' => '29',
'rgt' => '30'),
array('name' => '4.2.2 item',
'depth' => '2',
'lft' => '31',
'rgt' => '32',),
array('name' => '5. item',
'depth' => '0',
'lft' => '35',
'rgt' => '36'),
);
return $categories;
}
function get_categories_large()
{
return array (
25 =>
array (
'name' => 'hidden 25',
'category_id' => '25',
'type' => '1',
'depth' => '0',
'rgt' => '92',
'lft' => '1',
),
62 =>
array (
'name' => 'hidden 62',
'category_id' => '62',
'type' => '1',
'depth' => '1',
'rgt' => '21',
'lft' => '2',
),
71 =>
array (
'name' => 'hidden 71',
'category_id' => '71',
'type' => '2',
'depth' => '2',
'rgt' => '4',
'lft' => '3',
),
70 =>
array (
'name' => 'hidden 70',
'category_id' => '70',
'type' => '2',
'depth' => '2',
'rgt' => '6',
'lft' => '5',
),
69 =>
array (
'name' => 'hidden 69',
'category_id' => '69',
'type' => '2',
'depth' => '2',
'rgt' => '8',
'lft' => '7',
),
68 =>
array (
'name' => 'hidden 68',
'category_id' => '68',
'type' => '2',
'depth' => '2',
'rgt' => '10',
'lft' => '9',
),
67 =>
array (
'name' => 'hidden 67',
'category_id' => '67',
'type' => '2',
'depth' => '2',
'rgt' => '12',
'lft' => '11',
),
66 =>
array (
'name' => 'hidden 66',
'category_id' => '66',
'type' => '2',
'depth' => '2',
'rgt' => '14',
'lft' => '13',
),
65 =>
array (
'name' => 'hidden 65',
'category_id' => '65',
'type' => '2',
'depth' => '2',
'rgt' => '16',
'lft' => '15',
),
64 =>
array (
'name' => 'hidden 64',
'category_id' => '64',
'type' => '2',
'depth' => '2',
'rgt' => '18',
'lft' => '17',
),
63 =>
array (
'name' => 'hidden 63',
'category_id' => '63',
'type' => '2',
'depth' => '2',
'rgt' => '20',
'lft' => '19',
),
57 =>
array (
'name' => 'hidden 57',
'category_id' => '57',
'type' => '1',
'depth' => '1',
'rgt' => '31',
'lft' => '22',
),
61 =>
array (
'name' => 'hidden 61',
'category_id' => '61',
'type' => '2',
'depth' => '2',
'rgt' => '24',
'lft' => '23',
),
60 =>
array (
'name' => 'hidden 60',
'category_id' => '60',
'type' => '2',
'depth' => '2',
'rgt' => '26',
'lft' => '25',
),
59 =>
array (
'name' => 'hidden 59',
'category_id' => '59',
'type' => '2',
'depth' => '2',
'rgt' => '28',
'lft' => '27',
),
58 =>
array (
'name' => 'hidden 58',
'category_id' => '58',
'type' => '2',
'depth' => '2',
'rgt' => '30',
'lft' => '29',
),
48 =>
array (
'name' => 'hidden 48',
'category_id' => '48',
'type' => '1',
'depth' => '1',
'rgt' => '49',
'lft' => '32',
),
56 =>
array (
'name' => 'hidden 56',
'category_id' => '56',
'type' => '2',
'depth' => '2',
'rgt' => '34',
'lft' => '33',
),
53 =>
array (
'name' => 'hidden 53',
'category_id' => '53',
'type' => '1',
'depth' => '2',
'rgt' => '40',
'lft' => '35',
),
55 =>
array (
'name' => 'hidden 55',
'category_id' => '55',
'type' => '2',
'depth' => '3',
'rgt' => '37',
'lft' => '36',
),
54 =>
array (
'name' => 'hidden 54',
'category_id' => '54',
'type' => '2',
'depth' => '3',
'rgt' => '39',
'lft' => '38',
),
52 =>
array (
'name' => 'hidden 52',
'category_id' => '52',
'type' => '2',
'depth' => '2',
'rgt' => '42',
'lft' => '41',
),
51 =>
array (
'name' => 'hidden 51',
'category_id' => '51',
'type' => '2',
'depth' => '2',
'rgt' => '44',
'lft' => '43',
),
50 =>
array (
'name' => 'hidden 50',
'category_id' => '50',
'type' => '2',
'depth' => '2',
'rgt' => '46',
'lft' => '45',
),
49 =>
array (
'name' => 'hidden 49',
'category_id' => '49',
'type' => '2',
'depth' => '2',
'rgt' => '48',
'lft' => '47',
),
45 =>
array (
'name' => 'hidden 45',
'category_id' => '45',
'type' => '1',
'depth' => '1',
'rgt' => '55',
'lft' => '50',
),
47 =>
array (
'name' => 'hidden 47',
'category_id' => '47',
'type' => '2',
'depth' => '2',
'rgt' => '52',
'lft' => '51',
),
46 =>
array (
'name' => 'hidden 46',
'category_id' => '46',
'type' => '2',
'depth' => '2',
'rgt' => '54',
'lft' => '53',
),
42 =>
array (
'name' => 'hidden 42',
'category_id' => '42',
'type' => '1',
'depth' => '1',
'rgt' => '61',
'lft' => '56',
),
44 =>
array (
'name' => 'hidden 44',
'category_id' => '44',
'type' => '2',
'depth' => '2',
'rgt' => '58',
'lft' => '57',
),
43 =>
array (
'name' => 'hidden 43',
'category_id' => '43',
'type' => '2',
'depth' => '2',
'rgt' => '60',
'lft' => '59',
),
41 =>
array (
'name' => 'hidden 41',
'category_id' => '41',
'type' => '2',
'depth' => '1',
'rgt' => '63',
'lft' => '62',
),
40 =>
array (
'name' => 'hidden 40',
'category_id' => '40',
'type' => '2',
'depth' => '1',
'rgt' => '65',
'lft' => '64',
),
39 =>
array (
'name' => 'hidden 39',
'category_id' => '39',
'type' => '2',
'depth' => '1',
'rgt' => '67',
'lft' => '66',
),
35 =>
array (
'name' => 'hidden 35',
'category_id' => '35',
'type' => '1',
'depth' => '1',
'rgt' => '75',
'lft' => '68',
),
38 =>
array (
'name' => 'hidden 38',
'category_id' => '38',
'type' => '2',
'depth' => '2',
'rgt' => '70',
'lft' => '69',
),
37 =>
array (
'name' => 'hidden 37',
'category_id' => '37',
'type' => '2',
'depth' => '2',
'rgt' => '72',
'lft' => '71',
),
36 =>
array (
'name' => 'hidden 36',
'category_id' => '36',
'type' => '2',
'depth' => '2',
'rgt' => '74',
'lft' => '73',
),
26 =>
array (
'name' => 'hidden 26',
'category_id' => '26',
'type' => '1',
'depth' => '1',
'rgt' => '91',
'lft' => '76',
),
34 =>
array (
'name' => 'hidden 34',
'category_id' => '34',
'type' => '2',
'depth' => '2',
'rgt' => '78',
'lft' => '77',
),
33 =>
array (
'name' => 'hidden 33',
'category_id' => '33',
'type' => '2',
'depth' => '2',
'rgt' => '80',
'lft' => '79',
),
32 =>
array (
'name' => 'hidden 32',
'category_id' => '32',
'type' => '2',
'depth' => '2',
'rgt' => '82',
'lft' => '81',
),
31 =>
array (
'name' => 'hidden 31',
'category_id' => '31',
'type' => '2',
'depth' => '2',
'rgt' => '84',
'lft' => '83',
),
30 =>
array (
'name' => 'hidden 30',
'category_id' => '30',
'type' => '2',
'depth' => '2',
'rgt' => '86',
'lft' => '85',
),
29 =>
array (
'name' => 'hidden 29',
'category_id' => '29',
'type' => '2',
'depth' => '2',
'rgt' => '88',
'lft' => '87',
),
28 =>
array (
'name' => 'hidden 28',
'category_id' => '28',
'type' => '2',
'depth' => '2',
'rgt' => '90',
'lft' => '89',
),
72 =>
array (
'name' => 'hidden 72',
'category_id' => '72',
'type' => '1',
'depth' => '0',
'rgt' => '100',
'lft' => '93',
),
75 =>
array (
'name' => 'hidden 75',
'category_id' => '75',
'type' => '2',
'depth' => '1',
'rgt' => '95',
'lft' => '94',
),
74 =>
array (
'name' => 'hidden 74',
'category_id' => '74',
'type' => '2',
'depth' => '1',
'rgt' => '97',
'lft' => '96',
),
73 =>
array (
'name' => 'hidden 73',
'category_id' => '73',
'type' => '2',
'depth' => '1',
'rgt' => '99',
'lft' => '98',
),
76 =>
array (
'name' => 'hidden 76',
'category_id' => '76',
'type' => '1',
'depth' => '0',
'rgt' => '130',
'lft' => '101',
),
88 =>
array (
'name' => 'hidden 88',
'category_id' => '88',
'type' => '1',
'depth' => '1',
'rgt' => '109',
'lft' => '102',
),
91 =>
array (
'name' => 'hidden 91',
'category_id' => '91',
'type' => '2',
'depth' => '2',
'rgt' => '104',
'lft' => '103',
),
90 =>
array (
'name' => 'hidden 90',
'category_id' => '90',
'type' => '2',
'depth' => '2',
'rgt' => '106',
'lft' => '105',
),
89 =>
array (
'name' => 'hidden 89',
'category_id' => '89',
'type' => '2',
'depth' => '2',
'rgt' => '108',
'lft' => '107',
),
87 =>
array (
'name' => 'hidden 87',
'category_id' => '87',
'type' => '2',
'depth' => '1',
'rgt' => '111',
'lft' => '110',
),
83 =>
array (
'name' => 'hidden 83',
'category_id' => '83',
'type' => '1',
'depth' => '1',
'rgt' => '119',
'lft' => '112',
),
86 =>
array (
'name' => 'hidden 86',
'category_id' => '86',
'type' => '2',
'depth' => '2',
'rgt' => '114',
'lft' => '113',
),
85 =>
array (
'name' => 'hidden 85',
'category_id' => '85',
'type' => '2',
'depth' => '2',
'rgt' => '116',
'lft' => '115',
),
84 =>
array (
'name' => 'hidden 84',
'category_id' => '84',
'type' => '2',
'depth' => '2',
'rgt' => '118',
'lft' => '117',
),
81 =>
array (
'name' => 'hidden 81',
'category_id' => '81',
'type' => '2',
'depth' => '1',
'rgt' => '121',
'lft' => '120',
),
80 =>
array (
'name' => 'hidden 80',
'category_id' => '80',
'type' => '2',
'depth' => '1',
'rgt' => '123',
'lft' => '122',
),
79 =>
array (
'name' => 'hidden 79',
'category_id' => '79',
'type' => '2',
'depth' => '1',
'rgt' => '125',
'lft' => '124',
),
78 =>
array (
'name' => 'hidden 78',
'category_id' => '78',
'type' => '2',
'depth' => '1',
'rgt' => '127',
'lft' => '126',
),
77 =>
array (
'name' => 'hidden 77',
'category_id' => '77',
'type' => '2',
'depth' => '1',
'rgt' => '129',
'lft' => '128',
),
92 =>
array (
'name' => 'hidden 92',
'category_id' => '92',
'type' => '1',
'depth' => '0',
'rgt' => '152',
'lft' => '131',
),
98 =>
array (
'name' => 'hidden 98',
'category_id' => '98',
'type' => '1',
'depth' => '1',
'rgt' => '141',
'lft' => '132',
),
102 =>
array (
'name' => 'hidden 102',
'category_id' => '102',
'type' => '2',
'depth' => '2',
'rgt' => '134',
'lft' => '133',
),
101 =>
array (
'name' => 'hidden 101',
'category_id' => '101',
'type' => '2',
'depth' => '2',
'rgt' => '136',
'lft' => '135',
),
100 =>
array (
'name' => 'hidden 100',
'category_id' => '100',
'type' => '2',
'depth' => '2',
'rgt' => '138',
'lft' => '137',
),
99 =>
array (
'name' => 'hidden 99',
'category_id' => '99',
'type' => '2',
'depth' => '2',
'rgt' => '140',
'lft' => '139',
),
97 =>
array (
'name' => 'hidden 97',
'category_id' => '97',
'type' => '2',
'depth' => '1',
'rgt' => '143',
'lft' => '142',
),
96 =>
array (
'name' => 'hidden 96',
'category_id' => '96',
'type' => '2',
'depth' => '1',
'rgt' => '145',
'lft' => '144',
),
95 =>
array (
'name' => 'hidden 95',
'category_id' => '95',
'type' => '2',
'depth' => '1',
'rgt' => '147',
'lft' => '146',
),
94 =>
array (
'name' => 'hidden 94',
'category_id' => '94',
'type' => '2',
'depth' => '1',
'rgt' => '149',
'lft' => '148',
),
93 =>
array (
'name' => 'hidden 93',
'category_id' => '93',
'type' => '2',
'depth' => '1',
'rgt' => '151',
'lft' => '150',
),
103 =>
array (
'name' => 'hidden 103',
'category_id' => '103',
'type' => '1',
'depth' => '0',
'rgt' => '194',
'lft' => '153',
),
123 =>
array (
'name' => 'hidden 123',
'category_id' => '123',
'type' => '2',
'depth' => '1',
'rgt' => '155',
'lft' => '154',
),
122 =>
array (
'name' => 'hidden 122',
'category_id' => '122',
'type' => '2',
'depth' => '1',
'rgt' => '157',
'lft' => '156',
),
117 =>
array (
'name' => 'hidden 117',
'category_id' => '117',
'type' => '1',
'depth' => '1',
'rgt' => '167',
'lft' => '158',
),
121 =>
array (
'name' => 'hidden 121',
'category_id' => '121',
'type' => '2',
'depth' => '2',
'rgt' => '160',
'lft' => '159',
),
120 =>
array (
'name' => 'hidden 120',
'category_id' => '120',
'type' => '2',
'depth' => '2',
'rgt' => '162',
'lft' => '161',
),
119 =>
array (
'name' => 'hidden 119',
'category_id' => '119',
'type' => '2',
'depth' => '2',
'rgt' => '164',
'lft' => '163',
),
118 =>
array (
'name' => 'hidden 118',
'category_id' => '118',
'type' => '2',
'depth' => '2',
'rgt' => '166',
'lft' => '165',
),
116 =>
array (
'name' => 'hidden 116',
'category_id' => '116',
'type' => '2',
'depth' => '1',
'rgt' => '169',
'lft' => '168',
),
115 =>
array (
'name' => 'hidden 115',
'category_id' => '115',
'type' => '2',
'depth' => '1',
'rgt' => '171',
'lft' => '170',
),
114 =>
array (
'name' => 'hidden 114',
'category_id' => '114',
'type' => '2',
'depth' => '1',
'rgt' => '173',
'lft' => '172',
),
113 =>
array (
'name' => 'hidden 113',
'category_id' => '113',
'type' => '2',
'depth' => '1',
'rgt' => '175',
'lft' => '174',
),
112 =>
array (
'name' => 'hidden 112',
'category_id' => '112',
'type' => '2',
'depth' => '1',
'rgt' => '177',
'lft' => '176',
),
111 =>
array (
'name' => 'hidden 111',
'category_id' => '111',
'type' => '2',
'depth' => '1',
'rgt' => '179',
'lft' => '178',
),
106 =>
array (
'name' => 'hidden 106',
'category_id' => '106',
'type' => '1',
'depth' => '1',
'rgt' => '189',
'lft' => '180',
),
110 =>
array (
'name' => 'hidden 110',
'category_id' => '110',
'type' => '2',
'depth' => '2',
'rgt' => '182',
'lft' => '181',
),
109 =>
array (
'name' => 'hidden 109',
'category_id' => '109',
'type' => '2',
'depth' => '2',
'rgt' => '184',
'lft' => '183',
),
108 =>
array (
'name' => 'hidden 108',
'category_id' => '108',
'type' => '2',
'depth' => '2',
'rgt' => '186',
'lft' => '185',
),
107 =>
array (
'name' => 'hidden 107',
'category_id' => '107',
'type' => '2',
'depth' => '2',
'rgt' => '188',
'lft' => '187',
),
105 =>
array (
'name' => 'hidden 105',
'category_id' => '105',
'type' => '2',
'depth' => '1',
'rgt' => '191',
'lft' => '190',
),
104 =>
array (
'name' => 'hidden 104',
'category_id' => '104',
'type' => '2',
'depth' => '1',
'rgt' => '193',
'lft' => '192',
),
124 =>
array (
'name' => 'hidden 124',
'category_id' => '124',
'type' => '2',
'depth' => '0',
'rgt' => '196',
'lft' => '195',
),
125 =>
array (
'name' => 'hidden 125',
'category_id' => '125',
'type' => '1',
'depth' => '0',
'rgt' => '210',
'lft' => '197',
),
132 =>
array (
'name' => 'hidden 132',
'category_id' => '132',
'type' => '2',
'depth' => '1',
'rgt' => '199',
'lft' => '198',
),
131 =>
array (
'name' => 'hidden 131',
'category_id' => '131',
'type' => '2',
'depth' => '1',
'rgt' => '201',
'lft' => '200',
),
130 =>
array (
'name' => 'hidden 130',
'category_id' => '130',
'type' => '2',
'depth' => '1',
'rgt' => '203',
'lft' => '202',
),
129 =>
array (
'name' => 'hidden 129',
'category_id' => '129',
'type' => '2',
'depth' => '1',
'rgt' => '205',
'lft' => '204',
),
128 =>
array (
'name' => 'hidden 128',
'category_id' => '128',
'type' => '2',
'depth' => '1',
'rgt' => '207',
'lft' => '206',
),
126 =>
array (
'name' => 'hidden 126',
'category_id' => '126',
'type' => '2',
'depth' => '1',
'rgt' => '209',
'lft' => '208',
),
133 =>
array (
'name' => 'hidden 133',
'category_id' => '133',
'type' => '1',
'depth' => '0',
'rgt' => '220',
'lft' => '211',
),
137 =>
array (
'name' => 'hidden 137',
'category_id' => '137',
'type' => '2',
'depth' => '1',
'rgt' => '213',
'lft' => '212',
),
136 =>
array (
'name' => 'hidden 136',
'category_id' => '136',
'type' => '2',
'depth' => '1',
'rgt' => '215',
'lft' => '214',
),
135 =>
array (
'name' => 'hidden 135',
'category_id' => '135',
'type' => '2',
'depth' => '1',
'rgt' => '217',
'lft' => '216',
),
134 =>
array (
'name' => 'hidden 134',
'category_id' => '134',
'type' => '2',
'depth' => '1',
'rgt' => '219',
'lft' => '218',
),
138 =>
array (
'name' => 'hidden 138',
'category_id' => '138',
'type' => '1',
'depth' => '0',
'rgt' => '244',
'lft' => '221',
),
142 =>
array (
'name' => 'hidden 142',
'category_id' => '142',
'type' => '1',
'depth' => '1',
'rgt' => '237',
'lft' => '222',
),
149 =>
array (
'name' => 'hidden 149',
'category_id' => '149',
'type' => '2',
'depth' => '2',
'rgt' => '224',
'lft' => '223',
),
148 =>
array (
'name' => 'hidden 148',
'category_id' => '148',
'type' => '2',
'depth' => '2',
'rgt' => '226',
'lft' => '225',
),
147 =>
array (
'name' => 'hidden 147',
'category_id' => '147',
'type' => '2',
'depth' => '2',
'rgt' => '228',
'lft' => '227',
),
146 =>
array (
'name' => 'hidden 146',
'category_id' => '146',
'type' => '2',
'depth' => '2',
'rgt' => '230',
'lft' => '229',
),
145 =>
array (
'name' => 'hidden 145',
'category_id' => '145',
'type' => '2',
'depth' => '2',
'rgt' => '232',
'lft' => '231',
),
144 =>
array (
'name' => 'hidden 144',
'category_id' => '144',
'type' => '2',
'depth' => '2',
'rgt' => '234',
'lft' => '233',
),
143 =>
array (
'name' => 'hidden 143',
'category_id' => '143',
'type' => '2',
'depth' => '2',
'rgt' => '236',
'lft' => '235',
),
139 =>
array (
'name' => 'hidden 139',
'category_id' => '139',
'type' => '1',
'depth' => '1',
'rgt' => '243',
'lft' => '238',
),
141 =>
array (
'name' => 'hidden 141',
'category_id' => '141',
'type' => '2',
'depth' => '2',
'rgt' => '240',
'lft' => '239',
),
140 =>
array (
'name' => 'hidden 140',
'category_id' => '140',
'type' => '2',
'depth' => '2',
'rgt' => '242',
'lft' => '241',
),
150 =>
array (
'name' => 'hidden 150',
'category_id' => '150',
'type' => '1',
'depth' => '0',
'rgt' => '304',
'lft' => '245',
),
284 =>
array (
'name' => 'hidden 284',
'category_id' => '284',
'type' => '2',
'depth' => '1',
'rgt' => '247',
'lft' => '246',
),
175 =>
array (
'name' => 'hidden 175',
'category_id' => '175',
'type' => '1',
'depth' => '1',
'rgt' => '253',
'lft' => '248',
),
177 =>
array (
'name' => 'hidden 177',
'category_id' => '177',
'type' => '2',
'depth' => '2',
'rgt' => '250',
'lft' => '249',
),
176 =>
array (
'name' => 'hidden 176',
'category_id' => '176',
'type' => '2',
'depth' => '2',
'rgt' => '252',
'lft' => '251',
),
170 =>
array (
'name' => 'hidden 170',
'category_id' => '170',
'type' => '1',
'depth' => '1',
'rgt' => '263',
'lft' => '254',
),
174 =>
array (
'name' => 'hidden 174',
'category_id' => '174',
'type' => '2',
'depth' => '2',
'rgt' => '256',
'lft' => '255',
),
173 =>
array (
'name' => 'hidden 173',
'category_id' => '173',
'type' => '2',
'depth' => '2',
'rgt' => '258',
'lft' => '257',
),
172 =>
array (
'name' => 'hidden 172',
'category_id' => '172',
'type' => '2',
'depth' => '2',
'rgt' => '260',
'lft' => '259',
),
171 =>
array (
'name' => 'hidden 171',
'category_id' => '171',
'type' => '2',
'depth' => '2',
'rgt' => '262',
'lft' => '261',
),
164 =>
array (
'name' => 'hidden 164',
'category_id' => '164',
'type' => '1',
'depth' => '1',
'rgt' => '275',
'lft' => '264',
),
169 =>
array (
'name' => 'hidden 169',
'category_id' => '169',
'type' => '2',
'depth' => '2',
'rgt' => '266',
'lft' => '265',
),
168 =>
array (
'name' => 'hidden 168',
'category_id' => '168',
'type' => '2',
'depth' => '2',
'rgt' => '268',
'lft' => '267',
),
167 =>
array (
'name' => 'hidden 167',
'category_id' => '167',
'type' => '2',
'depth' => '2',
'rgt' => '270',
'lft' => '269',
),
166 =>
array (
'name' => 'hidden 166',
'category_id' => '166',
'type' => '2',
'depth' => '2',
'rgt' => '272',
'lft' => '271',
),
165 =>
array (
'name' => 'hidden 165',
'category_id' => '165',
'type' => '2',
'depth' => '2',
'rgt' => '274',
'lft' => '273',
),
163 =>
array (
'name' => 'hidden 163',
'category_id' => '163',
'type' => '2',
'depth' => '1',
'rgt' => '277',
'lft' => '276',
),
162 =>
array (
'name' => 'hidden 162',
'category_id' => '162',
'type' => '2',
'depth' => '1',
'rgt' => '279',
'lft' => '278',
),
155 =>
array (
'name' => 'hidden 155',
'category_id' => '155',
'type' => '1',
'depth' => '1',
'rgt' => '293',
'lft' => '280',
),
161 =>
array (
'name' => 'hidden 161',
'category_id' => '161',
'type' => '2',
'depth' => '2',
'rgt' => '282',
'lft' => '281',
),
160 =>
array (
'name' => 'hidden 160',
'category_id' => '160',
'type' => '2',
'depth' => '2',
'rgt' => '284',
'lft' => '283',
),
159 =>
array (
'name' => 'hidden 159',
'category_id' => '159',
'type' => '2',
'depth' => '2',
'rgt' => '286',
'lft' => '285',
),
158 =>
array (
'name' => 'hidden 158',
'category_id' => '158',
'type' => '2',
'depth' => '2',
'rgt' => '288',
'lft' => '287',
),
157 =>
array (
'name' => 'hidden 157',
'category_id' => '157',
'type' => '2',
'depth' => '2',
'rgt' => '290',
'lft' => '289',
),
156 =>
array (
'name' => 'hidden 156',
'category_id' => '156',
'type' => '2',
'depth' => '2',
'rgt' => '292',
'lft' => '291',
),
154 =>
array (
'name' => 'hidden 154',
'category_id' => '154',
'type' => '2',
'depth' => '1',
'rgt' => '295',
'lft' => '294',
),
151 =>
array (
'name' => 'hidden 151',
'category_id' => '151',
'type' => '1',
'depth' => '1',
'rgt' => '303',
'lft' => '296',
),
282 =>
array (
'name' => 'hidden 282',
'category_id' => '282',
'type' => '2',
'depth' => '2',
'rgt' => '298',
'lft' => '297',
),
153 =>
array (
'name' => 'hidden 153',
'category_id' => '153',
'type' => '2',
'depth' => '2',
'rgt' => '300',
'lft' => '299',
),
152 =>
array (
'name' => 'hidden 152',
'category_id' => '152',
'type' => '2',
'depth' => '2',
'rgt' => '302',
'lft' => '301',
),
178 =>
array (
'name' => 'hidden 178',
'category_id' => '178',
'type' => '1',
'depth' => '0',
'rgt' => '318',
'lft' => '305',
),
184 =>
array (
'name' => 'hidden 184',
'category_id' => '184',
'type' => '2',
'depth' => '1',
'rgt' => '307',
'lft' => '306',
),
183 =>
array (
'name' => 'hidden 183',
'category_id' => '183',
'type' => '2',
'depth' => '1',
'rgt' => '309',
'lft' => '308',
),
182 =>
array (
'name' => 'hidden 182',
'category_id' => '182',
'type' => '2',
'depth' => '1',
'rgt' => '311',
'lft' => '310',
),
181 =>
array (
'name' => 'hidden 181',
'category_id' => '181',
'type' => '2',
'depth' => '1',
'rgt' => '313',
'lft' => '312',
),
180 =>
array (
'name' => 'hidden 180',
'category_id' => '180',
'type' => '2',
'depth' => '1',
'rgt' => '315',
'lft' => '314',
),
179 =>
array (
'name' => 'hidden 179',
'category_id' => '179',
'type' => '2',
'depth' => '1',
'rgt' => '317',
'lft' => '316',
),
185 =>
array (
'name' => 'hidden 185',
'category_id' => '185',
'type' => '2',
'depth' => '0',
'rgt' => '320',
'lft' => '319',
),
186 =>
array (
'name' => 'hidden 186',
'category_id' => '186',
'type' => '1',
'depth' => '0',
'rgt' => '334',
'lft' => '321',
),
192 =>
array (
'name' => 'hidden 192',
'category_id' => '192',
'type' => '2',
'depth' => '1',
'rgt' => '323',
'lft' => '322',
),
191 =>
array (
'name' => 'hidden 191',
'category_id' => '191',
'type' => '2',
'depth' => '1',
'rgt' => '325',
'lft' => '324',
),
190 =>
array (
'name' => 'hidden 190',
'category_id' => '190',
'type' => '2',
'depth' => '1',
'rgt' => '327',
'lft' => '326',
),
189 =>
array (
'name' => 'hidden 189',
'category_id' => '189',
'type' => '2',
'depth' => '1',
'rgt' => '329',
'lft' => '328',
),
188 =>
array (
'name' => 'hidden 188',
'category_id' => '188',
'type' => '2',
'depth' => '1',
'rgt' => '331',
'lft' => '330',
),
187 =>
array (
'name' => 'hidden 187',
'category_id' => '187',
'type' => '2',
'depth' => '1',
'rgt' => '333',
'lft' => '332',
),
193 =>
array (
'name' => 'hidden 193',
'category_id' => '193',
'type' => '1',
'depth' => '0',
'rgt' => '342',
'lft' => '335',
),
196 =>
array (
'name' => 'hidden 196',
'category_id' => '196',
'type' => '2',
'depth' => '1',
'rgt' => '337',
'lft' => '336',
),
195 =>
array (
'name' => 'hidden 195',
'category_id' => '195',
'type' => '2',
'depth' => '1',
'rgt' => '339',
'lft' => '338',
),
194 =>
array (
'name' => 'hidden 194',
'category_id' => '194',
'type' => '2',
'depth' => '1',
'rgt' => '341',
'lft' => '340',
),
197 =>
array (
'name' => 'hidden 197',
'category_id' => '197',
'type' => '1',
'depth' => '0',
'rgt' => '390',
'lft' => '343',
),
283 =>
array (
'name' => 'hidden 283',
'category_id' => '283',
'type' => '2',
'depth' => '1',
'rgt' => '345',
'lft' => '344',
),
215 =>
array (
'name' => 'hidden 215',
'category_id' => '215',
'type' => '1',
'depth' => '1',
'rgt' => '355',
'lft' => '346',
),
219 =>
array (
'name' => 'hidden 219',
'category_id' => '219',
'type' => '2',
'depth' => '2',
'rgt' => '348',
'lft' => '347',
),
218 =>
array (
'name' => 'hidden 218',
'category_id' => '218',
'type' => '2',
'depth' => '2',
'rgt' => '350',
'lft' => '349',
),
217 =>
array (
'name' => 'hidden 217',
'category_id' => '217',
'type' => '2',
'depth' => '2',
'rgt' => '352',
'lft' => '351',
),
216 =>
array (
'name' => 'hidden 216',
'category_id' => '216',
'type' => '2',
'depth' => '2',
'rgt' => '354',
'lft' => '353',
),
214 =>
array (
'name' => 'hidden 214',
'category_id' => '214',
'type' => '2',
'depth' => '1',
'rgt' => '357',
'lft' => '356',
),
213 =>
array (
'name' => 'hidden 213',
'category_id' => '213',
'type' => '2',
'depth' => '1',
'rgt' => '359',
'lft' => '358',
),
212 =>
array (
'name' => 'hidden 212',
'category_id' => '212',
'type' => '2',
'depth' => '1',
'rgt' => '361',
'lft' => '360',
),
211 =>
array (
'name' => 'hidden 211',
'category_id' => '211',
'type' => '2',
'depth' => '1',
'rgt' => '363',
'lft' => '362',
),
210 =>
array (
'name' => 'hidden 210',
'category_id' => '210',
'type' => '2',
'depth' => '1',
'rgt' => '365',
'lft' => '364',
),
209 =>
array (
'name' => 'hidden 209',
'category_id' => '209',
'type' => '2',
'depth' => '1',
'rgt' => '367',
'lft' => '366',
),
208 =>
array (
'name' => 'hidden 208',
'category_id' => '208',
'type' => '2',
'depth' => '1',
'rgt' => '369',
'lft' => '368',
),
207 =>
array (
'name' => 'hidden 207',
'category_id' => '207',
'type' => '2',
'depth' => '1',
'rgt' => '371',
'lft' => '370',
),
206 =>
array (
'name' => 'hidden 206',
'category_id' => '206',
'type' => '2',
'depth' => '1',
'rgt' => '373',
'lft' => '372',
),
204 =>
array (
'name' => 'hidden 204',
'category_id' => '204',
'type' => '2',
'depth' => '1',
'rgt' => '375',
'lft' => '374',
),
205 =>
array (
'name' => 'hidden 205',
'category_id' => '205',
'type' => '2',
'depth' => '1',
'rgt' => '377',
'lft' => '376',
),
203 =>
array (
'name' => 'hidden 203',
'category_id' => '203',
'type' => '2',
'depth' => '1',
'rgt' => '379',
'lft' => '378',
),
202 =>
array (
'name' => 'hidden 202',
'category_id' => '202',
'type' => '2',
'depth' => '1',
'rgt' => '381',
'lft' => '380',
),
198 =>
array (
'name' => 'hidden 198',
'category_id' => '198',
'type' => '1',
'depth' => '1',
'rgt' => '389',
'lft' => '382',
),
201 =>
array (
'name' => 'hidden 201',
'category_id' => '201',
'type' => '2',
'depth' => '2',
'rgt' => '384',
'lft' => '383',
),
200 =>
array (
'name' => 'hidden 200',
'category_id' => '200',
'type' => '2',
'depth' => '2',
'rgt' => '386',
'lft' => '385',
),
199 =>
array (
'name' => 'hidden 199',
'category_id' => '199',
'type' => '2',
'depth' => '2',
'rgt' => '388',
'lft' => '387',
),
220 =>
array (
'name' => 'hidden 220',
'category_id' => '220',
'type' => '1',
'depth' => '0',
'rgt' => '404',
'lft' => '391',
),
226 =>
array (
'name' => 'hidden 226',
'category_id' => '226',
'type' => '2',
'depth' => '1',
'rgt' => '393',
'lft' => '392',
),
225 =>
array (
'name' => 'hidden 225',
'category_id' => '225',
'type' => '2',
'depth' => '1',
'rgt' => '395',
'lft' => '394',
),
224 =>
array (
'name' => 'hidden 224',
'category_id' => '224',
'type' => '2',
'depth' => '1',
'rgt' => '397',
'lft' => '396',
),
223 =>
array (
'name' => 'hidden 223',
'category_id' => '223',
'type' => '2',
'depth' => '1',
'rgt' => '399',
'lft' => '398',
),
222 =>
array (
'name' => 'hidden 222',
'category_id' => '222',
'type' => '2',
'depth' => '1',
'rgt' => '401',
'lft' => '400',
),
221 =>
array (
'name' => 'hidden 221',
'category_id' => '221',
'type' => '2',
'depth' => '1',
'rgt' => '403',
'lft' => '402',
),
227 =>
array (
'name' => 'hidden 227',
'category_id' => '227',
'type' => '1',
'depth' => '0',
'rgt' => '436',
'lft' => '405',
),
242 =>
array (
'name' => 'hidden 242',
'category_id' => '242',
'type' => '2',
'depth' => '1',
'rgt' => '407',
'lft' => '406',
),
241 =>
array (
'name' => 'hidden 241',
'category_id' => '241',
'type' => '2',
'depth' => '1',
'rgt' => '409',
'lft' => '408',
),
240 =>
array (
'name' => 'hidden 240',
'category_id' => '240',
'type' => '2',
'depth' => '1',
'rgt' => '411',
'lft' => '410',
),
239 =>
array (
'name' => 'hidden 239',
'category_id' => '239',
'type' => '2',
'depth' => '1',
'rgt' => '413',
'lft' => '412',
),
236 =>
array (
'name' => 'hidden 236',
'category_id' => '236',
'type' => '1',
'depth' => '1',
'rgt' => '419',
'lft' => '414',
),
238 =>
array (
'name' => 'hidden 238',
'category_id' => '238',
'type' => '2',
'depth' => '2',
'rgt' => '416',
'lft' => '415',
),
237 =>
array (
'name' => 'hidden 237',
'category_id' => '237',
'type' => '2',
'depth' => '2',
'rgt' => '418',
'lft' => '417',
),
235 =>
array (
'name' => 'hidden 235',
'category_id' => '235',
'type' => '2',
'depth' => '1',
'rgt' => '421',
'lft' => '420',
),
232 =>
array (
'name' => 'hidden 232',
'category_id' => '232',
'type' => '1',
'depth' => '1',
'rgt' => '427',
'lft' => '422',
),
234 =>
array (
'name' => 'hidden 234',
'category_id' => '234',
'type' => '2',
'depth' => '2',
'rgt' => '424',
'lft' => '423',
),
233 =>
array (
'name' => 'hidden 233',
'category_id' => '233',
'type' => '2',
'depth' => '2',
'rgt' => '426',
'lft' => '425',
),
229 =>
array (
'name' => 'hidden 229',
'category_id' => '229',
'type' => '1',
'depth' => '1',
'rgt' => '433',
'lft' => '428',
),
231 =>
array (
'name' => 'hidden 231',
'category_id' => '231',
'type' => '2',
'depth' => '2',
'rgt' => '430',
'lft' => '429',
),
230 =>
array (
'name' => 'hidden 230',
'category_id' => '230',
'type' => '2',
'depth' => '2',
'rgt' => '432',
'lft' => '431',
),
228 =>
array (
'name' => 'hidden 228',
'category_id' => '228',
'type' => '2',
'depth' => '1',
'rgt' => '435',
'lft' => '434',
),
243 =>
array (
'name' => 'hidden 243',
'category_id' => '243',
'type' => '2',
'depth' => '0',
'rgt' => '438',
'lft' => '437',
),
244 =>
array (
'name' => 'hidden 244',
'category_id' => '244',
'type' => '1',
'depth' => '0',
'rgt' => '446',
'lft' => '439',
),
247 =>
array (
'name' => 'hidden 247',
'category_id' => '247',
'type' => '2',
'depth' => '1',
'rgt' => '441',
'lft' => '440',
),
246 =>
array (
'name' => 'hidden 246',
'category_id' => '246',
'type' => '2',
'depth' => '1',
'rgt' => '443',
'lft' => '442',
),
245 =>
array (
'name' => 'hidden 245',
'category_id' => '245',
'type' => '2',
'depth' => '1',
'rgt' => '445',
'lft' => '444',
),
248 =>
array (
'name' => 'hidden 248',
'category_id' => '248',
'type' => '1',
'depth' => '0',
'rgt' => '454',
'lft' => '447',
),
251 =>
array (
'name' => 'hidden 251',
'category_id' => '251',
'type' => '2',
'depth' => '1',
'rgt' => '449',
'lft' => '448',
),
250 =>
array (
'name' => 'hidden 250',
'category_id' => '250',
'type' => '2',
'depth' => '1',
'rgt' => '451',
'lft' => '450',
),
249 =>
array (
'name' => 'hidden 249',
'category_id' => '249',
'type' => '2',
'depth' => '1',
'rgt' => '453',
'lft' => '452',
),
252 =>
array (
'name' => 'hidden 252',
'category_id' => '252',
'type' => '1',
'depth' => '0',
'rgt' => '462',
'lft' => '455',
),
255 =>
array (
'name' => 'hidden 255',
'category_id' => '255',
'type' => '2',
'depth' => '1',
'rgt' => '457',
'lft' => '456',
),
254 =>
array (
'name' => 'hidden 254',
'category_id' => '254',
'type' => '2',
'depth' => '1',
'rgt' => '459',
'lft' => '458',
),
253 =>
array (
'name' => 'hidden 253',
'category_id' => '253',
'type' => '2',
'depth' => '1',
'rgt' => '461',
'lft' => '460',
),
256 =>
array (
'name' => 'hidden 256',
'category_id' => '256',
'type' => '2',
'depth' => '0',
'rgt' => '464',
'lft' => '463',
),
257 =>
array (
'name' => 'hidden 257',
'category_id' => '257',
'type' => '2',
'depth' => '0',
'rgt' => '466',
'lft' => '465',
),
258 =>
array (
'name' => 'hidden 258',
'category_id' => '258',
'type' => '2',
'depth' => '0',
'rgt' => '468',
'lft' => '467',
),
259 =>
array (
'name' => 'hidden 259',
'category_id' => '259',
'type' => '2',
'depth' => '0',
'rgt' => '470',
'lft' => '469',
),
260 =>
array (
'name' => 'hidden 260',
'category_id' => '260',
'type' => '2',
'depth' => '0',
'rgt' => '472',
'lft' => '471',
),
261 =>
array (
'name' => 'hidden 261',
'category_id' => '261',
'type' => '2',
'depth' => '0',
'rgt' => '474',
'lft' => '473',
),
262 =>
array (
'name' => 'hidden 262',
'category_id' => '262',
'type' => '1',
'depth' => '0',
'rgt' => '482',
'lft' => '475',
),
266 =>
array (
'name' => 'hidden 266',
'category_id' => '266',
'type' => '2',
'depth' => '1',
'rgt' => '477',
'lft' => '476',
),
264 =>
array (
'name' => 'hidden 264',
'category_id' => '264',
'type' => '2',
'depth' => '1',
'rgt' => '479',
'lft' => '478',
),
263 =>
array (
'name' => 'hidden 263',
'category_id' => '263',
'type' => '2',
'depth' => '1',
'rgt' => '481',
'lft' => '480',
),
267 =>
array (
'name' => 'hidden 267',
'category_id' => '267',
'type' => '1',
'depth' => '0',
'rgt' => '490',
'lft' => '483',
),
271 =>
array (
'name' => 'hidden 271',
'category_id' => '271',
'type' => '2',
'depth' => '1',
'rgt' => '485',
'lft' => '484',
),
269 =>
array (
'name' => 'hidden 269',
'category_id' => '269',
'type' => '2',
'depth' => '1',
'rgt' => '487',
'lft' => '486',
),
268 =>
array (
'name' => 'hidden 268',
'category_id' => '268',
'type' => '2',
'depth' => '1',
'rgt' => '489',
'lft' => '488',
),
272 =>
array (
'name' => 'hidden 272',
'category_id' => '272',
'type' => '1',
'depth' => '0',
'rgt' => '498',
'lft' => '491',
),
275 =>
array (
'name' => 'hidden 275',
'category_id' => '275',
'type' => '2',
'depth' => '1',
'rgt' => '493',
'lft' => '492',
),
274 =>
array (
'name' => 'hidden 274',
'category_id' => '274',
'type' => '2',
'depth' => '1',
'rgt' => '495',
'lft' => '494',
),
273 =>
array (
'name' => 'hidden 273',
'category_id' => '273',
'type' => '2',
'depth' => '1',
'rgt' => '497',
'lft' => '496',
),
276 =>
array (
'name' => 'hidden 276',
'category_id' => '276',
'type' => '1',
'depth' => '0',
'rgt' => '508',
'lft' => '499',
),
280 =>
array (
'name' => 'hidden 280',
'category_id' => '280',
'type' => '2',
'depth' => '1',
'rgt' => '501',
'lft' => '500',
),
279 =>
array (
'name' => 'hidden 279',
'category_id' => '279',
'type' => '2',
'depth' => '1',
'rgt' => '503',
'lft' => '502',
),
278 =>
array (
'name' => 'hidden 278',
'category_id' => '278',
'type' => '2',
'depth' => '1',
'rgt' => '505',
'lft' => '504',
),
277 =>
array (
'name' => 'hidden 277',
'category_id' => '277',
'type' => '2',
'depth' => '1',
'rgt' => '507',
'lft' => '506',
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment