Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctp 3558 coding standards 2 #1

Merged
merged 51 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
3f5f809
CTP-3558 coding std add file headers
watson8 Aug 12, 2024
f55e699
CTP-3558 coding std add eof newline
watson8 Aug 12, 2024
e3423e5
CTP-3558 coding std package coursework
watson8 Aug 12, 2024
1361ece
CTP-3558 coding std remove import leading backslash
watson8 Aug 12, 2024
b8b7196
CTP-3558 coding std remove space around =
watson8 Aug 12, 2024
ca700b6
CTP-3558 coding std insert space around =>
watson8 Aug 12, 2024
7ee19b8
CTP-3558 coding std remove spaces newline btwn ) {
watson8 Aug 12, 2024
2b3bb09
CTP-3558 coding std if( becomes if (
watson8 Aug 12, 2024
c0a3d48
CTP-3558 coding std insert space after comma
watson8 Aug 12, 2024
190e696
CTP-3558 coding std remove excess newlines
watson8 Aug 12, 2024
7b6cec1
CTP-3558 coding std insert space in ){
watson8 Aug 12, 2024
413fc13
CTP-3558 coding std insert space in for(
watson8 Aug 12, 2024
df24657
CTP-3558 coding std insert space in foreach(
watson8 Aug 12, 2024
50a35e3
CTP-3558 coding std insert space after comma
watson8 Aug 12, 2024
84f078f
CTP-3558 coding std insert space around =
watson8 Aug 12, 2024
4f3eef5
CTP-3558 coding std remove EOL whitespace
watson8 Aug 12, 2024
0725797
CTP-3558 coding std avoid IDE doc error
watson8 Aug 12, 2024
ab2ddcb
CTP-3558 coding std remove excess spaces
watson8 Aug 12, 2024
cbe073a
CTP-3558 coding std licence docs
watson8 Aug 12, 2024
a3eb417
CTP-3558 coding std insert space after comma
watson8 Aug 12, 2024
c11a298
CTP-3558 coding std insert spaces in comments
watson8 Aug 12, 2024
90ea671
CTP-3558 coding std short array syntax
watson8 Aug 12, 2024
78ff532
CTP-3558 coding std remove space before ;
watson8 Aug 12, 2024
5b0fdf9
CTP-3558 coding std correct commit 90ea671c
watson8 Aug 12, 2024
cc9818b
CTP-3558 coding std spaces around ? :
watson8 Aug 12, 2024
a225f2d
CTP-3558 coding std remove or operator
watson8 Aug 12, 2024
cf3a8ae
CTP-3558 coding std spaces around as
watson8 Aug 12, 2024
e9ed231
CTP-3558 coding std spaces after =>
watson8 Aug 12, 2024
09c778f
CTP-3558 coding std spaces around ? :
watson8 Aug 12, 2024
2c6d77f
CTP-3558 coding std spaces around .=
watson8 Aug 12, 2024
0a93e02
CTP-3558 coding std spaces around <=
watson8 Aug 12, 2024
0113d9c
CTP-3558 coding std sizeof() become count()
watson8 Aug 12, 2024
627b343
CTP-3558 coding std spaces around else
watson8 Aug 12, 2024
79e427a
CTP-3558 coding std spaces around ? :
watson8 Aug 12, 2024
892ae90
CTP-3558 coding std class opening {
watson8 Aug 12, 2024
b016577
CTP-3558 coding std spaces after "function "
watson8 Aug 12, 2024
169023b
CTP-3558 coding std spaces around ? :
watson8 Aug 12, 2024
83dc184
CTP-3558 coding std spaces around maths operators
watson8 Aug 12, 2024
0b91c6d
CTP-3558 coding std space before "function"
watson8 Aug 12, 2024
7cf6dc1
CTP-3558 coding std use self::
watson8 Aug 12, 2024
97d4d55
CTP-3558 coding std excess/missing spaces
watson8 Aug 12, 2024
05d266e
CTP-3558 coding std remove dupe lang str
watson8 Aug 12, 2024
080e31e
CTP-3558 coding std remove and operator
watson8 Aug 12, 2024
40feceb
CTP-3558 coding std more spaces
watson8 Aug 12, 2024
52edba7
CTP-3558 coding std renderer avoid $OUTPUT
watson8 Aug 12, 2024
8397a22
CTP-3558 coding std renderer avoid $PAGE
watson8 Aug 12, 2024
abb1eba
CTP-3558 coding std renderer avoid $OUTPUT 2
watson8 Aug 12, 2024
363b1f0
CTP-3558 coding std spaces
watson8 Aug 12, 2024
8ecc291
CTP-3558 coding std phpdocs
watson8 Aug 13, 2024
85758db
CTP-3558 coding std correct commit 2b3bb091 disabledif
watson8 Aug 13, 2024
fa1db75
CTP-3558 coding std PR comments
watson8 Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion actions/ajax/datatable/grading.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @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
*/

ob_start();
require_once(dirname(__FILE__) . '/../../../../../config.php');

Expand All @@ -14,7 +35,7 @@
$unallocated = optional_param('unallocated', false, PARAM_BOOL);

// Grading report display options.
$report_options = array();
$report_options = [];
if ($unallocated) {
$report_options['unallocated'] = true;
}
Expand Down
22 changes: 21 additions & 1 deletion actions/ajax/deadline_extension/edit.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @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(dirname(__FILE__) . '/../../../../../config.php');

Expand Down Expand Up @@ -29,4 +49,4 @@
$params['submissionid'] = $submissionid;
$params['name'] = $name;

$controller->ajax_edit_mitigation($params);
$controller->ajax_edit_mitigation($params);
22 changes: 21 additions & 1 deletion actions/ajax/deadline_extension/new.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @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(dirname(__FILE__) . '/../../../../../config.php');

Expand Down Expand Up @@ -29,4 +49,4 @@
$params['submissionid'] = $submissionid;
$params['name'] = $name;

$controller->ajax_new_mitigation($params);
$controller->ajax_new_mitigation($params);
20 changes: 20 additions & 0 deletions actions/ajax/deadline_extension/submit.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @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(dirname(__FILE__) . '/../../../../../config.php');

Expand Down
54 changes: 16 additions & 38 deletions actions/allocate.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +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
*/

use \mod_coursework\models\coursework;
use \mod_coursework\allocation\widget;
use mod_coursework\models\coursework;
use mod_coursework\allocation\widget;

require_once(dirname(__FILE__).'/../../../config.php');

Expand All @@ -46,12 +45,12 @@
$assessorallocationstrategy = optional_param('assessorallocationstrategy', false, PARAM_TEXT);

$moderationruletype = optional_param('addmodsetruletype', 0, PARAM_ALPHAEXT);
$deletemodsetrule = optional_param('delete-mod-set-rule', array(), PARAM_RAW) ;
$deletemodsetrule = optional_param('delete-mod-set-rule', [], PARAM_RAW);

// options used for pagination
// If a session variable holding page preference for the specific coursework is not set, set default value (0).
if (isset($SESSION->allocate_perpage[$coursemoduleid]) && (isset($SESSION->perpage[$coursemoduleid]) && optional_param('per_page', 0, PARAM_INT) != $SESSION->perpage[$coursemoduleid])
&& optional_param('per_page', 0, PARAM_INT) != 0){ // prevent blank pages if not in correct page
&& optional_param('per_page', 0, PARAM_INT) != 0) { // prevent blank pages if not in correct page
$page = 0;
$SESSION->allocate_page[$coursemoduleid] = $page;
} else if (!(isset($SESSION->allocate_page[$coursemoduleid]))) {
Expand All @@ -74,10 +73,10 @@
// SQL sort for allocation table.
$sortby = optional_param('sortby', '', PARAM_ALPHA);
$sorthow = optional_param('sorthow', '', PARAM_ALPHA);
$options = compact('sortby', 'sorthow','perpage','page');
$options = compact('sortby', 'sorthow', 'perpage', 'page');

// $_POST['allocatables'] comes as array of arrays which is not supported by optional_param_array, however we clean this later in process_data() function
$formdataarray = isset($_POST['allocatables']) ? $_POST['allocatables'] : array();
$formdataarray = isset($_POST['allocatables']) ? $_POST['allocatables'] : [];

require_login($course, true, $coursemodule);

Expand All @@ -102,18 +101,16 @@
'node-base')
);
$PAGE->requires->js_init_call('M.mod_coursework.init_allocate_page',
array('wwwroot'=>$CFG->wwwroot,'coursemoduleid'=>$coursemoduleid),
array('wwwroot' => $CFG->wwwroot, 'coursemoduleid' => $coursemoduleid),
false,
$jsmodule);

$PAGE->requires->string_for_js('sameassessorerror', 'coursework');



$allocationsmanager = $coursework->get_allocation_manager();
$allocationtable = new mod_coursework\allocation\table\builder($coursework, $options);
$allocationtable = new mod_coursework_allocation_table($allocationtable);
$pageurl = $PAGE->url;
$pageurl = $PAGE->url;

// 1. Save the rules and settings from the config bits.

Expand All @@ -129,8 +126,7 @@
$coursework->save();
}


if ($samplingformsavebutton) {
if ($samplingformsavebutton) {
if ($coursework->sampling_enabled()) {
$allocationsmanager->save_sample();
}
Expand All @@ -147,8 +143,6 @@
}
}



// 2. Process the manual allocations

// Did we just get the form submitted to us?
Expand All @@ -159,13 +153,8 @@
$allocationsmanager->auto_generate_sample_set();
}


// 3. Process the auto allocations to fill in the gaps.





// Get the data to render as a moderation set widget.
$allocationwidget = new widget($coursework);
$allocationwidget = new \mod_coursework_allocation_widget($allocationwidget);
Expand All @@ -179,22 +168,21 @@
*/
$page_renderer = $PAGE->get_renderer('mod_coursework', 'page');


$warnings = new \mod_coursework\warnings($coursework);

$percentage_allocation_not_complete = $warnings->percentage_allocations_not_complete();
$manual_allocation_not_complete = '';
$students_in_multiple_groups = '';
if ($coursework->allocation_enabled()){
if ($coursework->allocation_enabled()) {
$manual_allocation_not_complete = $warnings->manual_allocation_not_completed();
if ($coursework->use_groups == 1 || $coursework->assessorallocationstrategy == 'group_assessor') {
$students_in_multiple_groups = $warnings->students_in_mutiple_grouos();
}
}

if ($formsavebutton && $percentage_allocation_not_complete == '' && $manual_allocation_not_complete == ''){
redirect($CFG->wwwroot.'/mod/coursework/view.php?id='.$coursemoduleid, get_string('changessaved','mod_coursework'));
} elseif ($formsavebutton) {
if ($formsavebutton && $percentage_allocation_not_complete == '' && $manual_allocation_not_complete == '') {
redirect($CFG->wwwroot.'/mod/coursework/view.php?id='.$coursemoduleid, get_string('changessaved', 'mod_coursework'));
} else if ($formsavebutton) {
redirect($PAGE->url);
}

Expand All @@ -208,26 +196,19 @@
// Add coursework id etc.
echo \html_writer::input_hidden_params($PAGE->url);



if ($coursework->sampling_enabled()) { // Do not delete yet - refactoring...
if ($coursework->sampling_enabled()) { // Do not delete yet - refactoring...
echo \html_writer::start_tag('form', array('id' => 'sampling_form',
'method' => 'post'));
$samplesetwidget = $allocationsmanager->get_sampling_set_widget();
echo $object_renderer->render($samplesetwidget);
echo html_writer::end_tag('form');
}





// Start form. The page has now been broken into two forms sampling section and allocation section
// Open form tag.
echo \html_writer::start_tag('form', array('id' => 'allocation_form',
'method' => 'post'));


if ($coursework->allocation_enabled()) {
echo $object_renderer->render($allocationwidget);
}
Expand All @@ -239,9 +220,8 @@
echo html_writer::start_tag('div', $attributes);
echo html_writer::end_tag('div');


echo html_writer::tag('h3', get_string('assessormoderatorgrades', 'mod_coursework'));
echo html_writer::tag('div', get_string('pininfo', 'mod_coursework'), array('class'=>'pininfo'));
echo html_writer::tag('div', get_string('pininfo', 'mod_coursework'), array('class' => 'pininfo'));

// Start the form with save button.
/*
Expand All @@ -256,6 +236,4 @@

echo html_writer::end_tag('form');



echo $OUTPUT->footer();
68 changes: 43 additions & 25 deletions actions/allocationsession.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,60 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @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("../../../config.php");

global $SESSION;


$assesorselect = required_param_array('assesorselect',PARAM_RAW);
$assesorselectvalue = required_param_array('assesorselectvalue',PARAM_RAW);
$pinnedchk = optional_param_array('pinned',array(),PARAM_RAW);
$pinnedchkval = optional_param_array('pinnedvalue',array(),PARAM_RAW);
$moderatorselect = optional_param_array('moderatorselect',array(),PARAM_RAW);
$moderatorselectvalue = optional_param_array('moderatorselectvalue',array(),PARAM_RAW);
$samplechk = optional_param_array('sample',array(),PARAM_RAW);
$samplechkvalue = optional_param_array('samplevalue',array(),PARAM_RAW);
$coursemoduleid = required_param('coursemoduleid', PARAM_INT);

if (!isset($SESSION->coursework_allocationsessions)) {
$SESSION->coursework_allocationsessions = array();
$assesorselect = required_param_array('assesorselect', PARAM_RAW);
$assesorselectvalue = required_param_array('assesorselectvalue', PARAM_RAW);
$pinnedchk = optional_param_array('pinned', [], PARAM_RAW);
$pinnedchkval = optional_param_array('pinnedvalue', [], PARAM_RAW);
$moderatorselect = optional_param_array('moderatorselect', [], PARAM_RAW);
$moderatorselectvalue = optional_param_array('moderatorselectvalue', [], PARAM_RAW);
$samplechk = optional_param_array('sample', [], PARAM_RAW);
$samplechkvalue = optional_param_array('samplevalue', [], PARAM_RAW);
$coursemoduleid = required_param('coursemoduleid', PARAM_INT);

if (!isset($SESSION->coursework_allocationsessions)) {
$SESSION->coursework_allocationsessions = [];
}

if (!isset($SESSION->coursework_allocationsessions[$coursemoduleid])) {
$SESSION->coursework_allocationsessions[$coursemoduleid] = array();
if (!isset($SESSION->coursework_allocationsessions[$coursemoduleid])) {
$SESSION->coursework_allocationsessions[$coursemoduleid] = [];
}



for($i = 0; $i < count($assesorselect); $i++) {
$SESSION->coursework_allocationsessions[$coursemoduleid][$assesorselect[$i]] = $assesorselectvalue[$i];
for ($i = 0; $i < count($assesorselect); $i++) {
$SESSION->coursework_allocationsessions[$coursemoduleid][$assesorselect[$i]] = $assesorselectvalue[$i];
}

for($i = 0; $i < count($pinnedchk); $i++) {
$SESSION->coursework_allocationsessions[$coursemoduleid][$pinnedchk[$i]] = $pinnedchkval[$i];
for ($i = 0; $i < count($pinnedchk); $i++) {
$SESSION->coursework_allocationsessions[$coursemoduleid][$pinnedchk[$i]] = $pinnedchkval[$i];
}

for($i = 0; $i < count($moderatorselect); $i++) {
$SESSION->coursework_allocationsessions[$coursemoduleid][$moderatorselect[$i]] = $moderatorselectvalue[$i];
for ($i = 0; $i < count($moderatorselect); $i++) {
$SESSION->coursework_allocationsessions[$coursemoduleid][$moderatorselect[$i]] = $moderatorselectvalue[$i];
}

for($i = 0; $i < count($samplechk); $i++) {
$SESSION->coursework_allocationsessions[$coursemoduleid][$samplechk[$i]] = $samplechkvalue[$i];
for ($i = 0; $i < count($samplechk); $i++) {
$SESSION->coursework_allocationsessions[$coursemoduleid][$samplechk[$i]] = $samplechkvalue[$i];
}

Loading
Loading