コード例 #1
0
// date_:   2013-02-07
// Title:   Dashboard reminders, process actioned
// Free software under GNU GPL
// ----------------------------------------------------------------
if (!$_POST["data"]) {
    echo "Invalid data";
    exit;
}
$post = stripslashes($_POST["data"]);
$id = json_decode($post);
$page_security = 'SA_DASHBOARDREMINDERS';
$path_to_root = "../..";
include_once $path_to_root . "/includes/session.inc";
include_once $path_to_root . "/modules/dashboard/includes/dashboard_db.inc";
add_access_extensions();
$myrow = get_dashboard_reminder($id);
$role_id = $myrow["role_id"];
$next_date = sql2date($myrow["next_date"]);
$description = $myrow["description"];
$frequency = $myrow["frequency"];
$param = $myrow["param"];
$data = json_decode(html_entity_decode($param));
$occurrence = intval(coalesce($data, 'occurence', '1'));
switch ($frequency) {
    case 'daily':
        $next_date = add_days($next_date, 1);
        break;
    case 'weekly':
        $next_date = add_days($next_date, 7 * $occurrence);
        break;
    case 'monthly':
コード例 #2
0
    edit_button_cell("Edit" . $myrow["id"], _("Edit"));
    delete_button_cell("Delete" . $myrow["id"], _("Delete"));
    end_row();
}
end_table(1);
//-------------------------------------------------------------------------------------------------
if (list_updated('frequency')) {
    $Ajax->activate('edits');
}
div_start('edits');
start_table(TABLESTYLE2);
$_POST['param'] = '';
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing payment reminder
        $myrow = get_dashboard_reminder($selected_id);
        $_POST['role_id'] = $myrow["role_id"];
        $_POST['next_date'] = sql2date($myrow["next_date"]);
        $_POST['description'] = $myrow["description"];
        $_POST['frequency'] = $myrow["frequency"];
        $_POST['param'] = $myrow["param"];
        $data = json_decode(html_entity_decode($_POST['param']));
        $_POST['occurrence'] = coalesce($data, 'occurrence');
    }
    hidden('selected_id', $selected_id);
}
label_cell(_("Role:"), "class='label'");
security_roles_list_cells(null, 'role_id');
date_row(_("Next Date"), 'next_date', '', null, 0, 0, 1001);
textarea_row(_("Description:"), 'description', null, 40, 5);
select_row(_("Frequency:"), "frequency", null, $frequencies, array('select_submit' => true));