Source for file OCSP_MOD_CONF.phpclass
Documentation is available at OCSP_MOD_CONF.phpclass
* openCSP class OCSP_MOD_CONF.phpclass
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: OCSP_MOD_CONF.phpclass,v 1.2 2008/10/30 07:35:28 pitlinz Exp $
* @deprecated since pk-08-10-28
// ---------------------------------------------------------
// ---------------------------------------------------------
require
__OCSP_PHPINCPATH__ .
"common" .
_OCSP_DIRSEP_ .
"pcf_directory.phpinc";
// ---------------------------------------------------------
// ---------------------------------------------------------
if (!defined('_OCSP_EXCEP_MOD_NOTREGISTERED_')) define('_OCSP_EXCEP_MOD_NOTREGISTERED_','OCSP MODULE NOT REGISTERED');
if (!defined('_OCSP_EXCEP_MODULE_NOT_FOUND_')) define('_OCSP_EXCEP_MODULE_NOT_FOUND_',"MODULE NOT FOUND");
* openCSP class OCSP_MOD_CONF
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: OCSP_MOD_CONF.phpclass,v 1.2 2008/10/30 07:35:28 pitlinz Exp $
* @deprecated since pk-08-10-28
/*** class constants --------------------------------------------- */
* @constant string CLASS_SRC_FILE
/*** class variables --------------------------------------------- */
* array of configured modules
private static $modules =
array();
* name of the table the settings are stored
* @staticvar string $settingTbl
private static $settingTbl =
"T_MOD_SETTINGS";
/*** compostion ------------------------------------------------- */
/*** attributes ------------------------------------------------ */
/*** static functions ------------------------------------------- */
* returns the modul cache path
public static function loadModule($modName,$debug=
false)
if ($debug) echoDebugMethod(__FILE__
,"static","OCSP_MOD_CONF::loadModule($modName)");
if (isset
(self::$modules[$modName]) &&
is_object(self::$modules[$modName]))
self::$modules[$modName] =
new OCSP_MOD_CONF($modName);
} else if (file_exists(self::getConf('MODULEPATH') .
"mod_" .
$modName .
"/config/config.phpinc")) {
require_once self::getConf('MODULEPATH') .
"mod_" .
$modName .
"/config/config.phpinc";
if ($obj_mod->dbPopulate($debug))
self::$modules[$modName]=
$obj_mod;
if ($debug) echoDebugMethod(__FILE__
,"static","OCSP_MOD_CONF::installModule()");
if (file_exists(self::getConf('MODULEPATH') .
$str_instPath))
include self::getConf('MODULEPATH') .
$str_instPath;
$str_debug =
"MODULEPATH: " .
self::getConf('MODULEPATH') .
"<br />";
* register all modules cached in self::getCachePath()
if ($debug) echoDebugMethod(__FILE__
,"static","OCSP_MOD_CONF::registerCachedModules();");
foreach($arr_files as $str_fileName)
if (substr($str_fileName,-
4) ==
".xml")
self::registerModule(substr($str_fileName,0,-
4));
if (!isset
(self::$modules[$modName]))
self::$modules[$modName] =
new OCSP_MOD_CONF($modName);
return self::$modules[$modName];
* returns a module configuration
public static function getConfObj($modName,$debug=
false)
if (!isset
(self::$modules[$modName]))
//throw new Exception(_OCSP_EXCEP_MOD_NOTREGISTERED_ . ":" . $modName);
if (!self::$modules[$modName] =
self::loadModule($modName))
unset
(self::$modules[$modName]);
return self::$modules[$modName];
/*** constructor ----------------------------------------------- */
$str_cacheFile = self::getCachePath() . "config" . _OCSP_DIRSEP_ . $modName . ".xml";
if (file_exists($str_cacheFile))
$this->mySettings = OCSP_XMLARRAY::getArray($str_cacheFile);
if (!$this->isConnected(true,$debug))
throw new Exception(_OCSP_EXCEP_NODBCONN_);
if (!($this->dbPopulate($debug)))
// module is not installed
$str_path = self::getCachePath()."config";
if (pcf_checkDir($str_path,true))
OCSP_XMLARRAY::saveXML($this->mySettings,$str_path . _OCSP_DIRSEP_ . $this->getModuleName() . ".xml");
/*** getter / setter ------------------------------------------ */
* returns the module name
return $this->getDBField('MOD_NAME',$debug,false);
* returns the module cache path
* returns the root path of the module
$str_ret =
str_replace('$@MODULEPATH$',self::getConf('MODULEPATH'),$str_path);
$str_ret =
trim($str_ret);
* returns the template path for the module
/*** DB key / filter ------------------------------------------ */
* generates a where clause to select the object identfied by DBMS_TBLOBJ::myKeys
* populates the module configuration, settings and hooks
$arr_filter=
array('MOD_ID' =>
$this->getId());
if ($arr_row =
$this->myDBObj->getArray($this->myTable,$arr_filter,0,0,"",$debug))
$this->setDBRow($arr_row[0],true,$debug);
* inserts the module with settings and hooks
if ($int_ret =
parent::dbInsert($debug))
* replaces (update) a module configuration
* @param boolean $ignorPopulated
function dbReplace($debug=
FALSE,$ignorPopulated=
FALSE)
if (parent::dbReplace($debug,$ignorPopulated))
/*** settings ------------------------------------------------- */
* populates the module settings
$arr_filter=
array('MOD_ID' =>
$this->getId());
if ($arr_settings=
$this->myDBObj->getArray(self::$settingTbl,$arr_filter))
foreach($arr_settings as $arr_row)
$this->mySettings[$arr_row['MOS_NAME']] =
$arr_row;
* stores the settings to the database
foreach($this->mySettings as $str_name =>
$arr_mos)
$arr_mos['MOS_NAME'] =
$str_name;
$arr_mos['MOD_ID'] =
$this->getId();
$this->myDBObj->replaceArray(self::$settingTbl,$arr_mos);
* returns a module setting
if ($debug) echoDebugMethod(__FILE__
,get_class($this),"OCSP_MOD_CONF::getMySetting(" .
$optName .
")");
if (isset
($this->mySettings[$optName]['MOS_VALUE']))
if (!empty($this->mySettings[$optName]['MOS_VALUE']))
/*** hooks ---------------------------------------------------- */
public function addHook($system,$part,$cmd,$className)
'MOD_ID' =>
$this->getId(),
'HOO_CLASS' =>
$className
return $this->myDBObj->insertArray('T_MOD_HOOKS',$arr_hook,$debug,'HOO_ID');
/*** modul Object ----------------------------------------- */
* returns the name of the main class
* which has to implement INFA_MODULE
* returns the main object of the modul
* @return INFA_MODULE class
require_once $str_incFile;
* returns the module main object
* @return INFA_MODULE object
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"ObjectCmd: <br />" .
$str_cmd);
$obj_ret->setMyModConf($this);
Documentation generated on Thu, 08 Jan 2009 17:47:02 +0100 by phpDocumentor 1.4.0a2