'.$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')); } $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'; $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] = '
'; $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); } print_table ($table); echo '
'; echo '
'; print_submit_button (__('Create'), 'create', false, 'class="sub next"'); print_input_hidden ('create_alert', 1); echo '
'; echo '
'; ?>