Exemplo n.º 1
0
 /**
  * Class constructor
  *
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $value          (optional)Input field value
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 function __construct($elementName = null, $value = null, $attributes = null)
 {
     parent::__construct($elementName, null, $attributes);
     $this->_persistantFreeze = false;
     $this->setValue($value);
     $this->setType('button');
 }
Exemplo n.º 2
0
 /**
  * Class constructor
  * 
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $elementLabel   (optional)Input field value
  * @param     string    $text           (optional)Checkbox display text
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string 
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function __construct($elementName = null, $elementLabel = null, $text = '', $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_text = $text;
     $this->setType('checkbox');
     $this->updateAttributes(array('value' => 1));
 }
Exemplo n.º 3
0
 /**
  * constructor
  *
  * @param string $elementName (optional) name of the recaptcha element
  * @param string $elementLabel (optional) label for recaptcha element
  * @param mixed $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = null)
 {
     global $CFG;
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_type = 'recaptcha';
     if (is_https()) {
         $this->_https = true;
     } else {
         $this->_https = false;
     }
 }
Exemplo n.º 4
0
 /**
  * Class constructor
  *
  * @param     string    Input field name attribute
  * @param     mixed     Label(s) for a field
  * @param     string    Text to display near the radio
  * @param     string    Input field value
  * @param     mixed     Either a typical HTML attribute string or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function __construct($elementName = null, $elementLabel = null, $text = null, $value = null, $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     if (isset($value)) {
         $this->setValue($value);
     }
     $this->_persistantFreeze = true;
     $this->setType('radio');
     $this->_text = $text;
     $this->_generateId();
 }
Exemplo n.º 5
0
 /**
  * Class constructor
  *
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $elementLabel   (optional)Input field value
  * @param     string    $text           (optional)Checkbox display text
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function HTML_QuickForm_checkbox($elementName = null, $elementLabel = null, $text = '', $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_text = $text;
     $this->setType('checkbox');
     if (!isset($attributes['value'])) {
         $this->updateAttributes(array('value' => 1));
     } else {
         $this->updateAttributes(array('value' => $attributes['value']));
     }
     $this->_generateId();
 }
Exemplo n.º 6
0
 /**
  * @param string $name input name example 'submit'
  * @param string $text button text to show
  * @param string $icon icons based in font-awesome
  * @param string $style i.e default|primary|success|info|warning|danger|link
  * @param string $size large|default|small|extra-small
  * @param string $class
  * @param array $attributes
  */
 public function __construct($name, $text, $icon = 'check', $style = 'default', $size = 'default', $class = null, $attributes = array())
 {
     $this->setIcon($icon);
     $this->setStyle($style);
     $this->setSize($size);
     $this->setClass($class);
     $columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null;
     $this->setColumnsSize($columnsSize);
     parent::__construct($name, null, $attributes);
     $this->_persistantFreeze = false;
     $this->setValue($text);
     $this->setType('submit');
 }
