function addEntry(AdminMenuEntry $entry, $subentries = array(), $offset = -1) { if ($offset == -1) { $offset = count($this->entries); } $history = AdminHistory::getInstance(); $current_node = $this->admin->node; $node = $history->getNodeByDepth($current_node->getId(), 1); $selected = false; $arr_sub = array(); foreach ($subentries as $subentry) { $sub = $subentry->toArray(); $sub[2] = $node && $subentry->getPath() == $node->getPath() && $subentry->getArguments() == $node->getArguments(); $selected = $selected || $sub[2]; $arr_sub[] = $sub; } $entry_arr = $entry->toArray(); $entry_arr[2] = false; if ($subentries) { $entry_arr[2] = $selected; } else { if ($node) { $entry_arr[2] = $entry->getPath() == $node->getPath(); } } $insert = array('entry' => $entry_arr, 'subentries' => $arr_sub); if (isset($this->entries[$offset])) { array_splice($this->entries, $offset, 0, array($insert)); } else { $this->entries[$offset] = $insert; } ksort($this->entries); }
final function initialize($admin, $components) { $this->node = $admin->node; $this->history = AdminHistory::getInstance(); $this->admin = $admin; $this->components = $components; $this->valid = $this->load->validator(); }
function breadcrumb() { $this->helper->filter->defaults($this->args, array('current_node_id' => '')); $history = AdminHistory::getInstance(); $list = $history->getBranch($this->args['current_node_id']); $links = array(); foreach ($list as $id => $node) { $links[] = array('text' => $node->getTitle(), 'url' => '/admin/node/' . $id); } $this->view->addHelper('text'); $this->view->set('links', $links); }
function __construct(Context $context) { $this->context = $context; $history = $this->history = AdminHistory::getInstance(); $url = $this->url = new AdminUrlBuilder(); $node = $this->node = $url->getNode($context->getArguments()); $schema = $this->schema = new AdminSchema(); $menu = $this->menu = new AdminMenu($this); $load = new Loader($context); $components = $this->components = new AdminComponentList($load, $this); $modules = array(); $dirs = scandir(APPD_APPLICATION); foreach ($dirs as $dir) { if ($dir[0] != '.') { $file = APPD_APPLICATION . DS . $dir . DS . 'admin' . DS . $dir . 'admin.utility.php'; if (file_exists($file)) { $utility = $load->utility("/{$dir}/admin/{$dir}admin"); $utility->initialize($this, $components); $modules[$dir] = $utility; } $file_config = APPD_APPLICATION . DS . $dir . DS . 'admin' . DS . $dir . 'config.utility.php'; if (file_exists($file_config)) { $utility_config = $load->utility("/{$dir}/admin/{$dir}config"); $utility_config->configureSchema($schema); $utility_config->configureMenu($menu); } } } $this->modules = $modules; $current_module = $this->node->getModule(); $module = false; if (isset($this->modules[$current_module])) { $module = $this->modules[$current_module]; } if (!$module) { return false; } $module->execute(); }
function getParentNode() { $history = AdminHistory::getInstance(); return $history->getNode($this->node['parent']); }
function __construct() { $this->history = AdminHistory::getInstance(); }