'.$template['name'].''; echo ''.__('Type').': '; echo get_alert_templates_type_name ($template['type']); echo '
'; echo print_alert_template_example ($template['id'], true); echo '
'; if ($template['description'] != '') { echo ''.__('Description').':
'; echo $template['description']; echo '
'; } echo ''.__('Priority').': '; echo get_priority_name ($template['priority']); echo '
'; if ($template['monday'] && $template['tuesday'] && $template['wednesday'] && $template['thursday'] && $template['friday'] && $template['saturday'] && $template['sunday']) { /* Everyday */ echo ''.__('Everyday').'
'; } else { $days = array ('monday' => __('Monday'), 'tuesday' => __('Tuesday'), 'wednesday' => __('Wednesday'), 'thursday' => __('Thursday'), 'friday' => __('Friday'), 'saturday' => __('Saturday'), 'sunday' => __('Sunday')); echo ''.__('Days').': '.__('Every').' '; $actives = array (); foreach ($days as $day => $name) { if ($template[$day]) array_push ($actives, $name); } $last = array_pop ($actives); if (count ($actives)) { echo implode (', ', $actives); echo ' '.__('and').' '; } echo $last; } echo '
'; if ($template['time_from'] != $template['time_to']) { echo ''.__('From').' '; echo $template['time_from']; echo ' '.__('to').' '; echo $template['time_to']; echo '
'; } return; } return; } echo '

'.__('Alert templates').'

'; $update_template = (bool) get_parameter ('update_template'); $delete_template = (bool) get_parameter ('delete_template'); if ($update_template) { $id = (int) get_parameter ('id'); $recovery_notify = (bool) get_parameter ('recovery_notify'); $field2_recovery = (string) get_parameter ('field2_recovery'); $field3_recovery = (string) get_parameter ('field3_recovery'); $result = update_alert_template ($id, array ('recovery_notify' => $recovery_notify, 'field2_recovery' => $field2_recovery, 'field3_recovery' => $field3_recovery)); print_result_message ($result, __('Successfully updated'), __('Could not be updated')); } if ($delete_template) { $id = get_parameter ('id'); $result = delete_alert_template ($id); print_result_message ($result, __('Successfully deleted'), __('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] = '
'; $table->data[0][4] .= print_submit_button (__('Search'), 'search', false, 'class="sub search"', true); $table->data[0][4] .= '
'; echo '
'; print_table ($table); echo '
'; 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 (); $table->head[0] = __('Name'); $table->head[1] = __('Description'); $table->head[2] = __('Type'); $table->head[3] = __('Op.'); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->size = array (); $table->size[2] = '10%'; $table->size[3] = '50px'; $table->align = array (); $table->align[3] = 'center'; foreach ($templates as $template) { $data = array (); $data[0] = ''. $template['name'].''; $data[1] = $template['description']; $data[2] = get_alert_templates_type_name ($template['type']); $data[3] = '
'; $data[3] .= print_input_hidden ('duplicate_template', 1, true); $data[3] .= print_input_hidden ('source_id', $template['id'], true); $data[3] .= print_input_image ('dup', 'images/copy.png', 1, '', true, array ('title' => __('Duplicate'))); $data[3] .= '
'; $data[3] .= '
'; $data[3] .= print_input_hidden ('delete_template', 1, true); $data[3] .= print_input_hidden ('id', $template['id'], true); $data[3] .= print_input_image ('del', 'images/cross.png', 1, '', true, array ('title' => __('Delete'))); $data[3] .= '
'; array_push ($table->data, $data); } pagination ($total_templates, $url); print_table ($table); echo '
'; echo '
'; print_submit_button (__('Create'), 'create', false, 'class="sub next"'); print_input_hidden ('create_alert', 1); echo '
'; echo '
'; ?>