2009-05-20 Esteban Sanchez <estebans@artica.es>
* include/functions_alerts.php: Changed interface of get_alert_templates() to allow custom filters. * godmode/alerts/alert_list.php, godmode/agentes/massive_delete_alerts.php: Changes in get_alerts_templates(). * godmode/alerts/alert_templates.php: Added pagination and a search form. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1700 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9d0105c8d9
commit
2203005c8f
|
@ -1,3 +1,15 @@
|
|||
2009-05-20 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/functions_alerts.php: Changed interface of
|
||||
get_alert_templates() to allow custom filters.
|
||||
|
||||
* godmode/alerts/alert_list.php,
|
||||
godmode/agentes/massive_delete_alerts.php: Changes in
|
||||
get_alerts_templates().
|
||||
|
||||
* godmode/alerts/alert_templates.php: Added pagination and a search
|
||||
form.
|
||||
|
||||
2009-05-20 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* general/ui/agents_list.php: Fixed searching filter. Added pagination
|
||||
|
|
|
@ -96,8 +96,9 @@ $table->size[1] = '85%';
|
|||
|
||||
$table->data = array ();
|
||||
|
||||
$templates = get_alert_templates (false, array ('id', 'name'));
|
||||
$table->data[0][0] = __('Alert template');
|
||||
$table->data[0][1] = print_select (get_alert_templates (),
|
||||
$table->data[0][1] = print_select (index_array ($templates, 'id', 'name'),
|
||||
'id_alert_template', $id_alert_template, false, __('Select'), 0, true);
|
||||
|
||||
$table->data[1][0] = __('Group');
|
||||
|
|
|
@ -352,11 +352,9 @@ $table->data[0][1] .= ' <span id="module_loading" class="invisible">';
|
|||
$table->data[0][1] .= '<img src="images/spinner.gif" /></span>';
|
||||
|
||||
$table->data[1][0] = __('Template');
|
||||
$templates = get_alert_templates ();
|
||||
if (empty ($templates))
|
||||
$templates = array ();
|
||||
$table->data[1][1] = print_select ($templates, 'template', '', '', __('Select'),
|
||||
0, true);
|
||||
$templates = get_alert_templates (false, array ('id', 'name'));
|
||||
$table->data[1][1] = print_select (index_array ($templates, 'id', 'name'),
|
||||
'template', '', '', __('Select'), 0, true);
|
||||
$table->data[1][1] .= ' <a class="template_details invisible" href="#">
|
||||
<img class="img_help" src="images/zoom.png" /></a>';
|
||||
|
||||
|
|
|
@ -137,6 +137,49 @@ if ($delete_template) {
|
|||
__('Could not be deleted'));
|
||||
}
|
||||
|
||||
$url = get_url_refresh (array ('offset' => false));
|
||||
|
||||
$search_string = (string) get_parameter ('search_string');
|
||||
$search_type = (string) get_parameter ('search_type');
|
||||
|
||||
$table->width = '600px';
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
|
||||
$table->data[0][0] = __('Type');
|
||||
$table->data[0][1] = print_select (get_alert_templates_types (), 'search_type',
|
||||
$search_type, '', __('All'), '', true, false, false);
|
||||
$table->data[0][2] = __('Search');
|
||||
$table->data[0][3] = print_input_text ('search_string', $search_string, '', 25,
|
||||
255, true);
|
||||
$table->data[0][4] = '<div class="action-buttons">';
|
||||
$table->data[0][4] .= print_submit_button (__('Search'), 'search', false,
|
||||
'class="sub search"', true);
|
||||
$table->data[0][4] .= '</div>';
|
||||
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
print_table ($table);
|
||||
echo '</form>';
|
||||
|
||||
unset ($table);
|
||||
|
||||
$filter = array ();
|
||||
if ($search_type != '')
|
||||
$filter['type'] = $search_type;
|
||||
if ($search_string)
|
||||
$filter[] = '(name LIKE "%'.$search_string.'%" OR description LIKE "%'.$search_string.'%" OR value LIKE "%'.$search_string.'%")';
|
||||
$total_templates = get_alert_templates ($filter, array ('COUNT(*) AS total'));
|
||||
$total_templates = $total_templates[0]['total'];
|
||||
$filter['offset'] = (int) get_parameter ('offset');
|
||||
$filter['limit'] = (int) $config['block_size'];
|
||||
$templates = get_alert_templates ($filter,
|
||||
array ('id', 'name', 'description', 'type'));
|
||||
if ($templates === false)
|
||||
$templates = array ();
|
||||
|
||||
$table->width = '90%';
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
|
@ -152,10 +195,6 @@ $table->size[3] = '50px';
|
|||
$table->align = array ();
|
||||
$table->align[3] = 'center';
|
||||
|
||||
$templates = get_alert_templates (false);
|
||||
if ($templates === false)
|
||||
$templates = array ();
|
||||
|
||||
foreach ($templates as $template) {
|
||||
$data = array ();
|
||||
|
||||
|
@ -179,6 +218,7 @@ foreach ($templates as $template) {
|
|||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
pagination ($total_templates, $url);
|
||||
print_table ($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
|
|
@ -237,21 +237,8 @@ function delete_alert_template ($id_alert_template) {
|
|||
return @process_sql_delete ('talert_templates', array ('id' => $id_alert_template));
|
||||
}
|
||||
|
||||
function get_alert_templates ($only_names = true) {
|
||||
$all_templates = get_db_all_rows_in_table ('talert_templates');
|
||||
|
||||
if ($all_templates === false)
|
||||
return array ();
|
||||
|
||||
if (! $only_names)
|
||||
return $all_templates;
|
||||
|
||||
$templates = array ();
|
||||
foreach ($all_templates as $template) {
|
||||
$templates[$template['id']] = $template['name'];
|
||||
}
|
||||
|
||||
return $templates;
|
||||
function get_alert_templates ($filter = false, $fields = false) {
|
||||
return @get_db_all_rows_filter ('talert_templates', $filter, $fields);
|
||||
}
|
||||
|
||||
function get_alert_template ($id_alert_template) {
|
||||
|
|
Loading…
Reference in New Issue