Code style fixes (mostly white-space)

This commit is contained in:
PMKuipers 2023-09-08 12:47:29 +02:00
parent 5eacc6f68c
commit 9f8a87ac83
68 changed files with 720 additions and 709 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -196,4 +196,3 @@ export const Absolute = {
return eval(convertAllInStr(expression, "px", ctx));
}

View File

@ -83,8 +83,8 @@ class completionscanner {
* @return int[]
*/
private function filter_studentlist(array $studentlist) : array {
$course_students = courseinfo::get_course_students($this->courseid);
return array_intersect($studentlist, $course_students);
$coursestudents = courseinfo::get_course_students($this->courseid);
return array_intersect($studentlist, $coursestudents);
}
/**
@ -166,7 +166,9 @@ class completionscanner {
statistics are marred.
*/
// Get completion info.
$students = isset($studentlist) ? $this->filter_studentlist($studentlist) : courseinfo::get_course_students($this->courseid);
$students = isset($studentlist) ?
$this->filter_studentlist($studentlist) :
courseinfo::get_course_students($this->courseid);
$completed = 0;
$ungraded = 0;
$completedpass = 0;

View File

@ -489,11 +489,12 @@ class corecompletioninfo {
and we want to show similar behaviour. This happens when completion data is reset
in a module
*/
if(!$completion->is_complete() && in_array($gradecompletion, [COMPLETION_COMPLETE, COMPLETION_COMPLETE_PASS])) {
if ( !$completion->is_complete()
&&
in_array($gradecompletion, [COMPLETION_COMPLETE, COMPLETION_COMPLETE_PASS])) {
/* If a passing grade was provided, but the activity was not completed,
* most likely the completion data was erased.
*/
/*$completionstatus = COMPLETION_INCOMPLETE; */
if ( !is_null($cm->completiongradeitemnumber) || ($cm->completionpassgrade) ) {
// Show a warning if this activity has grade completions to help make sense of the completion.
@ -506,7 +507,9 @@ class corecompletioninfo {
$iinfo['status'] = self::completion_handle($data->completionstate);
// Re-evaluate the completed value, to make sure COMPLETE_FAIL doesn't creep in as completed.
if (($data->completionstate == COMPLETION_INCOMPLETE) || ($data->completionstate == COMPLETION_COMPLETE_FAIL)) {
if (($data->completionstate == COMPLETION_INCOMPLETE)
||
($data->completionstate == COMPLETION_COMPLETE_FAIL)) {
$iinfo['completed'] = false;
} else {
$iinfo['completed'] = true;
@ -542,8 +545,7 @@ class corecompletioninfo {
if ($completion->is_complete()) {
$progress += 1; // Add a point to the progress counter.
}
}
else {
} else {
if ($completion->is_complete()) {
$progress += 1; // Add a point to the progress counter.
}

View File

@ -444,8 +444,7 @@ class courseservice extends \external_api {
/**
* Scan criterium for progress statistics
* @param mixed $criteriaid Id of criterium
* @param mixed $studyplanid Id of studyplan relevant to this criteria
* @param mixed $courseid Id of course this cirteria is related to
* @param mixed $studyitemid Id of studyplan relevant to this criteria
* @return array
*/
public static function scan_completion_progress($criteriaid, $studyitemid) {

View File

@ -283,7 +283,7 @@ class bistate_aggregator extends \local_treestudyplan\aggregator {
} else {
return completion::INCOMPLETE;
}
} else { /* ALL (default) */
} else { /* default value of ALL */
if ( $total == $statecount[completion::EXCELLENT]) {
return completion::EXCELLENT;
} else if ( $total == ( $statecount[completion::EXCELLENT]

View File

@ -223,7 +223,7 @@ class core_aggregator extends \local_treestudyplan\aggregator {
} else {
return completion::INCOMPLETE;
}
} else { /* ALL (default) */
} else { /* default value of ALL */
if ( $total == $statecount[completion::EXCELLENT]) {
return completion::EXCELLENT;
} else if ( $total == ( $statecount[completion::EXCELLENT]

View File

@ -312,7 +312,7 @@ class period {
// Reload record after edit and ensure end dates of previous period are adjusted if needed.
$this->r = $DB->get_record(self::TABLE, ['id' => $this->id], "*", MUST_EXIST);
// Adjust end date of previous period if needed
// Adjust end date of previous period if needed.
if (isset($prev) && !empty($fields['startdate'])) {
$maxdate = $this->startdate()->sub(new DateInterval("P1D")); // Subtract 1 day, since periods include the end day.
$rqdate = $prev->enddate();
@ -321,7 +321,7 @@ class period {
}
}
// Adjust start date of next period if needed
// Adjust start date of next period if needed.
if (isset($next) && !empty($fields['enddate'])) {
$mindate = $this->enddate()->add(new DateInterval("P1D")); // Subtract 1 day, since periods include the end day.
$rqdate = $next->startdate();

View File

@ -1471,7 +1471,7 @@ class studyplanservice extends \external_api {
*/
public static function get_period($id) {
$p = period::find_by_id($id);
// Public data - no rights check needed
// Public data - no rights check needed.
\external_api::validate_context($p->page()->studyplan()->context());
return $p->model();
}

View File

@ -141,7 +141,12 @@ print $OUTPUT->header();
</div>
<div class='t-studyplan-container'>
<t-studyplan v-if='activestudyplan' v-model='activestudyplan' @moved="movedStudyplan" @toggletoolbox="toggletoolbox"></t-studyplan>
<t-studyplan
v-if='activestudyplan'
v-model='activestudyplan'
@moved="movedStudyplan"
@toggletoolbox="toggletoolbox"
></t-studyplan>
<div v-else-if='loadingstudyplan' class="spinner-border text-primary" role="status">
<span class="sr-only">Loading...</span>
</div>

12
lib.php
View File

@ -42,6 +42,10 @@ function local_treestudyplan_unit_get_editor_options(context $context) {
'trusttext' => 0];
}
/**
* Create primary navigation links for studyplan if needed
*/
function local_treestudyplan_autofill_customusermenuitems() {
if (get_config("local_treestudyplan", "primary_nav_autofill")) {
$lang = current_language();
@ -51,12 +55,12 @@ function local_treestudyplan_autofill_customusermenuitems() {
"/local/treestudyplan/edit-plan.php" => ["included" => false, "strkey" => "link_editplan"],
];
// Load the custom menu items from config
// Load the custom menu items from config.
$custommenuitems = get_config("core", "custommenuitems");
// Scan through all the lines to see if it is a link to one of our nav items in the current language.
$lines = explode("\n", $custommenuitems);
//debugging("\n\nLines: ". print_r($lines,true)."\n");
$links = array_keys($navitems);
foreach ($lines as $line) {
$parms = explode('|', $line);
@ -69,13 +73,13 @@ function local_treestudyplan_autofill_customusermenuitems() {
}
}
// List through all the links to see if we need to add one or more
// List through all the links to see if we need to add one or more.
foreach ($navitems as $link => $details) {
if (!$details["included"]) {
$line = implode("|", [
get_string($details["strkey"], "local_treestudyplan"), // Menu text.
$link, // Link.
'', // Tooltip,
'', // Tooltip.
$lang, // Language code.
" #Automatically added by studyplan plugin. See setting 'primary_nav_autofill' to disable this"
]);

View File

@ -42,7 +42,7 @@ if ($hassiteconfig) {
$page = new admin_settingpage('local_treestudyplan_settings',
get_string('settingspage', 'local_treestudyplan', null, true));
// NAVIGATION
// NAVIGATION.
$page->add(new admin_setting_heading('local_treestudyplan/navigation_heading',
get_string('setting_navigation_heading', 'local_treestudyplan'),
get_string('settingdesc_navigation_heading', 'local_treestudyplan')