';
} else if ($coursework->blindmarking_enabled() &&
diff --git a/classes/forms/student_submission_form.php b/classes/forms/student_submission_form.php
index 8c34db3d..ff5bca7f 100644
--- a/classes/forms/student_submission_form.php
+++ b/classes/forms/student_submission_form.php
@@ -15,8 +15,7 @@
// along with Moodle. If not, see .
/**
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -58,7 +57,7 @@ public function definition() {
$this->add_hidden_elements_to_form();
// if TII plagiarism enabled check if user agreed/disagreed EULA
- if(!$this->get_coursework()->plagiarism_enbled() || has_user_seen_tii_EULA_agreement()) {
+ if (!$this->get_coursework()->plagiarism_enbled() || has_user_seen_tii_EULA_agreement()) {
$this->add_header_to_form();
@@ -176,19 +175,17 @@ public function handle() {
if (!$submission->get_coursework()->has_deadline()) {
- $userids = explode(',',$submission->get_coursework()->get_submission_notification_users());
+ $userids = explode(',', $submission->get_coursework()->get_submission_notification_users());
if (!empty($userids)) {
- foreach($userids as $u) {
- $notifyuser = $DB->get_record('user',array('id'=>trim($u)));
+ foreach ($userids as $u) {
+ $notifyuser = $DB->get_record('user', array('id' => trim($u)));
$mailer = new mailer($coursework);
if (!empty($notifyuser)) $mailer->send_submission_notification($notifyuser);
}
}
-
-
}
// Must happen AFTER file attributes have been fiddled with, otherwise we get
@@ -230,7 +227,6 @@ public function handle() {
}
}
-
/**
* Sets the data, tweaking the submission to conform to the form's field names
*
@@ -264,7 +260,6 @@ public function set_data($submission) {
}
-
/**
* @return coursework
*/
@@ -304,7 +299,7 @@ protected function add_submit_buttons_to_form() {
$ability = new ability(user::find($USER), $this->get_coursework());
- $button_array = array();
+ $button_array = [];
// If submitting on behalf of someone else, we want to make sure that we don't have people leaving it in a draft
// state because the reason for doing submit on behalf of in the first place is that the student cannot use the
// interface themselves, so they are unable to come back later to finalise it themselves.
@@ -359,7 +354,7 @@ protected function add_file_manager_to_form() {
$uploadfilestring,
null,
$this->get_file_manager_options());
- $this->_form->addRule('submission_manager', 'You must upload file(s) into the box below before you can save', 'required', null,'server',false,true);
+ $this->_form->addRule('submission_manager', 'You must upload file(s) into the box below before you can save', 'required', null, 'server', false, true);
}
@@ -370,7 +365,7 @@ protected function add_instructions_to_form() {
$file_manager_options = $this->get_file_manager_options();
$usernamehash = $this->get_coursework()->get_username_hash($this->get_submission()->userid);
- $filerenamestring = ($this->get_coursework()->renamefiles == 1)? get_string('file_rename', 'coursework', $usernamehash) : "";
+ $filerenamestring = ($this->get_coursework()->renamefiles == 1) ? get_string('file_rename', 'coursework', $usernamehash) : "";
$filerenamestring .= $this->make_plagiarism_instructions();
$filerenamestring .= html_writer::empty_tag('br');
if ($file_manager_options['accepted_types'] != '*') {
@@ -387,9 +382,8 @@ protected function add_instructions_to_form() {
*/
protected function add_header_to_form() {
$file_manager_options = $this->get_file_manager_options();
- $files_string = ($file_manager_options['maxfiles'] == 1) ? 'yoursubmissionfile'
- : 'yoursubmissionfiles';
- $renamed = ($this->get_coursework()->renamefiles == 1)?get_string('yoursubmissionfile_renamed', 'coursework') : "";
+ $files_string = ($file_manager_options['maxfiles'] == 1) ? 'yoursubmissionfile' : 'yoursubmissionfiles';
+ $renamed = ($this->get_coursework()->renamefiles == 1) ? get_string('yoursubmissionfile_renamed', 'coursework') : "";
$this->_form->addElement('header', 'submitform', get_string($files_string, 'coursework'). $renamed);
@@ -408,7 +402,7 @@ protected function get_file_manager_options() {
*/
protected function make_plagiarism_instructions() {
$plagiarism_helpers = $this->get_coursework()->get_plagiarism_helpers();
- $plagiarism_instructions = array();
+ $plagiarism_instructions = [];
foreach ($plagiarism_helpers as $helper) {
if ($helper->file_submission_instructions()) {
$plagiarism_instructions[] = $helper->file_submission_instructions();
diff --git a/classes/forms/upload_allocations_form.php b/classes/forms/upload_allocations_form.php
index 503e7a19..795d2847 100644
--- a/classes/forms/upload_allocations_form.php
+++ b/classes/forms/upload_allocations_form.php
@@ -16,36 +16,33 @@
// along with Moodle. If not, see .
/**
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2016 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once($CFG->libdir.'/formslib.php');
-
-
class upload_allocations_form extends moodleform {
private $cmid;
- function __construct($cmid) {
- $this->cmid = $cmid;
+ function __construct($cmid) {
+ $this->cmid = $cmid;
parent::__construct();
}
- function definition() {
+ function definition() {
$mform =& $this->_form;
- $mform->addElement('filepicker', 'allocationsdata', get_string('allocationsfile','coursework'), null, array( 'accepted_types' => '*.csv'));
+ $mform->addElement('filepicker', 'allocationsdata', get_string('allocationsfile', 'coursework'), null, array( 'accepted_types' => '*.csv'));
$mform->addRule('allocationsdata', null, 'required');
- // $mform->addElement('checkbox','overwrite','',get_string('overwritegrades','coursework'));
- $mform->addElement('hidden','cmid',$this->cmid);
+ // $mform->addElement('checkbox', 'overwrite', '', get_string('overwritegrades', 'coursework'));
+ $mform->addElement('hidden', 'cmid', $this->cmid);
- $mform->setType('cmid',PARAM_RAW);
+ $mform->setType('cmid', PARAM_RAW);
$choices = csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
@@ -61,12 +58,11 @@ function definition() {
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');
-
- $this->add_action_buttons(true,get_string('uploadallocations','coursework'));
+ $this->add_action_buttons(true, get_string('uploadallocations', 'coursework'));
}
- function display() {
+ function display() {
return $this->_form->toHtml();
}
-}
\ No newline at end of file
+}
diff --git a/classes/forms/upload_feedback_form.php b/classes/forms/upload_feedback_form.php
index 4b01b931..7f49a791 100644
--- a/classes/forms/upload_feedback_form.php
+++ b/classes/forms/upload_feedback_form.php
@@ -1,49 +1,59 @@
.
+
/**
- * Created by PhpStorm.
- * User: Nigel.Daley
- * Date: 10/08/2015
- * Time: 18:27
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-
require_once($CFG->libdir.'/formslib.php');
-
-
class upload_feedback_form extends moodleform {
- private $cmid;
- private $coursework;
+ private $cmid;
+ private $coursework;
- function __construct($coursework, $cmid) {
- $this->cmid = $cmid;
- $this->coursework = $coursework;
+ function __construct($coursework, $cmid) {
+ $this->cmid = $cmid;
+ $this->coursework = $coursework;
parent::__construct();
}
- function definition() {
+ function definition() {
$mform =& $this->_form;
- $mform->addElement('filepicker', 'feedbackzip', get_string('feedbackzipfile','coursework'), null, array( 'accepted_types' => '*.zip'));
+ $mform->addElement('filepicker', 'feedbackzip', get_string('feedbackzipfile', 'coursework'), null, array( 'accepted_types' => '*.zip'));
$mform->addRule('feedbackzip', null, 'required');
- $mform->addHelpButton('feedbackzip', 'feedbackzipfile','coursework');
+ $mform->addHelpButton('feedbackzip', 'feedbackzipfile', 'coursework');
- $mform->addElement('advcheckbox','overwrite','',get_string('overwritefeedback','coursework'),null,array(0,1));
- $mform->addElement('hidden','cmid',$this->cmid);
- $mform->setType('cmid',PARAM_RAW);
+ $mform->addElement('advcheckbox', 'overwrite', '', get_string('overwritefeedback', 'coursework'), null, array(0, 1));
+ $mform->addElement('hidden', 'cmid', $this->cmid);
+ $mform->setType('cmid', PARAM_RAW);
- $options = array();
+ $options = [];
if ($this->coursework->get_max_markers() > 1) {
$capability = array('mod/coursework:addinitialgrade', 'mod/coursework:editinitialgrade');
- if (has_any_capability($capability, $this->coursework->get_context()) && !has_capability('mod/coursework:administergrades',$this->coursework->get_context())) {
+ if (has_any_capability($capability, $this->coursework->get_context()) && !has_capability('mod/coursework:administergrades', $this->coursework->get_context())) {
$options['initialassessor'] = get_string('initialassessor', 'coursework');
- } else if (has_capability('mod/coursework:administergrades',$this->coursework->get_context())){
+ } else if (has_capability('mod/coursework:administergrades', $this->coursework->get_context())) {
$options['assessor_1'] = get_string('assessorupload', 'coursework', '1');
if ($this->coursework->get_max_markers() >= 2) $options['assessor_2'] = get_string('assessorupload', 'coursework', '2');
if ($this->coursework->get_max_markers() >= 3) $options['assessor_3'] = get_string('assessorupload', 'coursework', '3');
@@ -54,25 +64,24 @@ function definition() {
$mform->addElement('select', 'feedbackstage', get_string('feedbackstage', 'coursework'), $options);
} else {
- $mform->addElement('hidden','feedbackstage','assessor_1');
- $mform->setType('feedbackstage',PARAM_RAW);
+ $mform->addElement('hidden', 'feedbackstage', 'assessor_1');
+ $mform->setType('feedbackstage', PARAM_RAW);
}
// Disable overwrite current feedback files checkbox if user doesn't have edit capability
- if(!has_capability('mod/coursework:editinitialgrade',$this->coursework->get_context())) {
+ if (!has_capability('mod/coursework:editinitialgrade', $this->coursework->get_context())) {
$mform->disabledIf('overwrite', 'feedbackstage', 'eq', 'initialassessor');
}
- if(!has_capability('mod/coursework:editagreedgrade',$this->coursework->get_context()) && !has_capability('mod/coursework:administergrades',$this->coursework->get_context()) ) {
+ if (!has_capability('mod/coursework:editagreedgrade', $this->coursework->get_context()) && !has_capability('mod/coursework:administergrades', $this->coursework->get_context()) ) {
$mform->disabledIf('overwrite', 'feedbackstage', 'eq', 'final_agreed_1');
}
-
- $this->add_action_buttons(true,get_string('uploadfeedbackzip','coursework'));
+ $this->add_action_buttons(true, get_string('uploadfeedbackzip', 'coursework'));
}
- function display() {
+ function display() {
return $this->_form->toHtml();
}
-}
\ No newline at end of file
+}
diff --git a/classes/forms/upload_grading_sheet_form.php b/classes/forms/upload_grading_sheet_form.php
index 564ba116..fd396742 100644
--- a/classes/forms/upload_grading_sheet_form.php
+++ b/classes/forms/upload_grading_sheet_form.php
@@ -1,37 +1,47 @@
.
+
/**
- * Created by PhpStorm.
- * User: Nigel.Daley
- * Date: 10/08/2015
- * Time: 18:27
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-
require_once($CFG->libdir.'/formslib.php');
-
-
class upload_grading_sheet_form extends moodleform {
private $cmid;
- function __construct($cmid) {
- $this->cmid = $cmid;
+ function __construct($cmid) {
+ $this->cmid = $cmid;
parent::__construct();
}
- function definition() {
+ function definition() {
$mform =& $this->_form;
- $mform->addElement('filepicker', 'gradingdata', get_string('gradingsheetfile','coursework'), null, array( 'accepted_types' => '*.csv'));
+ $mform->addElement('filepicker', 'gradingdata', get_string('gradingsheetfile', 'coursework'), null, array( 'accepted_types' => '*.csv'));
$mform->addRule('gradingdata', null, 'required');
- $mform->addElement('checkbox','overwrite','',get_string('overwritegrades','coursework'));
- $mform->addElement('hidden','cmid',$this->cmid);
+ $mform->addElement('checkbox', 'overwrite', '', get_string('overwritegrades', 'coursework'));
+ $mform->addElement('hidden', 'cmid', $this->cmid);
- $mform->setType('cmid',PARAM_RAW);
+ $mform->setType('cmid', PARAM_RAW);
$choices = csv_import_reader::get_delimiter_list();
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
@@ -47,15 +57,11 @@ function definition() {
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');
-
- $this->add_action_buttons(true,get_string('uploadgradingworksheet','coursework'));
+ $this->add_action_buttons(true, get_string('uploadgradingworksheet', 'coursework'));
}
- function display() {
+ function display() {
return $this->_form->toHtml();
}
-
-
-
-}
\ No newline at end of file
+}
diff --git a/classes/forms/view_all_students_mform.php b/classes/forms/view_all_students_mform.php
index 8c90cebe..e014ef43 100644
--- a/classes/forms/view_all_students_mform.php
+++ b/classes/forms/view_all_students_mform.php
@@ -14,9 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-/*
- * this is a mform designed to allow the toggling of the displaying of students not allocated to the current user
- *
+/**
+ * This is a mform designed to allow the toggling of the displaying of students not allocated to the current user
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_coursework\forms;
@@ -29,21 +31,19 @@
require_once($CFG->dirroot.'/lib/formslib.php');
-class view_all_students_mform extends moodleform {
+class view_all_students_mform extends moodleform {
- function definition() {
+ function definition() {
$this->_form->addElement('hidden', 'id', $this->_customdata['cmid']);
$this->_form->setType('id', PARAM_INT);
-
- $buttontext = (empty($this->_customdata['displayallstudents'])) ? get_string('viewallstudents', 'coursework') : get_string('hideallstudents','coursework');
- $hiddenvalue = (empty($this->_customdata['displayallstudents'])) ? 1 : 0;
+ $buttontext = (empty($this->_customdata['displayallstudents'])) ? get_string('viewallstudents', 'coursework') : get_string('hideallstudents', 'coursework');
+ $hiddenvalue = (empty($this->_customdata['displayallstudents'])) ? 1 : 0;
$this->_form->addElement('submit', 'displayallstudentbutton', $buttontext);
$this->_form->addElement('hidden', 'displayallstudents', $hiddenvalue);
$this->_form->setType('displayallstudents', PARAM_INT);
-
}
/**
@@ -55,5 +55,4 @@ public function display() {
return $this->_form->toHtml();
}
-
-}
\ No newline at end of file
+}
diff --git a/classes/framework/ability.php b/classes/framework/ability.php
index 94ac93a4..edf38364 100644
--- a/classes/framework/ability.php
+++ b/classes/framework/ability.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\framework;
use mod_coursework\ability\rule;
@@ -34,7 +54,7 @@ abstract class ability {
/**
* @var rule[]
*/
- protected $rules = array();
+ protected $rules = [];
/**
* We use a different instance of the class for each user. This makes it a bit cleaner.
@@ -138,7 +158,7 @@ protected function get_rule($action, $type) {
* @return array
*/
protected function classname_mappings() {
- return array();
+ return [];
}
/**
@@ -192,5 +212,4 @@ protected function prevent($action, $class, $function) {
$this->rules[] = $rule;
}
-
-}
\ No newline at end of file
+}
diff --git a/classes/framework/decorator.php b/classes/framework/decorator.php
index 57d988ae..7ebe0f7d 100644
--- a/classes/framework/decorator.php
+++ b/classes/framework/decorator.php
@@ -1,12 +1,31 @@
.
-namespace mod_coursework\framework;
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace mod_coursework\framework;
/**
* Class decorator
*
- * Acts as a decorator around a class. Remember to add the '@mixin' property so that PHPStorm will
+ * Acts as a decorator around a class. Remember to add the @ mixin property so that PHPStorm will
* provide autocompletion of methods and properties.
*/
class decorator {
@@ -63,4 +82,4 @@ public function __set($name, $value) {
public function wrapped_object() {
return $this->wrapped_object;
}
-}
\ No newline at end of file
+}
diff --git a/classes/framework/table_base.php b/classes/framework/table_base.php
index c79becab..06b93d57 100644
--- a/classes/framework/table_base.php
+++ b/classes/framework/table_base.php
@@ -14,8 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-namespace mod_coursework\framework;;
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace mod_coursework\framework;;
use moodle_database;
use stdClass;
@@ -108,7 +113,7 @@ public static function find($db_record, $reload = true) {
* @return array
* @throws \coding_exception
*/
- public static function find_all($params = array()) {
+ public static function find_all($params = []) {
if (!is_array($params)) {
throw new \coding_exception('::all() require an array of parameters');
@@ -119,7 +124,6 @@ public static function find_all($params = array()) {
return self::instantiate_objects($params);
}
-
/**
* Makes a new object ready to save
*
@@ -149,7 +153,6 @@ public static function create($params) {
return $item;
}
-
/**
* Takes the supplied DB record (one row of the table) and applies it to this object. If it's a
* number, change it to a DB row and then do it.
@@ -179,7 +182,7 @@ protected static function instantiate_objects($params) {
global $DB;
$raw_records = $DB->get_records(static::get_table_name(), $params);
- $objects = array();
+ $objects = [];
$klass = get_called_class();
foreach ($raw_records as $raw_record) {
$objects[$raw_record->id] = new $klass($raw_record);
@@ -510,7 +513,7 @@ private function build_data_object_to_save($sneakily = false) {
* @param array|table_base $conditions key value pairs of DB columns
* @return bool
*/
- public static function exists($conditions = array()) {
+ public static function exists($conditions = []) {
global $DB;
if (is_number($conditions)) {
@@ -520,7 +523,7 @@ public static function exists($conditions = array()) {
$conditions = $conditions->to_array();
}
- foreach($conditions as $colname => $value) {
+ foreach ($conditions as $colname => $value) {
static::ensure_column_exists($colname);
}
return $DB->record_exists(static::get_table_name(), $conditions);
@@ -530,7 +533,7 @@ public static function exists($conditions = array()) {
* @param array $conditions
* @return int
*/
- public static function count($conditions = array()) {
+ public static function count($conditions = []) {
global $DB;
foreach ($conditions as $colname => $value) {
@@ -594,7 +597,7 @@ public function __toString() {
* @return array
*/
public function to_array() {
- $data = array();
+ $data = [];
// Only save the non-null fields.
foreach (static::get_column_names() as $column_name) {
diff --git a/classes/framework/test/classes/user_table.php b/classes/framework/test/classes/user_table.php
index 02fdda36..afc21545 100644
--- a/classes/framework/test/classes/user_table.php
+++ b/classes/framework/test/classes/user_table.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
/**
* Class framework_user_table allows us to test the table_base class on a reasonably stable table
@@ -13,4 +33,4 @@ class framework_user_table extends \mod_coursework\framework\table_base {
*/
protected static $table_name = 'user';
-}
\ No newline at end of file
+}
diff --git a/classes/framework/test/table_base_test.php b/classes/framework/test/table_base_test.php
index 846e448e..2f16324e 100644
--- a/classes/framework/test/table_base_test.php
+++ b/classes/framework/test/table_base_test.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
defined('MOODLE_INTERNAL') || die();
@@ -11,7 +31,7 @@
*/
class framework_table_base_test extends advanced_testcase {
- public function SetUp() {
+ public function setUp(): void {
$this->resetAfterTest();
}
@@ -72,12 +92,11 @@ public function test_find_when_false_and_zero_supplied() {
$this->assertFalse(framework_user_table::find(0));
}
-
public function test_exists_when_true() {
$generator = testing_util::get_data_generator();
$params = array(
- 'username' =>'freddo'
+ 'username' => 'freddo'
);
$generator->create_user($params);
@@ -120,4 +139,4 @@ public function test_find_all_returns_specific_records() {
$this->assertEquals(2, count(framework_user_table::find_all(array('firstname' => 'Dave'))));
}
-}
\ No newline at end of file
+}
diff --git a/classes/grade_judge.php b/classes/grade_judge.php
index c218c0cf..f4f4187d 100644
--- a/classes/grade_judge.php
+++ b/classes/grade_judge.php
@@ -1,5 +1,24 @@
.
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework;
@@ -141,12 +160,11 @@ public function is_feedback_that_is_promoted_to_gradebook(feedback $feedback) {
return $gradebook_feedback && $gradebook_feedback->id == $feedback->id;
}
-
/**
* @param allocatable $allocatable
* @return bool
*/
- public function allocatable_needs_more_than_one_feedback ($allocatable){
+ public function allocatable_needs_more_than_one_feedback ($allocatable) {
if ($this->coursework->sampling_enabled()) {
assessment_set_membership::fill_pool_coursework($this->coursework->id);
@@ -156,15 +174,14 @@ public function allocatable_needs_more_than_one_feedback ($allocatable){
return $this->coursework->has_multiple_markers();
}
-
}
- public function grade_in_scale($value) {
+ public function grade_in_scale($value) {
if (is_null($value)) {
return true;
} else if ($this->coursework->grade >= 1) {
// Numeric grade
- return is_numeric($value) && $value < $this->coursework->grade +1 && $value > 0;
+ return is_numeric($value) && $value < $this->coursework->grade + 1 && $value > 0;
} else if ($this->coursework->grade == 0) {
// No grade
return true;
@@ -172,7 +189,7 @@ public function grade_in_scale($value) {
// Scale
$scale = \grade_scale::fetch(array('id' => abs($this->coursework->grade)));
$scale->load_items();
- return in_array($value,$scale->scale_items);
+ return in_array($value, $scale->scale_items);
}
}
@@ -182,21 +199,17 @@ public function grade_in_scale($value) {
* @param $value
* @return mixed
*/
- public function get_grade($value) {
+ public function get_grade($value) {
if ($this->coursework->grade <= -1) {
// Scale
$scale = \grade_scale::fetch(array('id' => abs($this->coursework->grade)));
$scale->load_items();
- return array_search($value,$scale->scale_items)+1;
+ return array_search($value, $scale->scale_items) + 1;
} else {
return $value;
}
-
}
-
-
-
-}
\ No newline at end of file
+}
diff --git a/classes/grades/gradeitems.php b/classes/grades/gradeitems.php
index 63e7a507..dbc56d1b 100644
--- a/classes/grades/gradeitems.php
+++ b/classes/grades/gradeitems.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
/**
* Grade item mappings for the activity.
*
@@ -24,8 +30,8 @@
namespace mod_coursework\grades;
-use \core_grades\local\gradeitem\itemnumber_mapping;
-use \core_grades\local\gradeitem\advancedgrading_mapping;
+use core_grades\local\gradeitem\itemnumber_mapping;
+use core_grades\local\gradeitem\advancedgrading_mapping;
/**
* Grade item mappings for the activity.
@@ -58,4 +64,3 @@ public static function get_advancedgrading_itemnames(): array {
}
}
-
diff --git a/classes/grading_report.php b/classes/grading_report.php
index ace35c2c..b806f21b 100644
--- a/classes/grading_report.php
+++ b/classes/grading_report.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework;
use mod_coursework\models\allocation;
@@ -72,18 +78,18 @@ class grading_report {
/**
* @var cell_interface[]
*/
- private $cells;
+ private $cells;
/**
* Grades in $data must be already rounded to the set number of decimals or must be null
- * (in which later case, the [mod_workshop,nullgrade] string shall be displayed)
+ * (in which later case, the [mod_workshop, nullgrade] string shall be displayed)
*
* @param array $options
* @param coursework $coursework
*/
public function __construct(array $options, $coursework) {
- $options['courseworkid'] = $coursework->id;
+ $options['courseworkid'] = $coursework->id;
$this->options = $options;
$this->coursework = $coursework;
@@ -114,7 +120,6 @@ public function get_coursework() {
return $this->coursework;
}
-
/**
* @param $options
* @return string
@@ -199,7 +204,6 @@ public function sort_by_firstname($a, $b) {
return $sort;
}
-
/**
* For use with usort.
* Method called dynamically, so don't delete if unused. See construct_sort_function_name().
@@ -251,7 +255,6 @@ public function sort_by_lastname($a, $b) {
return $this->sort_by_stringfield($a->get_student_lastname(), $b->get_student_lastname());
}
-
/**
* For use with usort.
* Method called dynamically, so don't delete if unused. See construct_sort_function_name().
@@ -264,8 +267,6 @@ public function sort_by_groupname($a, $b) {
return $this->sort_by_stringfield($a->get_allocatable()->name, $b->get_allocatable()->name);
}
-
-
/**
* For use with usort.
* Method called dynamically, so don't delete if unused. See construct_sort_function_name().
@@ -340,7 +341,7 @@ public function get_participant_count() {
*
* @return grading_table_row_base[] row objects
*/
- public function get_table_rows_for_page($rowcount=false) {
+ public function get_table_rows_for_page($rowcount = false) {
global $USER;
@@ -350,20 +351,20 @@ public function get_table_rows_for_page($rowcount=false) {
$participants = $this->coursework->get_allocatables();
// Make tablerow objects so we can use the methods to check permissions and set things.
- $rows = array();
+ $rows = [];
$row_class = $this->coursework->has_multiple_markers() ? 'mod_coursework\grading_table_row_multi' : 'mod_coursework\grading_table_row_single';
$ability = new ability(user::find($USER, false), $this->get_coursework());
- $participantsfound = 0;
+ $participantsfound = 0;
foreach ($participants as $key => $participant) {
// handle 'Group mode' - unset groups/individuals thaat are not in the chosen group
- if(!empty($options['group']) && $options['group'] != -1){
- if ($this->coursework->is_configured_to_have_group_submissions()){
- if($options['group'] != $participant->id) continue;
+ if (!empty($options['group']) && $options['group'] != -1) {
+ if ($this->coursework->is_configured_to_have_group_submissions()) {
+ if ($options['group'] != $participant->id) continue;
} else {
- if(!$this->coursework->student_in_group($participant->id, $options['group']))continue;
+ if (!$this->coursework->student_in_group($participant->id, $options['group']))continue;
}
}
@@ -426,5 +427,4 @@ public function get_options() {
return $this->options;
}
-
}
diff --git a/classes/grading_table_row_base.php b/classes/grading_table_row_base.php
index 9359326e..51532886 100644
--- a/classes/grading_table_row_base.php
+++ b/classes/grading_table_row_base.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework;
use html_writer;
@@ -26,7 +32,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Refactoring the grading table to clarify the logic. There will be two subclasses of this -
* one for single row tables and one for multi-row tables. These classes contain all the business
@@ -180,7 +185,7 @@ public function get_time_submitted() {
/**
* Getter for personal deadline time
- *
+ *
* @return int|mixed|string
*/
public function get_personal_deadlines() {
@@ -195,18 +200,16 @@ public function get_personal_deadlines() {
$personal_deadline = $DB->get_record('coursework_person_deadlines',
array('courseworkid' => $this->get_coursework()->id,
'allocatableid' => $allocatable->id(),
- 'allocatabletype'=> $allocatable->type()));
- if ($personal_deadline){
+ 'allocatabletype' => $allocatable->type()));
+ if ($personal_deadline) {
$personal_deadline = $personal_deadline->personal_deadline;
} else {
$personal_deadline = $this->get_coursework()->deadline;
}
-
+
return $personal_deadline;
}
-
-
/**
* Returns the hash used to name files anonymously for this user/coursework combination
*/
@@ -260,7 +263,6 @@ public function get_plagiarism_flag() {
return plagiarism_flag::find($params);
}
-
/**
* Chained getter to prevent tight coupling.
*
@@ -347,7 +349,7 @@ public function get_student_firstname() {
$allocatable = $this->get_allocatable();
if (empty($allocatable->firstname)) {
- $this->allocatable = user::find($allocatable);
+ $this->allocatable = user::find($allocatable);
}
return $this->get_allocatable()->firstname;
@@ -362,7 +364,7 @@ public function get_student_lastname() {
$allocatable = $this->get_allocatable();
if (empty($allocatable->lastname)) {
- $this->allocatable = user::find($allocatable);
+ $this->allocatable = user::find($allocatable);
}
return $this->get_allocatable()->lastname;
@@ -390,11 +392,10 @@ public function has_feedback() {
/**
* @return models\feedback
*/
- public function get_single_feedback(){
+ public function get_single_feedback() {
return $this->get_submission()->get_assessor_feedback_by_stage('assessor_1');
}
-
/**
* Check if the extension is given to this row
*
@@ -406,11 +407,10 @@ public function has_extension() {
global $DB;
return $DB->record_exists('coursework_extensions', array('courseworkid' => $this->get_coursework()->id,
'allocatableid' => $this->get_allocatable()->id(),
- 'allocatabletype'=> $this->get_allocatable()->type()));
+ 'allocatabletype' => $this->get_allocatable()->type()));
}
-
/**
* Getter for row extension
*
@@ -421,7 +421,7 @@ public function get_extension() {
global $DB;
return $DB->get_record('coursework_extensions', array('courseworkid' => $this->get_coursework()->id,
'allocatableid' => $this->get_allocatable()->id(),
- 'allocatabletype'=> $this->get_allocatable()->type()));
+ 'allocatabletype' => $this->get_allocatable()->type()));
}
public function get_user_firstname() {
@@ -433,8 +433,7 @@ public function get_user_firstname() {
$viewanonymous = has_capability('mod/coursework:viewanonymous', $this->get_coursework()->get_context());
if (!$this->get_coursework()->blindmarking || $viewanonymous || $this->is_published() ) {
return $user->firstname;
- }
- else {
+ } else {
return get_string('hidden', 'mod_coursework');
}
}
@@ -448,8 +447,7 @@ public function get_user_lastname() {
$viewanonymous = has_capability('mod/coursework:viewanonymous', $this->get_coursework()->get_context());
if (!$this->get_coursework()->blindmarking || $viewanonymous || $this->is_published()) {
return $user->lastname;
- }
- else {
+ } else {
return get_string('hidden', 'mod_coursework');
}
}
diff --git a/classes/grading_table_row_multi.php b/classes/grading_table_row_multi.php
index a10bfc7b..d2d1ece9 100644
--- a/classes/grading_table_row_multi.php
+++ b/classes/grading_table_row_multi.php
@@ -14,17 +14,21 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework;
defined('MOODLE_INTERNAL') || die();
-
/**
* Single row of the grading table for when there are multiple markers.
*/
class grading_table_row_multi extends grading_table_row_base {
-
/**
* Returns a new table object using the attached submission as a constructor.
*
@@ -35,5 +39,4 @@ public function get_assessor_feedback_table() {
return $table;
}
-
-}
\ No newline at end of file
+}
diff --git a/classes/grading_table_row_single.php b/classes/grading_table_row_single.php
index b5c889e4..4c43405c 100644
--- a/classes/grading_table_row_single.php
+++ b/classes/grading_table_row_single.php
@@ -14,17 +14,21 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework;
use coding_exception;
defined('MOODLE_INTERNAL') || die();
-
/**
* Single row of the grading table for when there is just one marker
*/
class grading_table_row_single extends grading_table_row_base {
-
}
diff --git a/classes/mailer.php b/classes/mailer.php
index 99ab0ed3..7d9dee85 100644
--- a/classes/mailer.php
+++ b/classes/mailer.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework;
use mod_coursework\models\submission;
@@ -88,7 +108,7 @@ public function send_late_submission_notification($submission) {
foreach ($recipients as $recipient) {
// New approach.
- $eventdata = new \core\message\message();
+ $eventdata = new \core\message\message();
$eventdata->component = 'mod_coursework';
$eventdata->name = 'submission_receipt';
$eventdata->userfrom = \core_user::get_noreply_user();
@@ -110,7 +130,6 @@ public function send_late_submission_notification($submission) {
}
}
-
/**
* Send feedback notifications to users whose feedback was released
*
@@ -164,7 +183,7 @@ public function send_feedback_notification($submission) {
* @return mixed
* @throws \coding_exception
*/
- public function send_student_deadline_reminder($user) {
+ public function send_student_deadline_reminder($user) {
global $CFG;
@@ -175,7 +194,7 @@ public function send_student_deadline_reminder($user) {
$email_data->coursework_name = $this->coursework->name;
$email_data->coursework_name_with_link = \html_writer::link($CFG->wwwroot . '/mod/coursework/view.php?id=' . $this->coursework->get_coursemodule_id(), $this->coursework->name);
$email_data->deadline = $user->deadline;
- $email_data->human_deadline = userdate($user->deadline,'%a, %d %b %Y, %H:%M');
+ $email_data->human_deadline = userdate($user->deadline, '%a, %d %b %Y, %H:%M');
$secondstodeadline = $user->deadline - time();
$days = floor($secondstodeadline / 86400);
@@ -195,7 +214,7 @@ public function send_student_deadline_reminder($user) {
$text_body = get_string('cron_email_text', 'mod_coursework', $email_data);
$html_body = get_string('cron_email_html', 'mod_coursework', $email_data);
- $eventdata = new \core\message\message();
+ $eventdata = new \core\message\message();
$eventdata->component = 'mod_coursework';
$eventdata->name = 'student_deadline_reminder';
$eventdata->userfrom = \core_user::get_noreply_user();
@@ -213,9 +232,7 @@ public function send_student_deadline_reminder($user) {
return message_send($eventdata);
}
-
-
- public function send_submission_notification($userstonotify) {
+ public function send_submission_notification($userstonotify) {
global $CFG;
@@ -250,6 +267,5 @@ public function send_submission_notification($userstonotify) {
message_send($eventdata);
}
-
}
-}
\ No newline at end of file
+}
diff --git a/classes/models/allocation.php b/classes/models/allocation.php
index 73b50b53..3b019615 100644
--- a/classes/models/allocation.php
+++ b/classes/models/allocation.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework\models;
use mod_coursework\framework\table_base;
diff --git a/classes/models/assessment_set_membership.php b/classes/models/assessment_set_membership.php
index 5482ab94..d5f179f9 100644
--- a/classes/models/assessment_set_membership.php
+++ b/classes/models/assessment_set_membership.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
/**
* This class allows us to add functionality to the users, despite the fact that Moodle has no
@@ -9,8 +29,8 @@
namespace mod_coursework\models;
use mod_coursework\framework\table_base;
-use \mod_coursework\allocation\allocatable;
-use \mod_coursework\allocation\moderatable;
+use mod_coursework\allocation\allocatable;
+use mod_coursework\allocation\moderatable;
/**
* @property int courseworkid
@@ -85,4 +105,4 @@ protected function after_destroy() {
self::remove_cache($this->courseworkid);
}
-}
\ No newline at end of file
+}
diff --git a/classes/models/course_module.php b/classes/models/course_module.php
index 26742727..ec329270 100644
--- a/classes/models/course_module.php
+++ b/classes/models/course_module.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework\models;
use mod_coursework\framework\table_base;
diff --git a/classes/models/coursework.php b/classes/models/coursework.php
index fe942c5f..e13c3e00 100644
--- a/classes/models/coursework.php
+++ b/classes/models/coursework.php
@@ -18,15 +18,13 @@
* Page that prints a table of all students and all markers so that first marker, second marker, moderators
* etc can be allocated manually or automatically.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_coursework\models;
-
use coding_exception;
use context_course;
@@ -239,7 +237,7 @@ class coursework extends table_base {
/**
* @var array
*/
- protected $stages = array();
+ protected $stages = [];
/**
* @var \context Instance of a moodle context, i.e. that of the coursemodule for this coursework.
@@ -381,7 +379,6 @@ class coursework extends table_base {
*/
public $extensionsenabled;
-
public $gradeeditingtime;
/**
@@ -389,13 +386,11 @@ class coursework extends table_base {
*/
public $markingdeadlineenabled;
-
/**
* @var int
*/
public $initialmarkingdeadline;
-
/**
* @var int
*/
@@ -460,8 +455,7 @@ public function get_course_module() {
return $this->coursemodule;
}
- public function cm_object($coursemodule){
-
+ public function cm_object($coursemodule) {
$modinfo = get_fast_modinfo($this->get_course_id());
return $this->coursemodule = $modinfo->get_cm($coursemodule->id);
@@ -495,7 +489,6 @@ public function get_coursemodule_idnumber() {
return (int)$coursemodule->idnumber;
}
-
/**
* Getter function for the coursework's course object.
*
@@ -593,7 +586,7 @@ public function deadline_has_passed() {
return ($this->has_deadline() && $this->deadline < time());
}
- public function has_deadline() {
+ public function has_deadline() {
return !empty($this->deadline);
}
@@ -618,7 +611,7 @@ public function get_participants($groups = array(0)) {
// Fetch the list of ids of all participants - this may get really long so fetch just id.
$groups = (array)$groups;
- $allusers = array();
+ $allusers = [];
foreach ($groups as $groupdid) {
$allusers = array_merge($allusers, get_enrolled_users($this->get_context(), 'mod/coursework:submit', $groupdid, 'u.id'));
}
@@ -659,8 +652,7 @@ public function get_context_id() {
return $this->get_context()->id;
}
-
- function get_grade_editing_time() {
+ function get_grade_editing_time() {
return $this->gradeeditingtime;
}
@@ -670,17 +662,16 @@ function get_grade_editing_time() {
* @return int
*/
function get_initial_marking_deadline() {
- return (!empty($this->initialmarkingdeadline)) ? $this->initialmarkingdeadline : 0;
+ return (!empty($this->initialmarkingdeadline)) ? $this->initialmarkingdeadline : 0;
}
-
/**
* Returns the initial marking deadline timestamp
*
* @return int
*/
function get_agreed_grade_marking_deadline() {
- return (!empty($this->agreedgrademarkingdeadline)) ? $this->agreedgrademarkingdeadline : 0;
+ return (!empty($this->agreedgrademarkingdeadline)) ? $this->agreedgrademarkingdeadline : 0;
}
/**
@@ -697,7 +688,7 @@ public function get_file_options() {
$turnitinenabled = $this->tii_enabled();
// Turn it in only allows one file.
- $max_files = $this->maxfiles;
+ $max_files = $this->maxfiles;
// Turn it in only likes some file types.
/* DOC, DOCX, Corel
@@ -828,7 +819,7 @@ public function get_allocatable_identifier_hash($allocatable) {
*/
public function get_plagiarism_helpers() {
$enabled_plagiarism_plugins = array_keys(\core_component::get_plugin_list('plagiarism'));
- $objects = array();
+ $objects = [];
foreach ($enabled_plagiarism_plugins as $plugin_name) {
$class_name = "\\mod_coursework\\plagiarism_helpers\\{$plugin_name}";
if (class_exists($class_name)) {
@@ -870,7 +861,6 @@ public function plagiarism_enbled() {
return false;
}
-
/**
* @return bool
*/
@@ -885,7 +875,6 @@ public function early_finalisation_allowed() {
return !!$this->allowearlyfinalisation;
}
-
/**
* Pushes all grades form the coursework into the gradebook. Will overwrite any older grades.
*
@@ -957,11 +946,11 @@ public function pack_files() {
$ability = new ability(user::find($USER), $this);
$submissions = $DB->get_records('coursework_submissions',
- array('courseworkid' => $this->id, 'finalised'=>1));
+ array('courseworkid' => $this->id, 'finalised' => 1));
if (!$submissions) {
return false;
}
- $files_for_zipping = array();
+ $files_for_zipping = [];
$fs = get_file_storage();
$grading_sheet = new \mod_coursework\export\grading_sheet($this, null, null);
@@ -973,7 +962,6 @@ public function pack_files() {
// If allocations are in use, then we don't supply files that are not allocated.
$submission = submission::find($submission);
-
$files = $fs->get_area_files($context->id, 'mod_coursework', 'submission',
$submission->id, "id", false);
foreach ($files as $f) {
@@ -982,26 +970,24 @@ public function pack_files() {
$foldername = '';
- if($this->blindmarking == 0 || has_capability('mod/coursework:viewanonymous',$this->get_context())) {
+ if ($this->blindmarking == 0 || has_capability('mod/coursework:viewanonymous', $this->get_context())) {
$submissionuser = $submission->get_allocatable();
if ($this->is_configured_to_have_group_submissions() && $submissionuser->name) {
$foldername = $submissionuser->name . '_';
- } elseif(!$this->is_configured_to_have_group_submissions()) {
+ } else if (!$this->is_configured_to_have_group_submissions()) {
$foldername = $submissionuser->firstname . ' ' . $submissionuser->lastname . '_';
}
}
- $foldername .= $this->get_username_hash($submission->get_allocatable()->id());
+ $foldername .= $this->get_username_hash($submission->get_allocatable()->id());
- $filename = $foldername.'/'.$filename;
+ $filename = $foldername.'/'.$filename;
/* @var $f stored_file */
$files_for_zipping[$filename] = $f;
}
}
-
-
// Create path for new zip file.
$temp_zip = tempnam($CFG->dataroot.'/temp/', 'ocm_');
// Zip files.
@@ -1012,10 +998,6 @@ public function pack_files() {
return false;
}
-
-
-
-
/**
* Makes code cleaner than writing MATHS all over the place!!
* @return bool
@@ -1223,7 +1205,7 @@ public function assessor_has_any_allocation_for_student($allocatable, $userid=fa
global $DB, $USER;
- if (!$userid){
+ if (!$userid) {
$userid = $USER->id;
}
$params = array(
@@ -1236,7 +1218,6 @@ public function assessor_has_any_allocation_for_student($allocatable, $userid=fa
return $DB->record_exists('coursework_allocation_pairs', $params);
}
-
/**
* Check if current assessor is not already allocated for this submission in different stage
*
@@ -1262,7 +1243,6 @@ public function assessor_has_allocation_for_student_not_in_current_stage($alloca
return false;
}
-
/**
* Checks whether the current user is an assessor allocated to mark this submission.
*
@@ -1305,22 +1285,21 @@ public function get_all_submissions() {
* @throws \dml_missing_record_exception
* @throws \dml_multiple_records_exception
*/
- public function get_submissions_needing_grading(){
+ public function get_submissions_needing_grading() {
- $needsgrading = array();
+ $needsgrading = [];
$submissions = $this->get_finalised_submissions();
foreach ($submissions as $submission) {
- $stage_identifier = ($this->has_multiple_markers())? 'final_agreed_1': 'assessor_1';
+ $stage_identifier = ($this->has_multiple_markers()) ? 'final_agreed_1' : 'assessor_1';
$submission = submission::find($submission);
- if (!$feedback = $submission->get_assessor_feedback_by_stage($stage_identifier)){
+ if (!$feedback = $submission->get_assessor_feedback_by_stage($stage_identifier)) {
$needsgrading[] = $submission;
}
}
-
return $needsgrading;
}
@@ -1333,14 +1312,14 @@ public function get_submissions_needing_grading(){
* @throws \dml_missing_record_exception
* @throws \dml_multiple_records_exception
*/
- public function get_graded_submissions_by_stage($stage_identifier){
+ public function get_graded_submissions_by_stage($stage_identifier) {
- $graded = array();
+ $graded = [];
$submissions = $this->get_finalised_submissions();
foreach ($submissions as $submission) {
$submission = submission::find($submission);
- if ($feedback = $submission->get_assessor_feedback_by_stage($stage_identifier)){
+ if ($feedback = $submission->get_assessor_feedback_by_stage($stage_identifier)) {
$graded[$submission->id] = $submission;
}
}
@@ -1354,18 +1333,18 @@ public function get_graded_submissions_by_stage($stage_identifier){
* @return array
* @throws \dml_exception
*/
- public function get_assessor_graded_submissions($assessorid){
+ public function get_assessor_graded_submissions($assessorid) {
global $DB;
- $graded = array();
+ $graded = [];
$params = array('courseworkid' => $this->id, 'assessorid' => $assessorid);
$sql = "SELECT cs.id
- FROM {coursework_feedbacks} cf
- JOIN {coursework_submissions} cs
+ FROM {coursework_feedbacks} cf
+ JOIN {coursework_submissions} cs
ON cs.id = cf.submissionid
- WHERE cs.courseworkid = :courseworkid
+ WHERE cs.courseworkid = :courseworkid
AND assessorid = :assessorid";
- $submissions = $DB->get_records_sql($sql, $params);
+ $submissions = $DB->get_records_sql($sql, $params);
foreach ($submissions as $submission) {
$submission = submission::find($submission);
@@ -1375,14 +1354,13 @@ public function get_assessor_graded_submissions($assessorid){
return $graded;
}
-
/**
* Get all published submissions in the coursework
*
* @return array
* @throws \dml_exception
*/
- public function get_published_submissions(){
+ public function get_published_submissions() {
global $DB;
$sql = "SELECT *
@@ -1390,14 +1368,13 @@ public function get_published_submissions(){
WHERE courseworkid = :courseworkid
AND firstpublished IS NOT NULL";
- $submissions = $DB->get_records_sql($sql, array('courseworkid' => $this->id));
+ $submissions = $DB->get_records_sql($sql, array('courseworkid' => $this->id));
foreach ($submissions as &$submission) {
$submission = submission::find($submission);
}
return $submissions;
}
-
/**
* Returns a hash of this user's id. Not username as this would be non-unique across
* different courseworks, compromising anonymity.
@@ -1408,26 +1385,23 @@ public function get_published_submissions(){
* @param int $userid
* @return string
*/
- static function get_name_hash($id,$userid,$time=1440000609)
- {
+ static function get_name_hash($id, $userid, $time=1440000609) {
if ($id < 1) {
return '';
}
- $uhash = $id . $userid;
+ $uhash = $id . $userid;
- //hash with zero have the potential to become changed in outside programs
- //so we generate a hash without a leading zero
+ // Hash with zero have the potential to become changed in outside programs
+ // So we generate a hash without a leading zero
$uhash = substr(md5($uhash), 0, 8);
$uhash = 'X' . $uhash;
-
return $uhash;
}
- public function get_username_hash($userid)
- {
- return static::get_name_hash($this->id,$userid,$this->timecreated);
+ public function get_username_hash($userid) {
+ return static::get_name_hash($this->id, $userid, $this->timecreated);
}
/**
@@ -1475,16 +1449,15 @@ public function get_assessor_allocation($allocatable, $stage_identifier) {
$params = array(
'courseworkid' => $this->id,
'allocatableid' => $allocatable->allocatableid,
- 'stage_identifier'=>$stage_identifier,
- 'allocatabletype'=> $allocatable->allocatabletype
+ 'stage_identifier' => $stage_identifier,
+ 'allocatabletype' => $allocatable->allocatabletype
);
$allocation = $DB->get_record('coursework_allocation_pairs', $params);
return $allocation;
}
-
- public function get_assessors_stage_identifier($allocatable_id, $assessor_id){
+ public function get_assessors_stage_identifier($allocatable_id, $assessor_id) {
global $DB;
$params = array(
@@ -1498,7 +1471,6 @@ public function get_assessors_stage_identifier($allocatable_id, $assessor_id){
return $stage_identifier->stage_identifier;
}
-
/**
* Checks settings to see whether the current user (who we assume is a student) can
* view their feedback.
@@ -1827,7 +1799,6 @@ public function build_own_submission($user) {
return submission::build($own_submission_params);
}
-
/**
* Uses the knowledge of the Coursework settings to compose the object which the renderer can deal with.
* This is the messy wiring for the nice, reusable components in the grading report :)
@@ -1845,7 +1816,6 @@ public function renderable_grading_report_factory($report_options) {
'coursework' => $this,
);
-
// Add the cell objects. These are used to generate the table headers and to render each row.
if ($this->is_configured_to_have_group_submissions()) {
$report->add_cell(new group_cell($cell_items));
@@ -1886,7 +1856,7 @@ public function renderable_grading_report_factory($report_options) {
);
$report->add_cell(new single_assessor_feedback_cell($items_with_stage));
}
- if($this->moderation_agreement_enabled()){
+ if ($this->moderation_agreement_enabled()) {
$items_with_stage = array(
'stage' => $this->get_moderator_grade_stage(),
'coursework' => $this,
@@ -1955,7 +1925,7 @@ public function due_to_send_second_reminders($deadline) {
* @return user[]
*/
public function get_students() {
- $users = array();
+ $users = [];
$raw_users = get_enrolled_users($this->get_context(), 'mod/coursework:submit');
// filter students who are restricted from the coursework
@@ -1997,7 +1967,7 @@ public function get_students_who_have_not_yet_submitted() {
* @return user[]
*/
public function initial_assessors($student) {
- $assessors = array();
+ $assessors = [];
$stages = $this->get_assessor_marking_stages();
// If allocations, send the allocated teachers.
// Otherwise send everyone.
@@ -2095,22 +2065,21 @@ public function student_is_in_any_group($student) {
/**
* @return bool
*/
- public function sampling_enabled()
- {
+ public function sampling_enabled() {
return (bool)$this->samplingenabled;
}
/**
* @return bool
*/
- public function automaticagreement_enabled(){
+ public function automaticagreement_enabled() {
return $this->automaticagreementstrategy != null;
}
/**
* @return bool
*/
- public function autopopulatefeedbackcomment_enabled(){
+ public function autopopulatefeedbackcomment_enabled() {
return (bool)$this->autopopulatefeedbackcomment;
}
@@ -2170,11 +2139,11 @@ protected function get_advanced_grading_manager() {
*
* @return bool
*/
- public function is_using_rubric(){
+ public function is_using_rubric() {
$grading_manager = $this->get_advanced_grading_manager();
$method = $grading_manager->get_active_method();
- if ($method == 'rubric'){
+ if ($method == 'rubric') {
return true;
}
return false;
@@ -2185,7 +2154,7 @@ public function is_using_rubric(){
*
* @return mixed
*/
- public function get_rubric_criteria(){
+ public function get_rubric_criteria() {
$controller = $this->get_advanced_grading_active_controller();
return $controller->get_definition()->rubric_criteria;
}
@@ -2209,7 +2178,7 @@ public function marking_stages() {
$this->stages[$identifier] = new final_agreed($this, $identifier);
}
- if ($this->moderation_agreement_enabled()){
+ if ($this->moderation_agreement_enabled()) {
$identifier = 'moderator';
$this->stages[$identifier] = new moderator($this, $identifier);
@@ -2225,12 +2194,12 @@ public function marking_stages() {
* @return stage_base[]
*/
public function get_assessor_marking_stages() {
- $stages = array();
+ $stages = [];
for ($i = 1; $i <= $this->get_max_markers(); $i++) {
$stages[] = new assessor($this, 'assessor_' . $i);
}
- if ($this->moderation_agreement_enabled()){
+ if ($this->moderation_agreement_enabled()) {
$stages[] = new moderator($this, 'moderator');
}
@@ -2261,11 +2230,10 @@ private function get_moderator_grade_stage() {
}
}
- public function get_submission_notification_users() {
+ public function get_submission_notification_users() {
return $this->submissionnotification;
}
-
/**
* Utility method that returns an image icon.
*
@@ -2290,7 +2258,7 @@ public final static function get_image($text, $image_name) {
public function get_allocatables() {
global $DB;
- $allocatables = array();
+ $allocatables = [];
if ($this->is_configured_to_have_group_submissions()) {
if ($this->grouping_id) {
@@ -2320,14 +2288,14 @@ public function get_allocatables() {
$groups = $DB->get_records_sql($sql, $params);
foreach ($groups as $group) {
$group = group::find($group);
- //find out if members of this group can access this coursework, if group is left without members then remove it
+ // Find out if members of this group can access this coursework, if group is left without members then remove it
$cm = $this->get_course_module();
$cmobject = $this->cm_object($cm);
/**
* @var group $group
*/
- $members = $group->get_members($this->get_context(), $cmobject);
- if (empty($members)){
+ $members = $group->get_members($this->get_context(), $cmobject);
+ if (empty($members)) {
continue;
}
$allocatables[$group->id] = $group;
@@ -2422,25 +2390,25 @@ public function has_stuff_to_publish() {
/**
* @return bool
*/
- public function is_general_feedback_enabled(){
+ public function is_general_feedback_enabled() {
return ($this->generalfeedback != 0);
}
/**
* @return bool
*/
- public function has_individual_autorelease_feedback_enabled(){
+ public function has_individual_autorelease_feedback_enabled() {
return ($this->individualfeedback != 0);
}
/**
* @return array
*/
- public function get_finalised_submissions(){
+ public function get_finalised_submissions() {
global $DB;
$submissions = $DB->get_records('coursework_submissions',
- array('courseworkid' => $this->id, 'finalised'=>1), '', 'id');
+ array('courseworkid' => $this->id, 'finalised' => 1), '', 'id');
foreach ($submissions as &$submission) {
$submission = submission::find($submission);
@@ -2461,18 +2429,18 @@ public function finalise_all() {
global $DB;
$excludesql = '';
// check if any extensions granted for this coursework
- if ($this->extensions_enabled() && $this->extension_exists()){
+ if ($this->extensions_enabled() && $this->extension_exists()) {
$submissions_with_extensions = $this->get_submissions_with_extensions();
- foreach ($submissions_with_extensions as $submission){
+ foreach ($submissions_with_extensions as $submission) {
// exclude submissions that are still within extended deadline
- if ($submission->extended_deadline > time()){
+ if ($submission->extended_deadline > time()) {
$excludesubmissions[$submission->submissionid] = $submission->submissionid;
}
}
// build exclude sql
- if (!empty($excludesubmissions)){
+ if (!empty($excludesubmissions)) {
$excludesql = ' AND id NOT IN(';
- $excludesql .= implode(',',$excludesubmissions);
+ $excludesql .= implode(',', $excludesubmissions);
$excludesql .= ')';
}
}
@@ -2495,8 +2463,6 @@ public function finalise_all() {
$excludesql .= ')';
}
-
-
$DB->execute("UPDATE {coursework_submissions}
SET finalised = 1
WHERE courseworkid = ? $excludesql", array($this->id));
@@ -2508,7 +2474,7 @@ public function finalise_all() {
public static function extension_reasons() {
global $CFG;
- $extension_reasons = array();
+ $extension_reasons = [];
if (!empty($CFG->coursework_extension_reasons_list)) {
$extension_reasons = $CFG->coursework_extension_reasons_list;
$extension_reasons = explode("\n", $extension_reasons);
@@ -2532,13 +2498,13 @@ public function extensions_enabled() {
/*
* @return bool
*/
- public function extension_exists(){
+ public function extension_exists() {
global $DB;
- return $DB->record_exists('coursework_extensions',array('courseworkid'=>$this->id));
+ return $DB->record_exists('coursework_extensions', array('courseworkid' => $this->id));
}
- public function get_submissions_with_extensions(){
+ public function get_submissions_with_extensions() {
global $DB;
$sql = "SELECT *, cs.id as submissionid
@@ -2549,13 +2515,13 @@ public function get_submissions_with_extensions(){
AND ce.allocatabletype = cs.allocatabletype
AND cs.courseworkid = :courseworkid";
- return $DB->get_records_sql($sql,array('courseworkid'=>$this->id));
+ return $DB->get_records_sql($sql, array('courseworkid' => $this->id));
}
/**
* Get all personal deadline in coursework, they can be coursework deadline-(default) or personal
*/
- public function get_coursework_submission_personal_deadlines(){
+ public function get_coursework_submission_personal_deadlines() {
global $DB;
$sql = "SELECT cs.id as submissionid, personal_deadline
@@ -2565,10 +2531,10 @@ public function get_coursework_submission_personal_deadlines(){
AND pd.allocatabletype = cs.allocatabletype
WHERE cs.courseworkid = :courseworkid";
- $submissions = $DB->get_records_sql($sql,array('courseworkid'=>$this->id));
+ $submissions = $DB->get_records_sql($sql, array('courseworkid' => $this->id));
// for submissions that don't have a set personal deadline give coursework's default deadline
- if($submissions) {
+ if ($submissions) {
foreach ($submissions as $submission) {
if (is_null($submission->personal_deadline)) {
$submission->personal_deadline = $this->deadline;
@@ -2578,53 +2544,42 @@ public function get_coursework_submission_personal_deadlines(){
return $submissions;
}
-
-
-
-
-
-
/**
* Has the given stage got a an automatic sampling rule
*
* @param $stage
* @return bool
*/
- public function has_automatic_sampling_at_stage($stage) {
+ public function has_automatic_sampling_at_stage($stage) {
global $DB;
- return $DB->record_exists('coursework_sample_set_rules',array('courseworkid'=>$this->id,'stage_identifier'=>$stage));
+ return $DB->record_exists('coursework_sample_set_rules', array('courseworkid' => $this->id, 'stage_identifier' => $stage));
}
-
-
/**
* Returns all allocatables in the current coursework that have feedback
*
* @return allocatable[]
*/
- public function get_allocatables_with_feedback($stage, $random = false) {
+ public function get_allocatables_with_feedback($stage, $random = false) {
global $DB, $CFG;
$sql = "SELECT cwrsub.allocatableid, cwrfb.*
FROM {coursework_submissions} cwrsub,
{coursework_feedbacks} cwrfb
- WHERE cwrsub.id = cwrfb.submissionid
+ WHERE cwrsub.id = cwrfb.submissionid
AND cwrsub.courseworkid = :coursework_id
AND stage_identifier = :stage";
-
-
if ($random) {
- $sql .= ($CFG->dbtype == 'pgsql') ? " ORDER BY RANDOM() " : " ORDER BY RAND() ";
+ $sql .= ($CFG->dbtype == 'pgsql') ? " ORDER BY RANDOM() " : " ORDER BY RAND() ";
}
return $DB->get_records_sql($sql,
- array('coursework_id' => $this->id, "stage"=>$stage));
+ array('coursework_id' => $this->id, "stage" => $stage));
}
-
/*
* Creates automatic feedback
*
@@ -2676,15 +2631,13 @@ public function create_automatic_feedback() {
unset($SESSION->keep_cache_data);
feedback::remove_cache($this->id);
-
}
-
/** Function to check it Turnitin is enabled for the particular coursework
* @return bool
* @throws \dml_exception
*/
- public function tii_enabled(){
+ public function tii_enabled() {
if (!isset(self::$pool[$this->id]['tii_enabled'][$this->id])) {
global $CFG, $DB;
@@ -2707,41 +2660,34 @@ public function tii_enabled(){
return self::$pool[$this->id]['tii_enabled'][$this->id];
}
-
-
-
-
-
/**
* Lets us know if personal deadlines are enabled in the coursework.
* @return bool
*/
- public function personal_deadlines_enabled(){
+ public function personal_deadlines_enabled() {
return (bool)$this->personaldeadlineenabled;
}
-
/**
* Lets us know if draft feedback is enabled in the coursework.
* @return bool
*/
- public function draft_feedback_enabled(){
+ public function draft_feedback_enabled() {
return (bool)$this->draftfeedbackenabled;
}
-
/**
* Return all allocatables and the allocatables deadline
* Note! allocatables are returned irrespective of whether they have submitted.
*
* @return array
*/
- public function get_allocatables_and_deadline() {
+ public function get_allocatables_and_deadline() {
- $allocatables = $this->get_allocatables();
+ $allocatables = $this->get_allocatables();
if (!empty($allocatables)) {
- $allocatables = array_map(array($this,"get_allocatable_personal_deadline"), $allocatables);
+ $allocatables = array_map(array($this, "get_allocatable_personal_deadline"), $allocatables);
}
return $allocatables;
@@ -2754,12 +2700,12 @@ public function get_allocatables_and_deadline() {
*
* @return array
*/
- private function get_allocatable_personal_deadline($allocatable) {
+ private function get_allocatable_personal_deadline($allocatable) {
global $DB;
- $allocatable->deadline = $this->deadline;
- $allocatable->coursework_id = $this->id;
+ $allocatable->deadline = $this->deadline;
+ $allocatable->coursework_id = $this->id;
if ($this->personal_deadlines_enabled()) {
personal_deadline::fill_pool_coursework($this->id);
@@ -2778,7 +2724,7 @@ private function get_allocatable_personal_deadline($allocatable) {
*
* @return bool
*/
- public function has_samples(){
+ public function has_samples() {
global $DB;
return $DB->record_exists('coursework_sample_set_mbrs', array('courseworkid' => $this->id));
@@ -2790,7 +2736,7 @@ public function has_samples(){
*
* @return bool
*/
- public function can_submit(){
+ public function can_submit() {
if (has_capability('mod/coursework:submit', $this->get_context())) {
return true;
}
@@ -2802,7 +2748,7 @@ public function can_submit(){
*
* @return bool
*/
- public function can_grade(){
+ public function can_grade() {
if (has_capability('mod/coursework:addinitialgrade', $this->get_context()) || has_capability('mod/coursework:addagreedgrade', $this->get_context())
|| has_capability('mod/coursework:addallocatedagreedgrade', $this->get_context())) {
return true;
@@ -2810,12 +2756,11 @@ public function can_grade(){
return false;
}
-
/**
* @return bool
*/
- public function marking_deadline_enabled(){
- return (bool)$this->markingdeadlineenabled ;
+ public function marking_deadline_enabled() {
+ return (bool)$this->markingdeadlineenabled;
}
/**
@@ -2826,7 +2771,7 @@ public function marking_deadline_enabled(){
* @return bool
* @throws \dml_exception
*/
- public function student_in_group($studentid, $groupid){
+ public function student_in_group($studentid, $groupid) {
global $DB;
$sql = "SELECT groups.*
FROM {groups} groups
@@ -2845,7 +2790,7 @@ public function student_in_group($studentid, $groupid){
*
* @return submissions
*/
- function retrieve_submissions_by_coursework(){
+ function retrieve_submissions_by_coursework() {
global $DB;
return $DB->get_records('coursework_submissions', ['courseworkid' => $this->id, 'allocatabletype' => 'user']);
}
@@ -2855,7 +2800,7 @@ function retrieve_submissions_by_coursework(){
* @param $user_id
* @return submissions
*/
- public function retrieve_submissions_by_user($user_id){
+ public function retrieve_submissions_by_user($user_id) {
global $DB;
return $DB->get_records('coursework_submissions', ['courseworkid' => $this->id, 'authorid' => $user_id, 'allocatabletype' => 'user']);
}
@@ -2876,7 +2821,7 @@ public function retrieve_feedbacks_by_submission($submission_id) {
*
* @param $user_id
*/
- public function remove_submissions_by_user($user_id){
+ public function remove_submissions_by_user($user_id) {
global $DB;
$DB->delete_records('coursework_submissions', ['courseworkid' => $this->id, 'authorid' => $user_id, 'allocatabletype' => 'user']);
}
@@ -2885,7 +2830,7 @@ public function remove_submissions_by_user($user_id){
*
* @return submissions
*/
- public function remove_submissions_by_coursework(){
+ public function remove_submissions_by_coursework() {
global $DB;
$DB->delete_records('coursework_submissions', ['courseworkid' => $this->id, 'allocatabletype' => 'user']);
}
@@ -2896,7 +2841,7 @@ public function remove_submissions_by_coursework(){
* @param $item_id
* @param $filearea
*/
- public function remove_corresponding_file($context_id, $item_id, $filearea){
+ public function remove_corresponding_file($context_id, $item_id, $filearea) {
global $DB;
$component = 'mod_coursework';
$fs = get_file_storage();
@@ -2907,7 +2852,7 @@ public function remove_corresponding_file($context_id, $item_id, $filearea){
*
* @param $submission_id
*/
- public function remove_feedbacks_by_submission($submission_id){
+ public function remove_feedbacks_by_submission($submission_id) {
global $DB;
$DB->delete_records('coursework_feedbacks', ['submissionid' => $submission_id]);
}
@@ -2916,7 +2861,7 @@ public function remove_feedbacks_by_submission($submission_id){
*
* @param $feedback_id
*/
- public function remove_agreements_by_feedback($feedback_id){
+ public function remove_agreements_by_feedback($feedback_id) {
global $DB;
$DB->delete_records('coursework_mod_agreements', ['feedbackid' => $feedback_id]);
}
@@ -2925,7 +2870,7 @@ public function remove_agreements_by_feedback($feedback_id){
*
* @param $user_id
*/
- public function remove_deadline_extensions_by_user($user_id){
+ public function remove_deadline_extensions_by_user($user_id) {
global $DB;
$DB->execute('DELETE FROM {coursework_extensions} WHERE allocatabletype = ? AND (allocatableid = ? OR allocatableuser = ? ) ', array('user', $user_id, $user_id));
}
@@ -2943,23 +2888,22 @@ public function remove_personal_deadlines_by_coursework() {
* Function to Remove all deadline extensions by coursework
*
*/
- public function remove_deadline_extensions_by_coursework(){
+ public function remove_deadline_extensions_by_coursework() {
global $DB;
$DB->execute('DELETE FROM {coursework_extensions} WHERE allocatabletype = ? AND courseworkid = ? ', array('user', $this->id));
}
-
/**
* Function to check if Coursework has any final feedback
*
* @return bool
* @throws \dml_exception
*/
- public function has_any_final_feedback(){
+ public function has_any_final_feedback() {
global $DB;
- $sql = "SELECT *
- FROM {coursework_feedbacks} cf
+ $sql = "SELECT *
+ FROM {coursework_feedbacks} cf
JOIN {coursework_submissions} cs ON cs.id = cf.submissionid
WHERE cs.courseworkid = :courseworkid
AND cf.stage_identifier = 'final_agreed_1'";
@@ -2976,14 +2920,13 @@ public function has_any_final_feedback(){
public function get_allocatable_deadline($allocatableid) {
$deadline = $this->deadline;
- if($this->use_groups){
+ if ($this->use_groups) {
$allocatable = group::find($allocatableid);
} else {
$allocatable = user::find($allocatableid);
}
-
- if ($this->personal_deadlines_enabled()){
+ if ($this->personal_deadlines_enabled()) {
// find personal deadline for a user if this option enabled
$personal = $this->get_allocatable_personal_deadline($allocatable);
if (!empty($personal)) {
@@ -2991,7 +2934,7 @@ public function get_allocatable_deadline($allocatableid) {
}
}
- if($this->extensions_enabled()){ // check if coursework allows extensions
+ if ($this->extensions_enabled()) { // check if coursework allows extensions
// check if extension for this user exists
$extension = $this->get_allocatable_extension($allocatable);
if (!empty($extension)) {
@@ -3007,14 +2950,13 @@ public function get_allocatable_deadline($allocatableid) {
* @param $allocatable
* @return bool/int
*/
- private function get_allocatable_extension($allocatable) {
+ private function get_allocatable_extension($allocatable) {
global $DB;
$extension = false;
-
if ($this->extensions_enabled() ) {
- $extensionrecord = $DB->get_record('coursework_extensions', array('courseworkid' => $this->id,'allocatableid' => $allocatable->id));
+ $extensionrecord = $DB->get_record('coursework_extensions', array('courseworkid' => $this->id, 'allocatableid' => $allocatable->id));
if (!empty($extensionrecord)) {
$extension = $extensionrecord->extended_deadline;
@@ -3024,7 +2966,6 @@ private function get_allocatable_extension($allocatable) {
return $extension;
}
-
/**
* Function to Remove all plagiarisms by a submission
*
@@ -3036,34 +2977,32 @@ public function remove_plagiarisms_by_submission($submission_id) {
$DB->delete_records('coursework_plagiarism_flags', ['submissionid' => $submission_id]);
}
-
/**
* Function to check if Coursework has any submission
*
* @return bool
* @throws \dml_exception
*/
- public function has_any_submission(){
+ public function has_any_submission() {
global $DB;
- $sql = "SELECT *
- FROM {coursework_submissions} cs
+ $sql = "SELECT *
+ FROM {coursework_submissions} cs
WHERE cs.courseworkid = :courseworkid";
return $DB->record_exists_sql($sql, array('courseworkid' => $this->id));
}
-
/**
* Function to check if coursework or course that a coursework belongs to is hidden
*
* @return bool
* @throws moodle_exception
*/
- public function is_coursework_visible(){
+ public function is_coursework_visible() {
$visible = true;
- if ($this->get_course_module()->visible == 0 || $this->get_course()->visible == 0){
+ if ($this->get_course_module()->visible == 0 || $this->get_course()->visible == 0) {
$visible = false;
}
return $visible;
@@ -3083,7 +3022,6 @@ public function clear_stage($stage_index = null) {
}
}
-
/**
* cache array
*
@@ -3139,7 +3077,7 @@ public function fill_cache() {
global $DB;
$coursework_id = $this->id;
submission::fill_pool_coursework($coursework_id);
- coursework::fill_pool([$this]);
+ self::fill_pool([$this]);
course_module::fill_pool([$this->get_course_module()]);
module::fill_pool($DB->get_records('modules', ['name' => 'coursework']));
feedback::fill_pool_submissions($coursework_id, array_keys(submission::$pool[$coursework_id]['id']));
diff --git a/classes/models/deadline_extension.php b/classes/models/deadline_extension.php
index 465d9af5..1d10e361 100644
--- a/classes/models/deadline_extension.php
+++ b/classes/models/deadline_extension.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\models;
@@ -138,4 +158,4 @@ protected function after_destroy() {
self::remove_cache($this->courseworkid);
}
-}
\ No newline at end of file
+}
diff --git a/classes/models/feedback.php b/classes/models/feedback.php
index 42a2395e..14a07aae 100644
--- a/classes/models/feedback.php
+++ b/classes/models/feedback.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework\models;
use context;
@@ -22,7 +28,7 @@
use mod_coursework\ability;
use mod_coursework\stages\base as stage_base;
use stdClass;
-use \mod_coursework\feedback_files;
+use mod_coursework\feedback_files;
defined('MOODLE_INTERNAL') || die();
@@ -188,10 +194,10 @@ class feedback extends table_base {
* @return string assessor's name
* @throws \coding_exception
*/
- public function display_assessor_name(){
+ public function display_assessor_name() {
// check if assessor's name in this CW is set to hidden
- if ($this->is_assessor_anonymity_enabled()){
+ if ($this->is_assessor_anonymity_enabled()) {
$assessor_name = get_string('hidden', 'mod_coursework');
} else {
$assessor_name = $this->get_assesor_username();
@@ -200,7 +206,6 @@ public function display_assessor_name(){
return $assessor_name;
}
-
/**
* Real name for display. Allows us to defer the DB call to retrieve first and last name
* in case we don't need it.
@@ -215,22 +220,22 @@ public function get_assesor_username() {
return $this->assessor->name();
}
- public function get_assessor_id(){
+ public function get_assessor_id() {
return $this->assessor->id;
}
/**
* @return string
*/
- public function get_assessor_stage_no(){
+ public function get_assessor_stage_no() {
$no = '';
- if (substr($this->stage_identifier,0,9 ) =='assessor_'){
+ if (substr($this->stage_identifier, 0, 9 ) == 'assessor_') {
$no = substr($this->stage_identifier, -1);
}
return $no;
}
- public function get_feedbacks_assessorid(){
+ public function get_feedbacks_assessorid() {
return $this->assessorid;
}
/**
@@ -267,7 +272,6 @@ public function get_coursemodule_id() {
return $this->get_submission()->get_course_module_id();
}
-
/**
* Returns a feedback instance
* @todo get rid of this.
@@ -307,7 +311,7 @@ public static function get_teacher_feedback(submission $submission,
* Check if assessor is allocated to the user in this stage
* @return bool
*/
- public function is_assessor_allocated(){
+ public function is_assessor_allocated() {
return $this->get_stage()->assessor_has_allocation($this->get_allocatable());
}
@@ -338,7 +342,7 @@ public function set_feedback_files($context_id) {
public function get_feedback_files() {
$this->set_feedback_files($this->get_context_id());
- if ($this->feedbackfiles !=null){
+ if ($this->feedbackfiles !=null) {
$this->feedback_files = new feedback_files($this->feedbackfiles, $this);
return $this->feedback_files;
}
@@ -346,8 +350,6 @@ public function get_feedback_files() {
return false;
}
-
-
/**
* @return mixed
*/
@@ -439,7 +441,6 @@ public function get_context() {
return $this->get_coursework()->get_context();
}
-
/**
* Is this feedback one of the component grades in a multiple marking scenario?
*
@@ -569,7 +570,7 @@ public function get_allocatable() {
return $this->get_submission()->get_allocatable();
}
- public function is_assessor_anonymity_enabled(){
+ public function is_assessor_anonymity_enabled() {
return $this->get_coursework()->assessoranonymity;
}
diff --git a/classes/models/group.php b/classes/models/group.php
index e75fc939..418d8979 100644
--- a/classes/models/group.php
+++ b/classes/models/group.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
/**
* This class allows us to add functionality to the users, despite the fact that Moodle has no
@@ -9,8 +29,8 @@
namespace mod_coursework\models;
use mod_coursework\framework\table_base;
-use \mod_coursework\allocation\allocatable;
-use \mod_coursework\allocation\moderatable;
+use mod_coursework\allocation\allocatable;
+use mod_coursework\allocation\moderatable;
use mod_coursework\traits\allocatable_functions;
/**
@@ -66,7 +86,7 @@ public function get_members($context, $cm) {
$info = new \core_availability\info_module(\cm_info::create($cm));
$members = $info->filter_user_list($members);
- $member_objects = array();
+ $member_objects = [];
foreach ($members as $member) {
// check is member has capability to submit in this coursework (to get rid of assessors if they are placed in the group)
if (has_capability('mod/coursework:submit', $context, $member)) {
@@ -123,4 +143,4 @@ public static function get_object($id) {
}
return self::$pool['id'][$id];
}
-}
\ No newline at end of file
+}
diff --git a/classes/models/moderation.php b/classes/models/moderation.php
index 2a9debb5..ca7808cd 100644
--- a/classes/models/moderation.php
+++ b/classes/models/moderation.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework\models;
use context;
@@ -22,7 +28,7 @@
use mod_coursework\ability;
use mod_coursework\stages\base as stage_base;
use stdClass;
-use \mod_coursework\feedback_files;
+use mod_coursework\feedback_files;
defined('MOODLE_INTERNAL') || die();
@@ -32,8 +38,7 @@
* @property mixed stage_identifier
* @property int feedback_manager
*/
-class moderation extends table_base{
-
+class moderation extends table_base {
/**
* @var int
@@ -45,7 +50,6 @@ class moderation extends table_base{
*/
public $feedbackid;
-
/**
* @var int
*/
@@ -76,7 +80,6 @@ class moderation extends table_base{
*/
public $modcommentformat;
-
/**
* Chained getter for loose coupling.
*
@@ -86,41 +89,36 @@ public function get_coursework() {
return $this->get_submission()->get_coursework();
}
-
/**
*
*/
- public function get_feedback(){
+ public function get_feedback() {
global $DB;
//Moderation done only for single courseworks so submission id to retrieve feedback is enough
- $params = array('id'=>$this->feedbackid);
+ $params = array('id' => $this->feedbackid);
$feedback = $DB->get_record('coursework_feedbacks', $params);
return $feedback;
}
- public function get_agreement(){
+ public function get_agreement() {
return $this->agreement;
-
}
-
/**
* Memoized getter
*
* @return bool|submission
*/
public function get_submission() {
- $feedback = $this->get_feedback();
+ $feedback = $this->get_feedback();
$this->submission = submission::find($feedback->submissionid);
return $this->submission;
}
-
-
/**
* @return user
*/
@@ -141,16 +139,15 @@ public function get_moderator_username() {
return fullname($this->moderator);
}
- public function get_moderator_id(){
+ public function get_moderator_id() {
return $this->moderator->id;
}
-
/**
* Check if assessor is allocated to the user in this stage
* @return bool
*/
- public function is_moderator_allocated(){
+ public function is_moderator_allocated() {
return $this->get_stage()->assessor_has_allocation($this->get_allocatable());
}
@@ -187,4 +184,4 @@ public static function get_moderator_agreement($feedback) {
return null;
}
-}
\ No newline at end of file
+}
diff --git a/classes/models/moderation_set_rule.php b/classes/models/moderation_set_rule.php
index dacdd2e3..11d44550 100644
--- a/classes/models/moderation_set_rule.php
+++ b/classes/models/moderation_set_rule.php
@@ -17,7 +17,7 @@
namespace mod_coursework\models;
use mod_coursework\allocation\allocatable;
-use \mod_coursework\stages\base as stage_base;
+use mod_coursework\stages\base as stage_base;
/**
* This file keeps track of upgrades to the eassessment module
@@ -29,8 +29,7 @@
* it cannot do itself, it will tell you what you need to do. The commands in
* here will all be database-neutral, using the functions defined in DLL libraries.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -41,7 +40,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Forms a base for the moderation set rules, which determine various sets of students which
* need to be included in the set e.g. lowest 40%.
@@ -101,7 +99,6 @@ abstract class moderation_set_rule extends table_base implements renderable {
'minimum'
);
-
/**
* @param bool|int|stdClass $dbrecord
*/
diff --git a/classes/models/module.php b/classes/models/module.php
index 57739a73..c0f91448 100644
--- a/classes/models/module.php
+++ b/classes/models/module.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework\models;
use mod_coursework\framework\table_base;
diff --git a/classes/models/null_feedback.php b/classes/models/null_feedback.php
index 7cadb816..f63faf74 100644
--- a/classes/models/null_feedback.php
+++ b/classes/models/null_feedback.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\models;
@@ -21,4 +41,4 @@ public function get_grade() {
return '';
}
-}
\ No newline at end of file
+}
diff --git a/classes/models/null_user.php b/classes/models/null_user.php
index f8dc241c..4a694371 100644
--- a/classes/models/null_user.php
+++ b/classes/models/null_user.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\models;
@@ -64,10 +84,9 @@ public function has_agreed_feedback($coursework) {
* @return feedback[]
*/
public function get_initial_feedbacks($coursework) {
- return array();
+ return [];
}
-
/**
* @param coursework $coursework
* @return bool
@@ -76,16 +95,14 @@ public function has_all_initial_feedbacks($coursework) {
return false;
}
-
/**
* @param coursework $coursework
* @return bool
*/
- public function get_agreed_feedback($coursework){
+ public function get_agreed_feedback($coursework) {
return false;
}
-
/**
* @param coursework $coursework
* @return submission
@@ -93,4 +110,4 @@ public function get_agreed_feedback($coursework){
public function get_submission($coursework) {
}
-}
\ No newline at end of file
+}
diff --git a/classes/models/outstanding_marking.php b/classes/models/outstanding_marking.php
index 582b4a8b..f6bc8fac 100644
--- a/classes/models/outstanding_marking.php
+++ b/classes/models/outstanding_marking.php
@@ -1,130 +1,145 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
-class outstanding_marking {
+namespace mod_coursework\models;
- private $day_in_secs;
+class outstanding_marking {
+ private $day_in_secs;
- public function __construct() {
+ public function __construct() {
- $this->day_in_secs = 86400;
+ $this->day_in_secs = 86400;
}
-
/**
* @param $cwkrecord
* @param $userid
* @return int
*/
- public function get_to_grade_initial_count($cwkrecord,$userid){
+ public function get_to_grade_initial_count($cwkrecord, $userid) {
- $coursework = new \mod_coursework\models\coursework($cwkrecord);
+ $coursework = new \mod_coursework\models\coursework($cwkrecord);
- $initialsubmissions = array();
+ $initialsubmissions = [];
- if($this->should_get_to_mark_initial_grade_info($coursework->id,$userid)){
+ if ($this->should_get_to_mark_initial_grade_info($coursework->id, $userid)) {
if (!$coursework->has_multiple_markers()) {
- $initialsubmissions = $this->get_single_marker_initial_grade_submissions_to_mark($coursework->id, $userid,$coursework->allocation_enabled());
+ $initialsubmissions = $this->get_single_marker_initial_grade_submissions_to_mark($coursework->id, $userid, $coursework->allocation_enabled());
} else if ($coursework->sampling_enabled() && !$coursework->allocation_enabled()) { //
- $initialsubmissions = $this->get_multiple_to_mark_sampled_initial_grade_submissions($coursework->id,$userid);
+ $initialsubmissions = $this->get_multiple_to_mark_sampled_initial_grade_submissions($coursework->id, $userid);
} else {
- $initialsubmissions = $this->get_multiple_to_mark_initial_grade_submissions($coursework->id,$userid,$coursework->get_max_markers(),$coursework->allocation_enabled());
+ $initialsubmissions = $this->get_multiple_to_mark_initial_grade_submissions($coursework->id, $userid, $coursework->get_max_markers(), $coursework->allocation_enabled());
}
}
- return (!empty($initialsubmissions)) ? count($initialsubmissions) : 0 ;
+ return (!empty($initialsubmissions)) ? count($initialsubmissions) : 0;
}
-
/**
* @param $cwkrecord
* @param $userid
* @return int
*/
- public function get_to_grade_agreed_count($cwkrecord,$userid) {
+ public function get_to_grade_agreed_count($cwkrecord, $userid) {
- $coursework = new \mod_coursework\models\coursework($cwkrecord);
+ $coursework = new \mod_coursework\models\coursework($cwkrecord);
- $agreedsubmissions = array();
+ $agreedsubmissions = [];
//AGREED GRADE INFORMATION
- if ($this->should_get_to_mark_agreed_grade_info($coursework->id,$userid) && $coursework->has_multiple_markers()) {
+ if ($this->should_get_to_mark_agreed_grade_info($coursework->id, $userid) && $coursework->has_multiple_markers()) {
if (!$coursework->sampling_enabled()) {
- $agreedsubmissions = $this->get_to_grade_agreed_grade_submissions($coursework->id,$coursework->get_max_markers());
+ $agreedsubmissions = $this->get_to_grade_agreed_grade_submissions($coursework->id, $coursework->get_max_markers());
} else {
$agreedsubmissions = $this->get_to_grade_agreed_grade_sampled_submissions($coursework->id);
}
}
- return (!empty($agreedsubmissions)) ? count($agreedsubmissions) : 0;
+ return (!empty($agreedsubmissions)) ? count($agreedsubmissions) : 0;
}
-
/**
* @param $courseworkid
* @param bool $userid
* @param bool $allocationenabled
* @return array
*/
- private function get_single_marker_initial_grade_submissions_to_mark($courseworkid, $userid=false, $allocationenabled=false) {
+ private function get_single_marker_initial_grade_submissions_to_mark($courseworkid, $userid=false, $allocationenabled=false) {
global $DB;
- $sqlparams = array();
- $sqltable = "";
- $sqlextra = "";
+ $sqlparams = [];
+ $sqltable = "";
+ $sqlextra = "";
- if ($allocationenabled) {
- //we only have to check for submissions allocated to this user
- $sqltable = ", {coursework_allocation_pairs} cap ";
+ if ($allocationenabled) {
+ // We only have to check for submissions allocated to this user
+ $sqltable = ", {coursework_allocation_pairs} cap ";
- $sqlextra = "
- AND cap.courseworkid = cs.courseworkid
+ $sqlextra = " AND cap.courseworkid = cs.courseworkid
AND cap.allocatableid = cs.allocatableid
AND cap.allocatabletype = cs.allocatabletype
AND cap.assessorid = :assessorid ";
- $sqlparams['assessorid'] = $userid;
+ $sqlparams['assessorid'] = $userid;
}
- $sql = "SELECT cs.id as submissionid
+ $sql = "SELECT cs.id as submissionid
FROM {coursework_submissions} cs
LEFT JOIN {coursework_feedbacks} f
ON cs.id = f.submissionid
{$sqltable}
WHERE f.id IS NULL
AND cs.finalised = 1
- AND cs.courseworkid = :courseworkid
- {$sqlextra}
+ AND cs.courseworkid = :courseworkid
+ {$sqlextra}
";
- $sqlparams['courseworkid'] = $courseworkid;
+ $sqlparams['courseworkid'] = $courseworkid;
return $DB->get_records_sql($sql, $sqlparams);
}
-
/**
* @param $courseworkid
* @param $userid
* @return array
*/
- private function get_multiple_to_mark_sampled_initial_grade_submissions($courseworkid,$userid) {
+ private function get_multiple_to_mark_sampled_initial_grade_submissions($courseworkid, $userid) {
global $DB;
$countsamples = 'CASE WHEN a.id = NULL THEN 0 ELSE COUNT(a.id)+1 END';
- $sql = " SELECT *,
+ $sql = " SELECT *,
$countsamples AS count_samples,
COUNT(a.id) AS ssmID FROM(
- SELECT cs.id AS csid, f.id AS fid, cs.allocatableid ,ssm.id, COUNT(f.id) AS count_feedback,
+ SELECT cs.id AS csid, f.id AS fid, cs.allocatableid, ssm.id, COUNT(f.id) AS count_feedback,
cs.courseworkid
FROM {coursework_submissions} cs LEFT JOIN
{coursework_feedbacks} f ON f.submissionid= cs.id
@@ -141,16 +156,14 @@ private function get_multiple_to_mark_sampled_initial_grade_submissions($coursew
GROUP BY a.allocatableid, a.csid, a.fid, a.id, a.count_feedback, a.courseworkid
HAVING (count_feedback < $countsamples )";
- $sqlparams = array();
- $sqlparams['subassessorid'] = $userid;
- $sqlparams['subcourseworkid'] = $courseworkid;
- $sqlparams['courseworkid'] = $courseworkid;
-
+ $sqlparams = [];
+ $sqlparams['subassessorid'] = $userid;
+ $sqlparams['subcourseworkid'] = $courseworkid;
+ $sqlparams['courseworkid'] = $courseworkid;
return $DB->get_records_sql($sql, $sqlparams);
}
-
/**
* @param $courseworkid
* @param $userid
@@ -158,82 +171,75 @@ private function get_multiple_to_mark_sampled_initial_grade_submissions($coursew
* @param $allocationenabled
* @return array
*/
- private function get_multiple_to_mark_initial_grade_submissions($courseworkid,$userid,$numberofmarkers,$allocationenabled) {
+ private function get_multiple_to_mark_initial_grade_submissions($courseworkid, $userid, $numberofmarkers, $allocationenabled) {
global $DB;
- $sqlparams = array();
- $sqltable = '';
- $sqlextra = '';
+ $sqlparams = [];
+ $sqltable = '';
+ $sqlextra = '';
- if ($allocationenabled) {
- //we only have to check for submissions allocated to this user
- $sqltable = ", {coursework_allocation_pairs} cap ";
+ if ($allocationenabled) {
+ // We only have to check for submissions allocated to this user
+ $sqltable = ", {coursework_allocation_pairs} cap ";
- $sqlextra = "
+ $sqlextra = "
AND cap.courseworkid = cs.courseworkid
AND cap.allocatableid = cs.allocatableid
AND cap.allocatabletype = cs.allocatabletype
AND cap.assessorid = :assessorid2 ";
- $sqlparams['assessorid2'] = $userid;
+ $sqlparams['assessorid2'] = $userid;
}
-
- $sql = "SELECT cs.id AS submissionid, COUNT(f.id) AS count_feedback
+ $sql = "SELECT cs.id AS submissionid, COUNT(f.id) AS count_feedback
FROM {coursework_submissions} cs LEFT JOIN
{coursework_feedbacks} f ON cs.id = f.submissionid
{$sqltable}
WHERE cs.finalised = 1
- AND cs.courseworkid = :courseworkid
+ AND cs.courseworkid = :courseworkid
AND (f.assessorid != :assessorid OR f.assessorid IS NULL)
{$sqlextra}
- AND cs.id NOT IN (SELECT sub.id FROM
- {coursework_feedbacks} feed JOIN
- {coursework_submissions} sub ON sub.id = feed.submissionid
+ AND cs.id NOT IN (SELECT sub.id FROM
+ {coursework_feedbacks} feed
+ JOIN {coursework_submissions} sub ON sub.id = feed.submissionid
WHERE assessorid = :subassessorid AND sub.courseworkid= :subcourseworkid)
GROUP BY cs.id, f.id
HAVING (COUNT(f.id) < :numofmarkers)";
-
- $sqlparams['subassessorid'] = $userid;
- $sqlparams['subcourseworkid'] = $courseworkid;
- $sqlparams['courseworkid'] = $courseworkid;
- $sqlparams['numofmarkers'] = $numberofmarkers;
- $sqlparams['assessorid'] = $userid;
-
+ $sqlparams['subassessorid'] = $userid;
+ $sqlparams['subcourseworkid'] = $courseworkid;
+ $sqlparams['courseworkid'] = $courseworkid;
+ $sqlparams['numofmarkers'] = $numberofmarkers;
+ $sqlparams['assessorid'] = $userid;
return $DB->get_records_sql($sql, $sqlparams);
}
-
/**
* @param $courseworkid
* @param $numberofmarkers
* @return array
*/
- private function get_to_grade_agreed_grade_submissions($courseworkid,$numberofmarkers){
+ private function get_to_grade_agreed_grade_submissions($courseworkid, $numberofmarkers) {
global $DB;
$sql = "SELECT cs.id as submissionid, COUNT(cs.id) AS count_feedback
- FROM {coursework_submissions} cs ,
- {coursework_feedbacks} f
+ FROM {coursework_submissions} cs ,
+ {coursework_feedbacks} f
WHERE f.submissionid= cs.id
AND cs.finalised = 1
AND cs.courseworkid = :courseworkid
GROUP BY cs.id
HAVING (COUNT(cs.id) = :numofmarkers)";
-
$sqlparams['numofmarkers'] = $numberofmarkers;
$sqlparams['courseworkid'] = $courseworkid;
-
return $DB->get_records_sql($sql, $sqlparams);
}
-
/**
* @param $courseworkid
* @return array
@@ -243,10 +249,10 @@ private function get_to_grade_agreed_grade_sampled_submissions($courseworkid) {
global $DB;
$countsamples = 'CASE WHEN a.id = NULL THEN 0 ELSE COUNT(a.id)+1 END';
- $sql = "SELECT *,
+ $sql = "SELECT *,
$countsamples AS count_samples,
COUNT(a.id) AS ssmID FROM(
- SELECT f.id AS fid, cs.id AS csid, cs.allocatableid ,ssm.id, COUNT(f.id) AS count_feedback,
+ SELECT f.id AS fid, cs.id AS csid, cs.allocatableid, ssm.id, COUNT(f.id) AS count_feedback,
cs.courseworkid
FROM {coursework_submissions} cs LEFT JOIN
{coursework_feedbacks} f ON f.submissionid= cs.id
@@ -256,51 +262,48 @@ private function get_to_grade_agreed_grade_sampled_submissions($courseworkid) {
GROUP BY cs.allocatableid, ssm.stage_identifier, f.id, cs.id, ssm.id
) a
GROUP BY a.allocatableid, a.csid, a.fid, a.id, a.count_feedback, a.courseworkid
- HAVING (count_feedback = $countsamples AND $countsamples > 1 );";
+ HAVING (count_feedback = $countsamples AND $countsamples > 1 );";
$sqlparams['courseworkid'] = $courseworkid;
return $DB->get_records_sql($sql, $sqlparams);
}
-
/**
* @param $course_id
* @param $user_id
* @return bool
*/
- private function has_agreed_grade($course_id,$user_id) {
+ private function has_agreed_grade($course_id, $user_id) {
- $coursecontext = \context_course::instance($course_id);
+ $coursecontext = \context_course::instance($course_id);
- return has_capability('mod/coursework:addagreedgrade',$coursecontext,$user_id) || has_capability('mod/coursework:addallocatedagreedgrade',$coursecontext,$user_id);
+ return has_capability('mod/coursework:addagreedgrade', $coursecontext, $user_id) || has_capability('mod/coursework:addallocatedagreedgrade', $coursecontext, $user_id);
}
-
/**
* @param $course_id
* @param $user_id
* @return bool
*/
- private function has_initial_grade($course_id,$user_id) {
+ private function has_initial_grade($course_id, $user_id) {
- $coursecontext = \context_course::instance($course_id);
+ $coursecontext = \context_course::instance($course_id);
- return has_capability('mod/coursework:addinitialgrade',$coursecontext,$user_id);
+ return has_capability('mod/coursework:addinitialgrade', $coursecontext, $user_id);
}
-
/**
* @param $courseworkid
* @param $userid
* @return bool
*/
- private function should_get_to_mark_initial_grade_info($courseworkid,$userid) {
+ private function should_get_to_mark_initial_grade_info($courseworkid, $userid) {
- $coursework = new \mod_coursework\models\coursework($courseworkid);
+ $coursework = new \mod_coursework\models\coursework($courseworkid);
- //findout if the user can create an initial grade
- $user_has_initial_grade_capability = $this->has_initial_grade($coursework->get_course()->id, $userid);
+ // Findout if the user can create an initial grade
+ $user_has_initial_grade_capability = $this->has_initial_grade($coursework->get_course()->id, $userid);
return $user_has_initial_grade_capability;
}
@@ -310,12 +313,12 @@ private function should_get_to_mark_initial_grade_info($courseworkid,$userid)
* @param $userid
* @return bool
*/
- private function should_get_to_mark_agreed_grade_info($courseworkid,$userid) {
+ private function should_get_to_mark_agreed_grade_info($courseworkid, $userid) {
- $coursework = new \mod_coursework\models\coursework($courseworkid);
+ $coursework = new \mod_coursework\models\coursework($courseworkid);
- //findout if the user can create an initial grade
- $user_has_agreed_grade_capability = $this->has_agreed_grade($coursework->get_course()->id, $userid);
+ // Findout if the user can create an initial grade
+ $user_has_agreed_grade_capability = $this->has_agreed_grade($coursework->get_course()->id, $userid);
return $user_has_agreed_grade_capability;
diff --git a/classes/models/personal_deadline.php b/classes/models/personal_deadline.php
index c8349b18..b02713bd 100644
--- a/classes/models/personal_deadline.php
+++ b/classes/models/personal_deadline.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\models;
@@ -47,7 +67,7 @@ public function get_allocatable() {
* Function to check if extension for this personal deadline (alloctable) exists
* @return static
*/
- public function extension_exists(){
+ public function extension_exists() {
$coursework = $this->get_coursework();
$params = array('courseworkid' => $coursework->id,
@@ -76,7 +96,6 @@ public static function get_personal_deadline_for_student($student, $coursework)
}
}
-
/**
* cache array
*
@@ -133,4 +152,4 @@ protected function after_destroy() {
self::remove_cache($this->courseworkid);
}
-}
\ No newline at end of file
+}
diff --git a/classes/models/plagiarism_flag.php b/classes/models/plagiarism_flag.php
index d5e5bf1b..ec51b741 100644
--- a/classes/models/plagiarism_flag.php
+++ b/classes/models/plagiarism_flag.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\models;
@@ -29,10 +49,10 @@ class plagiarism_flag extends table_base {
/**
* Constants with Statuses for Plagiarism flagging
*/
- const INVESTIGATION = 0;
- const RELEASED = 1;
- const CLEARED = 2;
- const NOTCLEARED = 3;
+ const INVESTIGATION = 0;
+ const RELEASED = 1;
+ const CLEARED = 2;
+ const NOTCLEARED = 3;
/**
* @return mixed|\mod_coursework_coursework
@@ -71,13 +91,12 @@ public static function get_plagiarism_flag($submission) {
return $result;
}
-
/**
* @return bool
*/
- public function can_release_grades(){
+ public function can_release_grades() {
- switch ($this->status){
+ switch ($this->status) {
case self::INVESTIGATION:
case self::NOTCLEARED:
@@ -147,5 +166,4 @@ protected function after_destroy() {
self::remove_cache($this->courseworkid);
}
-
-}
\ No newline at end of file
+}
diff --git a/classes/models/reminder.php b/classes/models/reminder.php
index 36be80e2..c15c74ab 100644
--- a/classes/models/reminder.php
+++ b/classes/models/reminder.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\models;
@@ -12,4 +32,4 @@ class reminder extends table_base {
protected static $table_name = 'coursework_reminder';
-}
\ No newline at end of file
+}
diff --git a/classes/models/sample_set_rule.php b/classes/models/sample_set_rule.php
index b1aa21b8..465bbe23 100644
--- a/classes/models/sample_set_rule.php
+++ b/classes/models/sample_set_rule.php
@@ -17,7 +17,7 @@
namespace mod_coursework\models;
use mod_coursework\allocation\allocatable;
-use \mod_coursework\stages\base as stage_base;
+use mod_coursework\stages\base as stage_base;
/**
* This file keeps track of upgrades to the eassessment module
@@ -29,8 +29,7 @@
* it cannot do itself, it will tell you what you need to do. The commands in
* here will all be database-neutral, using the functions defined in DLL libraries.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -41,7 +40,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Forms a base for the moderation set rules, which determine various sets of students which
* need to be included in the set e.g. lowest 40%.
@@ -101,15 +99,14 @@ abstract class sample_set_rule extends table_base implements renderable {
'minimum'
);
-
/**
* @param bool|int|stdClass $dbrecord
*/
public function __construct($coursework) {
- $this->coursework = $coursework;
+ $this->coursework = $coursework;
- //parent::__construct($dbrecord);
+ // parent::__construct($dbrecord);
// We cannot set this from outside if we are making a new one.
if (!isset($this->ruleorder)) {
diff --git a/classes/models/submission.php b/classes/models/submission.php
index 37029efb..c6b6a601 100644
--- a/classes/models/submission.php
+++ b/classes/models/submission.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework\models;
use context;
@@ -21,7 +27,7 @@
use mod_coursework\ability;
use mod_coursework\allocation\allocatable;
use mod_coursework\grade_judge;
-use \mod_coursework\submission_files;
+use mod_coursework\submission_files;
use mod_coursework\framework\table_base;
use moodle_database;
use moodle_url;
@@ -248,16 +254,16 @@ public static function unfinalised_past_deadline() {
$deadline = $submission->deadline;
$submission = static::find($submission);
- if ($submission->get_coursework()->personal_deadlines_enabled()){
+ if ($submission->get_coursework()->personal_deadlines_enabled()) {
$deadline = $submission->submission_personal_deadline();
}
-
- if ($deadline < time()){
+
+ if ($deadline < time()) {
// if deadline passed check if extension exists
- if ($submission->has_extension()){
- //check if extension is valid
+ if ($submission->has_extension()) {
+ // Check if extension is valid
$extension = $submission->submission_extension();
- if($extension->extended_deadline > time()){
+ if ($extension->extended_deadline > time()) {
//unset as it doesn't need to be autofinalise yet
unset($submissions[$submission->id]);
}
@@ -347,7 +353,6 @@ public function submit_plagiarism($type = null) {
$files = $fs->get_area_files($this->get_context_id(), 'mod_coursework', 'submission',
$this->id, "id", false);
-
$params = array(
'context' => \context_module::instance($this->get_coursework()->get_course_module()->id),
'courseid' => $this->get_course_id(),
@@ -360,7 +365,6 @@ public function submit_plagiarism($type = null) {
)
);
-
$event = \mod_coursework\event\assessable_uploaded::create($params);
//$event->set_legacy_files($files);
$event->trigger();
@@ -380,7 +384,7 @@ public function get_submission_files($reset = false) {
}
if ($this->id < 1 || $this->get_context_id() < 1) {
- return new submission_files(array(), $this);
+ return new submission_files([], $this);
}
$submission_files = $this->get_files();
@@ -391,7 +395,7 @@ public function get_submission_files($reset = false) {
return $this->submission_files;
}
- $files = new submission_files(array(), $this);
+ $files = new submission_files([], $this);
return $files;
}
@@ -457,7 +461,7 @@ public function get_first_feedback() {
public function get_assessor_feedbacks() {
if (!$this->id) {
// No submission - empty placeholder.
- return array();
+ return [];
}
if (!isset(feedback::$pool[$this->courseworkid]['submissionid-stage_identifier_index'])) {
@@ -505,18 +509,17 @@ public function get_assessor_allocation_by_stage($stage_identifier) {
}
-
/**
* @return mixed|feedback|string
* @throws \dml_missing_record_exception
* @throws \dml_multiple_records_exception
*/
- public function get_agreed_grade(){
+ public function get_agreed_grade() {
global $DB;
if (!$this->id) {
// No submission - empty placeholder.
- return array();
+ return [];
}
$params = [
@@ -608,8 +611,6 @@ public function get_state() {
$hasfinalfeedback = (bool)$this->get_final_feedback();
$maxfeedbacksreached = count($assessor_feedbacks) >= $this->max_number_of_feedbacks();
-
-
if ($hasfinalfeedback) {
return self::FINAL_GRADED;
}
@@ -759,7 +760,6 @@ public function user_has_submitted_feedback($userid = 0) {
return false;
}
-
/*
* As with the author id field this function was created to verify that coursework will work correctly with Turnitin
* Plagiarism plugin that requires the author of a submission to
@@ -769,11 +769,11 @@ public function get_author_id() {
$id = $USER->id;
- //if this is a submission on behalf of the student and it is a group submission we have to make sure
+ // If this is a submission on behalf of the student and it is a group submission we have to make sure
// the author is the first member of the group
if ($this->is_submission_on_behalf()) {
- if ( $this->get_coursework()->is_configured_to_have_group_submissions()) {
+ if ( $this->get_coursework()->is_configured_to_have_group_submissions()) {
$members = groups_get_members($this->allocatableid, 'u.id', 'id');
if ($members) {
$id = reset($members)->id;
@@ -797,21 +797,21 @@ public function get_author_id() {
* @param $groupid
* @return array
*/
- public function get_tii_group_member_with_eula($groupid) {
+ public function get_tii_group_member_with_eula($groupid) {
global $DB;
- $sql = "
+ $sql = "
SELECT gm.userid as id
FROM {groups_members} gm,
{turnitintooltwo_users} tu
WHERE tu.userid = gm.userid
AND user_agreement_accepted != 0
- AND gm.groupid = ?
+ AND gm.groupid = ?
ORDER BY gm.userid
LIMIT 1";
- return $DB->get_record_sql($sql,array($groupid));
+ return $DB->get_record_sql($sql, array($groupid));
}
/**
@@ -825,34 +825,34 @@ public function get_status_text() {
switch ($this->get_state()) {
- case submission::NOT_SUBMITTED:
+ case self::NOT_SUBMITTED:
$statustext = get_string('statusnotsubmitted', 'coursework');
break;
- case submission::SUBMITTED:
+ case self::SUBMITTED:
$allowearlyfinalisation = $this->get_coursework()->allowearlyfinalisation;
- $statustext = ($allowearlyfinalisation)?get_string('statusnotfinalised', 'coursework') : get_string('submitted', 'coursework');
+ $statustext = ($allowearlyfinalisation) ?get_string('statusnotfinalised', 'coursework') : get_string('submitted', 'coursework');
break;
- case submission::FINALISED:
+ case self::FINALISED:
$statustext = get_string('statussubmittedfinalised', 'coursework');
break;
- case submission::PARTIALLY_GRADED:
+ case self::PARTIALLY_GRADED:
$statustext = get_string('statuspartiallygraded', 'coursework');
- if($this->any_editable_feedback_exists()){
+ if ($this->any_editable_feedback_exists()) {
$statustext = get_string('statusfullygraded', 'coursework'). " ";
- $statustext .= get_string('stilleditable', 'coursework');
+ $statustext .= get_string('stilleditable', 'coursework');
}
break;
- case submission::FULLY_GRADED:
+ case self::FULLY_GRADED:
$statustext = get_string('statusfullygraded', 'coursework');
break;
- case submission::FINAL_GRADED:
+ case self::FINAL_GRADED:
$spanfinalgraded = html_writer::tag('span',
get_string('statusfinalgraded', 'coursework'),
array('class' => 'highlight'));
@@ -861,12 +861,12 @@ public function get_status_text() {
get_string('statusfinalgradedsingle', 'coursework'),
array('class' => 'highlight'));
$statustext = $this->has_multiple_markers() && $this->sampled_feedback_exists() ? $spanfinalgraded : $spanfinalgradedsingle;
- if($this->editable_final_feedback_exist()){
+ if ($this->editable_final_feedback_exist()) {
$statustext .= " ". get_string('finalgradestilleditable', 'coursework');
}
break;
- case submission::PUBLISHED:
+ case self::PUBLISHED:
$statustext = get_string('statuspublished', 'coursework');
if (!$this->coursework->deadline_has_passed()) {
$statustext .= ' '.get_string('released_early', 'mod_coursework');
@@ -895,35 +895,32 @@ public function belongs_to_user($user) {
* @return bool
*/
public function ready_to_grade() {
- return $this->get_state() >= submission::FINALISED;
+ return $this->get_state() >= self::FINALISED;
}
/**
* @return bool
*/
public function already_published() {
- return $this->get_state() >= submission::PUBLISHED;
+ return $this->get_state() >= self::PUBLISHED;
}
-
-
/**
* @return bool
*/
public function all_inital_graded() {
- return $this->get_state() >= submission::FULLY_GRADED;
+ return $this->get_state() >= self::FULLY_GRADED;
}
- public function is_finalised() {
- return $this->get_state() == submission::FINALISED;
+ public function is_finalised() {
+ return $this->get_state() == self::FINALISED;
}
-
/**
* @return bool
*/
public function final_grade_agreed() {
- return $this->get_state() >= submission::FINAL_GRADED;
+ return $this->get_state() >= self::FINAL_GRADED;
}
/**
@@ -941,7 +938,7 @@ public function get_allocatable() {
* @return user[]
*/
public function get_students() {
- $allocatables = array();
+ $allocatables = [];
if ($this->get_coursework()->is_configured_to_have_group_submissions() && $this->allocatabletype == 'group') {
/**
* @var group $group
@@ -972,7 +969,7 @@ public function ready_to_publish() {
}
$grade_judge = new grade_judge($this->get_coursework());
- if($grade_judge->has_feedback_that_is_promoted_to_gradebook($this) && $this->final_grade_agreed() && !$this->editable_final_feedback_exist()) {
+ if ($grade_judge->has_feedback_that_is_promoted_to_gradebook($this) && $this->final_grade_agreed() && !$this->editable_final_feedback_exist()) {
return true;
}
@@ -1029,7 +1026,7 @@ private function get_grades_to_update() {
// Only updating, not actually creating?
$grades = grade_get_grades($this->get_course_id(), 'mod', 'coursework', $this->get_coursework()->id, $student_ids);
$grades = $grades->items[0]->grades;
- foreach($student_ids as $userid) {
+ foreach ($student_ids as $userid) {
if (!array_key_exists($userid, $grades)) {
$grades[$userid] = new stdClass();
}
@@ -1052,8 +1049,8 @@ public function get_last_submitter() {
*/
public function is_late() {
// check if submission has personal deadline
- if ($this->get_coursework()->personaldeadlineenabled){
- $deadline = $this->submission_personal_deadline();
+ if ($this->get_coursework()->personaldeadlineenabled) {
+ $deadline = $this->submission_personal_deadline();
} else { // if not, use coursework default deadline
$deadline = $this->get_coursework()->get_deadline();
}
@@ -1121,7 +1118,7 @@ public function extract_extension_from_file_name($file_name) {
private function rename_file($file, $counter) {
// if a submission was made of behalf of student/group, we need to use owner's id, not the person who submitted it
- if ($this->is_submission_on_behalf()){
+ if ($this->is_submission_on_behalf()) {
$userid = $this->allocatableid;
} else {
$userid = $this->userid;
@@ -1145,7 +1142,7 @@ public function time_submitted() {
return $this->timesubmitted;
}
- public function sampled_feedback_exists(){
+ public function sampled_feedback_exists() {
global $DB;
return $DB->record_exists('coursework_sample_set_mbrs', array('courseworkid' => $this->courseworkid,
'allocatableid' => $this->get_allocatable()->id(),
@@ -1153,10 +1150,10 @@ public function sampled_feedback_exists(){
}
- public function max_number_of_feedbacks(){
+ public function max_number_of_feedbacks() {
global $DB;
- if ($this->get_coursework()->sampling_enabled()){
+ if ($this->get_coursework()->sampling_enabled()) {
// calculate how many stages(markers) are enabled for this submission
$parameters = array('courseworkid' => $this->coursework->id,
'allocatableid' => $this->get_allocatable()->id(),
@@ -1180,7 +1177,7 @@ public function max_number_of_feedbacks(){
* @return array|bool
* @throws \coding_exception
*/
- public function students_for_gradebook(){
+ public function students_for_gradebook() {
if ($this->get_coursework()->is_configured_to_have_group_submissions()) {
$students = groups_get_members($this->allocatableid);
return $students;
@@ -1207,10 +1204,10 @@ private function students_for_gradng() {
/**
* @return bool
*/
- private function is_submission_on_behalf(){
+ private function is_submission_on_behalf() {
global $USER;
- if (($this->allocatableid == $USER->id && $this->allocatabletype != 'group') || groups_is_member($this->allocatableid)){
+ if (($this->allocatableid == $USER->id && $this->allocatabletype != 'group') || groups_is_member($this->allocatableid)) {
return false;
} else {
return true;
@@ -1230,7 +1227,6 @@ public function get_submissions_in_sample() {
return $records;
}
-
/**
* Function to get samplings for the submission
* @return array
@@ -1247,7 +1243,6 @@ public function get_submissions_in_sample_by_stage($stage_identifier) {
return $record;
}
-
/**
* Check if submission has an extension
*
@@ -1278,12 +1273,12 @@ public function submission_extension() {
* @return mixed
* @throws \coding_exception
*/
- public function submission_personal_deadline(){
+ public function submission_personal_deadline() {
$allocatableid = $this->get_allocatable()->id();
$allocatabletype = $this->get_allocatable()->type();
$personal_deadline = personal_deadline::get_object($this->courseworkid, 'allocatableid-allocatabletype', [$allocatableid, $allocatabletype]);
- if ($personal_deadline){
+ if ($personal_deadline) {
$personal_deadline = $personal_deadline->personal_deadline;
} else {
$personal_deadline = $this->get_coursework()->deadline;
@@ -1293,14 +1288,12 @@ public function submission_personal_deadline(){
}
-
-
/**
* Check if submission was submitted within the extension time
*
* @return bool
*/
- public function submitted_within_extension(){
+ public function submitted_within_extension() {
return $this->time_submitted() < $this->extension_deadline();
}
@@ -1308,7 +1301,7 @@ public function submitted_within_extension(){
* Retrieve submission's extended deadline
* @return mixed
*/
- public function extension_deadline(){
+ public function extension_deadline() {
return $this->submission_extension()->extended_deadline;
}
@@ -1329,9 +1322,6 @@ public function is_assessor_initial_grader() {
return false;
}
-
-
-
/**
* Tells us whether any initial feedbacks for this submission are editable
* This is only for double marked courseworks
@@ -1359,10 +1349,9 @@ public function editable_feedbacks_exist() {
}
}
- return (empty($editablefeedbacks)) ? false : $editablefeedbacks;
+ return (empty($editablefeedbacks)) ? false : $editablefeedbacks;
}
-
/**
* Tells us whether any final feedback for this submission is editable
*
@@ -1380,7 +1369,7 @@ public function editable_final_feedback_exist() {
if ($final_feedback->timecreated + $grade_editing_time > time()) {
$this->editable_final_feedback = true;
}
- } elseif ($final_feedback->finalised == 0 && $final_feedback->assessorid <> 0) {
+ } else if ($final_feedback->finalised == 0 && $final_feedback->assessorid <> 0) {
$this->editable_final_feedback = true;
}
}
@@ -1399,7 +1388,7 @@ public function final_draft_feedbacks_exist() {
$this->get_coursework()->get_grade_editing_time();
- $sql = "
+ $sql = "
SELECT *
FROM {coursework} c,
{coursework_submissions} cs,
@@ -1414,21 +1403,21 @@ public function final_draft_feedbacks_exist() {
AND cf.timecreated + c.gradeeditingtime > :time
";
- $editablefeedbacks = $DB->get_records_sql($sql,array('submissionid'=>$this->id,'time'=>time()));
+ $editablefeedbacks = $DB->get_records_sql($sql, array('submissionid' => $this->id, 'time' => time()));
- return (empty($editablefeedbacks)) ? false : $editablefeedbacks;
+ return (empty($editablefeedbacks)) ? false : $editablefeedbacks;
}
/*
* Determines whether the current user is able to add a turnitin grademark to this submission
*/
- function can_add_tii_grademark() {
- $canadd = false;
+ function can_add_tii_grademark() {
+ $canadd = false;
if ($this->get_coursework()->get_max_markers() == 1) {
- $canadd = (has_any_capability(array('mod/coursework:addinitialgrade','mod/coursework:addministergrades'),$this->get_context()) && $this->ready_to_grade()) ;
+ $canadd = (has_any_capability(array('mod/coursework:addinitialgrade', 'mod/coursework:addministergrades'), $this->get_context()) && $this->ready_to_grade());
} else {
- $canadd = (has_any_capability(array('mod/coursework:addagreedgrade','mod/coursework:addallocatedagreedgrade','mod/coursework:addministergrades'),$this->get_context()) && $this->all_inital_graded()) ;
+ $canadd = (has_any_capability(array('mod/coursework:addagreedgrade', 'mod/coursework:addallocatedagreedgrade', 'mod/coursework:addministergrades'), $this->get_context()) && $this->all_inital_graded());
}
return $canadd;
@@ -1439,7 +1428,7 @@ function can_add_tii_grademark() {
*
* @return bool
*/
- function any_editable_feedback_exists(){
+ function any_editable_feedback_exists() {
return count($this->get_assessor_feedbacks()) >= $this->max_number_of_feedbacks() && $this->editable_feedbacks_exist();
}
@@ -1449,7 +1438,7 @@ function any_editable_feedback_exists(){
*
* @return bool
*/
- function has_valid_extension(){
+ function has_valid_extension() {
deadline_extension::fill_pool_coursework($this->courseworkid);
$extension = deadline_extension::get_object($this->courseworkid, 'allocatableid-allocatabletype', [$this->allocatableid, $this->allocatabletype]);
@@ -1461,9 +1450,8 @@ function has_valid_extension(){
return $valid_extension;
}
-
- function can_be_unfinalised() {
- return ($this->get_state() == submission::FINALISED);
+ function can_be_unfinalised() {
+ return ($this->get_state() == self::FINALISED);
}
/**
@@ -1473,16 +1461,16 @@ function can_be_unfinalised() {
* @return bool|false|mixed|stdClass
* @throws \dml_exception
*/
- function has_specific_assessor_feedback($assessorid){
+ function has_specific_assessor_feedback($assessorid) {
global $DB;
- $feedback = $DB->get_record('coursework_feedbacks', array('submissionid'=>$this->id,
- 'assessorid'=>$assessorid));
+ $feedback = $DB->get_record('coursework_feedbacks', array('submissionid' => $this->id,
+ 'assessorid' => $assessorid));
- return (empty($feedback)) ? false : $feedback;
+ return (empty($feedback)) ? false : $feedback;
}
- //caching
+ // Caching
/**
* cache array
diff --git a/classes/models/user.php b/classes/models/user.php
index 80b6cfc8..d2fd6e47 100644
--- a/classes/models/user.php
+++ b/classes/models/user.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
/**
* This class allows us to add functionality to the users, despite the fact that Moodle has no
@@ -9,8 +29,8 @@
namespace mod_coursework\models;
use mod_coursework\framework\table_base;
-use \mod_coursework\allocation\allocatable;
-use \mod_coursework\allocation\moderatable;
+use mod_coursework\allocation\allocatable;
+use mod_coursework\allocation\moderatable;
use mod_coursework\traits\allocatable_functions;
/**
@@ -31,7 +51,7 @@ class user extends table_base implements allocatable, moderatable {
*/
public function __construct($data = false) {
$allnames = \core_user\fields::get_name_fields();
- foreach($allnames as $namefield) {
+ foreach ($allnames as $namefield) {
$this->$namefield = '';
}
parent::__construct($data);
@@ -111,7 +131,6 @@ public function __toString() {
return $this->id;
}
-
/**
* cache array
*
@@ -190,5 +209,4 @@ public static function get_object($id) {
return self::$pool['id'][$id];
}
-
-}
\ No newline at end of file
+}
diff --git a/classes/moderation_set_rule/minimum_range_grade_percent.php b/classes/moderation_set_rule/minimum_range_grade_percent.php
index e0c32c58..888b48b3 100644
--- a/classes/moderation_set_rule/minimum_range_grade_percent.php
+++ b/classes/moderation_set_rule/minimum_range_grade_percent.php
@@ -17,8 +17,7 @@
/**
* File for a moderation set rule that will include X students from between an upper and lower limit.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -32,7 +31,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Defines a rule that will include all students above or below a particular percentage of
* the total grade.
@@ -58,7 +56,6 @@ public function adjust_set(array &$moderation_set, array &$potential_allocatable
// Convert percentages to raw grades for comparison.
global $DB;
-
$params = array('id' => $this->courseworkid);
$maxgrade = $DB->get_field('coursework', 'grade', $params);
// Convert percentages to raw grades for comparison.
@@ -174,5 +171,4 @@ protected function grade_is_above_lower_limit($grade, $lowerlimit) {
return $grade >= $lowerlimit;
}
-
}
diff --git a/classes/moderation_set_rule/minimum_range_grade_raw.php b/classes/moderation_set_rule/minimum_range_grade_raw.php
index 180ba91c..76985030 100644
--- a/classes/moderation_set_rule/minimum_range_grade_raw.php
+++ b/classes/moderation_set_rule/minimum_range_grade_raw.php
@@ -17,8 +17,7 @@
/**
* File for a moderation set rule that will include X students from between an upper and lower limit.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -31,8 +30,6 @@
defined('MOODLE_INTERNAL') || die();
-
-
/**
* Defines a rule that will include all students above or below a particular percentage of
* the total grade.
diff --git a/classes/moderation_set_rule/range_grade_percent.php b/classes/moderation_set_rule/range_grade_percent.php
index 0502ba61..25cfff42 100644
--- a/classes/moderation_set_rule/range_grade_percent.php
+++ b/classes/moderation_set_rule/range_grade_percent.php
@@ -18,8 +18,7 @@
* Page that prints a table of all students and all markers so that first marker, second marker,
* moderators etc can be allocated manually or automatically.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -32,7 +31,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Defines a rule that will include all students above or below a particular percentage of
* the total grade.
diff --git a/classes/moderation_set_rule/range_grade_raw.php b/classes/moderation_set_rule/range_grade_raw.php
index 2fb23faf..7e4502cf 100644
--- a/classes/moderation_set_rule/range_grade_raw.php
+++ b/classes/moderation_set_rule/range_grade_raw.php
@@ -18,8 +18,7 @@
* Page that prints a table of all students and all markers so that first marker, second marker,
* moderators etc can be allocated manually or automatically.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -32,7 +31,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Defines a rule that will include all students between to raw grade marks.
*/
@@ -128,5 +126,4 @@ public function get_form_elements() {
return $html;
}
-
}
diff --git a/classes/moderation_set_rule/range_total_percent.php b/classes/moderation_set_rule/range_total_percent.php
index 32e6ba9b..825ed812 100644
--- a/classes/moderation_set_rule/range_total_percent.php
+++ b/classes/moderation_set_rule/range_total_percent.php
@@ -18,8 +18,7 @@
* Page that prints a table of all students and all markers so that first marker, second marker,
* moderators etc can be allocated manually or automatically.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -33,7 +32,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Defines a rule that will include all students between an upper and lower percentage of the total
* number. Only really makes sense with lowerlimit as 0.
diff --git a/classes/observer.php b/classes/observer.php
index 66cecc7e..dba5bcef 100644
--- a/classes/observer.php
+++ b/classes/observer.php
@@ -17,48 +17,41 @@
/**
* Observers
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2016 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot.'/mod/coursework/lib.php');
class mod_coursework_observer {
-
-
- public static function autoallocate_when_user_added(core\event\role_assigned $event){
+ public static function autoallocate_when_user_added(core\event\role_assigned $event) {
coursework_role_assigned_event_handler($event);
}
- public static function autoallocate_when_user_removed(core\event\role_unassigned $event){
+ public static function autoallocate_when_user_removed(core\event\role_unassigned $event) {
coursework_role_unassigned_event_handler($event);
}
- public static function coursework_deadline_changed(mod_coursework\event\coursework_deadline_changed $event){
+ public static function coursework_deadline_changed(mod_coursework\event\coursework_deadline_changed $event) {
coursework_send_deadline_changed_emails($event);
}
- public static function process_allocation_after_update(core\event\course_module_updated $event){
+ public static function process_allocation_after_update(core\event\course_module_updated $event) {
coursework_mod_updated($event);
}
-
-
- public static function process_allocation_after_creation(core\event\course_module_created $event){
+ public static function process_allocation_after_creation(core\event\course_module_created $event) {
coursework_mod_updated($event);
@@ -67,21 +60,21 @@ public static function process_allocation_after_creation(core\event\course_modul
/**
* @param \core\event\group_member_added $event
*/
- public static function process_allocations_when_group_member_added(\core\event\group_member_added $event){
+ public static function process_allocations_when_group_member_added(\core\event\group_member_added $event) {
course_group_member_added($event);
}
/**
* @param \core\event\group_member_removed $event
*/
- public static function process_allocations_when_group_member_removed(\core\event\group_member_removed $event){
+ public static function process_allocations_when_group_member_removed(\core\event\group_member_removed $event) {
course_group_member_removed($event);
}
/**
* @param \core\event\role_assigned $event
*/
- public static function add_teacher_to_dropdown_when_enrolled(core\event\role_assigned$event){
+ public static function add_teacher_to_dropdown_when_enrolled(core\event\role_assigned$event) {
teacher_allocation_cache_purge($event);
}
@@ -89,11 +82,10 @@ public static function add_teacher_to_dropdown_when_enrolled(core\event\role_ass
/**
* @param \core\event\role_unassigned $event
*/
- public static function remove_teacher_from_dropdown_when_unenrolled(core\event\role_unassigned$event){
+ public static function remove_teacher_from_dropdown_when_unenrolled(core\event\role_unassigned$event) {
teacher_removed_allocated_not_graded($event);
teacher_allocation_cache_purge($event);
}
-
-}
\ No newline at end of file
+}
diff --git a/classes/personal_deadline/allocatable.php b/classes/personal_deadline/allocatable.php
index 919dc25b..b1e0441f 100644
--- a/classes/personal_deadline/allocatable.php
+++ b/classes/personal_deadline/allocatable.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\personal_deadline;
use mod_coursework\models\coursework;
@@ -75,4 +95,4 @@ public function has_all_initial_feedbacks($coursework);
* @return submission
*/
public function get_submission($coursework);
-}
\ No newline at end of file
+}
diff --git a/classes/personal_deadline/table/builder.php b/classes/personal_deadline/table/builder.php
index 8629555d..ec6d52e2 100644
--- a/classes/personal_deadline/table/builder.php
+++ b/classes/personal_deadline/table/builder.php
@@ -19,8 +19,7 @@
/**
* Class file for the renderable object that makes the table for assigning personal deadlines to students.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -64,7 +63,6 @@ public function __construct($coursework, array $options) {
$this->options = $options;
}
-
/**
* Takes the raw data, instantiates each row as a new renderable object and returns the whole lot.
*
@@ -73,7 +71,7 @@ public function __construct($coursework, array $options) {
public function get_rows() {
$allocatables = $this->get_coursework()->get_allocatables();
- $rows = array();
+ $rows = [];
foreach ($allocatables as $allocatable) {
$rows[] = new row_builder($this, $allocatable);
}
@@ -87,7 +85,6 @@ public function get_rows() {
$method_name));
}
-
return $rows;
}
@@ -124,7 +121,6 @@ public function get_allocatable_cell() {
return new user_cell($items);
}
-
/**
* @return personal_deadline_cell
*/
diff --git a/classes/personal_deadline/table/row/builder.php b/classes/personal_deadline/table/row/builder.php
index 0f9f3a87..f6e8bb89 100644
--- a/classes/personal_deadline/table/row/builder.php
+++ b/classes/personal_deadline/table/row/builder.php
@@ -19,8 +19,7 @@
/**
* Class file for the renderable object that makes a single row in the marker personal deadline table.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -60,7 +59,6 @@ public function __construct($personal_deadline_table, $allocatable) {
$this->allocatable = $allocatable;
}
-
/**
* @return allocatable
*/
@@ -121,7 +119,7 @@ public function get_student_firstname() {
$allocatable = $this->get_allocatable();
if (empty($allocatable->firstname)) {
- $this->allocatable = user::find($allocatable);
+ $this->allocatable = user::find($allocatable);
}
return $this->get_allocatable()->firstname;
@@ -136,7 +134,7 @@ public function get_student_lastname() {
$allocatable = $this->get_allocatable();
if (empty($allocatable->lastname)) {
- $this->allocatable = user::find($allocatable);
+ $this->allocatable = user::find($allocatable);
}
return $this->get_allocatable()->lastname;
@@ -151,13 +149,12 @@ public function get_idnumber() {
$allocatable = $this->get_allocatable();
if (empty($allocatable->idnumber)) {
- $this->allocatable = user::find($allocatable);
+ $this->allocatable = user::find($allocatable);
}
return $this->get_allocatable()->idnumber;
}
-
/**
* @return string
*/
@@ -167,7 +164,7 @@ public function get_email() {
$allocatable = $this->get_allocatable();
if (empty($allocatable->email)) {
- $this->allocatable = user::find($allocatable);
+ $this->allocatable = user::find($allocatable);
}
return $this->get_allocatable()->email;
@@ -190,8 +187,8 @@ public function get_personal_deadlines() {
$personal_deadline = $DB->get_record('coursework_person_deadlines',
array('courseworkid' => $this->get_coursework()->id,
'allocatableid' => $this->allocatable->id(),
- 'allocatabletype'=> $this->allocatable->type()));
- if ($personal_deadline){
+ 'allocatabletype' => $this->allocatable->type()));
+ if ($personal_deadline) {
$personal_deadline = $personal_deadline->personal_deadline;
} else {
$personal_deadline = $this->get_coursework()->deadline;
@@ -200,27 +197,24 @@ public function get_personal_deadlines() {
return $personal_deadline;
}
-
- public function get_submission_status() {
+ public function get_submission_status() {
global $DB;
- $submission_db = $DB->get_record('coursework_submissions',
+ $submission_db = $DB->get_record('coursework_submissions',
array('courseworkid' => $this->get_coursework()->id,
'allocatableid' => $this->allocatable->id(),
- 'allocatabletype'=> $this->allocatable->type()));
+ 'allocatabletype' => $this->allocatable->type()));
- $submission = \mod_coursework\models\submission::find($submission_db);
+ $submission = \mod_coursework\models\submission::find($submission_db);
- $statustext = get_string('statusnotsubmitted','mod_coursework');
+ $statustext = get_string('statusnotsubmitted', 'mod_coursework');
- if (!empty($submission) && $submission->is_finalised()) {
- $statustext = get_string('finalisedsubmission','mod_coursework');
+ if (!empty($submission) && $submission->is_finalised()) {
+ $statustext = get_string('finalisedsubmission', 'mod_coursework');
} else if (!empty($submission)) {
- $statustext = $submission->get_status_text();
+ $statustext = $submission->get_status_text();
}
return $statustext;
}
-
-
}
diff --git a/classes/plagiarism_helpers/base.php b/classes/plagiarism_helpers/base.php
index 4fc98e52..60c2ce80 100644
--- a/classes/plagiarism_helpers/base.php
+++ b/classes/plagiarism_helpers/base.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\plagiarism_helpers;
use mod_coursework\models\coursework;
@@ -43,4 +63,4 @@ abstract public function enabled();
*/
abstract public function human_readable_name();
-}
\ No newline at end of file
+}
diff --git a/classes/plagiarism_helpers/turnitin.php b/classes/plagiarism_helpers/turnitin.php
index ca03191d..ec2c23b8 100644
--- a/classes/plagiarism_helpers/turnitin.php
+++ b/classes/plagiarism_helpers/turnitin.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\plagiarism_helpers;
@@ -48,4 +68,4 @@ public function enabled() {
public function human_readable_name() {
return get_string('turnitin', 'plagiarism_turnitin');
}
-}
\ No newline at end of file
+}
diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php
index 96537ecb..acc79b7a 100644
--- a/classes/privacy/provider.php
+++ b/classes/privacy/provider.php
@@ -13,16 +13,23 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework\privacy;
defined('MOODLE_INTERNAL') || die();
-use \core_privacy\local\metadata\collection;
-use \core_privacy\local\request\contextlist;
-use \core_privacy\local\request\writer;
-use \core_privacy\local\request\approved_contextlist;
-use \core_privacy\local\request\transform;
-use \core_privacy\local\request\helper;
-use \core_privacy\local\request\userlist;
-use \core_privacy\local\request\approved_userlist;
+use core_privacy\local\metadata\collection;
+use core_privacy\local\request\contextlist;
+use core_privacy\local\request\writer;
+use core_privacy\local\request\approved_contextlist;
+use core_privacy\local\request\transform;
+use core_privacy\local\request\helper;
+use core_privacy\local\request\userlist;
+use core_privacy\local\request\approved_userlist;
/**
* Privacy Subsystem implementation for coursework.
*
@@ -42,48 +49,48 @@ class provider implements
*/
public static function get_metadata(collection $collection) : collection {
$feedbacks = [
- 'assessorid' => 'privacy:metadata:assessorid',
- 'timecreated' => 'privacy:metadata:timecreated',
- 'timemodified' => 'timemodified',
- 'grade' => 'privacy:metadata:grade',
- 'submissionid' => 'privacy:metadata:submissionid',
- 'feedbackcomment' => 'privacy:metadata:feedbackcomment'
+ 'assessorid' => 'privacy:metadata:assessorid',
+ 'timecreated' => 'privacy:metadata:timecreated',
+ 'timemodified' => 'timemodified',
+ 'grade' => 'privacy:metadata:grade',
+ 'submissionid' => 'privacy:metadata:submissionid',
+ 'feedbackcomment' => 'privacy:metadata:feedbackcomment'
];
$submissions = [
- 'authorid' => 'privacy:metadata:authorid',
- 'userid' => 'privacy:metadata:userid',
- 'timecreated' => 'privacy:metadata:timecreated',
- 'timemodified' => 'timemodified',
- 'createdby' => 'createdby',
- 'timesubmitted' => 'timesubmitted'
+ 'authorid' => 'privacy:metadata:authorid',
+ 'userid' => 'privacy:metadata:userid',
+ 'timecreated' => 'privacy:metadata:timecreated',
+ 'timemodified' => 'timemodified',
+ 'createdby' => 'createdby',
+ 'timesubmitted' => 'timesubmitted'
];
$extensions = [
'allocatableid' => 'privacy:metadata:allocatableid',
- 'createdbyid' => 'privacy:metadata:createdbyid',
+ 'createdbyid' => 'privacy:metadata:createdbyid',
'extra_information_text' => 'privacy:metadata:extra_information_text',
'extended_deadline' => 'privacy:metadata:extended_deadline',
- 'allocatableuser' => 'privacy:metadata:userid',
- 'allocatablegroup' => 'privacy:metadata:groupid'
+ 'allocatableuser' => 'privacy:metadata:userid',
+ 'allocatablegroup' => 'privacy:metadata:groupid'
];
$persondeadlines = [
- 'allocatableid' => 'privacy:metadata:allocatableid',
- 'createdbyid' => 'privacy:metadata:createdbyid',
+ 'allocatableid' => 'privacy:metadata:allocatableid',
+ 'createdbyid' => 'privacy:metadata:createdbyid',
'personal_deadline' => 'privacy:metadata:personal_deadline',
- 'allocatableuser' => 'privacy:metadata:userid',
- 'allocatablegroup' => 'privacy:metadata:groupid'
+ 'allocatableuser' => 'privacy:metadata:userid',
+ 'allocatablegroup' => 'privacy:metadata:groupid'
];
$modagreements = [
- 'moderatorid' => 'privacy:metadata:moderatorid',
- 'agreement' => 'privacy:metadata:agreement',
- 'modcomment' => 'privacy:metadata:modcomment',
- 'timecreated' => 'privacy:metadata:timecreated',
- 'timemodified' => 'timemodified'
+ 'moderatorid' => 'privacy:metadata:moderatorid',
+ 'agreement' => 'privacy:metadata:agreement',
+ 'modcomment' => 'privacy:metadata:modcomment',
+ 'timecreated' => 'privacy:metadata:timecreated',
+ 'timemodified' => 'timemodified'
];
$plagiarismflags = [
- 'createdby' => 'privacy:metadata:createdby',
- 'comment' => 'privacy:metadata:comment',
- 'timecreated' => 'privacy:metadata:timecreated',
- 'timemodified' => 'timemodified'
+ 'createdby' => 'privacy:metadata:createdby',
+ 'comment' => 'privacy:metadata:comment',
+ 'timecreated' => 'privacy:metadata:timecreated',
+ 'timemodified' => 'timemodified'
];
$collection->add_database_table('coursework_feedbacks', $feedbacks, 'privacy:metadata:feedbacks');
$collection->add_database_table('coursework_submissions', $submissions, 'privacy:metadata:submissions');
@@ -167,7 +174,6 @@ public static function get_users_in_context(userlist $userlist) {
WHERE ctx.id = :contextid AND ctx.contextlevel = :contextlevel";
$userlist->add_from_sql('createdby', $sql, $params);
-
}
/**
* Returns all of the contexts that has information relating to the userid.
@@ -623,4 +629,4 @@ protected static function export_mod_agreement_data($agreement, $context, $path)
writer::with_context($context)
->export_data(array_merge($path, [get_string('privacy:moderator', 'mod_coursework')]), (object) $agreementData);
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/base_renderer.php b/classes/render_helpers/grading_report/base_renderer.php
index ed4ec4e7..bce70543 100644
--- a/classes/render_helpers/grading_report/base_renderer.php
+++ b/classes/render_helpers/grading_report/base_renderer.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report;
@@ -14,4 +34,4 @@ public function render_grading_report() {
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/_user_cell.php b/classes/render_helpers/grading_report/cells/_user_cell.php
index 2ed15136..def69931 100644
--- a/classes/render_helpers/grading_report/cells/_user_cell.php
+++ b/classes/render_helpers/grading_report/cells/_user_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use core_user;
@@ -47,16 +67,16 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
$viewanonymous = has_capability('mod/coursework:viewanonymous', $this->coursework->get_context());
//adding this line so that the sortable heading function will make a sortable link unique to the table
- //if tablename is set
- $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '' ;
+ // If tablename is set
+ $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '';
// allow to sort users only if CW is not set to blind marking or a user has capability to view anonymous
- if($viewanonymous || !$this->coursework->blindmarking) {
+ if ($viewanonymous || !$this->coursework->blindmarking) {
$sort_by_first_name = $this->helper_sortable_heading(get_string('firstname'),
'firstname',
$options['sorthow'],
@@ -83,7 +103,7 @@ public function get_table_header($options = array()) {
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'studentname';
}
@@ -110,4 +130,4 @@ private function fullname_format() {
public function header_group() {
return 'empty';
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/allocatable_cell.php b/classes/render_helpers/grading_report/cells/allocatable_cell.php
index 8be27a7c..2e801f75 100644
--- a/classes/render_helpers/grading_report/cells/allocatable_cell.php
+++ b/classes/render_helpers/grading_report/cells/allocatable_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
@@ -8,4 +28,4 @@
*/
interface allocatable_cell extends cell_interface {
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/cell_base.php b/classes/render_helpers/grading_report/cells/cell_base.php
index 82db8731..d3fdb5a6 100644
--- a/classes/render_helpers/grading_report/cells/cell_base.php
+++ b/classes/render_helpers/grading_report/cells/cell_base.php
@@ -1,7 +1,26 @@
.
-namespace mod_coursework\render_helpers\grading_report\cells;
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace mod_coursework\render_helpers\grading_report\cells;
use html_writer;
use mod_coursework\models\coursework;
@@ -20,7 +39,7 @@ abstract class cell_base implements cell_interface {
/**
* @param array $items
*/
- public function __construct($items = array()) {
+ public function __construct($items = []) {
$this->coursework = $items['coursework'];
$this->after_initialisation($items);
}
@@ -34,13 +53,13 @@ public function __construct($items = array()) {
* @param string $sortby The current sort from the URL.
* @return string
*/
- protected function helper_sortable_heading($display_name, $field, $sort_how, $sortby = '',$tablename='') {
+ protected function helper_sortable_heading($display_name, $field, $sort_how, $sortby = '', $tablename='') {
global $PAGE;
$params = array('id' => optional_param('id', 0, PARAM_INT));
- $tablename = (!empty($tablename)) ? $tablename.'_' : '' ;
+ $tablename = (!empty($tablename)) ? $tablename.'_' : '';
if (optional_param($tablename.'page', 0, PARAM_INT) > 0) {
$params[$tablename.'page'] = optional_param($tablename.'page', 0, PARAM_INT);
@@ -53,15 +72,13 @@ protected function helper_sortable_heading($display_name, $field, $sort_how, $so
$params[$tablename.'sorthow'] = 'ASC';
}
-
-
// $url = clone($PAGE->url);
// $url->params($params);
// Need a little icon to show ASC or DESC.
// if ($field == $sortby) {
- // $display_name .= ' '; // Keep them on the same line.
- // $display_name .= $sort_how == 'ASC' ? '▲' : '▼'; // Small unicode triangles.
+ // $display_name .= ' '; // Keep them on the same line.
+ // $display_name .= $sort_how == 'ASC' ? '▲' : '▼'; // Small unicode triangles.
// }
// return html_writer::link($url, $display_name);
@@ -125,9 +142,8 @@ protected function after_initialisation($items) {
/**
* Override for the header help message
*/
- public function get_table_header_help_icon(){
+ public function get_table_header_help_icon() {
}
-
}
diff --git a/classes/render_helpers/grading_report/cells/cell_interface.php b/classes/render_helpers/grading_report/cells/cell_interface.php
index 921480db..0dd5bb2d 100644
--- a/classes/render_helpers/grading_report/cells/cell_interface.php
+++ b/classes/render_helpers/grading_report/cells/cell_interface.php
@@ -1,7 +1,26 @@
.
-namespace mod_coursework\render_helpers\grading_report\cells;
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace mod_coursework\render_helpers\grading_report\cells;
use html_table_cell;
use mod_coursework\grading_table_row_base;
@@ -22,8 +41,7 @@ public function get_table_cell($rowobject);
* @param array $options
* @return string
*/
- public function get_table_header($options = array());
-
+ public function get_table_header($options = []);
/**
* @return string
@@ -46,4 +64,4 @@ public function header_group();
* @return mixed
*/
public function get_table_header_help_icon();
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/email_cell.php b/classes/render_helpers/grading_report/cells/email_cell.php
index cfb4059d..2615fceb 100644
--- a/classes/render_helpers/grading_report/cells/email_cell.php
+++ b/classes/render_helpers/grading_report/cells/email_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use core_user;
@@ -30,14 +50,14 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
return "Email";
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'email_cell';
}
@@ -47,4 +67,4 @@ public function get_table_header_class(){
public function header_group() {
return 'empty';
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/first_name_cell.php b/classes/render_helpers/grading_report/cells/first_name_cell.php
index 9f390a1e..3528de99 100644
--- a/classes/render_helpers/grading_report/cells/first_name_cell.php
+++ b/classes/render_helpers/grading_report/cells/first_name_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use core_user;
@@ -30,14 +50,14 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
return "First Name";
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'firstname_cell';
}
@@ -47,4 +67,4 @@ public function get_table_header_class(){
public function header_group() {
return 'empty';
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/first_name_letter_cell.php b/classes/render_helpers/grading_report/cells/first_name_letter_cell.php
index 9cf7d910..b6145057 100644
--- a/classes/render_helpers/grading_report/cells/first_name_letter_cell.php
+++ b/classes/render_helpers/grading_report/cells/first_name_letter_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use core_user;
@@ -38,14 +58,14 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
return "First Letter - First Name";
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'firstname_letter_cell';
}
@@ -55,4 +75,4 @@ public function get_table_header_class(){
public function header_group() {
return 'empty';
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/grade_for_gradebook_cell.php b/classes/render_helpers/grading_report/cells/grade_for_gradebook_cell.php
index 1c801899..d11947e2 100644
--- a/classes/render_helpers/grading_report/cells/grade_for_gradebook_cell.php
+++ b/classes/render_helpers/grading_report/cells/grade_for_gradebook_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use coding_exception;
@@ -35,14 +55,14 @@ public function get_table_cell($row_object) {
* @throws coding_exception
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
return get_string('provisionalgrade', 'mod_coursework');
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'provisionalgrade';
}
@@ -56,9 +76,9 @@ public function header_group() {
/**
* @return string
*/
- public function get_table_header_help_icon(){
+ public function get_table_header_help_icon() {
global $OUTPUT;
return ($OUTPUT->help_icon('provisionalgrade', 'mod_coursework'));
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/group_cell.php b/classes/render_helpers/grading_report/cells/group_cell.php
index fa75824e..93fb8e2b 100644
--- a/classes/render_helpers/grading_report/cells/group_cell.php
+++ b/classes/render_helpers/grading_report/cells/group_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use coding_exception;
@@ -28,11 +48,10 @@ public function get_table_cell($row_object) {
$content .= '
';
$content .= '
';
return $this->get_new_cell_with_order_data(['display' => $content, '@data-order' => $deadline]);
@@ -61,9 +81,9 @@ public function get_table_cell($row_object) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
- $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '' ;
+ $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '';
return $this->helper_sortable_heading(get_string('tableheadpersonaldeadline', 'coursework'),
'personaldeadline',
@@ -75,7 +95,7 @@ public function get_table_header($options = array()) {
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'tableheadpersonaldeadline';
}
diff --git a/classes/render_helpers/grading_report/cells/plagiarism_cell.php b/classes/render_helpers/grading_report/cells/plagiarism_cell.php
index fcd79e9e..c5040102 100644
--- a/classes/render_helpers/grading_report/cells/plagiarism_cell.php
+++ b/classes/render_helpers/grading_report/cells/plagiarism_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use coding_exception;
@@ -41,14 +61,14 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
return get_string('plagiarism', 'mod_coursework');
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'plagiarism';
}
@@ -58,4 +78,4 @@ public function get_table_header_class(){
public function header_group() {
return 'submission';
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/plagiarism_flag_cell.php b/classes/render_helpers/grading_report/cells/plagiarism_flag_cell.php
index da318582..f4b22698 100644
--- a/classes/render_helpers/grading_report/cells/plagiarism_flag_cell.php
+++ b/classes/render_helpers/grading_report/cells/plagiarism_flag_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use coding_exception;
@@ -29,13 +49,13 @@ public function get_table_cell($rowobject) {
$content = '';
$ability = new ability(user::find($USER), $rowobject->get_coursework());
- if($rowobject->has_submission() && $rowobject->get_submission()->finalised){
+ if ($rowobject->has_submission() && $rowobject->get_submission()->finalised) {
$plagiarism_flag_params = array(
'submissionid' => $rowobject->get_submission()->id
);
- $plagiarism_flag = plagiarism_flag::find($plagiarism_flag_params);
+ $plagiarism_flag = plagiarism_flag::find($plagiarism_flag_params);
- if(!$plagiarism_flag){ // if plagiarism flag for this submission doesn't exist, we can create one
+ if (!$plagiarism_flag) { // if plagiarism flag for this submission doesn't exist, we can create one
$plagiarism_flag_params = array('courseworkid' => $rowobject->get_coursework()->id,
'submissionid' => $rowobject->get_submission()->id);
$new_plagiarism_flag = plagiarism_flag::build($plagiarism_flag_params);
@@ -62,14 +82,14 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
return (get_string('tableheadplagiarismalert', 'coursework'));
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'tableheadplagiarismalert';
}
@@ -80,11 +100,9 @@ public function header_group() {
return 'submission';
}
-
/**
- * @param grading_table_row_base $rowobject
- * @param $row_object
- * @return array
+ * @param grading_table_row_base $row_object
+ * @return string
* @throws \coding_exception
*/
private function new_flag_plagiarism_button($row_object) {
@@ -105,11 +123,9 @@ private function new_flag_plagiarism_button($row_object) {
return $OUTPUT->action_link($link, $title, null, $html_attributes);
}
-
/**
- * @param grading_table_row_base $rowobject
- * @param $row_object
- * @return array
+ * @param grading_table_row_base $row_object
+ * @return string
* @throws \coding_exception
*/
private function edit_flag_plagiarism_button($row_object) {
@@ -127,4 +143,4 @@ private function edit_flag_plagiarism_button($row_object) {
$icon = new pix_icon('edit', $title, 'coursework');
return $OUTPUT->action_icon($link, $icon, null, array('id' => $link_id));
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/single_assessor_feedback_cell.php b/classes/render_helpers/grading_report/cells/single_assessor_feedback_cell.php
index 67294989..1573f4e2 100644
--- a/classes/render_helpers/grading_report/cells/single_assessor_feedback_cell.php
+++ b/classes/render_helpers/grading_report/cells/single_assessor_feedback_cell.php
@@ -1,7 +1,26 @@
.
-namespace mod_coursework\render_helpers\grading_report\cells;
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace mod_coursework\render_helpers\grading_report\cells;
use coding_exception;
use html_table_cell;
@@ -49,7 +68,6 @@ public function get_table_cell($rowobject) {
$content = $this->get_content($rowobject);
return $this->get_new_cell_with_class($content);
}
-
public function get_content($rowobject) {
global $USER;
@@ -122,14 +140,14 @@ public function get_content($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
return get_string('feedbackandgrading', 'coursework');
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'feedbackandgrading';
}
@@ -142,7 +160,7 @@ public function header_group() {
/**
* @param $rowobject
- * @return array
+ * @return string
* @throws \coding_exception
*/
private function edit_feedback_button($rowobject) {
@@ -159,7 +177,6 @@ private function edit_feedback_button($rowobject) {
$title = get_string('editfinalgrade', 'coursework');
$icon = new pix_icon('edit', $title, 'coursework');
-
return $OUTPUT->action_icon($link,
$icon,
null,
@@ -183,17 +200,15 @@ private function show_feedback_button($rowobject) {
$iconlink = $OUTPUT->action_link($link,
$linktitle,
null,
- array('class'=>'show_feedback','id' => $link_id));
-
+ array('class' => 'show_feedback', 'id' => $link_id));
return $iconlink;
}
-
/**
* @param grading_table_row_base $rowobject
* @param user $assessor
- * @return array
+ * @return string
* @throws \coding_exception
*/
private function new_feedback_button($rowobject, $assessor) {
@@ -214,7 +229,7 @@ private function new_feedback_button($rowobject, $assessor) {
return $OUTPUT->action_link($link,
$title,
null,
- array('class'=>'new_final_feedback','id' => $link_id));
+ array('class' => 'new_final_feedback', 'id' => $link_id));
}
}
diff --git a/classes/render_helpers/grading_report/cells/status_cell.php b/classes/render_helpers/grading_report/cells/status_cell.php
index a44ba4d6..348ed3e2 100644
--- a/classes/render_helpers/grading_report/cells/status_cell.php
+++ b/classes/render_helpers/grading_report/cells/status_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use html_table_cell;
@@ -27,14 +47,14 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
return get_string('tableheadstatus', 'coursework');
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'tableheadstatus';
}
@@ -44,4 +64,4 @@ public function get_table_header_class(){
public function header_group() {
return 'empty';
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/submission_cell.php b/classes/render_helpers/grading_report/cells/submission_cell.php
index 657cffce..ff4eff2b 100644
--- a/classes/render_helpers/grading_report/cells/submission_cell.php
+++ b/classes/render_helpers/grading_report/cells/submission_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use coding_exception;
@@ -59,7 +79,6 @@ public function get_table_cell($rowobject) {
'createdby' => $USER->id,
));
-
if (($rowobject->get_submission()&& !$rowobject->get_submission()->finalised)
|| !$rowobject->get_submission()) {
@@ -113,9 +132,9 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
- $tablename = (isset($options['tablename'])) ? $options['tablename'] : '' ;
+ $tablename = (isset($options['tablename'])) ? $options['tablename'] : '';
$fileid = $this->helper_sortable_heading(get_string('tableheadid', 'coursework'),
'hash',
@@ -123,13 +142,13 @@ public function get_table_header($options = array()) {
$options['sortby'],
$tablename);
- return get_string('tableheadfilename', 'coursework') .' / ' . $fileid ;
+ return get_string('tableheadfilename', 'coursework') .' / ' . $fileid;
}
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'tableheadfilename';
}
@@ -139,4 +158,4 @@ public function get_table_header_class(){
public function header_group() {
return 'submission';
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/cells/time_submitted_cell.php b/classes/render_helpers/grading_report/cells/time_submitted_cell.php
index da4eff2d..338c7a26 100644
--- a/classes/render_helpers/grading_report/cells/time_submitted_cell.php
+++ b/classes/render_helpers/grading_report/cells/time_submitted_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use coding_exception;
@@ -60,8 +80,8 @@ public function prepare_content_cell($row_object) {
if ($submission->is_late() && (!$submission->has_extension() || !$submission->submitted_within_extension())) {
// check if submission has personal deadline
- if ($coursework->personaldeadlineenabled ){
- $deadline = $submission->submission_personal_deadline();
+ if ($coursework->personaldeadlineenabled ) {
+ $deadline = $submission->submission_personal_deadline();
} else { // if not, use coursework default deadline
$deadline = $coursework->deadline;
}
@@ -84,7 +104,7 @@ public function prepare_content_cell($row_object) {
$content .= html_writer::end_span();
} else {
- $content .= html_writer::span('(' . get_string('ontime', 'mod_coursework') . ')','ontime_submission');
+ $content .= html_writer::span('(' . get_string('ontime', 'mod_coursework') . ')', 'ontime_submission');
}
if ($submission->get_allocatable()->type() == 'group') {
@@ -114,19 +134,18 @@ public function prepare_content_cell($row_object) {
$displayeddeadline = $extension->extended_deadline;
}
-
- if($extension->id) {
+ if ($extension->id) {
$new_extension_params['id'] = $extension->id;
}
- if($submission) {
+ if ($submission) {
$new_extension_params['submissionid'] = $submission->id;
}
$deadline = $deadline ?? $coursework->deadline;
$content_time = [
- 'time' => date('d-m-Y H:i',$deadline),
+ 'time' => date('d-m-Y H:i', $deadline),
'time_content' => userdate($deadline),
- 'is_have_deadline' => ($coursework->deadline > 0)? 1 : 0,
+ 'is_have_deadline' => ($coursework->deadline > 0) ? 1 : 0,
];
if ($ability->can('new', $extension) && $coursework->extensions_enabled()) {
@@ -135,7 +154,7 @@ public function prepare_content_cell($row_object) {
$content .= $OUTPUT->action_link($link,
$title,
null,
- array('class' => 'new_deadline_extension', 'data-name' => $row_object->get_allocatable()->name(), 'data-params' => json_encode($new_extension_params), 'data-time' =>json_encode($content_time) ));
+ array('class' => 'new_deadline_extension', 'data-name' => $row_object->get_allocatable()->name(), 'data-params' => json_encode($new_extension_params), 'data-time' => json_encode($content_time) ));
} else if ($ability->can('edit', $extension) && $coursework->extensions_enabled()) {
$link = $this->get_router()->get_path('edit deadline extension', array('id' => $extension->id));
@@ -144,10 +163,9 @@ public function prepare_content_cell($row_object) {
$content .= $OUTPUT->action_icon($link,
$icon,
null,
- array('class' => 'edit_deadline_extension', 'data-name' => $row_object->get_allocatable()->name(), 'data-params' => json_encode($new_extension_params), 'data-time' =>json_encode($content_time)));
+ array('class' => 'edit_deadline_extension', 'data-name' => $row_object->get_allocatable()->name(), 'data-params' => json_encode($new_extension_params), 'data-time' => json_encode($content_time)));
}
-
$content .= '';
return ['display' => $content, '@data-order' => $this->standardize_time_for_compare($time_submitted) . '|' . $this->standardize_time_for_compare($displayeddeadline)];
@@ -177,11 +195,11 @@ private function standardize_time_for_compare($time) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
//adding this line so that the sortable heading function will make a sortable link unique to the table
- //if tablename is set
- $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '' ;
+ // If tablename is set
+ $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '';
return $this->helper_sortable_heading(get_string('tableheadsubmissiondate', 'coursework'),
'timesubmitted',
@@ -193,7 +211,7 @@ public function get_table_header($options = array()) {
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'tableheaddate';
}
diff --git a/classes/render_helpers/grading_report/cells/user_cell.php b/classes/render_helpers/grading_report/cells/user_cell.php
index 2e43a670..6eddeab0 100644
--- a/classes/render_helpers/grading_report/cells/user_cell.php
+++ b/classes/render_helpers/grading_report/cells/user_cell.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\cells;
use core_user;
@@ -35,13 +55,13 @@ public function get_table_cell($rowobject) {
// TODO CSS for the space!!
$content .= ' ' . $rowobject->get_user_name(true);
$content .= " ".$rowobject->get_email();
- $user = $rowobject->get_allocatable();
+ $user = $rowobject->get_allocatable();
/*
- $candidatenumber = $user->candidate_number();
+ $candidatenumber = $user->candidate_number();
- if (!empty($candidatenumber)) {
+ if (!empty($candidatenumber)) {
- $content .= ' ('.$candidatenumber.')';
+ $content .= ' ('.$candidatenumber.')';
}
@@ -54,16 +74,16 @@ public function get_table_cell($rowobject) {
* @param array $options
* @return string
*/
- public function get_table_header($options = array()) {
+ public function get_table_header($options = []) {
$viewanonymous = has_capability('mod/coursework:viewanonymous', $this->coursework->get_context());
//adding this line so that the sortable heading function will make a sortable link unique to the table
- //if tablename is set
- $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '' ;
+ // If tablename is set
+ $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '';
// allow to sort users only if CW is not set to blind marking or a user has capability to view anonymous
- if($viewanonymous || !$this->coursework->blindmarking) {
+ if ($viewanonymous || !$this->coursework->blindmarking) {
$sort_by_first_name = $this->helper_sortable_heading(get_string('firstname'),
'firstname',
$options['sorthow'],
@@ -110,7 +130,7 @@ public function get_table_header($options = array()) {
/**
* @return string
*/
- public function get_table_header_class(){
+ public function get_table_header_class() {
return 'studentname';
}
diff --git a/classes/render_helpers/grading_report/component_factory_interface.php b/classes/render_helpers/grading_report/component_factory_interface.php
index 7f2316ad..77cf65ec 100644
--- a/classes/render_helpers/grading_report/component_factory_interface.php
+++ b/classes/render_helpers/grading_report/component_factory_interface.php
@@ -1,19 +1,38 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report;
/**
* Each variation on the grading report should provide an abstract factory that conforms to this interface.
* The renderer then uses a template method to assemble the pieces.
- *
+ *
* Interface component_factory_interface
* @package mod_coursework\render_helpers\grading_report
*/
interface component_factory_interface {
-
public function get_cells();
public function get_sub_rows();
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/multi_renderer.php b/classes/render_helpers/grading_report/multi_renderer.php
index a072df68..3e086a8a 100644
--- a/classes/render_helpers/grading_report/multi_renderer.php
+++ b/classes/render_helpers/grading_report/multi_renderer.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report;
@@ -11,4 +31,4 @@
*/
class multi_renderer extends base_renderer {
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/single_renderer.php b/classes/render_helpers/grading_report/single_renderer.php
index 252949f1..14f94766 100644
--- a/classes/render_helpers/grading_report/single_renderer.php
+++ b/classes/render_helpers/grading_report/single_renderer.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report;
@@ -11,4 +31,4 @@
*/
class single_renderer extends base_renderer {
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/sub_rows/multi_marker_feedback_sub_rows.php b/classes/render_helpers/grading_report/sub_rows/multi_marker_feedback_sub_rows.php
index ce325461..8ed31c78 100644
--- a/classes/render_helpers/grading_report/sub_rows/multi_marker_feedback_sub_rows.php
+++ b/classes/render_helpers/grading_report/sub_rows/multi_marker_feedback_sub_rows.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\sub_rows;
@@ -62,9 +82,9 @@ public function get_grade_cell_content($feedback_row, $coursework, $ability = nu
if (empty($ability)) {
$ability = new ability(user::find($USER), $coursework);
}
- $gradedby = ($coursework->allocation_enabled() && $feedback_row->has_feedback() && $feedback_row->get_graded_by() != $feedback_row->get_assessor())?
+ $gradedby = ($coursework->allocation_enabled() && $feedback_row->has_feedback() && $feedback_row->get_graded_by() != $feedback_row->get_assessor()) ?
' (Graded by: '. $feedback_row->get_graders_name().')' : '';
- $editable = (!$feedback_row->has_feedback() || $feedback_row->get_feedback()->finalised)? '' : ''.get_string('notfinalised', 'coursework');
+ $editable = (!$feedback_row->has_feedback() || $feedback_row->get_feedback()->finalised) ? '' : ''.get_string('notfinalised', 'coursework');
$result = $this->comment_for_row($feedback_row, $ability) . $gradedby . $editable;
return $result;
}
@@ -84,7 +104,6 @@ protected function render_assessor_feedback_table(assessor_feedback_table $asses
$ability = new ability(user::find($USER, false), $coursework);
$feedbackrows = $assessor_feedback_table->get_renderable_feedback_rows();
-
$allocatable = $assessor_feedback_table->get_allocatable();
$output_rows = '';
@@ -105,19 +124,17 @@ protected function render_assessor_feedback_table(assessor_feedback_table $asses
continue;
}*/
-
$output_rows .= '
@@ -189,7 +206,7 @@ private function get_router() {
/**
* @param assessor_feedback_row $feedback_row
- * @return array
+ * @return string
* @throws \coding_exception
*/
protected function edit_existing_feedback_link($feedback_row) {
@@ -238,7 +255,7 @@ private function show_feedback_link($feedback_row) {
$iconlink = $OUTPUT->action_link($link,
$linktitle,
null,
- array('class'=>'show_feedback','id' => $link_id));
+ array('class' => 'show_feedback', 'id' => $link_id));
return $iconlink;
}
@@ -264,7 +281,7 @@ protected function new_feedaback_link($feedback_row) {
$iconlink = $OUTPUT->action_link($link,
$linktitle,
null,
- array('class'=>'new_feedback'));
+ array('class' => 'new_feedback'));
return $iconlink;
}
@@ -330,8 +347,7 @@ protected function comment_for_row($feedback_row, $ability) {
}
}
- $grade_editing = get_config('mod_coursework','coursework_grade_editing');
-
+ $grade_editing = get_config('mod_coursework', 'coursework_grade_editing');
if ($ability->can('edit', $feedback_row->get_feedback()) && !$submission->already_published()) {
$html .= $this->edit_existing_feedback_link($feedback_row);
diff --git a/classes/render_helpers/grading_report/sub_rows/no_sub_rows.php b/classes/render_helpers/grading_report/sub_rows/no_sub_rows.php
index 09c0992a..bd94f12c 100644
--- a/classes/render_helpers/grading_report/sub_rows/no_sub_rows.php
+++ b/classes/render_helpers/grading_report/sub_rows/no_sub_rows.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\sub_rows;
@@ -15,4 +35,4 @@ class no_sub_rows implements sub_rows_interface {
public function get_row_with_assessor_feedback_table($row_object, $column_width) {
return '';
}
-}
\ No newline at end of file
+}
diff --git a/classes/render_helpers/grading_report/sub_rows/sub_rows_interface.php b/classes/render_helpers/grading_report/sub_rows/sub_rows_interface.php
index 0300d176..c324b303 100644
--- a/classes/render_helpers/grading_report/sub_rows/sub_rows_interface.php
+++ b/classes/render_helpers/grading_report/sub_rows/sub_rows_interface.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\render_helpers\grading_report\sub_rows;
@@ -16,4 +36,4 @@ interface sub_rows_interface {
*/
public function get_row_with_assessor_feedback_table($row_object, $column_width);
-}
\ No newline at end of file
+}
diff --git a/classes/renderers/deadline_extension_renderer.php b/classes/renderers/deadline_extension_renderer.php
index 9c726b5a..b516c31f 100644
--- a/classes/renderers/deadline_extension_renderer.php
+++ b/classes/renderers/deadline_extension_renderer.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\renderers;
@@ -31,7 +51,6 @@ public function show_page($vars) {
$PAGE->set_title($SITE->fullname);
$PAGE->set_heading($heading);
-
$html = '';
echo $OUTPUT->header();
@@ -84,4 +103,4 @@ public function edit_page($vars) {
echo $OUTPUT->footer();
}
-}
\ No newline at end of file
+}
diff --git a/classes/renderers/personal_deadline_renderer.php b/classes/renderers/personal_deadline_renderer.php
index fbb5a948..c0f81d59 100644
--- a/classes/renderers/personal_deadline_renderer.php
+++ b/classes/renderers/personal_deadline_renderer.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\renderers;
@@ -10,7 +30,6 @@
*/
class personal_deadline_renderer {
-
/**
* @param array $vars
* @throws \coding_exception
@@ -23,12 +42,12 @@ public function new_page($vars) {
$PAGE->set_title($SITE->fullname);
$PAGE->set_heading($SITE->fullname);
- $html = '';
+ $html = '';
- //if page has been accessed via the set personal deadline page then we dont want to say who set the last personal
+ // If page has been accessed via the set personal deadline page then we dont want to say who set the last personal
//deadline
if (empty($vars['params']['multipleuserdeadlines'])) {
- $allocatable = $vars['personal_deadline']->get_allocatable();
+ $allocatable = $vars['personal_deadline']->get_allocatable();
$createdby = $DB->get_record('user', array('id' => $vars['personal_deadline']->createdbyid));
$lasteditedby = $DB->get_record('user', array('id' => $vars['personal_deadline']->lastmodifiedbyid));
@@ -44,14 +63,13 @@ public function new_page($vars) {
$html .= '';
}
} else {
- $html = '
Edit personal deadline for ' . get_string('multipleusers','mod_coursework') . '
';
+ $html = '
Edit personal deadline for ' . get_string('multipleusers', 'mod_coursework') . '
';
}
-
echo $OUTPUT->header();
echo $html;
$vars['form']->display();
echo $OUTPUT->footer();
}
-}
\ No newline at end of file
+}
diff --git a/classes/router.php b/classes/router.php
index 17b740d1..8077e876 100644
--- a/classes/router.php
+++ b/classes/router.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework;
use coding_exception;
@@ -48,7 +68,7 @@ public static function instance() {
* @throws \coding_exception
* @return moodle_url|string url
*/
- public function get_path($path_name, $items = array(), $as_url_object = false, $escaped = true) {
+ public function get_path($path_name, $items = [], $as_url_object = false, $escaped = true) {
global $CFG;
@@ -184,8 +204,8 @@ public function get_path($path_name, $items = array(), $as_url_object = false, $
case 'new moderations':
$params = array('submissionid' => $items['submission']->id,
'stage_identifier' => $items['stage']->identifier(),
- 'feedbackid' =>$items['feedbackid']);
- $url = new moodle_url('/mod/coursework/actions/moderations/new.php',$params);
+ 'feedbackid' => $items['feedbackid']);
+ $url = new moodle_url('/mod/coursework/actions/moderations/new.php', $params);
break;
case 'create moderation agreement':
@@ -195,7 +215,7 @@ public function get_path($path_name, $items = array(), $as_url_object = false, $
case 'edit moderation':
$url = new moodle_url('/mod/coursework/actions/moderations/edit.php',
array('moderationid' => $items['moderation']->id,
- 'feedbackid' =>$items['moderation']->feedbackid));
+ 'feedbackid' => $items['moderation']->feedbackid));
break;
case 'update moderation':
@@ -205,13 +225,13 @@ public function get_path($path_name, $items = array(), $as_url_object = false, $
case 'show moderation':
$url = new moodle_url('/mod/coursework/actions/moderations/show.php',
array('moderationid' => $items['moderation']->id,
- 'feedbackid' =>$items['moderation']->feedbackid));
+ 'feedbackid' => $items['moderation']->feedbackid));
break;
case 'new plagiarism flag':
$url = new moodle_url('/mod/coursework/actions/plagiarism_flagging/new.php',
- array('submissionid' =>$items['submission']->id ));
+ array('submissionid' => $items['submission']->id ));
break;
@@ -243,7 +263,7 @@ public function get_path($path_name, $items = array(), $as_url_object = false, $
$auto_path = '/mod/coursework/actions/' . $this->pluralise($type) . '/' . $action . '.php';
if (file_exists($CFG->dirroot . $auto_path)) {
- $params = array();
+ $params = [];
if (array_key_exists($type, $items)) {
$params[$type.'id'] = $items[$type]->id;
} else if (array_key_exists('coursework', $items)) {
diff --git a/classes/sample_set_rule/range_sample_type.php b/classes/sample_set_rule/range_sample_type.php
index 26ed1f5b..303fc868 100644
--- a/classes/sample_set_rule/range_sample_type.php
+++ b/classes/sample_set_rule/range_sample_type.php
@@ -17,8 +17,7 @@
/**
* File for a sampling rule that will include X students from between an upper and lower limit.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2015 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -30,10 +29,8 @@
use mod_coursework\allocation\allocatable;
use mod_coursework\models\coursework;
-
defined('MOODLE_INTERNAL') || die();
-
/**
* Defines a rule that will include all students above or below a particular percentage of
* the total grade.
@@ -44,12 +41,11 @@ public function adjust_set(array &$moderation_set, array &$potential_allocatable
}
-
- public function get_numeric_boundaries() {
+ public function get_numeric_boundaries() {
}
- public function get_default_rule_order() {
+ public function get_default_rule_order() {
}
@@ -57,86 +53,78 @@ public function add_form_elements($assessor_number=0) {
global $DB;
- $html = '';
+ $html = '';
- $sql = "SELECT sr.*
+ $sql = "SELECT sr.*
FROM {coursework_sample_set_rules} sr,
{coursework_sample_set_plugin} sp
- WHERE sr.sample_set_plugin_id = sp.id
+ WHERE sr.sample_set_plugin_id = sp.id
AND sr.courseworkid = {$this->coursework->id}
AND sr.stage_identifier = 'assessor_{$assessor_number}'
AND sp.rulename = 'range_sample_type'";
- $rulesfound = false;
+ $rulesfound = false;
- $samplerecords = $DB->get_records_sql($sql);
+ $samplerecords = $DB->get_records_sql($sql);
- if (!empty($samplerecords)) {
- $seq = 0;
- foreach($samplerecords as $record) {
- $html .= $this->range_elements($assessor_number,$seq,$record);
+ if (!empty($samplerecords)) {
+ $seq = 0;
+ foreach ($samplerecords as $record) {
+ $html .= $this->range_elements($assessor_number, $seq, $record);
$seq++;
}
- } else {
- $html .= $this->range_elements($assessor_number,0,false);
+ } else {
+ $html .= $this->range_elements($assessor_number, 0, false);
}
-
-
- $html .= html_writer::link('#',get_string('addgraderule','mod_coursework'),array('id'=>"assessor_{$assessor_number}_addgradderule", 'class'=>'addgradderule sample_set_rule'));
- $html .= " ";
- $html .= html_writer::link('#',get_string('removegraderule','mod_coursework'),array('id'=>"assessor_{$assessor_number}_removegradderule", 'class'=>'removegradderule sample_set_rule'));
-
-
-
+ $html .= html_writer::link('#', get_string('addgraderule', 'mod_coursework'), array('id' => "assessor_{$assessor_number}_addgradderule", 'class' => 'addgradderule sample_set_rule'));
+ $html .= " ";
+ $html .= html_writer::link('#', get_string('removegraderule', 'mod_coursework'), array('id' => "assessor_{$assessor_number}_removegradderule", 'class' => 'removegradderule sample_set_rule'));
return $html;
}
- public function range_elements($assessor_number,$sequence,$dbrecord=false) {
+ public function range_elements($assessor_number, $sequence, $dbrecord=false) {
+ $percentage_options = [];
- $percentage_options = array();
-
- for($i = 0;$i < 110; $i = $i + 10) {
+ for ($i = 0;$i < 110; $i = $i + 10) {
$percentage_options[$i] = "{$i}";
}
- $scale = array();
+ $scale = [];
if ($this->coursework->grade > 0) {
- for($i=0;$i <= $this->coursework->grade; $i++) {
- $scale[] = $i;
+ for ($i = 0;$i <= $this->coursework->grade; $i++) {
+ $scale[] = $i;
}
} else {
- $grade_scale = \grade_scale::fetch(array('id' => abs($this->coursework->grade)));
- $scale = explode(",",$grade_scale->scale);
+ $grade_scale = \grade_scale::fetch(array('id' => abs($this->coursework->grade)));
+ $scale = explode(",", $grade_scale->scale);
}
- if ($dbrecord) {
- $selected_type = array($dbrecord->ruletype=>get_string($dbrecord->ruletype, 'mod_coursework'));
- $selected_to = ($dbrecord->ruletype == 'scale') ? array($dbrecord->upperlimit=>$scale[$dbrecord->upperlimit]) : array($dbrecord->upperlimit=>$dbrecord->upperlimit);
+ if ($dbrecord) {
+ $selected_type = array($dbrecord->ruletype => get_string($dbrecord->ruletype, 'mod_coursework'));
+ $selected_to = ($dbrecord->ruletype == 'scale') ? array($dbrecord->upperlimit => $scale[$dbrecord->upperlimit]) : array($dbrecord->upperlimit => $dbrecord->upperlimit);
- $selected_from = ($dbrecord->ruletype == 'scale') ? array($dbrecord->lowerlimit=>$scale[$dbrecord->lowerlimit]) : array($dbrecord->lowerlimit=>$dbrecord->lowerlimit);
+ $selected_from = ($dbrecord->ruletype == 'scale') ? array($dbrecord->lowerlimit => $scale[$dbrecord->lowerlimit]) : array($dbrecord->lowerlimit => $dbrecord->lowerlimit);
- $rules_checked = ($dbrecord) ? true : false;
+ $rules_checked = ($dbrecord) ? true : false;
} else {
- $selected_type = array('percentage'=>get_string('percentage', 'mod_coursework'));
- $selected_to = array('100'=>'100');
- $selected_from = array('0'=>'0');;
- $rules_checked = false;
+ $selected_type = array('percentage' => get_string('percentage', 'mod_coursework'));
+ $selected_to = array('100' => '100');
+ $selected_from = array('0' => '0');;
+ $rules_checked = false;
}
-
$html = html_writer::start_tag('div', array('class' => "assessor_{$assessor_number}_grade_rules", 'id' => "assessor_{$assessor_number}_grade_rules_{$sequence}"));
$html .= html_writer::checkbox("assessor_{$assessor_number}_samplerules[]", 1, $rules_checked, '',
array('id' => "assessor_{$assessor_number}_samplerules_{$sequence}", 'class' => "assessor_{$assessor_number} range_grade_checkbox sample_set_rule"));
-
- $grade_scale_text = ($this->coursework->grade < 0) ? get_string('scale', 'mod_coursework') : get_string('grade', 'mod_coursework') ;
- $grade_scale_val = ($this->coursework->grade < 0) ? 'scale' : 'grade';
+ $grade_scale_text = ($this->coursework->grade < 0) ? get_string('scale', 'mod_coursework') : get_string('grade', 'mod_coursework');
+ $grade_scale_val = ($this->coursework->grade < 0) ? 'scale' : 'grade';
$options = array('percentage' => get_string('percentage', 'mod_coursework'),
$grade_scale_val => $grade_scale_text);
@@ -149,7 +137,7 @@ public function range_elements($assessor_number,$sequence,$dbrecord=false) {
$html .= html_writer::label(get_string('from', 'mod_coursework'), 'assessortwo_samplefrom[0]');
- $rule_options = (!empty($selected_type) && array_key_exists('percentage',$selected_type)) ? $percentage_options : $scale; //change this into a ternary statement that
+ $rule_options = (!empty($selected_type) && array_key_exists('percentage', $selected_type)) ? $percentage_options : $scale; //change this into a ternary statement that
$html .= html_writer::select($rule_options,
"assessor_{$assessor_number}_samplefrom[]",
@@ -159,31 +147,28 @@ public function range_elements($assessor_number,$sequence,$dbrecord=false) {
$html .= html_writer::label(get_string('to', 'mod_coursework'), "assessor_{$assessor_number}_sampleto[0]");
- $html .= html_writer::select(array_reverse($rule_options,true),
+ $html .= html_writer::select(array_reverse($rule_options, true),
"assessor_{$assessor_number}_sampleto[]",
"",
$selected_to,
array('id' => "assessor_{$assessor_number}_sampleto_{$sequence}", 'class' => " sample_set_rule range_drop_down"));
-
$html .= html_writer::end_tag('div', '');
return $html;
}
-
-
public function add_form_elements_js($assessor_number=0) {
- $js_script = "
+ $js_script = "
- var AUTOMATIC_SAMPLING = 1;
+ var AUTOMATIC_SAMPLING = 1;
//add grade rule buttons
$('.addgradderule').each(function(e,element) {
- $(element).on('click',function (e) {
+ $(element).on('click',function (e) {
e.preventDefault();
var linkid = $(this).attr('id').split('_');
@@ -192,19 +177,19 @@ public function add_form_elements_js($assessor_number=0) {
var spanClone = $('div.'+linkid[0] + '_' + linkid[1] +'_grade_rules').first().clone(true);
- //find out how many rule spans exist
+ // Find out how many rule spans exist
var gradeSpans = $('div.'+linkid[0] + '_' + linkid[1] +'_grade_rules');
if (gradeSpans.length < 5) {
- //put a new line in
+ // Put a new line in
- //rename the select box ids
+ // Rename the select box ids
spanClone.find('select').each(function (n, ele) {
var elename = $(ele).attr('id').split('_');
$(ele).attr('id', elename[0] + '_' + elename[1] + '_' + elename[2] + '_' + gradeSpans.length);
});
- //rename the checkbox
+ // Rename the checkbox
spanClone.find('input').each(function (n, ele) {
var elename = $(ele).attr('id').split('_');
$(ele).attr('id', elename[0] + '_' + elename[1] + '_' + elename[2] + '_' + gradeSpans.length);
@@ -216,7 +201,7 @@ public function add_form_elements_js($assessor_number=0) {
//spanClone.appendTo($('#'+linkid[0] + '_' + linkid[1]+'_grade_rules_0').parent());
spanClone.insertAfter($('div.'+linkid[0] + '_' + linkid[1] +'_grade_rules').last());
- //make sure the from and to selects are set to the correct type
+ // Make sure the from and to selects are set to the correct type
change_options($('#'+linkid[0] + '_' + linkid[1] + '_sampletype_' + gradeSpans.length));
@@ -225,21 +210,19 @@ public function add_form_elements_js($assessor_number=0) {
});
})
-
- //remove grade rule buttons
+ // Remove grade rule buttons
$('.removegradderule').each(function(e,element) {
- $(element).on('click',function (e) {
+ $(element).on('click',function (e) {
e.preventDefault();
var linkid = $(this).attr('id').split('_');
-
- var spanclass = 'div.'+linkid[0] + '_' + linkid[1] +'_grade_rules';
+ var spanclass = 'div.'+linkid[0] + '_' + linkid[1] +'_grade_rules';
if ($('#'+linkid[0] + '_' + linkid[1] + '_samplingstrategy').val() == AUTOMATIC_SAMPLING) {
- //find out how many rule spans exist
+ // Find out how many rule spans exist
var gradeSpans = $(spanclass);
if (gradeSpans.length > 1) {
$(spanclass).last().remove();
@@ -250,30 +233,27 @@ public function add_form_elements_js($assessor_number=0) {
});
-
-
$('.range_grade_checkbox').each(function(e,element) {
- var ele_id = $(this).attr('id').split('_');
- var sampletypeid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampletype_'+ele_id[3];
- var samplefromid = '#'+ele_id[0]+'_'+ele_id[1]+'_samplefrom_'+ele_id[3];
- var sampletoid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampleto_'+ele_id[3];
+ var ele_id = $(this).attr('id').split('_');
+ var sampletypeid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampletype_'+ele_id[3];
+ var samplefromid = '#'+ele_id[0]+'_'+ele_id[1]+'_samplefrom_'+ele_id[3];
+ var sampletoid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampleto_'+ele_id[3];
- var disabled = !$(this).prop('checked');
+ var disabled = !$(this).prop('checked');
$(sampletypeid).attr('disabled',disabled);
$(samplefromid).attr('disabled',disabled);
$(sampletoid).attr('disabled',disabled);
+ $(element).on('change',function() {
- $(element).on('change',function() {
-
- var ele_id = $(this).attr('id').split('_');
- var sampletypeid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampletype_'+ele_id[3];
- var samplefromid = '#'+ele_id[0]+'_'+ele_id[1]+'_samplefrom_'+ele_id[3];
- var sampletoid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampleto_'+ele_id[3];
+ var ele_id = $(this).attr('id').split('_');
+ var sampletypeid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampletype_'+ele_id[3];
+ var samplefromid = '#'+ele_id[0]+'_'+ele_id[1]+'_samplefrom_'+ele_id[3];
+ var sampletoid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampleto_'+ele_id[3];
- var disabled = !$(this).prop('checked');
+ var disabled = !$(this).prop('checked');
$(sampletypeid).attr('disabled',disabled);
$(samplefromid).attr('disabled',disabled);
@@ -282,40 +262,38 @@ public function add_form_elements_js($assessor_number=0) {
})
});
- //grade rule drop downs
+ // Grade rule drop downs
$('.grade_type').each(function(e,element) {
- $(element).on('change',function() {
+ $(element).on('change',function() {
change_options(this);
})
});
-
function change_options(element) {
- var PERCENT = 'percentage';
+ var PERCENT = 'percentage';
- var ele_id = $(element).attr('id').split('_');
+ var ele_id = $(element).attr('id').split('_');
- var samplefromid = '#'+ele_id[0]+'_'+ele_id[1]+'_samplefrom_'+ele_id[3];
- var sampletoid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampleto_'+ele_id[3];
+ var samplefromid = '#'+ele_id[0]+'_'+ele_id[1]+'_samplefrom_'+ele_id[3];
+ var sampletoid = '#'+ele_id[0]+'_'+ele_id[1]+'_sampleto_'+ele_id[3];
-
- //remove the contents from the grade rule from and to drop downs
+ // Remove the contents from the grade rule from and to drop downs
$(samplefromid).find('option').remove();
$(sampletoid).find('option').remove();
- var selectValues = Array();
+ var selectValues = [];
var type = PERCENT;
- if ($(element).val() == PERCENT ) {
- for(var i = 0;i < 11; i++) {
+ if ($(element).val() == PERCENT ) {
+ for (var i = 0;i < 11; i++) {
selectValues[i] = (i*10);
}
} else {
- var selectValues = $('#scale_values').val().split(',');
+ var selectValues = $('#scale_values').val().split(',');
type = 1;
}
@@ -337,31 +315,27 @@ function change_options(element) {
});
-
$(sampletoid).append($(sampletoid).children().toArray().reverse());
- $(sampletoid).children().first().prop('selected',true);
- $(samplefromid).children().first().prop('selected',true);
+ $(sampletoid).children().first().prop('selected', true);
+ $(samplefromid).children().first().prop('selected', true);
}
-
-
";
- return html_writer::script($js_script,null);
+ return html_writer::script($js_script, null);
}
-
- public function save_form_data($assessor_number=0,&$order=0) {
+ public function save_form_data($assessor_number=0, &$order=0) {
global $DB;
- $sample_rules = optional_param_array("assessor_{$assessor_number}_samplerules",false,PARAM_RAW);
- $sample_type = optional_param_array("assessor_{$assessor_number}_sampletype",false,PARAM_RAW);
- $sample_from = optional_param_array("assessor_{$assessor_number}_samplefrom",false,PARAM_RAW);
- $sample_to = optional_param_array("assessor_{$assessor_number}_sampleto",false,PARAM_RAW);
+ $sample_rules = optional_param_array("assessor_{$assessor_number}_samplerules", false, PARAM_RAW);
+ $sample_type = optional_param_array("assessor_{$assessor_number}_sampletype", false, PARAM_RAW);
+ $sample_from = optional_param_array("assessor_{$assessor_number}_samplefrom", false, PARAM_RAW);
+ $sample_to = optional_param_array("assessor_{$assessor_number}_sampleto", false, PARAM_RAW);
- $sample_plugin = $DB->get_record('coursework_sample_set_plugin',array('rulename'=>'range_sample_type'));
+ $sample_plugin = $DB->get_record('coursework_sample_set_plugin', array('rulename' => 'range_sample_type'));
if ($sample_rules) {
foreach ($sample_rules as $i => $val) {
@@ -373,49 +347,45 @@ public function save_form_data($assessor_number=0,&$order=0) {
$dbrecord->upperlimit = $sample_to[$i];
$dbrecord->sample_set_plugin_id = $sample_plugin->id;
$dbrecord->courseworkid = $this->coursework->id;
- $dbrecord->ruleorder = $order;
- $dbrecord->stage_identifier = "assessor_{$assessor_number}";
+ $dbrecord->ruleorder = $order;
+ $dbrecord->stage_identifier = "assessor_{$assessor_number}";
$DB->insert_record("coursework_sample_set_rules", $dbrecord);
$order++;
}
}
-
-
}
-
- public function adjust_sample_set($stage_number,&$allocatables,&$manual_sample_set,&$auto_sample_set) {
+ public function adjust_sample_set($stage_number, &$allocatables, &$manual_sample_set, &$auto_sample_set) {
global $DB;
- $stage = "assessor_".$stage_number;
+ $stage = "assessor_".$stage_number;
-
- $sql = "SELECT r.*,p.rulename
+ $sql = "SELECT r.*,p.rulename
FROM {coursework_sample_set_plugin} p,
{coursework_sample_set_rules} r
- WHERE p.id = r.sample_set_plugin_id
+ WHERE p.id = r.sample_set_plugin_id
AND r.courseworkid = :courseworkid
AND p.rulename = 'range_sample_type'
AND stage_identifier = :stage
ORDER BY ruleorder";
- $ruleinstance = $DB->get_records_sql($sql,array('courseworkid'=>$this->coursework->id,'stage'=>$stage));
+ $ruleinstance = $DB->get_records_sql($sql, array('courseworkid' => $this->coursework->id, 'stage' => $stage));
- foreach($ruleinstance as $ri) {
+ foreach ($ruleinstance as $ri) {
- $limit = $this->rationalise($ri->ruletype,$ri->lowerlimit,$ri->upperlimit);
+ $limit = $this->rationalise($ri->ruletype, $ri->lowerlimit, $ri->upperlimit);
// all allocatables that are within specified range based on previous stage
- $previous_stage = $stage_number-1;
- $allocatables_in_range = $this->get_allocatables_in_range("assessor_".$previous_stage,$limit[0],$limit[1]);
+ $previous_stage = $stage_number-1;
+ $allocatables_in_range = $this->get_allocatables_in_range("assessor_".$previous_stage, $limit[0], $limit[1]);
$finalised = $this->finalised_submissions();
$published = $this->released_submissions();
- foreach($allocatables_in_range as $awf) {
+ foreach ($allocatables_in_range as $awf) {
if (!isset($published[$awf->allocatableid]) && !isset($finalised[$awf->allocatableid])
&& !isset($auto_sample_set[$awf->allocatableid]) && !isset($manual_sample_set[$awf->allocatableid])
&& isset($allocatables[$awf->allocatableid]))
@@ -425,15 +395,14 @@ public function adjust_sample_set($stage_number,&$allocatables,&$manual_sample_s
}
}
- private function rationalise($ruletype,$limit1,$limit2) {
+ private function rationalise($ruletype, $limit1, $limit2) {
global $DB;
- $limits = array();
-
+ $limits = [];
- $limits[0] = ($limit1>$limit2) ? $limit2 : $limit1;
- $limits[1] = ($limit1>$limit2) ? $limit1 : $limit2;
+ $limits[0] = ($limit1>$limit2) ? $limit2 : $limit1;
+ $limits[1] = ($limit1>$limit2) ? $limit1 : $limit2;
if ($ruletype == 'scale') {
++$limits[0];
@@ -444,37 +413,34 @@ private function rationalise($ruletype,$limit1,$limit2) {
if ($this->coursework->grade > 0) {
$limits[0] = $this->coursework->grade * $limits[0] / 100;
$limits[1] = $this->coursework->grade * $limits[1] / 100;
- } else {
- $scale = $DB->get_record("scale",array('id'=>abs($this->coursework->grade)));
+ } else {
+ $scale = $DB->get_record("scale", array('id' => abs($this->coursework->grade)));
- if ($scale) {
+ if ($scale) {
- $coursework_scale = explode(",",$scale->scale);
+ $coursework_scale = explode(",", $scale->scale);
- $number_of_items = count($coursework_scale);
+ $number_of_items = count($coursework_scale);
- $weighting = 100 / $number_of_items; // shall we round it????
+ $weighting = 100 / $number_of_items; // shall we round it????
+ $limits[0] = ceil($limits[0]/$weighting); // element of array
+ $limits[1] = ceil($limits[1]/$weighting); // element of array
- $limits[0] = ceil($limits[0]/$weighting); // element of array
- $limits[1] = ceil($limits[1]/$weighting); // element of array
-
- //note we have to add one as the values are not stored in there element positions
+ // Note we have to add one as the values are not stored in there element positions
}
}
}
-
-
return $limits;
}
- private function get_allocatables_in_range($stage,$limit1,$limit2) {
+ private function get_allocatables_in_range($stage, $limit1, $limit2) {
global $CFG, $DB;
- $gradesql = ($CFG->dbtype == 'pgsql') ? " CAST(grade AS integer) " : " grade ";
+ $gradesql = ($CFG->dbtype == 'pgsql') ? " CAST(grade AS integer) " : " grade ";
$sql = "SELECT *
FROM {coursework_submissions} cs,
@@ -484,13 +450,12 @@ private function get_allocatables_in_range($stage,$limit1,$limit2) {
AND stage_identifier = :stage
AND $gradesql BETWEEN {$limit1} AND {$limit2}";
- //note as things stand limit1 and limit2 can not be params as the type of the grade field (varchar)
+ // Note as things stand limit1 and limit2 can not be params as the type of the grade field (varchar)
//means the values are cast as strings
-
- return $DB->get_records_sql($sql, array('courseworkid'=>$this->coursework->id,
- 'stage'=>$stage));
+ return $DB->get_records_sql($sql, array('courseworkid' => $this->coursework->id,
+ 'stage' => $stage));
}
-}
\ No newline at end of file
+}
diff --git a/classes/sample_set_rule/sample_base.php b/classes/sample_set_rule/sample_base.php
index 93b949ee..e4a25d12 100644
--- a/classes/sample_set_rule/sample_base.php
+++ b/classes/sample_set_rule/sample_base.php
@@ -1,18 +1,23 @@
.
/**
* File for a sampling rule that will include X students from between an upper and lower limit.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2015 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -23,16 +28,13 @@
use mod_coursework\allocation\allocatable;
use mod_coursework\models\coursework;
-
defined('MOODLE_INTERNAL') || die();
-
/**
* This base class is extended to make specific sampling rules strategies
*/
abstract class sample_base {
-
/**
* @var string DB table this class relates to.
*/
@@ -48,7 +50,6 @@ abstract class sample_base {
*/
public $courseworkid;
-
protected $coursework;
/**
@@ -89,13 +90,10 @@ abstract class sample_base {
'minimum'
);
-
-
- function __construct($coursework) {
- $this->coursework = $coursework;
+ function __construct($coursework) {
+ $this->coursework = $coursework;
}
-
/**
* Returns the name of the class without the 'coursework_moderation_set_rule_' prefix.
*/
@@ -139,7 +137,6 @@ public static function allow_multiple() {
return true;
}
-
/**
* Each rule may have different form elements that we need to add in order for a new one to be
* @abstract
@@ -149,15 +146,15 @@ abstract public function add_form_elements($assessor_number);
abstract public function add_form_elements_js($assessor_number);
- abstract public function save_form_data($assessor_number=0,&$order=0);
+ abstract public function save_form_data($assessor_number=0, &$order=0);
- abstract public function adjust_sample_set($rule_id,&$manual_sample_set,&$allocatables,&$auto_sample_set);
+ abstract public function adjust_sample_set($rule_id, &$manual_sample_set, &$allocatables, &$auto_sample_set);
/**
*
* @return array
*/
- protected function finalised_submissions(){
+ protected function finalised_submissions() {
global $DB;
$sql = "SELECT allocatableid
@@ -167,15 +164,14 @@ protected function finalised_submissions(){
WHERE s.courseworkid = :courseworkid
AND f.stage_identifier = 'final_agreed_1'";
- return $DB->get_records_sql($sql, array('courseworkid'=>$this->coursework->id));
+ return $DB->get_records_sql($sql, array('courseworkid' => $this->coursework->id));
}
-
/**
*
* @return array
*/
- protected function released_submissions(){
+ protected function released_submissions() {
global $DB;
$sql = "SELECT allocatableid
@@ -183,8 +179,7 @@ protected function released_submissions(){
WHERE courseworkid = :courseworkid
AND firstpublished IS NOT NULL";
- return $DB->get_records_sql($sql, array('courseworkid'=>$this->coursework->id));
+ return $DB->get_records_sql($sql, array('courseworkid' => $this->coursework->id));
}
-
-}
\ No newline at end of file
+}
diff --git a/classes/sample_set_rule/total_sample_type.php b/classes/sample_set_rule/total_sample_type.php
index bf651507..f1993680 100644
--- a/classes/sample_set_rule/total_sample_type.php
+++ b/classes/sample_set_rule/total_sample_type.php
@@ -17,8 +17,7 @@
/**
* File for a sampling rule that will include X students from between an upper and lower limit.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2015 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -32,7 +31,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Defines a rule that will include all students above or below a particular percentage of
* the total grade.
@@ -43,12 +41,11 @@ public function adjust_set(array &$moderation_set, array &$potential_allocatable
}
-
- public function get_numeric_boundaries() {
+ public function get_numeric_boundaries() {
}
- public function get_default_rule_order() {
+ public function get_default_rule_order() {
}
@@ -56,63 +53,55 @@ public function add_form_elements($assessor_number=0) {
global $DB;
- $sql = "SELECT sr.*
+ $sql = "SELECT sr.*
FROM {coursework_sample_set_rules} sr,
{coursework_sample_set_plugin} sp
- WHERE sr.sample_set_plugin_id = sp.id
+ WHERE sr.sample_set_plugin_id = sp.id
AND sr.courseworkid = {$this->coursework->id}
AND sr.stage_identifier = 'assessor_{$assessor_number}'
AND sp.rulename = 'total_sample_type'";
- $selected = ($record = $DB->get_record_sql($sql)) ? array($record->upperlimit=>$record->upperlimit) : false;
- $checked = ($selected) ? true : false;
-
+ $selected = ($record = $DB->get_record_sql($sql)) ? array($record->upperlimit => $record->upperlimit) : false;
+ $checked = ($selected) ? true : false;
+ $percentage_options = [];
- $percentage_options = array();
-
- for($i = 5;$i <= 100; $i = $i + 5) {
+ for ($i = 5;$i <= 100; $i = $i + 5) {
$percentage_options[$i] = "{$i}";
}
- $html = html_writer::start_div('sampletotal');
-
- $html .= html_writer::checkbox("assessor_{$assessor_number}_sampletotal_checkbox",1,$checked,get_string('topupto','mod_coursework'),
- array('id'=>"assessor_{$assessor_number}_sampletotal_checkbox",'class'=>"assessor_{$assessor_number} total_checkbox sample_set_rule"));
-
+ $html = html_writer::start_div('sampletotal');
+ $html .= html_writer::checkbox("assessor_{$assessor_number}_sampletotal_checkbox", 1, $checked, get_string('topupto', 'mod_coursework'),
+ array('id' => "assessor_{$assessor_number}_sampletotal_checkbox", 'class' => "assessor_{$assessor_number} total_checkbox sample_set_rule"));
- $html .= html_writer::select($percentage_options,
+ $html .= html_writer::select($percentage_options,
"assessor_{$assessor_number}_sampletotal",
"",
$selected,
- array('id'=>"assessor_{$assessor_number}_sampletotal", 'class' => " sample_set_rule"));
- $html .= html_writer::label(get_string('ofallstudents', 'mod_coursework'),'assessortwo_sampletotal[]');
-
- $html .= html_writer::end_div();
-
+ array('id' => "assessor_{$assessor_number}_sampletotal", 'class' => " sample_set_rule"));
+ $html .= html_writer::label(get_string('ofallstudents', 'mod_coursework'), 'assessortwo_sampletotal[]');
+ $html .= html_writer::end_div();
return $html;
}
-
public function add_form_elements_js($assessor_number=0) {
- $js_script = "
+ $js_script = "
$('.total_checkbox').each(function(e,element) {
- var ele_id = $(this).attr('id').split('_');
- var sampletotal = '#'+ele_id[0]+'_'+ele_id[1]+'_sampletotal';
- var disabled = !$(this).prop('checked');
+ var ele_id = $(this).attr('id').split('_');
+ var sampletotal = '#'+ele_id[0]+'_'+ele_id[1]+'_sampletotal';
+ var disabled = !$(this).prop('checked');
$(sampletotal).attr('disabled',disabled);
-
- $(element).on('change',function() {
- var ele_id = $(this).attr('id').split('_');
- var sampletotal = '#'+ele_id[0]+'_'+ele_id[1]+'_sampletotal';
- var disabled = !$(this).prop('checked');
+ $(element).on('change',function() {
+ var ele_id = $(this).attr('id').split('_');
+ var sampletotal = '#'+ele_id[0]+'_'+ele_id[1]+'_sampletotal';
+ var disabled = !$(this).prop('checked');
$(sampletotal).attr('disabled',disabled);
})
@@ -120,84 +109,78 @@ public function add_form_elements_js($assessor_number=0) {
";
- return html_writer::script($js_script,null);
+ return html_writer::script($js_script, null);
}
- function save_form_data($assessor_number=0,&$order=0) {
+ function save_form_data($assessor_number=0, &$order=0) {
global $DB;
- $total_checkbox = optional_param("assessor_{$assessor_number}_sampletotal_checkbox",false,PARAM_INT);
- $sample_total = optional_param("assessor_{$assessor_number}_sampletotal",false,PARAM_INT);
+ $total_checkbox = optional_param("assessor_{$assessor_number}_sampletotal_checkbox", false, PARAM_INT);
+ $sample_total = optional_param("assessor_{$assessor_number}_sampletotal", false, PARAM_INT);
if ($total_checkbox) {
-
$dbrecord = new \stdClass();
$dbrecord->ruletype = "";
$dbrecord->lowerlimit = 0;
$dbrecord->upperlimit = $sample_total;
- $dbrecord->sample_set_plugin_id = 2; //TODO: THIS SHOULD NOT BE HARD CODED - AF
+ $dbrecord->sample_set_plugin_id = 2; // TODO: THIS SHOULD NOT BE HARD CODED - AF
$dbrecord->courseworkid = $this->coursework->id;
$dbrecord->ruleorder = $order;
$dbrecord->stage_identifier = "assessor_{$assessor_number}";
- $DB->insert_record('coursework_sample_set_rules',$dbrecord);
+ $DB->insert_record('coursework_sample_set_rules', $dbrecord);
}
-
}
-
static function compare_key($a, $b) {
if ($a === $b) return 0;
- return ($a > $b)? 1:-1;
+ return ($a > $b) ? 1 : -1;
}
- public function adjust_sample_set($stage_number,&$allocatables,&$manual_sample_set,&$auto_sample_set) {
+ public function adjust_sample_set($stage_number, &$allocatables, &$manual_sample_set, &$auto_sample_set) {
global $DB;
- $stage = "assessor_".$stage_number;
+ $stage = "assessor_".$stage_number;
- $sql = "SELECT r.*,p.rulename
+ $sql = "SELECT r.*,p.rulename
FROM {coursework_sample_set_plugin} p,
{coursework_sample_set_rules} r
- WHERE p.id = r.sample_set_plugin_id
+ WHERE p.id = r.sample_set_plugin_id
AND r.courseworkid = :courseworkid
AND p.rulename = 'total_sample_type'
AND stage_identifier = :stage
ORDER BY ruleorder";
- $rule = $DB->get_record_sql($sql,array('courseworkid'=>$this->coursework->id,'stage'=>$stage));
+ $rule = $DB->get_record_sql($sql, array('courseworkid' => $this->coursework->id, 'stage' => $stage));
- if ($rule) {
+ if ($rule) {
$finalised = $this->finalised_submissions();
$published = $this->released_submissions();
- $number_of_alloctables = count($allocatables);
+ $number_of_alloctables = count($allocatables);
- $total_to_return = ceil(($rule->upperlimit/100) * $number_of_alloctables);
+ $total_to_return = ceil(($rule->upperlimit / 100) * $number_of_alloctables);
- //we include the manual sample set in the count
+ // We include the manual sample set in the count
// TODO: should we do this?
- $total_to_return -= count($manual_sample_set);
+ $total_to_return -= count($manual_sample_set);
- //if the resultant number isnt greater than 0 then no automatic sample allocatables will be used
+ // If the resultant number isnt greater than 0 then no automatic sample allocatables will be used
if ($total_to_return > 0) {
//use array chunk to split auto sample set into chunks we will only use the first chunk
if ($chunked_array = array_chunk($auto_sample_set, $total_to_return, true)) $auto_sample_set = $chunked_array[0];
-
-
- //if the number in the sample set is less than the total to return
+ // If the number in the sample set is less than the total to return
if (count($auto_sample_set) < $total_to_return) {
- //we need to top up the sample set with other allocatables
+ // We need to top up the sample set with other allocatables
-
- //graded at the previous stage take precedence
+ // Graded at the previous stage take precedence
$previous_stage_number = $stage_number - 1;
@@ -216,25 +199,24 @@ public function adjust_sample_set($stage_number,&$allocatables,&$manual_sample_s
}
}
-
- //if this is not enough select anyone (which should == the ungraded as all graded should have been added)
+ // If this is not enough select anyone (which should == the ungraded as all graded should have been added)
if (count($auto_sample_set) < $total_to_return) {
- //remove allocatables with published submissions
- $allocatable_sample_set = array_diff_ukey($allocatables,$published,array("mod_coursework\\sample_set_rule\\total_sample_type", "compare_key"));
+ // Remove allocatables with published submissions
+ $allocatable_sample_set = array_diff_ukey($allocatables, $published, array("mod_coursework\\sample_set_rule\\total_sample_type", "compare_key"));
- //remove allocatables with finalised submissions
- $allocatable_sample_set = array_diff_ukey($allocatable_sample_set,$finalised,array("mod_coursework\\sample_set_rule\\total_sample_type", "compare_key"));
+ // Remove allocatables with finalised submissions
+ $allocatable_sample_set = array_diff_ukey($allocatable_sample_set, $finalised, array("mod_coursework\\sample_set_rule\\total_sample_type", "compare_key"));
- //remove allocatables who have been manually selected
- $allocatable_sample_set = array_diff_ukey($allocatable_sample_set,$manual_sample_set,array("mod_coursework\\sample_set_rule\\total_sample_type", "compare_key"));
+ // Remove allocatables who have been manually selected
+ $allocatable_sample_set = array_diff_ukey($allocatable_sample_set, $manual_sample_set, array("mod_coursework\\sample_set_rule\\total_sample_type", "compare_key"));
- //remove allocatables already in the sample set
- $allocatable_sample_set = array_diff_ukey($allocatable_sample_set,$auto_sample_set,array("mod_coursework\\sample_set_rule\\total_sample_type", "compare_key"));
+ // Remove allocatables already in the sample set
+ $allocatable_sample_set = array_diff_ukey($allocatable_sample_set, $auto_sample_set, array("mod_coursework\\sample_set_rule\\total_sample_type", "compare_key"));
$array_keys = array_rand($allocatable_sample_set, $total_to_return - count($auto_sample_set));
- if (!is_array($array_keys)) $array_keys = array($array_keys);
+ if (!is_array($array_keys)) $array_keys = array($array_keys);
//use the allocatables array to get other ungraded allocatables
foreach ($array_keys as $id) {
@@ -250,17 +232,11 @@ public function adjust_sample_set($stage_number,&$allocatables,&$manual_sample_s
}
} else {
- $auto_sample_set = array();
+ $auto_sample_set = [];
}
-
}
}
-
-
-
-
-
-}
\ No newline at end of file
+}
diff --git a/classes/sampling_set_widget.php b/classes/sampling_set_widget.php
index 62a4fcaf..f1d7bbc2 100644
--- a/classes/sampling_set_widget.php
+++ b/classes/sampling_set_widget.php
@@ -20,8 +20,7 @@
* Page that prints a table of all students and all markers so that first marker, second marker, moderators
* etc can be allocated manually or automatically.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -92,7 +91,7 @@ public function get_potential_rules() {
$classes = $this->get_potential_rule_class_names();
- $suffixes = array();
+ $suffixes = [];
foreach ($classes as $shortname => $classname) {
$label = get_string($shortname, 'mod_coursework');
@@ -115,10 +114,10 @@ public function get_potential_rule_class_names() {
$dirname = $CFG->dirroot.'/mod/coursework/classes/sample_set_rule/*.php';
$files = glob($dirname);
- $classes = array();
+ $classes = [];
foreach ($files as $file) {
- $matches = array(); // In case we have stuff left over.
+ $matches = []; // In case we have stuff left over.
preg_match('/([^\/]+)\.php/', $file, $matches);
/* @var models\moderation_set_rule $fullclassname */
$rulename = $matches[1];
diff --git a/classes/stages/assessor.php b/classes/stages/assessor.php
index 883ea082..3d3da04b 100644
--- a/classes/stages/assessor.php
+++ b/classes/stages/assessor.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\stages;
use mod_coursework\models\user;
@@ -88,4 +108,4 @@ public function uses_sampling() {
}
}
-}
\ No newline at end of file
+}
diff --git a/classes/stages/base.php b/classes/stages/base.php
index 971ff9de..d8498cdb 100644
--- a/classes/stages/base.php
+++ b/classes/stages/base.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\stages;
@@ -49,7 +69,6 @@ abstract class base {
'user_is_assessor' => []
];
-
/**
* @param coursework $coursework
* @param int $stage_identifier
@@ -59,7 +78,6 @@ public function __construct($coursework, $stage_identifier) {
$this->stage_identifier = $stage_identifier;
}
-
/**
* @return strategy_base
*/
@@ -78,7 +96,7 @@ public function make_auto_allocation_if_necessary($allocatable) {
return;
}
- if ($this->get_coursework()->assessorallocationstrategy == 'group_assessor' && $this->identifier() == 'assessor_1' ){
+ if ($this->get_coursework()->assessorallocationstrategy == 'group_assessor' && $this->identifier() == 'assessor_1' ) {
// get teacher form the group
$teacher = $this->get_assessor_from_moodle_course_group($allocatable);
//$teacher = user::find(12);
@@ -86,7 +104,6 @@ public function make_auto_allocation_if_necessary($allocatable) {
$teacher = $this->get_next_teacher($allocatable);
}
-
if ($teacher) {
$this->make_auto_allocation($allocatable, $teacher);
}
@@ -121,7 +138,7 @@ private function already_allocated($allocatable) {
*/
public function assessor_already_allocated_for_this_submission($allocatable, $assessor) {
- if(!empty($assessor)) {
+ if (!empty($assessor)) {
$coursework_id = $this->get_coursework_id();
allocation::fill_pool_coursework($coursework_id);
$record = allocation::get_object(
@@ -182,7 +199,6 @@ public function get_allocation_table_cell($allocatable) {
return $cell_helper->get_renderable_allocation_table_cell();
}
-
/**
* @param $allocatable
* @return \html_table_cell
@@ -218,7 +234,7 @@ protected function is_moderator() {
private function get_next_teacher($allocatable) {
// for percentage allocation use only those teachers that have percentage allocated
- if ($this->coursework->assessorallocationstrategy == 'percentages'){
+ if ($this->coursework->assessorallocationstrategy == 'percentages') {
$teachers = $this->get_percentage_allocated_teachers();
} else {
$teachers = $this->get_teachers();
@@ -231,10 +247,10 @@ private function get_next_teacher($allocatable) {
* Get ids of teachers who have percentage allocated to them
* @return array
*/
- private function get_percentage_allocated_teachers(){
+ private function get_percentage_allocated_teachers() {
global $DB;
- return $DB->get_records('coursework_allocation_config', array('courseworkid'=>$this->get_coursework_id()),'','assessorid as id');
+ return $DB->get_records('coursework_allocation_config', array('courseworkid' => $this->get_coursework_id()), '', 'assessorid as id');
}
/**
@@ -278,20 +294,20 @@ public function allocation_is_manual($allocatable) {
public function get_teachers() {
$cache = \cache::make('mod_coursework', 'courseworkdata');
- $serialised_teachers = $cache->get($this->coursework->id()."_teachers");
+ $serialised_teachers = $cache->get($this->coursework->id()."_teachers");
- //there is a chance that when the teachers were initially cached the dataset was empty
- //so check again
+ // There is a chance that when the teachers were initially cached the dataset was empty
+ // So check again
if (empty($serialised_teachers) || empty(unserialize($serialised_teachers))) {
$teachers = get_enrolled_users($this->coursework->get_context(), $this->assessor_capability());
- $teacher_users = array();
+ $teacher_users = [];
foreach ($teachers as $teacher) {
$teacher_users[] = user::build($teacher);
}
$cache->set($this->coursework->id()."_teachers", serialize($teacher_users));
} else {
- $teacher_users = unserialize($serialised_teachers);
+ $teacher_users = unserialize($serialised_teachers);
}
return $teacher_users;
@@ -332,7 +348,7 @@ public function has_moderation($submission) {
if ($feedback) {
$sql = "SELECT *
- FROM {coursework_mod_agreements}
+ FROM {coursework_mod_agreements}
WHERE feedbackid = ?";
return $DB->record_exists_sql($sql, array($feedback->id));
} else {
@@ -340,7 +356,6 @@ public function has_moderation($submission) {
}
}
-
/**
* @param $moderation
* @return bool|moderation
@@ -373,7 +388,7 @@ public function get_feedback_for_allocatable($allocatable) {
* @param $submission
* @return feedback|bool
*/
- public function get_single_feedback($submission){
+ public function get_single_feedback($submission) {
feedback::fill_pool_coursework($submission->courseworkid);
$result = feedback::get_object($submission->courseworkid, 'submissionid-stage_identifier', [$submission->id, 'assessor_1']);
@@ -396,13 +411,12 @@ public function has_allocation($allocatable) {
return in_array($allocatable->id, $this->allocatables_with_allocations);
}
-
/**
* Check if current marking stage has any allocation
*
* @return bool
*/
- public function stage_has_allocation(){
+ public function stage_has_allocation() {
$coursework_id = $this->get_coursework_id();
allocation::fill_pool_coursework($coursework_id);
$record = allocation::get_object($coursework_id, 'stage_identifier', [$this->stage_identifier]);
@@ -410,7 +424,6 @@ public function stage_has_allocation(){
return !empty($record);
}
-
/**
* @param $allocatable
* @throws \coding_exception
@@ -497,7 +510,7 @@ public function allocatable_is_in_sample($allocatable) {
return true;
}
- if ($this->stage_identifier == 'final_agreed_1'){
+ if ($this->stage_identifier == 'final_agreed_1') {
return true;
}
@@ -539,7 +552,7 @@ public function remove_allocatable_from_sampling($allocatable) {
'courseworkid' => $this->coursework->id,
'allocatableid' => $allocatable->id(),
'allocatabletype' => $allocatable->type(),
- 'stage_identifier'=> $this->stage_identifier
+ 'stage_identifier' => $this->stage_identifier
);
$DB->delete_records('coursework_sample_set_mbrs', $params);
}
@@ -551,7 +564,7 @@ public function remove_allocatable_from_sampling($allocatable) {
public function user_is_assessor($assessor) {
if (!isset(self::$self_cache['user_is_assessor'][$this->coursework->id][$assessor->id])) {
$enrolled = is_enrolled($this->coursework->get_course_context(), $assessor, $this->assessor_capability());
- $res = $enrolled || is_primary_admin($assessor->id);
+ $res = $enrolled || is_primary_admin($assessor->id);
self::$self_cache['user_is_assessor'][$this->coursework->id][$assessor->id] = $res;
}
return self::$self_cache['user_is_assessor'][$this->coursework->id][$assessor->id];
@@ -566,13 +579,12 @@ public function user_is_moderator($moderator) {
return $enrolled || is_primary_admin($moderator->id);
}
-
/**
* Check if a user has any allocation in this stage
* @param allocatable $allocatable
* @return bool
*/
- public function assessor_has_allocation($allocatable){
+ public function assessor_has_allocation($allocatable) {
global $USER;
allocation::fill_pool_coursework($this->coursework->id);
$allocation = allocation::get_object(
@@ -646,7 +658,7 @@ public function prerequisite_stages_have_feedback($allocatable) {
$submission = submission::get_object($coursework_id, 'allocatableid-allocatabletype', [$allocatable->id(), $allocatable->type()]);
if (count($submission->get_assessor_feedbacks()) >= $submission->max_number_of_feedbacks()
- && $submission->sampled_feedback_exists()){
+ && $submission->sampled_feedback_exists()) {
break;
}
}
@@ -710,7 +722,6 @@ public function get_moderation_for_feedback($feedback) {
return moderation::find($moderation_params);
}
-
/**
* return bool
*/
@@ -748,7 +759,6 @@ public function is_initial_assesor_stage() {
*/
public function potential_marker_dropdown($allocatable) {
-
// This gets called a lot on the allocations page, but does not change.
if (!isset($this->assessor_dropdown_options)) {
@@ -780,11 +790,9 @@ public function potential_marker_dropdown($allocatable) {
$option_for_nothing_chosen_yet = array('' => get_string($identifier, 'mod_coursework'));
+ $dropdown_name = $this->assessor_dropdown_name($allocatable);
- $dropdown_name = $this->assessor_dropdown_name($allocatable);
-
- $selected = $this->selected_allocation_in_session($dropdown_name);
-
+ $selected = $this->selected_allocation_in_session($dropdown_name);
$assessor_dropdown = \html_writer::select($this->assessor_dropdown_options,
$dropdown_name,
@@ -793,7 +801,6 @@ public function potential_marker_dropdown($allocatable) {
$html_attributes
);
-
return $assessor_dropdown;
}
@@ -803,15 +810,15 @@ public function potential_marker_dropdown($allocatable) {
*/
public function potential_moderator_dropdown($allocatable) {
- $option_for_nothing_chosen_yet = array('' =>'Choose Moderator');
+ $option_for_nothing_chosen_yet = array('' => 'Choose Moderator');
$html_attributes = array(
'id' => $this->moderator_dropdown_id($allocatable),
'class' => 'moderator_id_dropdown',
);
- $dropdown_name = $this->assessor_dropdown_name($allocatable);
+ $dropdown_name = $this->assessor_dropdown_name($allocatable);
- $selected = $this->selected_allocation_in_session($dropdown_name);
+ $selected = $this->selected_allocation_in_session($dropdown_name);
return $moderator_dropdown = \html_writer::select($this->potential_moderators_as_options_array(),
'allocatables[' . $allocatable->id . '][moderator][assessor_id]',
@@ -825,7 +832,7 @@ public function potential_moderator_dropdown($allocatable) {
*/
private function potential_markers_as_options_array() {
$potentialmarkers = $this->get_teachers();
- $options = array();
+ $options = [];
foreach ($potentialmarkers as $marker) {
$options[$marker->id] = $marker->name();
}
@@ -838,7 +845,7 @@ private function potential_markers_as_options_array() {
*/
private function potential_moderators_as_options_array() {
$potentialmoderators = get_enrolled_users($this->coursework->get_course_context(), 'mod/coursework:moderate');
- $options = array();
+ $options = [];
foreach ($potentialmoderators as $moderator) {
$options[$moderator->id] = fullname($moderator);
}
@@ -893,7 +900,6 @@ private function currently_allocated_assessor($allocatable) {
return false;
}
-
/**
* @param $allocatable
*/
@@ -901,56 +907,52 @@ private function in_editable_period($allocatable) {
$result = $this->get_coursework()->get_grade_editing_time();
- //the feedback is not in the editable period if the editable setting is disabled
+ // The feedback is not in the editable period if the editable setting is disabled
if (empty($this->get_coursework()->get_grade_editing_time())) return false;
$coursework_id = $this->get_coursework_id();
submission::fill_pool_coursework($coursework_id);
$submission = submission::get_object($coursework_id, 'allocatableid-allocatabletype', [$allocatable->id(), $allocatable->type()]);
- $feedback = $this->get_feedback_for_submission($submission);
+ $feedback = $this->get_feedback_for_submission($submission);
if ($feedback) {
$result += $feedback->timecreated;
}
-
return $result > time();
}
-
- private function selected_allocation_in_session($dropdownname) {
+ private function selected_allocation_in_session($dropdownname) {
global $SESSION;
- $cm = $this->coursework->get_course_module();
+ $cm = $this->coursework->get_course_module();
- if (!empty($SESSION->coursework_allocationsessions[$cm->id])) {
+ if (!empty($SESSION->coursework_allocationsessions[$cm->id])) {
- if (!empty($SESSION->coursework_allocationsessions[$cm->id][$dropdownname])) {
+ if (!empty($SESSION->coursework_allocationsessions[$cm->id][$dropdownname])) {
return $SESSION->coursework_allocationsessions[$cm->id][$dropdownname];
}
-
-
}
return '';
}
- public function get_assessor_from_moodle_course_group($allocatable){
+ public function get_assessor_from_moodle_course_group($allocatable) {
$assessor = '';
// get allocatables group
- if ($this->coursework->is_configured_to_have_group_submissions()){
+ if ($this->coursework->is_configured_to_have_group_submissions()) {
$groupid = $allocatable->id;
} else {
$user = user::get_object($allocatable->id);
$group = $this->coursework->get_student_group($user);
- $groupid = ($group)? $group->id: 0;
+ $groupid = ($group) ? $group->id : 0;
}
- if($groupid) {
+ if ($groupid) {
// find 1st assessor in the group
$first_group_assessor = get_enrolled_users($this->coursework->get_context(), $this->assessor_capability(),
$groupid, 'u.*', 'id ASC', 0, 1);
@@ -965,4 +967,4 @@ public function get_assessor_from_moodle_course_group($allocatable){
return $assessor;
}
-}
\ No newline at end of file
+}
diff --git a/classes/stages/final_agreed.php b/classes/stages/final_agreed.php
index 7f09e88d..fc562c98 100644
--- a/classes/stages/final_agreed.php
+++ b/classes/stages/final_agreed.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\stages;
use mod_coursework\models\user;
@@ -42,4 +62,4 @@ public function allocation_table_header() {
protected function assessor_capability() {
return 'mod/coursework:addagreedgrade';
}
-}
\ No newline at end of file
+}
diff --git a/classes/stages/moderator.php b/classes/stages/moderator.php
index c6eb4eca..fcfc559a 100644
--- a/classes/stages/moderator.php
+++ b/classes/stages/moderator.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\stages;
use mod_coursework\models\user;
@@ -32,4 +52,4 @@ protected function strategy_name() {
return 'none';
}
-}
\ No newline at end of file
+}
diff --git a/classes/submission_files.php b/classes/submission_files.php
index fb4edc70..dbe6b6fa 100644
--- a/classes/submission_files.php
+++ b/classes/submission_files.php
@@ -19,8 +19,7 @@
/**
* Displays the information a student sees when they submit or have submitted work
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -31,7 +30,6 @@
defined('MOODLE_INTERNAL') || die();
-
/**
* Represents the files a student has submitted.
*/
diff --git a/classes/task/enrol_task.php b/classes/task/enrol_task.php
index d3eb7869..0de5827b 100644
--- a/classes/task/enrol_task.php
+++ b/classes/task/enrol_task.php
@@ -17,7 +17,6 @@
namespace mod_coursework;
namespace mod_coursework\task;
-
/**
* A scheduled task for the coursework module cron.
*
@@ -44,9 +43,9 @@ public function execute() {
global $DB;
- $courseworkids = $DB->get_records('coursework',array('processenrol'=>1));
+ $courseworkids = $DB->get_records('coursework', array('processenrol' => 1));
- if (!empty($courseworkids)) {
+ if (!empty($courseworkids)) {
foreach ($courseworkids as $courseworkid) {
$coursework = \mod_coursework\models\coursework::find($courseworkid);
if (empty($coursework)) {
@@ -58,10 +57,10 @@ public function execute() {
$allocator = new \mod_coursework\allocation\auto_allocator($coursework);
$allocator->process_allocations();
- $DB->set_field('coursework','processenrol',0,array('id'=>$coursework->id()));
+ $DB->set_field('coursework', 'processenrol', 0, array('id' => $coursework->id()));
}
}
return true;
}
-}
\ No newline at end of file
+}
diff --git a/classes/task/unenrol_task.php b/classes/task/unenrol_task.php
index 8b39a264..acdc1d96 100644
--- a/classes/task/unenrol_task.php
+++ b/classes/task/unenrol_task.php
@@ -17,7 +17,6 @@
namespace mod_coursework\models;
namespace mod_coursework\task;
-
/**
* A scheduled task for the coursework module cron.
*
@@ -44,9 +43,9 @@ public function execute() {
global $DB;
- $courseworkids = $DB->get_records('coursework',array('processunenrol'=>1));
+ $courseworkids = $DB->get_records('coursework', array('processunenrol' => 1));
- if (!empty($courseworkids)) {
+ if (!empty($courseworkids)) {
foreach ($courseworkids as $courseworkid) {
$coursework = \mod_coursework\models\coursework::find($courseworkid);
if (empty($coursework)) {
@@ -56,10 +55,10 @@ public function execute() {
$allocator = new \mod_coursework\allocation\auto_allocator($coursework);
$allocator->process_allocations();
- $DB->set_field('coursework','processunenrol',0,array('id'=>$coursework->id()));
+ $DB->set_field('coursework', 'processunenrol', 0, array('id' => $coursework->id()));
}
}
return true;
}
-}
\ No newline at end of file
+}
diff --git a/classes/test_helpers/factory_mixin.php b/classes/test_helpers/factory_mixin.php
index 37a1edec..f69588c6 100644
--- a/classes/test_helpers/factory_mixin.php
+++ b/classes/test_helpers/factory_mixin.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\test_helpers;
@@ -246,7 +266,7 @@ public function create_an_assessor_feedback_for_the_submisison($assessor) {
$feedback = new stdClass();
$feedback->submissionid = $this->get_submission()->id;
$feedback->assessorid = $assessor->id;
- $feedback->stage_identifier = 'assessor_'.($count+1);
+ $feedback->stage_identifier = 'assessor_'.($count + 1);
$feedback->grade = 45;
return $generator->create_feedback($feedback);
}
@@ -384,4 +404,4 @@ protected function get_submission() {
}
return $this->submission;
}
-}
\ No newline at end of file
+}
diff --git a/classes/traits/allocatable_functions.php b/classes/traits/allocatable_functions.php
index f4ef42a3..ccbf9a43 100644
--- a/classes/traits/allocatable_functions.php
+++ b/classes/traits/allocatable_functions.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework\traits;
use mod_coursework\models\assessment_set_membership;
@@ -63,7 +83,6 @@ public function has_agreed_feedback($coursework) {
return !empty($result);
}
-
/**
* @param coursework $coursework
* @return bool
@@ -82,7 +101,6 @@ public function get_agreed_feedback($coursework) {
return $DB->get_record_sql($sql, array('id' => $this->id(), 'courseworkid' => $coursework->id()));
}
-
/**
* @param coursework $coursework
* @return bool
@@ -159,4 +177,4 @@ private function fill_submission_and_feedback($coursework) {
submission::fill_pool_coursework($coursework_id);
feedback::fill_pool_coursework($coursework_id);
}
-}
\ No newline at end of file
+}
diff --git a/classes/user_row.php b/classes/user_row.php
index d3304862..00271b22 100644
--- a/classes/user_row.php
+++ b/classes/user_row.php
@@ -19,8 +19,7 @@
/**
* Class file for the renderable object that makes a single row int he marker allocation table.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/classes/utils/cs_editor.php b/classes/utils/cs_editor.php
index 0e7590f6..fdd2ae41 100644
--- a/classes/utils/cs_editor.php
+++ b/classes/utils/cs_editor.php
@@ -14,6 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
namespace mod_coursework\utils;
/**
diff --git a/classes/warnings.php b/classes/warnings.php
index 590c9acd..21576ab3 100644
--- a/classes/warnings.php
+++ b/classes/warnings.php
@@ -1,4 +1,24 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
namespace mod_coursework;
use mod_coursework\models\coursework;
@@ -109,7 +129,7 @@ public function students_in_mutiple_grouos() {
if (!has_capability('mod/coursework:addinitialgrade', $this->coursework->get_context(), $student->userid)) {
$studentmessage .= '
' . $student->firstname . ' ' . $student->lastname;
- //get group ids of these students
+ // Get group ids of these students
if ($this->coursework->grouping_id) {
$sql = "SELECT groups.id,groups.name
@@ -151,8 +171,8 @@ public function students_in_mutiple_grouos() {
}
}
- if(!empty($studentmessage)) {
- $message = '
';
+ if (!empty($studentmessage)) {
+ $message = '
';
$message .= $studentmessage;
@@ -195,13 +215,13 @@ public function percentage_allocations_not_complete() {
* @return string
* @throws \coding_exception
*/
- public function manual_allocation_not_completed(){
+ public function manual_allocation_not_completed() {
global $DB;
$coursework = $this->coursework;
$coursework_stages = $coursework->numberofmarkers;
- for ($i = 1; $i <= $coursework_stages; $i++){
+ for ($i = 1; $i <= $coursework_stages; $i++) {
$assessor = 'assessor_'.$i;
if ($coursework->samplingenabled == 0 || $assessor == 'assessor_1') {
@@ -219,7 +239,7 @@ public function manual_allocation_not_completed(){
return $this->alert_div(get_string('assessors_no_allocated_warning', 'mod_coursework'));
}
}
- }else{
+ } else {
$params = array('courseworkid' => $coursework->id);
$sql = "SELECT id, stage_identifier, allocatableid
@@ -247,7 +267,7 @@ public function manual_allocation_not_completed(){
* @param $params
* @return array
*/
- public function check_existing_allocations($params){
+ public function check_existing_allocations($params) {
global $DB;
$sql = "SELECT 1
FROM {coursework_allocation_pairs}
@@ -407,4 +427,4 @@ public function a_to_z_filter_on() {
public function filters_warning() {
return $this->alert_div(get_string('filteronwarning', 'mod_coursework'));
}
-}
\ No newline at end of file
+}
diff --git a/db/access.php b/db/access.php
index 19876a38..07e8c4b2 100644
--- a/db/access.php
+++ b/db/access.php
@@ -15,13 +15,11 @@
// along with Moodle. If not, see .
/**
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
/**
* Capability definitions for the coursework module
*
diff --git a/db/caches.php b/db/caches.php
index 16c2cd91..b097c831 100644
--- a/db/caches.php
+++ b/db/caches.php
@@ -1,7 +1,27 @@
.
+
+/**
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
$definitions = array(
'courseworkdata' => array(
'mode' => cache_store::MODE_APPLICATION
)
-);
\ No newline at end of file
+);
diff --git a/db/events.php b/db/events.php
index 9eb9ae19..31627dd3 100644
--- a/db/events.php
+++ b/db/events.php
@@ -17,36 +17,33 @@
/**
* Event handlers. Mostly for dealing with auto allocation of markers.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-
$observers = array(
array(
- 'eventname' => '\core\event\role_assigned',
- 'callback' => 'mod_coursework_observer::autoallocate_when_user_added',
+ 'eventname' => '\core\event\role_assigned',
+ 'callback' => 'mod_coursework_observer::autoallocate_when_user_added',
),
array(
- 'eventname' => '\core\event\role_unassigned',
- 'callback' => 'mod_coursework_observer::autoallocate_when_user_removed',
+ 'eventname' => '\core\event\role_unassigned',
+ 'callback' => 'mod_coursework_observer::autoallocate_when_user_removed',
),
array(
- 'eventname' => '\mod_coursework\event\coursework_deadline_changed',
- 'callback' => 'mod_coursework_observer::coursework_deadline_changed',
+ 'eventname' => '\mod_coursework\event\coursework_deadline_changed',
+ 'callback' => 'mod_coursework_observer::coursework_deadline_changed',
'schedule' => 'cron'
),
array(
- 'eventname' => '\core\event\course_module_updated',
- 'callback' => 'mod_coursework_observer::process_allocation_after_update',
+ 'eventname' => '\core\event\course_module_updated',
+ 'callback' => 'mod_coursework_observer::process_allocation_after_update',
),
array(
- 'eventname' => '\core\event\course_module_created',
- 'callback' => 'mod_coursework_observer::process_allocation_after_creation',
+ 'eventname' => '\core\event\course_module_created',
+ 'callback' => 'mod_coursework_observer::process_allocation_after_creation',
),
array(
'eventname' => '\core\event\group_member_added',
@@ -66,4 +63,3 @@
),
);
-
diff --git a/db/install.php b/db/install.php
index 338da5ff..3f8a2049 100644
--- a/db/install.php
+++ b/db/install.php
@@ -1,9 +1,23 @@
.
+
/**
- * Created by PhpStorm.
- * User: Nigel.Daley
- * Date: 08/10/2015
- * Time: 17:19
+ * @package mod_coursework
+ * @copyright 2017 University of London Computer Centre {@link ulcc.ac.uk}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
@@ -11,20 +25,19 @@
function xmldb_coursework_install() {
global $DB;
+ // Install the plugins used by sampling in the correct order
+ $plugins = array('range_sample_type', 'total_sample_type');
- //install the plugins used by sampling in the correct order
- $plugins = array('range_sample_type','total_sample_type');
-
- $i = 1;
+ $i = 1;
- foreach($plugins as $p) {
+ foreach ($plugins as $p) {
$dbrecord = new \stdClass();
$dbrecord->rulename = $p;
$dbrecord->pluginorder = $i;
- $DB->insert_record('coursework_sample_set_plugin',$dbrecord);
+ $DB->insert_record('coursework_sample_set_plugin', $dbrecord);
$i++;
}
-}
\ No newline at end of file
+}
diff --git a/db/log.php b/db/log.php
index ae01ba39..cd5cd1a1 100644
--- a/db/log.php
+++ b/db/log.php
@@ -15,8 +15,7 @@
// along with Moodle. If not, see .
/**
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -37,8 +36,8 @@
global $DB;
$logs = array(
- array('module'=>'coursework', 'action'=>'add', 'mtable'=>'coursework', 'field'=>'name'),
- array('module'=>'coursework', 'action'=>'update', 'mtable'=>'coursework', 'field'=>'name'),
- array('module'=>'coursework', 'action'=>'view', 'mtable'=>'coursework', 'field'=>'name'),
- array('module'=>'coursework', 'action'=>'view all', 'mtable'=>'coursework', 'field'=>'name')
+ array('module' => 'coursework', 'action' => 'add', 'mtable' => 'coursework', 'field' => 'name'),
+ array('module' => 'coursework', 'action' => 'update', 'mtable' => 'coursework', 'field' => 'name'),
+ array('module' => 'coursework', 'action' => 'view', 'mtable' => 'coursework', 'field' => 'name'),
+ array('module' => 'coursework', 'action' => 'view all', 'mtable' => 'coursework', 'field' => 'name')
);
diff --git a/db/messages.php b/db/messages.php
index 894c8d6d..bc5d351a 100644
--- a/db/messages.php
+++ b/db/messages.php
@@ -15,8 +15,7 @@
// along with Moodle. If not, see .
/**
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2012 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -48,4 +47,4 @@
),
'student_deadline_reminder' => array(
),
-);
\ No newline at end of file
+);
diff --git a/db/upgrade.php b/db/upgrade.php
index d1d77bb3..de358995 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -24,8 +24,7 @@
* it cannot do itself, it will tell you what you need to do. The commands in
* here will all be database-neutral, using the functions defined in DLL libraries.
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -104,7 +103,7 @@ function xmldb_coursework_upgrade($oldversion) {
// Alter the comments and write them to the DB.
foreach ($olddata as $datarow) {
$oldcomment = unserialize($datarow->feedbackcomment);
- $newcomment = array();
+ $newcomment = [];
if ($oldcomment) { // Some were blank - probably an earlier experiment.
foreach ($oldcomment as $componentarray) {
$newcomment[] = $componentarray['id'];
@@ -127,7 +126,7 @@ function xmldb_coursework_upgrade($oldversion) {
// Will have to subtract component values from the string one at a time, recording their
// ids if we find the value.
foreach ($olddata as $datarow) {
- $newcomment = array();
+ $newcomment = [];
$oldcomment = $datarow->feedbackcomment; // Comma separated, with lots of extra commas.
$components = $DB->get_records('coursework_form_component',
array('fieldid' => $datarow->fieldid));
@@ -1057,7 +1056,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2013011400, 'coursework');
}
-
if ($oldversion < 2014031800) {
// Define field mitigationenabled to be added to coursework.
@@ -1181,13 +1179,12 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014071400, 'coursework');
}
-
if ($oldversion < 2014071404) {
// Add stage identifier to all allocations.
$courseworks = $DB->get_records('coursework', null, '', 'id');
- foreach($courseworks as $coursework) {
+ foreach ($courseworks as $coursework) {
$coursework = \mod_coursework\models\coursework::find($coursework->id);
$students_with_assessor_allocations = $DB->get_records_sql('
SELECT DISTINCT studentid
@@ -1243,7 +1240,6 @@ function xmldb_coursework_upgrade($oldversion) {
$dbman->drop_table($table);
}
-
// Coursework savepoint reached.
upgrade_mod_savepoint(true, 2014071500, 'coursework');
}
@@ -1310,7 +1306,6 @@ function xmldb_coursework_upgrade($oldversion) {
AND isfinalgrade = 1
");
-
upgrade_mod_savepoint(true, 2014071502, 'coursework');
}
@@ -1605,7 +1600,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014072500, 'coursework');
}
-
if ($oldversion < 2014072502) {
// Define field showallfeedbacks to be added to coursework.
@@ -1628,7 +1622,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014072502, 'coursework');
}
-
if ($oldversion < 2014082600) {
// Define table coursework_mitigation_codes to be dropped.
@@ -1658,8 +1651,6 @@ function xmldb_coursework_upgrade($oldversion) {
$DB->execute("UPDATE {coursework} SET moderationenabled = 0");
}
-
-
if ($oldversion < 2014090801) {
// Define field timesubmitted to be added to coursework_submissions.
@@ -1690,7 +1681,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014091000, 'coursework');
}
-
if ($oldversion < 2014111700) {
// Define field samplingenabled to be added to coursework.
@@ -1856,7 +1846,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014121203, 'coursework');
}
-
if ($oldversion < 2014122200) {
// Define field extensionsenabled to be added to coursework.
@@ -1962,7 +1951,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2015082402, 'coursework');
}
-
if ($oldversion < 2015082409) {
// Define table coursework_sample_set_rules to be created.
$table = new xmldb_table('coursework_sample_set_rules');
@@ -1982,13 +1970,11 @@ function xmldb_coursework_upgrade($oldversion) {
// Adding keys to table coursework_moderation_set_ru.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
// Conditionally launch create table for coursework_moderation_set_ru.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
-
$table = new xmldb_table('coursework_sample_set_plugin');
// Adding fields to table coursework_sample_set_rules.
@@ -2000,22 +1986,20 @@ function xmldb_coursework_upgrade($oldversion) {
// Adding keys to table coursework_moderation_set_ru.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
+ // Now create plugin records for sample set plugins
+ $plugins = array('range_sample_type', 'total_sample_type');
- //now create plugin records for sample set plugins
- $plugins = array('range_sample_type','total_sample_type');
-
- $i = 1;
+ $i = 1;
- foreach($plugins as $p) {
+ foreach ($plugins as $p) {
$dbrecord = new \stdClass();
$dbrecord->rulename = $p;
$dbrecord->pluginorder = $i;
- $DB->insert_record('coursework_sample_set_plugin',$dbrecord);
+ $DB->insert_record('coursework_sample_set_plugin', $dbrecord);
$i++;
}
@@ -2026,7 +2010,6 @@ function xmldb_coursework_upgrade($oldversion) {
}
-
if ($oldversion < 2015082410) {
// Define table coursework_sample_set_mbrs to be created.
@@ -2053,16 +2036,14 @@ function xmldb_coursework_upgrade($oldversion) {
}
-
- $allocatabletables=array('coursework_submissions',
+ $allocatabletables = array('coursework_submissions',
'coursework_allocation_pairs',
'coursework_mod_set_members',
'coursework_extensions',
'coursework_sample_set_mbrs');
-
- if($oldversion < 2015110303) {
- $fields = array();
+ if ($oldversion < 2015110303) {
+ $fields = [];
//Add fields to assist backup annotation
$fielduser = new xmldb_field('allocatableuser', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', 'allocatabletype');
$fieldgroup = new xmldb_field('allocatablegroup', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', 'allocatableuser');
@@ -2084,10 +2065,8 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2015110303, 'coursework');
}
-
-
- if($oldversion < 2015121401) {
- $fields = array();
+ if ($oldversion < 2015121401) {
+ $fields = [];
//Add fields to assist backup annotation
$fieldeditingtime = new xmldb_field('gradeeditingtime', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', null);
@@ -2095,7 +2074,6 @@ function xmldb_coursework_upgrade($oldversion) {
$table = new xmldb_table('coursework');
-
if (!$dbman->field_exists($table, $fieldeditingtime)) {
$dbman->add_field($table, $fieldeditingtime);
}
@@ -2103,14 +2081,13 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2015121401, 'coursework');
}
- if($oldversion < 2015121402) {
+ if ($oldversion < 2015121402) {
$fieldeditingtime = new xmldb_field('authorid', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', null);
$fieldeditingtime->setNotNull(true);
$table = new xmldb_table('coursework_submissions');
-
if (!$dbman->field_exists($table, $fieldeditingtime)) {
$dbman->add_field($table, $fieldeditingtime);
}
@@ -2118,8 +2095,8 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2015121402, 'coursework');
}
- if($oldversion < 2016110100) {
- $fields = array();
+ if ($oldversion < 2016110100) {
+ $fields = [];
//Add fields to hold marking deadline enabled
$upgradefield = new xmldb_field('markingdeadlineenabled', XMLDB_TYPE_INTEGER, '1', true, XMLDB_NOTNULL, null, '0', null);
@@ -2127,7 +2104,6 @@ function xmldb_coursework_upgrade($oldversion) {
$table = new xmldb_table('coursework');
-
if (!$dbman->field_exists($table, $upgradefield)) {
$dbman->add_field($table, $upgradefield);
}
@@ -2135,8 +2111,8 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2016110100, 'coursework');
}
- if($oldversion < 2016110101) {
- $fields = array();
+ if ($oldversion < 2016110101) {
+ $fields = [];
//Add fields to hold intial marking deadline
$upgradefield = new xmldb_field('initialmarkingdeadline', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', null);
@@ -2144,7 +2120,6 @@ function xmldb_coursework_upgrade($oldversion) {
$table = new xmldb_table('coursework');
-
if (!$dbman->field_exists($table, $upgradefield)) {
$dbman->add_field($table, $upgradefield);
}
@@ -2156,7 +2131,6 @@ function xmldb_coursework_upgrade($oldversion) {
$table = new xmldb_table('coursework');
-
if (!$dbman->field_exists($table, $upgradefield)) {
$dbman->add_field($table, $upgradefield);
}
@@ -2164,8 +2138,8 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2016110101, 'coursework');
}
- if($oldversion < 2016110102) {
- $fields = array();
+ if ($oldversion < 2016110102) {
+ $fields = [];
//Add fields to hold intial marking deadline
$upgradefield = new xmldb_field('markingreminderenabled', XMLDB_TYPE_INTEGER, '1', true, XMLDB_NOTNULL, null, '0', null);
@@ -2173,17 +2147,14 @@ function xmldb_coursework_upgrade($oldversion) {
$table = new xmldb_table('coursework');
-
if (!$dbman->field_exists($table, $upgradefield)) {
$dbman->add_field($table, $upgradefield);
}
-
upgrade_mod_savepoint(true, 2016110102, 'coursework');
}
-
- if($oldversion < 2016112300) {
+ if ($oldversion < 2016112300) {
//Add a field to hold extension value if granted
$fieldextension = new xmldb_field('extension', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', null);
@@ -2191,16 +2162,14 @@ function xmldb_coursework_upgrade($oldversion) {
$table = new xmldb_table('coursework_reminder');
-
if (!$dbman->field_exists($table, $fieldextension)) {
$dbman->add_field($table, $fieldextension);
}
-
upgrade_mod_savepoint(true, 2016112300, 'coursework');
}
- if($oldversion < 2016121500) {
+ if ($oldversion < 2016121500) {
//Add fields to hold personal deadline enabled
$upgradefield = new xmldb_field('personaldeadlineenabled', XMLDB_TYPE_INTEGER, '1', true, XMLDB_NOTNULL, null, '0', null);
@@ -2208,7 +2177,6 @@ function xmldb_coursework_upgrade($oldversion) {
$table = new xmldb_table('coursework');
-
if (!$dbman->field_exists($table, $upgradefield)) {
$dbman->add_field($table, $upgradefield);
}
@@ -2216,13 +2184,12 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2016121500, 'coursework');
}
-
if ($oldversion < 2016121501) {
// Define table coursework_sample_set_mbrs to be created.
$table = new xmldb_table('coursework');
- $upgradefield = new xmldb_field('submissionnotification', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $upgradefield = new xmldb_field('submissionnotification', XMLDB_TYPE_TEXT, null, null, null, null, null);
if (!$dbman->field_exists($table, $upgradefield)) {
$dbman->add_field($table, $upgradefield);
@@ -2231,8 +2198,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2016121501, 'coursework');
}
-
-
if ($oldversion < 2016121600) {
// Define table coursework_person_deadlines to be created.
@@ -2263,7 +2228,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2016121600, 'coursework');
}
-
if ($oldversion < 2017030801) {
// Define table coursework_sample_set_mbrs to be created.
@@ -2271,7 +2235,6 @@ function xmldb_coursework_upgrade($oldversion) {
$relativeinitial = new xmldb_field('relativeinitialmarkingdeadline', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', null);
-
if (!$dbman->field_exists($table, $relativeinitial)) {
$dbman->add_field($table, $relativeinitial);
}
@@ -2320,13 +2283,13 @@ function xmldb_coursework_upgrade($oldversion) {
// coursework obejct
$coursework = coursework::find($coursework);
- if($coursework->marking_deadline_enabled() && $coursework->initialmarkingdeadline){
- //create initialgradingdue event
+ if ($coursework->marking_deadline_enabled() && $coursework->initialmarkingdeadline) {
+ // Create initialgradingdue event
coursework_update_events($coursework, 'initialgradingdue');
}
- if($coursework->marking_deadline_enabled() && $coursework->agreedgrademarkingdeadline){
- //create agreedgradegradingdue event
+ if ($coursework->marking_deadline_enabled() && $coursework->agreedgrademarkingdeadline) {
+ // Create agreedgradegradingdue event
coursework_update_events($coursework, 'agreedgradingdue');
}
}
@@ -2334,19 +2297,15 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2017081102, 'coursework');
}
-
-
if ($oldversion < 2017081103) {
// Changing the default of field automaticagreementstrategy on table coursework
$table = new xmldb_table('coursework');
$field = new xmldb_field('automaticagreementstrategy', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, false, 'none');
-
// Launch change of default for field automaticagreementstrategy.
$dbman->change_field_default($table, $field);
-
// again update default value of automaticagreementstrategy field from NULL to none
$allcourseworks = $DB->get_records('coursework', array('automaticagreementstrategy' => 'NULL')); // get all courseworks with automaticagreementstrategy set to NULL
foreach ($allcourseworks as $coursework) {
@@ -2358,7 +2317,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2017081103, 'coursework');
}
-
if ($oldversion < 2017091400) {
$table = new xmldb_table('coursework');
@@ -2372,8 +2330,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2017091400, 'coursework');
}
-
-
if ($oldversion < 2017100300) {
// Define table coursework_person_deadlines to be created.
@@ -2428,7 +2384,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2017100501, 'coursework');
}
-
if ($oldversion < 2018021501) {
$table = new xmldb_table('coursework');
@@ -2449,7 +2404,7 @@ function xmldb_coursework_upgrade($oldversion) {
}
- if ($oldversion < 2018042401){
+ if ($oldversion < 2018042401) {
$table = new xmldb_table('coursework_mod_agreements');
$upgradefield = new xmldb_field('lasteditedbyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
@@ -2462,8 +2417,7 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2018042401, 'coursework');
}
-
- if($oldversion < 2019071100) {
+ if ($oldversion < 2019071100) {
//Add fields for finalstagegrading
$fieldfinalstagegrading = new xmldb_field('finalstagegrading', XMLDB_TYPE_INTEGER, '1', true, XMLDB_NOTNULL, null, '0', 'numberofmarkers');
@@ -2477,7 +2431,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2019071100, 'coursework');
}
-
if ($oldversion < 2019110700) {
// Define field plagiarismflagenabled to be added to coursework.
@@ -2504,13 +2457,12 @@ function xmldb_coursework_upgrade($oldversion) {
$table->add_field('submissionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null);
$table->add_field('status', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
$table->add_field('comment', XMLDB_TYPE_TEXT, null, null, null, null, null);
- $table->add_field('comment_format',XMLDB_TYPE_INTEGER,'2',null,null,null,null);
+ $table->add_field('comment_format',XMLDB_TYPE_INTEGER, '2', null, null, null, null);
$table->add_field('createdby', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('lastmodifiedby', XMLDB_TYPE_INTEGER, '10', null, false, null, null);
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
-
// Adding keys to table coursework_plagiarism_flag.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
@@ -2528,23 +2480,21 @@ function xmldb_coursework_upgrade($oldversion) {
// Define table coursework_plagiarism_flag to be created.
$table = new xmldb_table('coursework');
- $field = $table->add_field('renamefiles',XMLDB_TYPE_INTEGER,'1',null,null,null,null);
+ $field = $table->add_field('renamefiles',XMLDB_TYPE_INTEGER, '1', null, null, null, null);
// Conditionally launch add field.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
+ $courseworkinstances = $DB->get_records('coursework');
- $courseworkinstances = $DB->get_records('coursework');
+ foreach ($courseworkinstances as $cwk) {
+ $courseworkhassubmissions = $DB->record_exists('coursework_submissions', array('courseworkid' => $cwk->id));
- foreach($courseworkinstances as $cwk) {
- $courseworkhassubmissions = ($DB->get_records('coursework_submissions', array('courseworkid' => $cwk->id)))
- ? true : false;
+ $cwk->renamefiles = ($cwk->blindmarking == 1 || $courseworkhassubmissions) ? 1 : 0;
- $cwk->renamefiles = ($cwk->blindmarking == 1 || $courseworkhassubmissions) ? 1 : 0 ;
-
- $DB->update_record('coursework',$cwk);
+ $DB->update_record('coursework', $cwk);
}
// Coursework savepoint reached.
@@ -2573,8 +2523,6 @@ function xmldb_coursework_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2020111602, 'coursework');
}
-
-
// Always needs to return true.
return true;
}
diff --git a/index.php b/index.php
index 95b3a0d1..ba70f2a5 100644
--- a/index.php
+++ b/index.php
@@ -15,13 +15,12 @@
// along with Moodle. If not, see .
/**
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-/// Replace coursework with the name of your module and remove this line
+// Replace coursework with the name of your module and remove this line
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once(dirname(__FILE__).'/lib.php');
@@ -65,8 +64,7 @@
die();
}
-
echo $OUTPUT->heading(get_string('modulenameplural', 'coursework'), 2);
$page_renderer = $PAGE->get_renderer('mod_coursework', 'page');
echo $page_renderer->view_course_index($course->id);
-echo $OUTPUT->footer();
\ No newline at end of file
+echo $OUTPUT->footer();
diff --git a/lang/en/coursework.php b/lang/en/coursework.php
index 1a977aab..9c1827d3 100644
--- a/lang/en/coursework.php
+++ b/lang/en/coursework.php
@@ -17,8 +17,7 @@
/**
* English strings for coursework
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -28,7 +27,7 @@
global $CFG;
$string['access_denied'] = 'Access denied';
-$string['all'] = 'ALL';
+$string['all'] = 'ALL';
$string['aday'] = 'A day';
$string['add_rule'] = 'Add rule';
@@ -51,8 +50,8 @@
$string['agreedgradeby'] = 'Agreed grade by';
$string['agreedgradeon'] = 'Agreed grade on';
$string['agreedgradedelay'] = 'Agreed grade delay';
-$string['agreedgrademarkingdeadline'] = 'Agreed grade marking deadline';
-$string['agreedgrademarkingdeadline_help'] = 'Set the date agreed grading should be completed by';
+$string['agreedgrademarkingdeadline'] = 'Agreed grade marking deadline';
+$string['agreedgrademarkingdeadline_help'] = 'Set the date agreed grading should be completed by';
$string['agreed_marking_deadline_default'] = 'Agreed grade marking deadline';
$string['agreed_marking_deadline_default_desc'] = 'Select the default agreed grade marking deadline applied to coursework activities';
$string['agreedgradebyusername'] = 'Agreed grade by username';
@@ -83,7 +82,6 @@
$string['allocationactions_help'] = "These buttons will automatically allocate all of the students so that you don't have to do it manually. 'Auto-allocate all' will wipe all the existing allocations (including any ones you set manually) and randomly allocate graders based on the strategy you ahve chosen. The other buttons give you the option of leaving existing choices in place. Any students who have already been graded will of course be left as they are.";
$string['allocationcheckboxtitle'] = 'Include {$a} in the moderations set';
$string['allocationenabled'] = 'Assessor allocation enabled';
-$string['allocationenabled_help'] = '';
$string['allocationsfile'] = 'Allocations file';
$string['allocationstrategy'] = 'Allocation strategy';
$string['allocationstrategy_help'] = "The strategy here will determine how students are allocated to graders when it's done automatically (or you can disable the process). Automatic allocation is done when the allocation buttons below are pressed, or when a student is enrolled on the course.";
@@ -96,9 +94,9 @@
$string['anonymity'] = 'Anonymity';
$string['anonymity_warning_group'] = 'The anonymity may be compromised if only some groups have their grades published.';
$string['anonymity_warning_user'] = 'The anonymity may be compromised if only some students have their grades published.';
-$string['anonymousmarking'] = 'Anonymous marking';
+$string['anonymousmarking'] = 'Anonymous marking';
$string['anonymousmarking_help'] = 'Anonymous marking will be fixed permanently once set and cannot be '. 'changed later. Remember to set the permissions so that the teacher role cannot view logs for '. 'this to be effective.';
-$string['apply'] = 'Apply';
+$string['apply'] = 'Apply';
$string['assessment_group_description'] = 'Description';
$string['assessment_group_title'] = 'Assessment Group';
$string['assessment_period_description'] = 'Description';
@@ -126,23 +124,22 @@
$string['assessormoderatorgrades'] = 'Assessor/moderator grades';
$string['assessoronedefault'] = 'Assessor 1 is included in sample by default';
$string['assessornotallocated'] = 'Assessor not allocated';
-$string['assessornotincoursework'] = 'Assessor {$a} not in the coursework';
+$string['assessornotincoursework'] = 'Assessor {$a} not in the coursework';
$string['assessorupload'] = 'Assessor {$a}';
$string['assessorallocations'] = 'Assessor allocations';
$string['assessors_no_allocated_warning'] = 'Please make sure assessors are allocated.';
-$string['attribute'] = "Attribute";
-$string['availability'] = "Availability";
-$string['automaticagreement'] = "Automatic agreement";
-$string['automaticagreementofgrades'] = "Automatic agreement of grades";
-$string['automaticagreement_desc'] = "TODO description";
-$string['automaticagreement_help'] = "Automatic grade agreement strategy for the final grade. The final grade is worked out from the initial grades based on the strategy chosen";
-$string['automaticagreementrange'] = "Automatic agreement range";
-$string['automaticagreementrange_help'] = "TODO: Automatic agreement range help";
-$string['automaticagreementrange_help'] = "TODO: Automatic agreement range help";
-$string['autopopulatefeedbackcomment'] = "Auto-populate agreed feedback comment";
-$string['autopopulatefeedbackcomment_help'] = "Pre-populate agreed feedback comment field with comments from initial marking. Please note these comments are not saved until 'Save changes' button is pressed.";
-$string['grade_editing_enabled'] = "Grade editing time";
-$string['grade_editing_enabled_desc'] = "Select the amount of time that a user has to edit an initial grade after entering it";
+$string['attribute'] = "Attribute";
+$string['availability'] = "Availability";
+$string['automaticagreement'] = "Automatic agreement";
+$string['automaticagreementofgrades'] = "Automatic agreement of grades";
+$string['automaticagreement_desc'] = "TODO description";
+$string['automaticagreement_help'] = "Automatic grade agreement strategy for the final grade. The final grade is worked out from the initial grades based on the strategy chosen";
+$string['automaticagreementrange'] = "Automatic agreement range";
+$string['automaticagreementrange_help'] = "TODO: Automatic agreement range help";
+$string['autopopulatefeedbackcomment'] = "Auto-populate agreed feedback comment";
+$string['autopopulatefeedbackcomment_help'] = "Pre-populate agreed feedback comment field with comments from initial marking. Please note these comments are not saved until 'Save changes' button is pressed.";
+$string['grade_editing_enabled'] = "Grade editing time";
+$string['grade_editing_enabled_desc'] = "Select the amount of time that a user has to edit an initial grade after entering it";
$string['automaticallyinsample'] = 'Automatically included in sample';
$string['automaticallocation'] = 'Automatic allocation';
@@ -173,14 +170,14 @@
$string['config_coursework_undergraduate_cap_2_weeks'] = 'Sets the percent that the grade for '. 'undergraduates will capped by if submission is up to 2 weeks late.';
$string['config_enable_sits'] = 'This will require teachers to specify what assessment in the external '. 'records system corresponds to the coursework they are creating.';
$string['config_second_reminder'] = 'Sets the number of days before the deadline/extended deadline for the second email reminder. If the '. 'student has not completed the assignment within the reminder period, they will get an email';
-$string['configuration_needed'] = ' You are being redirected to the allocation page as further configuration is needed due to the the following: {$a->percentage} {$a->manual}';
+$string['configuration_needed'] = ' You are being redirected to the allocation page as further configuration is needed due to the the following: {$a->percentage} {$a->manual}';
$string['configextraid'] = 'Select an additional ID number to be displayed for submissions in the grading report (e.g. candidate ID).';
$string['configforceplagiarism'] = 'These will be set once when the coursework is created and will not '. 'update when the site level settings are altered. Admins can alter them manually on the coursework\'s settings screen';
$string['configgeneralfeedback'] = 'Sets the number of weeks after the deadline that general '. 'feedback should be completed.';
$string['configindividualfeedback'] = 'Sets the number of weeks after the deadline that individual '. 'feedback should be provided to the student.';
$string['configmaxbytes'] = 'Default maximum assignment size for all assignments on the site '. '(subject to course limits and other local settings)';
$string['confirmpublish'] = 'Are you sure you want to release all grades? This action cannot be undone.';
-$string['confirmremovefeedback'] = 'Are you sure you want to remove this feedback? This action cannot be undone';
+$string['confirmremovefeedback'] = 'Are you sure you want to remove this feedback? This action cannot be undone';
$string['continuetocoursework'] = 'Continue to coursework';
$string['coursework'] = 'Coursework';
$string['coursework:addinstance'] = 'Add a new coursework instance';
@@ -222,24 +219,22 @@
$string['courseworkname_help'] = 'This is the content of the help tooltip associated with the '. 'Coursework name field. Markdown syntax is supported.';
$string['courseworknavlink'] = 'Coursework reports';
$string['courseworktype'] = 'Coursework Type';
-$string['createdby'] = 'Created by';
$string['crontask'] = 'Coursework housekeeping cron job';
$string['cron_email_html'] = '
Dear {$a->name},
We wish to remind you that your assignment for {$a->coursework_name_with_link} is due on {$a->human_deadline}. '. 'You have {$a->day_hour} to complete it
Regards, Course Admin
';
$string['cron_email_html_admin'] = '
Dear {$a->firstname} {$a->lastname},
We wish to remind you that Student assignments for {$a->coursework_name} are due on {$a->deadline}. '. 'They have {$a->day_hour} to complete it
Regards, Course Admin
';
$string['cron_email_subject'] = 'Reminder: your assignment for {$a->coursework_name} is due on {$a->human_deadline}';
$string['cron_email_subject_admin'] = 'Reminder: Student assignments for {$a->coursework_name} due on {$a->deadline}';
-$string['cron_email_text'] = 'Dear {$a->name},'."\n\n".'We wish to remind you that your assignment for {$a->coursework_name} is due on {$a->human_deadline}. You have {$a->day_hour} to complete it.'."\n\n".' Regards, Course Admin ';
+$string['cron_email_text'] = 'Dear {$a->name}, '."\n\n".'We wish to remind you that your assignment for {$a->coursework_name} is due on {$a->human_deadline}. You have {$a->day_hour} to complete it.'."\n\n".' Regards, Course Admin ';
$string['cron_email_text_admin'] = 'Dear {$a->firstname} {$a->lastname},'."\n\n".'We wish to remind you that Student assignments for {$a->coursework_name} are due on {$a->deadline}.'."\n\n".'They have {$a->day_hour} to complete it.'."\n\n".'Regards, Course Admin.';
$string['currentmoderationset'] = 'Current moderations set';
$string['customforms'] = 'Coursework Custom Forms';
$string['customformslist'] = 'Custom forms';
$string['day'] = 'Day';
-$string['days'] = 'days';
$string['days'] = 'Days';
$string['deadline'] = 'Deadline for submissions';
$string['deadline_help'] = 'Students will be able to add and remove files up until this deadline, '. 'or until a tutor has graded them if there is no deadline. Please note that if "Use the personal deadline" option is selected, this deadline will act as a default Personal Deadline for each student. ';
$string['deadlinechanged'] = 'The {$a->typeofdeadline} deadline has changed for {$a->courseworkname}. The deadline is now {$a->deadline}';
-$string['deadline_defaults'] = 'Deadline Defaults';
+$string['deadline_defaults'] = 'Deadline Defaults';
$string['deadline_warning'] = 'After the deadline the current submission will autofinalise and no edits can be made.';
$string['deadlines'] = 'Deadlines';
$string['default_deadline'] = 'This is the default deadline that will be used if personal deadline was not specified.';
@@ -249,7 +244,7 @@
$string['description'] = 'Description';
$string['disabled'] = 'Disabled';
$string['disagreed'] = 'Disagreed';
-$string['digest'] = 'Digest';
+$string['digest'] = 'Digest';
$string['dodgysrscode'] = 'This candidate number doesn\'t match the required format (6 alphanumeric characters e.g. P12345)';
$string['download_student_files'] = 'Download all student submitted files';
$string['download_submitted_files'] = 'Download submitted files';
@@ -277,7 +272,7 @@
$string['enable_sits'] = 'Enable integration with SITS';
$string['enablegeneralfeedback'] = 'Enable general feedback';
$string['enablegeneralfeedback_help'] = 'This will allow teachers to edit a bit of text which will be released to all students automatically once the deadline for general feedback passes. It is intended for situations when an exam or similar is coming up and areas for all students to improve upon are emerging, but there has not yet been time to mark and release the grades for all the students individually.';
-$string['enroltask'] = 'Coursework process enrolment allocation task';
+$string['enroltask'] = 'Coursework process enrolment allocation task';
$string['eventassessableuploaded'] = 'A file has been uploaded.';
$string['exportfinalgrades'] = 'Export final grades';
$string['exportgradingsheets'] = 'Export grading sheet';
@@ -349,7 +344,7 @@
$string['finaliseyoursubmission'] = 'Finalise your submission';
$string['finalstagegrading'] = 'Grading method for final stage';
$string['finalstagegrading_help'] = 'This allows to choose the grading method for the final stage of grading if Rubrics or Marking Guide is used in initial stages. You will not be able to change it back if at least one final stage feedback exists.';
-$string['finalisedsubmission'] = 'Finalised submission';
+$string['finalisedsubmission'] = 'Finalised submission';
$string['flagplagiarism'] = 'Flag plagiarism';
$string['followingerrors'] = 'Following errors were found:';
$string['forceautoauto_release_individual_feedback'] = 'Force auto release of individual feedback global setting across all courseworks';
@@ -370,7 +365,7 @@
$string['formid'] = 'Select feedback form';
$string['formid_help'] = 'You can create a new form based on an existing form';
$string['fourhours'] = 'Four hours';
-$string['fourteendays'] = '14 days';
+$string['fourteendays'] = '14 days';
$string['from'] = 'from';
$string['generalfeedback'] = 'General feedback';
$string['generalfeedback_help'] = 'Please confirm the date that general feedback on this assignment'. ' will be available to all students. If not enabled, any general feedback will be visible to all students as soon as it is added.';
@@ -382,12 +377,11 @@
$string['graded'] = 'Graded';
$string['gradedandpublished'] = 'Graded and published';
$string['gradebook'] = 'Gradebook';
-$string['grade_help'] = 'Grade help';
$string['grade_hidden_manager'] = 'Hidden until all initial grades are complete';
$string['grade_hidden_teacher'] = 'Hidden until grades are agreed';
$string['gradeitem:submissions'] = 'Submissions';
-$string['grades_table_header'] = 'Grades';
-$string['grades_table_header_help'] = 'All grades are provisional until finalised at Assessment panel and boards.';
+$string['grades_table_header'] = 'Grades';
+$string['grades_table_header_help'] = 'All grades are provisional until finalised at Assessment panel and boards.';
$string['gradealreadyexists'] = 'Grade already exists';
$string['gradingsheetfile'] = 'Grading sheet file';
$string['gradedby'] = 'Graded by';
@@ -410,9 +404,6 @@
$string['grade_editing'] = 'Grade editing time';
$string['grading_page'] = 'Grading page';
-
-
-
$string['group'] = 'Group';
$string['grouping_id'] = 'Grouping';
$string['grouping_id_help'] = 'Grouping containing the groups wich are allowed to submit.';
@@ -429,7 +420,6 @@
$string['hidden'] = 'Hidden';
$string['hideallstudents'] = 'Hide submissions for other students';
$string['hour'] = 'Hour';
-$string['hours'] = 'hours';
$string['hours'] = 'Hours';
$string['howmanyfeedbacks'] = '{$a->number} (Max: {$a->max})';
$string['iagreetotheterms'] = 'I agree to the terms';
@@ -444,11 +434,11 @@
$string['individual_feedback_auto_release'] = 'Auto release of individual feedback';
$string['individual_feedback_auto_release_desc'] = 'This will enable date picker in the individual coursework instance';
$string['initialgrade'] = 'Initial grade';
-$string['submissionnotification'] = 'User to receive submission notification';
+$string['submissionnotification'] = 'User to receive submission notification';
$string['initialassessor'] = 'Initial assessor';
$string['initialassessorno'] = 'Initial Assessor {$a}';
-$string['initialmarkingdeadline'] = 'Initial marking deadline';
-$string['initialmarkingdeadline_help'] = 'Set the date that intial grading should be completed by';
+$string['initialmarkingdeadline'] = 'Initial marking deadline';
+$string['initialmarkingdeadline_help'] = 'Set the date that intial grading should be completed by';
$string['item'] = 'Item';
$string['itsyou'] = '(you)';
$string['lastedited'] = 'Last edited by {$a->name} on {$a->time}';
@@ -491,7 +481,6 @@
$string['minimum_range_grade_rawdesc'] = '{$a->minimum} students between {$a->lowerlimit} and {$a->upperlimit}';
$string['minimumis'] = 'Minimum: {$a}';
$string['minute'] = 'Minute';
-$string['minutes'] = 'minutes';
$string['minutes'] = 'Minutes';
$string['moderate'] = 'Moderate';
$string['moderatedby'] = 'Moderated by';
@@ -505,7 +494,6 @@
$string['moderationagreementenabled_help'] = 'Enable moderations agreement field in which moderators need to agree/disagree with assessor\'s feedback. This is only available for single marked courseworks';
$string['moderationcomment'] = 'Moderation comment';
$string['moderationenabled'] = 'Moderation enabled';
-$string['moderationenabled_help'] = 'Moderation enabled';
$string['moderationfor'] = 'Moderation for {$a}';
$string['moderationset'] = 'Moderation set';
$string['moderationset_help'] = 'The moderations set determines which students are to be moderated. The others will not be visible to the moderator. This is optional, and if no rules are supplied, it will be assumed that all students should be moderated.';
@@ -516,7 +504,7 @@
$string['moderatorfeedback'] = 'Moderator feedback';
$string['moderatornotallocated'] = 'Moderator not allocated';
$string['modsetallocateallwithout'] = 'Allocate any without moderator allocations';
-$string['modsetgradeexplain'] = 'Please note: This moderations set rule will not be activated until initial grading has commenced. The moderations sample will continue to include all qualifying assignments, based upon the set rule chosen.' ;
+$string['modsetgradeexplain'] = 'Please note: This moderations set rule will not be activated until initial grading has commenced. The moderations sample will continue to include all qualifying assignments, based upon the set rule chosen.';
$string['modsetminimum'] = 'Minimum number of items to include if possible';
$string['modsetreallocateall'] = 'Re-allocate all unmoderated';
$string['modsetreallocateallnonmanual'] = 'Re-allocate all non-manual moderations';
@@ -529,7 +517,7 @@
$string['modulename'] = 'Coursework';
$string['modulename_help'] = 'The coursework module allows students to upload a file or files to be assessed by assessors as part of a grading process that may include single or multiple assessors, blind marking, moderations, allocation of marking to specific teachers, restricting marking/moderations to a subset of students, or any combination of these. The marking process is highly configurable and has been designed to satisfy the requirements of UK university departments. Integration with Turnitin is available if you have a Turnitin subscription and there is the option to get students to resubmit repeatedly and/or extend the deadlines on a per-student basis.';
$string['modulenameplural'] = 'Courseworks';
-$string['multipleusers'] = 'Multiple users';
+$string['multipleusers'] = 'Multiple users';
$string['must_be_after_dealdine'] = 'Must be after the submission deadline';
$string['must_be_before_dealdine'] = 'Must be before the submission deadline';
$string['must_be_after_initial_grade_dealdine'] = 'Must be after the initial grade deadline';
@@ -545,7 +533,6 @@
$string['noerrorsfound'] = 'No errors were found in the grading sheet uploaded';
$string['noallocationerrorsfound'] = 'No errors were found in the allocation sheet uploaded';
-
$string['nofeedbackforms'] = 'At present no feedback forms have been created. At least one feedback form is required so that it may be selected when creating a OCM. Click url}\'>here to create a form';
$string['nofeedbacksyet'] = 'No feedbacks yet (Max: {$a})';
$string['nofeedbackyet'] = 'No feedback yet';
@@ -559,13 +546,13 @@
$string['nomarkers'] = 'No available assessors';
$string['nomoderators'] = 'No available moderators';
$string['noneedforsubmission'] = 'Submission not needed';
-$string['nopermissiontoimportfeedback'] = 'You do not have permission to import feedback to this coursework';
+$string['nopermissiontoimportfeedback'] = 'You do not have permission to import feedback to this coursework';
$string['nopermissiontogradesubmission'] = 'You do not have permission to grade this submission';
$string['nopermissiontoeditgrade'] = 'You do not have permission to edit this submissions grade';
-$string['nopermissiontoimportgrade'] = 'You do not have permission to upload grades for this submission';
-$string['nopersonaldeadlineforextensionwarning'] = 'Note users who have extensions can not have their personal deadline changed or be a part of bulk unflinalise';
+$string['nopermissiontoimportgrade'] = 'You do not have permission to upload grades for this submission';
+$string['nopersonaldeadlineforextensionwarning'] = 'Note users who have extensions can not have their personal deadline changed or be a part of bulk unflinalise';
$string['norulesyet'] = 'No rules defined.';
-$string['norenamefile'] = 'No (you are unable to change this setting as a submission has been made)';
+$string['norenamefile'] = 'No (you are unable to change this setting as a submission has been made)';
$string['nosave'] = 'You cannot save changes or cancel in preview mode - this will cause an error';
$string['nosubmissionhasbeenmade'] = 'No submission has been made.';
$string['nosubmissionrequired'] = 'No submission required';
@@ -599,7 +586,6 @@
$string['onemonth'] = 'One month';
$string['oneweek'] = 'One week';
$string['ontime'] = 'On time';
-$string['overwritegrades'] = 'Overwrite current grades with uploaded ones';
$string['overwritefeedback'] = 'Overwrite current feedback files with uploaded ones';
$string['originalfinalgrade'] = 'Assessor agreed final grade';
$string['originalgrade'] = 'Original grade';
@@ -607,10 +593,10 @@
$string['otherassessorfeedback'] = 'Other assessor feedback ({$a})';
$string['overwritegrades'] = 'Check box to allow existing grades to be overwritten by grades present in this csv';
$string['ofallstudents'] = '% of all students';
-$string['participants'] = 'Participants';
-$string['per_page'] = 'Records per page';
-$string['per_page_desc'] = 'Default number of records displayed per page';
-$string['percentage'] = '%';
+$string['participants'] = 'Participants';
+$string['per_page'] = 'Records per page';
+$string['per_page_desc'] = 'Default number of records displayed per page';
+$string['percentage'] = '%';
$string['percentages_do_not_add_up'] = 'Percentage allocations are enabled, but the percentages for each assessor do not add up to 100% (only {$a}%). Some students will remain unallocated until this is fixed.';
$string['personal_deadline'] = 'Personal deadline';
$string['personaldeadlineenabled'] = 'Personal deadline';
@@ -635,10 +621,10 @@
$string['previewform'] = 'Preview form';
$string['provisionalgrade'] = 'Provisional grade';
$string['provisionalgrade_help'] = 'Grade before panels and boards';
-$string['processallocationsupload'] = "Allocations file upload results";
-$string['processallocationsuploaddesc'] = "The allocations file that you uploaded has been validated and processed. Below is the result of the upload. ";
-$string['processgradingsheetupload'] = "Grading sheet upload results";
-$string['processgradingsheetuploaddesc'] = "The grading sheet that you uploaded has been validated and processed. Below is the result of the upload. ";
+$string['processallocationsupload'] = "Allocations file upload results";
+$string['processallocationsuploaddesc'] = "The allocations file that you uploaded has been validated and processed. Below is the result of the upload. ";
+$string['processgradingsheetupload'] = "Grading sheet upload results";
+$string['processgradingsheetuploaddesc'] = "The grading sheet that you uploaded has been validated and processed. Below is the result of the upload. ";
$string['publish'] = 'Release all grades';
$string['publishgeneralfeedback'] = 'Release general feedback';
$string['range_grade_percent'] = 'Range between two percentage grades';
@@ -649,12 +635,12 @@
$string['range_total_percentdesc'] = 'With the total sample being at least {$a->upperlimit}%';
$string['records_per_page'] = 'Showing:';
$string['released_early'] = '(released early)';
-$string['relativeinitialmarkingdeadline'] = "Relative initial marking deadline";
-$string['relativeinitialmarkingdeadline_help'] = "Set the amount of time that initial marking should be completed by relative to submission time";
-$string['relativeagreedmarkingdeadline'] = "Relative agreed grade marking deadline";
-$string['relativeagreedmarkingdeadline_help'] = "Set the amount of time that agreed grade should be completed by relative to submission time";
-$string['relativedeadlinesreminder'] = "N.b if you turn off marking deadlines and leave marking reminders on, the reminders will default to the relative deadlines selected by your moodle admin";
-$string['renamefiles'] = 'Rename files';
+$string['relativeinitialmarkingdeadline'] = "Relative initial marking deadline";
+$string['relativeinitialmarkingdeadline_help'] = "Set the amount of time that initial marking should be completed by relative to submission time";
+$string['relativeagreedmarkingdeadline'] = "Relative agreed grade marking deadline";
+$string['relativeagreedmarkingdeadline_help'] = "Set the amount of time that agreed grade should be completed by relative to submission time";
+$string['relativedeadlinesreminder'] = "N.b if you turn off marking deadlines and leave marking reminders on, the reminders will default to the relative deadlines selected by your moodle admin";
+$string['renamefiles'] = 'Rename files';
$string['renamefiles_help'] = 'Sets whether files will be renamed. Automatically set to yes if blind marking is selected';
$string['reminder'] = 'Date 2nd reminder emails';
$string['reminder_first'] = 'Students will receive their first reminder {$a} days before the deadline';
@@ -662,20 +648,20 @@
$string['removefeedback'] = 'Remove feedback';
$string['removegraderule'] = 'Remove rule';
$string['replacing_an_existing_file_warning'] = 'You have already submitted this assignment. The document(s) you choose will replace the document(s) you previously submitted.';
-$string['returntocourseworkpage'] = 'Return to coursework page';
+$string['returntocourseworkpage'] = 'Return to coursework page';
$string['restrictgeneralfeedback'] = 'Restrict general feedback';
$string['resubmit'] = 'Resubmit to {$a}';
$string['resubmitted'] = 'Submission files for {$a} have been sent to the plagiarism system again. It may'. ' take up to an hour or two for them to be processed.';
$string['revert'] = 'Unfinalise';
$string['rightnumberofallocations'] = 'Right number of allocations';
$string['sameforallstages'] = 'Same throughout all stages';
-$string['rounddown'] = 'Rounding down';
-$string['roundingrule'] = "Rounding of average grade";
-$string['roundingrule_help'] = "Rounding of average grade to the whole number rules.";
-$string['roundmid'] = 'Mid point rounding';
-$string['roundup'] = 'Rounding up';
-$string['rubric_grade_cannot_be_empty'] = 'Grade can not be empty: ';
-$string['rubric_invalid_value'] = 'Value given is invalid for this rubric: ';
+$string['rounddown'] = 'Rounding down';
+$string['roundingrule'] = "Rounding of average grade";
+$string['roundingrule_help'] = "Rounding of average grade to the whole number rules.";
+$string['roundmid'] = 'Mid point rounding';
+$string['roundup'] = 'Rounding up';
+$string['rubric_grade_cannot_be_empty'] = 'Grade can not be empty: ';
+$string['rubric_invalid_value'] = 'Value given is invalid for this rubric: ';
$string['sampling'] = 'Sampling';
$string['sampletype'] = 'Sample Type ';
@@ -687,7 +673,7 @@
$string['samplingenabled'] = 'Sampling enabled';
$string['samplingenabled_help'] = 'Sampling allows you to choose which students will be included for later stages of marking after the first mark is done.';
$string['save'] = 'Save';
-$string['save_and_exit'] = 'Save and exit';
+$string['save_and_exit'] = 'Save and exit';
$string['save_email_finalised'] = ' and it has been finalised ';
$string['save_email_html'] = '
Dear {$a->name},
Your submission has been made to {$a->coursework_name} {$a->finalised} with a submission time of {$a->submittedtime}
The submission id in case of dispute is {$a->submissionid}
';
$string['save_email_subject'] = 'Submission Receipt';
@@ -707,14 +693,14 @@
$string['selectalltopin'] = 'Pin/unpin marking stage on screen';
$string['selectsamplingstrategy'] = 'Select sampling strategy';
$string['selectrules'] = 'Select rules';
-$string['sendmarkingreminder'] = 'Send marking reminder';
+$string['sendmarkingreminder'] = 'Send marking reminder';
$string['sequence_number_description'] = 'Description';
$string['sequence_number_title'] = 'Sequence / Assessment Title';
-$string['setdateforselected'] = 'Set date for selected {$a}s';
+$string['setdateforselected'] = 'Set date for selected {$a}s';
$string['setpersonaldeadlines'] = 'Set personal deadlines';
$string['setpersonaldeadlinesfor'] = 'Set personal deadlines for {$a}';
$string['settings_header'] = 'All values set in this page are defaults for all courseworks, however \'Availability\', \'Submission\' and \'Feedback types\' settings can be overridden in the individual coursework instance.';
-$string['sevendays'] = '7 days';
+$string['sevendays'] = '7 days';
$string['showallfeedbacks'] = 'Show initial assessors feedback to students';
$string['showallfeedbacks_help'] = 'If enabled, all assessors feedback will be visible to students. This doesn\'t apply to single marked courseworks, where there is only one feedback anyway.';
$string['showallstudents'] = 'Show submissions for other students';
@@ -778,15 +764,15 @@
$string['submissiondeadline'] = 'Submissions deadline';
$string['submissionsdeadlineinfo'] = 'Please note that the submitted work will be auto-finalised when the deadline passes. The submission needs to be finalised to allow assessor(s) to grade.';
$string['submission_deadline_enabled_desc'] = 'Set the default submissions deadline applied to coursework activities';
-$string['submissiontime'] = 'Submission time';
-$string['submissiontype'] = 'Submission type';
-$string['submissionnotallocatedtoassessor'] = 'Submissions for students not allocated to you';
+$string['submissiontime'] = 'Submission time';
+$string['submissiontype'] = 'Submission type';
+$string['submissionnotallocatedtoassessor'] = 'Submissions for students not allocated to you';
$string['submitandfinalise'] = 'Submit and finalise';
$string['submitonbehalfof'] = 'Submit work on behalf of a student';
$string['submissionnotreadyforagreedgrade'] = 'The submission is not ready for agreed grade';
$string['submissionnotreadytograde'] = 'The submission is not ready to be graded';
$string['submission_notification_html'] = '
Dear {$a->name},
A submission has been made in the {$a->coursework_name} coursework.
';
-$string['submission_notification_subject'] = 'A submission has been made in {$a}';
+$string['submission_notification_subject'] = 'A submission has been made in {$a}';
$string['submission_notification_text'] = 'Dear {$a->name},'."\n\n".'A submission has been made in the {$a->coursework_name} coursework.';
$string['coursework:submitonbehalfof'] = 'Submit work on behalf of a student';
$string['submitonbehalfofstudent'] = 'Submit work on behalf of {$a}';
@@ -830,24 +816,24 @@
$string['type_help'] = 'Field type';
$string['type_help_help'] = 'Field type';
$string['uncappedgrade'] = 'Uncapped maximum grade';
-$string['unfinaliseselected'] = 'Unfinialise submissions for selected {$a}s';
-$string['unfinalisedchangesubmissiondate'] = 'You may need to change the submission deadlines for unfinalised submissions. Note if an expired deadline is not changed then your submission will auto-finalise';
+$string['unfinaliseselected'] = 'Unfinialise submissions for selected {$a}s';
+$string['unfinalisedchangesubmissiondate'] = 'You may need to change the submission deadlines for unfinalised submissions. Note if an expired deadline is not changed then your submission will auto-finalise';
$string['unmoderatedworkexists'] = 'Cannot release grades - some work still needs moderating and strict anonymity for moderations is enabled.';
-$string['unenroltask'] = 'Coursework process unenrolment allocation task';
+$string['unenroltask'] = 'Coursework process unenrolment allocation task';
$string['updatethis'] = 'Update this Coursework';
$string['uploadfeedbackfiles'] = 'Upload feedback files in a zip';
$string['upperlimit'] = 'Upper limit';
$string['use_groups'] = 'Group submissions';
$string['use_groups_help'] = 'If enabled, groups of students will submit one bit of work for the whole group. Any student in the group can submit, and if they do, their submission will overwrite any previous submission by other group members.';
-$string['usernamemissing'] = 'User\'s username is missing';
-$string['usernotincoursework'] = 'Student not in the coursework';
-$string['usemarkingdeadline'] = 'Use the marking deadline';
+$string['usernamemissing'] = 'User\'s username is missing';
+$string['usernotincoursework'] = 'Student not in the coursework';
+$string['usemarkingdeadline'] = 'Use the marking deadline';
$string['usepersonaldeadline'] = 'Use the personal deadline';
-$string['uploadallocations'] = 'Upload allocations';
-$string['uploadgradingworksheet'] = 'Upload grading worksheet';
-$string['uploadfeedbackzip'] = 'Upload feedback zip';
-$string['value'] = "Value";
-$string['valuenotincourseworkscale'] = "Grade value not in coursework scale.";
+$string['uploadallocations'] = 'Upload allocations';
+$string['uploadgradingworksheet'] = 'Upload grading worksheet';
+$string['uploadfeedbackzip'] = 'Upload feedback zip';
+$string['value'] = "Value";
+$string['valuenotincourseworkscale'] = "Grade value not in coursework scale.";
$string['viewfeedback'] = 'View feedback';
$string['viewinitialgradeenabled'] = 'View initial assessors grades';
$string['viewinitialgradeenabled_help'] = 'If selected, assessors will be able to see initial grades from other assessors.';
@@ -856,7 +842,7 @@
$string['viewallstudents'] = 'View students not allocated to user';
$string['week'] = 'Week';
$string['weeks'] = 'Weeks';
-$string['yesrenamefile'] = 'Yes (you are unable to change this setting as a submission has been made)';
+$string['yesrenamefile'] = 'Yes (you are unable to change this setting as a submission has been made)';
$string['youmustagreetotheterms'] = 'You must agree to the following terms before submitting:';
$string['youmustagreetothetermserror'] = 'You must agree to the terms';
$string['yoursrscode'] = 'Your candidate number';
@@ -869,7 +855,7 @@
$string['moderationenabled_help'] = 'Allow a moderator to mark a subset of the submissions. A moderator\'s grade becomes the final grade for any submission they mark.';
$string['grade_help'] = 'Select the grade scale on which this coursework will be marked';
$string['anonymitydescription'] = '
Blind marking - You will not see students names';
-$string['allocationenabled_help'] = 'Restrict which assessors will mark which submission,';
+$string['allocationenabled_help'] = 'Restrict which assessors will mark which submission';
$string['oneweekoption'] = '1 week';
$string['twoweeksoption'] = '2 weeks';
@@ -911,4 +897,4 @@
$string['privacy:metadata:persondeadlines'] = 'PersonDeadlines';
$string['privacy:metadata:modagreements'] = 'ModAgreements';
$string['privacy:metadata:plagiarismflags'] = 'PlagiarismFlags';
-$string['loadingpagination'] = 'Loading Pagination';
\ No newline at end of file
+$string['loadingpagination'] = 'Loading Pagination';
diff --git a/lib.php b/lib.php
index f1953afa..8236a50b 100644
--- a/lib.php
+++ b/lib.php
@@ -17,8 +17,7 @@
/**
* Library of interface functions and constants for module coursework
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -50,7 +49,7 @@
* @return array
*/
function coursework_get_file_areas($course, $cm, $context) {
- $areas = array();
+ $areas = [];
if (has_capability('mod/coursework:submit', $context)) {
$areas['submission'] = get_string('submissionfiles', 'coursework');
@@ -106,7 +105,7 @@ function mod_coursework_pluginfile($course, $cm, $context, $filearea, $args, $fo
$fullpath = "/{$context->id}/mod_coursework/submission/{$submission->id}/{$relativepath}";
$fs = get_file_storage();
- if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) {
+ if (!$file = $fs->get_file_by_hash(sha1($fullpath)) || $file->is_directory()) {
return false;
}
send_stored_file($file, 0, 0, true); // Download MUST be forced - security!
@@ -133,7 +132,7 @@ function mod_coursework_pluginfile($course, $cm, $context, $filearea, $args, $fo
"{$feedback->id}/{$relativepath}";
$fs = get_file_storage();
- if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) {
+ if (!$file = $fs->get_file_by_hash(sha1($fullpath)) || $file->is_directory()) {
return false;
}
send_stored_file($file, 0, 0, true);
@@ -160,10 +159,10 @@ function coursework_add_instance($formdata) {
// You may have to add extra stuff in here.
- //we have to check to see if this coursework has a deadline ifm it doesn't we need to set the
- //deadline to zero
+ // We have to check to see if this coursework has a deadline ifm it doesn't we need to set the
+ // Deadline to zero
- $formdata->deadline = empty($formdata->deadline) ? 0 : $formdata->deadline;
+ $formdata->deadline = empty($formdata->deadline) ? 0 : $formdata->deadline;
$subnotify = '';
$comma = '';
if (!empty($formdata->submissionnotification)) {
@@ -174,8 +173,8 @@ function coursework_add_instance($formdata) {
}
$formdata->submissionnotification = $subnotify;
- //if blindmarking is set we will rename files
- if ($formdata->blindmarking == 1) {
+ // If blindmarking is set we will rename files
+ if ($formdata->blindmarking == 1) {
$formdata->renamefiles = 1;
@@ -185,17 +184,17 @@ function coursework_add_instance($formdata) {
$formdata->id = $returnid;
// IMPORTANT: at this point, the coursemodule will be in existence, but will
- // not have the coursework id saved, because we only just made it.
+ // Not have the coursework id saved, because we only just made it.
$coursemodule = $DB->get_record('course_modules', array('id' => $formdata->coursemodule));
$coursemodule->instance = $returnid;
// This is doing what will be done later by the core routines. Makes it simpler to use existing
- // code without special cases.
+ // Code without special cases.
$DB->update_record('course_modules', $coursemodule);
// Get all the other data e.g. coursemodule.
$coursework = coursework::find($returnid);
- //create event for coursework deadline [due]
+ // Create event for coursework deadline [due]
if ($coursework && $coursework->deadline) {
$event = coursework_event($coursework, format_module_intro('coursework', $coursework,
$coursemodule->id), $returnid, 'due', $coursework->deadline);
@@ -203,7 +202,7 @@ function coursework_add_instance($formdata) {
calendar_event::create($event);
}
- //create event for coursework initialmarking deadline [initialgradingdue]
+ // Create event for coursework initialmarking deadline [initialgradingdue]
if ($coursework && $coursework->marking_deadline_enabled() && $coursework->initialmarkingdeadline) {
$event = coursework_event($coursework, format_module_intro('coursework', $coursework,
$coursemodule->id), $returnid, 'initialgradingdue', $coursework->initialmarkingdeadline);
@@ -211,7 +210,7 @@ function coursework_add_instance($formdata) {
calendar_event::create($event);
}
- //create event for coursework agreedgrademarking deadline [agreedgradingdue]
+ // Create event for coursework agreedgrademarking deadline [agreedgradingdue]
if ($coursework && $coursework->marking_deadline_enabled() && $coursework->agreedgrademarkingdeadline && $coursework->has_multiple_markers()) {
$event = coursework_event($coursework, format_module_intro('coursework', $coursework,
$coursemodule->id), $returnid, 'agreedgradingdue', $coursework->agreedgrademarkingdeadline);
@@ -223,8 +222,6 @@ function coursework_add_instance($formdata) {
return $returnid;
}
-
-
/**
* Is the event visible?
*
@@ -254,7 +251,6 @@ function mod_coursework_core_calendar_is_event_visible(calendar_event $event) {
return false;
}
-
/**
* This function receives a calendar event and returns the action associated with it, or null if there is none.
*
@@ -282,28 +278,28 @@ function mod_coursework_core_calendar_provide_event_action(calendar_event $event
$student = $coursework->can_submit();
$marker = $coursework->is_assessor($user);
- if ($marker){ // for markers
+ if ($marker) { // For markers
- // check how many submissions to mark
- $outstandingmarking = new outstanding_marking();
+ // Check how many submissions to mark
+ $outstandingmarking = new outstanding_marking();
- if($event->eventtype == 'initialgradingdue') {
- //initial grades
+ if ($event->eventtype == 'initialgradingdue') {
+ // Initial grades
$togradeinitialcount = $outstandingmarking->get_to_grade_initial_count($dbcoursework, $user->id());
- $name = ($coursework->has_multiple_markers())? get_string('initialgrade', 'coursework') : get_string('grade', 'mod_coursework');
- $itemcount = $togradeinitialcount ;
+ $name = ($coursework->has_multiple_markers()) ? get_string('initialgrade', 'coursework') : get_string('grade', 'mod_coursework');
+ $itemcount = $togradeinitialcount;
- } else if($event->eventtype == 'agreedgradingdue') {
- //agreed grades
+ } else if ($event->eventtype == 'agreedgradingdue') {
+ // Agreed grades
$togradeagreedcount = $outstandingmarking->get_to_grade_agreed_count($dbcoursework, $user->id());
$name = get_string('agreedgrade', 'coursework');
- $itemcount = $togradeagreedcount;
+ $itemcount = $togradeagreedcount;
}
$submission_url = new \moodle_url('/mod/coursework/view.php', array('id' => $cm->id));
- } elseif ($student) { // for students
+ } else if ($student) { // for students
// if group cw check if student is in group, if not then don't display 'Add submission' link
if ($coursework->is_configured_to_have_group_submissions() && !$coursework->get_student_group($user)) {
@@ -318,7 +314,7 @@ function mod_coursework_core_calendar_provide_event_action(calendar_event $event
if (!$submission) {
$submission = $new_submission;
}
- // check if user can still submit
+ // Check if user can still submit
$ability = new ability($user, $coursework);
if (!$submission || $ability->can('new', $submission)) {
$name = get_string('addsubmission', 'coursework');
@@ -432,7 +428,7 @@ function coursework_update_instance($coursework) {
$coursework->timemodified = time();
$coursework->id = $coursework->instance;
- if ($coursework->finalstagegrading == 1){
+ if ($coursework->finalstagegrading == 1) {
$coursework->automaticagreementstrategy = 'none';
$coursework->automaticagreementrange = 10;
}
@@ -448,25 +444,21 @@ function coursework_update_instance($coursework) {
$coursework->submissionnotification = $subnotify;
- $courseworkhassubmissions = ($DB->get_records('coursework_submissions',array('courseworkid'=>$coursework->id)))
- ? true : false;
+ $courseworkhassubmissions = $DB->record_exists('coursework_submissions', array('courseworkid' => $coursework->id));
- //if the coursework has submissions then we the renamefiles setting can't be changes
+ // If the coursework has submissions then we the renamefiles setting can't be changes
if ($courseworkhassubmissions) {
- $currentcoursework = $DB->get_record('coursework',array('id'=>$coursework->id));
+ $currentcoursework = $DB->get_record('coursework', array('id' => $coursework->id));
$coursework->renamefiles = $currentcoursework->renamefiles;
- } else if ($coursework->blindmarking == 1) {
+ } else if ($coursework->blindmarking == 1) {
$coursework->renamefiles = 1;
}
-
-
-
$oldsubmissiondeadline = $DB->get_field('coursework', 'deadline', array('id' => $coursework->id));
$oldgeneraldeadline = $DB->get_field('coursework', 'generalfeedback', array('id' => $coursework->id));
$oldindividualdeadline = $DB->get_field('coursework', 'individualfeedback', array('id' => $coursework->id));
@@ -479,13 +471,12 @@ function coursework_update_instance($coursework) {
$courseworkobj = coursework::find($coursework->id);
-
$params = array(
'context' => context_module::instance($courseworkobj->get_course_module()->id),
'courseid' => $courseworkobj->get_course()->id,
'objectid' => $coursework->id,
'other' => array(
- 'courseworkid' => $coursework->id,
+ 'courseworkid' => $coursework->id,
'oldsubmissiondeadline' => $oldsubmissiondeadline,
'newsubmissionsdeadline' => $coursework->deadline,
'oldgeneraldeadline' => $oldgeneraldeadline,
@@ -496,31 +487,30 @@ function coursework_update_instance($coursework) {
)
);
-
$event = \mod_coursework\event\coursework_deadline_changed::create($params);
$event->trigger();
}
- // update event for calendar(cw name/deadline) if a coursework has a deadline
+ // Update event for calendar(cw name/deadline) if a coursework has a deadline
if ($coursework->deadline) {
- coursework_update_events($coursework, 'due'); //cw deadline
- if ($coursework->initialmarkingdeadline){
- //update
- coursework_update_events($coursework, 'initialgradingdue'); //cw initial grading deadine
+ coursework_update_events($coursework, 'due'); // Cw deadline
+ if ($coursework->initialmarkingdeadline) {
+ // Update
+ coursework_update_events($coursework, 'initialgradingdue'); // Cw initial grading deadine
} else {
- //remove it
+ // Remove it
remove_event($coursework, 'initialgradingdue');
}
- if ($coursework->agreedgrademarkingdeadline && $coursework->numberofmarkers > 1){
- //update
- coursework_update_events($coursework, 'agreedgradingdue'); //cw agreed grade deadine
+ if ($coursework->agreedgrademarkingdeadline && $coursework->numberofmarkers > 1) {
+ // Update
+ coursework_update_events($coursework, 'agreedgradingdue'); // Cw agreed grade deadine
} else {
- //remove it
- remove_event($coursework,'agreedgradingdue' );
+ // Remove it
+ remove_event($coursework, 'agreedgradingdue' );
}
} else {
- // remove all deadline events for this coursework regardless the type
+ // Remove all deadline events for this coursework regardless the type
remove_event($coursework);
}
@@ -532,64 +522,63 @@ function coursework_update_instance($coursework) {
*
* @param $coursework
*/
- function coursework_update_events($coursework, $eventtype){
+ function coursework_update_events($coursework, $eventtype) {
global $DB;
$event = "";
- $eventid = $DB->get_record('event', array('modulename'=>'coursework', 'instance'=>$coursework->id, 'eventtype'=>$eventtype));
+ $eventid = $DB->get_record('event', array('modulename' => 'coursework', 'instance' => $coursework->id, 'eventtype' => $eventtype));
- if ($eventid){
+ if ($eventid) {
$event = calendar_event::load($eventid->id);
}
- // update/create event for coursework deadline [due]
+ // Update/create event for coursework deadline [due]
if ($eventtype == 'due') {
$data = coursework_event($coursework, $coursework->intro, $coursework->id, $eventtype, $coursework->deadline);
if ($event) {
$event->update($data); //update if event exists
} else {
- calendar_event::create($data); //create new event as it doesn't exist
+ calendar_event::create($data); // Create new event as it doesn't exist
}
}
- // update/create event for coursework initialmarking deadline [initialgradingdue]
- if ($eventtype == 'initialgradingdue'){
- $data = coursework_event($coursework, $coursework->intro, $coursework->id,$eventtype, $coursework->initialmarkingdeadline);
+ // Update/create event for coursework initialmarking deadline [initialgradingdue]
+ if ($eventtype == 'initialgradingdue') {
+ $data = coursework_event($coursework, $coursework->intro, $coursework->id, $eventtype, $coursework->initialmarkingdeadline);
if ($event) {
$event->update($data); //update if event exists
} else {
- calendar_event::create($data); //create new event as it doesn't exist
+ calendar_event::create($data); // Create new event as it doesn't exist
}
}
- // update/create event for coursework agreedgrademarking deadline [agreedgradingdue]
- if ($eventtype == 'agreedgradingdue'){
+ // Update/create event for coursework agreedgrademarking deadline [agreedgradingdue]
+ if ($eventtype == 'agreedgradingdue') {
$data = coursework_event($coursework, $coursework->intro, $coursework->id, $eventtype, $coursework->agreedgrademarkingdeadline);
if ($event) {
$event->update($data); //update if event exists
} else {
- calendar_event::create($data); //create new event as it doesn't exist
+ calendar_event::create($data); // Create new event as it doesn't exist
}
}
}
-function remove_event($coursework, $eventtype = false){
+function remove_event($coursework, $eventtype = false) {
global $DB;
- $params = array('modulename'=>'coursework', 'instance'=>$coursework->id);
+ $params = array('modulename' => 'coursework', 'instance' => $coursework->id);
- if ($eventtype){
+ if ($eventtype) {
$params['eventtype'] = $eventtype;
}
$events = $DB->get_records('event', $params);
- foreach($events as $eventid) {
+ foreach ($events as $eventid) {
$event = calendar_event::load($eventid->id);
$event->delete(); // delete events from mdl_event table
}
}
-
/**
* Given an ID of an instance of this module,
* this function will permanently delete the instance
@@ -713,7 +702,7 @@ function coursework_scale_used($courseworkid, $scaleid) {
$params = array('grade' => $scaleid,
'id' => $courseworkid);
- if ($scaleid and $DB->record_exists('coursework', $params)) {
+ if ($scaleid && $DB->record_exists('coursework', $params)) {
return true;
} else {
return false;
@@ -731,7 +720,7 @@ function coursework_scale_used($courseworkid, $scaleid) {
function coursework_scale_used_anywhere($scaleid) {
global $DB;
- if ($scaleid and $DB->record_exists('coursework', array('grade' => $scaleid))) {
+ if ($scaleid && $DB->record_exists('coursework', array('grade' => $scaleid))) {
return true;
} else {
return false;
@@ -777,7 +766,6 @@ function coursework_supports($feature) {
}
}
-
/**
* Checks whether the student with the given username has been flagged
* as having a disability
@@ -896,11 +884,10 @@ function coursework_extend_settings_navigation(settings_navigation $settings, na
($coursework->allocation_enabled() || $coursework->sampling_enabled())) {
$link = new moodle_url('/mod/coursework/actions/allocate.php', array('id' => $cm->id));
- $lang_str = ($coursework->moderation_agreement_enabled())? 'allocateassessorsandmoderators':'allocateassessors';
+ $lang_str = ($coursework->moderation_agreement_enabled()) ? 'allocateassessorsandmoderators' : 'allocateassessors';
$navref->add(get_string($lang_str, 'mod_coursework'), $link, navigation_node::TYPE_SETTING);
}
-
// Link to personal deadlines screen
if (has_capability('mod/coursework:editpersonaldeadline', $context) && ($coursework->personal_deadlines_enabled())) {
$link = new moodle_url('/mod/coursework/actions/set_personal_deadlines.php', array('id' => $cm->id));
@@ -909,7 +896,6 @@ function coursework_extend_settings_navigation(settings_navigation $settings, na
}
-
/**
* Auto-allocates after a new student or teacher is added to a coursework.
*
@@ -919,12 +905,12 @@ function coursework_extend_settings_navigation(settings_navigation $settings, na
function coursework_role_assigned_event_handler($roleassignment) {
global $DB;
-// return true; // Until we fix the auto allocator. The stuff below causes an infinite loop.
+// return true; // Until we fix the auto allocator. The stuff below causes an infinite loop.
$courseworkids = coursework_get_coursework_ids_from_context_id($roleassignment->contextid);
foreach ($courseworkids as $courseworkid) {
- $DB->set_field('coursework','processenrol',1,array('id'=>$courseworkid));
+ $DB->set_field('coursework', 'processenrol', 1, array('id' => $courseworkid));
}
return true;
@@ -945,7 +931,7 @@ function coursework_role_unassigned_event_handler($roleassignment) {
$courseworkids = coursework_get_coursework_ids_from_context_id($roleassignment->contextid);
foreach ($courseworkids as $courseworkid) {
- $DB->set_field('coursework','processunenrol',1,array('id'=>$courseworkid));
+ $DB->set_field('coursework', 'processunenrol', 1, array('id' => $courseworkid));
}
return true;
@@ -962,7 +948,7 @@ function coursework_get_coursework_ids_from_context_id($contextid) {
global $DB;
- $courseworkids = array();
+ $courseworkids = [];
// Is this a coursework?
$context = context::instance_by_id($contextid);
@@ -1012,7 +998,7 @@ function coursework_seconds_to_string($seconds) {
get_string('seconds', 'mod_coursework'))
);
- $result = array();
+ $result = [];
foreach ($units as $divisor => $unitame) {
$units = intval($seconds / $divisor);
if ($units) {
@@ -1121,29 +1107,28 @@ function coursework_send_deadline_changed_emails($eventdata) {
// Now we need a decent message that provides the relevant data and notifies what changed.
// - Submissions deadline if it's in the future and the user has not already submitted.
- // - Feedback deadline if it's in the future and the student's personal deadline for feedback has
- // not passed.
+ // - Feedback deadline if it's in the future and the student's personal deadline for feedback has not passed.
// - Link to get to the view.php page.
// - Change since last time.
- $deadlinechangedmessage = array();
+ $deadlinechangedmessage = [];
$strings = new stdClass();
$strings->courseworkname = $coursework->name;
if ($submissionsdeadlinechanged) {
$strings->typeofdeadline = strtolower(get_string('submission', 'mod_coursework'));
- $strings->deadline = userdate($coursework->deadline,'%a, %d %b %Y, %H:%M');
+ $strings->deadline = userdate($coursework->deadline, '%a, %d %b %Y, %H:%M');
$deadlinechangedmessage[] = get_string('deadlinechanged', 'mod_coursework', $strings);
}
if ($generaldeadlinechanged) {
$strings->typeofdeadline = strtolower(get_string('generalfeedback', 'mod_coursework'));
- $strings->deadline = userdate($coursework->generalfeedback,'%a, %d %b %Y, %H:%M');
+ $strings->deadline = userdate($coursework->generalfeedback, '%a, %d %b %Y, %H:%M');
$deadlinechangedmessage[] = get_string('deadlinechanged', 'mod_coursework', $strings);
}
if ($individualdeadlinechanged) {
$strings->typeofdeadline = strtolower(get_string('individualfeedback', 'mod_coursework'));
- $strings->deadline = userdate($userreleasedate,'%a, %d %b %Y, %H:%M');
+ $strings->deadline = userdate($userreleasedate, '%a, %d %b %Y, %H:%M');
$deadlinechangedmessage[] = get_string('deadlinechanged', 'mod_coursework', $strings);
}
@@ -1184,7 +1169,7 @@ function coursework_plugin_exists($plugintype, $pluginname) {
*/
function coursework_records_to_menu($records, $field1, $field2) {
- $menu = array();
+ $menu = [];
if (!empty($records)) {
foreach ($records as $record) {
@@ -1195,7 +1180,6 @@ function coursework_records_to_menu($records, $field1, $field2) {
}
-
/**
* Custom error handler for ADODB used by the sits class. Came with no docs so not sure what it's for.
* Set as error handler at top of sits class file. Suspect it suppresses errors.
@@ -1249,7 +1233,6 @@ function mod_coursework_supports($feature) {
}
}
-
/**
* @param $event_data
* @return bool
@@ -1288,32 +1271,31 @@ function course_group_member_added($event_data) {
$addeduserid = $event_data->relateduserid;
// get all courseworks with group_assessor allocation strategy
- $courseworks = $DB->get_records('coursework', array('course'=>$courseid, 'assessorallocationstrategy' => 'group_assessor'));
+ $courseworks = $DB->get_records('coursework', array('course' => $courseid, 'assessorallocationstrategy' => 'group_assessor'));
- foreach($courseworks as $coursework){
+ foreach ($courseworks as $coursework) {
$coursework = coursework::find($coursework);
$stage = $coursework->marking_stages();
$stage_1 = $stage['assessor_1']; // this allocation is only for 1st stage, we don't touch other stages
-
$student = $coursework->can_submit(); // check if user is student in this course
$initial_stage_assessor = has_capability('mod/coursework:addinitialgrade', $coursework->get_context(), $addeduserid); // check if user is initial stage assessor in this course
- if($initial_stage_assessor){
+ if ($initial_stage_assessor) {
// check if any assessor already exists in the group except currently added one
$assessors_in_group = get_enrolled_users($coursework->get_context(), 'mod/coursework:addinitialgrade', $groupid);
- unset($assessors_in_group[$addeduserid]); //remove added assessor as at this point they will be already in the group
+ unset($assessors_in_group[$addeduserid]); // Remove added assessor as at this point they will be already in the group
- if ($assessors_in_group){//yes - do nothing as other assessor is already assigned to group members, return true
+ if ($assessors_in_group) {//yes - do nothing as other assessor is already assigned to group members, return true
break;
- } else{ //no - check if CW is a group coursework
- if($coursework->is_configured_to_have_group_submissions()){// yes - assign the tutor to a allocatable group
+ } else { // No - check if CW is a group coursework
+ if ($coursework->is_configured_to_have_group_submissions()) {// yes - assign the tutor to a allocatable group
$stage_1->make_auto_allocation_if_necessary(group::find($groupid));
} else { // no, check if group has any student members
$allocatables = $coursework->get_allocatables();
- if ($allocatables){
+ if ($allocatables) {
// yes - assign this assessor to every allocatable student in the appropriate course group - at this point assessor should already be a member
- foreach($allocatables as $allocatable) {
+ foreach ($allocatables as $allocatable) {
// process students allocations
if ($coursework->student_is_in_any_group($allocatable)) { // student must belong to a group
$stage_1->make_auto_allocation_if_necessary($allocatable);
@@ -1324,8 +1306,8 @@ function course_group_member_added($event_data) {
}
}
}
- } else if($student) {
- if($coursework->is_configured_to_have_group_submissions()) {
+ } else if ($student) {
+ if ($coursework->is_configured_to_have_group_submissions()) {
$allocatable = group::find($groupid);
} else {
$allocatable = user::find($addeduserid);
@@ -1337,7 +1319,6 @@ function course_group_member_added($event_data) {
return true;
}
-
/**
* * Function to process allocation of new group members (student/group - assign to a group assessor or assessor - assign to students/group) when a group member is deleted
*
@@ -1354,9 +1335,9 @@ function course_group_member_removed($event_data) {
$removeduserid = $event_data->relateduserid;
// get all courseworks with group_assessor allocation strategy
- $courseworks = $DB->get_records('coursework', array('course'=>$courseid, 'assessorallocationstrategy' => 'group_assessor'));
+ $courseworks = $DB->get_records('coursework', array('course' => $courseid, 'assessorallocationstrategy' => 'group_assessor'));
- foreach($courseworks as $coursework){
+ foreach ($courseworks as $coursework) {
$coursework = coursework::find($coursework);
$stage = $coursework->marking_stages();
@@ -1365,17 +1346,17 @@ function course_group_member_removed($event_data) {
$student = $coursework->can_submit(); // check if user is student in this course
$initial_stage_assessor = has_capability('mod/coursework:addinitialgrade', $coursework->get_context(), $removeduserid); // check if user was initial stage assessor in this course
- if($initial_stage_assessor){
+ if ($initial_stage_assessor) {
// remove all assessor allocations for this group
- if($coursework->is_configured_to_have_group_submissions()) {
+ if ($coursework->is_configured_to_have_group_submissions()) {
if (can_delete_allocation($coursework->id(), $groupid)) {
$DB->delete_records('coursework_allocation_pairs', array('courseworkid' => $coursework->id(), 'assessorid' => $removeduserid, 'allocatableid' => $groupid, 'stage_identifier' => 'assessor_1'));
}
} else {
// find all individual students in the group
- $students = get_enrolled_users($coursework->get_context(), 'mod/coursework:submit', $groupid);
- if ($students){
- foreach($students as $student){
+ $students = get_enrolled_users($coursework->get_context(), 'mod/coursework:submit', $groupid);
+ if ($students) {
+ foreach ($students as $student) {
if (can_delete_allocation($coursework->id(), $student->id)) {
$DB->delete_records('coursework_allocation_pairs', array('courseworkid' => $coursework->id(), 'assessorid' => $removeduserid, 'allocatableid' => $student->id, 'stage_identifier' => 'assessor_1'));
}
@@ -1388,8 +1369,8 @@ function course_group_member_removed($event_data) {
// check if there are any other assessor in the group, at this point the removed member should no longer be in the group
$assessors_in_group = get_enrolled_users($coursework->get_context(), 'mod/coursework:addinitialgrade', $groupid);
- if($assessors_in_group) { // if another assessor found, assign all allocatables in this group to the other assessor
- if($coursework->is_configured_to_have_group_submissions()){// yes - assign the assessor to a allocatable group
+ if ($assessors_in_group) { // if another assessor found, assign all allocatables in this group to the other assessor
+ if ($coursework->is_configured_to_have_group_submissions()) {// yes - assign the assessor to a allocatable group
$stage_1->make_auto_allocation_if_necessary(group::find($groupid));
} else {
$allocatables = $coursework->get_allocatables();
@@ -1403,10 +1384,10 @@ function course_group_member_removed($event_data) {
continue;
}
}
- } else{
+ } else {
continue;
}
- } else if($student) {
+ } else if ($student) {
if ($coursework->is_configured_to_have_group_submissions()) {
// check if student was the only student member in the group
$students = get_enrolled_users($coursework->get_context(), 'mod/coursework:submit', $groupid); // at this point student should be already removed from the group
@@ -1418,7 +1399,7 @@ function course_group_member_removed($event_data) {
}
} else {
- //if individual coursework
+ // If individual coursework
$allocatableid = $removeduserid;
}
@@ -1438,7 +1419,6 @@ function course_group_member_removed($event_data) {
return true;
}
-
/**
* Function to check the allocation if it is not pinned or its submission has not been marked yet
*
@@ -1454,7 +1434,7 @@ function can_delete_allocation($courseworkid, $allocatableid) {
$ungraded_allocations = $DB->get_record_sql("SELECT *
FROM {coursework_allocation_pairs} p
WHERE courseworkid = :courseworkid
- AND p.manual = 0
+ AND p.manual = 0
AND stage_identifier = 'assessor_1'
AND allocatableid = :allocatableid
AND NOT EXISTS (SELECT 1
@@ -1486,7 +1466,7 @@ function plagiarism_similarity_information($course_module) {
/**
* @return bool
*/
-function has_user_seen_tii_EULA_agreement(){
+function has_user_seen_tii_EULA_agreement() {
global $CFG, $DB, $USER;
// if TII plagiarism enabled check if user agreed/disagreed EULA
@@ -1495,7 +1475,7 @@ function has_user_seen_tii_EULA_agreement(){
$plagiarismsettings = (array)get_config('plagiarism_turnitin');
if (!empty($plagiarismsettings['enabled'])) {
- if ($DB->get_manager()->table_exists('plagiarism_turnitin_users')){
+ if ($DB->get_manager()->table_exists('plagiarism_turnitin_users')) {
$sql = "SELECT * FROM {plagiarism_turnitin_users}
WHERE userid = :userid
AND user_agreement_accepted <> 0";
@@ -1505,9 +1485,9 @@ function has_user_seen_tii_EULA_agreement(){
AND user_agreement_accepted <> 0";
}
- $shouldseeEULA = $DB->record_exists_sql($sql, array('userid'=>$USER->id));
+ $shouldseeEULA = $DB->record_exists_sql($sql, array('userid' => $USER->id));
}
- } else {
+ } else {
$shouldseeEULA = true;
}
return $shouldseeEULA;
@@ -1517,11 +1497,11 @@ function coursework_is_ulcc_digest_coursework_plugin_installed() {
global $DB;
- $pluginexists = false;
- $disgestblockexists = $DB->record_exists_sql("SELECT id FROM {block} WHERE name = 'ulcc_digest' AND visible = 1");
+ $pluginexists = false;
+ $disgestblockexists = $DB->record_exists_sql("SELECT id FROM {block} WHERE name = 'ulcc_digest' AND visible = 1");
if (!empty($disgestblockexists)) {
- $pluginexists = ($DB->get_records('block_ulcc_digest_plgs',array('module'=>'coursework','status'=>1))) ? true : false;
+ $pluginexists = $DB->record_exists('block_ulcc_digest_plgs', array('module' => 'coursework', 'status' => 1));
}
return $pluginexists;
@@ -1531,15 +1511,15 @@ function coursework_is_ulcc_digest_coursework_plugin_installed() {
* @param $courseworkid
* @return bool
*/
-function coursework_personal_deadline_passed($courseworkid){
+function coursework_personal_deadline_passed($courseworkid) {
global $DB;
- $sql = "SELECT *
+ $sql = "SELECT *
FROM {coursework_person_deadlines}
WHERE courseworkid = :courseworkid
AND personal_deadline < :now";
- return $DB->record_exists_sql($sql, array('courseworkid' =>$courseworkid , 'now' => time()));
+ return $DB->record_exists_sql($sql, array('courseworkid' => $courseworkid, 'now' => time()));
}
@@ -1551,7 +1531,7 @@ function coursework_personal_deadline_passed($courseworkid){
* @param $deadline
* @return stdClass
*/
-function coursework_event($coursework, $description, $instance, $eventtype, $deadline){
+function coursework_event($coursework, $description, $instance, $eventtype, $deadline) {
$event = new stdClass();
$event->type = CALENDAR_EVENT_TYPE_ACTION;
@@ -1569,7 +1549,7 @@ function coursework_event($coursework, $description, $instance, $eventtype, $dea
$event->timesort = $deadline;
$event->visible = instance_is_visible('coursework', $coursework);
- /* if ($eventtype == 'initialgradingdue'){
+ /* if ($eventtype == 'initialgradingdue') {
$event->name .= " (Initial stage)";
} else if ($eventtype == 'agreedgradingdue') {
$event->name .= " (Agreed Grade stage)";
@@ -1584,7 +1564,7 @@ function coursework_event($coursework, $description, $instance, $eventtype, $dea
* @param $event_data
* @return bool
*/
-function teacher_allocation_cache_purge($event_data){
+function teacher_allocation_cache_purge($event_data) {
global $DB;
$roleid = $event_data->objectid;
@@ -1599,7 +1579,6 @@ function teacher_allocation_cache_purge($event_data){
return true;
}
-
/**
* Function to remove teacher allocation (also if pinned), don't remove if teacher already graded
*
@@ -1607,20 +1586,20 @@ function teacher_allocation_cache_purge($event_data){
* @return bool
* @throws dml_exception
*/
-function teacher_removed_allocated_not_graded($event_data){
+function teacher_removed_allocated_not_graded($event_data) {
global $DB;
$userid = $event_data->relateduserid;
$courseid = $event_data->courseid;
$courseworks = coursework_get_courseworks_by_courseid($courseid);
- foreach($courseworks as $cw){
+ foreach ($courseworks as $cw) {
$coursework = coursework::find($cw->id);
- if($coursework->allocation_enabled()){
- $assessor_allocations = $DB->get_records('coursework_allocation_pairs', array('courseworkid'=>$coursework->id,
- 'assessorid'=>$userid));
- foreach($assessor_allocations as $allocation){
- if($allocation->allocatabletype == 'user'){
+ if ($coursework->allocation_enabled()) {
+ $assessor_allocations = $DB->get_records('coursework_allocation_pairs', array('courseworkid' => $coursework->id,
+ 'assessorid' => $userid));
+ foreach ($assessor_allocations as $allocation) {
+ if ($allocation->allocatabletype == 'user') {
$allocatable = user::find($allocation->allocatableid);
} else {
$allocatable = group::find($allocation->allocatableid);
@@ -1628,13 +1607,13 @@ function teacher_removed_allocated_not_graded($event_data){
$submission = $coursework->get_allocatable_submission($allocatable);
// if assessor grade the submission already, skip it
- if($submission && $submission->has_specific_assessor_feedback($userid)){
+ if ($submission && $submission->has_specific_assessor_feedback($userid)) {
continue;
}
- $DB->delete_records('coursework_allocation_pairs', array('courseworkid'=>$coursework->id,
- 'assessorid'=>$userid,
- 'allocatableid'=>$allocatable->id));
+ $DB->delete_records('coursework_allocation_pairs', array('courseworkid' => $coursework->id,
+ 'assessorid' => $userid,
+ 'allocatableid' => $allocatable->id));
}
}
}
@@ -1649,9 +1628,9 @@ function teacher_removed_allocated_not_graded($event_data){
* @return array
* @throws dml_exception
*/
-function coursework_get_courseworks_by_courseid($courseid){
+function coursework_get_courseworks_by_courseid($courseid) {
global $DB;
- return $DB->get_records('coursework', array('course'=>$courseid));
+ return $DB->get_records('coursework', array('course' => $courseid));
}
diff --git a/mod_form.php b/mod_form.php
index 95e646d6..19201e1e 100644
--- a/mod_form.php
+++ b/mod_form.php
@@ -18,8 +18,7 @@
* The main coursework module configuration form. Presented to the user when they make a new
* instance of this module
*
- * @package mod
- * @subpackage coursework
+ * @package mod_coursework
* @copyright 2011 University of London Computer Centre {@link ulcc.ac.uk}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -55,7 +54,7 @@ public function definition() {
'ajax'
));
- $PAGE->requires->js_init_call('M.mod_coursework.init', array(), true, $module);
+ $PAGE->requires->js_init_call('M.mod_coursework.init', [], true, $module);
$this->set_form_attributes();
@@ -64,14 +63,12 @@ public function definition() {
$this->add_name_field();
$this->standard_intro_elements(get_string('description', 'coursework'));
-
$this->add_availability_header();
$this->add_start_date_field();
$this->add_submission_deadline_field();
$this->add_personal_deadline_field();
-
// if (coursework_is_ulcc_digest_coursework_plugin_installed()) {
$this->add_marking_deadline_field();
$this->add_initial_marking_deadline_field();
@@ -83,7 +80,6 @@ public function definition() {
$this->add_allow_early_finalisation_field();
$this->add_allow_late_submissions_field();
-
if (coursework_is_ulcc_digest_coursework_plugin_installed()) {
$this->add_digest_header();
$this->add_marking_reminder_warning();
@@ -91,7 +87,6 @@ public function definition() {
}
-
$this->add_submissions_header();
$this->add_turnitin_files_settings_waring();
@@ -124,7 +119,6 @@ public function definition() {
$this->add_enable_assessor_anonymity_field();
-
$this->add_feedback_header();
$this->add_general_feedback_release_date_field();
@@ -132,7 +126,6 @@ public function definition() {
$this->add_email_individual_feedback_notification_field();
$this->add_all_feedbacks_field();
-
$this->add_extensions_header();
$this->add_enable_extensions_field();
@@ -142,7 +135,6 @@ public function definition() {
$this->add_use_groups_field();
$this->add_grouping_field();
-
$this->standard_grading_coursemodule_elements();
$this->add_tweaks_to_standard_grading_form_elements();
@@ -151,7 +143,6 @@ public function definition() {
}
-
/**
* Adds all default data to the form elements.
*
@@ -198,9 +189,9 @@ public function set_data($default_values) {
*/
public function validation($data, $files) {
- $errors = array();
+ $errors = [];
- if ($data['startdate'] != 0 && !empty($data['deadline']) && $data['startdate'] > $data['deadline']){
+ if ($data['startdate'] != 0 && !empty($data['deadline']) && $data['startdate'] > $data['deadline']) {
$errors['startdate'] = get_string('must_be_before_dealdine', 'mod_coursework');
}
@@ -212,27 +203,27 @@ public function validation($data, $files) {
$errors['generalfeedback'] = get_string('must_be_after_dealdine', 'mod_coursework');
}
- if (isset($data['initialmarkingdeadline']) && $data['initialmarkingdeadline'] != 0 && !empty($data['deadline']) && $data['initialmarkingdeadline'] < $data['deadline']){
+ if (isset($data['initialmarkingdeadline']) && $data['initialmarkingdeadline'] != 0 && !empty($data['deadline']) && $data['initialmarkingdeadline'] < $data['deadline']) {
$errors['initialmarkingdeadline'] = get_string('must_be_after_dealdine', 'mod_coursework');
}
- if (isset($data['agreedgrademarkingdeadline']) && $data['agreedgrademarkingdeadline'] != 0 && !empty($data['deadline']) && $data['agreedgrademarkingdeadline'] < $data['deadline']){
+ if (isset($data['agreedgrademarkingdeadline']) && $data['agreedgrademarkingdeadline'] != 0 && !empty($data['deadline']) && $data['agreedgrademarkingdeadline'] < $data['deadline']) {
$errors['agreedgrademarkingdeadline'] = get_string('must_be_after_dealdine', 'mod_coursework');
}
- if (isset($data['agreedgrademarkingdeadline']) && $data['agreedgrademarkingdeadline'] != 0 && $data['agreedgrademarkingdeadline'] < $data['initialmarkingdeadline'] ){
+ if (isset($data['agreedgrademarkingdeadline']) && $data['agreedgrademarkingdeadline'] != 0 && $data['agreedgrademarkingdeadline'] < $data['initialmarkingdeadline'] ) {
$errors['agreedgrademarkingdeadline'] = get_string('must_be_after_initial_grade_dealdine', 'mod_coursework');
}
- if (isset($data['initialmarkingdeadline']) && $data['initialmarkingdeadline'] != 0 && !empty($data['deadline']) && $data['deadline'] && $data['initialmarkingdeadline'] < $data['deadline']){
+ if (isset($data['initialmarkingdeadline']) && $data['initialmarkingdeadline'] != 0 && !empty($data['deadline']) && $data['deadline'] && $data['initialmarkingdeadline'] < $data['deadline']) {
$errors['initialmarkingdeadline'] = get_string('must_be_after_dealdine', 'mod_coursework');
}
- if (isset($data['agreedgrademarkingdeadline']) && $data['agreedgrademarkingdeadline'] != 0 && !empty($data['deadline']) && $data['agreedgrademarkingdeadline'] < $data['deadline']){
+ if (isset($data['agreedgrademarkingdeadline']) && $data['agreedgrademarkingdeadline'] != 0 && !empty($data['deadline']) && $data['agreedgrademarkingdeadline'] < $data['deadline']) {
$errors['agreedgrademarkingdeadline'] = get_string('must_be_after_dealdine', 'mod_coursework');
}
- if (isset($data['agreedgrademarkingdeadline']) && $data['agreedgrademarkingdeadline'] != 0 && $data['agreedgrademarkingdeadline'] < $data['initialmarkingdeadline'] ){
+ if (isset($data['agreedgrademarkingdeadline']) && $data['agreedgrademarkingdeadline'] != 0 && $data['agreedgrademarkingdeadline'] < $data['initialmarkingdeadline'] ) {
$errors['agreedgrademarkingdeadline'] = get_string('must_be_after_initial_grade_dealdine', 'mod_coursework');
}
@@ -241,29 +232,23 @@ public function validation($data, $files) {
}
-
$courseworkid = $this->get_coursework_id();
if ($courseworkid) {
$coursework = mod_coursework\models\coursework::find($courseworkid);
- if ($coursework->has_samples() && isset($data['samplingenabled']) && $data['samplingenabled'] == 0){
+ if ($coursework->has_samples() && isset($data['samplingenabled']) && $data['samplingenabled'] == 0) {
$errors['samplingenabled'] = get_string('sampling_cant_be_disabled', 'mod_coursework');
}
}
- if ( isset($data['numberofmarkers']) && $data['numberofmarkers'] == 1 && isset($data['samplingenabled']) && $data['samplingenabled'] == 1){
+ if ( isset($data['numberofmarkers']) && $data['numberofmarkers'] == 1 && isset($data['samplingenabled']) && $data['samplingenabled'] == 1) {
$errors['numberofmarkers'] = get_string('not_enough_assessors_for_sampling', 'mod_coursework');
}
-
-
$parent_errors = parent::validation($data, $files);
return array_merge($errors, $parent_errors);
}
-
-
-
/**
* Get data from the form and manipulate it
* @return bool|object
@@ -272,15 +257,15 @@ function get_data() {
global $CFG;
$data = parent::get_data();
- if (!$data){
+ if (!$data) {
return false;
}
- if ($this->forceblindmarking() == 1){
+ if ($this->forceblindmarking() == 1) {
$data->blindmarking = $CFG->coursework_blindmarking;
}
- if($data->numberofmarkers >1){
+ if ($data->numberofmarkers > 1) {
$data->moderationagreementenabled = 0;
}
@@ -336,62 +321,55 @@ protected function add_submission_deadline_field() {
$moodle_form =& $this->_form;
- $default_timestamp = strtotime('+2 weeks');
- $disabled = true;
+ $default_timestamp = strtotime('+2 weeks');
+ $disabled = true;
- if (!empty($CFG->coursework_submission_deadline)) {
- $disabled = false;
+ if (!empty($CFG->coursework_submission_deadline)) {
+ $disabled = false;
- $default_timestamp =strtotime('today');
- if ($CFG->coursework_submission_deadline == 7 ) {
- $default_timestamp = strtotime('+1 weeks');
+ $default_timestamp = strtotime('today');
+ if ($CFG->coursework_submission_deadline == 7 ) {
+ $default_timestamp = strtotime('+1 weeks');
} else if ($CFG->coursework_submission_deadline == 14 ) {
- $default_timestamp = strtotime('+2 weeks');
+ $default_timestamp = strtotime('+2 weeks');
} else if ($CFG->coursework_submission_deadline == 31 ) {
- $default_timestamp = strtotime('+1 month');
+ $default_timestamp = strtotime('+1 month');
}
}
$optional = true;
$courseworkid = $this->get_coursework_id();
- if ($courseworkid){
- $coursework = mod_coursework\models\coursework::find($courseworkid);
- if($coursework->extension_exists()){
+ if ($courseworkid) {
+ $coursework = mod_coursework\models\coursework::find($courseworkid);
+ if ($coursework->extension_exists()) {
$optional = false;
}
}
-
$moodle_form->addElement('date_time_selector',
'deadline',
get_string('deadline', 'coursework'),
- array('optional' => $optional, 'disabled'=> $disabled));
-
-
+ array('optional' => $optional, 'disabled' => $disabled));
$moodle_form->addElement('html', '