".__('Alerts')." » ";
echo __('Alert actions').'';
$update_action = (bool) get_parameter ('update_action');
$create_action = (bool) get_parameter ('create_action');
$delete_action = (bool) get_parameter ('delete_action');
if ($create_action) {
$name = (string) get_parameter ('name');
$id_alert_command = (int) get_parameter ('id_command');
$field1 = (string) get_parameter ('field1');
$field2 = (string) get_parameter ('field2');
$field3 = (string) get_parameter ('field3');
$result = create_alert_action ($name, $id_alert_command,
array ('field1' => $field1,
'field2' => $field2,
'field3' => $field3));
print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
}
if ($update_action) {
$id = (string) get_parameter ('id');
$name = (string) get_parameter ('name');
$id_alert_command = (int) get_parameter ('id_command');
$field1 = (string) get_parameter ('field1');
$field2 = (string) get_parameter ('field2');
$field3 = (string) get_parameter ('field3');
$values = array ();
$values['name'] = $name;
$values['id_alert_command'] = $id_alert_command;
$values['field1'] = $field1;
$values['field2'] = $field2;
$values['field3'] = $field3;
$result = update_alert_action ($id, $values);
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
}
if ($delete_action) {
$id = get_parameter ('id');
$result = delete_alert_action ($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] = __('Delete');
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->size = array ();
$table->size[1] = '40px';
$table->align = array ();
$table->align[1] = 'center';
$actions = get_db_all_rows_in_table ('talert_actions');
if ($actions === false)
$actions = array ();
$rowPair = true;
$iterator = 0;
foreach ($actions as $action) {
if ($rowPair)
$table->rowclass[$iterator] = 'rowPair';
else
$table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair;
$iterator++;
$data = array ();
$data[0] = ''.
$action['name'].'';
$data[1] = ''.
'';
array_push ($table->data, $data);
}
print_table ($table);
echo '