checkACL()) {
$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['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');
$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;
foreach ($this->groups as $group) {
$ui->contentAddHtml('
');
$ui->contentAddHtml('
');
$ui->contentAddHtml('
' . $group['group_name'] . '
');
$ui->contentAddHtml('
');
$ui->contentAddHtml('- ' .
__('Agents') .
' ' . $group[__('Agents')] .
'
');
$ui->contentAddHtml('- ' .
__('Agents unknown') .
' ' . $group[__('Agents unknown')] .
'
');
$ui->contentAddHtml('- ' .
__('Unknown') .
' ' . $group[__('Unknown')] .
'
');
$ui->contentAddHtml('- ' .
__('Not init') .
' ' . $group[__('Not init')] .
'
');
$ui->contentAddHtml('- ' .
__('Normal') .
' ' . $group[__('Normal')] .
'
');
$ui->contentAddHtml('- ' .
__('Warning') .
' ' . $group[__('Warning')] .
'
');
$ui->contentAddHtml('- ' .
__('Critical') .
' ' . $group[__('Critical')] .
'
');
$ui->contentAddHtml('- ' .
__('Alerts fired') .
' ' . $group[__('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();
$user = User::getInstance();
// Get group list that user has access
$groups_full = users_get_groups($user->getIdUser(), "AR", true, true);
$groups = array();
foreach ($groups_full as $group) {
$groups[$group['id_grupo']]['name'] = $group['nombre'];
if ($group['id_grupo'] != 0) {
$groups[$group['parent']]['childs'][] = $group['id_grupo'];
$groups[$group['id_grupo']]['prefix'] = $groups[$group['parent']]['prefix'].' ';
}
else {
$groups[$group['id_grupo']]['prefix'] = '';
}
if (!isset($groups[$group['id_grupo']]['childs'])) {
$groups[$group['id_grupo']]['childs'] = array();
}
}
// For each valid group for this user, take data from agent and modules
foreach ($groups as $id_group => $group) {
$rows = groups_get_group_row_data($id_group, $groups, $group, $printed_groups);
if (!empty($rows))
$return = array_merge($return, $rows);
}
return $return;
}
}