'.$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 '
'; } 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 = (bool) get_parameter ('field2_recovery'); $field3_recovery = (bool) get_parameter ('field3_recovery'); $result = update_alert_template ($id, array ('recovery_notify' => $recovery_notify, 'field2_recovery' => $field2_recovery, 'field3_recovery' => $field3_recovery)); print_error_message ($result, __('Successfully updated'), __('Could not be updated')); } if ($delete_template) { $id = get_parameter ('id'); // Templates below 4 are special and cannot be deleted if ($id < 4) { audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Alert Management"); require ("general/noaccess.php"); exit; } $result = delete_alert_template ($id); print_error_message ($result, __('Successfully deleted'), __('Could not be deleted')); } $table->width = '90%'; $table->data = array (); $table->head = array (); $table->head[0] = __('Name'); $table->head[1] = __('Description'); $table->head[2] = __('Type'); $table->head[3] = __('Delete'); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->size = array (); $table->size[2] = '10%'; $table->size[3] = '40px'; $table->align = array (); $table->align[3] = 'center'; $templates = get_alert_templates (false); if ($templates === false) $templates = array (); 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] = ''. ''; array_push ($table->data, $data); } print_table ($table); echo '
'; echo '
'; print_submit_button (__('Create'), 'create', false, 'class="sub next"'); print_input_hidden ('create_alert', 1); echo '
'; echo '
'; ?>