Source for file OCSP_HTMLPAGE.phpclass
Documentation is available at OCSP_HTMLPAGE.phpclass
* Class file OCSP_HTMLPAGE.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_HTMLPAGE.phpclass,v 1.27 2008/12/10 15:39:05 peterkrebs Exp $
* ---------------------------------------------------
* common settings and requirements
require_once dirname(__FILE__
) .
_OCSP_DIRSEP_ .
"pcf.phpinc";
require_once dirname(__FILE__
) .
_OCSP_DIRSEP_ .
"pcf_templates.phpinc";
/** ---------------------------------------------------
* Class OCSP_HTMLPAGE.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_HTMLPAGE.phpclass,v 1.27 2008/12/10 15:39:05 peterkrebs Exp $
* @desc buffers a html page
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* @constant string CLASS_SRC_FILE
const CLASS_SRC_FILE = __FILE__
;
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** class vars ------------------------------------------------------ */
/*** class methods --------------------------------------------------- */
* if $name is in URIs Query string the value
* is replaced otherwise $name=$value is appended to the uri
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** compostion --------------------------------------------------- */
* @var CMS_PROJECT $myProject
* @var OCSP_AJAX $myAjaxObj
/*** attributes -------------------------------------------------- */
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
* @var string $myHtmlTag <html ...>
protected $myHtmlTag=
"xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"de_DE\" lang=\"de_DE\"";
* http attributes ----------
* an array of http header fields
* @var array $myHTTP_headers
* @see http://www.php.net/header
* @see http://www.faqs.org/rfcs/rfc2616
'Content-Type' =>
array('EQUIV'=>
"Content-Type", 'CONTENT'=>
"text/html;charset=utf-8"),
'Content-Script-Type' =>
array('EQUIV'=>
"Content-Script-Type",'CONTENT'=>
"text/javascript;charset=utf-8"),
'Content-Style-Type' =>
array('EQUIV'=>
"Content-Style-Type", 'CONTENT'=>
"text/css;charset=utf-8")
* @var array $myJS_includes
protected $myJS_includes=
array('$@SYSTEMURL$javascript/jquery/jquery.js','$@SYSTEMURL$jOCSP/jOCSP.js');
* @var array $myCSS_includes
* @var string $myCSS_code
* @var string $myHeadContent
* @var string $myBodyTag added to <body .... >
* @var string $myBodyOnload
* @var string $myJsOnError
* @var array $myBodyBlocks array of block names in the order the have been added
* @var array $myBodyContent
* @var array $myBodyVars array of template vars to replace
* METHODS _____________________________________________
/** -----------------------------------------------------
global $OCSP_OBJ,$OCSP_CONF;
if (!isset
($OCSP_CONF['DEFAULT_WINDOW_WIDTH']) ||
!intval($OCSP_CONF['DEFAULT_WINDOW_WIDTH']))
$OCSP_CONF['DEFAULT_WINDOW_WIDTH']=
750;
if (!isset
($OCSP_CONF['DEFAULT_WINDOW_HEIGHT']) ||
!intval($OCSP_CONF['DEFAULT_WINDOW_HEIGHT']))
$OCSP_CONF['DEFAULT_WINDOW_HEIGHT']=
550;
$myTemplateVars['ALL']=
array();
ocsp_session_name ='".
$OCSP_OBJ['SESSION']->getName().
"';
ocsp_session_id ='".
$OCSP_OBJ['SESSION']->getId().
"';
ocsp_conf_winwidth ='".
$OCSP_CONF['DEFAULT_WINDOW_WIDTH'].
"';
ocsp_conf_winheight ='".
$OCSP_CONF['DEFAULT_WINDOW_WIDTH'].
"';
$this->addJsSrcLink($OCSP_CONF['JAVASCRIPTURL'].
"window.js");
$this->addJsSrcLink($OCSP_CONF['JAVASCRIPTURL'].
"base64.js");
$this->addJsSrcLink($OCSP_CONF['JAVASCRIPTURL'].
"forms.js");
/** -----------------------------------------------------
* getter & setter methods
* @param string $aType HTML Doctype
* appends a HTTP header field
* clears the HTTP header fields
* HTML head ----------------------------------------------------------------------------------
* @param boolean $http_equiv;
$this->myMetaTags[$name]=
array('CONTENT'=>
$content,'EQUIV'=>
$http_equiv);
* @param boolean $prepend add the code before already added code
function addJsCode($code,$prepend=
False,$debug=
False)
* includes a javascript code file into the header
* @param boolean $prepend add the code before already added code
function addJsFile($file,$prepend=
False,$debug=
False)
* @param string $onErrorCode
if (!empty($src)) // <pk-07-06-08>
* @param boolean $prepend add the code before already added code
function addCssCode($code,$prepend=
False,$debug=
False)
* adds a string to the <head>
* adds a file content to the <head>
* HTML body ----------------------------------------------------------------------------------
* sets the body onLoad event
* adds a js command to the onLoad of the body
* 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 boolean $prepend
* @param string $blockName
* @todo OCSP_HTMLPAGE::prepend in array mode
$blockName=
trim($blockName);
if (!empty($blockName) &&
(!empty($code)))
// check if content block is used as array
if (substr($blockName,-
2) ==
"[]")
$blockName =
substr($blockName,0,-
2);
// add the block to the blocklist
$this->myBodyContent[$blockName]=
"<!-- OCSP PAGEBLOCK ".
$blockName.
" -->\n";
* loads a html code file and adds it to the body by calling $this->addBodyContent()
* @param boolean $prepend
* @param string $blockName
* sets a template var if no block is set it's add to 'ALL' and used in all blocks
* to add an array set $varName to "" and $varValue to the array
* @param string $blockName
if (empty($blockName)) $blockName=
'ALL';
if (empty($varName) &&
is_array($varValue))
* parses a template var imediatly
* @param string $varValue
public function parseTemplateVar($varName,$varValue,$blockName=
'ALL',$debug=
False)
$arr_values =
array($varName =>
$varValue);
$this->myBodyContent[$str_key] =
$obj_tmpl->getValueParsedTemplate($arr_values);
$this->myBodyContent[$blockName] =
$obj_tmpl->getValueParsedTemplate($arr_values);
* @param string $blockName
if (empty($blockName)) $blockName=
'ALL';
* ajax -------------------------------------------------------------------
* sets the ajax object of the page
* @param &OCSP_AJAX $ajaxObj
* returns the ajax object of the page
/** -----------------------------------------------------
* returns the HTML head <head>...</head>
$str_ret.=
"\t<title>".
$this->myTitle.
"</title>\n";
$str_ret.=
"\t<title>".
$this->myProject->getTitle().
"</title>\n";
} else if (isset
($PROJECT['TITLE']) &&
(!empty($PROJECT['TITLE']))) {
$str_ret.=
"\t<title>".
$PROJECT['TITLE'].
"</title>\n";
foreach($this->myMetaTags as $str_name =>
$arr_tag)
$str_ret.=
"http-equiv=\"".
$str_name.
"\" ";
$str_ret.=
"name=\"".
$str_name.
"\" ";
$str_ret.=
"content=\"".
$arr_tag['CONTENT'].
"\"";
$str_ret.=
"\n<script type=\"text/javascript\">\n<!--\n";
$str_ret.=
"\n//-->\n</script>\n\n";
//$str_src=pcf_HTML_changeURI_GetValue($str_src,session_name(),session_id());
$str_ret.=
"\t<script language=\"JavaScript\" src=\"".
pcf_HTML_getEncodedURI($str_src).
"\" type=\"text/javascript\"></script>\n";
$str_ret.=
"\t<link rel=\"stylesheet\" href=\"".
$str_src.
"\" type=\"text/css\" />\n";
$str_ret.=
"\n<style type=\"text/css\">\n<!--\n/*<![CDATA[*/\n";
$str_ret.=
"\n-->\n/*]]*/\n</style>\n\n";
$str_ret.=
"\n<script type=\"text/javascript\">\n<!--\n";
$str_ret.=
"\n//-->\n</script>\n\n";
{ // add the ajax wrappers
<script defer type=\"text/javascript\" src=\"" .
OCSP_CONF::getInstance()->getValue('SYSTEMURL') .
"javascript/pngfix.js\"></script>
} else if (strstr($str_ret,'$')) {
* returns the page content
* this methods returns the whole content for each block the blocks are ordered by there first time set
* @version pk-08-01-10 avoid parsing the template twice to keep inline templates in forms for example
$str_blockContent=
"<!-- OCSP PAGEBLOCK ".
$str_blockName.
"[] -->\n";
$str_blockContent.=
$str_content.
"\n";
* returns the html code of the page
* @param boolean $closeBody
* @version pk-07-08-08 ankor ocsp_page_top added
function toHtml($closeBody=
TRUE)
$str_ret.=
"\n<body id=\"ocspBody\" ".
$this->myBodyTag;
$str_ret.=
"<div style=\"display:none\"><a name=\"ocsp_page_top\"></a></div>\n"; // <pk-07-08-08 />
* @param boolean $closeBody
* @param string $convertCharSet
* @version pk-07-12-14 gzip return
function display($closeBody=
true,$convertCharSet=
"UTF-8")
$b_buffer=
(sizeof($arr_ob) <
1);
if ($b_buffer) ob_start('ob_gzhandler');
//if (!empty($convertCharSet))
// echo mb_convert_encoding($str_output, "UTF-8");
} // end class OCSP_HTMLPAGE
Documentation generated on Thu, 08 Jan 2009 17:46:51 +0100 by phpDocumentor 1.4.0a2