Example #1
0
 /**
  * Class constructor
  *
  * The following keys may appear in $options array:
  * - 'language': date language
  * - 'format': Format of the date, based on PHP's date() function.
  *   The following characters are currently recognised in format string:
  *   <pre>
  *       D => Short names of days
  *       l => Long names of days
  *       d => Day numbers
  *       M => Short names of months
  *       F => Long names of months
  *       m => Month numbers
  *       Y => Four digit year
  *       y => Two digit year
  *       h => 12 hour format
  *       H => 23 hour  format
  *       i => Minutes
  *       s => Seconds
  *       a => am/pm
  *       A => AM/PM
  *   </pre>
  * - 'minYear': Minimum year in year select
  * - 'maxYear': Maximum year in year select
  * - 'addEmptyOption': Should an empty option be added to the top of
  *    each select box?
  * - 'emptyOptionValue': The value passed by the empty option.
  * - 'emptyOptionText': The text displayed for the empty option.
  * - 'optionIncrement': Step to increase the option values by (works for 'i' and 's')
  *
  * @access   public
  * @param    string  Element's name
  * @param    mixed   Label(s) for an element
  * @param    array   Options to control the element's display
  * @param    mixed   Either a typical HTML attribute string or an associative array
  */
 public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_appendName = true;
     $this->_type = 'date';
     // Added by Ivan Tcholakov, 16-MAR-2010.
     $current_year = intval(api_get_local_time());
     $this->_options['minYear'] = $current_year - 9;
     $this->_options['maxYear'] = $current_year + 1;
     //
     // set the options, do not bother setting bogus ones
     if (is_array($options)) {
         foreach ($options as $name => $value) {
             if ('language' == $name) {
                 $this->_options['language'] = isset($this->_locale[$value]) ? $value : 'en';
             } elseif (isset($this->_options[$name])) {
                 if (is_array($value) && is_array($this->_options[$name])) {
                     $this->_options[$name] = @array_merge($this->_options[$name], $value);
                 } else {
                     $this->_options[$name] = $value;
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * Class constructor
  *
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $elementLabel   (optional)Input field label in form
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
  *                                      or an associative array. Date format is passed along the attributes.
  * @param     mixed     $separator      (optional)Use a string for one separator,
  *                                      use an array to alternate the separators.
  * @access    public
  * @return    void
  */
 function __construct($elementName = null, $elementLabel = null, $attributes = null, $separator = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     if (isset($separator)) {
         $this->_separator = $separator;
     }
     $this->_type = 'hierselect';
     $this->_appendName = true;
 }
Example #3
0
 /**
  * Class constructor
  *
  * The following keys may appear in $options array:
  * - 'language': date language
  * - 'format': Format of the date, based on PHP's date() function.
  *   The following characters are currently recognised in format string:
  *   <pre>
  *       D => Short names of days
  *       l => Long names of days
  *       d => Day numbers
  *       M => Short names of months
  *       F => Long names of months
  *       m => Month numbers
  *       Y => Four digit year
  *       y => Two digit year
  *       h => 12 hour format
  *       H => 23 hour  format
  *       i => Minutes
  *       s => Seconds
  *       a => am/pm
  *       A => AM/PM
  *   </pre>
  * - 'minYear': Minimum year in year select
  * - 'maxYear': Maximum year in year select
  * - 'addEmptyOption': Should an empty option be added to the top of
  *    each select box?
  * - 'emptyOptionValue': The value passed by the empty option.
  * - 'emptyOptionText': The text displayed for the empty option.
  * - 'optionIncrement': Step to increase the option values by (works for 'i' and 's')
  *
  * @access   public
  * @param    string  Element's name
  * @param    mixed   Label(s) for an element
  * @param    array   Options to control the element's display
  * @param    mixed   Either a typical HTML attribute string or an associative array
  */
 function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_appendName = true;
     $this->_type = 'date';
     // set the options, do not bother setting bogus ones
     if (is_array($options)) {
         foreach ($options as $name => $value) {
             if ('language' == $name) {
                 $this->_options['language'] = isset($this->_locale[$value]) ? $value : 'en';
             } elseif (isset($this->_options[$name])) {
                 if (is_array($value) && is_array($this->_options[$name])) {
                     $this->_options[$name] = @array_merge($this->_options[$name], $value);
                 } else {
                     $this->_options[$name] = $value;
                 }
             }
         }
     }
 }
Example #4
0
 /**
  * constructor
  *
  * @param string $elementName (optional) name of the group
  * @param string $elementLabel (optional) group label
  * @param array $elements (optional) array of HTML_QuickForm_element elements to group
  * @param string $separator (optional) string to seperate elements.
  * @param string $appendName (optional) string to appened to grouped elements.
  */
 public function __construct($elementName = null, $elementLabel = null, $elements = null, $separator = null, $appendName = true)
 {
     parent::__construct($elementName, $elementLabel, $elements, $separator, $appendName);
 }