示例#1
0
 function edit()
 {
     $model = new Cron();
     $model->edit();
     $this->redirect('/cron/');
 }
示例#2
0
    Validate::number("Run Cycle", $_POST['run_cycle'], 0);
    Validate::number("Start Date", $_POST['date_start'], 0);
    Validate::number("End Date", $_POST['date_end'], 0);
    // Still need to validate parameter data
    $args = isset($_POST['args']) ? $_POST['args'] : array();
    foreach ($args as $key => $val) {
        if ($val == "") {
            unset($args[$key]);
        } else {
            $args[$key] = Sanitize::text($val);
        }
    }
    if (Validate::pass()) {
        // If we're in edit mode, edit the existing task
        if ($editID) {
            if (Cron::edit($editID, $_POST['title'], $_POST['method'], $args, $_POST['run_cycle'], $_POST['date_start'], $_POST['date_end'])) {
                Alert::saveSuccess("Edited Task", "You have successfully edited the cron task.");
                header("Location: /admin/cron");
                exit;
            }
        } else {
            if (Cron::create($_POST['title'], $_POST['method'], $args, $_POST['run_cycle'], $_POST['date_start'], $_POST['date_end'])) {
                Alert::saveSuccess("Created Task", "You have successfully created a cron task.");
                header("Location: /admin/cron");
                exit;
            }
        }
    }
} else {
    // If we're in edit mode
    if ($editID) {