From 654d5178f79bf3d75f5b4489df2779a9d3cfb937 Mon Sep 17 00:00:00 2001 From: Barry Oosthuizen Date: Fri, 6 Jun 2014 10:28:20 +0100 Subject: [PATCH 1/9] Fix issue #1. Use the same icon as the Kaltura repositories #1 https://github.com/remotelearner/moodle-mod_kalvidassign/issues/1 --- pix/icon.gif | Bin 128 -> 0 bytes pix/icon.png | Bin 0 -> 1912 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 pix/icon.gif create mode 100644 pix/icon.png diff --git a/pix/icon.gif b/pix/icon.gif deleted file mode 100644 index 550df5db8c43d778c40a1290f1d3a724d0e88133..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 128 zcmZ?wbhEHb6krfwSoEKPf#I&Pahh>jn(@rE0|yTL|Np+Z^fq{iV2gnAh z6kuRrcJ#zjX4L3#Hi6(Z+o*#S%V7+Nf#XzKA=r8LA_%CILNJ0OW5{&A zaJ)*o3WdW~1%)eCEm!cB;B0Te%P7DFG%yAMMvYpl7Z`=$fUW>vTaM`Zc7Vh+(|~Rp~Gl zq6I99Pz;iQ2|+y5PbFw{Uu3oV&)0-s7~Kfz=u8^JQqmw$Ci{P=M)L)&$3o$+`TnP{ zK0Hwe(?elBl7K4k#>GyvgwhFoQ5eDyG#o+HgSR+89>EZOJfZ`9!#F^MN~=T+`T?{| zCJ4~#F-WU`1H?iQ=hIXwrGUfr3A}9OI!cd z=D{P}JC@}a)8d;iwuiO2*HPTmCMRbA|5iEz#G-JcX?mDLU|1Z*+iZT+^mgoASKDP{ z4l2mxwi?gzn_07RPgV;LjT%l)AJ6uWeXvDXGAwrDsBv*)IWOR}p!MoYnwt}nPqbhD zYdmWsxINRvngY9>r;s!V(s|xYYYGTLv*}CGn>~3W@4w#Z+oz)}N#PRQH{Cw#X}uWs%&oK3G&W zrd@jC-qCJ!P76VPyX17^qFsk~<`>#T%ZbFwLMh~yQTc0DdpJ1<+OR+Q>EEt5BvrrI z`u&i_jXC3D|L%u9!RDX8+qT#-s`tc_?0~zqR&5UrR^#`8IqCH|nR(0xBfEKl-lost zDzZAZ)!b{^yX;2PZbnyXh1&n_;v}NZ^znO_iyzMhCmroJ?`Qfm-?C#f4tIgAP?fH& z-Y$;{2R4@XC$|;F1e+g+&@Og%Uplq6W>OAaQtEx9$2eQ7>fCFLzwxMope`v~GZ%X% z@jf#ddb->y<@Cs0MOyspuCy#^)AM;-c1QwW(M90}wvH*;Rf!!R{xH2MTW!}&&Xw-I z<@kFui4uM9jdLh(#rgDIQB{KZ11*7Nh;}g&5G}>lvZx>Nh);W@7U@3=*b0-$I%r@>AimMyQx{zYnmtb zfgdD)K8UEj-1eiB;RuPtJNny!1P5DxdC1JL@|HTa7Rx-BEF2cUt+D1LapjCCuI6~7 zZ%r$^IdRR)wx+s-mld5vx2axH&5DMnMSyjF>E`^pVCqC`bl;P)tYY>oiCxk3Ddo_~ zOQV~bvwE(6<5DUuUi>EQW+4CYf&CF4tvwY->WLf6-Y*+|X2IMn^ZHcp)=clMRvQS4 zxoeK+uX_1P&^2*%1Q^1w8v?6y21*Xh)| Date: Fri, 6 Jun 2014 10:31:05 +0100 Subject: [PATCH 2/9] Fix issue #2. Minor improvements to kalvidassign_gradepreferences_form https://github.com/remotelearner/moodle-mod_kalvidassign/issues/2 --- grade_preferences_form.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grade_preferences_form.php b/grade_preferences_form.php index b1fa0e4..ce594d4 100644 --- a/grade_preferences_form.php +++ b/grade_preferences_form.php @@ -32,16 +32,16 @@ class kalvidassign_gradepreferences_form extends moodleform { function definition() { - global $CFG, $COURSE, $USER; + global $COURSE, $USER; $mform =& $this->_form; $mform->addElement('hidden', 'cmid', $this->_customdata['cmid']); + $mform->setType('cmid', PARAM_INT); $mform->addElement('header', 'kal_vid_subm_hdr', get_string('optionalsettings', 'kalvidassign')); - - $context = get_context_instance(CONTEXT_MODULE, $this->_customdata['cmid']); + $context = context_module::instance($this->_customdata['cmid']); $group_opt = array(); $groups = array(); From 38645035a3e37555326e003bff7468f3aed6e31d Mon Sep 17 00:00:00 2001 From: Barry Oosthuizen Date: Fri, 6 Jun 2014 10:34:17 +0100 Subject: [PATCH 3/9] Fix issue #3. Use new get_course() function instead of $DB->get_record('course' ... https://github.com/remotelearner/moodle-mod_kalvidassign/issues/3 --- grade_submissions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grade_submissions.php b/grade_submissions.php index f773cbf..c36ee89 100644 --- a/grade_submissions.php +++ b/grade_submissions.php @@ -45,7 +45,7 @@ print_error('invalidcoursemodule'); } -if (! $course = $DB->get_record('course', array('id' => $cm->course))) { +if (! $course = get_course($cm->course)) { print_error('coursemisconf'); } From ff072fb53e58a3a4b0ac14a50184cd0899e9407d Mon Sep 17 00:00:00 2001 From: Barry Oosthuizen Date: Fri, 6 Jun 2014 10:41:05 +0100 Subject: [PATCH 4/9] Fix issue #3. In index.php and submission.php: Use new get_course() function instead of $DB->get_record('course' ... https://github.com/remotelearner/moodle-mod_kalvidassign/issues/3 --- index.php | 2 +- submission.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 3039532..e5c5ed7 100644 --- a/index.php +++ b/index.php @@ -27,7 +27,7 @@ $id = required_param('id', PARAM_INT); // Course ID. -$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST); +$course = get_course($id); require_login($course); diff --git a/submission.php b/submission.php index 43143f7..1bd43af 100644 --- a/submission.php +++ b/submission.php @@ -37,7 +37,7 @@ print_error('invalidcoursemodule'); } -if (! $course = $DB->get_record('course', array('id' => $cm->course))) { +if (! $course = get_course($cm->course)) { print_error('coursemisconf'); } From 32a2c2f478540a4433685d9c915deb30f55cf9eb Mon Sep 17 00:00:00 2001 From: Barry Oosthuizen Date: Fri, 6 Jun 2014 10:49:26 +0100 Subject: [PATCH 5/9] Fix issue #4. Replace deprecated get_context_instance with context_xxxx::instance() In grade_submissions.php, locallib.php https://github.com/remotelearner/moodle-mod_kalvidassign/issues/4 --- grade_submissions.php | 2 +- locallib.php | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/grade_submissions.php b/grade_submissions.php index c36ee89..4823fd2 100644 --- a/grade_submissions.php +++ b/grade_submissions.php @@ -115,7 +115,7 @@ echo $OUTPUT->header(); -require_capability('mod/kalvidassign:gradesubmission', get_context_instance(CONTEXT_MODULE, $cm->id)); +require_capability('mod/kalvidassign:gradesubmission', context_module::instance($cm->id)); add_to_log($course->id, 'kalvidassign', 'view submissions page', 'grade_submissions.php?cmid='.$cm->id, $kalvidassignobj->id, $cm->id); diff --git a/locallib.php b/locallib.php index 4e384d8..eb23ce2 100644 --- a/locallib.php +++ b/locallib.php @@ -54,8 +54,6 @@ function kalvidassign_assignemnt_submission_expired($kalvidassign) { } function kalvidassign_submissions($mode) { - //make user global so we can use the id - global $USER, $OUTPUT, $DB, $PAGE; $mailinfo = optional_param('mailinfo', null, PARAM_BOOL); @@ -83,11 +81,11 @@ function kalvidassign_submissions($mode) { /** * Retrieve a list of users who have submitted assignments - * + * * @param int - assignment instance id * @param string - filter results by assignments that have been submitted or * assignment that need to be graded or no filter at all - * + * * @return mixed - collection of users or false */ function kalvidassign_get_submissions($kalvidassignid, $filter = '') { @@ -359,11 +357,10 @@ function kalvidassign_email_teachers_html($info) { function kalvidassign_get_assignment_students($cm) { - global $CFG; - $context = get_context_instance(CONTEXT_MODULE, $cm->id); + $context = context_module::instance($cm->id); $users = get_enrolled_users($context, 'mod/kalvidassign:submit', 0, 'u.id'); - + return $users; } From 05485625d5df2578e1635203a11f9c9d5f292710 Mon Sep 17 00:00:00 2001 From: Barry Oosthuizen Date: Fri, 6 Jun 2014 10:55:58 +0100 Subject: [PATCH 6/9] Fix issue #5. Remove unused / unecessary variable / global declarations In lib.php, single_sebmission_form.php https://github.com/remotelearner/moodle-mod_kalvidassign/issues/5 Add blank line to single_submission.php --- lib.php | 1 - single_submission.php | 2 +- single_submission_form.php | 9 +++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib.php b/lib.php index fe25c49..ba72e0d 100644 --- a/lib.php +++ b/lib.php @@ -286,7 +286,6 @@ function kalvidassign_supports($feature) { * @return int, 0 if ok, error code otherwise */ function kalvidassign_grade_item_update($kalvidassign, $grades=NULL) { - global $CFG; require_once(dirname(dirname(dirname(__FILE__))) . '/lib/gradelib.php'); diff --git a/single_submission.php b/single_submission.php index 7f4fa73..286c0d4 100644 --- a/single_submission.php +++ b/single_submission.php @@ -252,4 +252,4 @@ $submissionform->display(); -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/single_submission_form.php b/single_submission_form.php index e4570c1..14a32d8 100644 --- a/single_submission_form.php +++ b/single_submission_form.php @@ -32,7 +32,7 @@ class kalvidassign_singlesubmission_form extends moodleform { * This function defines the forums elments that are to be displayed */ public function definition() { - global $CFG, $PAGE; + global $CFG; $mform =& $this->_form; @@ -63,16 +63,15 @@ public function definition() { $submission = $this->_customdata->submission; $grading_info = $this->_customdata->grading_info; $entryobject = ''; - $timemodified = ''; if (!empty($submission->entry_id)) { $kaltura = new kaltura_connection(); $connection = $kaltura->get_connection(true, KALTURA_SESSION_LENGTH); - + if ($connection) { $entryobject = local_kaltura_get_ready_entry_object($this->_customdata->submission->entry_id); - + // Determine the type of video (See KALDEV-28) if (!local_kaltura_video_type_valid($entryobject)) { $entryobject = local_kaltura_get_ready_entry_object($entryobject->id, false); @@ -222,8 +221,6 @@ public function set_data($data) { $data->textformat = $data->submission->format; } - $editoroptions = $this->get_editor_options(); - return parent::set_data($data); } From 6fc90600cd5ba2131b6777988b5b864748fa7e08 Mon Sep 17 00:00:00 2001 From: Barry Oosthuizen Date: Fri, 6 Jun 2014 11:46:04 +0100 Subject: [PATCH 7/9] Fix issue #4, #5, #6, https://github.com/remotelearner/moodle-mod_kalvidassign/issues/4 https://github.com/remotelearner/moodle-mod_kalvidassign/issues/5 https://github.com/remotelearner/moodle-mod_kalvidassign/issues/6 --- renderer.php | 66 +++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/renderer.php b/renderer.php index fd124ec..0c63727 100644 --- a/renderer.php +++ b/renderer.php @@ -129,7 +129,7 @@ function col_selectgrade($data) { 'class' => $locked_overridden); - $output = html_writer::tag('div', $final_grade->formatted_grade, $attr); + $output = html_writer::div($final_grade->formatted_grade, '', $attr); } else if (!empty($this->_quickgrade)) { @@ -164,7 +164,6 @@ function col_selectgrade($data) { function col_submissioncomment($data) { - global $OUTPUT; $output = ''; $final_grade = false; @@ -210,11 +209,10 @@ function col_timemodified($data) { $attr = array('id' => 'ts'.$data->id); - $date_modified = $data->timemodified; - $date_modified = is_null($date_modified) || empty($data->timemodified) ? - '' : userdate($date_modified); + $date_modified = is_null($data->timemodified) || empty($data->timemodified) ? + '' : userdate($data->timemodified); - $output = html_writer::tag('div', $date_modified, $attr); + $output = html_writer::div($date_modified, '', $attr); $output .= html_writer::empty_tag('br'); $output .= html_writer::start_tag('center'); @@ -234,7 +232,7 @@ function col_timemodified($data) { if (!array_key_exists($data->entry_id, $this->_entries)) { $note = get_string('grade_video_not_cache', 'kalvidassign'); - + // If the entry has not yet been cached, force a call to retrieve the entry object // from the Kaltura server so that the thumbnail can be displayed $entry_object = local_kaltura_get_ready_entry_object($data->entry_id, false); @@ -290,7 +288,7 @@ function col_timemarked($data) { if (0 < $data->timemarked) { $attr = array('id' => 'tt'.$data->id); - $output = html_writer::tag('div', userdate($data->timemarked), $attr); + $output = html_writer::div(userdate($data->timemarked), '', $attr); } else { $otuput = '-'; @@ -401,7 +399,7 @@ function display_submission($kalvideoobj, $userid, $entry_obj = null) { $attr = array('id' => 'notification', 'class' => 'notification', 'tabindex' => '-1'); - $html .= html_writer::tag('div', '', $attr); + $html .= html_writer::div('', '', $attr); if (!empty($entry_obj)) { @@ -506,8 +504,8 @@ function display_student_submit_buttons($cm, $userid, $disablesubmit = false) { // Check of KSR is enabled via config or capability $enable_ksr = get_config(KALTURA_PLUGIN_NAME, 'enable_screen_recorder'); - $context = get_context_instance(CONTEXT_MODULE, $cm->id); - + $context = context_module::instance($cm->id); + if ($enable_ksr && has_capability('mod/kalvidassign:screenrecorder', $context)) { @@ -519,7 +517,7 @@ function display_student_submit_buttons($cm, $userid, $disablesubmit = false) { 'value' => '1'); $html .= html_writer::empty_tag('input', $attr); $html .= html_writer::end_tag('td'); - + $html .= html_writer::start_tag('td'); $attr = array('for' => 'id_media_method_1'); $html .= html_writer::tag('label', get_string('use_screen_recorder', 'kalvidassign'), $attr); @@ -620,8 +618,8 @@ function display_student_resubmit_buttons($cm, $userid, $disablesubmit = false) // Check of KSR is enabled via config or capability $enable_ksr = get_config(KALTURA_PLUGIN_NAME, 'enable_screen_recorder'); - $context = get_context_instance(CONTEXT_MODULE, $cm->id); - + $context = context_module::instance($cm->id); + if ($enable_ksr && has_capability('mod/kalvidassign:screenrecorder', $context)) { @@ -631,14 +629,14 @@ function display_student_resubmit_buttons($cm, $userid, $disablesubmit = false) 'name' => 'media_method', 'id' => 'id_media_method_1', 'value' => '1'); - + if ($disablesubmit) { $attr['disabled'] = 'disabled'; } - + $html .= html_writer::empty_tag('input', $attr); $html .= html_writer::end_tag('td'); - + $html .= html_writer::start_tag('td'); $attr = array('for' => 'id_media_method_1'); $html .= html_writer::tag('label', get_string('use_screen_recorder', 'kalvidassign'), $attr); @@ -811,7 +809,7 @@ function display_submissions_table($cm, $group_filter = 0, $filter = 'all', $per $groups_join = ''; $groups = array(); $group_ids = ''; - $context = get_context_instance(CONTEXT_COURSE, $COURSE->id); + $context = context_course::instance($COURSE->id); // Get all groups that the user belongs to, check if the user has capability to access all groups if (!has_capability('moodle/site:accessallgroups', $context, $USER->id)) { @@ -823,7 +821,7 @@ function display_submissions_table($cm, $group_filter = 0, $filter = 'all', $per return; } } else { - $groups = groups_get_all_groups($COURSE->id); + $groups = groups_get_all_groups($COURSE->id); } // Create a comma separated list of group ids @@ -1029,15 +1027,15 @@ function display_kcw_panel_markup() { $output = ''; $attr = array('id' => 'video_panel'); - $output .= html_writer::start_tag('div', $attr); + $output .= html_writer::start_div('', $attr); $attr = array('class' => 'hd'); - $output .= html_writer::tag('div', '', $attr); + $output .= html_writer::div('', '', $attr); $attr = array('class' => 'bd'); - $output .= html_writer::tag('div', '', $attr); + $output .= html_writer::div('', '', $attr); - $output .= html_writer::end_tag('div'); + $output .= html_writer::end_div(); return $output; } @@ -1052,15 +1050,15 @@ function display_video_preview_markup() { $attr = array('id' => 'id_video_preview', 'class' => 'video_preview'); - $output .= html_writer::start_tag('div', $attr); + $output .= html_writer::start_div('', $attr); $attr = array('class' => 'hd'); - $output .= html_writer::tag('div', get_string('video_preview_header', 'kalvidassign'), $attr); + $output .= html_writer::div(get_string('video_preview_header', 'kalvidassign'), '', $attr); $attr = array('class' => 'bd'); - $output .= html_writer::tag('div', '', $attr); + $output .= html_writer::div('', '', $attr); - $output .= html_writer::end_tag('div'); + $output .= html_writer::end_div(); return $output; @@ -1075,19 +1073,19 @@ function display_loading_markup() { // Panel wait markup $output = ''; - $output .= html_writer::end_tag('div'); + $output .= html_writer::end_div(); $attr = array('id' => 'wait'); - $output .= html_writer::start_tag('div', $attr); + $output .= html_writer::start_div('', $attr); $attr = array('class' => 'hd'); - $output .= html_writer::tag('div', '', $attr); + $output .= html_writer::div('', '', $attr); $attr = array('class' => 'bd'); - $output .= html_writer::tag('div', '', $attr); + $output .= html_writer::div('', '', $attr); - $output .= html_writer::end_tag('div'); + $output .= html_writer::end_div(); return $output; } @@ -1194,10 +1192,10 @@ function render_progress_bar() { $progress_bar = html_writer::tag('span', '', $attr); $attr = array('id' => 'slider_border'); - $slider_border = html_writer::tag('div', $progress_bar, $attr); + $slider_border = html_writer::div($progress_bar, '', $attr); $attr = array('id' => 'loading_text'); - $loading_text = html_writer::tag('div', get_string('checkingforjava', 'mod_kalvidassign'), $attr); + $loading_text = html_writer::div(get_string('checkingforjava', 'mod_kalvidassign'), '', $attr); $attr = array('id' => 'progress_bar_container', 'style' => 'width:100%; padding-left:10px; padding-right:10px; visibility: hidden'); From 3c99b139195d01078ab53ef9d2ce0cc0212462e5 Mon Sep 17 00:00:00 2001 From: Barry Oosthuizen Date: Fri, 6 Jun 2014 12:11:48 +0100 Subject: [PATCH 8/9] Fix issues #3, #4, #5 - get_course() function, context_xxx::instance() and remove unused variables. https://github.com/remotelearner/moodle-mod_kalvidassign/issues/3 https://github.com/remotelearner/moodle-mod_kalvidassign/issues/4 https://github.com/remotelearner/moodle-mod_kalvidassign/issues/5 --- view.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/view.php b/view.php index 14357e5..ec83cfc 100644 --- a/view.php +++ b/view.php @@ -37,7 +37,7 @@ print_error('invalidcoursemodule'); } - if (! $course = $DB->get_record('course', array('id' => $cm->course))) { + if (! $course = get_course($cm->course)) { print_error('coursemisconf'); } @@ -66,7 +66,7 @@ $url = new moodle_url("{$host}/p/{$partner_id}/sp/{$partner_id}/ksr/uiconfId/{$sr_unconf_id}"); $PAGE->requires->js($url, true); $PAGE->requires->js('/local/kaltura/js/screenrecorder.js', true); - + $PAGE->requires->js('/local/kaltura/js/jquery.js', true); $PAGE->requires->js('/local/kaltura/js/swfobject.js', true); $PAGE->requires->js('/local/kaltura/js/kcwcallback.js', true); @@ -77,7 +77,7 @@ $PAGE->set_title(format_string($kalvidassign->name)); $PAGE->set_heading($course->fullname); -$context = get_context_instance(CONTEXT_MODULE, $cm->id); +$context = context_module::instance($cm->id); add_to_log($course->id, 'kalvidassign', 'view assignment details', 'view.php?id='.$cm->id, $kalvidassign->id, $cm->id); @@ -193,15 +193,12 @@ ); $courseid = get_courseid_from_context($PAGE->context); - $conversion_script = ''; $kcw = local_kaltura_get_kcw('assign_uploader', true); $markup = $renderer->display_all_panel_markup(); $properties = kalvidassign_get_video_properties(); $conversion_script = "../../local/kaltura/check_conversion.php?courseid={$courseid}&entry_id="; $login_session = ''; - $modalwidth = 0; - $modalheight = 0; - + if ($connection) { $login_session = $connection->getKs(); } From c4ec4bd2d8ad5c6769a2d1c197a839107c0bdc68 Mon Sep 17 00:00:00 2001 From: Barry Oosthuizen Date: Fri, 6 Jun 2014 15:51:14 +0100 Subject: [PATCH 9/9] Fix issue #8 - Update install.xml inline with MDL-27982 https://github.com/remotelearner/moodle-mod_kalvidassign/issues/8 --- db/install.xml | 64 +++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) mode change 100755 => 100644 db/install.xml diff --git a/db/install.xml b/db/install.xml old mode 100755 new mode 100644 index e4cbf29..264311e --- a/db/install.xml +++ b/db/install.xml @@ -1,24 +1,24 @@ - - +
- - - - - - - - - - - - - + + + + + + + + + + + + + @@ -27,29 +27,29 @@
- +
- - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + +