checkACL($this->acl)) { $this->allowed = true; } else { $this->allowed = false; } } /** * Prepare filters for current view. * * @return void */ private function getFilters() { $system = System::getInstance(); $user = User::getInstance(); $this->defaultFilters['group'] = true; $this->defaultFilters['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->defaultFilters['group'] = false; } $this->type = $system->getRequest('type', __('Type')); if (($this->type === __('Type')) || ($this->type === '0')) { $this->type = '0'; } else { $this->default = false; $this->defaultFilters['type'] = false; } } /** * Run view. * * @return void */ public function show() { if (!$this->allowed) { $this->show_fail_acl(); } else { $this->getFilters(); $this->show_visualmaps(); } } /** * Show a message about failed ACL access. * * @return void */ private function show_fail_acl() { $error['type'] = 'onStart'; $error['title_text'] = __('You don\'t have access to this page'); $error['content_text'] = System::getDefaultACLFailText(); // Redirect to main page. if (class_exists('HomeEnterprise') === true) { $home = new HomeEnterprise(); } else { $home = new Home(); } $home->show($error); } /** * Show visual console list header. * * @return void */ private function show_visualmaps() { $ui = Ui::getInstance(); $ui->createPage(); $ui->createDefaultHeader( __('Visual consoles'), $ui->createHeaderButton( [ 'icon' => 'ui-icon-back', 'pos' => 'left', 'text' => __('Back'), 'href' => 'index.php?page=home', 'class' => 'header-button-left', ] ) ); $ui->showFooter(false); $ui->beginContent(); $this->listVisualmapsHtml(); $ui->endContent(); $ui->showPage(); } /** * Show list of visual consoles. * * @return void */ private function listVisualmapsHtml() { $system = System::getInstance(); $ui = Ui::getInstance(); $visualmaps = visual_map_get_user_layouts(); if (empty($visualmaps) === true) { $ui->contentAddHtml('

'.__('No maps defined').'

'); } else { $table = new Table(); // Without header jquery.mobile crashes. $table->addHeader(['']); $table->id = 'list_visualmaps'; foreach ($visualmaps as $map) { $link = ''.io_safe_output($map['name']).''; $row = $link; $row .= ui_print_group_icon( $map['id_group'], true, 'groups_small', '', false ); $table->addRow([ $map['id'].' flex-center' => $row]); } $ui->contentAddHtml($table->getHTML()); $ui->contentAddLinkListener('list_visualmaps'); } } }