Source for file CMS_IFRAME_PAGE.phpclass

Documentation is available at CMS_IFRAME_PAGE.phpclass

  1. <?php
  2. /**
  3.   * Class file CMS_IFRAME_PAGE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    cms
  7.   *
  8.   * @author     Peter Krebs <p.krebs@lvus.at>
  9.   * @copyright  (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   ***/
  13.  
  14. require_once $GLOBALS['DEFAULTCONFPATH']."cms.conf.phpinc";
  15. require_once $GLOBALS['CMS']['PHPINCPATH']."page/CMS_PAGE_V2.phpclass";
  16.  
  17. /**
  18.   * class to handel PAGES with php code included
  19.   *
  20.   * NOTE: if you use a $PREPEND_INC make sure
  21.   * it is included by your index.php script by either
  22.   * calling inc_prepInc or by calling getHead which
  23.   * includes the file if not done before
  24.   *
  25.   * @project    Open CSP-Management
  26.   * @package    cms
  27.   *
  28.   * @author     Peter Krebs <p.krebs@lvus.at>
  29.   * @copyright  (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  30.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  31.   *
  32.   * @version    pk-04-11-17
  33.   * @since      pk-04-08-10
  34.   *
  35.   * @todo APPEND_INC
  36.   *
  37.   ***/
  38. class CMS_IFRAME_PAGE extends CMS_PAGE_V2 {
  39.     /*
  40.      * @staticvar string $myClassName   name of the class
  41.      **/
  42.      var $myClassName    = "CMS_IFRAME_PAGE";
  43.  
  44.     /**
  45.       * @var string $includeRoot 
  46.       ***/
  47.     var $includeRoot="intranet/files/";
  48.  
  49.     /**
  50.       * @var string $prepeandInc 
  51.       ***/
  52.     var $PREPEND_INC = "";
  53.  
  54.      /**
  55.        * @var string $programmInc 
  56.        ***/
  57.     var $FILE_INC = "";
  58.  
  59.      /**
  60.        * @var string $appendInc 
  61.        */
  62.     var $APPEND_INC = "";
  63.  
  64.     /**
  65.       * returns a array of variables used by the page object
  66.       *
  67.       * array[varName]=array(
  68.       *     [TYPE]          datatype
  69.       *     [FLDCLASS]      name of DBMS_FIELD* class
  70.       *     [CLASSVALS]     array of values of [FLDCLASS]
  71.       *
  72.       *
  73.       *
  74.       * @returns array
  75.       *
  76.       * @since pk-04-08-10
  77.       *
  78.       ***/
  79.     function getObjVarDef({
  80.         $retArr=parent::getObjVarDef();
  81.         require_once $GLOBALS['OCSP']['DBMSFLD_PATH']."DBMS_FIELD_FILESELECTLIST.phpclass";
  82.         $retArr["FILE_INC"]array(
  83.                 "TYPE"      => "string",
  84.                 "FLDCLASS"  => "DBMS_FIELD_FILESELECTLIST",
  85.                 "CLASSVALS" =>array(
  86.                     "label"         => "Datei",
  87.                     "allowNull"     => TRUE,
  88.                     "isSearchable"  => TRUE,
  89.                     "showInList"    => FALSE,
  90.                     "toolTip"       => "Include File im Content Bereich",
  91.                     "rootDir"       => $this->includeRoot,
  92.                     "defaultDir"    => $this->includeRoot,
  93.                     "allow_mkdir"   => TRUE,
  94.                     "allow_upload"  => TRUE,
  95.                     "editorUrl"     => ""
  96.                 )
  97.             );
  98. /* not implemented
  99.         $retArr["APPEND_INC"]= array(
  100.                 "TYPE"      => "string",
  101.                 "FLDCLASS"  => "DBMS_FIELD_FILESELECTLIST",
  102.                 "CLASSVALS" =>array(
  103.                     "label"         => "Append Include",
  104.                     "allowNull"     => TRUE,
  105.                     "isSearchable"  => TRUE,
  106.                     "showInList"    => FALSE,
  107.                     "toolTip"       => "Include File nach </html>",
  108.                     "rootDir"       => $this->includeRoot,
  109.                     "defaultDir"    => $this->includeRoot."pages/",
  110.                     "allow_mkdir"   => TRUE,
  111.                     "allow_upload"  => TRUE
  112.                 )
  113.             );
  114. */
  115.         return $retArr;
  116.     }
  117.  
  118.  
  119.     /**
  120.       * unset some object vars to not store to the database
  121.       * and then calls the parent function
  122.       *
  123.       * @param string $gDBIDX GLOBAL ARRAY INDEX OF DB OBJECT
  124.       * @param bool   $debug  SHOW DEBUG INFO
  125.       *
  126.       * @return mixed 
  127.       *
  128.       * @since pk-04-11-17
  129.       *
  130.       ***/
  131.     function dbSave($gDBIDX="USRDB",$debug=FALSE{
  132.         unset($this->prepIncDone);
  133.         return parent::dbSave($gDBIDX,$debug);
  134.     }
  135.  
  136.     // #########################################
  137.  
  138.  
  139.     /**
  140.       * shows the page in preview mode
  141.       *
  142.       * @param int  $mdoe 
  143.       * @param bool $debug 
  144.       *
  145.       * @version pk-04-11-17
  146.       *
  147.       ***/
  148.     function preview($mode=0,$debug=FALSE{
  149.         if ($debugecho "<p><b>CMS_IFRAME_PAGE::preview($mode,$debug)</b> (".get_class($this).")</p>";
  150.         if (!is_object($this->myTmpl)) {
  151.             if (!($this->loadTemplate($debug))) {
  152.                 $ERR="TEMPLATE_NOT_FOUND ".$query;
  153.                 include $GLOBALS['PROJECT']['PHPINCPATH']."io/errors.phpinc";
  154.                 die();
  155.             }
  156.         }
  157.         $this->inc_prepInc($debug)/* <pk-04-11-17 /> */
  158.  
  159.         ?>
  160.             <!doctype public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/TR/html4/loose.dtd">
  161.             <html>
  162.             <head>
  163.                 <title><?php echo $this->{$this->colPrevix."TITLE"}?></title>
  164.                 <link type="text/css" rel="stylesheet" href="/cms/defaultStyles.php">
  165.                 <?php if intval($this->STY_ID)) ?>
  166.                     <link type="text/css" rel="stylesheet" href="/cms/styles.php?STY_ID=<?php echo $this->STY_ID?>&PROJ_ID=<?php echo $this->getProjId();?>>
  167.                 <?php }
  168.                 echo $this->myTmpl->getMetaTag()."\n";
  169.                 echo $this->myTmpl->getCSSTag()."\n";
  170.                 echo $this->myTmpl->getJavaScriptTag()."\n";
  171.                 ?>
  172.             </head>
  173.         <?php
  174.         echo $this->myTmpl->getBodyTag();
  175.         echo $this->myTmpl->getHeadLineTag();
  176.  
  177.         echo $this->{$this->colPrevix."HEADER"};
  178.  
  179.             echo $this->getChapter(CHAPTER_SHOWMODE_ALLWAYS_TOP,$debug);
  180.             if (!empty($this->PROGRAMM_INC)) {
  181.                 if (file_exists($GLOBALS['PROJECT']['PATH'].$this->includeRoot.$this->PROGRAMM_INC)) {
  182.                     if ($debugecho "<p>Programm Include:</p>";
  183.                     include $GLOBALS['PROJECT']['PATH'].$this->includeRoot.$this->PROGRAMM_INC;
  184.                 else if (file_exists($GLOBALS['PROJECT']['PATH'].$this->PROGRAMM_INC)) {
  185.                     if ($debugecho "<p>Programm Include:</p>";
  186.                     include $GLOBALS['PROJECT']['PATH'].$this->PROGRAMM_INC;
  187.                 else {
  188.                     if ($debugecho "<p>Programm Include: <b>not found</b></b>";
  189.                 }
  190.             }
  191.             echo $this->getChapter(CHAPTER_SHOWMODE_ALLWAYS_BOTTOM,$debug);
  192.         /*        
  193.         if ($debug) echo "<p>Chapter Query: ".$this->getChapQuery(TRUE,FALSE,TRUE,FALSE,"",$debug)."</p>";
  194.         if ($cursor=$GLOBALS[$this->get_gDBIDX()]->query($this->getChapQuery())) {
  195.             while($row=$cursor->fetchArray()) {
  196.                 if (!is_object($this->chaTmplArr[$row[$this->ctmplFldPrevix."ID"]])) {
  197.                     $idx=$row[$this->ctmplFldPrevix."ID"];
  198.                     $cmd="\$this->chaTmplArr[".$idx."] = new ".$this->ctmplClass."();";
  199.                     eval ($cmd);
  200.  
  201.                     $this->chaTmplArr[$idx]->setProjId($this->getProjId());
  202.                     $this->chaTmplArr[$idx]->setPTMPId($this->getPTMPId());
  203.                     $this->chaTmplArr[$idx]->setId($idx);
  204.                     $this->chaTmplArr[$idx]->dbPopulate($debug);
  205.                 }
  206.  
  207.                 echo $this->chaTmplArr[$row[$this->ctmplFldPrevix."ID"]]->getTag(unserialize($row[$this->chapPrevix.'FIELDS']));
  208.  
  209.             }
  210.         }
  211.         */
  212.         echo $this->{$this->colPrevix."FEETER"};
  213.         echo $this->myTmpl->getFeeterTag();
  214.         ?>
  215.             </body>
  216.             </html>
  217.         <?php
  218.  
  219.     }
  220.  
  221.     /**
  222.       * checks if we have a prepend inc file
  223.       * and includes it if exists
  224.       *
  225.       * @param boolean $debug
  226.       *
  227.       * @returns boolean
  228.       *
  229.       * @since pk-04-11-17
  230.       *
  231.       **/
  232.     function inc_prepInc($debug=FALSE{
  233.         if (!empty($this->PREPEND_INC)) {
  234.             if (file_exists($GLOBALS['PROJECT']['PATH'].$this->includeRoot.$this->PREPEND_INC)) {
  235.                 if ($debugecho "<p>Prepend Include:</p>";
  236.                 include $GLOBALS['PROJECT']['PATH'].$this->includeRoot.$this->PREPEND_INC;
  237.                 $this->prepIncDone=TRUE;
  238.             else if (file_exists($GLOBALS['PROJECT']['PATH'].$this->PREPEND_INC)) {
  239.                 if ($debugecho "<p>Prepend Include:</p>";
  240.                 include $GLOBALS['PROJECT']['PATH'].$this->PREPEND_INC;
  241.                 $this->prepIncDone=TRUE;
  242.             else {
  243.                 if ($debugecho "<p>Prepend Include: <b>not found</b></b>";
  244.             }
  245.         }
  246.  
  247.         return $this->prepIncDone;
  248.     }
  249.  
  250.     /**
  251.       * returns the html head
  252.       * and includes $this->PREPEND_INC if file exists
  253.       *
  254.       *
  255.       * @param boolean $withMenu
  256.       * @param boolean $debug
  257.       *
  258.       * @returns string
  259.       *
  260.       * @version pk-04-11-17
  261.       *
  262.       **/
  263.     function getHead($withMenu=TRUE,$debug=FALSE{
  264.         if ($debugecho "<p><b>CMS_IFRAME_PAGE::getHead($withMenu,...)</b> (".get_class($this).")</p>";
  265.         /* <pk-04-11-17> */
  266.         if (!$this->prepIncDone{
  267.             $this->inc_prepInc($debug);
  268.         }
  269.         /* </pk-04-11-17> */
  270.         return parent::getHead($withMenu,$debug);
  271.     }
  272.  
  273.  
  274.     /**
  275.       * echos the content of the page
  276.       *
  277.       * @param int $chaShowMode
  278.       * @param boolean $debug
  279.       *
  280.       **/
  281.     function content($chaShowMode=0,$debug=FALSE{
  282.         if (!intval($chaShowMode)) {
  283.             $debug true;
  284.             echo $this->getChapter(CHAPTER_SHOWMODE_ALLWAYS_TOP,$debug);
  285.             if (!empty($this->FILE_INC)) {
  286.                 if (file_exists($GLOBALS['PROJECT']['PATH'].$this->includeRoot.$this->FILE_INC)) {
  287.                     if ($debugecho "<p>File Include:</p>";
  288.                     echo "<IFRAME SRC=\"".$GLOBALS['PROJECT']['PATH'].$this->includeRoot.$this->FILE_INC."\"</IFRAME>";
  289.                 else if (file_exists($GLOBALS['PROJECT']['PATH'].$this->FILE_INC)) {
  290.                     if ($debugecho "<p>File Include:</p>";
  291.                     echo "<IFRAME SRC=\"".$GLOBALS['PROJECT']['PATH'].$this->FILE_INC."\"</IFRAME>";
  292.                 else {
  293.                     if ($debugecho "<p>Programm Include: <b>not found</b></b>";
  294.                 }
  295.             }
  296.             echo $this->getChapter(CHAPTER_SHOWMODE_ALLWAYS_BOTTOM,$debug);
  297.         else {
  298.             echo $this->getChapter($chaShowMode,$debug);
  299.         }
  300.     }
  301.  
  302. }
  303.  
  304.  
  305. ?>

Documentation generated on Thu, 08 Jan 2009 17:38:54 +0100 by phpDocumentor 1.4.0a2