Location: PHPKode > scripts > AJAX Login Module > AJAX_Locking.php
<?php
/* vim: set number autoindent tabstop=2 shiftwidth=2 softtabstop=2: */

/**
* AJAX_Locking
*
* An AJAX framework to manage object locking

* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt.  If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to hide@address.com so we can mail you a copy immediately.
*
* @category   HTML
* @package    AJAX_Locking
* @author     Fabio Ambrosanio <hide@address.com>
* @license    http://www.php.net/license/3_01.txt  PHP
* @version    @package_version@
*/
require_once 'HTML/AJAX/Server.php';

define("AJAX_LOCKING_DRIVER_DEFAULT", "File");

/**
 * This class implement a AJAX technique to locking of any object that
 * is identified by an id. 
 *
 */
class AJAX_Locking extends HTML_AJAX_Server 
{
	var $initMethods = true;
	var $driver;
	
	/**
	 * Constructor
	 *
	 * @return AJAX_Locking
	 */
	function AJAX_Locking($driver = false)
	{
		parent::HTML_AJAX_Server();
		$this->driver = $driver;

		// registers aux library
		$path = '@data-dir@'.DIRECTORY_SEPARATOR.'AJAX_Locking'.DIRECTORY_SEPARATOR.'js'.DIRECTORY_SEPARATOR;
        if(strpos($path, '@'.'data-dir@') === 0) {
			$path = realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'js').DIRECTORY_SEPARATOR;
		}
		
		$this->registerJSLibrary('Locking','Locking.js', $path);
	}
		
	/**
	 * Register the driver as AJAX remote object
	 *
	 * @param uriver $driver
	 */
	function initAjaxLocking() 
	{
		if (!$this->driver) {
			require_once ( dirname(__FILE__) . "/Driver/" . AJAX_LOCKING_DRIVER_DEFAULT . ".php");
			$this->driver = new AJAX_Locking_Driver_SharedMemory();
		} 
		$this->registerClass($this->driver, 'AjaxLocking');		
	}	
}

?>
Return current item: AJAX Login Module