public function RenderFileBrowser($parentId, $link, $basePath = null, $level = 0, $id = 'fileTree', $withRoot = false) { $links = array(); $tree = new Model_Page(); $children = $tree->getChildren($parentId, null, 'name'); // add a link for site root if (isset($withRoot) && $withRoot == true) { $links[] = $this->_getSiteRootElement(); } foreach ($children as $child) { if ($tree->hasChildren($child)) { $newLevel = $level + 1; $submenu = $this->view->RenderFileBrowser($child->id, $link, $basePath, $newLevel); $icon = 'folder.png'; } else { $icon = 'page_white_text.png'; $submenu = false; } if (isset($child->label) && !empty($child->label)) { $label = $child->label; } else { $label = $child->name; } $links[] = '<li class="menuItem">' . $this->view->link($label, $link . $child->id, $icon) . $submenu . '</li>'; } if (is_array($links)) { if ($level == 0) { $strId = "id='{$id}'"; } else { $strId = null; } $filetree = "<ul {$strId}>" . implode(null, $links) . '</ul>'; return $filetree; } }
public function RenderFileChecklist($values = array(), $parentId, $level = 0, $id = 'fileChecklist') { $links = array(); $page = new Model_Page(); $children = $page->getChildren($parentId); foreach ($children as $child) { if ($page->hasChildren($child)) { $newLevel = $level + 1; $submenu = $this->view->RenderFileChecklist($values, $child->id, $newLevel); } else { $submenu = false; } if (in_array($child->id, $values)) { $checked = 1; } else { $checked = 0; } $checkbox = $this->view->formCheckbox('file_' . $child->id, $checked); $links[] = '<li class="page">' . $checkbox . $child->name . $submenu . '</li>'; } if (is_array($links)) { if ($level == 0) { $strId = "id='{$id}'"; } else { $strId = null; } $fileChecklist = "<ul {$strId}>" . implode(null, $links) . '</ul>'; return $fileChecklist; } }
public function renderFileChecklist($values = array(), $parentId, $level = 0, $class = 'fileChecklist', $icon = null) { $links = array(); $page = new Model_Page(); $children = $page->getChildren($parentId); foreach ($children as $child) { $submenu = false; if ($page->hasChildren($child)) { $newLevel = $level + 1; $submenu = $this->view->renderFileChecklist($values, $child->id, $newLevel, $class, $icon); } // TODO: refactor into Toolbox String - replace empty spaces with underscores for element names only $childName = strtolower(str_replace(' ', '_', $child->name)); $checked = 0; if (in_array($childName, $values)) { $checked = 1; } $form = new Digitalus_Form(); $checkbox = $form->createElement('checkbox', $childName, array('value' => $checked, 'decorators' => array('ViewHelper'), 'belongsTo' => $class)); $links[] = '<li>' . $checkbox . $this->getIcon($icon, $child->name) . $child->name . $submenu . '</li>'; } $strClass = null; if (is_array($links)) { if ($level == 0) { $strClass = 'class="' . $class . '"'; } $fileChecklist = '<ul ' . $strClass . 'class="treeview">' . implode(null, $links) . '</ul>'; return $fileChecklist; } }
/** * Constructor * * @param object $item A Zend_Db_Table_Row object */ public function __construct(Zend_Db_Table_Row $item) { $this->_innerItem = $item; $this->label = Digitalus_Toolbox_Page::getLabel($item); $this->link = Digitalus_Toolbox_Page::getUrl($item); $this->id = $this->_innerItem->id; if ($item->show_on_menu) { $this->visible = true; } else { $this->visible = false; } $page = new Model_Page(); if ($page->hasChildren($item)) { $this->hasSubmenu = true; } else { $this->hasSubmenu = false; } }
public function renderFileBrowser($parentId, $link, $basePath = null, $level = 0, $id = 'fileTree', $withRoot = false, $current = null, $exclude = null, $translate = true) { $links = array(); $tree = new Model_Page(); $children = $tree->getChildren($parentId); // add a link for site root if (isset($withRoot) && $withRoot == true) { $links[] = $this->_getSiteRootElement(); } foreach ($children as $child) { if ($tree->hasChildren($child)) { $newLevel = $level + 1; $submenu = $this->view->renderFileBrowser($child->id, $link, $basePath, $newLevel, null, null, $current, $exclude); $icon = 'folder.png'; if ($child->id == $current) { $icon = 'folder_wrench.png'; } } else { $icon = 'page_white_text.png'; if ($child->id == $current) { $icon = 'page_white_wrench.png'; } $submenu = false; } $label = $child->name; if ($child->id == $exclude) { $links[] = $this->_getExcludeElement($label, $submenu, $icon); } else { $links[] = '<li class="menuItem">' . $this->view->link($label, $link . $child->id, $icon, null, null, null, $translate) . $submenu . '</li>'; } } if (is_array($links)) { if ($level == 0) { $strId = 'id="' . $id . '"'; } else { $strId = null; } $filetree = "<ul {$strId}>" . implode(null, $links) . '</ul>'; return $filetree; } }