Source for file DBMS_FIELD_DBMS_FORMSELECT.phpclass

Documentation is available at DBMS_FIELD_DBMS_FORMSELECT.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_DBMS_FORMSELECT.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   int
  8.   *
  9.   * @author     Peter Krebs <p.krebs@lvus.at>
  10.   * @copyright  (c) 2002-2005 by Peter Krebs and LVUS
  11.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  12.   *
  13.   ***/
  14.  
  15. global $OCSP_CONF;
  16.  
  17. if (!isset($OCSP_CONF['DBMSFLD_PATH'])) $OCSP_CONF['DBMSFLD_PATH']=dirname(__FILE__)._OCSP_DIRSEP_;
  18. require_once $OCSP_CONF['DBMSFLD_PATH']."DBMS_FIELD_FOREIGNKEY.phpclass";
  19.  
  20. /**
  21.   * Class file DBMS_FIELD_DBMS_FORMSELECT.phpclass
  22.   *
  23.   * @project    Open CSP-Management
  24.   * @package    dbms_field
  25.   * @category   int
  26.   *
  27.   * @author     Peter Krebs <p.krebs@lvus.at>
  28.   * @copyright  (c) 2002-2005 by Peter Krebs and LVUS
  29.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  30.   *
  31.   * @since      pk-05-09-30
  32.   *
  33.   ***/
  34.     /**
  35.       * source file of the class
  36.       *
  37.       * @var string $classSrcFile 
  38.       * @since pk-05-01-20
  39.       ***/
  40.     protected $classSrcFile=__FILE__;    
  41.     
  42.     var $className      = "Form Select List";
  43.     
  44.     
  45.     /*** lookup table **/
  46.      
  47.     /**
  48.      * @var string $lookupTable 
  49.      */
  50.     protected $lookupTable     = "T_DBMS_FORM";
  51.     /**
  52.      * @var string $lookupShowField 
  53.      */    
  54.     protected $lookupShowField = "CONCAT(FRM_NAME,' (',FRM_ID,')')";
  55.     /**
  56.      * @var string $lookupField 
  57.      */    
  58.     protected $lookupField     = "FRM_ID";
  59.     /**
  60.      * @var string $lookupSort 
  61.      */        
  62.     protected $lookupSort      = "FRM_NAME";
  63.     /**
  64.      * @var boolean $showNullOption 
  65.      */        
  66.     protected $showNullOption  = FALSE;    
  67.     
  68.  
  69.     /**
  70.       * @var string $editUrl url to the field editor
  71.       ***/
  72.     protected $editUrl             = "\$@OCSP|ADMINURL\$dbms/editframe.php?FRM_ID=##VALUE##";
  73.  
  74.     /**
  75.       * @var int $editEnableInList link List field with edit url
  76.       ***/
  77.     var $editEnableInList   = TRUE;
  78.  
  79.     /**
  80.       * @var string $formTable 
  81.       * @since pk-05-10-25
  82.       ***/
  83.     protected $formTable="";
  84.  
  85.  
  86.  
  87.     // ###########################################################
  88.     // OBJECT SETTINGS METHODS
  89.     // ###########################################################
  90.  
  91.     /**
  92.       * returns an array of field to bie shown in the edit form
  93.       * by using editTbl_echoForm
  94.       *
  95.       * the array is in the form:
  96.       *
  97.       * <code>
  98.       * [_sectionName_]
  99.       *      [TITLE] -> string
  100.       *      [_rowName_]
  101.       *         [FLDLAB]  (complete html code with <td></td>)
  102.       *         [FLDVAL] (complete html code with <td></td>)
  103.       * </code>
  104.       *
  105.       * @param boolean $debug 
  106.       *
  107.       * @returns array
  108.       *
  109.       * @since pk-06-07-21
  110.       *
  111.       ***/
  112.     function editTbl_getFieldEditArr($debug=FALSE{
  113.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBSELECTLIST::editTbl_getFieldEditArr","",0);
  114.  
  115.         // setting some defaults
  116.         if (empty($this->showField)) $this->showField="CONCAT(FRM_NAME,' (',FRM_ID,')')";
  117.         if (empty($this->sortField)) $this->sortField="FRM_NAME";
  118.  
  119.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  120.  
  121.         unset($a_ret['DBLOOKUP']['FLD_FOREIGNTBL']);
  122.         $a_ret['DBLOOKUP']['FLD_VALFLD']['FLDVAL']="FRM_ID";
  123.  
  124.         $s_tmp=$a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'];
  125.         $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL']="
  126.                 Tabellenfilter: <select name=\"formTable\" size=\"1\">
  127.                     <option value=\"\">--- ??? ---</option>\n";
  128.         if ($a_tblLst=$GLOBALS['USRDB']->getDBTblList($debug)) {
  129.             foreach($a_tblLst as $s_tbl{
  130.                 $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].="  <option value=\"".$s_tbl."\"";
  131.                 if ($this->formTable == $s_tbl$a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].=" selected";
  132.                 $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].=">".$s_tbl."</option>\n";
  133.             }
  134.         }
  135.         $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].="</select><br />\n";
  136.         $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].=$s_tmp;
  137.  
  138.         if ($debugecho "<pre>".htmlspecialchars(print_r($a_ret['DBLOOKUP']['FLD_WHEREFLD'],TRUE))."</pre>";
  139.         return $a_ret;
  140.     }
  141.  
  142.     /**
  143.       * saves the postet values to the object but not to the db
  144.       *
  145.       * @returns boolean
  146.       *
  147.       * @version pk-07-02-14
  148.       *
  149.       ***/
  150.     function save({
  151.         $ret=parent::save();
  152.  
  153.         $this->lookupTable      = "T_DBMS_FORM";
  154.         $this->lookupField      = "FRM_ID";
  155.  
  156.         $this->formTable        = $_POST['formTable'];
  157.         return $ret;
  158.     }
  159.  
  160.     /**
  161.       * returns the where part of to select the foreign Value
  162.       *
  163.       * @param string $arrName 
  164.       * @param string $append 
  165.       * @param boolean $debug 
  166.       * @param boolean $withWhereAnd 
  167.       *
  168.       * @return string 
  169.       *
  170.       * @since pk-05-10-25
  171.       *
  172.       * @var string $s_ret 
  173.       *
  174.       ***/
  175.     function getWhereStmt($arrName="DBVAL",$append="",$debug=FALSE,$withWhereAnd=TRUE{
  176.         if ($debugecho "<p><b>DBMS_FIELD_DBMS_FORMSELECT::getWhereStmt(...)</b> (".get_class($this).")</p>\n";
  177.  
  178.         $s_ret=parent::getWhereStmt($arrName,$append,$debug,$withWhereAnd);
  179.         if (!empty($this->formTable)) {
  180.             if (strstr($s_ret,"WHERE")) $s_ret.=" AND "else $s_ret.=" WHERE ";
  181.             $s_ret.="FRM_TABLES LIKE '%".$this->formTable."%' ";
  182.         }
  183.         return $s_ret;
  184.     }
  185.  
  186.  
  187. }
  188. ?>

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