本文整理汇总了PHP中moodleform::get_js_module方法的典型用法代码示例。如果您正苦于以下问题:PHP moodleform::get_js_module方法的具体用法?PHP moodleform::get_js_module怎么用?PHP moodleform::get_js_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moodleform
的用法示例。
在下文中一共展示了moodleform::get_js_module方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finishForm
/**
* Called when visiting a form, after processing all form elements
* Adds required note, form attributes, validation javascript and form content.
*
* @global moodle_page $PAGE
* @param moodleform $form Passed by reference
*/
function finishForm(&$form)
{
global $PAGE;
if ($form->isFrozen()) {
$this->_hiddenHtml = '';
}
parent::finishForm($form);
$this->_html = str_replace('{collapsebtns}', $this->_collapseButtons, $this->_html);
if (!$form->isFrozen()) {
$args = $form->getLockOptionObject();
if (count($args[1]) > 0) {
$PAGE->requires->js_init_call('M.form.initFormDependencies', $args, true, moodleform::get_js_module());
}
}
}
示例2: renderHeader
/**
* Called when visiting a header element
*
* @param object $header An HTML_QuickForm_header element being visited
* @access public
* @return void
* @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++;
}