Source for file CMS_PAGE_V2.phpclass
Documentation is available at CMS_PAGE_V2.phpclass
* Class file CMS_PAGE_V2.phpclass
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
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
* @deprecated since pk-08-06-16
/*** class constants --------------------------------------------- */
* @constant string CLASS_SRC_FILE
* @staticvar array $cmsPageList
static $cmsPageList =
array();
/** -----------------------------------------------------
/** -----------------------------------------------------
* @var CMS_PAGE_TEMPLATE $myTmpl
* @var array $chaTmpl (an array with chapter template objects used)
/** -----------------------------------------------------
* @staticvar string $colPrevix fields in $this->myTable starts with
* @staticvar string $myClassName name of the class
* @staticvar string $ctmplTable name of the chapter template table
* @staticvar string $ctmplClass name of the default chapter template class (is used to generate a new chapter template object)
var $ctmplClass =
"TMPL_CHAPTER_V3"; // <pk-05-08-26 />
* @staticvar string $cTable name of the chapter table
* @staticvar string $chapPrevix prefix used in chapter table for column names
* @staticvar string $myChapterClass
* NOTE make sure the class is included before calling chapter methods
* @var string $ctmplFldPrevix prefix of the template columns
* @var array $chaTmplArr with loaded chapter templates to avoid reloading
* @staticvar string $moduleKey
* METHODS _____________________________________________
/** -----------------------------------------------------
* init the object and populates it if (intval($aId))
* @param int $projId the project ID
* @param int $menId the menu ID
* @param int $aId the page ID
* @param int $langId the language ID
function CMS_PAGE_V2($projId=
0,$menId=
0,$aId=
0,$langId=
0,$debug=
False) {
$this->setDBField($this->myProjIdCol,$projId); // <pk-05-07-26 /> as PROJ_ID is no longer part of primary key
$this->setDBField('LANG_ID',$langId); // <pk-05-07-26 /> as LANG_ID is no longer part of primary key
$this->setDBField($this->myMenuIdCol,$menId); // <pk-05-07-26 /> as MEN_ID is no longer part of primary key
* generates a new page object of class $className
* @param string $className
if ($debug) echoDebugMethod(__FILE__
,"static call","CMS_PAGE_V2::CMS_PAGE_FROM_CLASS($className)");
if (isset
($OCSP_CONF['CMS']['DEFAULTPAGETYPE']) &&
!empty($OCSP_CONF['CMS']['DEFAULTPAGETYPE']))
$className=
$OCSP_CONF['CMS']['DEFAULTPAGETYPE'];
$className=
"CMS_PAGE_V2";
if (isset
($OCSP_CONF['CMS']['PAGETYPE'][$className]['OBJINC']))
require_once $OCSP_CONF['CMS']['PAGETYPE'][$className]['OBJINC'];
ocsp_logError(__FILE__
,__LINE__
,"\$OCSP_CONF['CMS']['PAGETYPE'][$className]['OBJINC'] not set",E_NOTICE);
$className=
'CMS_PAGE_V2';
$str_cmd=
"\$obj_ret=new $className();";
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"new cmd: $str_cmd");
* constructor for page objects out of a database row
* @param CMS_MENU_NODE $aMenuNode
if ($debug) echoDebugMethod(__FILE__
,"static call","<hr />CMS_PAGE_V2::CMS_PAGE_FROM_DBROW()");
if (isset
($dbRow['PAG_OBJCLASS']))
$o_ret->setDBRow($dbRow,True);
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"CMS_PAGE_FROM_DBROW returns ".
get_class($o_ret).
" object ID: ".
$o_ret->getId());
* tries to get the page object from the querystring
if ($debug) echoDebugMethod(__FILE__
,"static call","CMS_PAGE_V2::CMS_PAGE_FROM_GET()");
return self::factoryFromQueryString(False,$debug);
/** -----------------------------------------------------
* returns a array of variables used by the page object
* [FLDCLASS] name of DBMS_FIELD* class
* [CLASSVALS] array of values of [FLDCLASS]
"FLDCLASS" =>
"DBMS_FIELD_TEXTAREA",
"label" =>
"Meta Keywords",
"toolTip" =>
"Meta Keywords fr Suchmaschinen"
"METADESCRIPTION"=>
array(
"FLDCLASS" =>
"DBMS_FIELD_TEXTAREA",
"label" =>
"Meta Description",
"toolTip" =>
"Beschreibung fr Suchmaschinen"
* @returns int the page id
* returns the class name of the page object stored in the db
if ($debug) echo
"<p><b>CMS_PAGE_V2::getObjClass()</b> (".
get_class($this).
")</p>\n";
if (!empty($this->PAG_OBJCLASS)) {
return $this->PAG_OBJCLASS;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* sets the page as current page by setting projects myPageObj
$this->myProjObj->setMyPageObj($this,$debug);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* populates the page and checks if the current object ($this) is of the class
* stored in the database PAG_OBJCLASS
* if this differs a new page object with the right class is returned
if ($arr_cachePageVal=
$this->myCmsCache->getPageData($this->getId(),$debug) && isset
($arr_cachePageVal['PAGVAL']['PAG_OBJCLASS']))
return CMS_PAGE_V2::CMS_PAGE_FROM_PEARCACHEARR($arr_cachePageVal,$debug);
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"Page Query: ".
$str_query);
if ($dbRow=
$this->myDBObj->quickQuery($str_query))
if (!empty($dbRow['PAG_OBJCLASS']) &&
(get_class($this) !=
$dbRow['PAG_OBJCLASS']))
if ($debug) echoDebugMethod(__FILE__
,__LINE__
,"generating no object for class: ".
$dbRow['PAG_OBJCLASS'].
" current class: ".
get_class($this));
$obj_ret->setDBObj($this->myDBObj);
ocsp_logError(__FILE__
,__LINE__
,"could not get object from database row <pre>".
print_r($dbRow,True).
"</pre>",E_ERROR);
* @param bool $debug show debug info
* @returns int returns the autoIncFld ID if exists or 1 on success
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
$s_query =
"SELECT COUNT(*) FROM ".
$this->myTable;
$s_query.=
" AND PAG_SORTORDER=".
$i_sortOrder;
if ($this->myDBObj->quickQuery($s_query,0)) {
$s_query=
"UPDATE ".
$this->myTable .
" SET PAG_SORTORDER=PAG_SORTORDER+1 ";
$s_query.=
" AND PAG_SORTORDER >= ".
$i_sortOrder;
$this->myDBObj->executeCmd($s_query);
$s_query =
"SELECT IFNULL(MAX(".
$this->colPrevix.
"SORTORDER),0) FROM ".
$this->myTable;
return parent::dbInsert($debug);
* deletes the row from the database
* @note overwrite if not uses PAG_ID and T_CMS_CHAPTER
* @param boolean $backupData
function dbDelete($backupData=
False,$debug=
False) {
foreach($a_chapters as $o_chap) {
$o_chap->dbDelete($backupData,$debug);
return parent::dbDelete($backupData,$debug);
* sets the default values form the default form
if ($debug) echo
"<p><b>CMS_PAGE_V2::setDefaults()</b> (".
get_class($this).
")</p><blockquote>";
$this->setDbRow($frmObj->getDefaultValArr("",$debug),False,$debug);
if ($debug) echo
"<p><b>ERROR:<br />Could not load default form</p>";
if ($debug) echo
"</blockquote>";
#############################################################################
#############################################################################
* moves the page to the first positon (SORTORDER)
* @note does not save the object
* @param boolean $allStates
* @todo only $allStates=True coded now
if ($debug) echo
"<p><b>CMS_PAGE_V2::sortMoveFirst(...)</b> (".
get_class($this).
")</p>";
$query.=
" ORDER BY ".
$this->colPrevix.
"SORTORDER ";
if ($debug) echo
"<blockquote><p>$query</p></blockquote>";
if ($siblings=
$this->myDBObj->queryArray($query)) {
foreach($siblings as $siblId) {
$cmd =
"UPDATE ".
$this->myTable.
" set ".
$this->colPrevix.
"SORTORDER = ".
$sortOrder++
;
$cmd.=
" WHERE ".
$this->colPrevix.
"ID =".
$siblId;
* moves the page to the last positon (SORTORDER)
* @note does not save the object
* @param boolean $allStates
* @todo only $allStates=True coded now
if ($debug) echo
"<p><b>CMS_PAGE_V2::sortMoveFirst(...)</b> (".
get_class($this).
")</p>";
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_WARNING);
$query.=
" ORDER BY ".
$this->colPrevix.
"SORTORDER ";
if ($debug) echo
"<blockquote><p>$query</p></blockquote>";
if ($siblings=
$this->myDBObj->queryArray($query)) {
foreach($siblings as $siblId) {
$cmd =
"UPDATE ".
$this->myTable.
" set ".
$this->colPrevix.
"SORTORDER = ".
$sortOrder++
;
$cmd.=
" WHERE ".
$this->colPrevix.
"ID =".
$siblId;
* moves the page on position up in the sortorder
* @var array $a_prevPageRow
if ($debug) echo
"<p><b>CMS_PAGE_V2::moveSortUp()</b> (".
get_class($this).
")</p>";
if ($debug) echo
"<blockquote>current OrderNr: (".
$this->colPrevix.
"SORTORDER)".
intval($this->{$this->colPrevix.
"SORTORDER"}).
"</blockquote>";
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_WARNING);
$s_Query =
"SELECT * FROM ".
$this->myTable;
$s_Query.=
" ORDER BY ".
$this->colPrevix.
"SORTORDER DESC";
if ($debug) echo
"<blockquote>Query: ".
$s_Query.
"</blockquote>";
if ($a_prevPageRow=
$this->myDBObj->quickQuery($s_Query)) {
} else if ($i_myOrderNr >
1) {
* moves the page on position up in the sortorder
* @var array $a_nextPageRow
if ($debug) echo
"<p><b>CMS_PAGE_V2::moveSortUp()</b> (".
get_class($this).
")</p>";
$s_Query =
"SELECT * FROM ".
$this->myTable;
$s_Query.=
" ORDER BY ".
$this->colPrevix.
"SORTORDER";
if ($debug) echo
"<blockquote>Query: ".
$s_Query.
"</blockquote>";
if ($a_nextPageRow=
$this->myDBObj->quickQuery($s_Query)) {
$a_nextPageRow[$this->colPrevix.
"SORTORDER"]=
$i_myOrderNr;
$this->{$this->colPrevix.
"SORTORDER"} =
$i_myOrderNr+
1;
#############################################################################
#############################################################################
* returns the feedback form object
* @param string $fbFormName
if ($debug) echo
"<p><b>CMS_PAGE_V2::getFeedbackForm($fbFormName,...)</b> (".
get_class($this).
")</p>";
require_once $GLOBALS['OCSP']['PHPFORMPATH'].
"forms.phpinc";
if (($fbFormName !=
"T_CMS_FEEDBACK") &&
($frmObj=
&DBMS_form_loadName("T_CMS_FEEDBACK"))) {
* stores feedback data and returns the data array
* or null if an error occured
* @param DBMS_FORM $frmObj
* @param string $postName
if ($debug) echo
"<p><b>CMS_PAGE_V2::saveFeedBackForm(...)</b> (".
get_class($this).
")</p>";
if (!is_array($_POST[$postName])) return NULL;
if (!$DBVAL=
$frmObj->getValueArray($_POST['DBVAL'])) return NULL;
$DBVAL['MEN_ID'] =
$this->MEN_ID;
$DBVAL['PAG_ID'] =
$this->PAG_ID;
$DBVAL['LANG_ID'] =
$this->LANG_ID;
if ($DBVAL['CFB_ID']=
$this->myDBObj->insertArray("T_CMS_FEEDBACK",$DBVAL,$debug))
#############################################################################
#############################################################################
* returns the body include file from the page template
* "" if none is set or no template could be loaded
return $this->myTemplate->getDBField("PTMP_BODYTMPLINC");
* loads the page template object if $this->myTemplate is not set or has a different ID
* uses $GLOBALS['OCSP']['CACHE'][$this->moduleKey.'PAGE_TEMPLATES'] as memory cache
* @param boolean $debug show debug information
* @param boolean $enableEmpty
* @version pk-05-12-13 enableEmpty added
* @version pk-06-02-16 use $this->{$this->ptmplFld} instead of $this->PTMP_ID; use Cache
* @version pk-07-06-07 use cache ask menu and project for PTMP_ID
* @deprecated since pk-08-06-19
return ($this->getTemplate($debug) ?
True :
False);
* Overwrite in inherit classes with other tables or objects
* @requires $GLOBALS['OCSP_CMS']['PHPINCPATH']."template/chapter/TMPL_CHAPTER_V3.phpclass";
if ($debug) echo
"<p><b>CMS_PAGE_V2::loadChaTemplate($tmplId)</b> (".
get_class($this).
")</p>";
require_once $GLOBALS['OCSP_CMS']['PHPINCPATH'].
"template/chapter/TMPL_CHAPTER_V3.phpclass";
$cmd=
"\$this->chaTmplArr[".
$tmplId.
"] = new ".
$this->ctmplClass.
"();";
if ($debug) echo
"<pre>".
$cmd.
"</pre>";
$this->chaTmplArr[$tmplId]->setPTMPId($this->getTemplateId());
// $this->chaTmplArr[$tmplId]->setLangId(intval($chapRow['LANG_ID']));
* returns the template object with ID $tmplId
* @returns TMPL_CHAPTER_V3
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* returns the query string to select the chapters
* adds $addWhere between WHERE and ORDER BY
* $query.=" AND LANG_ID=".$this->getLangId();
* $query.=" ORDER BY ".$this->."_SORTORDER";
* @param bool $showAllStates don't care about chapter state
* @param bool $showTimedOut show chapters with SHOWTILL date in past
* @param bool $showFuture show chapters with SHOWFROM date in futur
* @param mixed $showGroup 0=Public, -1 $OCSP_OBJ['USER']->getGroups(), False don't care else exakt the group
* @param string $addWhere
* @global array $OCSP_OBJ
function getChapQuery($showAllStates=
False,$showTimedOut=
False,$showFuture=
False,$showGroup=
False,$addWhere=
"",$debug=
False) {
if ($debug) echoDebugMethod(__FILE__
,get_class($this),"CMS_PAGE_V2::getChapQuery($showAll,$showTimedOut,$showFuter,$showGroup,$addWhere,$debug)");
if ($this->cTable ==
"T_CMS_CHAPTER") {
$query.=
",(".
$this->chapPrevix.
"SHOWFROM <= NOW()) AS SHOWFROM_OK";
$query.=
",(".
$this->chapPrevix.
"SHOWTILL > NOW()) AS SHOWTILL_OK";
$query.=
" FROM ".
$this->cTable;
$query.=
" AND ".
$this->myDBObj->qs_getWhereIn($this->chapPrevix.
"STATE",$this->getChapOnlineStates(),False);
if ($showGroup !==
False ) { // note !== type equal compare (0 != False)
$query.=
" AND ".
$this->chapPrevix.
"SHOWGROUP = ".
$showGroup;
$query.=
" ORDER BY ".
$this->chapPrevix.
"SORTORDER";
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"Returning: $query");
* returns an array of chapter objects
* NOTE does not use CMS_PAGE_V2::getChapQuery()
* @param int $showMode (0=all)
* @param boolean $onlineOnly
* @version pk-05-11-16 checks if certain columns exists added
* @version pk-07-09-11 use $this->getChapQuery
* @todo CMS_PAGE_V2::getChapterObjArray() cacheing
$str_query=
$this->getChapQuery($b_showOffLine,$b_showOffLine,$b_showOffLine,$showGroup,"",$debug);
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"Chapter Query: $str_query");
if ($o_cursor=
$this->myDBObj->query($str_query)) {
//if (!class_exists($this->myChapterClass)) $this->myChapterClass="CMS_CHAPTER_V2";
while($a_row=
$o_cursor->fetchArrayFld()) {
ocsp_logError(__FILE__
,__LINE__
,"could not instantion chapter object ",E_ERROR);
$i_idx=
$obj_chapter->getSortOrder();
while(isset
($a_chapters[$i_idx])) $i_idx++
;
$a_chapters[$i_idx]=
$obj_chapter;
* @todo CMS_PAGE_V2::getChapterObj() use cache
* @todo CMS_PAGE_V2::getChapterObj() include chapter class if not exists
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"Chapter Query: ".
$str_query);
if (!$chaRow=
$this->myDBObj->quickQuery($str_query))
ocsp_logError(__FILE__
,__LINE__
,"could not find chapter with id: $chaId",E_WARNING);
if (empty($str_chaClass)) $str_chaClass=
"CMS_CHAPTER_V2";
ocsp_logError(__FILE__
,__LINE__
,"chapter class $str_chaClass not loaded",E_WARNING);
$str_chaClass=
"CMS_CHAPTER_V2";
$str_cmd=
"\$obj_chapter=new ".
$str_chaClass.
"();";
$obj_chapter->setDBRow($chaRow,True,$debug);
* copies the chpaters from the page with id $sourceId
* @param int $sourceId PAG_ID of sourcepage
* @param bool $outdated if true copy only pages with show till > now
* @version pk-05-03-12 bugfix
* @todo CMS_PAGE_V2::copyChaptersFrom() inline SQL
$str_query =
"SELECT * FROM ".
$this->cTable.
" WHERE ".
$this->colPrevix.
"ID=".
intval($sourceId); /* <pk-05-03-12 /> */
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
if ($obj_cursor =
$this->myDBObj->query($outdated)) {
while ($arr_chapter =
$obj_cursor->fetchArrayFld()) {
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"<pre>".
$arr_chapter.
"</pre>");
$o_newCha =
new $chapter['CHA_CLASS']();
* @param boolean $orderByState
* @param boolean $orderByShowMode
function resortChapters($orderByState=
False,$orderByShowMode=
True,$debug=
False) {
if ($debug) echo
"<p><b>CMS_PAGE_V2::resortChapters()</b> (".
get_class($this).
")</p>";
if ($orderByShowMode) $orderBy.=
$this->chapPrevix.
"SHOWMODE,";
if ($orderByState) $orderBy.=
$this->chapPrevix.
"STATE,";
if ($debug) echo
"<blockquote><p>Query: $query</p><ul>";
if ($chaList=
$this->myDBObj->queryArray($query,0,1)) {
foreach($chaList as $chaId =>
$sort) {
if ($sort !=
$sortOrder) {
$cmd =
"UPDATE ".
$this->cTable.
" SET ".
$this->chapPrevix.
"SORTORDER=".
$sortOrder;
$cmd.=
$where.
" AND ".
$this->chapPrevix.
"ID=".
$chaId;
if ($debug) echo
"<li>$cmd</li>";
if ($debug) echo
"</ul></blockquote>";
* moves a chapter to a specified positon (SORTORDER)
* first updates the chapter and than
* calls $this->resortChapters(False,True,$debug)
if ($debug) echo
"<p><b>CMS_PAGE_V2::chpater_MoveToPosition($chaId,$position,$debug)</b> (".
get_class($this).
")</p>";
$cmd.=
" AND CHA_ID=".
intval($chaId);
if ($debug) echo
"<p>Cmd: $cmd</p>";
if ($this->myDBObj->executeCmd($cmd)) {
// #########################################
* returns a query to find a sibling
* if $preview is True showdate is ignored
* @param boolean $preview
if ($debug) echo
"<p><b>CMS_PAGE_V2::getSiblingQueryString()</b> (".
get_class($this).
")</p>";
if ($idOnly) $query.=
$this->colPrevix.
"ID "; else $query.=
"* ";
$query.=
" FROM ".
$this->myTable.
" WHERE ";
foreach($keys as $key =>
$val) {
$query.=
$and .
$key.
" =\"".
str_replace('"','\"',$this->{$key}).
"\"";
if (isset
($this->MEN_ID)) {
$query.=
$and.
" MEN_ID=".
intval($this->MEN_ID);
$query.=
$and.
$this->colPrevix.
"SHOWFROM <= NOW()";
$query.=
" AND ".
$this->colPrevix.
"SHOWTILL >= NOW()";
* returns the id of the next sibling
* @param boolean $preview
$query.=
" AND ".
$this->colPrevix.
"STATE IN (";
foreach($GLOBALS['OCSP_CMS']['PAGESTATE'] as $id =>
$sArr) {
if ($debug) echo
"<blockquote><p>$query</p></blockquote>";
return $this->myDBObj->quickQuery($query,0);
* returns the link to the next page by adding setting getParam PAG_ID in the menu query
* @param boolean $preview
* returns the id of the previous sibling
* @param boolean $preview
$query.=
" AND ".
$this->colPrevix.
"STATE IN (";
foreach($GLOBALS['OCSP_CMS']['PAGESTATE'] as $id =>
$sArr) {
if ($debug) echo
"<blockquote><p>$query</p></blockquote>";
return $this->myDBObj->quickQuery($query,0);
* returns the link to the parent menu
if ($o_menParent=
$o_menNode->getParentObj()) {
* returns the link to the first page state 7 (insert)
* @param boolean $preview
function getNewLink($preview=
False,$debug=
False) {
$ret=
$_SERVER['SCRIPT_NAME'];
$ret.=
"&MEN_ID=".
$this->MEN_ID;
if ($pagId=
$this->myDBObj->quickQuery($query,0)) {
* returns the link to the first page state 8 (edit)
* @param boolean $preview
if ($debug) echo
"<p><b>CMS_PAGE_V2::getEditLink()</b> (".
get_class($this).
")</p>";
$ret=
$_SERVER['SCRIPT_NAME'];
$ret.=
"&MEN_ID=".
$this->MEN_ID;
if ($debug) echo
"<blockquote><p>$query</p></blockquote>";
if ($pagId=
$this->myDBObj->quickQuery($query,0)) {
// #########################################
* returns a comma seperated list of chapter page modes to show
* from $GLOBALS['OCSP_CMS']['CHAPTERSTATE']
foreach($GLOBALS['OCSP_CMS']['CHAPTERSTATE'] as $key =>
$settings) {
echo
"<pre>";print_r($settings); echo
"</pre>";
if ($settings["SHOW"]) $ret[]=
$key;
echo
"<pre>";print_r($ret); echo
"</pre>";
* shows the page in preview mode
* @todo rewrite the method
function preview($mode=
0,$debug=
False) {
if ($debug) echo
"<p><b>CMS_PAGE_V2::preview($mode,$debug)</b> (".
get_class($this).
")</p>";
if (!is_object($this->myTemplate)) {
if (!($this->loadTemplate($debug))) {
$ERR="TEMPLATE_NOT_FOUND ".$query;
include __OCSP_PHPINCPATH__."io/errors.phpinc";
<!doctype public \"-//w3c//dtd html 4.01 transitional//en\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html lang=\"de-at\">\n";
echo "<head><title>".$this->{$this->colPrevix."TITLE"}."</title><link type=\"text/css\" rel=\"stylesheet\" href=\"/cms/defaultStyles.php\" />";
if ( intval($this->STY_ID)) {
echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/cms/styles.php?STY_ID=".$this->STY_ID."&".$this->myProjIdCol."=".$this->getProjId()."\" />";
echo $this->myTemplate->getMetaTag()."\n";
echo $this->myTemplate->getCSSTag()."\n";
echo $this->myTemplate->getJavaScriptTag()."\n";
echo $this->myTemplate->getBodyTag();
echo $this->myTemplate->getHeadLineTag();
echo $this->{$this->colPrevix."HEADER"};
if ($debug) echo "<p>Chapter Query: ".$this->getChapQuery(True,False,True,False,"",$debug)."</p>";
if ($cursor=$this->myDBObj->query($this->getChapQuery())) {
while($row=$cursor->fetchArray()) {
if (!is_object($this->chaTmplArr[$row[$this->ctmplFldPrevix."ID"]])) {
$idx=$row[$this->ctmplFldPrevix."ID"];
$cmd="\$this->chaTmplArr[".$idx."] = new ".$this->ctmplClass."();";
echo $this->chaTmplArr[$row[$this->ctmplFldPrevix."ID"]]->getTag(unserialize($row[$this->chapPrevix.'FIELDS']));
echo $this->{$this->colPrevix."FEETER"};
echo $this->myTemplate->getFeeterTag();
* returns the html code of the page header
* @param boolean $withStyles
* @param boolean $withEndTag </ pk-04-10-11>
* @version pk-05-04-19 lang added to html (@see http://www.w3.org/TR/WCAG10-HTML-TECHS/#identify-primary-lang)
* @version pk-05-07-12 bugfix $withStyles
* @version pk-07-02-27 pcf_get_htmlJsInclude
* @todo take lang from the LANG_ID
* @requires __OCSP_PHPINCPATH__."common/OCSP_BROWSER.phpclass" (_OCSP_USEPEARCACHE_)
function getHead($withStyles=
True,$debug=
False,$withEndTag=
True) {
if ($str_header=
$this->myCmsCache->getPageHeader($this,$debug))
// get the project default template
$s_query =
"SELECT PTMP_ID FROM T_CMS_TMPL_PAGE WHERE (PROJ_ID=".
$this->getProjId().
" OR PROJ_ID=0) ";
$s_query.=
" ORDER BY PROJ_ID DESC,PTMP_ISDEFAULT DESC";
$ERR=
"TEMPLATE_NOT_FOUND ".
$s_query;
if (!isset
($GLOBALS['PROJECT']['HTML']['HEAD_PREPEND'])) $GLOBALS['PROJECT']['HTML']['HEAD_PREPEND']=
""; // <pk-06-07-26 /> E_ALL
if (!isset
($GLOBALS['PROJECT']['META'])) $GLOBALS['PROJECT']['META'] =
""; // <pk-06-07-26 /> E_ALL
if (!isset
($GLOBALS['PROJECT']['HTML']['HEAD_APPEND'])) $GLOBALS['PROJECT']['HTML']['HEAD_APPEND'] =
""; // <pk-06-07-26 /> E_ALL
$str_header =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
$str_header.=
"<html lang=\"de-at\">\n";
$str_header.=
" <head>\n";
$str_header.=
" <!-- GLOBAL HEAD_PREPEND -->\n".
$GLOBALS['PROJECT']['HTML']['HEAD_PREPEND'].
"\n <!-- END HEAD_PREPEND -->\n";
$str_header.=
" <meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\">\n";
$str_header.=
" <meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\">\n";
$str_header.=
" <meta http-equiv=\"Content-Style-Type\" content=\"text/css\">\n";
$str_header.=
pcf_get_htmlJsInclude($GLOBALS['OCSP']['JAVASCRIPTURL'].
"js_browser.js.phpinc"); // <pk-07-02-27 />
$str_header.=
pcf_get_htmlJsInclude($GLOBALS['OCSP']['JAVASCRIPTURL'].
"window.js.php"); // <pk-07-02-27 />
$str_header.=
$GLOBALS['PROJECT']['META'].
"\n\n";
$str_header.=
" <!-- GLOBAL HEAD_APPEND -->\n".
$GLOBALS['PROJECT']['HTML']['HEAD_APPEND'].
"\n <!-- END HEAD_APPEND -->\n";
if ($withEndTag) $str_header.=
" </head>\n\n";
if ($debug) echo
"</blockquote>\n";
if ($debug) echoDebug(__FILE__
,"<p class=\"debug\">writing cache</p>");
$str_cache.=
$str_header.
"\n<!-- header comes from cache -->\n";
$obj_cache->save($str_cache,"pageHeaders".
$this->getCacheIdString(),$GLOBALS['OCSP_OBJ']['BROWSER']->getId());
* returns the tag for a single chapter
* @param bool $chkShowVal
* @version pk-06-10-02 set MenId to the chapter
// <pk-05-10-10> <pk-06-09-28>
if (!isset
($chapRow['CHA_CLASS']) ||
empty($chapRow['CHA_CLASS']))
if (isset
($GLOBALS['OCSP_CMS']['CHAPTERTYPE'][$chapRow['CHA_CLASS']]))
require_once $GLOBALS['OCSP_CMS']['CHAPTERTYPE'][$chapRow['CHA_CLASS']]['OBJINC'].
$GLOBALS['OCSP_CMS']['CHAPTERTYPE'][$chapRow['CHA_CLASS']]['CLASS'].
".phpclass";
if ($debug) echoDebug(__FILE__
,"<p>Using default class CMS_CHAPTER_V2");
$chapRow['CHA_CLASS']=
'CMS_CHAPTER_V2';
require_once $GLOBALS['OCSP_CMS']['CHAPTERTYPE'][$chapRow['CHA_CLASS']]['OBJINC'].
$GLOBALS['OCSP_CMS']['CHAPTERTYPE'][$chapRow['CHA_CLASS']]['CLASS'].
".phpclass";
$s_cmd=
"\$o_chapter=new ".
$chapRow['CHA_CLASS'].
"();";
if ($debug) echo
"<p>ChapterCmd: ".
$s_cmd.
"</p>";
$o_chapter->setTemplateObj($this->chaTmplArr[$idx]);
return $o_chapter->getTag($this->getDBVal(),'$',False,$debug); // getTag($tmplVals=NULL,$tmplVarSign='$',$wysiwygPreView=False,$debug=False)
if ($debug) return "<p style=\"color:red\">NO TEMPLATE FOR ".
$this->chapPrevix.
"ID ".
$chapRow[$this->chapPrevix.
'ID'].
"</p>";
* returns the page feeter
// old *inconsistent style*
* executes a prepend script before the page output starts
* echos the content of the page
* @param int $chaShowMode
* @version pk-05-11-10 debug infos
function content($chaShowMode=
0,$debug=
False) {
echo
$this->getContent($chaShowMode,$debug);
if ($chaShowMode==0) echo $this->getHeadlineTag($debug);
echo $this->getChapter($chaShowMode,$debug);
if ($chaShowMode==0) echo $this->getFeeterTag($debug);
function view($chaShowMode=
0,$debug=
False) {
echo
$this->myTemplate->getBodyTag($debug);
$this->content($chaShowMode,$debug);
* returns the css tag to echo in the header
* @param boolean $asTemplate do not parse the return value with $this->getDBVal();
* @version pk-05-06-29 PROJ_ID added to style
* @version pk-06-07-19 write styles directly to the file
$s_ret=
"<!-- \n________CMS_PAGE_V2::getCSSHeaderTag________\n-->\n";
$s_ret.=
$this->myProjObj->getCSS_definition("",False,False,$debug);
$s_ret.=
$this->myTemplate->getCSSTag(False,$debug);
$s_ret.=
" <link type=\"text/css\" rel=\"stylesheet\" href=\"/cms/defaultStyles.php\">\n\n";
$s_ret.=
" <link type=\"text/css\" rel=\"stylesheet\" href=\"/cms/defaultStyles.php?".
$this->myProjIdCol.
"=".
$this->getProjId().
"\">\n";
$s_ret.=
"\n\t<!-- template styles -->\n";
$s_ret.=
$s_tmplCss.
"\n";
require_once $GLOBALS['CMS']['PHPINCPATH'].
"css/CMS_CSSSTYLE.phpclass";
$s_query=
"SELECT * FROM T_CMS_CSSSTYLES WHERE STY_ID=".
intval($this->getDBField('STY_ID'));
if ($a_sty=
$this->myDBObj->quickQuery($s_query)) {
$s_ret.=
"<style type=\"text/css\">\n<!--\n";
$s_ret.=
"\n/* STYLE: ".
$a_sty['STY_NAME'].
" PROJECT: ".
$a_sty['PROJ_ID'].
" */\n";
$s_ret.=
$o_style->getCSSCode($media,-
1,$debug);
$s_ret.=
"-->\n</style>\n";
if (!empty($a_sty['STY_JAVACODE'])) {
$s_ret.=
"<!-- __STY_JAVACODE__START__ -->\n";
$s_ret.=
"<script language=\"javascript\" type=\"text/javascript\">\n<!--\n";
$s_ret.=
$a_sty['STY_JAVACODE'];
$s_ret.=
"\n//-->\n</script>\n";
$s_ret.=
"<!-- __STY_JAVACODE__END__ -->\n";
} // if ($a_sty=$this->myDBObj->quickQuery($s_query))
} // if (intval($this->getDBField('STY_ID')))
$s_ret.=
"\n<!-- _________________________________________________________ -->\n";
$s_ret.=
"<!-- page styles done -->\n";
//$s_metaTag = $this->myTemplate->getMetaTag();
switch($i_projMetaMethod) {
$s_pMetaDesc=
$this->getDBField('METADESCRIPTION');
if (!empty($s_pMetaDesc)) {
$s_metaTag.=
"\t<meta name=\"description\" content=\"".
str_replace("\"","''",trim($s_pMetaDesc)).
"\">";
if (!empty($s_pMetaKeys)) {
$s_metaTag.=
"\t<meta name=\"keywords\" content=\"".
str_replace("\"","''",$s_pMetaKeys).
"\">";
* @version pk-04-09-08 param debug added
// $tag = "<script language=\"JavaScript\" src=\"".$GLOBALS['PROJECT']['JAVASCRIPTURL']."window.js\" type=\"text/javascript\"></script>\n";
$s_tag.=
$this->myTemplate->getJavaScriptTag();
* returns the html-title tag
* @version pk-05-12-13 "\t" added
return "\t<title>".
$this->getTitle().
"</title>\n";
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* returns a HTML Redirector
* @param string $destFrame
* @version pk-05-10-07 bugfix
if ($debug) echo
"<p><b>CMS_PAGE_V2::getHTMLRedirect($destUrl,$destFrame)</b> (".
get_class($this).
")</p>"; // <pk-05-10-07 />
$ret=
"<script language=\"javascript\" type=\"text/javascript\">\n";
$ret.=
"\tdocument.location.href=\"".
$destUrl.
"\";\n";
$ret.=
"\tparent.location.href=\"".
$destUrl.
"\";\n";
$ret.=
"\ttop.location.href=\"".
$destUrl.
"\";\n";
$ret.=
"\tvar myWnd = window.open(\"".
$destUrl.
"\",\"".
$destFrame.
"\");\n";
$ret.=
"\tmyWnd.focus();\n";
$ret.=
"<a href=\"".
$destUrl.
"\" target=\"".
$destFrame.
"\">Weiter</a>";
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* writes the page values to the pear cache
echoDebugLine(__FILE__
,__LINE__
,"object not cached because: ".
($this->isPopulated() ?
"caching disabled" :
"object not populated"));
Documentation generated on Thu, 08 Jan 2009 17:39:47 +0100 by phpDocumentor 1.4.0a2