<?php
/**
 * run.php - Controller file for the batch program to sync from extrenal databases to CMS
 *
 * @author $Author: dtong $
 * @version $Id: run.php,v 1.3 2011/02/11 09:09:26 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/

class Run extends CI_Controller {

	function __construct() {
		parent::__construct();
		$this->load->library('batch/batch_factory');
	}

	function index() {
		//echo APPPATH;
		$batchobj = $this->batch_factory->factory();
		if ( $batchobj === FALSE ) {
			echo 'Error, failed to get batch main object.';
			exit;
		}
		$now = date("D M j G:i:s T Y");
		echo "Batch job strated at $now\n\n";
		$batchobj->runit();
		$now = date("D M j G:i:s T Y");
		echo "\n\nBatch job finished at $now";
	}
}
?>