Permalink
Browse files

MDL-31276: Phpdocs cleanup for offline grading feature

  • Loading branch information...
1 parent d0d4796 commit 7a2b911c6baf15f074ce076f2fabccba2932ea56 Damyon Wiese committed Sep 11, 2012
@@ -349,7 +349,7 @@ public function view_summary(stdClass $submissionorgrade, & $showviewlink) {
}
/**
- * 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 @@ public function set_editor_text($name, $value, $submissionorgradeid) {
}
/**
- * 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 @@ public function get_files(stdClass $submissionorgrade) {
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 @@ public function get_editor_format($name, $submissionid) {
return 0;
}
- /**
+ /**
* Return true if this plugin can upgrade an old Moodle 2.2 assignment of this type
* and version.
*
@@ -428,7 +428,7 @@ public function can_upgrade($type, $version) {
return false;
}
- /**
+ /**
* Upgrade the settings from the old assignment to the new one
*
* @param context $oldcontext The context for the old assignment module
@@ -114,7 +114,7 @@ public function get_editor_fields() {
* 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 @@ public function get_editor_text($name, $gradeid) {
* 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) {
@@ -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,15 +30,15 @@
/**
* 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
*/
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 @@ function definition() {
'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);
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -28,7 +27,7 @@
require_once($CFG->libdir.'/formslib.php');
require_once($CFG->dirroot.'/mod/assign/feedback/file/importziplib.php');
-/*
+/**
* Import zip form
*
* @package assignfeedback_file
@@ -59,7 +58,6 @@ function definition() {
return;
}
-
$files = $importer->get_import_files($contextid);
$mform->addElement('header', 'uploadzip', get_string('confirmuploadzip', 'assignfeedback_file'));
@@ -110,7 +108,6 @@ function definition() {
}
}
-
if (count($updates)) {
$mform->addElement('html', $renderer->list_block_contents(array(), $updates));
} else {
@@ -28,7 +28,7 @@
/**
* 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 @@ public function import_zip_files($assignment, $fileplugin) {
}
}
-
require_once($CFG->dirroot . '/mod/assign/feedback/file/renderable.php');
$importsummary = new assignfeedback_file_import_summary($assignment->get_course_module()->id,
count($userswithnewfeedback),
@@ -79,14 +79,15 @@ private function get_file_options() {
/**
* 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 @@ public function update_file_count($grade) {
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 @@ public function view_batch_upload_files($users) {
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 @@ public function grading_batch_operation($action, $users) {
*
* @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());
@@ -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
*/
@@ -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;
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -28,7 +27,7 @@
require_once($CFG->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;
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -25,7 +24,7 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
-/*
+/**
* CSV Grade importer
*
* @package assignfeedback_offline
@@ -34,7 +33,7 @@
*/
class assignfeedback_offline_grade_importer {
- /** var string $importid - unique id for this import operation - must be passed between requests */
+ /** @var string $importid - unique id for this import operation - must be passed between requests */
public $importid;
/** @var csv_import_reader $csvreader - the csv importer class */
@@ -61,9 +60,10 @@ class assignfeedback_offline_grade_importer {
/**
* Constructor
*
- * @param string importid
+ * @param string $importid A unique id for this import
+ * @param assign $assignment The current assignment
*/
- function __construct($importid, assign $assignment) {
+ public function __construct($importid, assign $assignment) {
$this->importid = $importid;
$this->assignment = $assignment;
}
@@ -72,9 +72,10 @@ function __construct($importid, assign $assignment) {
* 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 @@ function parsecsv($csvdata) {
*
* @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 @@ function init() {
/**
* 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 @@ function next() {
*
* @param bool $delete
*/
- function close($delete) {
+ public function close($delete) {
$this->csvreader->close();
if ($delete) {
$this->csvreader->cleanup();
@@ -15,9 +15,9 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * 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['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 &quot;UTF-8&quot;';
$string['nochanges'] = 'No modified grades found in uploaded worksheet';
$string['offlinegradingworksheet'] = 'Grades';
$string['pluginname'] = 'Offline grading worksheet';
Oops, something went wrong.

0 comments on commit 7a2b911

Please sign in to comment.