1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
<?php
/**
* $Horde: kronolith/lib/Imple.php,v 1.1.2.2 2008/01/02 11:32:17 jan Exp $
*
* Copyright 2005-2008 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
* @author Michael Slusarz <slusarz@horde.org>
* @package Kronolith
*/
class Imple {
/**
* Parameters needed by the subclasses.
*
* @var array
*/
var $_params = array();
/**
* Attempts to return a concrete Imple instance based on $imple.
*
* @param string $imple The type of concrete Imple subclass to return
* return, based on the imple type indicated. The
* code is dynamically included.
* @param array $params The configuration parameter array.
*
* @return mixed The newly created concrete Imple instance, or false on
* error.
*/
function factory($imple, $params = array())
{
$imple = basename($imple);
if (!$imple) {
return false;
}
$class = 'Imple_' . $imple;
if (!class_exists($class)) {
include_once dirname(__FILE__) . '/Imple/' . $imple . '.php';
if (!class_exists($class)) {
return false;
}
}
return new $class($params);
}
/**
* Constructor.
*
* @param array $params Any parameters needed by the class.
*/
function Imple($params)
{
$this->_params = $params;
$this->attach();
}
/**
* Attach the Imple object to a javascript event.
*/
function attach()
{
Horde::addScriptFile('prototype.js', 'kronolith', true);
Horde::addScriptFile('builder.js', 'kronolith', true);
Horde::addScriptFile('effects.js', 'kronolith', true);
Horde::addScriptFile('controls.js', 'kronolith', true);
}
/**
* TODO
*
* @param TODO
*/
function handle($args)
{
}
/**
* Return the rendered HTML code.
*
* @return string The HTML code.
*/
function html()
{
}
/**
* Generate a random ID string.
*
* @access private
*
* @return string The random ID string.
*/
function _randomid()
{
return 'imple_' . uniqid(mt_rand());
}
}
|