예제 #1
0
 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $first = (int) $this->element['first'];
     $last = (int) $this->element['last'];
     $step = (int) $this->element['step'];
     // Sanity checks.
     if ($step == 0) {
         // Step of 0 will create an endless loop.
         return $options;
     } else {
         if ($first < $last && $step < 0) {
             // A negative step will never reach the last number.
             return $options;
         } else {
             if ($first > $last && $step > 0) {
                 // A position step will never reach the last number.
                 return $options;
             }
         }
     }
     // Build the options array.
     for ($i = $first; $i <= $last; $i += $step) {
         $options[] = RokCommon_Config_HTML_Select::option($i);
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
예제 #2
0
 /**
  * Method to get the field options.
  *
  * @return    array    The field option objects.
  * @since    1.6
  */
 protected function getOptions()
 {
     global $gantry;
     $options = array();
     $options = parent::getOptions();
     $choices = array("linear", "Quad.easeOut", "Quad.easeIn", "Quad.easeInOut", "Cubic.easeOut", "Cubic.easeIn", "Cubic.easeInOut", "Quart.easeOut", "Quart.easeIn", "Quart.easeInOut", "Quint.easeOut", "Quint.easeIn", "Quint.easeInOut", "Expo.easeOut", "Expo.easeIn", "Expo.easeInOut", "Circ.easeOut", "Circ.easeIn", "Circ.easeInOut", "Sine.easeOut", "Sine.easeIn", "Sine.easeInOut", "Back.easeOut", "Back.easeIn", "Back.easeInOut", "Bounce.easeOut", "Bounce.easeIn", "Bounce.easeInOut", "Elastic.easeOut", "Elastic.easeIn", "Elastic.easeInOut");
     foreach ($choices as $choice) {
         // Create a new option object based on the <option /> element.
         $tmp = RokCommon_Config_HTML_Select::option($choice, $choice, 'value', 'text', false);
         $options[] = $tmp;
     }
     return $options;
 }
예제 #3
0
 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = RokCommon_Config_HTML_Select::option((string) $option['value'], trim((string) $option), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     reset($options);
     return $options;
 }
예제 #4
0
 /**
  * Generates a selection list of integers.
  *
  * @param int The start integer
  * @param int The end integer
  * @param int The increment
  * @param string The value of the HTML name attribute
  * @param mixed Additional HTML attributes for the <select> tag, an array of
  * attributes, or an array of options. Treated as options if it is the last
  * argument passed.
  * @param mixed The key that is selected
  * @param string The printf format to be applied to the number
  * @return string HTML for the select list
  */
 public static function integerlist($start, $end, $inc, $name, $attribs = null, $selected = null, $format = '')
 {
     // Set default options
     $options = array_merge(RokCommon_Config_HTML_Select::$formatOptions, array('format.depth' => 0, 'option.format' => '', 'id' => null));
     if (is_array($attribs) && func_num_args() == 5) {
         // Assume we have an options array
         $options = array_merge($options, $attribs);
         // Extract the format and remove it from downstream options
         $format = $options['option.format'];
         unset($options['option.format']);
     } else {
         // Get options from the parameters
         $options['list.attr'] = $attribs;
         $options['list.select'] = $selected;
     }
     $start = intval($start);
     $end = intval($end);
     $inc = intval($inc);
     $data = array();
     for ($i = $start; $i <= $end; $i += $inc) {
         $data[$i] = $format ? sprintf($format, $i) : $i;
     }
     // Tell genericlist() to use array keys
     $options['option.key'] = null;
     return RokCommon_Config_HTML_Select::genericlist($data, $name, $options);
 }
예제 #5
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 public function getInput()
 {
     // Initialize variables.
     $html = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Get the field groups.
     $groups = (array) $this->getGroups();
     // Create a read-only list (no name) with a hidden input to store the value.
     if ((string) $this->element['readonly'] == 'true') {
         $html[] = RokCommon_Config_HTML_Select::groupedlist($groups, null, array('list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false, 'option.text.toHtml' => false));
         $html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
     } else {
         $html[] = RokCommon_Config_HTML_Select::groupedlist($groups, $this->name, array('list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false, 'option.text.toHtml' => false));
     }
     return implode($html);
 }