Ejemplo n.º 1
0
 /**
  * constructor
  *
  * @param string $elementName (optional) name of the checkbox
  * @param string $elementLabel (optional) checkbox label
  * @param string $text (optional) Text to put after the checkbox
  * @param mixed $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  * @param mixed $values (optional) Values to pass if checked or not checked
  */
 function MoodleQuickForm_advcheckbox($elementName = null, $elementLabel = null, $text = null, $attributes = null, $values = null)
 {
     if ($values === null) {
         $values = array(0, 1);
     }
     if (!is_null($attributes['group'])) {
         $this->_group = 'checkboxgroup' . $attributes['group'];
         unset($attributes['group']);
         if (is_null($attributes)) {
             $attributes = array();
             $attributes['class'] .= " {$this->_group}";
         } elseif (is_array($attributes)) {
             if (isset($attributes['class'])) {
                 $attributes['class'] .= " {$this->_group}";
             } else {
                 $attributes['class'] = $this->_group;
             }
         } elseif ($strpos = stripos($attributes, 'class="')) {
             $attributes = str_ireplace('class="', 'class="' . $this->_group . ' ', $attributes);
         } else {
             $attributes .= ' class="' . $this->_group . '"';
         }
     }
     parent::HTML_QuickForm_advcheckbox($elementName, $elementLabel, $text, $attributes, $values);
 }
Ejemplo n.º 2
0
 /**
  * Class constructor
  *
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $elementLabel   (optional)Input field label
  * @param     string    $text           (optional)Text to put after the checkbox
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
  *                                      or an associative array
  * @param     mixed     $values         (optional)Values to pass if checked or not checked
  *
  * @since     1.0
  * @access    public
  * @return    void
  */
 function MoodleQuickForm_advcheckbox($elementName = null, $elementLabel = null, $text = null, $attributes = null, $values = null)
 {
     if ($values === null) {
         $values = array(0, 1);
     }
     parent::HTML_QuickForm_advcheckbox($elementName, $elementLabel, $text, $attributes, $values);
 }