FundacionLQDVI_WebCongresos/www/administrator/components/com_sql2excel/controllers/schedule.php

69 lines
1.8 KiB
PHP

<?php
/*
* @component SQL 2 Excel Component
* @copyright Copyright (C) Joomla-R-Us, joomla-r-us.com
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once (JPATH_COMPONENT.DS.'helpers'.DS.'schedule.php');
class Sql2excelControllerSchedule extends Sql2excelController
{
/**
* constructor (registers additional tasks to methods)
* @return void
*/
function __construct()
{
parent::__construct();
// Register Extra tasks
$this->registerTask( 'runnow' , 'runScheduleNow' );
}
function runScheduleNow()
{
global $mainframe;
$id = JRequest::getVar( 'id', 0, 'get', 'int' );
$sched_id = (int) $id;
if ( $sched_id > 0 ) {
echo '<h3>' . JText::_('Schedule Test Results') . '</h3>';
echo '<p>' . JText::_('Schedule ID') . ' : ' . $sched_id . '</p>';
echo '<table>';
// Perform tests
Sql2excelSchedule::test_schedule($sched_id);
// Execute schedule?
if ( Sql2excelSchedule::run_schedule_ok($sched_id,1) ) {
echo '<tr>';
echo '<td><b>Executing Schedule</b></td>';
$res = Sql2excelSchedule::process_schedule($sched_id,1);
if ( $res === false ) {
echo '<td><h3><font color="red">' . JText::_('FAIL') . '</font></h3></td>';
Sql2excelSchedule::on_schedule_failure($sched_id, 1);
} elseif ( $res < -99 ) {
echo '<td><h3><font color="blue">' . JText::_('OK : Run-If Rule prevented execution') . '</font></h3></td>';
} elseif ( $res ) {
echo '<td><h3><font color="green">' . JText::_('OK') . '</font></h3></td>';
Sql2excelSchedule::on_schedule_success($sched_id, 1);
}
echo '<tr>';
}
echo '</table>';
} else {
$this->setRedirect( 'index.php?option=com_sql2excel&view=sqlexcelschedules', $msg );
}
}
}