Source for file DBMS_FIELD_SHOWTMPL.phpclass

Documentation is available at DBMS_FIELD_SHOWTMPL.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_SHOWTMPL.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   any
  8.   *
  9.   * @author     Peter Krebs <pitlinz@sourceforge.net>
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @since pk-07-10-20
  13.   *
  14.   ***/
  15.  
  16. /**
  17.   * requirements
  18.   */
  19. require_once dirname(__FILE__)."/DBMS_FIELD_LAYOUT.phpclass";
  20.  
  21.  
  22. /**
  23.   * Class DBMS_FIELD_SHOWTMPL
  24.   *
  25.   * @project    Open CSP-Management
  26.   * @package    dbms_field
  27.   * @category   any
  28.   *
  29.   * @author     Peter Krebs <pitlinz@sourceforge.net>
  30.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  31.   *
  32.   * @since pk-05-12-28
  33.   *
  34.   ***/
  35. class DBMS_FIELD_SHOWTMPL extends DBMS_FIELD {
  36.  
  37.     // ###########################################################
  38.     // OBJECT (CONST) VAR DECLARATION
  39.     // ###########################################################
  40.  
  41.     /**
  42.       * source file of the class
  43.       * @staticvar string $classSrcFile 
  44.       * @access protected
  45.       ***/
  46.     protected $classSrcFile=__FILE__;
  47.  
  48.     /**
  49.       * @var string $outputTemplate 
  50.       ***/
  51.     protected $outputTemplate="";
  52.  
  53.     /**
  54.       * @var string $listTemplate 
  55.       ***/
  56.     protected $listTemplate="";
  57.  
  58.  
  59.     // ###########################################################
  60.     // OBJECT SETTINGS METHODS
  61.     // ###########################################################
  62.  
  63.     /**
  64.       * @param boolean $debug 
  65.       * @global array $OCSP_CONF 
  66.       *
  67.       * @returns array
  68.       ***/
  69.     function editTbl_getFieldEditArr($debug=FALSE)
  70.     {
  71.         global $OCSP_CONF;
  72.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_SHOWTMPL::editTbl_getFieldEditArr","",0);
  73.  
  74.         if (empty($this->keyField)) $this->keyField=$this->myName// <pk-06-11-29 />
  75.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  76.  
  77.         $a_ret['COMMON']['FRM_OUTPUTTEMPLATE']=array(
  78.                 'FLDLAB'=>"<a href=\"#outputTemplate\" name=\"outputTemplate\" onClick=\"popup_window('".$OCSP_CONF['SYSTEMURL']."help/templatevars.html',500,400)\">Template</a>",
  79.                 'FLDVAL'=>"<textarea name=\"outputTemplate\" rows=\"3\" cols=\"30\">".$this->outputTemplate."</textarea>"
  80.             );
  81.  
  82.         $a_ret['LAYOUT']['FLD_SIZE']=NULL;      // unset parent field
  83.         $a_ret['LAYOUT']['FLD_INPUTADD']=NULL;  // unset parent field
  84.  
  85.         unset($a_ret['VALCHECKS']);
  86.  
  87.         unset($a_ret['SHOW']['FLD_ALLOW']);
  88.         $a_ret['SHOW']['FLD_SHOWMOD']=array(
  89.                 'FLDLAB'=>"Anzeigen in Modus",
  90.                 'FLDVAL'=>"<input name=\"SHOWREADONLY\" type=\"checkbox\" ".($this->hideReadOnly ? "" "checked")." value=\"1\" /> ReadOnly"
  91.             );
  92.  
  93.         $a_ret['LIST']['FRM_OUTPUTTEMPLATE']=array(
  94.                 'FLDLAB'=>"<a href=\"#listTemplate\" name=\"listTemplate\" onClick=\"popup_window('".$OCSP_CONF['SYSTEMURL']."help/templatevars.html',500,400)\">Template</a>",
  95.                 'FLDVAL'=>"<textarea name=\"listTemplate\" rows=\"3\" cols=\"30\">".$this->listTemplate."</textarea>"
  96.             );
  97.  
  98.  
  99.         return $a_ret;
  100.     }
  101.     
  102.  
  103.     /**
  104.       * save the filed definition form
  105.       *
  106.       * @returns boolean
  107.       *
  108.       ***/
  109.     function save({
  110.         $b_ret=parent::save();
  111.         $this->outputTemplate=(isset($_POST['outputTemplate']$_POST['outputTemplate'"");
  112.         $this->listTemplate  =(isset($_POST['listTemplate']$_POST['listTemplate'"");
  113.  
  114.         $this->enableNew =FALSE;
  115.         $this->enableEdit=FALSE;
  116.         $this->enableEditIfEmpty=FALSE;
  117.         $this->enableCopy=FALSE;
  118.  
  119.         $this->isSearchable=FALSE;
  120.  
  121.         return $b_ret;
  122.     }
  123.  
  124.     // ###########################################################
  125.     // OBJECT DATA METHODS
  126.     // ###########################################################
  127.  
  128.  
  129.     // ###########################################################
  130.     // OBJECT HTML FORM METHODS
  131.     // ###########################################################
  132.  
  133.     /**
  134.       * returns the html representation of the field
  135.       *
  136.       * @param mixed $aValue (the value)
  137.       * @param string $arrName (name of the global array holding data values)
  138.       * @param bool $debug (show debug info)
  139.       *
  140.       * @return mixed   the html representation of the field
  141.       *
  142.       * @requires pcf_templates.phpinc
  143.       *
  144.       ***/
  145.     function getScreenValue($aValue=NULL,$arrName="DBVAL",$debug=FALSE)
  146.     {
  147.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_SHOWTMPL::getScreenValue()",$this->getKey());
  148.         $this->myDataArrName=$arrName;
  149.         global ${$this->myDataArrName};
  150.  
  151.         if ($debugechoDebugLine(__FILE__,__LINE__,"Template: ".$this->outputTemplate."<pre>".print_r(${$this->myDataArrName},TRUE)."</pre>");
  152.  
  153.         require_once __OCSP_PHPINCPATH__."common"._OCSP_DIRSEP_."pcf_templates.phpinc";
  154.         return pcf_tmpl_parse($this->outputTemplate,${$this->myDataArrName});
  155.     }
  156.  
  157.     /**
  158.       * returns the html representation of the field in a list (table col)
  159.       *
  160.       * @param mixed $aValue (the value)
  161.       * @param string $arrName (name of the global array holding data values)
  162.       * @param bool $debug (show debug info)
  163.       *
  164.       * @return mixed the html representation of the field
  165.       *
  166.       * @requires pcf_templates.phpinc
  167.       *
  168.       **/
  169.     function getListValue($aValue=NULL,$arrName="DBVAL",$debug=FALSE)
  170.     {
  171.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_SHOWTMPL::getListValue()",$this->getKey());
  172.         $this->myDataArrName=$arrName;
  173.         global ${$this->myDataArrName};
  174.        
  175.         if (!empty($this->listTemplate))
  176.         {
  177.             require_once __OCSP_PHPINCPATH__."common"._OCSP_DIRSEP_."pcf_templates.phpinc";
  178.             return "<pre>".print_r(${$this->myDataArrName},TRUE)."</pre><hr />".pcf_tmpl_parse($this->listTemplate,${$this->myDataArrName});
  179.         }
  180.         return $this->getScreenValue($aValue,$arrName,$debug);
  181.     }
  182.  
  183.     // ###########################################################
  184.     // SEARCH FORM METHODS
  185.     // ###########################################################
  186.  
  187.  
  188.     // ###########################################################
  189.     // OBJECT HTML FORM METHODS
  190.     // ###########################################################
  191.  
  192.  
  193.     // ###########################################################
  194.     // OBJECT VALUE CHECK METHODS
  195.     // ###########################################################
  196.  
  197.  
  198.  
  199. // end class DBMS_FIELD_SHOWTMPL
  200. ?>

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