checkACL($this->acl)) { $this->correct_acl = true; } else { $this->correct_acl = false; } } public function ajax($parameter2 = false) { $system = System::getInstance(); if (!$this->correct_acl) { return; } else { switch ($parameter2) { case 'xxx': //$this->getFilters(); //$page = $system->getRequest('page', 0); break; } } } private function getFilters() { $system = System::getInstance(); $user = User::getInstance(); $this->default_filters['group'] = true; $this->default_filters['type'] = true; $this->group = (int)$system->getRequest('group', __("Group")); if (!$user->isInGroup($this->acl, $this->group)) { $this->group = 0; } if (($this->group === __("Group")) || ($this->group == 0)) { $this->group = 0; } else { $this->default = false; $this->default_filters['group'] = false; } $this->type = $system->getRequest('type', __("Type")); if (($this->type === __("Type")) || ($this->type === '0')) { $this->type = '0'; } else { $this->default = false; $this->default_filters['type'] = false; } } public function show() { if (!$this->correct_acl) { $this->show_fail_acl(); } else { $this->getFilters(); $this->show_networkmaps(); } } private function show_fail_acl() { $error['type'] = 'onStart'; $error['title_text'] = __('You don\'t have access to this page'); $error['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.

Please know that all attempts to access this page are recorded in security logs of Pandora System Database'); if (class_exists("HomeEnterprise")) $home = new HomeEnterprise(); else $home = new Home(); $home->show($error); } private function show_networkmaps() { $ui = Ui::getInstance(); $ui->createPage(); $ui->createDefaultHeader(__("Networkmaps"), $ui->createHeaderButton( array('icon' => 'back', 'pos' => 'left', 'text' => __('Back'), 'href' => 'index.php?page=home'))); $ui->showFooter(false); $ui->beginContent(); $filter_title = sprintf(__('Filter Networkmaps by %s'), $this->filterNetworkmapsGetString()); $ui->contentBeginCollapsible($filter_title); $ui->beginForm("index.php?page=networkmaps"); $system = System::getInstance(); $groups = users_get_groups_for_select( $system->getConfig('id_user'), "AR", true, true, false, 'id_grupo'); $options = array( 'name' => 'group', 'title' => __('Group'), 'label' => __('Group'), 'items' => $groups, 'selected' => $this->group ); $ui->formAddSelectBox($options); $networkmap_types = networkmap_get_filter_types(); $networkmap_types[0] = __('All'); $options = array( 'name' => 'type', 'title' => __('Type'), 'label' => __('Type'), 'items' => $networkmap_types, 'selected' => $this->type ); $ui->formAddSelectBox($options); $options = array( 'icon' => 'refresh', 'icon_pos' => 'right', 'text' => __('Apply Filter') ); $ui->formAddSubmitButton($options); $html = $ui->getEndForm(); $ui->contentCollapsibleAddItem($html); $ui->contentEndCollapsible(); $this->listNetworkmapsHtml(); $ui->endContent(); $ui->showPage(); } private function listNetworkmapsHtml() { $system = System::getInstance(); $ui = Ui::getInstance(); // Create filter $where = array(); // Order by type field $where['order'] = 'type'; if ($this->group != '0') { $where['store_group'] = $this->group; } else { $where['store_group'] = array_keys(users_get_groups()); } if ($this->type != '0') $where['type'] = $this->type; $network_maps = db_get_all_rows_filter('tnetwork_map', $where); if (empty($network_maps)) { $network_maps = array(); } $list = array(); foreach ($network_maps as $networkmap) { // ACL if (! $system->checkACL("AR", $networkmap['store_group'])) continue; // If enterprise not loaded then skip this code if ($networkmap['type'] == 'policies' and (!defined('PANDORA_ENTERPRISE'))) continue; $row = array(); $row[__('Name')] = '' . io_safe_output($networkmap['name']) . ''; $row[__('Type')] = $networkmap['type']; $row[__('Group')] = ui_print_group_icon($networkmap["store_group"], true, "groups_small", "" , false); $list[] = $row; } if (count($network_maps) == 0) { $ui->contentAddHtml('

' . __('No networkmaps') . '

'); } else { $table = new Table(); $table->id = 'list_networkmaps'; $table->importFromHash($list); $ui->contentAddHtml($table->getHTML()); } $ui->contentAddLinkListener('list_networkmaps'); } private function filterNetworkmapsGetString() { if ($this->default) { return __("(Default)"); } else { $filters_to_serialize = array(); if (!$this->default_filters['group']) { $filters_to_serialize[] = sprintf(__("Group: %s"), groups_get_name($this->group, true)); } if (!$this->default_filters['type']) { $networkmap_types = networkmap_get_filter_types(); $networkmap_types[0] = __('All'); $filters_to_serialize[] = sprintf(__("Type: %s"), $networkmap_types[$this->type]); } $string = '(' . implode(' - ', $filters_to_serialize) . ')'; //~ $networkmap_types = networkmap_get_filter_types(); //~ $networkmap_types[0] = __('All'); //~ $type = $networkmap_types[$this->type]; //~ $group = groups_get_name($this->group, true); //~ //~ //~ $string = sprintf( //~ __("(Type: %s - Group: %s)"), //~ $type, $group); return $string; } } } ?>