$description)); $info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $description; } } if ($result) { db_pandora_audit("Command management", "Create special day " . $result, false, false, $info); } else { db_pandora_audit("Command management", "Fail try to create special day", false, false); } ui_print_result_message ($result, __('Successfully created'), __('Could not be created')); } if ($update_special_day) { $id = (int) get_parameter ('id'); $alert = alerts_get_alert_special_day ($id); $date = (string) get_parameter ('date'); $same_day = (string) get_parameter ('same_day'); $description = (string) get_parameter ('description'); list($year, $month, $day) = explode("-", $date); if ($year == '*') { # '0001' means every year. $year = '0001'; $date = $year . '-' . $month . '-' . $day; } $values = array (); $values['date'] = $date; $values['same_day'] = $same_day; $values['description'] = $description; if (!checkdate ($month, $day, $year)) { $result = ''; } else { $result = alerts_update_alert_special_day ($id, $values); $info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $description; } if ($result) { db_pandora_audit("Command management", "Update special day " . $id, false, false, $info); } else { db_pandora_audit("Command management", "Fail to update special day " . $id, false, false); } ui_print_result_message ($result, __('Successfully updated'), __('Could not be updated')); } if ($delete_special_day) { $id = (int) get_parameter ('id'); $result = alerts_delete_alert_special_day ($id); if ($result) { db_pandora_audit("Command management", "Delete special day " . $id); } else { db_pandora_audit("Command management", "Fail to delete special day " . $id); } ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); } $table->width = '98%'; $table->data = array (); $table->head = array (); $table->head[0] = __('Date'); $table->head[1] = __('Same day of the week'); $table->head[2] = __('Description'); $table->head[3] = __('Delete'); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->size = array (); $table->size[0] = '20%'; $table->size[1] = '15%'; $table->size[2] = '60%'; $table->size[3] = '5%'; $table->align = array (); $table->align[3] = 'center'; $special_days = db_get_all_rows_in_table ('talert_special_days', 'date'); if ($special_days === false) $special_days = array (); foreach ($special_days as $special_day) { $data = array (); $data[0] = ''; # '0001' means every year. $data[0] .= ''. str_replace('0001', '*', $special_day['date']) . ''; $data[0] .= ''; switch ($special_day['same_day']) { case 'monday': $data[1] = __('Monday'); break; case 'tuesday': $data[1] = __('Tuesday'); break; case 'wednesday': $data[1] = __('Wednesday'); break; case 'thursday': $data[1] = __('Thursday'); break; case 'friday': $data[1] = __('Friday'); break; case 'saturday': $data[1] = __('Saturday'); break; case 'sunday': $data[1] = __('Sunday'); break; } $data[2] = $special_day['description']; $data[3] = ''; $data[3] = ''. html_print_image("images/cross.png", true) . ''; array_push ($table->data, $data); } if(isset($data)) { html_print_table ($table); } else { echo "