Source for file OCSP_CMS_HTMLPAGE.phpclass
Documentation is available at OCSP_CMS_HTMLPAGE.phpclass
* Class file OCSP_CMS_HTMLPAGE.phpclass
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @requires __OCSP_PHPINCPATH__."common/OCSP_HTMLPAGE.phpclass";
* @see http://pear.php.net/manual/en/package.caching.cache-lite.php
* ---------------------------------------------------
* common settings and requirements
if (!defined('__OCSP_CMS_PHPINCPATH__'))
require_once __OCSP_DEFAULTCONFPATH__.
"cms.conf.phpinc";
* Class OCSP_CMS_PEARCACHE.phpclass
* @project Open CSP-Management
* @author Peter Krebs <p.krebs@amicas.at>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* @constant string CLASS_SRC_FILE
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* unit of work array of instances
* @staticvar array $myCMSPageInstances
protected static $loaded_CMS_HTML_Pages =
array();
/*** class methods ------------------------------------------------ */
* returns the current html page object
if ($debug) echoDebugMethod(__FILE__
,"static","OCSP_CMS_HTMLPAGE::getCurrentPage()");
throw
new Exception("COULD NOT FIND SOMETHING TO SHOW");
$obj_menu =
$obj_project->getCurrentMenuNode();
$obj_page =
$obj_menu->getCurrentPage(False,True);
* returns if a page is already instanced
return isset
(self::$loaded_CMS_HTML_Pages[intval($aPageId)]);
* returns the instance for $aPage
* NOTE you can pass either the pageId or the page object
* @return OCSP_CMS_HTMLPAGE
public static function &getInstance($aPage,$debug=
False)
if ($debug) echoDebugMethod(__FILE__
,"static","OCSP_CMS_HTMLPAGE::getInstance()");
if ($int_pagId =
intval($aPage))
if (isset
(self::$loaded_CMS_HTML_Pages[$int_pagId]) &&
pcf_is_instance_of(self::$loaded_CMS_HTML_Pages[$int_pagId],'OCSP_CMS_HTMLPAGE'))
return self::$loaded_CMS_HTML_Pages[$int_pagId];
if (!($aPage =
CMS_PAGE::getInstance($int_pagId)))
$int_pagId =
$aPage->getId();
if (isset
(self::$loaded_CMS_HTML_Pages[$int_pagId]) &&
pcf_is_instance_of(self::$loaded_CMS_HTML_Pages[$int_pagId],'OCSP_CMS_HTMLPAGE'))
return self::$loaded_CMS_HTML_Pages[$int_pagId];
self::$loaded_CMS_HTML_Pages[$int_pagId] =
new OCSP_CMS_HTMLPAGE($aPage,$debug);
return self::$loaded_CMS_HTML_Pages[$int_pagId];
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** compostion --------------------------------------------------- */
* @var CMS_PAGE $myPageObj
* @var CMS_MENU_NODE $myPageObj
* @var CMS_PROJECT $myProject
/*** attributes -------------------------------------------------- */
* @var string $myJsOnError
window.onerror=ocsp_handleErr;
var ocsp_handleErrDebug=true;
function ocsp_handleErr(msg,url,l)
txt =\"There was an error on this page.\\n\\n\";
txt+=\"Error: \" + msg + \"\\n\";
txt+=\"URL: \" + url + \"\\n\";
txt+=\"Line: \" + l + \"\\n\\n\";
txt+=\"Click OK to continue.\\n\\n\";
if (ocsp_handleErrDebug) alert(txt);
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* factories the html page from the environment
* @return OCSP_CMS_HTMLPAGE
if ($debug) echoDebugMethod(__FILE__
,"static","OCSP_CMS_HTMLPAGE::factoryFromEnv");
$obj_page =
self::getCurrentPage($debug);
$obj_ret =
self::getInstance($obj_page);
if (isset
($_GET['PREVIEW']) &&
intval($_GET['PREVIEW']))
$obj_ret->setPreviewMode(True);
* factories a html page from a cms page object
* @return OCSP_CMS_HTMLPAGE
if ($debug) echoDebugMethod(__FILE__
,"static","OCSP_CMS_HTMLPAGE::factoryFromPage()");
* @param CMS_PAGE_V2 $aPage
$this->myProject =
$aPage->getMyProject($debug);
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* returns the page object
* returns if preview is on
/** -----------------------------------------------------
* adds a body content (to a block)
* if the blockname ends with [] the content is treaten as array
* in this case prepend is disabled
* @param CMS_PAGE_V2 $aPage
* @param int $chapterMode
* @param boolean $prepend
* @param string $blockName
* @todo OCSP_HTMLPAGE::prepend in array mode
function addBodyContentPage($aPage,$chapterMode=
0,$prepend=
False,$blockName=
'DEFAULT',$debug=
False)
ocsp_logError(__FILE__
,__LINE__
,"addPageContent(): \$aPage (".
get_class($aPage).
") is not an instance of CMS_PAGE_V2",E_WARNING);
$aPage->execPrependCmds($debug);
$aPage->setMyHTMLPage($this);
$str_content=
$aPage->getContent($chapterMode,$debug);
/** -----------------------------------------------------
* 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'];
* HTML head ----------------------------------------------------------------------------------
* sets the html header form the page
* note clears all previous settings
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"No page object set");
if (!isset
($GLOBALS['OCSP_VAL']['CMS_CSS_STY_INCLUDED']))
$GLOBALS['OCSP_VAL']['CMS_CSS_STY_INCLUDED']=
array();
// ------------------------------------------------
// ------------------------------------------------
* loads the required templates and sets the template vars
* @param unknown_type $debug
public function prepare($debug=
False)
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"index template: ".
$str_idxTmpl);
* @param boolean $closeBody
* @param string $convertCharSet
* @version pk-07-12-14 gzip return
function display($closeBody=
true,$convertCharSet=
"UTF-8",$debug=
False)
parent::display($closeBody,$convertCharSet);
* @param string $errorMsg
<title>" .
t_admin("Fehler") .
"</title>
// ------------------------------------------------
// ------------------------------------------------
* returns if the current user can open the page
} // end class OCSP_CMS_HTMLPAGE
Documentation generated on Thu, 08 Jan 2009 17:45:16 +0100 by phpDocumentor 1.4.0a2