l3.cas-d-astre/includes/libpage.inc.php

129 lines
2.5 KiB
PHP
Raw Normal View History

2009-05-01 08:39:36 +00:00
<?php
if (!defined("LIBPAGE_INC")){
define(LIBPAGE_INC,1);
class Page{
var $_title;
var $_script;
var $_currentHeader;
var $_header;
var $_currentScript;
var $_content;
var $_referer;
var $_basedir;
function Page($referer=""){
$this->_referer=$referer;
$this->_basedir=dirname($referer);
$this->_script=array();
$this->_header=array();
$this->_currentScript=0;
$this->_currentHeader=0;
// initialiser les variables d'inclusion
// lancer la session
session_start();
// v<>rifier le login
}
function logCheck($authorizedLevel=0){
include("logcheck.php");
/* TODO: pr<70>voir un niveau de check */
}
function setTitle($title){
}
function startHeader(){
ob_start();
}
function endHeader(){
$this->_header[$this->_currentHeader]=ob_get_contents();
$this->_currentHeader=$this->_currentHeader+1;
ob_end_clean();
}
function startScript(){
//TODO: faire en sorte de v<>rifier l'ordre des balises
ob_start();
print "<!-- Hide script\n"
."//<![CDATA[";
}
function endScript(){
//TODO: faire en sorte de v<>rifier l'ordre des balises
print "\n//]]> End script hiding -->\n";
$this->_script[$this->_currentScript]=ob_get_contents();
$this->_currentScript=$this->_currentScript+1;
ob_end_clean();
}
function startContent(){
//TODO: faire en sorte de v<>rifier l'ordre des balises
ob_start();
}
function endContent(){
//TODO: faire en sorte de v<>rifier l'ordre des balises
$this->_content=ob_get_contents();
ob_end_clean();
}
function toHTML(){
$htmlCode="";
/* Start of page */
ob_start();
include("header.inc.php");
$htmlCode.=ob_get_contents();
ob_end_clean();
/* Headers */
for($i=0;$i<$this->_currentHeader;$i++) {
$htmlCode.=$this->_header[$i];
}
/* Javascript */
$htmlCode.="<script language=\"JavaScript\" "
."type=\"text/javascript\">\n";
for($i=0;$i<$this->_currentScript;$i++) {
$htmlCode.="//script $i\n";
$htmlCode.=$this->_script[$i];
}
$htmlCode.="</script>\n";
/* Start of page */
ob_start();
include("bodystart.inc.php");
$htmlCode.=ob_get_contents();
ob_end_clean();
/* Content of page */
$htmlCode.=$this->_content;
/* Footer */
ob_start();
include("footer.inc.php");
$htmlCode.=ob_get_contents();
ob_end_clean();
/* End of page */
ob_start();
include("bodyend.inc.php");
$htmlCode.=ob_get_contents();
ob_end_clean();
return $htmlCode;
}
} // end class
} // end ifdef
?>