diff --git a/mod/assign/assignmentplugin.php b/mod/assign/assignmentplugin.php index 7ba205549eb..baf8f54396a 100644 --- a/mod/assign/assignmentplugin.php +++ b/mod/assign/assignmentplugin.php @@ -349,7 +349,7 @@ abstract class assign_plugin { } /** - * Given a field name and value should update this plugins submission or grade + * Given a field name and value should update the text for this field in the plugins submission or grade * * @param string $name Name of the field. * @param string $value Updated text @@ -361,14 +361,14 @@ abstract class assign_plugin { } /** - * Given a field name and value should update this plugins submission or grade + * Given a field name and value should update the format for this field in the plugins submission or grade * * @param string $name Name of the field. - * @param int $format Updated format - * @param int $submissionorgradeid The id of the submission or grade + * @param int $format Updated format. + * @param int $submissionorgradeid The id of the submission or grade. * @return bool - true if the value was updated */ - public function set_editor_format($name, $value, $submissionorgradeid) { + public function set_editor_format($name, $format, $submissionorgradeid) { return false; } @@ -404,7 +404,7 @@ abstract class assign_plugin { return array(); } - /** + /** * Given a field name, should return the format of an editor field that is part of * this plugin. This is used when exporting to portfolio. * @@ -416,7 +416,7 @@ abstract class assign_plugin { return 0; } - /** + /** * Return true if this plugin can upgrade an old Moodle 2.2 assignment of this type * and version. * @@ -428,7 +428,7 @@ abstract class assign_plugin { return false; } - /** + /** * Upgrade the settings from the old assignment to the new one * * @param context $oldcontext The context for the old assignment module diff --git a/mod/assign/feedback/comments/locallib.php b/mod/assign/feedback/comments/locallib.php index 9eab5f7acd4..b1463773cbf 100644 --- a/mod/assign/feedback/comments/locallib.php +++ b/mod/assign/feedback/comments/locallib.php @@ -114,7 +114,7 @@ class assign_feedback_comments extends assign_feedback_plugin { * Get the saved text content from the editor * * @param string $name - * @param int $submissionid + * @param int $gradeid * @return string */ public function get_editor_text($name, $gradeid) { @@ -132,7 +132,7 @@ class assign_feedback_comments extends assign_feedback_plugin { * Get the saved text content from the editor * * @param string $name - * @param int $submissionid + * @param int $gradeid * @return string */ public function set_editor_text($name, $value, $gradeid) { diff --git a/mod/assign/feedback/file/batchuploadfilesform.php b/mod/assign/feedback/file/batchuploadfilesform.php index 350f80f351b..7d4ef4fd035 100644 --- a/mod/assign/feedback/file/batchuploadfilesform.php +++ b/mod/assign/feedback/file/batchuploadfilesform.php @@ -17,7 +17,7 @@ /** * This file contains the forms to create and edit an instance of this module * - * @package mod_assign + * @package assignfeedback_file * @copyright 2012 NetSpot {@link http://www.netspot.com.au} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -30,7 +30,7 @@ require_once($CFG->dirroot . '/mod/assign/feedback/file/locallib.php'); /** * Assignment grading options form * - * @package mod_assign + * @package assignfeedback_file * @copyright 2012 NetSpot {@link http://www.netspot.com.au} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -38,7 +38,7 @@ class assignfeedback_file_batch_upload_files_form extends moodleform { /** * Define this form - called by the parent constructor */ - function definition() { + public function definition() { global $COURSE, $USER; $mform = $this->_form; @@ -53,7 +53,12 @@ class assignfeedback_file_batch_upload_files_form extends moodleform { 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL); - $data = file_prepare_standard_filemanager($data, 'files', $fileoptions, $params['context'], 'assignfeedback_file', ASSIGNFEEDBACK_BATCHFILE_FILEAREA, $USER->id); + $data = file_prepare_standard_filemanager($data, + 'files', + $fileoptions, + $params['context'], + 'assignfeedback_file', + ASSIGNFEEDBACK_BATCHFILE_FILEAREA, $USER->id); $mform->addElement('filemanager', 'files_filemanager', '', null, $fileoptions); diff --git a/mod/assign/feedback/file/importzipform.php b/mod/assign/feedback/file/importzipform.php index eb0e52e98f7..c3338b3266f 100644 --- a/mod/assign/feedback/file/importzipform.php +++ b/mod/assign/feedback/file/importzipform.php @@ -1,5 +1,4 @@ libdir.'/formslib.php'); require_once($CFG->dirroot.'/mod/assign/feedback/file/importziplib.php'); -/* +/** * Import zip form * * @package assignfeedback_file @@ -59,7 +58,6 @@ class assignfeedback_file_import_zip_form extends moodleform implements renderab return; } - $files = $importer->get_import_files($contextid); $mform->addElement('header', 'uploadzip', get_string('confirmuploadzip', 'assignfeedback_file')); @@ -110,7 +108,6 @@ class assignfeedback_file_import_zip_form extends moodleform implements renderab } } - if (count($updates)) { $mform->addElement('html', $renderer->list_block_contents(array(), $updates)); } else { diff --git a/mod/assign/feedback/file/importziplib.php b/mod/assign/feedback/file/importziplib.php index b006d2e4ad9..b355b33cad3 100644 --- a/mod/assign/feedback/file/importziplib.php +++ b/mod/assign/feedback/file/importziplib.php @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die(); /** * library class for importing feedback files from a zip * - * @package asignfeedback_file + * @package assignfeedback_file * @copyright 2012 NetSpot {@link http://www.netspot.com.au} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -41,6 +41,7 @@ class assignfeedback_file_zip_importer { * @param stored_file $fileinfo - The fileinfo * @param array $participants - A list of valid participants for this module indexed by unique_id * @param stdClass $user - Set to the user that matches by participant id + * @param assign_plugin $plugin - Set to the plugin that exported the file * @param string $filename - Set to truncated filename (prefix stripped) * @return true If the participant Id can be extracted and this is a valid user */ @@ -270,7 +271,6 @@ class assignfeedback_file_zip_importer { } } - require_once($CFG->dirroot . '/mod/assign/feedback/file/renderable.php'); $importsummary = new assignfeedback_file_import_summary($assignment->get_course_module()->id, count($userswithnewfeedback), diff --git a/mod/assign/feedback/file/locallib.php b/mod/assign/feedback/file/locallib.php index e06f9698588..f2d0c2be798 100644 --- a/mod/assign/feedback/file/locallib.php +++ b/mod/assign/feedback/file/locallib.php @@ -79,14 +79,15 @@ class assign_feedback_file extends assign_feedback_plugin { /** * Copy all the files from one file area to another * - * @param int fromcontextid - The source context id - * @param string fromcomponent - The source component - * @param string fromfilearea - The source filearea - * @param int fromitemid - The source item id - * @param int tocontextid - The destination context id - * @param string tocomponent - The destination component - * @param string tofilearea - The destination filearea - * @param int toitemid - The destination item id + * @param file_storage $fs - The source context id + * @param int $fromcontextid - The source context id + * @param string $fromcomponent - The source component + * @param string $fromfilearea - The source filearea + * @param int $fromitemid - The source item id + * @param int $tocontextid - The destination context id + * @param string $tocomponent - The destination component + * @param string $tofilearea - The destination filearea + * @param int $toitemid - The destination item id * @return boolean */ private function copy_area_files(file_storage $fs, @@ -186,7 +187,13 @@ class assign_feedback_file extends assign_feedback_plugin { public function save(stdClass $grade, stdClass $data) { $fileoptions = $this->get_file_options(); - $data = file_postupdate_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $grade->id); + $data = file_postupdate_standard_filemanager($data, + 'files', + $fileoptions, + $this->assignment->get_context(), + 'assignfeedback_file', + ASSIGNFEEDBACK_FILE_FILEAREA, + $grade->id); return $this->update_file_count($grade); } @@ -393,7 +400,6 @@ class assign_feedback_file extends assign_feedback_plugin { ASSIGNFEEDBACK_FILE_FILEAREA, $grade->id); - $filefeedback = $this->get_file_feedback($grade->id); if ($filefeedback) { $filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA); @@ -452,7 +458,7 @@ class assign_feedback_file extends assign_feedback_plugin { * * @return string - The html response */ - function view_upload_zip() { + public function view_upload_zip() { global $CFG, $USER; require_capability('mod/assign:grade', $this->assignment->get_context()); diff --git a/mod/assign/feedback/file/renderable.php b/mod/assign/feedback/file/renderable.php index 938918dc187..453b5fe24fb 100644 --- a/mod/assign/feedback/file/renderable.php +++ b/mod/assign/feedback/file/renderable.php @@ -45,7 +45,7 @@ class assignfeedback_file_import_summary implements renderable { * Constructor for this renderable class * * @param int $cmid - The course module id for navigation - * @param int $userswithnewfeedbac - The number of users with new feedback + * @param int $userswithnewfeedback - The number of users with new feedback * @param int $feedbackfilesadded - The number of feedback files added * @param int $feedbackfilesupdated - The number of feedback files updated */ diff --git a/mod/assign/feedback/file/uploadzipform.php b/mod/assign/feedback/file/uploadzipform.php index 218aee96c9f..0c6b397d728 100644 --- a/mod/assign/feedback/file/uploadzipform.php +++ b/mod/assign/feedback/file/uploadzipform.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -require_once ($CFG->libdir.'/formslib.php'); +require_once($CFG->libdir.'/formslib.php'); /** * Upload feedback zip @@ -37,7 +37,7 @@ class assignfeedback_file_upload_zip_form extends moodleform { /** * Define this form - called by the parent constructor */ - function definition() { + public function definition() { global $COURSE, $USER; $mform = $this->_form; diff --git a/mod/assign/feedback/offline/importgradesform.php b/mod/assign/feedback/offline/importgradesform.php index e4ffec75765..cf8f49da47a 100644 --- a/mod/assign/feedback/offline/importgradesform.php +++ b/mod/assign/feedback/offline/importgradesform.php @@ -1,5 +1,4 @@ libdir.'/formslib.php'); require_once($CFG->dirroot.'/mod/assign/feedback/offline/importgradeslib.php'); -/* +/** * Import grades form * * @package assignfeedback_offline @@ -40,7 +39,7 @@ class assignfeedback_offline_import_grades_form extends moodleform implements re /** * Create this grade import form */ - function definition() { + public function definition() { global $CFG, $PAGE, $DB; $mform = $this->_form; diff --git a/mod/assign/feedback/offline/importgradeslib.php b/mod/assign/feedback/offline/importgradeslib.php index fba5ef9a0cc..da193124779 100644 --- a/mod/assign/feedback/offline/importgradeslib.php +++ b/mod/assign/feedback/offline/importgradeslib.php @@ -1,5 +1,4 @@ importid = $importid; $this->assignment = $assignment; } @@ -72,9 +72,10 @@ class assignfeedback_offline_grade_importer { * Parse a csv file and save the content to a temp file * Should be called before init() * + * @param string $csvdata The csv data * @return bool false is a failed import */ - function parsecsv($csvdata) { + public function parsecsv($csvdata) { $this->csvreader = new csv_import_reader($this->importid, 'assignfeedback_offline'); $this->csvreader->load_csv_content($csvdata, 'utf-8', 'comma'); } @@ -84,7 +85,7 @@ class assignfeedback_offline_grade_importer { * * @return bool false is a failed import */ - function init() { + public function init() { if ($this->csvreader == null) { $this->csvreader = new csv_import_reader($this->importid, 'assignfeedback_offline'); } @@ -142,10 +143,9 @@ class assignfeedback_offline_grade_importer { /** * Get the next row of data from the csv file (only the columns we care about) * - * @global moodle_database $DB * @return stdClass or false The stdClass is an object containing user, grade and lastmodified */ - function next() { + public function next() { global $DB; $result = new stdClass(); @@ -178,7 +178,7 @@ class assignfeedback_offline_grade_importer { * * @param bool $delete */ - function close($delete) { + public function close($delete) { $this->csvreader->close(); if ($delete) { $this->csvreader->cleanup(); diff --git a/mod/assign/feedback/offline/lang/en/assignfeedback_offline.php b/mod/assign/feedback/offline/lang/en/assignfeedback_offline.php index 5fd0d64ff1b..aefde952502 100644 --- a/mod/assign/feedback/offline/lang/en/assignfeedback_offline.php +++ b/mod/assign/feedback/offline/lang/en/assignfeedback_offline.php @@ -15,9 +15,9 @@ // along with Moodle. If not, see . /** - * Strings for component 'feedback_file', language 'en' + * Strings for component 'feedback_offline', language 'en' * - * @package assignfeedback_file + * @package assignfeedback_offline * @copyright 2012 NetSpot {@link http://www.netspot.com.au} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -37,7 +37,7 @@ $string['ignoremodified_help'] = 'When the grading worksheet is downloaded from $string['importgrades'] = 'Confirm changes in grading worksheet'; $string['invalidgradeimport'] = 'Moodle could not read the uploaded worksheet. Make sure it is saved in comma separated value format (.csv) and try again.'; $string['gradesfile'] = 'Grading worksheet (csv format)'; -$string['gradesfile_help'] = 'Grading worksheet with modified grades. This file must be a csv file that has been downloaded form this assignment and must contain columns for the student grade, and identifier.'; +$string['gradesfile_help'] = 'Grading worksheet with modified grades. This file must be a csv file that has been downloaded from this assignment and must contain columns for the student grade, and identifier. The encoding for the file must be "UTF-8"'; $string['nochanges'] = 'No modified grades found in uploaded worksheet'; $string['offlinegradingworksheet'] = 'Grades'; $string['pluginname'] = 'Offline grading worksheet'; diff --git a/mod/assign/feedback/offline/locallib.php b/mod/assign/feedback/offline/locallib.php index 784a04e3195..d64927fac30 100644 --- a/mod/assign/feedback/offline/locallib.php +++ b/mod/assign/feedback/offline/locallib.php @@ -30,7 +30,7 @@ require_once($CFG->dirroot.'/grade/grading/lib.php'); /** * library class for file feedback plugin extending feedback plugin base class * - * @package asignfeedback_offline + * @package assignfeedback_offline * @copyright 2012 NetSpot {@link http://www.netspot.com.au} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -69,6 +69,7 @@ class assign_feedback_offline extends assign_feedback_plugin { * * @param int $draftid - The unique draft item id for this import * @param int $importid - The unique import ID for this csv import operation + * @param bool $ignoremodified - Ignore the last modified date when checking fields * @return string - The html response */ public function process_import_grades($draftid, $importid, $ignoremodified) { @@ -324,7 +325,7 @@ class assign_feedback_offline extends assign_feedback_plugin { $this->assignment->get_course()->shortname . '-' . $this->assignment->get_instance()->name . '-' . $groupname . - $this->assignment->get_course_module()->id); //name of new zip file. + $this->assignment->get_course_module()->id); $table = new assign_grading_table($this->assignment, 0, '', 0, false, $filename); diff --git a/mod/assign/feedback/offline/uploadgradesform.php b/mod/assign/feedback/offline/uploadgradesform.php index e73e23d933a..61df88f5cff 100644 --- a/mod/assign/feedback/offline/uploadgradesform.php +++ b/mod/assign/feedback/offline/uploadgradesform.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); -require_once ($CFG->libdir.'/formslib.php'); +require_once($CFG->libdir.'/formslib.php'); /** * Upload modified grading worksheet @@ -37,7 +37,7 @@ class assignfeedback_offline_upload_grades_form extends moodleform { /** * Define this form - called by the parent constructor */ - function definition() { + public function definition() { global $COURSE, $USER; $mform = $this->_form; diff --git a/mod/assign/feedback/offline/version.php b/mod/assign/feedback/offline/version.php index 694daa26689..065addfd1ce 100644 --- a/mod/assign/feedback/offline/version.php +++ b/mod/assign/feedback/offline/version.php @@ -15,9 +15,9 @@ // along with Moodle. If not, see . /** - * This file contains the version information for the comments feedback plugin + * This file contains the version information for the offline feedback plugin * - * @package assignfeedback_file + * @package assignfeedback_offline * @copyright 2012 NetSpot {@link http://www.netspot.com.au} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/mod/assign/feedbackplugin.php b/mod/assign/feedbackplugin.php index 79eb41c9691..292f314918d 100644 --- a/mod/assign/feedbackplugin.php +++ b/mod/assign/feedbackplugin.php @@ -145,15 +145,18 @@ abstract class assign_feedback_plugin extends assign_plugin { /** * Show a grading action form * + * @param string $gradingaction The action chosen from the grading actions menu * @return string The page containing the form */ - public function grading_action($action) { + public function grading_action($gradingaction) { return ''; } /** * Show a batch operations form * + * @param string $action The action chosen from the batch operations menu + * @param array $users The list of selected userids * @return string The page containing the form */ public function grading_batch_operation($action, $users) { diff --git a/mod/assign/gradingtable.php b/mod/assign/gradingtable.php index 45785b1fb30..c77a8f9bee5 100644 --- a/mod/assign/gradingtable.php +++ b/mod/assign/gradingtable.php @@ -72,7 +72,7 @@ class assign_grading_table extends table_sql implements renderable { * @param int $rowoffset For showing a subsequent page of results * @param bool $quickgrading Is this table wrapped in a quickgrading form? */ - function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgrading, $downloadfilename = null) { + public function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgrading, $downloadfilename = null) { global $CFG, $PAGE, $DB; parent::__construct('mod_assign_grading'); $this->assignment = $assignment; @@ -339,7 +339,7 @@ class assign_grading_table extends table_sql implements renderable { * @param stdClass $row - The row of data * @return string A list of valid options for the current scale */ - function col_scale($row) { + public function col_scale($row) { global $DB; if (empty($this->scale)) { @@ -535,8 +535,8 @@ class assign_grading_table extends table_sql implements renderable { * @param stdClass $row * @return string */ - function col_grademax(stdClass $row) { - return format_float($this->assignment->get_instance()->grade,2); + public function col_grademax(stdClass $row) { + return format_float($this->assignment->get_instance()->grade, 2); } /** diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index a95ae4c156b..58590918f1a 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -423,7 +423,7 @@ class assign { $o .= $this->view_reveal_identities_confirm($mform); } else if ($action == 'plugingradingbatchoperation') { $o .= $this->view_plugin_grading_batch_operation($mform); - } else if ($action == 'viewpluginpage') { + } else if ($action == 'viewpluginpage') { $o .= $this->view_plugin_page(); } else { $o .= $this->view_submission_page(); @@ -1807,7 +1807,7 @@ class assign { foreach ($students as $student) { $userid = $student->id; - if ((groups_is_member($groupid,$userid) or !$groupmode or !$groupid)) { + if ((groups_is_member($groupid, $userid) or !$groupmode or !$groupid)) { // Get the plugins to add their own files to the zip. $submissiongroup = false; @@ -1833,7 +1833,9 @@ class assign { if ($plugin->is_enabled() && $plugin->is_visible()) { $pluginfiles = $plugin->get_files($submission); foreach ($pluginfiles as $zipfilename => $file) { - $prefixedfilename = $prefix . $plugin->get_subtype() . '_' . $plugin->get_type() . '_' . $zipfilename; + $subtype = $plugin->get_subtype(); + $type = $plugin->get_type(); + $prefixedfilename = $prefix . $subtype . '_' . $type . '_' . $zipfilename; $filesforzipping[$prefixedfilename] = $file; } } @@ -2431,9 +2433,9 @@ class assign { print_error('invalidformdata', ''); } - /** * Ask the user to confirm they want to perform this batch operation + * @param moodleform $mform Set to a grading batch operations form * @return string - the page to view after processing these actions */ private function process_grading_batch_operation(& $mform) { @@ -4415,6 +4417,7 @@ class assign { /** * Lookup this unique id and return the user id for this assignment * + * @param int $assignid The id of the assignment this user mapping is in * @param int $uniqueid The uniqueid to lookup * @return int The user id or false if they don't exist */