function generateJobsToday() { setlimitRows(150000); $d = newObject("gtasklog"); $d->deletes("estado='No iniciada' AND inicio>" . dateTodayStamp()); $u = newObject("gtask"); $ids = $u->allID(); $d = array(); $tasks = array(1); foreach ($ids as $id) { $o = newObject("gtask", $id); $cron = new Parser($o->getCronString()); $RunsToday = $cron->getRuns(time()); foreach ($RunsToday as $timeStampOfRun) { //echo strftime("%d/%m/%Y %H:%M",$cron_ran)." # ".$cron_ran; $tl = newObject("gtasklog"); $tasklog = $tl->getByTaskDate($o, $timeStampOfRun); if ($tasklog) { $tasks[] = $tasklog->ID; //print_r($tasklog); } else { // $tl = newObject("gtasklog"); $tl->etiqueta = $o->titulo . "@" . strftime("%Y%m%d"); $tl->tipo = 'Desde Definición'; $tl->gtask_id = $id; $tl->schedule_id = $o->schedule_id; $tl->inicio = $timeStampOfRun; $tl->estado = 'No iniciada'; $tl->automatica = $o->automatica; $tl->emailconfirmacion = $o->emailconfirmacion; $tl->departamento = $o->departamento; $tl->diasderetraso = $o->diasderetraso; $tasks[] = $tl->save(); } } } resetlimitRows(); }
<?php $ORIGPATH = ini_get("include_path"); $PATH = dirname(__FILE__) . "/../../"; ini_set("include_path", "{$ORIGPATH}:{$PATH}:{$PATH}/Framework:{$PATH}/Apps"); $TrazaStatus = false; error_reporting(E_ERROR); require "GlobalSche.php"; setlimitRows(150); $t = newObject("gtasklog", $argv[1]); $s = newObject("gsteplog"); $s->searchResults = $s->select("gtasklog_id={$argv[1]}", 0, "secuencia ASC"); foreach ($s->searchResults as $step) { echo "#####################################################################################\n\n"; echo strftime("%d-%m-%Y %H:%M:%S\t") . $step->resolve("gtasklog_id") . "\tPaso: " . $step->resolve("gstep_id") . "\t{$step->estado}\n"; flush(); $step->run(); echo strftime("%d-%m-%Y %H:%M:%S\t") . $step->resolve("gtasklog_id") . "\tPaso: " . $step->resolve("gstep_id") . "\t{$step->estado}\n"; if ($step->estado == 'Cancelada') { $t->anotaciones = $step->ERROR . " " . $step->TMPOUT; $t->setStatus("can"); break; } }
<?php require_once "Bilo.php"; header("Content-Type: plain/text"); header("Content-Disposition: attachment; filename=registros.csv"); $r = newObject("registro"); if (empty($sort)) { $sort = " dia DESC "; } setlimitRows(5000); $r->searchResults = $r->selectAll($offset, $sort); echo "username,nombre,apellidos,dia,entrada,salida\n"; do { $o = current($r->searchResults); echo $o->get_ext("user", $o->user_id, "username") . ","; echo $o->get_ext("user", $o->user_id, "nombre") . ","; echo $o->get_ext("user", $o->user_id, "apellidos") . ","; echo int_to_text($o->dia) . ","; $void = $o->entrada_m > 3600 ? strftime("%H:%M", $o->entrada_m) . "," : "-,"; echo $void; $void = $o->salida_m > 3600 ? strftime("%H:%M", $o->salida_m) : "-"; echo $void; echo "\n"; } while (next($r->searchResults)); resetlimitRows(); //require $registry->get('templates', 'horde') . '/common-footer.inc';