Source for file DBMS_FIELD_DBLOOKUPSELECTLIST.phpclass

Documentation is available at DBMS_FIELD_DBLOOKUPSELECTLIST.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_DBLOOKUPSELECTLIST.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   any
  8.   *
  9.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @version $Id: DBMS_FIELD_DBLOOKUPSELECTLIST.phpclass,v 1.18 2008/12/03 21:32:40 pitlinz Exp $
  13.   *
  14.   */
  15.  
  16.     // ---------------------------------------------------------
  17.     // requirements
  18.     // ---------------------------------------------------------
  19.  
  20.     pcf_require_class('DBMS_FIELD_DBSELECTLIST',dirname(__FILE__"/");
  21.  
  22.     
  23. /**
  24.   * Class DBMS_FIELD_DBLOOKUPSELECTLIST
  25.   *
  26.   * handels select fields (&lt;SELECT&gt;) where the values are selected form the database
  27.   *
  28.   * @project    Open CSP-Management
  29.   * @package    dbms_field
  30.   * @category   any
  31.   *
  32.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  33.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  34.   *
  35.   * @version pk-06-02-06
  36.   * @version pk-06-02-10
  37.   * @version pk-07-08-31
  38.   * 
  39.   * @version $Id: DBMS_FIELD_DBLOOKUPSELECTLIST.phpclass,v 1.18 2008/12/03 21:32:40 pitlinz Exp $
  40.   * 
  41.   */
  42. {
  43.     // ---------------------------------------------------------------------------
  44.     // constants
  45.     // ---------------------------------------------------------------------------
  46.     
  47.     /**
  48.      * @constant string CLASS_SRC_FILE
  49.      */
  50.     const CLASS_SRC_FILE = __FILE__;
  51.  
  52.     // ---------------------------------------------------------------------------
  53.     // class (static)
  54.     // ---------------------------------------------------------------------------
  55.     
  56.     /*** class vars ------------------------------------------------------ */
  57.  
  58.     /*** class methods --------------------------------------------------- */    
  59.     
  60.     // ---------------------------------------------------------------------------
  61.     // object vars
  62.     // ---------------------------------------------------------------------------
  63.     
  64.     /*** compostion --------------------------------------------------- */
  65.     
  66.     /*** attributes  -------------------------------------------------- */    
  67.  
  68.     /**
  69.      * @deprecated
  70.      */
  71.     protected $classSrcFile=__FILE__;
  72.         
  73.      /**
  74.        * @var string $lookupTable 
  75.        * @access protected
  76.        ***/
  77.     protected $lookupTable;
  78.  
  79.     /**
  80.       * @var string $lookupShowField 
  81.       * @since pk-05-11-20
  82.       * @access protected
  83.       ***/
  84.     protected $lookupShowField;
  85.  
  86.     /**
  87.       * @var string $lookupShowLstField 
  88.       * @since pk-06-04-26
  89.       * @access protected
  90.       ***/
  91.     protected $lookupShowLstField;
  92.  
  93.     /**
  94.      * @var string $lookupField 
  95.      * @access protected
  96.      */
  97.     protected $lookupField;
  98.  
  99.     /**
  100.       * @var string $lookupWhere 
  101.       * @access protected
  102.       ***/
  103.     protected $lookupWhere="";
  104.  
  105.     /**
  106.      * @var string $lookupSort command string after 'ORDER BY' if empty
  107.      * @since pk-06-04-29
  108.      * @access protected
  109.      */
  110.     protected $lookupSort="";
  111.  
  112.     /**
  113.       * @var boolean $allowAddValues 
  114.       *  the class DOES NOT CARE if the added values are in the lookup table lookupShowField is used
  115.       * @access protected
  116.       ***/
  117.     protected $allowAddValues=False;
  118.  
  119.     /**
  120.       * @var boolean $allowEditValues 
  121.       * @since pk-06-02-06
  122.       * @access protected
  123.       ***/
  124.     protected $allowEditValues=False;
  125.  
  126.     // ---------------------------------------------------------------------------
  127.     // factory / construct
  128.     // ---------------------------------------------------------------------------
  129.     
  130.     // ---------------------------------------------------------------------------
  131.     // getter / setter
  132.     // ---------------------------------------------------------------------------    
  133.  
  134.     protected function getClassCacheKey()
  135.     {
  136.         $str_key $this->lookupTable . $this->lookupField . $this->lookupShowField . $this->lookupShowLstField . $this->lookupSort . $this->lookupWhere;
  137.         return md5($str_key);
  138.     }
  139.         
  140.     // ---------------------------------------------------------------------------
  141.     // OBJECT SETTINGS METHODS
  142.     // ---------------------------------------------------------------------------
  143.     
  144.     /**
  145.       * returns an array of field to bie shown in the edit form
  146.       * by using editTbl_echoForm
  147.       *
  148.       * the array is in the form:
  149.       *
  150.       * <code>
  151.       * [_sectionName_]
  152.       *      [TITLE] -> string
  153.       *      [_rowName_]
  154.       *         [FLDLAB]  (complete html code with <td></td>)
  155.       *         [FLDVAL] (complete html code with <td></td>)
  156.       * </code>
  157.       *
  158.       * @param boolean $debug 
  159.       * 
  160.       * @global $OCSP_CONF 
  161.       *
  162.       * @returns array
  163.       *
  164.       * @since pk-06-04-26
  165.       * @version pk-06-04-29
  166.       *
  167.       ***/
  168.     function editTbl_getFieldEditArr($debug=False
  169.     {
  170.         global $OCSP_CONF;
  171.         
  172.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBSELECTLIST::editTbl_getFieldEditArr","",0);
  173.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  174.  
  175.         $a_ret['SELECT']['FLD_VALQUERY']    =NULL// unset parent field
  176.         //$a_ret['SELECT']['FLD_RADCHKBOX']    =NULL; 
  177.         
  178.         $a_ret['DBLOOKUP']=array(
  179.             'TITLE'     =>"DB Lookup Definition",
  180.             'FLD_LUTBL'=>array(
  181.                 'FLDLAB'=>"Werte Tabelle"
  182.             ),
  183.             'FLD_VALFLD'=>array(
  184.                 'FLDLAB'=>"Wert Feld",
  185.                 'FLDVAL'=>"<input name=\"lookupField\" value=\"".htmlspecialchars($this->lookupField)."\" size=\"30\">"
  186.             ),
  187.             'FLD_SHOWFRMFLD'=>array(
  188.                 'FLDLAB'=>"Anzeige Feld (Formular Auswahl)",
  189.                 'FLDVAL'=>"<input name=\"lookupShowField\" value=\"".htmlspecialchars($this->lookupShowField)."\" size=\"30\">"
  190.             ),
  191.             'FLD_SHOWLSTFLD'=>array(
  192.                 'FLDLAB'=>"Anzeige Feld (Liste)",
  193.                 'FLDVAL'=>"<input name=\"lookupShowLstField\" value=\"".htmlspecialchars($this->lookupShowLstField)."\" size=\"30\">"
  194.             ),
  195.             'FLD_WHEREFLD'=>array(
  196.                 'FLDLAB'=>"Where Template <a href=\"".OCSP_CONF::getInstance()->getValue('SYSTEMURL')."help/templatevars.html\" target=\"_blank\">?</a>",
  197.                 'FLDVAL'=>"<textarea name=\"lookupWhere\" rows=\"2\" cols=\"30\">".htmlspecialchars($this->lookupWhere)."</textarea>"
  198.             ),
  199.             'FLD_SHOWLSTSORT'=>array(
  200.                 'FLDLAB'=>"Sortier Feld (Liste)",
  201.                 'FLDVAL'=>"ORDER BY <input name=\"lookupSort\" value=\"".htmlspecialchars($this->lookupSort)."\" size=\"30\">"
  202.             ),
  203.             'FLD_LSTADDVALUES'=>array(
  204.                 'FLDLAB'=>"Werte hinzuf&uuml;gen",
  205.                 'FLDVAL'=>"
  206.                             <input name=\"allowAddValues\" type=\"checkbox\"".($this->allowAddValues ? "checked" "")." value=\"1\">ja<br />
  207.                             <b>ACHTUNG</b> neue Werte werden nicht automatisch in die Lookup Tabelle eingetragen.
  208.                           "
  209.             ),
  210.             'FLD_LSTEDITVALUES'=>NULL // placeholder if subclasses need this
  211.         );
  212.         $a_ret['DBLOOKUP']['FLD_LUTBL']['FLDVAL']="<select name=\"lookupTable\" 
  213.             onchange=\"jQuery.getScript('" OCSP_CONF::getInstance()->getValue('ADMINURL'"/dbms/form_rpc.php?cmd=fldLookup_changeTable&FRM_ID=" $this->getFrmId("&fld=" $this->getKey("&table=' + this.value);\">";
  214.         $found=False;
  215.         if ($a_tblLst=$GLOBALS['USRDB']->getDBTblList()) {
  216.             foreach($a_tblLst as $s_tbl{
  217.                 if ($s_tbl == $this->lookupTable{
  218.                     $a_ret['DBLOOKUP']['FLD_LUTBL']['FLDVAL'].="\t<option value=\"$s_tbl\" selected>$s_tbl</option>\n";
  219.                     $found=TRUE;
  220.                 else {
  221.                     $a_ret['DBLOOKUP']['FLD_LUTBL']['FLDVAL'].="\t<option value=\"$s_tbl\">$s_tbl</option>\n";
  222.                 }
  223.             }
  224.         }
  225.         if (!$found{
  226.             $a_ret['DBLOOKUP']['FLD_LUTBL']['FLDVAL'].="\t<option value=\"".$this->lookupTable."\" selected>NOT IN DB[".$this->lookupTable."]</option>\n";
  227.         }
  228.         $a_ret['DBLOOKUP']['FLD_LUTBL']['FLDVAL'].="</select>";
  229.         $a_ret['DBLOOKUP']['FLD_LUTBL']['FLDVAL'].="<a onClick=\"
  230.                                                         var tblName=getSelectedOptionByName(document.forms['frmEdit'],'lookupTable');
  231.                                                         if (tblName=='') {
  232.                                                             alert('W&auml;hlen Sie zuerst eine Tabelle aus');
  233.                                                         } else {
  234.                                                             var link='".OCSP_CONF::getInstance()->getValue('ADMINURL')."phpmyadmin/tbl_properties_structure.php?db=".$GLOBALS['USRDB']->getMyDBName()."';
  235.                                                             link=link+'&table='+tblName;
  236.                                                             openLinkWnd(link);
  237.                                                         }
  238.                                                     \" title=\"Tabelle in phpMyAdmin zeigen\">
  239.                                                         <img src=\"".OCSP_CONF::getInstance()->getValue('SYSIMGURL')."icons-16x16/b_browse.png\" border=\"0\" class=\"button\">
  240.                                                     </a>";
  241.  
  242.         return $a_ret;
  243.  
  244.     }
  245.  
  246.  
  247.     /**
  248.       * ensures that no ; is in $str used in a sql statements
  249.       * @param string 
  250.       * @return string 
  251.       */
  252.     function DBcheckEditInput($str{
  253.         $ret="";
  254.         if (!empty($str)) {
  255.             if ($arr=explode(';',$str)) {
  256.                 $ret=$arr[0];
  257.             }
  258.         }
  259.         return $ret;
  260.     }
  261.  
  262.  
  263.     /**
  264.       * save the filed definition form
  265.       *
  266.       * @returns boolean
  267.       *
  268.       * @version pk-04-12-31
  269.       * @version pk-06-02-06 popUp_frmId
  270.       * @version pk-06-04-29 lookupSort
  271.       *
  272.       ***/
  273.     function save(
  274.     {
  275.         $ret=parent::save();
  276.         $this->lookupTable =        (isset($_POST['lookupTable'])       $this->DBcheckEditInput($_POST['lookupTable']$this->lookupTable);
  277.         $this->lookupField =        (isset($_POST['lookupField'])       $this->DBcheckEditInput($_POST['lookupField']$this->lookupField);
  278.         $this->lookupShowField=     (isset($_POST['lookupShowField'])   $this->DBcheckEditInput($_POST['lookupShowField']$this->lookupShowField);
  279.         $this->lookupShowLstField=  (isset($_POST['lookupShowLstField'])$this->DBcheckEditInput($_POST['lookupShowLstField']$this->lookupShowLstField);
  280.         $this->lookupWhere =        (isset($_POST['lookupWhere'])       $this->DBcheckEditInput($_POST['lookupWhere']$this->lookupWhere);
  281.         $this->lookupSort  =        (isset($_POST['lookupSort'])        $this->DBcheckEditInput($_POST['lookupSort']$this->lookupSort);
  282.  
  283.         $this->allowAddValues   =   ((isset($_POST['allowAddValues']&& intval($_POST['allowAddValues'])) TRUE False );
  284.         $this->allowEditValues  =   ((isset($_POST['allowEditValues']&& intval($_POST['allowEditValues'])) TRUE False );
  285.                 
  286.         return $ret;
  287.     }
  288.  
  289.     // -----------------------------------------------------------
  290.     // DB value methods
  291.     // -----------------------------------------------------------
  292.   
  293.     /**
  294.       * returns the database query
  295.       *
  296.       * @param boolean $debug 
  297.       *
  298.       * @global ${$this->myDataArrName} 
  299.       *
  300.       * @return string 
  301.       *
  302.       * @requires pcf_templates.phpinc
  303.       *
  304.       * @since pk-07-09-03
  305.       * @version pk-08-04-15
  306.       *
  307.       * @todo DBMS_FIELD_DBLOOKUPSELECTLIST::getMyValueQuery() remove inline SQL
  308.       */
  309.     function getMyValueQuery($debug=False)
  310.     {
  311.         
  312.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBLOOKUPSELECTLIST::getMyValueQuery()");
  313.  
  314.         if (empty($this->lookupShowField)) $this->lookupShowField=$this->lookupField;
  315.         $str_query ="SELECT ".$this->lookupField" AS KEYCOL,".$this->lookupShowField" as VALUECOL FROM ".$this->lookupTable;
  316.         $str_query.=$this->_getMyValueWhere($debug);
  317.         
  318.         if (empty($this->lookupSort)) 
  319.         {
  320.             $str_query.=" ORDER BY ".$this->lookupField;
  321.         else {
  322.             $str_query.=" ORDER BY ".$this->lookupSort;
  323.         }
  324.         
  325.         if ($debugechoDebugLine(__FILE__,__LINE__,"value query: <br />$str_query");
  326.         
  327.         if (empty($this->progValueCacheId))
  328.         {
  329.             $this->progValueCacheId md5($str_query);
  330.         }        
  331.         
  332.         return $str_query;
  333.      }     
  334.      
  335.      /**
  336.       * returns the where condition for $this->getMyValueQuery
  337.       *
  338.       * @param boolean $debug 
  339.       * 
  340.       * @return string 
  341.       * 
  342.       * @since pk-08-12-03
  343.       */
  344.      protected function _getMyValueWhere($debug)
  345.      {
  346.          if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBLOOKUPSELECTLIST::getMyValueWhere();");
  347.          
  348.          
  349.         if (!empty($this->lookupWhere)) // <pk-05-08-10>
  350.         {
  351.             pcf_require_class('OCSP_TEMPLATE',"common/");
  352.             global ${$this->myDataArrName};                    
  353.             return " WHERE " OCSP_TEMPLATE::parse($this->lookupWhere,${$this->myDataArrName},$debug);
  354.         }         
  355.          
  356.         return "";
  357.      }
  358.           
  359.     /**
  360.       * sets populates $this->myValues array from the database
  361.       *
  362.       * @param string $arrName
  363.       * @param boolean $debug
  364.       *
  365.       * @version pk-04-10-11
  366.       * @version pk-05-08-10
  367.       * @version pk-08-06-13 use OCSP_OBJ::defaultReadDBObj()
  368.       */
  369.     function setMyValues($arrName=NULL,$debug=False)
  370.     {     
  371.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBLOOKUPSELECTLIST::setMyValues();");
  372.         
  373.         $this->query = $this->getMyValueQuery($debug);
  374.         return parent::setMyValues($arrName,$debug);
  375.     }
  376.  
  377.     // ###########################################################
  378.     // OBJECT HTML FORM METHODS
  379.     // ###########################################################
  380.  
  381.     /**
  382.       * returns the html code for the new button
  383.       *
  384.       * @param boolean $debug
  385.       *
  386.       * @returns string
  387.       *
  388.       * @since pk-06-04-26
  389.       */
  390.     function getNewBtn($debug=False{
  391.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBLOOKUPSELECTLIST::getNewBtn","arrName$arrName",0);
  392.  
  393.         $s_ret ="<!--\n\t\t _______ ADD VALUES BUTTON _______ \n";
  394.         $s_ret.="\t\t--> <a name=\"".$this->getMyFormName()."_".$this->myName."\" href=\"#".$this->getMyFormName()."_".$this->myName."\" onClick=\"\n"// <pk-05-12-01>
  395.         $s_ret.="\t\t     if (document.forms['".$this->getMyFormName()."']) frmObj=document.forms['".$this->getMyFormName()."'];\n";
  396.         $s_ret.="\t\t     else frmObj=document.forms[".$this->myForm->getHTMLName()."];\n";
  397.         $s_ret.="\t\t     if (selObj=findElement(frmObj,'".$this->myDataArrName."[".$this->myName."]"."')) { \n";
  398.         $s_ret.="\t\t         if ((newVal=prompt('".$this->label."','')) && (newVal != '')) { \n";
  399.         $s_ret.="\t\t             id=selObj.length;\n";
  400.         $s_ret.="\t\t             opt = new Option(newVal,newVal,false,true);\n";
  401.         $s_ret.="\t\t             selObj.options[id]=opt;\n";
  402.         $s_ret.="\t\t         }\n";
  403.         $s_ret.="\t\t     }\n";
  404.         $s_ret.="\t\t \"><img src=\"" OCSP_CONF::getInstance()->getValue('SYSIMGURL')  "icons-16x16/filenew.png\" border=\"0\" alt=\"" t_admin("neuer Eintrag""\" align=\"middle\">";
  405.         $s_ret.="</a><!--\n";
  406.         $s_ret.="\t\t _______ ADD VALUES BUTTON _______ \n-->";
  407.         
  408.         return $s_ret;
  409.     }
  410.  
  411.     /**
  412.       * returns the html code for the select
  413.       *
  414.       * @param string $aValue
  415.       * @param array $arrName
  416.       * @param boolean $debug
  417.       *
  418.       * @returns string
  419.       *
  420.       * @version pk-05-12-01
  421.       * @version pk-06-04-26 getNewBtn()
  422.       *
  423.       **/
  424.     function getInputTag($aValue,$arrName="DBVAL",$debug=False{
  425.         $debug=($debug || $this->fldDebug);
  426.         if (!empty($arrName)) $this->myDataArrName=$arrName;
  427.  
  428.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBLOOKUPSELECTLIST::getInputTag(\$aValue,$arrName)","aValue=$aValue");
  429.  
  430.         $str_ret=parent::getInputTag($aValue,$arrName,$debug);
  431.  
  432.         if (!$this->showAsCheckRadio)
  433.         {
  434.             if ($this->allowAddValues
  435.             {
  436.                 $str_ret .= $this->getNewBtn($debug);
  437.             }
  438.             
  439.             if (method_exists($this,"getZoomBtn")) 
  440.             {
  441.                 $str_ret .= $this->getZoomBtn($debug);
  442.             }
  443.         }
  444.         return $str_ret;
  445.     }
  446.  
  447.     /**
  448.       * returns the db value for a value
  449.       *
  450.       * @param string $aValue
  451.       * @param boolean $debug
  452.       *
  453.       * @global $OCSP_VAL
  454.       *
  455.       * @return string
  456.       *
  457.       * @since pk-06-01-24
  458.       *
  459.       **/
  460.     function getDBValue($aValue,$mode=FRM_MODE_READONLY,$debug=False{
  461.         $debug=($debug || $this->fldDebug);
  462.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBLOOKUPSELECTLIST::getDBValue()",print_r($aValue,TRUE));
  463.  
  464.         if ($this->lookupShowField == $this->lookupField{
  465.             // no need to lookup in the database
  466.             return $aValue;
  467.         }
  468.  
  469.         if (!empty($aValue|| strlen(strval($aValue)) 0)
  470.         {
  471.             global $OCSP_VAL;
  472.  
  473.             if (($mode==FRM_MODE_LIST&& (!empty($this->lookupShowLstField)))
  474.             {
  475.                 $str_showCol=$this->lookupShowLstField;
  476.             else {
  477.                 $str_showCol=$this->lookupShowField;
  478.             }
  479.             $str_cacheKey=preg_replace('/[^a-z0-9A-Z_\-\.]/i','_',$str_showCol);
  480.  
  481.             if (isset($OCSP_VAL['DBMS_FIELD_DBLOOKUP_CACHE'][$this->getKey()][$str_cacheKey][$aValue]))
  482.             {
  483.                 return $OCSP_VAL['DBMS_FIELD_DBLOOKUP_CACHE'][$this->getKey()][$str_cacheKey][$aValue];
  484.             }
  485.  
  486.             $obj_myDB=$this->myForm->getDBObj();
  487.  
  488.             $s_query ="SELECT ".$str_showCol." FROM ".$this->lookupTable;
  489.             $s_query.=" WHERE ".$this->lookupField."=".$obj_myDB->qs_getSlashedValue($aValue);
  490.             if ($debugechoDebugLine(__FILE__,__LINE__,"<p>$s_query</p>",1);
  491.  
  492.             if ($s_ret=$obj_myDB->quickQuery($s_query,0)) {
  493.                 // value found in the database
  494.                 $OCSP_VAL['DBMS_FIELD_DBLOOKUP_CACHE'][$this->getKey()][$str_cacheKey][$aValue]=$s_ret;
  495.                 return $s_ret;
  496.             else {
  497.                 // value not found return the value
  498.                 return $aValue;
  499.             }
  500.         else {
  501.             return $aValue;
  502.         }
  503.     }
  504.  
  505.     /**
  506.       *
  507.       * returns the html code for the readonly field
  508.       *
  509.       * if is_array($aValue) a list (&lt;ul&gt;) is returned
  510.       *
  511.       * @param mixed $aValue
  512.       * @param string $arrName
  513.       * @param boolean $debug
  514.       *
  515.       * @returns string
  516.       *
  517.       * @version pk-06-01-24
  518.       * @version pk-06-02-10
  519.       * @version pk-06-04-26
  520.       * @version pk-06-04-14
  521.       *
  522.       **/
  523.     function getScreenValue($aValue,$arrName="DBVAL",$debug=False{
  524.         $debug=($debug || $this->fldDebug || $this->fldDbgGetValue);
  525.         if ($debugechoDebugMethod(__FILE__,__LINE__,"DBMS_FIELD_DBLOOKUPSELECTLIST::getScreenValue($aValue,$arrName,...)",0);
  526.  
  527.         if ($this->lookupField == $this->lookupShowField{
  528.             // no need to do db lookups
  529.             return parent::getScreenValue($aValue,$arrName,$debug);
  530.         }
  531.  
  532.         if (empty($this->mySeperator)) $this->mySeperator="\n"// <pk-06-09-14 />
  533.         if (!is_array($aValue&& (strstr($aValue,$this->mySeperator))) // <pk-06-02-10>
  534.             $aValue=explode($this->mySeperator,$aValue);
  535.         }
  536.  
  537.         if (is_array($aValue)) {
  538.             $ret"<ul>";
  539.             foreach($aValue as $val{
  540.                 $ret.="<li>".htmlspecialchars($this->getDBValue($val,FRM_MODE_READONLY,$debug))."</li>";
  541.             }
  542.             $ret.="</ul>";
  543.             return $ret;
  544.         else {
  545.             return htmlspecialchars($this->getDBValue($aValue,FRM_MODE_READONLY,$debug));
  546.         }
  547.     }
  548.  
  549.     /**
  550.       *
  551.       * returns the html code for the readonly field in a list (table col)
  552.       *
  553.       * if is_array($aValue) a list (&lt;ul&gt;) is returned
  554.       *
  555.       * @param mixed $aValue
  556.       * @param string $arrName
  557.       * @param boolean $debug
  558.       *
  559.       * @returns string
  560.       *
  561.       * @since pk-06-04-26
  562.       * @version pk-06-05-29 (lstValueIsHtml added)
  563.       *
  564.       **/
  565.     function getListValue($aValue,$arrName="DBVAL",$debug=False{
  566.         $debug=($debug || $this->fldDebug);
  567.         if ($debugechoDebug(__FILE__,"<hr /><p><b>DBMS_FIELD_DBLOOKUPSELECTLIST::getListValue($aValue,$arrName,...)</b></p>",0);
  568.  
  569.         if (empty($aValue&& ($this->nullToZero)) // <pk-06-10-09>
  570.             return $this->nullLabel;
  571.         }
  572.  
  573.         if ($this->lookupField == $this->lookupShowLstField{
  574.             // no need to do db lookups
  575.             return parent::getListValue($aValue,$arrName,$debug);
  576.         }
  577.  
  578.         if (empty($this->mySeperator)) $this->mySeperator="\n";
  579.         if (!empty($aValue&& !is_array($aValue&& (strstr($aValue,$this->mySeperator))) {
  580.             $aValue=explode($this->mySeperator,$aValue);
  581.         }
  582.  
  583.         if (is_array($aValue)) {
  584.             $ret"<ul>";
  585.             foreach($aValue as $val{
  586.                 $ret.="<li>";
  587.                 if ($this->lstValueIsHtml$ret.=$this->getDBValue($val,FRM_MODE_LIST,$debug)// <pk-06-05-29 />
  588.                 else                       $ret.=htmlspecialchars($this->getDBValue($val,FRM_MODE_LIST,$debug));
  589.                 $ret.="</li>";
  590.             }
  591.             $ret.="</ul>";
  592.             return $ret;
  593.         else {
  594.             if ($this->lstValueIsHtmlreturn $this->getDBValue($aValue,FRM_MODE_LIST,$debug)// <pk-06-05-29 />
  595.             else return htmlspecialchars($this->getDBValue($aValue,FRM_MODE_LIST,$debug));
  596.         }
  597.     }
  598.  
  599.     // ###########################################################
  600.     // SEARCH FORM METHODS
  601.     // ###########################################################
  602.  
  603.  
  604.     // ###########################################################
  605.     // OBJECT HTML FORM METHODS
  606.     // ###########################################################
  607.  
  608.  
  609.     // ###########################################################
  610.     // OBJECT VALUE CHECK METHODS
  611.     // ###########################################################
  612.  
  613.  
  614. // end class DBMS_FIELD_DBLOOKUPSELECTLIST
  615. ?>

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