Merge branch '2415-Plantillas_de_Consola_visual' of brutus.artica.lan:artica/pandorafms into 2415-Plantillas_de_Consola_visual

This commit is contained in:
fbsanchez 2018-08-01 12:22:34 +02:00
commit b694eded15
2 changed files with 196 additions and 2 deletions

View File

@ -69,5 +69,65 @@ if (!defined('METACONSOLE')) {
);
}
$id_layout = (int) get_parameter ('id_layout', 0);
$name_template = (string) get_parameter ('name_template', '');
$group = (int) get_parameter ('group');
$action = (string) get_parameter ('action', '');
if($action == "create_template"){
}
if($action == "delete_template"){
}
$visual_console_array = visual_map_get_user_layouts($config['id_user'], true);
if (!check_acl ($config['id_user'], 0, "VR")){
$return_all_group = false;
}
else{
$return_all_group = true;
}
$table = '<form method="post" action="" enctype="multipart/form-data">';
$table .= "<table border=0 cellpadding=4 cellspacing=4 class='databox filters' width=100%>";
$table .= "<tr>";
$table .= "<td align='left'>";
$table .= "<b>" . __("Create From") . ":</b>";
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_select($visual_console_array, 'id_layout', $id_layout, '', __('none'), 0, true);
$table .= "</td>";
$table .= "</tr>";
$table .= "<tr>";
$table .= "<td align='left'>";
$table .= "<b>" . __("Name") . ":</b>";
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_input_text ('name_template', $name_template, '', 50, 255, true);
$table .= "</td>";
$table .= "</tr>";
$table .= "<tr>";
$table .= "<td align='left'>";
$table .= '<b>' . __("Group") . ':</b>';
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_select_groups(false, "AR", $return_all_group, "group", $group, 'this.form.submit();', '', 0, true, false, true, '', false);
$table .= "</td>";
$table .= "</tr>";
$table .= "</table>";
if (check_acl ($config['id_user'], 0, "RW")) {
$table .= '<div class="action-buttons" style="width: 100%;">';
$table .= html_print_input_hidden('action', 'create_template');
$table .= html_print_submit_button (__('Create template'), 'apply', false, 'class="sub next"', true);
$table .= '</div>';
}
$table .= '</form>';
echo ui_toggle($table, __('Create New Template'), '', false, true);
?>

View File

@ -68,4 +68,138 @@ if (!defined('METACONSOLE')) {
$buttons
);
}
$templates = reporting_enterprise_get_template_reports(array ('order' => 'id_group, name'), array('id_report', 'name'), true);
$template_select = array();
if ($templates === false)
$template_select = array();
else {
$groups = array(__('All') => 0);
foreach ($templates as $template) {
$id_group = $template['id_group'];
$group_name = '';
if (!isset($groups[$id_group]))
$groups[$id_group] = groups_get_name($id_group, true);
if (!empty($groups[$id_group]))
$group_name = $groups[$id_group];
$template_select[$template['id_report']] = array('optgroup' => $group_name, 'name' => $template['name']);
}
}
if (is_metaconsole()) {
$keys_field = 'nombre';
}
else {
$keys_field = 'id_grupo';
}
$attr_available = array('id' => 'image-select_all_available', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
$attr_apply = array('id' => 'image-select_all_apply', 'title' => __('Select all'), 'style' => 'cursor: pointer;');
$table = '<form method="post" action="" enctype="multipart/form-data">';
$table .= "<table border=0 cellpadding=4 cellspacing=4 class='databox filters' width=100%>";
$table .= "<tr>";
$table .= "<td align='left'>";
$table .= "<b>" . __('Templates') . ":</b>";
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_select($template_select, 'templates', $template_selected, '', __('None'), '0', true, false, true, '', false, 'width:180px;');
$table .= "</td>";
$table .= "<td align='left'>";
$table .= "<b>" . __('Report name') . " " .
ui_print_help_tip(__('Left in blank if you want to use default name: Template name - agents (num agents) - Date'), true) . ":</b>";
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_input_text ('template_report_name', '', '', 80, 150, true);
$table .= "</td>";
$table .= "</tr>";
$table .= "<tr>";
$table .= "<td align='left'>";
$table .= '<b>' . __('Filter group') . ':</b>';
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_select_groups(
false, "RR", users_can_manage_group_all("RR"),
'group', '', '', '', 0, true, false, false,
'', false, false, false, false, $keys_field
);
$table .= "</td>";
$table .= "<td align='left'>";
$table .= "<b>" . __('Target group') . ":</b>";
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_select_groups(
false, "RR", users_can_manage_group_all("RR"),
'template_report_group', '', '', '', 0, true,
false, false, '', false, false, false, false,
$keys_field
);
$table .= "</td>";
$table .= "</tr>";
$table .= "<tr>";
$table .= "<td align='left'>";
$table .= '<b>' . __('Filter agent') . ':</b>';
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_input_text ('agent_filter', $agent_filter, '', 20, 150, true);
$table .= "</td>";
$table .= "<td align='left'>";
$table .= '';
$table .= "</td>";
$table .= "<td align='left'>";
$table .= '';
$table .= "</td>";
$table .= "</tr>";
$table .= "<tr>";
$table .= "<td align='left' colspan=2>";
$table .= "<b>" . __('Agents available')."</b>&nbsp;&nbsp;" .
html_print_image ('images/tick.png', true, $attr_available, false, true);
$table .= "</td>";
$table .= "<td align='left' colspan=2>";
$table .= "<b>" . __('Agents to apply')."</b>&nbsp;&nbsp;" .
html_print_image ('images/tick.png', true, $attr_apply, false, true);
$table .= "</td>";
$table .= "</tr>";
$table .= "<tr>";
$table .= "<td align='left' colspan=2>";
$option_style = array();
$template_agents_in = array();
$template_agents_all = array();
$template_agents_out = array();
$template_agents_out = array_diff_key($template_agents_all, $template_agents_in);
$template_agents_in_keys = array_keys($template_agents_in);
$template_agents_out_keys = array_keys($template_agents_out);
$table .= html_print_select ($template_agents_out, 'id_agents[]', 0, false, '', '', true, true, true, '', false, 'width: 100%;', $option_style);
$table .= "</td>";
$table .= "<td align='left'>";
$table .= html_print_image ('images/darrowright.png', true, array ('id' => 'right', 'title' => __('Add agents to template')));
$table .= html_print_image ('images/darrowleft.png', true, array ('id' => 'left', 'title' => __('Undo agents to template')));
$table .= "</td>";
$table .= "<td align='left'>";
$table .= $option_style = array();
//Agents applied to the template
$table .= html_print_select ($template_agents_in, 'id_agents2[]', 0, false, '', '', true, true, true, '', false, 'width: 100%;', $option_style);
$table .= "</td>";
$table .= "</tr>";
$table .= "</table>";
if (check_acl ($config['id_user'], 0, "RW")) {
$table .= '<div class="action-buttons" style="width: 100%;">';
$table .= html_print_input_hidden('action', 'create_template');
$table .= html_print_submit_button (__('Apply template'), 'apply', false, 'class="sub next"', true);
$table .= '</div>';
}
$table .= '</form>';
echo $table;
?>