/** * Recursively add pages to the container * * @param Zoo_Object_Tree $tree * @param Zend_Navigation_Container $container * @param int $key * @return void */ function treeToPageContainer(&$tree, Zend_Navigation_Page $container, $key = 0) { $children = $tree->getFirstChild($key); foreach ($children as $child) { $page = $this->nodeToPage($child); $container->addPage($page); $this->treeToPageContainer($tree, $page, $child->id); } }
/** * @return bool|Zend_Form_Subform */ function getOptions() { $menus = Zoo::getService('menu')->fetchAll(); // Build menu tree $tree = new Zoo_Object_Tree($menus, 'id', 'pid'); $options = $tree->getIndentedArray('title', 0, '-'); $form = new Zend_Form_SubForm(); $menu_select = new Zend_Form_Element_Select('menu'); $menu_select->setLabel('Menu'); $menu_select->addMultiOptions($options); $form->addElement($menu_select); return $form; }
/** * Retrieve galleries listing * * @return array */ function getTemplateVars() { $galleries = Zoo::getService('content')->getContent(array('active' => true, 'nodetype' => 'gallery_node', 'viewtype' => "Short", 'order' => 'published'), 0, 0); $tree = new Zoo_Object_Tree($galleries, 'id', 'pid'); return array('galleries' => $tree->toArray()); }
/** * Add resources to ACL from a Zoo_Object_Tree * * @param Zoo_Object_Tree $tree */ function addResourcesFromTree(Zoo_Object_Tree $tree, $id = 0) { foreach ($tree->getFirstChild($id) as $role) { if ($role->parent == 0) { $this->service->add($role); } else { $this->service->add($role, $tree->getByKey($role->parent)); } $this->addResourcesFromTree($tree, $role->id); } }
/** * List categories */ public function categoriesAction() { $categories = Zoo::getService('content')->getContent(array('group' => 'category', 'order' => 'title'), 0, 0); $tree = new Zoo_Object_Tree($categories, 'id', 'pid'); $this->view->assign('tree', $tree->toArray()); }