* @copyright (c) 2012-2013, ConLite Team * @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version) * @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version) * @link http://www.conlite.org ConLite.org * * $Id$ */ // security check defined('CON_FRAMEWORK') or die('Illegal call'); /** * Description of class.system_properties * * @author Ortwin Pinke */ class cApiSystemPropertyCollection extends ItemCollection { public static $_aCachedProperties; public static $_Counter; public function __construct() { global $cfg; parent::__construct($cfg['tab']['system_prop'], 'idsystemprop'); $this->_setItemClass("cApiSystemProperty"); if ($this->_bDebug) { echo "
";
            print_r(cApiSystemPropertyCollection::$_aCachedProperties);
            echo "
"; } } public function getSystemProperty($sType, $sName) { // sanitize param $sType = trim($sType); $sName = trim($sName); // use cache if exists if (is_array(self::$_aCachedProperties) && key_exists($sType, self::$_aCachedProperties)) { if (is_array(self::$_aCachedProperties[$sType]) && key_exists($sName, self::$_aCachedProperties[$sType])) { return self::$_aCachedProperties[$sType][$sName]['value']; } } $this->_loadPropertiesByType($sType); if (isset(self::$_aCachedProperties[$sType]) && is_array(self::$_aCachedProperties[$sType]) && key_exists($sName, self::$_aCachedProperties[$sType])) { return self::$_aCachedProperties[$sType][$sName]['value']; } return false; } private function _loadPropertiesByType($sType) { $this->resetQuery(); $this->setWhere('type', $sType); $this->query(); if ($this->count() > 0) { self::$_aCachedProperties[$sType] = array(); /* $oProperty cApiSystemProperty */ while ($oProperty = $this->next()) { self::$_aCachedProperties[$sType][$oProperty->get('name')]['value'] = $oProperty->get('value'); self::$_aCachedProperties[$sType][$oProperty->get('name')]['idsystemprop'] = $oProperty->get('idsystemprop'); } } } } class cApiSystemProperty extends Item { public function __construct($mId = false) { global $cfg; parent::__construct($cfg['tab']['system_prop'], 'idsystemprop'); if ($mId !== false) { $this->loadByPrimaryKey($mId); } } } ?>