2011-07-21 Sergio Martin <sergio.martin@artica.es>

* include/functions_users.php
	extensions/module_groups.php
	godmode/groups/modu_group_list.php
	godmode/groups/group_list.php
	godmode/alerts/alert_commands.php
	godmode/setup/os.list.php
	godmode/setup/news.php
	godmode/users/profile_list.php
	godmode/modules/manage_network_components.php
	godmode/modules/manage_nc_groups.php: Fixed several lonely 
	headers when no data and other no data little bugs for 3371455



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4614 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2011-07-21 12:37:24 +00:00
parent e190fee36f
commit d5a0415def
11 changed files with 337 additions and 275 deletions

View File

@ -1,3 +1,17 @@
2011-07-21 Sergio Martin <sergio.martin@artica.es>
* include/functions_users.php
extensions/module_groups.php
godmode/groups/modu_group_list.php
godmode/groups/group_list.php
godmode/alerts/alert_commands.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/users/profile_list.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php: Fixed several lonely
headers when no data and other no data little bugs for 3371455
2011-07-21 Ramon Novoa <rnovoa@artica.es>
* include/functions_config.php: Set dbtype to mysql by default

View File

@ -125,140 +125,146 @@ function mainModuleGroups() {
$agentGroups = users_get_groups ($config['id_user'], "AR", false);
$modelGroups = users_get_all_model_groups();
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
foreach ($modelGroups as $i => $n) {
$modelGroups[$i] = ui_print_truncate_text($n, 20);
}
if(!empty($agentGroups) && !empty($modelGroups)) {
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
$head = $modelGroups;
array_unshift($head, '&nbsp;');
//Metaobject use in html_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();
$fired = false;
//Create rows and cells
foreach ($agentGroups as $idAgentGroup => $name) {
foreach ($modelGroups as $i => $n) {
$modelGroups[$i] = ui_print_truncate_text($n, 20);
}
$head = $modelGroups;
array_unshift($head, '&nbsp;');
$row = array();
//Metaobject use in html_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%';
array_push($row, ui_print_truncate_text($name, 20));
foreach ($modelGroups as $idModelGroup => $modelGroup) {
$query = sprintf($sql,$idAgentGroup, $idModelGroup);
//The content of table
$tableData = array();
$fired = false;
//Create rows and cells
foreach ($agentGroups as $idAgentGroup => $name) {
$rowsDB = db_get_all_rows_sql ($query);
$row = array();
$agents = agents_get_group_agents($idAgentGroup);
if (!empty($agents)) {
$alerts = agents_get_alerts_simple($agents);
array_push($row, ui_print_truncate_text($name, 20));
foreach ($modelGroups as $idModelGroup => $modelGroup) {
$query = sprintf($sql,$idAgentGroup, $idModelGroup);
foreach ($alerts as $alert) {
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
$rowsDB = db_get_all_rows_sql ($query);
$agents = agents_get_group_agents($idAgentGroup);
if (!empty($agents)) {
$alerts = agents_get_alerts_simple($agents);
if ($idModelGroup == $module['id_module_group']) {
if ($alert["times_fired"] > 0) {
$fired = true;
foreach ($alerts as $alert) {
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
if ($idModelGroup == $module['id_module_group']) {
if ($alert["times_fired"] > 0) {
$fired = true;
}
}
}
}
}
$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 {
}
if ($fired) {
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired.
}
else 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.
$states = array();
if ($rowsDB !== false) {
foreach ($rowsDB as $rowDB) {
$states[$rowDB['estado']] = $rowDB['count'];
}
}
$count = 0;
foreach ($states as $idState => $state) {
$count += $state;
}
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' . $idModelGroup . '&id_agent_group=' . $idAgentGroup . '"
href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' . $idAgentGroup .
'&modulegroup=' . $idModelGroup . '" style="color: ' . $font_color . '; font-size: 18px;";>';
$alinkEnd = '</a>';
$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 {
if ($fired) {
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired.
}
else 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 = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' . $idModelGroup . '&id_agent_group=' . $idAgentGroup . '"
href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' . $idAgentGroup .
'&modulegroup=' . $idModelGroup . '" style="color: ' . $font_color . '; font-size: 18px;";>';
$alinkEnd = '</a>';
}
array_push($row,
'<div
style="background: ' . $color . ';
height: 25px;
margin-left: auto; margin-right: auto;
text-align: center; padding-top: 0px; font-size: 18px;">
' . $alinkStart . $count . $alinkEnd . '</div>');
}
array_push($row,
'<div
style="background: ' . $color . ';
height: 25px;
margin-left: auto; margin-right: auto;
text-align: center; padding-top: 0px; font-size: 18px;">
' . $alinkStart . $count . $alinkEnd . '</div>');
array_push($tableData,$row);
}
array_push($tableData,$row);
$table->data = $tableData;
echo "<div style='width:98%; overflow-x:scroll;'>";
html_print_table($table);
echo "</div>";
echo "<p>" . __("The colours meaning:") .
"<ul style='float: left;'>" .
'<li style="clear: both;">
<div style="float: left; background: #ffa300; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Orange cell when the module group and agent have at least one alarm fired.") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #cc0000; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Red cell when the module group and agent have at least one module in critical status and the others in any status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #fce94f; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #8ae234; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Green cell when the module group and agent have all modules in OK status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #babdb6; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Grey cell when the module group and agent have at least one in unknown status and the others in green status") .
'</li>' .
"</ul>" .
"</p>";
}
else {
echo "<div class='nf'>".__('There are no defined groups or module groups')."</div>";
}
$table->data = $tableData;
echo "<div style='width:98%; overflow-x:scroll;'>";
html_print_table($table);
echo "</div>";
echo "<p>" . __("The colours meaning:") .
"<ul style='float: left;'>" .
'<li style="clear: both;">
<div style="float: left; background: #ffa300; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Orange cell when the module group and agent have at least one alarm fired.") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #cc0000; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Red cell when the module group and agent have at least one module in critical status and the others in any status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #fce94f; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #8ae234; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Green cell when the module group and agent have all modules in OK status") .
'</li>' .
'<li style="clear: both;">
<div style="float: left; background: #babdb6; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;">&nbsp;</div>' .
__("Grey cell when the module group and agent have at least one in unknown status and the others in green status") .
'</li>' .
"</ul>" .
"</p>";
ui_require_css_file('cluetip');
ui_require_jquery_file('cluetip');

View File

@ -162,7 +162,12 @@ foreach ($commands as $command) {
array_push ($table->data, $data);
}
html_print_table ($table);
if(isset($data)) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('No alert commands configured')."</div>";
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_command">';

View File

@ -205,111 +205,125 @@ if ($delete_group) {
}
$table->width = '98%';
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('ID');
$table->head[2] = __('Icon');
$table->head[3] = __('Alerts');
$table->head[4] = __('Actions');
$table->align = array ();
$table->align[2] = 'center';
$table->align[4] = 'center';
$table->data = array ();
$groups = users_get_groups_tree ($config['id_user'], "AR", true);
$iterator = 0;
$table->width = '98%';
foreach ($groups as $id_group => $group) {
if ($group['deep'] == 0) {
$table->rowstyle[$iterator] = '';
}
else {
if ($group['parent'] != 0) {
$table->rowstyle[$iterator] = 'display: none;';
if(!empty($groups)) {
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('ID');
$table->head[2] = __('Icon');
$table->head[3] = __('Alerts');
$table->head[4] = __('Actions');
$table->align = array ();
$table->align[2] = 'center';
$table->align[4] = 'center';
$table->data = array ();
$iterator = 0;
foreach ($groups as $id_group => $group) {
if ($group['deep'] == 0) {
$table->rowstyle[$iterator] = '';
}
}
$symbolBranchs = '';
if ($group['id_grupo'] != 0) {
//Make a list of parents this group
$end = false;
$unloop = true;
$parents = null;
$parents[] = $group['parent'];
while (!$end) {
$lastParent = end($parents);
if ($lastParent == 0) {
$end = true;
else {
if ($group['parent'] != 0) {
$table->rowstyle[$iterator] = 'display: none;';
}
else {
$unloop = true;
foreach ($groups as $id => $node) {
if ($node['id_grupo'] == 0) {
continue;
}
$symbolBranchs = '';
if ($group['id_grupo'] != 0) {
//Make a list of parents this group
$end = false;
$unloop = true;
$parents = null;
$parents[] = $group['parent'];
while (!$end) {
$lastParent = end($parents);
if ($lastParent == 0) {
$end = true;
}
else {
$unloop = true;
foreach ($groups as $id => $node) {
if ($node['id_grupo'] == 0) {
continue;
}
if ($node['id_grupo'] == $lastParent) {
array_push($parents, $node['parent']);
$unloop = false;
}
}
if ($node['id_grupo'] == $lastParent) {
array_push($parents, $node['parent']);
$unloop = false;
//For exit of infinite loop
if ($unloop) {
break;
}
}
//For exit of infinite loop
if ($unloop) {
break;
}
$table->rowclass[$iterator] = 'parent_' . $group['parent'];
//Print the branch classes (for close a branch with child branch in the
//javascript) of this parent as example:
//
// the tree (0(1,2(4,5),3))
// for the group 4 have the style "parent_4 branch_0 branch_2"
if (!empty($parents)) {
foreach ($parents as $idParent) {
$table->rowclass[$iterator] .= ' branch_' . $idParent;
$symbolBranchs .= ' symbol_branch_' . $idParent;
}
}
}
$table->rowclass[$iterator] = 'parent_' . $group['parent'];
$tabulation = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $group['deep']);
//Print the branch classes (for close a branch with child branch in the
//javascript) of this parent as example:
//
// the tree (0(1,2(4,5),3))
// for the group 4 have the style "parent_4 branch_0 branch_2"
if (!empty($parents)) {
foreach ($parents as $idParent) {
$table->rowclass[$iterator] .= ' branch_' . $idParent;
$symbolBranchs .= ' symbol_branch_' . $idParent;
}
if ($group['id_grupo'] == 0) {
$symbol = '-';
}
else {
$symbol = '+';
}
if ($group['hash_branch']) {
$data[0] = '<strong>'.$tabulation . ' ' .
'<a href="javascript: showBranch(' . $group['id_grupo'] . ', ' . $group['parent'] . ');" title="' . __('Show branch children') . '"><span class="symbol_' . $group['id_grupo'] . ' ' . $symbolBranchs . '">' . $symbol . '</span> '. ui_print_truncate_text($group['nombre']).'</a></strong>';
}
else {
$data[0] = '<strong>'.$tabulation . ' '. ui_print_truncate_text($group['nombre'], 60).'</strong>';
}
$data[1] = $group['id_grupo'];
$data[2] = ui_print_group_icon($group['id_grupo'], true);
$data[3] = $group['disabled'] ? __('Disabled') : __('Enabled');
if ($group['id_grupo'] == 0) {
$data[4] = '';
}
else {
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'].'">' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0'));
$data[4] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$id_group.'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0'));
}
array_push ($table->data, $data);
$iterator++;
}
$tabulation = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $group['deep']);
if ($group['id_grupo'] == 0) {
$symbol = '-';
}
else {
$symbol = '+';
}
if ($group['hash_branch']) {
$data[0] = '<strong>'.$tabulation . ' ' .
'<a href="javascript: showBranch(' . $group['id_grupo'] . ', ' . $group['parent'] . ');" title="' . __('Show branch children') . '"><span class="symbol_' . $group['id_grupo'] . ' ' . $symbolBranchs . '">' . $symbol . '</span> '. ui_print_truncate_text($group['nombre']).'</a></strong>';
}
else {
$data[0] = '<strong>'.$tabulation . ' '. ui_print_truncate_text($group['nombre'], 60).'</strong>';
}
$data[1] = $group['id_grupo'];
$data[2] = ui_print_group_icon($group['id_grupo'], true);
$data[3] = $group['disabled'] ? __('Disabled') : __('Enabled');
if ($group['id_grupo'] == 0) {
$data[4] = '';
}
else {
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'].'">' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0'));
$data[4] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$id_group.'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0'));
}
array_push ($table->data, $data);
$iterator++;
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined groups')."</div>";
}
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/groups/configure_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
?>
<script type="text/javascript">
function showBranch(parent) {
display = $('.parent_' + parent).css('display');
@ -328,14 +342,3 @@ function showBranch(parent) {
}
}
</script>
<?php
html_print_table ($table);
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/groups/configure_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
?>

View File

@ -129,31 +129,36 @@ if ($delete_group) {
echo "<h3 class='suc'>".__('Group successfully deleted')."</h3>";
}
$table->width = '98%';
$table->head = array ();
$table->head[0] = __('ID');
$table->head[1] = __('Name');
$table->head[2] = __('Delete');
$table->align = array ();
$table->align[1] = 'left';
$table->align[2] = 'center';
$table->data = array ();
$sql = "SELECT *
FROM tmodule_group ";
$groups = db_get_all_rows_sql ($sql, true);
$table->width = '98%';
foreach ($groups as $id_group ) {
$data = array ();
$data[0] = $id_group["id_mg"];
$data[1] = '<strong><a href="index.php?sec=gagente&sec2=godmode/groups/configure_modu_group&id_group='.$id_group["id_mg"].'">' . ui_print_truncate_text($id_group["name"], 50).'</a></strong>';
$data[2] = '<a href="index.php?sec=gagente&sec2=godmode/groups/modu_group_list&id_group='.$id_group["id_mg"].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
array_push ($table->data, $data);
if(!empty($groups)) {
$table->head = array ();
$table->head[0] = __('ID');
$table->head[1] = __('Name');
$table->head[2] = __('Delete');
$table->align = array ();
$table->align[1] = 'left';
$table->align[2] = 'center';
$table->data = array ();
foreach ($groups as $id_group ) {
$data = array ();
$data[0] = $id_group["id_mg"];
$data[1] = '<strong><a href="index.php?sec=gagente&sec2=godmode/groups/configure_modu_group&id_group='.$id_group["id_mg"].'">' . ui_print_truncate_text($id_group["name"], 50).'</a></strong>';
$data[2] = '<a href="index.php?sec=gagente&sec2=godmode/groups/modu_group_list&id_group='.$id_group["id_mg"].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
array_push ($table->data, $data);
}
html_print_table ($table);
}
else{
echo "<div class='nf'>".__('There are no defined module groups')."</div>";
}
html_print_table ($table);
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/groups/configure_modu_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';

View File

@ -85,6 +85,14 @@ $url = ui_get_url_refresh (array ('offset' => false,
'upd' => false,
'id_sg' => false));
$filter = array ();
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
$groups = db_get_all_rows_filter ('tnetwork_component_group', $filter);
if ($groups === false)
$groups = array ();
$table->width = '98%';
$table->head = array ();
$table->head[0] = __('Name');
@ -103,14 +111,6 @@ $table->data = array ();
$total_groups = db_get_all_rows_filter ('tnetwork_component_group', false, 'COUNT(*) AS total');
$total_groups = $total_groups[0]['total'];
$filter = array ();
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
$groups = db_get_all_rows_filter ('tnetwork_component_group', $filter);
if ($groups === false)
$groups = array ();
ui_pagination ($total_groups, $url);
foreach ($groups as $group) {
@ -130,7 +130,13 @@ foreach ($groups as $group) {
array_push ($table->data, $data);
}
html_print_table ($table);
if(isset($data)) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined component groups')."</div>";
}
echo '<form method="post">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';

View File

@ -299,6 +299,7 @@ if ($components === false)
$components = array ();
unset ($table);
$table->width = '98%';
$table->head = array ();
$table->head[0] = __('Module name');
@ -340,7 +341,13 @@ foreach ($components as $component) {
array_push ($table->data, $data);
}
html_print_table ($table);
if(isset($data)) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined network components')."</div>";
}
echo '<form method="post" action="'.$url.'">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -349,7 +356,7 @@ html_print_select (array (2 => __('Create a new network component'),
4 => __('Create a new plugin component'),
6 => __('Create a new WMI component')),
'id_component_type', '', '', '', '', '');
html_print_submit_button (__('Create'), 'crt', false, 'class="sub next"');
html_print_submit_button (__('Create'), 'crt', false, 'class="sub next" style="margin-left: 5px;"');
echo '</div>';
echo '</form>'
?>

View File

@ -126,37 +126,41 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) {
echo '</form></td></tr></table>';
}
else {
// Main list view for Links editor
echo "<table cellpadding='4' cellspacing='4' class='databox' width=98%>";
echo "<th>".__('Subject')."</th>";
echo "<th>".__('Author')."</th>";
echo "<th>".__('Timestamp')."</th>";
echo "<th>".__('Delete')."</th>";
$rows = db_get_all_rows_in_table("tnews", "timestamp");
if ($rows === false) {
$rows = array();
echo "<div class='nf'>".__('There are no defined news')."</div>";
}
$color = 1;
foreach ($rows as $row) {
if ($color == 1) {
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gsetup&sec2=godmode/setup/news&form_edit=1&id_news=".$row["id_news"]."'>".$row["subject"]."</a></b></td>";
echo "<td class='$tdcolor'>".$row["author"]."</b></td>";
echo "<td class='$tdcolor'>".$row["timestamp"]."</b></td>";
else {
// Main list view for Links editor
echo "<table cellpadding='4' cellspacing='4' class='databox' width=98%>";
echo "<th>".__('Subject')."</th>";
echo "<th>".__('Author')."</th>";
echo "<th>".__('Timestamp')."</th>";
echo "<th>".__('Delete')."</th>";
echo '<td class="'.$tdcolor.'" align="center"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row["id_news"].'&borrar='.$row["id_news"].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a></td></tr>';
$color = 1;
foreach ($rows as $row) {
if ($color == 1) {
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gsetup&sec2=godmode/setup/news&form_edit=1&id_news=".$row["id_news"]."'>".$row["subject"]."</a></b></td>";
echo "<td class='$tdcolor'>".$row["author"]."</b></td>";
echo "<td class='$tdcolor'>".$row["timestamp"]."</b></td>";
echo '<td class="'.$tdcolor.'" align="center"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row["id_news"].'&borrar='.$row["id_news"].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a></td></tr>';
}
echo "</table>";
}
echo "</table>";
echo "<table width='98%'>";
echo "<tr><td align='right'>";
echo "<form method='post' action='index.php?sec=gsetup&sec2=godmode/setup/news&form_add=1'>";

View File

@ -60,5 +60,10 @@ foreach ($osList as $os) {
$table->data[] = $data;
}
html_print_table($table);
if(isset($data)) {
html_print_table($table);
}
else {
echo "<div class='nf'>".__('There are no defined operating systems')."</div>";
}
?>

View File

@ -99,7 +99,12 @@ foreach ($profiles as $profile) {
}
echo '<form method="post" action="index.php?sec=gusuarios&sec2=godmode/users/configure_profile">';
html_print_table ($table);
if(isset($data)) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined profiles')."</div>";
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden ('new_profile', 1);
html_print_submit_button (__('Create'), "crt", false, 'class="sub next"');

View File

@ -48,7 +48,9 @@ function users_get_info ($order = "fullname", $info = "fullname") {
*/
function users_get_all_model_groups () {
$groups = db_get_all_rows_in_table ('tmodule_group');
if($groups === false) {
$groups = array();
}
$returnGroups = array();
foreach ($groups as $group)
$returnGroups[$group['id_mg']] = $group['name'];