Source for file CMS_MENU_V2.phpclass
Documentation is available at CMS_MENU_V2.phpclass
* Class file CMS_MENU_V2.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: CMS_MENU_V2.phpclass,v 1.8 2008/06/16 07:07:03 pitlinz Exp $
* requirements -----------------------------------------------/
if (!defined('__OCSP_CMS_PHPINCPATH__')) require_once __OCSP_DEFAULTCONFPATH__.
"cms.conf.phpinc";
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: CMS_MENU_V2.phpclass,v 1.8 2008/06/16 07:07:03 pitlinz Exp $
/** -----------------------------------------------------
/** -----------------------------------------------------
* @var CMS_PROJECT $myProjObj
/** -----------------------------------------------------
* @staticvar string $myTable
* @staticvar string $myIdFld id column = root
* @staticvar string $myParentFld name of the parent column
* @staticvar string $mySortFld name of the sort field
* @staticvar string $myColPrevix
* @var string $myChildClass
* @var string $myChildKeys NOT FINAL comma sperated list of keys the children have to fit to
// ######################################
* @param mixed $aProject (CMS_PROJECT) a project object or (int) a project ID
* @param boolean $autoPopulate
function CMS_MENU_V2(&$aProject,$autoPopulate=
True,$debug=
False) {
if ($debug) echoDebugMethod(__FILE__
,get_class($this),"CMS_MENU_V2::CMS_MENU_V2($projId)",($autoPopulate ?
"AUTOPOPULATE" :
""));
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"setting project object with ID: ".
$aProject->getId());
$projId=
$aProject->getId();
* returns a node in the key tree
* @requires common/OCSP_DATE.phpclass
require_once $GLOBALS['OCSP']['PHPINCPATH'].
"common/OCSP_DATE.phpclass";
$obj_Date->setDbString($dbRow[$this->myColPrevix.
'SHOWFROM'],$debug);
$ts_showFrom=
$obj_Date->getLinuxTime();
$obj_Date->setDbString($dbRow[$this->myColPrevix.
'SHOWTILL'],$debug);
$ts_showTill=
$obj_Date->getLinuxTime();
'LANG' =>
$dbRow['LANG_ID'],
'SHOWFROM' =>
$ts_showFrom,
'SHOWTILL' =>
$ts_showTill,
* returns a array of pointers to the child objects
if ($arr_keyTree=
$this->getKeyTree()) // <pk-07-08-09>
foreach($arr_keyTree[0] as $i_Id =>
$a_keyTree)
$i_idx=
intval($a_keyTree['SORTORDER']);
while (isset
($arr_ret[$i_idx])) $i_idx++
;
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"returning empty array");
* @param boolean $useCache (is ignored here)
* @param boolean $keysOnly
function populateTree($useCache=
True,$keysOnly=
True,$where=
"",$debug=
False)
||
!isset
($GLOBALS['OCSP_VAL']['MENTREE'][$this->getGlobalTreeKey()]['ISLOADED'])
if ($arr_keyTree=
$this->myCmsCache->getMenuKeyTree($this->getProjId(),$debug))
unset
($arr_keyTree['PEARCACHE_TS']);
$where.=
" (PROJ_ID=".
$this->getProjId().
" OR PROJ_ID=0)";
if (parent::populateTree($useCache,$keysOnly,$where,$debug))
* generates a new child object and add it to the cache
* @param int $aId the (cache) id of the object
* @param string $aClassName if !empty $this-myChildClass is overwriten if class exists
if (empty($dataArr['MEN_OBJCLASS']) ||
(!is_array($GLOBALS['OCSP_CMS']['MENUTYPE'][$dataArr['MEN_OBJCLASS']]))) {
// unknown object class asume default
$s_menuClass=
$GLOBALS['OCSP_CMS']['MENUTYPE'][$dataArr['MEN_OBJCLASS']]['CLASS'];
require_once $GLOBALS['OCSP_CMS']['MENUTYPE'][$dataArr['MEN_OBJCLASS']]['INCLUDE'];
$s_cmd=
"\$o_nodeObj=new ".
$s_menuClass.
"();";
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"Object cmd: ".
$s_cmd);
$o_nodeObj->setDBVal($dataArr);
* @param bool $useCache (ignored here always True)
* return mixed DBMS_TREE_NODE if its a child
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"generating root node");
$obj_Node->setDBObj($this->getDBObj);
$obj_Node->setTreeObj($this);
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"returning Node from 'OCSP_VAL'");
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"generating node from NODEVAL <pre>".
print_r($arr_nodeVal,True).
"</pre>");
$GLOBALS['OCSP_VAL']['DBMS_TREE'][$this->getGlobalTreeKey()]['NODES'][$aId]=
$obj_Node->validateClass($debug);
return $GLOBALS['OCSP_VAL']['DBMS_TREE'][$this->getGlobalTreeKey()]['NODES'][$aId];
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"loading node form database");
$GLOBALS['OCSP_VAL']['DBMS_TREE'][$this->getGlobalTreeKey()]['NODES'][$aId]=
$obj_Node->validateClass();
$GLOBALS['OCSP_VAL']['DBMS_TREE'][$this->getGlobalTreeKey()]['NODEVAL'][$aId]['DATA']=
$arr_row;
//$this->myCmsCache->setMenuTreeIndex($this->getGlobalTreeKey());
$this->myCmsCache->setMenuData($GLOBALS['OCSP_VAL']['DBMS_TREE'][$this->getGlobalTreeKey()]['NODES'][$aId],$debug);
return $GLOBALS['OCSP_VAL']['DBMS_TREE'][$this->getGlobalTreeKey()]['NODES'][$aId];
if ($debug) echoDebugMethod(__FILE__
,__LINE__
,"node with id $aId not found in the database");
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} else if (isset
($this->PROJ_ID)) {
return intval($this->PROJ_ID);
* sets the project id if $projId != $this->PROJ_ID and the
* tree has children (sizeof($this->myChildren)) the childrens
$this->PROJ_ID=
intval($projId);
if ($this->PROJ_ID != intval($projId)) {
$this->PROJ_ID=intval($projId);
$this->myGlobalTreeKey=$this->myTable.intval($projId);
if (sizeof($this->myChildren)) {
if ($debug) echo "<blockquote><p><b>RELOADING CHILDREN</b></p>";
$this->myChildren=array();
$this->populate(False,$debug);
if ($debug) echo "</blockquote>";
* @param CMS_PROJECT $aProject
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* returns if the cms cache is usable
* if (_OCSP_USEPEARCACHE_) it's ensured that
* $GLOBALS['OCSP_OBJ']['CMS_PEARCHACHE'] is an object
require_once $GLOBALS['OCSP_CMS']['PHPINCPATH'].
"OCSP_CMS_PEARCACHE.phpclass";
$this->myCmsCache=
&$GLOBALS['OCSP_OBJ']['CMS_PEARCHACHE'];
* returns the cache array for a node
return $this->myCmsCache->getMenuVal($aId,$debug);
* @returns OCSP_CMS_PEARCACHE
Documentation generated on Thu, 08 Jan 2009 17:39:25 +0100 by phpDocumentor 1.4.0a2