Source for file DBMS_FIELD_DBOPTGRPSELLIST.phpclass

Documentation is available at DBMS_FIELD_DBOPTGRPSELLIST.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_DBOPTGRPSELLIST.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   mixed
  8.   *
  9.   * @author     Peter Krebs <p.krebs@lvus.at>
  10.   * @copyright  &copy; 2002-2005 by Peter Krebs and Landesverlag Unternehmensservice
  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_DBSELECTLIST")) {
  18.     require_once dirname(__FILE__)."/DBMS_FIELD_DBSELECTLIST.phpclass";
  19. }
  20.  
  21. /**
  22.   * Class DBMS_FIELD_DBOPTGRPSELLIST
  23.   *
  24.   * @project    Open CSP-Management
  25.   * @package    dbms_field
  26.   * @category   mixed
  27.   *
  28.   * @author     Peter Krebs <p.krebs@wpus.at>
  29.   * @author     amicas project <opencsp@amicas.at>
  30.   * @copyright  &copy; 2002-2005 by WURM & Partner Unternehmensservice
  31.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  32.   *
  33.   * @since pk-05-05-31
  34.   *
  35.   * @version ap-06-05-02
  36.   *
  37.   ***/
  38.  
  39.     // ###########################################################
  40.     // OBJECT (CONST) VAR DECLARATION
  41.     // ###########################################################
  42.  
  43.      var $className       = "SelectDbOptGrpList";
  44.  
  45.     /**
  46.       * source file of the class
  47.       *
  48.       * @var string $classSrcFile 
  49.       ***/
  50.     var $classSrcFile=__FILE__;
  51.  
  52.     /**
  53.       * database columns
  54.       *
  55.       * @var string $dbColumns 
  56.       ***/
  57.     var $dbColumns="";
  58.  
  59.     /**
  60.       * tables
  61.       *
  62.       * @var string $dbTables 
  63.       ***/
  64.     var $dbTables = "";
  65.  
  66.     /**
  67.       * group by field
  68.       *
  69.       * @var string $dbGroupBy 
  70.       ***/
  71.     var $dbGroupBy = "";
  72.  
  73.     /**
  74.       * order by field
  75.       *
  76.       * @var string $dbOrderBy 
  77.       ***/
  78.     var $dbOrderBy = "";
  79.  
  80.     /**
  81.       * @var boolean $navigateGrps use a select for each grp and call reload on Change
  82.       * @since ap-06-02-05
  83.       ***/
  84.     var $navigateGrps=FALSE;
  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 ap-06-05-02
  110.       *
  111.       ***/
  112.     function editTbl_getFieldEditArr($debug=FALSE{
  113.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBSELECTLIST::editTbl_getFieldEditArr","",0);
  114.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  115.  
  116.         $a_ret['LAYOUT']['FLD_NAVIGATEGRPS']=array(
  117.             'FLDLAB'=>"Gruppen Navigation",
  118.             'FLDVAL'=>"<input type=\"checkbox\" name=\"navigateGrps\" value=\"1\" ".($this->navigateGrps ? "checked" "")."> Ja, jede Gruppe in eigenem Select darstellen"
  119.         );
  120.         $a_ret['SELECT']['FLD_VALQUERY']    =NULL// unset parent field
  121.         $a_ret['SELECT']['FLD_RADCHKBOX']   =NULL// unset parent field
  122.         $a_ret['DBLOOKUP']=array(
  123.             'TITLE'     =>"DB Lookup Definition",
  124.             'FLD_SELFLD'=>array(
  125.                 'FLDLAB'=>"key,value)",
  126.                 'FLDVAL'=>"SELECT <input name=\"dbFields\" value=\"".htmlspecialchars($this->dbFields)."\" size=\"30\">"
  127.             ),
  128.             'FLD_FROMFRMFLD'=>array(
  129.                 'FLDLAB'=>"Table[s]",
  130.                 'FLDVAL'=>"FROM <input name=\"dbTables\" value=\"".htmlspecialchars($this->dbTables)."\" size=\"30\">"
  131.             ),
  132.             'FLD_WHEREFLD'=>array(
  133.                 'FLDLAB'=>"Where Template <a href=\"".$GLOBALS['OCSP']['SYSTEMURL']."help/templatevars.html\" target=\"_blank\">?</a>",
  134.                 'FLDVAL'=>"WHERE <textarea name=\"dbWhere\" rows=\"2\" cols=\"30\">".htmlspecialchars($this->dbWhere)."</textarea>"
  135.             ),
  136.             'FLD_GRPBYFLD'=>array(
  137.                 'FLDLAB'=>"Gruppierungs Feld(er)",
  138.                 'FLDVAL'=>"GROUP BY <input name=\"dbGroupBy\" value=\"".htmlspecialchars($this->dbGroupBy)."\" size=\"30\">"
  139.             ),
  140.             'FLD_SHOWLSTSORT'=>array(
  141.                 'FLDLAB'=>"Soritier Feld (Liste)",
  142.                 'FLDVAL'=>"ORDER BY <input name=\"dbOrderBy\" value=\"".htmlspecialchars($this->dbOrderBy)."\" size=\"30\">"
  143.             ),
  144.             'FLD_LSTADDVALUES' =>NULL,  // placeholder if subclasses need this
  145.             'FLD_LSTEDITVALUES'=>NULL   // placeholder if subclasses need this
  146.         );
  147.         return $a_ret;
  148.  
  149.     }
  150.  
  151.  
  152.  
  153.     /**
  154.       * echos the filed definition form
  155.       *
  156.       * @param bool $showSize 
  157.       *
  158.       * @version pk-04-10-11
  159.       * @version ap-06-05-02
  160.       *
  161.       ***/
  162.      function editTblForm($showSize=FALSE{
  163.         $a_FieldEditArr=$this->editTbl_getFieldEditArr($debug);
  164.         $this->editTbl_echoForm($a_FieldEditArr,$debug);
  165.     }
  166.  
  167.     /**
  168.       * save the filed definition form
  169.       *
  170.       * @return bool 
  171.       *
  172.       * @version ap-06-05-02
  173.       *
  174.       ***/
  175.     function save({
  176.         $ret=parent::save();
  177.         $this->navigateGrps=(intval($_POST['navigateGrps']TRUE FALSE);
  178.  
  179.         $this->dbFields=$_POST['dbFields'];
  180.         $this->dbTables=$_POST['dbTables'];
  181.         $this->dbWhere =$_POST['dbWhere'];
  182.         $this->dbGroupBy=$_POST['dbGroupBy'];
  183.         $this->dbOrderBy=$_POST['dbOrderBy'];
  184.  
  185.         // set database query for parent methods which use this
  186.         // to lookup values
  187.         $query="SELECT ".$this->dbFields." FROM ".$this->dbTables;
  188.         if (!empty($this->dbWhere)) $query.=" WHERE ".$this->dbWhere;
  189.         $query.=" ORDER BY ".$this->dbGroupBy;
  190.         if (!empty($this->dbOrderBy)) $query.=",".$this->dbOrderBy;
  191.  
  192.         $this->query=$GLOBALS[$this->getGlobalDBObjIdx()]->checkQuery($query,PQT_SELECT);
  193.  
  194.         return $ret;
  195.     }
  196.  
  197.     // ###########################################################
  198.     // OBJECT DATA METHODS
  199.     // ###########################################################
  200.  
  201.     /**
  202.       * returns an array of all group fields or an empty array
  203.       * if explode(",",$this->dbGroupBy) fails
  204.       *
  205.       * @param boolean $debug 
  206.       *
  207.       * @returns array
  208.       *
  209.       * @since ap-06-05-02
  210.       *
  211.       * @todo check if we have a complex dbGroupBy with for example CONCAT(xxx,yyy)
  212.       *
  213.       ***/
  214.     function getSelectGroups($debug=FALSE{
  215.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBOPTGRPSELLIST::getSelectGroups","",0);
  216.         if ($a_fields=explode(",",$this->dbGroupBy)) {
  217.             return $a_fields;
  218.         }
  219.         return array();
  220.     }
  221.  
  222.     /**
  223.       * returns the number of group fields used
  224.       *
  225.       * @param boolean $debug 
  226.       *
  227.       * @returns int
  228.       *
  229.       * @since ap-06-05-02
  230.       *
  231.       ***/
  232.     function nofGrpFlds($debug=FALSE{
  233.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBOPTGRPSELLIST::nofGrpFlds","",0);
  234.         $a_fields=$this>getSelectGroups($debug);
  235.         return sizeof($a_fields);
  236.     }
  237.  
  238.     /**
  239.       * returns an array with key and value column name
  240.       * or NULL in case of an error
  241.       *
  242.       * @param boolean $debug 
  243.       *
  244.       * @returns array
  245.       *
  246.       * @since ap-06-05-02
  247.       *
  248.       ***/
  249.     function getKeyValColumns($debug=FALSE{
  250.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBOPTGRPSELLIST::getKeyValColumns","",0);
  251.  
  252.         $a_ret=array();
  253.         if ($a_fields=explode(",",$this->dbFields,2)) {
  254.             $a_ret['MYKEY']=$a_fields[0];
  255.             if (empty($a_fields[1])) {
  256.                 // key == value
  257.                 $a_ret['MYVAL']=$a_fields[0];
  258.             else {
  259.                 $a_ret['MYVAL']=$a_fields[1];
  260.             }
  261.             return $a_ret;
  262.         else {
  263.             if ($debugechoDebug(__FILE__,"<p>Could not explode ".$this->dbFields."</p>");
  264.             return NULL;
  265.         }
  266.     }
  267.  
  268.     /**
  269.       * returns the SQL statement for key,values,groups
  270.       *
  271.       * @param boolean $withOrder omit 'ORDER BY ...'
  272.       * @param boolean $debug 
  273.       *
  274.       * @returns string
  275.       *
  276.       * @since ap-06-05-02
  277.       *
  278.       ***/
  279.     function getSQLStmt($withOrder=TRUE,$debug=FALSE{
  280.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBOPTGRPSELLIST::getSQLStmt","",0);
  281.  
  282.         if ($a_keyval=$this->getKeyValColumns($debug)) {
  283.             $s_query="SELECT ".$a_keyval['MYKEY']." AS MYKEY,".$a_keyval['MYVAL']." AS MYVAL";
  284.             $a_grps=$this->getSelectGroups($debug);
  285.             $i_nofGrps=sizeof($a_grps);
  286.             for ($i=0;$i<$i_nofGrps;$i++{
  287.                 $s_query.=",".$a_grps[$i]." AS MYGRP".$i;
  288.             }
  289.             $s_query.=" FROM ".$this->dbTables;
  290.             if (!empty($this->dbWhere)) $s_query.=" WHERE ".$this->dbWhere;
  291.             if ($withOrder{
  292.                 $s_query.=" ORDER BY ";
  293.                 if (!empty($this->dbGroupBy)) $s_query.=$this->dbGroupBy.",";
  294.                 if (!empty($this->dbOrderBy)) $s_query.=$this->dbOrderBy.",";
  295.                 $s_query.=$a_keyval['MYVAL'];
  296.             }
  297.             return $s_query;
  298.         else {
  299.             return NULL;
  300.         }
  301.  
  302.     }
  303.  
  304.     // ###########################################################
  305.     // OBJECT HTML FORM METHODS
  306.     // ###########################################################
  307.  
  308.     /**
  309.       * returns a string with the options
  310.       *
  311.       *
  312.       * @param array $aValArr   array of selected values
  313.       * @param bool $addNULL    add the null option (for search)
  314.       * @param bool $debug 
  315.       *
  316.       * @return string 
  317.       *
  318.       * @version ap-06-05-02
  319.       *
  320.       ***/
  321.     function getOptionList($aValArr,$addNULL=FALSE,$debug=FALSE{
  322.         $debug=($debug || $this->fldDebug)// <pk-04-08-31>
  323.         if ($debug{
  324.             echo "<p><b>DBMS_FIELD_DBOPTGRPSELLIST::getOptionList(\$aValArr,$addNULL,...)</b> (".get_class($this)."/".$this->myName.")</p>";
  325.             echo "<blockquote><p>\$aValArr</p><pre>".print_r($aValArr,TRUE)."</pre></blockquote>";
  326.         }
  327.  
  328.         $s_ret="\n";
  329.         if ($addNULL{
  330.             $s_ret.="\t<option value=\"\">".$this->nullLabel."</option>\n";
  331.         }
  332.  
  333.         if (!($s_query=$this->getSQLStmt(TRUE,$debug))) {
  334.             // ERROR no SQL statement
  335.             if ($debugechoDebug(__FILE__,"<p>NO SQL STATEMENT</p>");
  336.             return $s_ret;
  337.         }
  338.  
  339.         if (!is_object($GLOBALS[$this->getGlobalDBObjIdx()])) {
  340.            $objcmd "\$DBOBJ = new DB_".$GLOBALS['PROJECT']['DBTYPE'].";";
  341.            eval ($objcmd);
  342.            $DBOBJ->publicConnect($GLOBALS['PROJECT']['DBCONF']);
  343.            $toDisconnect=TRUE;
  344.         else {
  345.             $DBOBJ=&$GLOBALS[$this->getGlobalDBObjIdx()];
  346.             $toDisconnect=FALSE;
  347.         }
  348.  
  349.         if (($DBOBJ->isConnected()) && ($s_query=$DBOBJ->checkQuery($s_query,PQT_SELECT))) {
  350.             if ($cursor=$DBOBJ->query($s_query)) {
  351.                 $a_aktGrp=array();
  352.                 for ($i=0;$i<$i_nofGrps;$i++{
  353.                     $a_aktGrp[$i]['VAL']    =NULL;
  354.                     $a_aktGrp[$i]['OPEN']   =FALSE;
  355.                 }
  356.                 while($a_row=$cursor->fetchArrayFld()) {
  357.                     $i=0;
  358.                     while($i<$i_nofGrps{
  359.                         if ($a_aktGrp[$i]['VAL'!= $a_row['MYGRP'.$i]{
  360.                             $j=$i;
  361.                             while($j<$i_nofGrps{
  362.                                 if ($a_aktGrp[$j]['OPEN']$s_ret.="</optgroup>\n";
  363.                                 $a_aktGrp[$j]=NULL;
  364.                                 $j++;
  365.                             }
  366.                             $s_ret.="<optgroup label=\"".$a_row['MYGRP'.$i]."\">\n";
  367.                             $a_aktGrp[$i]['VAL']    $a_row['MYGRP'.$i];
  368.                             $a_aktGrp[$i]['OPEN']   TRUE;
  369.                         }
  370.                         $i++;
  371.                     }
  372.  
  373.                     $s_ret.="\t<option value=\"".$a_row['MYKEY']."\"";
  374.                     if ((!empty($a_row['MYKEY'])) && in_array($a_row['MYKEY'],$aValArr)) $s_ret .= " selected"/* <pk-05-02-17 changed if condition to increase performance />*/
  375.                     $s_ret.=">".$a_row['MYVAL']."</option>\n";
  376.                 }
  377.                 for ($i=0;$i<$i_nofGrps;$i++{
  378.                     if ($a_aktGrp[$i]['OPEN']$s_ret.="</optgroup>\n";
  379.                 }
  380.             }
  381.         }
  382.  
  383.         if ($toDisconnect$DBOBJ->disconnect();
  384.         return $s_ret;
  385.     }
  386.  
  387.     /**
  388.       * returns the html code for a grouped select
  389.       *
  390.       * @param int $nofvals number of values in group
  391.       * @param string $grpCol 
  392.       * @param array $selValues 
  393.       * @param boolean $debug 
  394.       *
  395.       * @returns string
  396.       *
  397.       * @since ap-06-05-02
  398.       *
  399.       * @todo change $GLOBALS['USRDB'] to the propriate DB by using self::getGlobalDBObjIdx()
  400.       *
  401.       ***/
  402.     function getGrpSelect(&$nofvals,$grpCol,&$selValues,$debug=FALSE{
  403.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBOPTGRPSELLIST::getGrpSelect","grpCol=".$grpCol."\nselValues=".print_r($selValues,TRUE),0);
  404.  
  405.         if (!is_array($selValues)) {
  406.             $selValues=array();
  407.         }
  408.  
  409.         $s_query="SELECT COUNT(*) AS NOFENTRIES,".$grpCol;
  410.         $s_query.=" FROM ".$this->dbTables;
  411.         if (!empty($this->dbWhere)) $s_query.=" WHERE ".$this->dbWhere;
  412.  
  413.         $s_query.=" GROUP BY $grpCol";
  414.  
  415.         if ($a_keyval=$this->getKeyValColumns($debug)) {
  416.             $s_query.=" ORDER BY ";
  417.             if (!empty($this->dbGroupBy)) $s_query.=$this->dbGroupBy.",";
  418.             if (!empty($this->dbOrderBy)) $s_query.=$this->dbOrderBy.",";
  419.             $s_query.=$a_keyval['MYVAL'];
  420.         }
  421.  
  422.         if ($debugechoDebug(__FILE__,"<p>".$s_query."</p>");
  423.  
  424.         $s_tag ="<select name='".$this->myDataArrName."[__".$this->myName."_GRP][".$grpCol."]";
  425.         $s_tag.=(($this->multiselect"[]' multiple size='3'" "' ");
  426.         $s_tag.=" ".$this->getOnChangeRelaod($this->myDataArrName).">\n";
  427.  
  428.         $s_firstVal="";$b_valFound=FALSE;
  429.         $nofvals=0;
  430.         if ($o_cursor=$GLOBALS['USRDB']->query($s_query)) {
  431.             while($a_row=$o_cursor->fetchArrayNum()) {
  432.                 $s_tag.="\t<option value=\"".$a_row[1]."\"";
  433.                 if (in_array($a_row[1],$selValues)) {
  434.                     $s_tag.=" selected";
  435.                     $b_valFound=TRUE;
  436.                 }
  437.                 $s_tag.=">".$a_row[1]."</option>\n";
  438.                 if (!intval($nofvals)) {
  439.                     $s_firstVal=$a_row[1]// cache first value in case we only have 1
  440.                 }
  441.                 $nofvals++;
  442.             }
  443.         }
  444.         if (!$b_valFound$selValues[]=$s_firstVal;
  445.  
  446.         if ($nofvals>1{
  447.             $s_tag.=$s_optTag;
  448.         else if ($nofvals==1{
  449.             return "<input type=\"hidden\" name=\"".$this->myDataArrName."[__".$this->myName."_GRP][".$grpCol."]\" value=\"$s_firstVal\">$s_firstVal&nbsp;\n";
  450.         }
  451.  
  452.  
  453.         $s_tag.="</select>\n";
  454.         return $s_tag;
  455.  
  456.     }
  457.  
  458.     /**
  459.       * returns the html code for the select
  460.       *
  461.       * @param string $aValue 
  462.       * @param array $arrName 
  463.       * @param boolean $debug 
  464.       *
  465.       * @returns string
  466.       *
  467.       * @since ap-06-05-02
  468.       *
  469.       * @todo change $GLOBALS['USRDB'] to the propriate DB by using self::getGlobalDBObjIdx()
  470.       *
  471.       ***/
  472.     function getSelectTag($aValue,$arrName="DBVAL",$debug=FALSE{
  473.         $debug=($debug || $this->fldDebug)// <pk-04-08-31>
  474.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBOPTGRPSELLIST::getSelectTag","aValue:".print_r($aValue,TRUE),0);
  475.  
  476.         if ((!$this->navigateGrps|| (empty($this->dbGroupBy))) {
  477.             // no need to do special handling
  478.             return parent::getSelectTag($aValue,$arrName,$debug);
  479.         }
  480.  
  481.         $a_grps=$this->getSelectGroups($debug);
  482.         if (!($i_nofGrps=sizeof($a_grps))) {
  483.             // empty array -> no need for special handling
  484.             return parent::getSelectTag($aValue,$arrName,$debug);
  485.         }
  486.  
  487.         $a_grpSelValues=array();
  488.  
  489.         if (is_array($_POST[$this->myDataArrName]["__".$this->myName."_GRP"])) {
  490.             // reload form
  491.             foreach($a_grps as $i_idx => $s_grpCol{
  492.                 $a_values=$_POST[$this->myDataArrName]["__".$this->myName."_GRP"][$s_grpCol];
  493.                 if (is_array($a_values)) {
  494.                     $a_grpSelValues[$i_idx]=$a_values;
  495.                 else if (!empty($a_values)){
  496.                     $a_grpSelValues[$i_idx][]=$a_values;
  497.                 }
  498.             }
  499.             if ($debugechoDebug(__FILE__,"<pre>".print_r($a_grpSelValues,TRUE)."</pre>");
  500.         else if (!empty($aValue)) {
  501.             // select value path
  502.             if (!($valArr=explode($this->mySeperator,$aValue))) // <pk-06-02-10>
  503.                 $valArr=array();
  504.                 $valArr[]=$aValue;
  505.             }
  506.             if (is_array($valArr)) {
  507.                 $a_keyval=$this->getKeyValColumns($debug);
  508.                 if ($s_query=$this->getSQLStmt(FALSE,$debug)) {
  509.                     if (!strstr($s_query,"WHERE"))  $s_query.=" WHERE ";
  510.                     else                            $s_query.=" AND ";
  511.                     $s_query.=$a_keyval['MYKEY']." IN (";
  512.                     $c_sep="";
  513.                     foreach($valArr as $s_val{
  514.                         $s_query.=$c_sep.$GLOBALS['USRDB']->qs_getSlashedValue($s_val);
  515.                         $c_sep=",";
  516.                     }
  517.                     $s_query.=")";
  518.                 }
  519.                 if ($debugechoDebug(__FILE__,"<p>value select: ".$s_query."</p>");
  520.                 if ($o_cursor=$GLOBALS['USRDB']->query($s_query)) // todo change fixed DB connection
  521.                     while($a_row=$o_cursor->fetchArrayFld()) {
  522.                         for ($i=0;$i<$i_nofGrps;$i++{
  523.                             if ((!is_array($a_grpSelValues[$i])) || (!in_array($a_row['MYGRP'.$i],$a_grpSelValues[$i]))) {
  524.                                 $a_grpSelValues[$i][]=$a_row['MYGRP'.$i];
  525.                             }
  526.                         }
  527.                     }
  528.                 }
  529.             }
  530.         }
  531.  
  532.         $s_ret="";
  533.         if ($debugechoDebug(__FILE__,"<pre>".print_r($a_grps,TRUE)."</pre>");
  534.         for ($i=0;$i<$i_nofGrps;$i++{
  535.             $i_nofGrpsVals=0;
  536.             $s_ret.=$this->getGrpSelect($i_nofGrpsVals,$a_grps[$i],$a_grpSelValues[$i],$debug);
  537.         }
  538.  
  539.         if ($debugechoDebug(__FILE__,"<pre>".print_r($a_grpSelValues,TRUE)."</pre>");
  540.  
  541.         $i_nofRows=0;
  542.  
  543.         if ($a_keyval=$this->getKeyValColumns($debug)) {
  544.             $s_query="SELECT ".$a_keyval['MYKEY']." AS MYKEY,".$a_keyval['MYVAL']." AS MYVAL";
  545.             $s_query.=" FROM ".$this->dbTables;
  546.             if (!empty($this->dbWhere)) {
  547.                 $s_query.=" WHERE ".$this->dbWhere;
  548.             else {
  549.                 $s_query.=" WHERE 1=1 "// dummy to use AND
  550.             }
  551.  
  552.             for ($i=0;$i<$i_nofGrps;$i++{
  553.                 $s_query.=" AND ".$a_grps[$i]." IN (";
  554.                 $c_sep="";
  555.                 foreach($a_grpSelValues[$ias $s_key{
  556.                     $s_query.=$c_sep.$GLOBALS['USRDB']->qs_getSlashedValue($s_key);
  557.                     $c_sep=",";
  558.                 }
  559.                 $s_query.=")";
  560.             }
  561.  
  562.             if ($a_keyval=$this->getKeyValColumns($debug)) {
  563.                 $s_query.=" ORDER BY ";
  564.                 if (!empty($this->dbGroupBy)) $s_query.=$this->dbGroupBy.",";
  565.                 if (!empty($this->dbOrderBy)) $s_query.=$this->dbOrderBy.",";
  566.                 $s_query.=$a_keyval['MYVAL'];
  567.             }
  568.  
  569.             if ($o_cursor=$GLOBALS['USRDB']->query($s_query)) {
  570.                 $s_detsel  "<select name='".$arrName."[".$this->myName."]";
  571.                 $s_detsel .=(($this->multiselect"[]' multiple " "' ");
  572.                 $s_detsel .= $this->selectAddTag;
  573.                 if (intval($this->selectsize)) {
  574.                     $s_detsel.=" size=\"".intval($this->selectsize)."\" ";
  575.                 }
  576.                 if ($this->reloadFormOnChange{
  577.                     $s_detsel.=" ".$this->getOnChangeRelaod($arrName);
  578.                 }
  579.                 if (intval($this->tabIndex)) // <pk-05-08-11>
  580.                     $s_detsel.=" tabindex=".intval($this->tabIndex);
  581.                 // </pk-05-08-11>
  582.                 $s_detsel .= ">\n";
  583.                 while($a_row=$o_cursor->fetchArrayFld()) {
  584.                     $s_detsel.="\t<option value=\"".$a_row['MYKEY']."\">".$a_row['MYVAL']."</option>\n";
  585.                     $i_nofRows++;
  586.                 }
  587.                 $s_detsel.="</select>\n";
  588.             }
  589.         }
  590.         if ($i_nofRows>0{
  591.             $s_ret.=$s_detsel;
  592.         }
  593.  
  594.         $s_ret.=$this->getReloadButton($arrName);
  595.         return $s_ret;
  596.     }
  597.  
  598.     // ###########################################################
  599.     // SEARCH FORM METHODS
  600.     // ###########################################################
  601.  
  602.  
  603.     // ###########################################################
  604.     // OBJECT HTML FORM METHODS
  605.     // ###########################################################
  606.  
  607.  
  608.     // ###########################################################
  609.     // OBJECT VALUE CHECK METHODS
  610.     // ###########################################################
  611.  
  612.  
  613. // end class DBMS_FIELD_DBOPTGRPSELLIST
  614. ?>

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