Ejemplo n.º 1
0
 /**
  * Creates and sets a user interface for this setting given appropriate arguments
  *
  * @param int $type
  * @param string $label
  * @param array $attributes
  * @param array $options
  */
 public function make_ui($type, $label, array $attributes = null, array $options = null)
 {
     $this->uisetting = backup_setting_ui::make($this, $type, $label, $attributes, $options);
     if (is_array($options) || is_object($options)) {
         $options = (array) $options;
         switch (get_class($this->uisetting)) {
             case 'backup_setting_ui_radio':
                 // text
                 if (array_key_exists('text', $options)) {
                     $this->uisetting->set_text($options['text']);
                 }
             case 'backup_setting_ui_checkbox':
                 // value
                 if (array_key_exists('value', $options)) {
                     $this->uisetting->set_value($options['value']);
                 }
                 break;
             case 'backup_setting_ui_select':
                 // options
                 if (array_key_exists('options', $options)) {
                     $this->uisetting->set_values($options['options']);
                 }
                 break;
         }
     }
 }
Ejemplo n.º 2
0
 public function get_ui_type()
 {
     return $this->uisetting->get_type();
 }
 /**
  * Returns true if the setting is changeable, false otherwise
  *
  * @return bool
  */
 public function is_changeable()
 {
     if (count($this->values) == 1) {
         return false;
     } else {
         return parent::is_changeable();
     }
 }