Source for file CMS_LIST_PAGE.phpclass

Documentation is available at CMS_LIST_PAGE.phpclass

  1. <?php
  2. /**
  3.   * Class file CMS_LIST_PAGE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    cms
  7.   * @category   page
  8.   *
  9.   * @author     Peter Krebs <p.krebs@lvus.at>
  10.   * @copyright  (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  11.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  12.   *
  13.   ***/
  14.  
  15. require_once $GLOBALS['DEFAULTCONFPATH']."cms.conf.phpinc";
  16. require_once $GLOBALS['CMS']['PHPINCPATH']."page/CMS_PAGE_V2.phpclass";
  17.  
  18. /**
  19.   * class CMS_LIST_PAGE
  20.   *
  21.   *
  22.   * @project    Open CSP-Management
  23.   * @package    cms
  24.   * @category   page
  25.   *
  26.   * @author     Peter Krebs <p.krebs@lvus.at>
  27.   * @copyright  (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  28.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  29.   *
  30.   * @since      pk-04-09-08
  31.   * @version    pk-04-12-20
  32.   *
  33.   ***/
  34. class CMS_LIST_PAGE extends CMS_PAGE_V2 {
  35.     /*
  36.      * @var string $myClassName   name of the class
  37.      **/
  38.      var $myClassName    = "CMS_LIST_PAGE";
  39.  
  40.     /**
  41.       * @var string $MYSQLSTMT 
  42.       ***/
  43.     var $MYQUERY="";
  44.  
  45.     /**
  46.       * @var string $TMPL_LSTSTART 
  47.       ***/
  48.     var $TMPL_LSTSTART="";
  49.  
  50.     /**
  51.       * @var string $TMPL_LST 
  52.       ***/
  53.     var $TMPL_LST="";
  54.  
  55.     /**
  56.       * @var string $TMPL_LSTEND 
  57.       ***/
  58.     var $TMPL_LSTEND="";
  59.  
  60.     /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  61.     /*                                                                 */
  62.     /* _______________________ DATA FUNCTIONS  _______________________ */
  63.     /*                                                                 */
  64.     /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  65.  
  66.  
  67.     /**
  68.       * returns a array of variables used by the page object
  69.       *
  70.       * array[varName]=array(
  71.       *     [TYPE]          datatype
  72.       *     [FLDCLASS]      name of DBMS_FIELD* class
  73.       *     [CLASSVALS]     array of values of [FLDCLASS]
  74.       *
  75.       *
  76.       *
  77.       * @returns array
  78.       *
  79.       * @since pk-04-08-10
  80.       *
  81.       ***/
  82.     function getObjVarDef({
  83.         $retArr=parent::getObjVarDef();
  84.  
  85.         require_once $GLOBALS['OCSP']['DBMSFLD_PATH']."DBMS_FIELD_HEADLINE.phpclass";
  86.         $retArr['_MYLISTHAEDLINE']=array(
  87.             "TYPE"      => "layout",
  88.             "FLDCLASS"  => "DBMS_FIELD_HEADLINE",
  89.                 "CLASSVALS" =>array(
  90.                     "label"         => "<b>Liste</b>"
  91.             )
  92.         );
  93.  
  94.         require_once $GLOBALS['OCSP']['DBMSFLD_PATH']."DBMS_FIELD_SQLSTATEMENT.phpclass";
  95.         $retArr['MYQUERY']array(
  96.             "TYPE"      => "blob",
  97.             "FLDCLASS"  => "DBMS_FIELD_SQLSTATEMENT",
  98.             "CLASSVALS" =>array(
  99.                 "label"             => "SQL-Select",
  100.                 "allowNull"         => FALSE,
  101.                 "isSearchable"      => FALSE,
  102.                 "showInList"        => FALSE
  103.             )
  104.         );
  105.  
  106.         require_once $GLOBALS['OCSP']['DBMSFLD_PATH']."DBMS_FIELD_HTMLSOURCE.phpclass";
  107.         $retArr['TMPL_LSTSTART']array(
  108.             "TYPE"      => "blob",
  109.             "FLDCLASS"  => "DBMS_FIELD_HTMLSOURCE",
  110.             "CLASSVALS" =>array(
  111.                 "label"         => "Liste Start",
  112.                 "allowNull"     => TRUE,
  113.                 "isSearchable"  => FALSE,
  114.                 "showInList"    => FALSE,
  115.                 "rows"          => 3
  116.             )
  117.         );
  118.  
  119.         $retArr['TMPL_LST']array(
  120.             "TYPE"      => "blob",
  121.             "FLDCLASS"  => "DBMS_FIELD_HTMLSOURCE",
  122.             "CLASSVALS" =>array(
  123.                 "label"         => "Listen Element",
  124.                 "allowNull"     => TRUE,
  125.                 "isSearchable"  => FALSE,
  126.                 "showInList"    => FALSE,
  127.                 "rows"          => 5,
  128.                 "myHelpUrl"     => $GLOBALS['PROJECT']['SYSTEMURL']."/help/templatevars.html"
  129.             )
  130.         );
  131.  
  132.         $retArr['TMPL_LSTEND']array(
  133.             "TYPE"      => "blob",
  134.             "FLDCLASS"  => "DBMS_FIELD_HTMLSOURCE",
  135.             "CLASSVALS" =>array(
  136.                 "label"         => "Listen Ende",
  137.                 "allowNull"     => TRUE,
  138.                 "isSearchable"  => FALSE,
  139.                 "showInList"    => FALSE,
  140.                 "rows"          => 3
  141.             )
  142.         );
  143.  
  144.  
  145.         require_once $GLOBALS['OCSP']['DBMSFLD_PATH']."DBMS_FIELD_INT.phpclass";
  146.         $retArr['LST_LIMIT']=array(
  147.             "TYPE"      => "int",
  148.             "FLDCLASS"  => "DBMS_FIELD_INT",
  149.             "CLASSVALS" =>array(
  150.                 "label"         => "Limit (Datensätze/Seite)",
  151.                 "allowNull"     => TRUE,
  152.                 "isSearchable"  => FALSE,
  153.                 "showInList"    => FALSE,
  154.                 "size"          => 4,
  155.                 "defaultValue"  => 20
  156.             )
  157.         );
  158.  
  159.         return $retArr;
  160.     }
  161.  
  162.     /**
  163.       * loads the form object
  164.       *
  165.       *
  166.       * @returns DBMS_FORM
  167.       *
  168.       ***/
  169.     function loadFrmObj($debug=FALSE{
  170.         if ($debug{
  171.             echo "<p><b>CMS_LIST_PAGE::loadFrmObj(...)</b> (".get_class($this).")</p>";
  172.             echo "<blockquote><p>ID: ".$this->MYFORM."</p>";
  173.             echo "DBMS_FORMS:<pre>".pcf_print_r($GLOBALS['DBMS_FORMS'][$this->MYFORM],TRUE,3)."</pre>";
  174.             echo "</blockquote>";
  175.         }
  176.  
  177.         if (!($this->pageFrmObj=&DBMS_form_loadId($this->MYFORM,$debug))) {
  178.             echo "ERROR FORM ID ".$this->MYFORM." NOT FOUND";
  179.             return FALSE;
  180.         }
  181.         return TRUE;
  182.     }
  183.  
  184.  
  185.  
  186.  
  187.  
  188.     /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  189.     /*                                                                 */
  190.     /* _______________________ HEADER ________________________________ */
  191.     /*                                                                 */
  192.     /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  193.  
  194.     /**
  195.       * returns the java tag
  196.       *
  197.       * @returns string
  198.       *
  199.       * @since pk-04-08-02
  200.       *
  201.       ***/
  202.     function getJavaHeaderTag($debug=FALSE{
  203.         if ($debugecho "<p><b>CMS_LIST_PAGE::getJavaHeaderTag(...)</b> (".get_class($this).")</p><blockquote>";
  204.  
  205.         $tag=parent::getJavaHeaderTag($debug);
  206.  
  207.         if (!strstr($tag,$GLOBALS['PROJECT']['JAVASCRIPTURL']."window.js")) {
  208.             $tag .="\t<script language=\"JavaScript\" src=\"".$GLOBALS['PROJECT']['JAVASCRIPTURL']."window.js\" type=\"text/javascript\"></script>\n";
  209.         }
  210.         if (!strstr($tag,$GLOBALS['PROJECT']['JAVASCRIPTURL']."forms.js")) {
  211.             $tag .="\t<script language=\"JavaScript\" src=\"".$GLOBALS['PROJECT']['JAVASCRIPTURL']."forms.js\"  type=\"text/javascript\"></script>\n";
  212.         }
  213.  
  214.         if ($debugecho "</blockquote>";
  215.         return $tag;
  216.     }
  217.  
  218.     /* _______________________ BODY _______________________________ */
  219.  
  220.     /**
  221.       * returns the html-code for the form
  222.       *
  223.       * @param boolean $debug 
  224.       *
  225.       * @returns string
  226.       *
  227.       * @version pk-04-12-20
  228.       *
  229.       ***/
  230.     function getList($debug=FALSE{
  231.         if ($debug{
  232.             echo "<p><b>CMS_LIST_PAGE::getList(...)</b> (".get_class($this).")</p>";
  233.             echo "<blockquote>";
  234.             $ovArr=$this->getObjVarDef();
  235.             foreach($ovArr as $key => $valArr{
  236.                 echo "<p>$key:<br>".htmlspecialchars($this->$key)."</p>";
  237.             }
  238.             // echo "PAGE OBJECT:<pre>".pcf_print_r($this,TRUE,3)."</pre>";
  239.            if ($debug)  echo "</blockqote>";
  240.         }
  241.         require_once $GLOBALS['PROJECT']['PHPINCPATH']."common/pcf_templates.phpinc";
  242.  
  243.         $tag $this->TMPL_LSTSTART;
  244.  
  245.         $query="SELECT ".$this->MYQUERY;
  246.         if ($debugecho "<p>Query$query</p><blockquote>";
  247.         if ($cursor=$GLOBALS['USRDB']->query($query)) {
  248.             $count=0;
  249.             while($row=$cursor->fetchArrayFld()) {
  250.                 if ($debugecho "<pre>".print_r($row,TRUE)."</pre>";
  251.                 $tag.=pcf_tmpl_parse($this->TMPL_LST,$row);
  252.                 $count++;
  253.             }
  254.         else {    /* <pk-04-12-20 >*/
  255.             echo "<!-- ERROR IN QUERY$query -->\n";
  256.         /* </pk-04-12-20 >*/
  257.         if ($debugecho "</blockquote>";
  258.  
  259.         $tag.= $this->TMPL_LSTEND;
  260.         return $tag;
  261.     }
  262.     /**
  263.       * echos the content of the page
  264.       *
  265.       * @param int $chaShowMode 
  266.       * @param boolean $debug 
  267.       *
  268.       ***/
  269.     function content($chaShowMode=0,$debug=FALSE{
  270.         if ($debugechoDebugMethod(__FILE__,get_class($this),"CMS_LIST_PAGE::content()");
  271.         if (!intval($chaShowMode)) {
  272.             echo $this->getChapter(CHAPTER_SHOWMODE_ALLWAYS_TOP,$debug);
  273.             echo $this->getList($debug);
  274.             echo $this->getChapter(CHAPTER_SHOWMODE_ALLWAYS_BOTTOM,$debug);
  275.         else {
  276.             echo $this->getChapter($chaShowMode,$debug);
  277.         }
  278.     }
  279. }
  280.  
  281. ?>

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