Beispiel #1
0
 function MoodleQuickForm_htmleditor($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
 {
     parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes);
     // set the options, do not bother setting bogus ones
     if (is_array($options)) {
         foreach ($options as $name => $value) {
             if (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;
                 }
             }
         }
     }
     if ($this->_options['canUseHtmlEditor'] == 'detect') {
         $this->_options['canUseHtmlEditor'] = can_use_html_editor();
     }
     if ($this->_options['canUseHtmlEditor']) {
         $this->_type = 'htmleditor';
         //$this->_elementTemplateType='wide';
     } else {
         $this->_type = 'textarea';
     }
     $this->_canUseHtmlEditor = $this->_options['canUseHtmlEditor'];
 }
 /**
  * Constructor
  * @param string $textareaName (optional) name of the text field
  * @param string $textareaLabel (optional) text field label
  * @param array $attributes (optional) Either a typical HTML attribute string or an associative array
  * @param string $buttonName (optional) name of the button
  * @param array $elementLinks (optional) link on button image and link on new page
  */
 public function qtype_poasquestion_text_and_button($textareaName = null, $textareaLabel = null, $attributes = null, $buttonName = null, $elementLinks = null, $dialogWidth = null)
 {
     global $PAGE;
     parent::MoodleQuickForm_textarea($textareaName, $textareaLabel, $attributes);
     $this->buttonName = $buttonName;
     $this->linkToPage = $elementLinks['link_to_page'];
     $this->linkToBtnImage = $elementLinks['link_to_button_image'];
     if ($dialogWidth === null) {
         $dialogWidth = '90%';
     }
     $PAGE->requires->jquery();
     $PAGE->requires->jquery_plugin('ui');
     $PAGE->requires->jquery_plugin('ui-css');
     $PAGE->requires->string_for_js('savechanges', 'moodle');
     $PAGE->requires->string_for_js('cancel', 'moodle');
     $PAGE->requires->string_for_js('close', 'editor');
     // dependencies
     //$PAGE->requires->js('/question/type/poasquestion/jquery.elastic.1.6.11.js');
     $PAGE->requires->jquery_plugin('poasquestion-jquerymodule', 'qtype_poasquestion');
     if (!self::$_poasquestion_text_and_button_included) {
         $jsargs = array($dialogWidth, $this->getDialogTitle());
         $PAGE->requires->js_init_call('M.poasquestion_text_and_button.init', $jsargs, true, $this->jsmodule);
         self::$_poasquestion_text_and_button_included = true;
     }
 }
Beispiel #3
0
 function MoodleQuickForm_wikieditor($elementName = null, $elementLabel = null, $attributes = null)
 {
     if (isset($attributes['wiki_format'])) {
         $this->wikiformat = $attributes['wiki_format'];
         unset($attributes['wiki_format']);
     }
     parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes);
 }
Beispiel #4
0
 /**
  * Constructor
  *
  * @param string $elementName (optional) name of the html editor
  * @param string $elementLabel (optional) editor label
  * @param array $options set of options to create html editor
  * @param array $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  */
 function MoodleQuickForm_htmleditor($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
 {
     parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes);
     // set the options, do not bother setting bogus ones
     if (is_array($options)) {
         foreach ($options as $name => $value) {
             if (array_key_exists($name, $this->_options)) {
                 if (is_array($value) && is_array($this->_options[$name])) {
                     $this->_options[$name] = @array_merge($this->_options[$name], $value);
                 } else {
                     $this->_options[$name] = $value;
                 }
             }
         }
     }
     $this->_type = 'htmleditor';
     editors_head_setup();
 }