public function run() { global $tree; include_once "Modules/Survey/classes/class.ilObjSurvey.php"; $status = ilCronJobResult::STATUS_NO_ACTION; $message = array(); $root = $tree->getNodeData(ROOT_FOLDER_ID); foreach ($tree->getSubTree($root, false, "svy") as $svy_ref_id) { $svy = new ilObjSurvey($svy_ref_id); if ($svy->checkReminder()) { $message[] = $svy_ref_id; $status = ilCronJobResult::STATUS_OK; } } $result = new ilCronJobResult(); $result->setStatus($status); if (sizeof($message)) { $result->setMessage("Ref-Ids: " . implode(", ", $message)); $result->setCode("#" . sizeof($message)); } return $result; }
/** * Reset job * * @param ilCronJob $a_job */ public static function resetJob(ilCronJob $a_job) { global $ilDB; include_once "Services/Cron/classes/class.ilCronJobResult.php"; $result = new ilCronJobResult(); $result->setStatus(ilCronJobResult::STATUS_RESET); $result->setCode("job_manual_reset"); $result->setMessage("Cron job re-activated by admin"); self::updateJobResult($a_job, $result, true); $ilDB->manipulate("UPDATE cron_job" . " SET running_ts = " . $ilDB->quote(0, "integer") . " , alive_ts = " . $ilDB->quote(0, "integer") . " , job_result_ts = " . $ilDB->quote(0, "integer") . " WHERE job_id = " . $ilDB->quote($a_job->getId(), "text")); self::activateJob($a_job, true); }