Permalink
Browse files

MDL-57490 scorm: convert legacy js to jquery

  • Loading branch information...
danpoltawski committed Dec 21, 2016
1 parent 6db06d0 commit d574114aeddc1b7b4e04dc5779bac4a439d6ab23
@@ -492,10 +492,20 @@ public function display($scorm, $cm, $course, $download) {
if ($candelete) {
echo \html_writer::start_tag('table', array('id' => 'commands'));
echo \html_writer::start_tag('tr').\html_writer::start_tag('td');
echo \html_writer::link('javascript:select_all_in(\'DIV\', null, \'scormtablecontainer\');',
get_string('selectall', 'scorm')).' / ';
echo \html_writer::link('javascript:deselect_all_in(\'DIV\', null, \'scormtablecontainer\');',
get_string('selectnone', 'scorm'));
echo \html_writer::link('#', get_string('selectall', 'scorm'), array('id' => 'checkattempts'));
echo ' / ';
echo \html_writer::link('#', get_string('selectnone', 'scorm'), array('id' => 'uncheckattempts'));
$PAGE->requires->js_amd_inline("
require(['jquery'], function($) {
$('#checkattempts').click(function(e) {
$('#attemptsform').find('input:checkbox').prop('checked', true);
e.preventDefault();
});
$('#uncheckattempts').click(function(e) {
$('#attemptsform').find('input:checkbox').prop('checked', false);
e.preventDefault();
});
});");
echo '  ';
echo \html_writer::empty_tag('input', array('type' => 'submit',
'value' => get_string('deleteselected', 'scorm'),
@@ -582,10 +582,20 @@ public function display($scorm, $cm, $course, $download) {
if ($candelete) {
echo \html_writer::start_tag('table', array('id' => 'commands'));
echo \html_writer::start_tag('tr').\html_writer::start_tag('td');
echo \html_writer::link('javascript:select_all_in(\'DIV\', null, \'scormtablecontainer\');',
get_string('selectall', 'scorm')).' / ';
echo \html_writer::link('javascript:deselect_all_in(\'DIV\', null, \'scormtablecontainer\');',
get_string('selectnone', 'scorm'));
echo \html_writer::link('#', get_string('selectall', 'scorm'), array('id' => 'checkattempts'));
echo ' / ';
echo \html_writer::link('#', get_string('selectnone', 'scorm'), array('id' => 'uncheckattempts'));
$PAGE->requires->js_amd_inline("
require(['jquery'], function($) {
$('#checkattempts').click(function(e) {
$('#attemptsform').find('input:checkbox').prop('checked', true);
e.preventDefault();
});
$('#uncheckattempts').click(function(e) {
$('#attemptsform').find('input:checkbox').prop('checked', false);
e.preventDefault();
});
});");
echo '  ';
echo \html_writer::empty_tag('input', array('type' => 'submit',
'value' => get_string('deleteselected', 'scorm'),
@@ -582,10 +582,20 @@ public function display($scorm, $cm, $course, $download) {
if ($candelete) {
echo \html_writer::start_tag('table', array('id' => 'commands'));
echo \html_writer::start_tag('tr').\html_writer::start_tag('td');
echo \html_writer::link('javascript:select_all_in(\'DIV\', null, \'scormtablecontainer\');',
get_string('selectall', 'scorm')).' / ';
echo \html_writer::link('javascript:deselect_all_in(\'DIV\', null, \'scormtablecontainer\');',
get_string('selectnone', 'scorm'));
echo \html_writer::link('#', get_string('selectall', 'scorm'), array('id' => 'checkattempts'));
echo ' / ';
echo \html_writer::link('#', get_string('selectnone', 'scorm'), array('id' => 'uncheckattempts'));
$PAGE->requires->js_amd_inline("
require(['jquery'], function($) {
$('#checkattempts').click(function(e) {
$('#attemptsform').find('input:checkbox').prop('checked', true);
e.preventDefault();
});
$('#uncheckattempts').click(function(e) {
$('#attemptsform').find('input:checkbox').prop('checked', false);
e.preventDefault();
});
});");
echo '  ';
echo \html_writer::empty_tag('input', array('type' => 'submit',
'value' => get_string('deleteselected', 'scorm'),

0 comments on commit d574114

Please sign in to comment.