<?php

/**
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS
 * @copyright Copyright (c) 2012 - 2014 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

/**
 * cfPseudoCron Class
 *
 * Class to capture page rendering events and insert code required for pseudo cron to function.
 *
 * @package clearFusionCMS
 */
class cfPseudoCron {

	/**
	 * Add the JavaScript required for pseudo cron to work to the output buffers.
	 *
	 * @param flEvent $evt The event data.
	 */
	function addJs($evt) {
		/* @var $tpl cfTemplateEngine */
		$tpl = $evt->getParam('templateEngine');
		$tpl->getCodeBuffer()->requireCore()->bufferReadyJS("\$fl.get('" . clearFusionCMS::getRouter()->assemble('cfManagerCron', array(), true) . "');");
	}
}