Exemplo n.º 7
0
 /**
  * Constructor.
  *
  * @param string $elementName (optional) name of the listing.
  * @param string $elementLabel (optional) listing label.
  * @param array $attributes (optional) Either a typical HTML attribute string or an associative array.
  * @param array $options set of options to initalize listing.
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = null, $options = array())
 {
     $this->_type = 'listing';
     if (!empty($options['items'])) {
         $this->items = $options['items'];
     }
     if (!empty($options['showall'])) {
         $this->showall = $options['showall'];
     } else {
         $this->showall = get_string('showall');
     }
     if (!empty($options['hideall'])) {
         $this->hideall = $options['hideall'];
     } else {
         $this->hideall = get_string('hide');
     }
     parent::__construct($elementName, $elementLabel, $attributes);
 }
Exemplo n.º 8
0
 /**
  * Class constructor
  *
  * @param     string    Input field name attribute
  * @param     mixed     Label(s) for a field
  * @param     string    Text to display near the radio
  * @param     string    Input field value
  * @param     mixed     Either a typical HTML attribute string or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function __construct($elementName = null, $elementLabel = null, $text = null, $value = null, $attributes = null)
 {
     $this->labelClass = isset($attributes['label-class']) ? $attributes['label-class'] : '';
     $this->radioClass = isset($attributes['radio-class']) ? $attributes['radio-class'] : 'radio';
     if (isset($attributes['label-class'])) {
         unset($attributes['label-class']);
     }
     if (isset($attributes['radio-class'])) {
         unset($attributes['radio-class']);
     }
     parent::__construct($elementName, $elementLabel, $attributes);
     if (isset($value)) {
         $this->setValue($value);
     }
     $this->_persistantFreeze = true;
     $this->setType('radio');
     $this->_text = $text;
     $this->_generateId();
 }
Exemplo n.º 9
0
 /**
  * Class constructor
  *
  * @param string $elementName    (optional)Input field name attribute
  * @param string $elementLabel   (optional)Input field label
  * @param mixed  $attributes     (optional)Either a typical HTML attribute string
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = array())
 {
     if (is_array($attributes) || empty($attributes)) {
         $attributes['class'] = 'form-control';
     }
     $inputSize = isset($attributes['input-size']) ? $attributes['input-size'] : null;
     $this->setInputSize($inputSize);
     $columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null;
     $this->setColumnsSize($columnsSize);
     $icon = isset($attributes['icon']) ? $attributes['icon'] : null;
     $this->setIcon($icon);
     if (!empty($inputSize)) {
         unset($attributes['input-size']);
     }
     if (!empty($icon)) {
         unset($attributes['icon']);
     }
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->setType('text');
 }
Exemplo n.º 10
0
 /**
  * Class constructor
  *
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $elementLabel   (optional)Input field value
  * @param     string    $text           (optional)Checkbox display text
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function __construct($elementName = null, $elementLabel = null, $text = '', $attributes = null)
 {
     $this->labelClass = isset($attributes['label-class']) ? $attributes['label-class'] : '';
     $this->checkboxClass = isset($attributes['checkbox-class']) ? $attributes['checkbox-class'] : 'checkbox';
     if (isset($attributes['label-class'])) {
         unset($attributes['label-class']);
     }
     if (isset($attributes['checkbox-class'])) {
         unset($attributes['checkbox-class']);
     }
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_text = $text;
     $this->setType('checkbox');
     if (!isset($attributes['value'])) {
         $this->updateAttributes(array('value' => 1));
     } else {
         $this->updateAttributes(array('value' => $attributes['value']));
     }
     $this->_generateId();
 }
Exemplo n.º 11
0
 /**
  * Constructor
  *
  * @param string $elementName (optional) name of the filepicker
  * @param string $elementLabel (optional) filepicker label
  * @param array $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  * @param array $options set of options to initalize filepicker
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = null, $options = null)
 {
     global $CFG, $PAGE;
     $options = (array) $options;
     foreach ($options as $name => $value) {
         if (array_key_exists($name, $this->_options)) {
             $this->_options[$name] = $value;
         }
     }
     if (empty($options['return_types'])) {
         $this->_options['return_types'] = FILE_INTERNAL;
     }
     $fpmaxbytes = 0;
     if (!empty($options['maxbytes'])) {
         $fpmaxbytes = $options['maxbytes'];
     }
     $coursemaxbytes = 0;
     if (!empty($PAGE->course->maxbytes)) {
         $coursemaxbytes = $PAGE->course->maxbytes;
     }
     $this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $coursemaxbytes, $fpmaxbytes);
     $this->_type = 'filepicker';
     parent::__construct($elementName, $elementLabel, $attributes);
 }
Exemplo n.º 12
0
 /**
  * Class constructor
  * 
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $elementLabel   (optional)Input field label
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string 
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->setType('text');
 }
Exemplo n.º 13
0
 /**
  * Class constructor
  * 
  * @param     string    $elementName    (optional)Element name attribute
  * @param     string    $src            (optional)Image source
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string 
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function __construct($elementName = null, $src = '', $attributes = null)
 {
     parent::__construct($elementName, null, $attributes);
     $this->setType('image');
     $this->setSource($src);
 }
Exemplo n.º 14
0
 /**
  * Class constructor
  * 
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $elementLabel   (optional)Input field label
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string 
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  * @throws    
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->setType('password');
 }
Exemplo n.º 15
0
 /**
  * Class constructor
  *
  * @param string $elementName Input field name attribute
  * @param mixed $elementLabel Label(s) for the input field
  * @param mixed $attributes Either a typical HTML attribute string or an associative array
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->gradingattributes = $attributes;
 }
Exemplo n.º 16
0
 /**
  * Class constructor
  *
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $value          (optional)Input field value
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function HTML_QuickForm_hidden($elementName = null, $value = '', $attributes = null)
 {
     parent::__construct($elementName, null, $attributes);
     $this->setType('hidden');
     $this->setValue($value);
 }
Exemplo n.º 17
0
 /**
  * Class constructor
  *
  * @param string $elementName  Name
  * @param mixed  $elementLabel Label for the CAPTCHA
  * @param array  $options      Options for the Text_CAPTCHA package
  * <ul>
  *  <li>'sessionVar' (string)  name of session variable containing
  *                             the Text_CAPTCHA instance (defaults to
  *                             _HTML_QuickForm_CAPTCHA.)</li>
  *  <li>Other options depend on the driver used</li>
  * </ul>
  * @param mixed  $attributes   HTML Attributes for the <a> tag surrounding
  *                             the image. Can be a string or array.
  *
  * @access public
  */
 function HTML_QuickForm_CAPTCHA($elementName = null, $elementLabel = null, $options = null, $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->setType('CAPTCHA_' . $this->_CAPTCHA_driver);
     if (is_array($options)) {
         $this->_options = array_merge($this->_options, $options);
     }
 }
Exemplo n.º 18
0
 /**
  * Class constructor
  * 
  * @param     string    Input field name attribute
  * @param     string    Input field value
  * @param     mixed     Either a typical HTML attribute string or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 public function __construct($elementName = null, $value = null, $attributes = null)
 {
     parent::__construct($elementName, null, $attributes);
     $this->setValue($value);
     $this->setType('submit');
 }
Exemplo n.º 19
0
 /**
  * Class constructor
  *
  * @param     string    Input field name attribute
  * @param     string    Input field label
  * @param     mixed     (optional)Either a typical HTML attribute string
  *                      or an associative array
  * @since     1.0
  * @access    public
  */
 function HTML_QuickForm_file($elementName = null, $elementLabel = null, $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
     $this->setType('file');
 }
Exemplo n.º 20
0
 /**
  * Constructor for rubric editor
  *
  * @param string $elementName
  * @param string $elementLabel
  * @param array $attributes
  */
 public function __construct($elementName = null, $elementLabel = null, $attributes = null)
 {
     parent::__construct($elementName, $elementLabel, $attributes);
 }
Exemplo n.º 21
0
 /**
  * Class constructor
  *
  * @param     string    $elementName    (optional)Input field name attribute
  * @param     string    $value          (optional)Input field value
  * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
  *                                      or an associative array
  * @since     1.0
  * @access    public
  * @return    void
  */
 function __construct($elementName = null, $value = '', $attributes = null)
 {
     parent::__construct($elementName, null, $attributes);
     $this->setType('hidden');
     $this->setValue($value);
 }