/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/form/form_elements/FENumbers.inc
ViewVC logotype

Diff of /nfo/php/libs/com.newsblob.phphtmllib/form/form_elements/FENumbers.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by jonen, Thu May 6 16:27:27 2004 UTC revision 1.3 by jonen, Thu Aug 11 14:09:59 2005 UTC
# Line 6  Line 6 
6   *   *
7   * $Id$   * $Id$
8   *   *
9   * @author Walter A. Boring IV <waboring@buildabetterweb.com>   * @author Walter A. Boring IV <waboring@newsblob.com>
10   * @author Suren Markosyan <suren@bcsweb.com>   * @author Suren Markosyan <suren@bcsweb.com>
11   * @package phpHtmlLib   * @package phpHtmlLib
12   * @subpackage FormProcessing   * @subpackage FormProcessing
# Line 18  Line 18 
18  require_once($phphtmllib."/form/form_elements/FEText.inc");  require_once($phphtmllib."/form/form_elements/FEText.inc");
19    
20  /**  /**
21   * This is the FormElement which builds a   * This is the FormElement which builds a
22   * text input field that validates   * text input field that validates
23   * It validates as is_number().   * It validates as is_number().
  *  
24   *   *
25   * @author Walter A. Boring IV <waboring@buildabetterweb.com>   *
26     * @author Walter A. Boring IV <waboring@newsblob.com>
27   * @author Suren Markossian <suren@bcsweb.com>   * @author Suren Markossian <suren@bcsweb.com>
28   * @package phpHtmlLib   * @package phpHtmlLib
29   * @subpackage FormProcessing   * @subpackage FormProcessing
# Line 49  class FENumber extends FEText { Line 49  class FENumber extends FEText {
49  }  }
50    
51  /**  /**
52   * This is the float FormElement which builds a   * This is the float FormElement which builds a
53   * text input field.   * text input field.
54   * It validates as is_float().   * It validates as is_float().
  *  
55   *   *
56   * @author Walter A. Boring IV <waboring@buildabetterweb.com>   *
57     * @author Walter A. Boring IV <waboring@newsblob.com>
58   * @author Suren Markossian <suren@bcsweb.com>   * @author Suren Markossian <suren@bcsweb.com>
59   * @package phpHtmlLib   * @package phpHtmlLib
60   * @subpackage FormProcessing   * @subpackage FormProcessing
# Line 80  class FENumberFloat extends FEText { Line 80  class FENumberFloat extends FEText {
80  }  }
81    
82  /**  /**
83   * This is the Price FormElement which builds a   * This is the Price FormElement which builds a
84   * text input field.   * text input field.
85   * It validates as is_price().   * It validates as is_price().
  *  
86   *   *
87   * @author Walter A. Boring IV <waboring@buildabetterweb.com>   *
88     * @author Walter A. Boring IV <waboring@newsblob.com>
89   * @author Suren Markossian <suren@bcsweb.com>   * @author Suren Markossian <suren@bcsweb.com>
90   * @package phpHtmlLib   * @package phpHtmlLib
91   * @subpackage FormProcessing   * @subpackage FormProcessing
# Line 111  class FENumberPrice extends FEText { Line 111  class FENumberPrice extends FEText {
111  }  }
112    
113  /**  /**
114   * This is the Number Range FormElement which builds a   * This is the Number Range FormElement which builds a
115   * text input field.   * text input field.
116   * It validates as is_within_rage().   * It validates as is_within_rage().
  *  
117   *   *
118   * @author Walter A. Boring IV <waboring@buildabetterweb.com>   *
119     * @author Walter A. Boring IV <waboring@newsblob.com>
120   * @author Suren Markossian <suren@bcsweb.com>   * @author Suren Markossian <suren@bcsweb.com>
121   * @package phpHtmlLib   * @package phpHtmlLib
122   * @subpackage FormProcessing   * @subpackage FormProcessing
# Line 140  class FENumberInRange extends FEText { Line 140  class FENumberInRange extends FEText {
140      var $_label_flag = TRUE;      var $_label_flag = TRUE;
141    
142      /**      /**
143         * The 'Range' text
144         */
145        var $_range_text = "Range";
146    
147        /**
148       * The constructor       * The constructor
149       *       *
150       * @param label string - text label for the element       * @param label string - text label for the element
# Line 149  class FENumberInRange extends FEText { Line 154  class FENumberInRange extends FEText {
154       * @param int the minimum value allowable       * @param int the minimum value allowable
155       * @param int the maximum value allowable       * @param int the maximum value allowable
156       * @param boolean - add the range to the label automatically?       * @param boolean - add the range to the label automatically?
157       *       *
158       */       */
159      function FENumberInRange($label, $required = TRUE, $width = NULL,      function FENumberInRange($label, $required = TRUE, $width = NULL,
160                             $maxlength = NULL, $min=0, $max=100, $label_flag=TRUE) {                             $maxlength = NULL, $min=0, $max=100, $label_flag=TRUE) {
161          $this->FEText($label, $required, $width, $maxlength);          $this->FEText($label, $required, $width, $maxlength);
162          $this->_min = $min;          $this->_min = $min;
# Line 159  class FENumberInRange extends FEText { Line 164  class FENumberInRange extends FEText {
164          $this->_label_flag = $label_flag;          $this->_label_flag = $label_flag;
165      }      }
166    
167      function get_label() {      /**
168         * This function builds and returns a
169         * label object based on the label text
170         * and error conditions
171         *
172         * @param FormContent object that holds the
173         *        required field marker
174         * @param string this string allows us to use this
175         *        method and wrap any string as a FormElement
176         *        label.
177         * @return object SPANtag
178         */
179        function get_label($form_content=NULL, $label='', $indent_flag=TRUE) {
180    
181          $label = $this->get_label_text();          $label = $this->get_label_text();
182    
183          if ($this->_label_flag) {          if ($this->_label_flag) {
184              $label .= " (".$this->_min."-".$this->_max.")";              $label .= " ".$this->get_range_string();
185          }          }
186    
187          if ($this->is_required()) $label .= ' ' . $this->get_required_symbol();          if ($this->_label_colon_flag) {
188                $label .= ':';              
189            }
190    
191          $span = html_span("formlabel", $label);          if ($this->is_required()) {
192                $text = ($form_content ? $form_content->_required_field_marker :
193                         $this->get_required_symbol()). ' '.$label;
194            } else {
195                if ($indent_flag) {
196                    $text = '&nbsp;&nbsp;'.$label;                  
197                } else {
198                    $text = $label;
199                }
200            }
201    
202            $span = html_span("formlabel", $text);
203    
204          if ($this->has_error()) {          if ($this->has_error()) {
205              $span->set_tag_attribute("style","color:red;");              $span->set_tag_attribute("style","color:red;");
# Line 178  class FENumberInRange extends FEText { Line 208  class FENumberInRange extends FEText {
208          return $span;          return $span;
209      }      }
210    
211    
212    
213        /**
214         * This function builds a string for the range display
215         *
216         * @return string
217         */
218        function get_range_string($include_range=TRUE) {
219            if ($include_range) {
220                $str = $this->_range_text.": ";
221            } else {
222                $str = '';
223            }
224    
225            return "(".$str.$this->_min."-".$this->_max.")";
226        }
227    
228      /**      /**
229       * This method validates the data       * This method validates the data
230       * for this Form Element.       * for this Form Element.

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed