Source for file DBMS_FIELD_RADIOSELECT.phpclass

Documentation is available at DBMS_FIELD_RADIOSELECT.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_RADIOSELECT.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   any
  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_SELECTLIST")) {
  18.     require_once dirname(__FILE__)."/DBMS_FIELD_SELECTLIST.phpclass";
  19. }
  20.  
  21. /**
  22.   * Class DBMS_FIELD_RADIOSELECT
  23.   *
  24.   * @project    Open CSP-Management
  25.   * @package    dbms_field
  26.   * @category   any
  27.   *
  28.   * @author     Peter Krebs <p.krebs@lvus.at>
  29.   * @copyright  &copy; 2002-2005 by Peter Krebs and Landesverlag Unternehmensservice
  30.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  31.   *
  32.   * @since pk-03-12-29
  33.   *
  34.   ***/
  35.  
  36.     // ###########################################################
  37.     // OBJECT (CONST) VAR DECLARATION
  38.     // ###########################################################
  39.  
  40.     var $className     = "RadioSelect";
  41.     var $cols          = 1;
  42.  
  43.     /**
  44.       * source file of the class
  45.       *
  46.       * @var string $classSrcFile 
  47.       * @since pk-05-02-19
  48.       ***/
  49.     var $classSrcFile=__FILE__;
  50.  
  51.     /**
  52.       * @staticvar boolean $static_multiSelDisabled 
  53.       * @since pk-05-08-29
  54.       ***/
  55.     var $static_multiSelDisabled=TRUE;
  56.  
  57.     // ###########################################################
  58.     // OBJECT SETTINGS METHODS
  59.     // ###########################################################
  60.  
  61.     // ###########################################################
  62.     // FIELD DEFINITION DATA METHODS
  63.     // ###########################################################
  64.  
  65.     /**
  66.       * returns an array of field to bie shown in the edit form
  67.       * by using editTbl_echoForm
  68.       *
  69.       * the array is in the form:
  70.       *
  71.       * <code>
  72.       * [_sectionName_]
  73.       *      [TITLE] -> string
  74.       *      [_rowName_]
  75.       *         [FLDLAB]  (complete html code with <td></td>)
  76.       *         [FLDVAL] (complete html code with <td></td>)
  77.       * </code>
  78.       *
  79.       * @param boolean $debug 
  80.       *
  81.       * @returns array
  82.       *
  83.       * @since pk-06-04-26
  84.       *
  85.       ***/
  86.     function editTbl_getFieldEditArr($debug=FALSE{
  87.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBSELECTLIST::editTbl_getFieldEditArr","",0);
  88.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  89.  
  90.         $a_ret['LAYOUT']['FLD_SIZE']=NULL;      // unset parent field
  91.         if (!($this->static_fixedSelSize)) {
  92.             $a_ret['LAYOUT']['FLD_SELSIZE']=array(
  93.                 'FLDLAB'=>"Spalten",
  94.                 'FLDVAL'=>"<input name=\"cols\" size=\"30\" value=\"".$this->cols."\">"
  95.             );
  96.         }
  97.  
  98.         unset($a_ret['LAYOUT']['FLD_INPUTADD'])// not used here
  99.         unset($a_ret['SELECT']['FLD_RADCHKBOX']);
  100.         unset($_art['SELECT']['MULTISELECT'])//does not make sense here
  101.  
  102.  
  103.         return $a_ret;
  104.     }
  105.  
  106.     /*
  107.     function editTblForm($showSize=FALSE,$showNull=FALSE,$showValueList=TRUE) {
  108.         parent::editTblForm($showSize,$showNull,$showValueList);
  109.         echo "<tr><td class=\"fldName\">Spalten</td>";
  110.         echo "<td class=\"fldValue\">";
  111.         echo "<input name=\"cols\" size=\"30\" value=\"".$this->cols."\">";
  112.         echo "</td></tr>\n";
  113.     }
  114.     */
  115.  
  116.     function save({
  117.         $ret=parent::save();
  118.         $this->cols=intval($_POST['cols']);
  119.         return TRUE;
  120.     }
  121.  
  122.  
  123.     // ###########################################################
  124.     // OBJECT DATA METHODS
  125.     // ###########################################################
  126.  
  127.  
  128.     // ###########################################################
  129.     // OBJECT HTML FORM METHODS
  130.     // ###########################################################
  131.  
  132.  
  133.     /**
  134.       * @param mixed $aValue 
  135.       * @param string $arrName 
  136.       *
  137.       * @return string 
  138.       *
  139.       * @version pk-05-08-29
  140.       * @version pk-05-11-25 debug info
  141.       *
  142.       ***/
  143.     function getInputTag($aValue,$arrName="DBVAL"{
  144.         $debug=($this->fldDebug);
  145.         if ($debugecho "<p><b>DBMS_FIELD_RADIOSELECT::getInputTag($aValue,$arrName)</b> (".get_class($this).")</p><blockquote>\n";
  146.  
  147.         $this->setMyValues($arrName,$debug);
  148.  
  149.         $ret ="<table border=\"0\">";
  150.         if (is_array($this->myValues)) {
  151.             $colNr=0;
  152.             foreach($this->myValues as $key => $val{
  153.                 if ($colNr == 0$ret.="<tr>";
  154.                 $ret .="\t<td><input type=\"radio\" name=\"".$arrName."[".$this->myName."]\" value=\"$key\"";
  155.                 if (strval(trim($aValue))==strval(trim($key))) $ret .= " checked";
  156.                 $ret .=">$val</td>\n";
  157.                 $colNr++;
  158.                 if ($colNr==$this->cols{
  159.                     $ret.="</tr>";
  160.                     $colNr=0;
  161.                 }
  162.             }
  163.  
  164.             if ($colNr 0{
  165.                 while($colNr $this->cols{
  166.                     $ret .= "<td>&nbsp;</td>";
  167.                     $colNr++;
  168.                 }
  169.                 $ret .= "</tr>";
  170.             }
  171.  
  172.         }
  173.         $ret.="</table>";
  174.  
  175.         if ($debugecho "</blockquote>";
  176.  
  177.         return $ret;
  178.     }
  179.  
  180.     // ################################################
  181.     // SEARCH FORM METHODS
  182.     // ################################################
  183.  
  184.  
  185.     // ###########################################################
  186.     // OBJECT VALUE CHECK/RETURN METHODS
  187.     // ###########################################################
  188.  
  189.  
  190.  
  191.  
  192.  
  193. // end class DBMS_FIELD_RADIOSELECT
  194. ?>

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