Example #1
0
function check_for_schedule(&$focus, $workflow_id, $time_array)
{
    // Check to see if it exists
    $wflow_schedule = new WorkFlowSchedule();
    $is_update = $wflow_schedule->check_existing_trigger($focus->id, $workflow_id);
    if (isset($time_array['parameters'])) {
        $wflow_schedule->parameters = $time_array['parameters'];
    }
    // If new record, set the data
    if (!$is_update) {
        $wflow_schedule->bean_id = $focus->id;
        $wflow_schedule->workflow_id = $workflow_id;
        $wflow_schedule->target_module = $focus->module_dir;
    }
    $wflow_schedule->set_time_interval($focus, $time_array, $is_update);
    if (!empty($wflow_schedule->date_expired)) {
        $wflow_schedule->save();
    }
}