| Línea 1426... |
Línea 1426... |
| 1426 |
* @param string $enhancement which init function should be called
|
1426 |
* @param string $enhancement which init function should be called
|
| 1427 |
* @param array $options options passed to javascript
|
1427 |
* @param array $options options passed to javascript
|
| 1428 |
* @param array $strings strings for javascript
|
1428 |
* @param array $strings strings for javascript
|
| 1429 |
* @deprecated since Moodle 3.3 MDL-57471
|
1429 |
* @deprecated since Moodle 3.3 MDL-57471
|
| 1430 |
*/
|
1430 |
*/
|
| 1431 |
function init_javascript_enhancement($element, $enhancement, array $options=array(), array $strings=null) {
|
1431 |
function init_javascript_enhancement($element, $enhancement, array $options=array(), ?array $strings=null) {
|
| 1432 |
debugging('$mform->init_javascript_enhancement() is deprecated and no longer does anything. '.
|
1432 |
debugging('$mform->init_javascript_enhancement() is deprecated and no longer does anything. '.
|
| 1433 |
'smartselect uses should be converted to the searchableselector form element.', DEBUG_DEVELOPER);
|
1433 |
'smartselect uses should be converted to the searchableselector form element.', DEBUG_DEVELOPER);
|
| 1434 |
}
|
1434 |
}
|
| Línea 1435... |
Línea 1435... |
| 1435 |
|
1435 |
|
| Línea 1773... |
Línea 1773... |
| 1773 |
$this->updateAttributes(array('class'=>$oldclass.' mform'));
|
1773 |
$this->updateAttributes(array('class'=>$oldclass.' mform'));
|
| 1774 |
}else {
|
1774 |
}else {
|
| 1775 |
$this->updateAttributes(array('class'=>'mform'));
|
1775 |
$this->updateAttributes(array('class'=>'mform'));
|
| 1776 |
}
|
1776 |
}
|
| 1777 |
$this->_reqHTML = '<span class="req">' . $OUTPUT->pix_icon('req', get_string('requiredelement', 'form')) . '</span>';
|
1777 |
$this->_reqHTML = '<span class="req">' . $OUTPUT->pix_icon('req', get_string('requiredelement', 'form')) . '</span>';
|
| 1778 |
$this->_advancedHTML = '<span class="adv">' . $OUTPUT->pix_icon('adv', get_string('advancedelement', 'form')) . '</span>';
|
1778 |
$this->_advancedHTML = '<span class="adv"></span>';
|
| - |
|
1779 |
$this->setRequiredNote(
|
| - |
|
1780 |
get_string(
|
| - |
|
1781 |
identifier: 'somefieldsrequired',
|
| - |
|
1782 |
component: 'form',
|
| - |
|
1783 |
a: $OUTPUT->pix_icon(
|
| - |
|
1784 |
pix: 'req',
|
| 1779 |
$this->setRequiredNote(get_string('somefieldsrequired', 'form', $OUTPUT->pix_icon('req', get_string('requiredelement', 'form'))));
|
1785 |
alt: get_string('requiredelement', 'form'),
|
| - |
|
1786 |
attributes: ['aria-hidden' => 'true'],
|
| - |
|
1787 |
),
|
| - |
|
1788 |
),
|
| - |
|
1789 |
);
|
| 1780 |
}
|
1790 |
}
|
| Línea 1781... |
Línea 1791... |
| 1781 |
|
1791 |
|
| 1782 |
/**
|
1792 |
/**
|
| 1783 |
* Old syntax of class constructor. Deprecated in PHP7.
|
1793 |
* Old syntax of class constructor. Deprecated in PHP7.
|
| Línea 2744... |
Línea 2754... |
| 2744 |
|
2754 |
|
| 2745 |
document.getElementById(\'' . $elem->_attributes['id'] . '\').addEventListener(\'change\', function(ev) {
|
2755 |
document.getElementById(\'' . $elem->_attributes['id'] . '\').addEventListener(\'change\', function(ev) {
|
| 2746 |
' . $valFunc . '
|
2756 |
' . $valFunc . '
|
| 2747 |
});
|
2757 |
});
|
| 2748 |
';
|
- |
|
| 2749 |
}
|
2758 |
';
|
| 2750 |
}
|
2759 |
|
| 2751 |
// This handles both randomised (MDL-65217) and non-randomised IDs.
|
2760 |
// This handles both randomised (MDL-65217) and non-randomised IDs.
|
| 2752 |
$errorid = preg_replace('/^id_/', 'id_error_', $elem->_attributes['id']);
|
2761 |
$errorid = preg_replace('/^id_/', 'id_error_', $elem->_attributes['id']);
|
| 2753 |
$validateJS .= '
|
2762 |
$validateJS .= '
|
| 2754 |
ret = validate_' . $this->_formName . '_' . $escapedElementName.'(frm.elements[\''.$elementName.'\'], \''.$escapedElementName.'\') && ret;
|
2763 |
ret = validate_' . $this->_formName . '_' . $escapedElementName.'(frm.elements[\''.$elementName.'\'], \''.$escapedElementName.'\') && ret;
|
| 2755 |
if (!ret && !first_focus) {
|
2764 |
if (!ret && !first_focus) {
|
| 2756 |
first_focus = true;
|
2765 |
first_focus = true;
|
| 2757 |
const element = document.getElementById("' . $errorid . '");
|
2766 |
const element = document.getElementById("' . $errorid . '");
|
| Línea 2760... |
Línea 2769... |
| 2760 |
element.focus();
|
2769 |
element.focus();
|
| 2761 |
}
|
2770 |
}
|
| 2762 |
}
|
2771 |
}
|
| 2763 |
';
|
2772 |
';
|
| Línea -... |
Línea 2773... |
| - |
|
2773 |
|
| - |
|
2774 |
}
|
| 2764 |
|
2775 |
}
|
| 2765 |
// Fix for bug displaying errors for elements in a group
|
2776 |
// Fix for bug displaying errors for elements in a group
|
| 2766 |
//unset($element);
|
2777 |
//unset($element);
|
| 2767 |
//$element =& $this->getElement($elementName);
|
2778 |
//$element =& $this->getElement($elementName);
|
| 2768 |
//end of fix
|
2779 |
//end of fix
|
| Línea 3191... |
Línea 3202... |
| 3191 |
/** @var string Template used when closing a fieldset */
|
3202 |
/** @var string Template used when closing a fieldset */
|
| 3192 |
var $_closeFieldsetTemplate = "\n\t\t</div></fieldset>";
|
3203 |
var $_closeFieldsetTemplate = "\n\t\t</div></fieldset>";
|
| Línea 3193... |
Línea 3204... |
| 3193 |
|
3204 |
|
| 3194 |
/** @var string Required Note template string */
|
3205 |
/** @var string Required Note template string */
|
| 3195 |
var $_requiredNoteTemplate =
|
3206 |
var $_requiredNoteTemplate =
|
| Línea 3196... |
Línea 3207... |
| 3196 |
"\n\t\t<div class=\"fdescription required\">{requiredNote}</div>";
|
3207 |
"\n\t\t<div class=\"fdescription required\" aria-hidden=\"true\">{requiredNote}</div>";
|
| 3197 |
|
3208 |
|
| 3198 |
/**
|
3209 |
/**
|
| 3199 |
* Collapsible buttons string template.
|
3210 |
* Collapsible buttons string template.
|
| Línea 3370... |
Línea 3381... |
| 3370 |
$attributes = $group->getAttributes();
|
3381 |
$attributes = $group->getAttributes();
|
| 3371 |
$attributes['id'] = $groupid;
|
3382 |
$attributes['id'] = $groupid;
|
| 3372 |
$group->updateAttributes($attributes);
|
3383 |
$group->updateAttributes($attributes);
|
| 3373 |
$advanced = isset($this->_advancedElements[$group->getName()]);
|
3384 |
$advanced = isset($this->_advancedElements[$group->getName()]);
|
| Línea -... |
Línea 3385... |
| - |
|
3385 |
|
| 3374 |
|
3386 |
$isinstickyfooter = $group->getName() && ($this->_stickyfooterelement == $group->getName());
|
| 3375 |
$html = $OUTPUT->mform_element($group, $required, $advanced, $error, false);
|
3387 |
$html = $OUTPUT->mform_element($group, $required, $advanced, $error, $isinstickyfooter);
|
| 3376 |
$fromtemplate = !empty($html);
|
3388 |
$fromtemplate = !empty($html);
|
| 3377 |
if (!$fromtemplate) {
|
3389 |
if (!$fromtemplate) {
|
| 3378 |
if (method_exists($group, 'getElementTemplateType')) {
|
3390 |
if (method_exists($group, 'getElementTemplateType')) {
|
| 3379 |
$html = $this->_elementTemplates[$group->getElementTemplateType()];
|
3391 |
$html = $this->_elementTemplates[$group->getElementTemplateType()];
|
| Línea 3405... |
Línea 3417... |
| 3405 |
}
|
3417 |
}
|
| 3406 |
$html = str_replace('{emptylabel}', $emptylabel, $html);
|
3418 |
$html = str_replace('{emptylabel}', $emptylabel, $html);
|
| 3407 |
}
|
3419 |
}
|
| 3408 |
$this->_templates[$group->getName()] = $html;
|
3420 |
$this->_templates[$group->getName()] = $html;
|
| 3409 |
// Check if the element should be displayed in the sticky footer.
|
3421 |
// Check if the element should be displayed in the sticky footer.
|
| 3410 |
if ($group->getName() && ($this->_stickyfooterelement == $group->getName())) {
|
3422 |
if ($isinstickyfooter) {
|
| 3411 |
$stickyfooter = new core\output\sticky_footer($html);
|
3423 |
$stickyfooter = new core\output\sticky_footer($html);
|
| 3412 |
$html = $OUTPUT->render($stickyfooter);
|
3424 |
$html = $OUTPUT->render($stickyfooter);
|
| 3413 |
}
|
3425 |
}
|
| Línea 3414... |
Línea 3426... |
| 3414 |
|
3426 |
|