" . __("This table shows in columns the modules group and in rows agents group. The cell shows all modules") . "

"; $agentGroups = get_user_groups ($config['id_user'], "AR", false); $modelGroups = get_all_model_groups(); array_walk($modelGroups, 'translate'); //Translate all head titles to language is set $head = $modelGroups; array_unshift($head, ' '); //Metaobject use in print_table $table = null; $table->align[0] = 'right'; //Align to right the first column. $table->style[0] = 'color: #ffffff; background-color: #778866; font-weight: bolder;'; $table->head = $head; $table->width = '95%'; //The content of table $tableData = array(); //Create rows and celds foreach ($agentGroups as $idAgentGroup => $name) { $row = array(); array_push($row, $name); foreach ($modelGroups as $idModelGroup => $modelGroup) { $query = sprintf($sql,$idAgentGroup, $idModelGroup); $rowsDB = get_db_all_rows_sql ($query); $states = array(); if ($rowsDB !== false) { foreach ($rowsDB as $rowDB) { $states[$rowDB['estado']] = $rowDB['count']; } } $count = 0; foreach ($states as $idState => $state) { $count = $state; } $color = 'transparent'; //Defaut color for cell $font_color = '#000000'; //Default font color for cell if ($count == 0) { $color = '#eeeeee'; //Soft grey when the cell for this model group and agent group hasn't modules. $alinkStart = ''; $alinkEnd = ''; } else { // TODO: ADD Alerts fired status /*if (array_key_exists(4,$states)) { $color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired. }*/ if (array_key_exists(1,$states)) { $color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state. $font_color = '#ffffff'; } elseif (array_key_exists(2,$states)) { $color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state. } elseif (array_key_exists(3,$states)) { $color = '#babdb6'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state. } elseif (array_key_exists(0,$states)) { $color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules. } $alinkStart = ''; $alinkEnd = ''; } array_push($row, '
' . $alinkStart . $count . $alinkEnd . '
'); } array_push($tableData,$row); } $table->data = $tableData; print_table($table); echo "

" . __("The colours meaning:") . "

" . "

"; } add_operation_menu_option(__("Modules groups"), 'estado', 'module_groups/icon_menu.png'); add_extension_main_function('mainModuleGroups'); ?>