Пример #1
0
 function MoodleQuickForm_header($elementName = null, $text = null)
 {
     parent::HTML_QuickForm_header($elementName, $text);
 }
Пример #2
0
 /**
  * Called when visiting a header element
  *
  * @param HTML_QuickForm_header $header An HTML_QuickForm_header element being visited
  * @global moodle_page $PAGE
  */
 function renderHeader(&$header)
 {
     global $PAGE;
     $name = $header->getName();
     $id = empty($name) ? '' : ' id="' . $name . '"';
     $id = preg_replace(array('/\\]/', '/\\[/'), array('', '_'), $id);
     if (is_null($header->_text)) {
         $header_html = '';
     } elseif (!empty($name) && isset($this->_templates[$name])) {
         $header_html = str_replace('{header}', $header->toHtml(), $this->_templates[$name]);
     } else {
         $header_html = str_replace('{header}', $header->toHtml(), $this->_headerTemplate);
     }
     if (isset($this->_advancedElements[$name])) {
         $header_html = str_replace('{advancedimg}', $this->_advancedHTML, $header_html);
         $elementName = 'mform_showadvanced';
         if ($this->_showAdvanced == 0) {
             $buttonlabel = get_string('showadvanced', 'form');
         } else {
             $buttonlabel = get_string('hideadvanced', 'form');
         }
         $button = '<input name="' . $elementName . '" class="showadvancedbtn" value="' . $buttonlabel . '" type="submit" />';
         $PAGE->requires->js_init_call('M.form.initShowAdvanced', array(), false, moodleform::get_js_module());
         $header_html = str_replace('{button}', $button, $header_html);
     } else {
         $header_html = str_replace('{advancedimg}', '', $header_html);
         $header_html = str_replace('{button}', '', $header_html);
     }
     if ($this->_fieldsetsOpen > 0) {
         $this->_html .= $this->_closeFieldsetTemplate;
         $this->_fieldsetsOpen--;
     }
     $openFieldsetTemplate = str_replace('{id}', $id, $this->_openFieldsetTemplate);
     if ($this->_showAdvanced) {
         $advclass = ' class="advanced"';
     } else {
         $advclass = ' class="advanced hide"';
     }
     if (isset($this->_advancedElements[$name])) {
         $openFieldsetTemplate = str_replace('{advancedclass}', $advclass, $openFieldsetTemplate);
     } else {
         $openFieldsetTemplate = str_replace('{advancedclass}', '', $openFieldsetTemplate);
     }
     $this->_html .= $openFieldsetTemplate . $header_html;
     $this->_fieldsetsOpen++;
 }
Пример #3
0
 /**
  * Called when visiting a header element
  *
  * @param HTML_QuickForm_header $header An HTML_QuickForm_header element being visited
  * @global moodle_page $PAGE
  */
 function renderHeader(&$header)
 {
     global $PAGE;
     $header->_generateId();
     $name = $header->getName();
     $id = empty($name) ? '' : ' id="' . $header->getAttribute('id') . '"';
     if (is_null($header->_text)) {
         $header_html = '';
     } elseif (!empty($name) && isset($this->_templates[$name])) {
         $header_html = str_replace('{header}', $header->toHtml(), $this->_templates[$name]);
     } else {
         $header_html = str_replace('{header}', $header->toHtml(), $this->_headerTemplate);
     }
     if ($this->_fieldsetsOpen > 0) {
         $this->_html .= $this->_closeFieldsetTemplate;
         $this->_fieldsetsOpen--;
     }
     // Define collapsible classes for fieldsets.
     $arialive = '';
     $fieldsetclasses = array('clearfix');
     if (isset($this->_collapsibleElements[$header->getName()])) {
         $fieldsetclasses[] = 'collapsible';
         if ($this->_collapsibleElements[$header->getName()]) {
             $fieldsetclasses[] = 'collapsed';
         }
     }
     if (isset($this->_advancedElements[$name])) {
         $fieldsetclasses[] = 'containsadvancedelements';
     }
     $openFieldsetTemplate = str_replace('{id}', $id, $this->_openFieldsetTemplate);
     $openFieldsetTemplate = str_replace('{classes}', join(' ', $fieldsetclasses), $openFieldsetTemplate);
     $this->_html .= $openFieldsetTemplate . $header_html;
     $this->_fieldsetsOpen++;
 }
Пример #4
0
 /**
  * constructor
  *
  * @param string $elementName name of the header element
  * @param string $text text displayed in header element
  */
 public function __construct($elementName = null, $text = null)
 {
     parent::__construct($elementName, $text);
 }