checkACL($this->acl)) {
$this->correct_acl = true;
$this->groups = $this->getListGroups();
//~ foreach ($this->groups as $key => $group) {
//~ $this->status[$key] = $group['status'];
//~ unset($this->groups[$key]['status']);
//~ }
}
else {
$this->correct_acl = false;
}
}
public function show() {
if (!$this->correct_acl) {
$this->show_fail_acl();
}
else {
$this->show_group();
}
}
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_group() {
$ui = Ui::getInstance();
$ui->createPage();
$ui->createDefaultHeader(__("Groups"), $ui->createHeaderButton(
array('icon' => 'back',
'pos' => 'left',
'text' => __('Back'),
'href' => 'index.php?page=home')));
$ui->showFooter(false);
$ui->beginContent();
$ui->contentAddHtml('
');
$count = 0;
$url_agent = 'index.php?page=agents&group=%s&status=%s';
$url_modules = 'index.php?page=modules&group=%s&status=%s';
foreach ($this->groups as $group) {
// Calculate entire row color
if ($group["_monitors_alerts_fired_"] > 0) {
$color_class = 'group_view_alrm';
$status_image = ui_print_status_image ('agent_alertsfired_ball.png', "", true);
}
elseif ($group["_monitors_critical_"] > 0) {
$color_class = 'group_view_crit';
$status_image = ui_print_status_image ('agent_critical_ball.png', "", true);
}
elseif ($group["_monitors_warning_"] > 0) {
$color_class = 'group_view_warn';
$status_image = ui_print_status_image ('agent_warning_ball.png', "", true);
}
elseif ($group["_monitors_ok_"] > 0) {
$color_class = 'group_view_ok';
$status_image = ui_print_status_image ('agent_ok_ball.png', "", true);
}
elseif (($group["_monitors_unknown_"] > 0) || ($group["_agents_unknown_"] > 0)) {
$color_class = 'group_view_unk';
$status_image = ui_print_status_image ('agent_no_monitors_ball.png', "", true);
}
else {
$color_class = '';
$status_image = ui_print_status_image ('agent_no_data_ball.png', "", true);
}
$group['icon'] = ($group['icon'] == '') ? 'world' : $group['icon'];
$ui->contentAddHtml('
');
$ui->contentAddHtml('
');
$ui->contentAddHtml('
' . $group['_name_'] . '
');
$ui->contentAddHtml('
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/agent.png', true, false,false, false, false, true) . __('Total agents') . '' .
'' . $group['_total_agents_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/agent_notinit.png', true, false,false, false, false, true) . __('Agents not init') . '' .
'' . $group['_agents_not_init_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/agent_critical.png', true, false,false, false, false, true) . __('Agents critical') . '' .
'' . $group['_agents_critical_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/agent_unknown.png', true, false,false, false, false, true) . __('Agents unknown') . '' .
'' . $group['_agents_unknown_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/module_unknown.png', true, false,false, false, false, true) . __('Unknown modules') . '' .
'' . $group['_monitors_unknown_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/module_notinit.png', true, false,false, false, false, true) . __('Not init modules') . '' .
'' . $group['_monitors_not_init_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/module_ok.png', true, false,false, false, false, true) . __('Normal modules') . '' .
'' . $group['_monitors_ok_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/module_warning.png', true, false,false, false, false, true) . __('Warning modules') . '' .
'' . $group['_monitors_warning_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/module_critical.png', true, false,false, false, false, true) . __('Critical modules') . '' .
'' . $group['_monitors_critical_'] . '' .
'
');
$ui->contentAddHtml('- ' .
'' . html_print_image('images/bell_error.png', true, false,false, false, false, true) . __('Alerts fired') . '' .
'' . $group['_monitors_alerts_fired_'] . '' .
'
');
$ui->contentAddHtml('
');
$ui->contentAddHtml('
');
$count++;
}
$ui->contentAddHtml('
');
//$ui->contentAddHtml(ob_get_clean());
//~ $table = new Table();
//~ $table->setId('list_groups');
//~ $table->setClass('group_view');
//~ $table->importFromHash($this->groups);
//~ $table->setRowClass($this->status);
//~ $ui->contentAddHtml($table->getHTML());
$ui->endContent();
$ui->showPage();
}
private function getListGroups() {
$return = array();
$system = System::getInstance();
$user = User::getInstance();
$all_data = groupview_status_modules_agents ($system->getConfig('id_user'), false, 'AR', false);
$result_groups = groupview_get_groups_list($system->getConfig('id_user'), false, 'AR', true, true);
foreach ($all_data as $group_all_data) {
$result_groups[0]['_total_agents_'] += $group_all_data["_total_agents_"];
$result_groups[0]['_monitors_ok_'] += $group_all_data["_monitors_ok_"];
$result_groups[0]['_monitors_warning_'] += $group_all_data["_monitors_warning_"];
$result_groups[0]['_monitors_critical_'] += $group_all_data["_monitors_critical_"];
$result_groups[0]['_monitors_unknown_'] += $group_all_data["_monitors_unknown_"];
$result_groups[0]['_monitors_not_init_'] += $group_all_data["_monitors_not_init_"];
$result_groups[0]['_agents_unknown_'] += $group_all_data["_agents_unknown_"];
$result_groups[0]['_agents_not_init_'] += $group_all_data["_agents_not_init_"];
$result_groups[0]['_agents_critical_'] += $group_all_data["_agents_critical_"];
$result_groups[0]['_monitors_alerts_fired_'] += $group_all_data["_monitors_alerts_fired_"];
}
return $result_groups;
}
}