public function show() { global $ms, $session, $tmpl; /* If authentication is enabled, check permissions */ if ($ms->getOption("authentication") == "Y" && !$ms->checkPermissions("user_show_rules")) { static::raiseError("You do not have enough permissions to access this module!"); return false; } if (($host_id = $session->getCurrentHostProfile()) === false) { static::raiseError('Do not know for which host I am working for!'); return false; } try { $nps = new \MasterShaper\Models\NetworkPathsModel(array('host_idx' => $host_id, 'active' => 'Y')); } catch (\Exception $e) { static::raiseError(__METHOD__ . '(), failed to load NetworkPathsModel!', false, $e); return false; } if (!$nps->hasItems()) { return parent::show(); } $tmpl->assign('nps', $nps); return parent::show(); if (($network_paths = $nps->getItems()) === false) { static::raiseError(get_class($nps) . '::getItems() returned false!'); return false; } foreach ($network_paths as $np) { $id = array_push($this->rules, $np); if (($netpath_idx = $np->getIdx()) === false) { static::raiseError(get_class($np) . '::getIdx() returned false!'); return false; } if (($chains = $np->getActiveChains()) === false) { static::raiseError(get_class($np) . '::getActiveChains() returned false!'); return false; } foreach ($chains as $chain) { if (($chain_idx = $chain->getIdx()) === false) { static::raiseError(get_class($chain) . '::getIdx() returned false!'); return false; } if (($pipes = $chain->getActivePipes()) === false) { static::raiseError(get_class($chain) . '::getActivePipes() returned false!'); return false; } foreach ($pipes as $pipe) { array_push($this->pipes[$chain_idx], $pipe); if (($pipe_idx = $pipe->getIdx()) === false) { static::raiseError(get_class($pipe) . '::getIdx() returned false!'); return false; } if (!isset($this->filters[$pipe_idx]) || !is_array($this->filters[$pipe_idx])) { $this->filters[$pipe_idx] = array(); } if (($filters = $pipe->getActiveFilters()) === false) { static::raiseError(get_class($pipe) . '::getActiveFilters() returned false!'); return false; } foreach ($filters as $filter) { array_push($this->filters[$pipe_idx], $filter); } } } } if (!$tmpl->registerPlugin("block", "ov_netpath", array(&$this, "smartyOverviewNetpath"))) { static::raiseError(get_class($tmpl) . '::registerPlugin() returned false!'); return false; } if (!$tmpl->registerPlugin("block", "ov_chain", array(&$this, "smartyOverviewChain"))) { static::raiseError(get_class($tmpl) . '::registerPlugin() returned false!'); return false; } if (!$tmpl->registerPlugin("block", "ov_pipe", array(&$this, "smartyOverviewPipe"))) { static::raiseError(get_class($tmpl) . '::registerPlugin() returned false!'); return false; } if (!$tmpl->registerPlugin("block", "ov_filter", array(&$this, "smartyOverviewFilter"))) { static::raiseError(get_class($tmpl) . '::registerPlugin() returned false!'); return false; } return parent::show(); }