Source for file DBMS_FIELD_TEMPLATE.phpclass

Documentation is available at DBMS_FIELD_TEMPLATE.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_TEMPLATE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   layout
  8.   *
  9.   * @author     Peter Krebs <opencsp@amicas.at>
  10.   * @copyright  &copy; 2006 by Amicas.at
  11.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  12.   *
  13.   ***/
  14.  
  15. if (empty($GLOBALS['OCSP']['PHPFORMPATH'])) $GLOBALS['OCSP']['PHPFORMPATH']=dirname(__FILE__)."/";
  16.  
  17. if (!class_exists("DBMS_FIELD")) {
  18.     require_once dirname(__FILE__)."/DBMS_FIELD.phpclass";
  19. }
  20.  
  21. /**
  22.   * Class DBMS_FIELD_TEMPLATE
  23.   *
  24.   * @project    Open CSP-Management
  25.   * @package    dbms_field
  26.   * @category   layout
  27.   *
  28.   * @author     Peter Krebs <opencsp@amicas.at>
  29.   * @copyright  &copy; 2006 by Amicas.at
  30.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  31.   *
  32.   * @since pk-06-06-08
  33.   *
  34.   ***/
  35. class DBMS_FIELD_TEMPLATE extends DBMS_FIELD {
  36.  
  37.     // ###########################################################
  38.     // OBJECT (CONST) VAR DECLARATION
  39.     // ###########################################################
  40.  
  41.     var $className       = "Template";
  42.  
  43.     /**
  44.       * @var string value as template
  45.       ***/
  46.     var $valTmpl        = "";
  47.  
  48.     /**
  49.       * source file of the class
  50.       *
  51.       * @var string $classSrcFile 
  52.       * @since pk-05-01-20
  53.       ***/
  54.     var $classSrcFile=__FILE__;
  55.  
  56.     // ###########################################################
  57.     // OBJECT SETTINGS METHODS
  58.     // ###########################################################
  59.  
  60.     // ###########################################################
  61.     // FIELD DEFINITION DATA METHODS
  62.     // ###########################################################
  63.  
  64.     /**
  65.       * returns an array of field to bie shown in the edit form
  66.       * by using editTbl_echoForm
  67.       *
  68.       * the array is in the form:
  69.       *
  70.       * <code>
  71.       * [_sectionName_]
  72.       *      [TITLE] -> string
  73.       *      [_rowName_]
  74.       *         [FLDLAB]  (complete html code with <td></td>)
  75.       *         [FLDVAL] (complete html code with <td></td>)
  76.       * </code>
  77.       *
  78.       * @param boolean $debug 
  79.       *
  80.       * @returns array
  81.       *
  82.       ***/
  83.     function editTbl_getFieldEditArr($debug=FALSE
  84.     {
  85.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD::editTbl_getFieldEditArr","",0);
  86.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  87.  
  88.         $a_ret['FLDTMPL']=array(
  89.             'TITLE'         => 'Anzeige Template',
  90.             'FLD_valTmpl'   => array(
  91.                 'FLDLAB'    => 'Anzeige Template <a href="'.$GLOBALS['OCSP']['SYSTEMURL']."help/templatevars.html".'" target="_blank">?</a>',
  92.                 'FLDVAL'    => "<textarea name=\"valTmpl\" rows=\"3\" cols=\"30\">".htmlspecialchars($this->valTmpl)."</textarea>"
  93.             )
  94.         );
  95.     }
  96.  
  97.     /**
  98.       * echos the filed definition form
  99.       **/
  100.  
  101.     function editTblForm($showSize=FALSE,$showNull=TRUE,$showValueList=FALSE{
  102.         $a_FieldEditArr=$this->editTbl_getFieldEditArr($debug);
  103.         $this->editTbl_echoForm($a_FieldEditArr,$debug);
  104.     }
  105.  
  106.     /**
  107.       * save the filed definition form
  108.       *
  109.       * @return boolean (always true)
  110.       *
  111.       ***/
  112.     function save({
  113.         $this->fldDebug        =($_POST['fldDebug'== TRUE FALSE)/* <pk-04-06-02> fldDebug added */
  114.         $this->label           =$_POST['label'];
  115.         $this->toolTip         ="";
  116.         $this->isSearchable    =FALSE;
  117.         $this->showInList      =(intval($_POST['showInList'])  FALSE TRUE);
  118.         $this->enableNew       =FALSE;
  119.         $this->enableEdit      =FALSE;
  120.         $this->enableCopy      =FALSE;
  121.         $this->hideNew         =(intval($_POST['hideNew'])  TRUE FALSE);
  122.         $this->hideEdit        =(intval($_POST['hideEdit']TRUE FALSE);
  123.         $this->hideCopy        =(intval($_POST['hideCopy']TRUE FALSE);
  124.         $this->size            =0;
  125.         $this->maxlength       =0;
  126.         $this->defaultValue    ="";
  127.         $this->addTag          ="";
  128.         $this->labeltd_add     =$_POST['labeltd_add'];
  129.         $this->labelcol_hide   =($_POST['labelcol_hide'== TRUE FALSE);
  130.         $this->fieldtd_add     =$_POST['fieldtd_add'];
  131.         $this->allowNull       =TRUE;
  132.         $this->nullErrMsg      ="";
  133.         $this->myHelpUrl       ="";
  134.         $this->valTmpl        =$_POST['valTmpl'];
  135.         return TRUE;
  136.     }
  137.  
  138.     // ###########################################################
  139.     // OBJECT DATA METHODS
  140.     // ###########################################################
  141.  
  142.  
  143.     // ###########################################################
  144.     // OBJECT HTML FORM METHODS
  145.     // ###########################################################
  146.  
  147.     /**
  148.       * returns the html code for the info text
  149.       *
  150.       * @param int $mode 
  151.       * @param array $aValue    if $aValue is an array $valTmpl is parsed with $aValue alse with ${$arrName}
  152.       * @param boolean $debug 
  153.       *
  154.       * @returns string
  155.       *
  156.       * @since pk-04-09-08
  157.       * @version pk-05-02-10
  158.       * @version pk-05-11-08 debug
  159.       ***/
  160.     function getFieldTag($mode,$aValue=NULL,$debug=FALSE{
  161.         $debug=($debug || $this->fldDebug);
  162.         if ($debugecho "<p><b>DBMS_FIELD_TEMPLATE::getFieldTag($mode,$aValue,...)</b> (".get_class($this)."/".$this->myName.")";
  163.  
  164.         //if ($debug) echo "<pre>".pcf_object_info($this,2,FALSE)."</pre>";
  165.         switch($mode{
  166.             case FRM_MODE_EDIT:
  167.                 if ($this->hideEditbreak;
  168.             case FRM_MODE_NEW:
  169.                 if ($this->hideNewbreak;
  170.             case FRM_MODE_COPY:
  171.                 if ($this->hideCopybreak;
  172.             default:
  173.                 if (!is_array($aValue)) {
  174.                     if (empty($this->myDataArrName)) $this->myDataArrName="DBVAL";
  175.                     global ${$this->myDataArrName};
  176.                     $aValue=${$this->myDataArrName};
  177.                 }
  178.                 require_once $GLOBALS['OCSP']['PHPINCPATH']."common/pcf_templates.phpinc";
  179.                 return pcf_tmpl_parse($this->valTmpl,$aValue,$debug);
  180.         }
  181.         return "";
  182.     }
  183.  
  184.     /**
  185.       * returns $this->getFieldTag($mode,$aValue,$debug)
  186.       * after setting $this->myDataArrName
  187.       *
  188.       * @param int $mode        show mode of the field
  189.       * @param array $aValue    if $aValue is an array $valTmpl is parsed with $aValue alse with ${$arrName}
  190.       * @param string $arrName  ${$arrName} is the dataarray for the template
  191.       * @param boolean $debug   show debug info
  192.       *
  193.       * @return bool    TRUE if an input field is written
  194.       *
  195.       * @version pk-05-02-10
  196.       *
  197.       **/
  198.     function writeField($mode,$aValue=NULL,$arrName="DBVAL",$debug=FALSE{
  199.         $debug=($debug || $this->fldDebug);
  200.         if ($debugecho "<p><b>DBMS_FIELD_TEMPLATE::writeField($mode,\$aValue,$arrName...)</b> (".get_class($this)."/".$this->myName.")";
  201.  
  202.         $this->myDataArrName=$arrName;
  203.         echo $this->getFieldTag($mode,$aValue,$debug);
  204.     }
  205.  
  206.  
  207.     // ###########################################################
  208.     // SEARCH FORM METHODS
  209.     // ###########################################################
  210.  
  211.  
  212.     // ###########################################################
  213.     // OBJECT HTML FORM METHODS
  214.     // ###########################################################
  215.  
  216.  
  217.     // ###########################################################
  218.     // OBJECT VALUE CHECK METHODS
  219.     // ###########################################################
  220.  
  221.  
  222. // end class DBMS_FIELD_HEADLINE
  223. ?>

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