protected function addRow($orig_row, $parent = 0, $level = 0) { #Set new condition for query builder $this->where = array('object.parent_id=' . intval($orig_row['id'])); $this->where[] = 'object.type_id = type.id'; if (isset($_GET['place']) && is_numeric($_GET['place'])) { $this->where[] = 'place.id = ' . $_GET['place']; } if (isset($_GET['group']) && is_numeric($_GET['group'])) { $this->where[] = 'group.id = ' . $_GET['group']; $this->where[] = 'place.id = group.place_id'; } #Get children of current node $query = $this->buildQueryRows($this->query); $result = $this->DB->query($query); #Add current node $orig_row['level'] = $level; $orig_row['parent'] = $parent ? $parent : null; $orig_row['isLeaf'] = $this->DB->rowCount($result) ? false : true; $orig_row['expanded'] = $this->input('expanded') ? true : false; $orig_row['expanded'] = $level >= 2 ? false : true; $orig_row['loaded'] = true; parent::addRow($orig_row); #Add children nodes recursively while ($r = $this->DB->fetch($result)) { $this->addRow($r, $orig_row['id'], $level + 1); } }
protected function addRow($orig_row, $parent = 0, $level = 0) { #Set new condition for query builder $this->where = array('t.parent_id=' . intval($orig_row['id'])); #Get children of current node $query = $this->buildQueryRows($this->query); $result = $this->DB->query($query); #Add current node $orig_row['level'] = $level; $orig_row['parent'] = $parent ? $parent : null; $orig_row['isLeaf'] = $this->DB->rowCount($result) ? false : true; $orig_row['expanded'] = $this->input('expanded') ? true : false; $orig_row['loaded'] = true; parent::addRow($orig_row); #Add children nodes recursively while ($r = $this->DB->fetch($result)) { $this->addRow($r, $orig_row['id'], $level + 1); } }