Skip to content

Commit

Permalink
Code checker fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnOLane committed Jul 16, 2024
1 parent 4338538 commit d232016
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
25 changes: 12 additions & 13 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public function render_scheduler_student_list(scheduler_student_list $studentlis
$checkbox3 = '';
if ($studentlist->checkboxname) {
if ($student->editattended) {
// ADDED.
// ADDED.
if ($studentlist->checkboxdisable) {
$checkbox = html_writer::start_tag('span', array("data-toggle" => "tooltip", "title" => "Present"));
$checkbox .= html_writer::checkbox(
Expand All @@ -587,7 +587,7 @@ public function render_scheduler_student_list(scheduler_student_list $studentlis
);
$checkbox .= html_writer::end_tag('span');

$checkbox2 = html_writer::start_tag('span', array("data-toggle"=>"tooltip", "title"=>"Absent"));
$checkbox2 = html_writer::start_tag('span', array("data-toggle => "tooltip", "title" => "Absent"));
$checkbox2 .= html_writer::checkbox(
$studentlist->checkboxname2,
$student->entryid,
Expand All @@ -597,7 +597,7 @@ public function render_scheduler_student_list(scheduler_student_list $studentlis
);
$checkbox2 .= html_writer::end_tag('span');

$checkbox3 = html_writer::start_tag('span', array("data-toggle"=>"tooltip", "title"=>"Absent Reschedule"));
$checkbox3 = html_writer::start_tag('span', array("data-toggle" => "tooltip", "title" => "Absent Reschedule"));
$checkbox3 .= html_writer::checkbox(
$studentlist->checkboxname3,
$student->entryid,
Expand All @@ -607,7 +607,7 @@ public function render_scheduler_student_list(scheduler_student_list $studentlis
);
$checkbox3 .= html_writer::end_tag('span');
} else {
$checkbox = html_writer::start_tag('span', array("data-toggle"=>"tooltip", "title"=>"Present"));
$checkbox = html_writer::start_tag('span', array("data-toggle" => "tooltip", "title" => "Present"));
$checkbox .= html_writer::checkbox(
$studentlist->checkboxname,
$student->entryid,
Expand All @@ -617,7 +617,7 @@ public function render_scheduler_student_list(scheduler_student_list $studentlis
);
$checkbox .= html_writer::end_tag('span');

$checkbox2 = html_writer::start_tag('span', array("data-toggle"=>"tooltip", "title"=>"Absent"));
$checkbox2 = html_writer::start_tag('span', array("data-toggle" => "tooltip", "title" => "Absent"));
$checkbox2 .= html_writer::checkbox(
$studentlist->checkboxname2,
$student->entryid,
Expand All @@ -627,13 +627,13 @@ public function render_scheduler_student_list(scheduler_student_list $studentlis
);
$checkbox2 .= html_writer::end_tag('span');

$checkbox3 = html_writer::start_tag('span', array("data-toggle"=>"tooltip", "title"=>"Absent Reschedule"));
$checkbox3 = html_writer::start_tag('span', array("data-toggle" => "tooltip", "title" => "Absent Reschedule"));
$checkbox3 .= html_writer::checkbox(
$studentlist->checkboxname3,
$student->entryid,
$student->checkedabsentschedule,
'AR',
['class' => 'absentschedule', 'disabled'=>'disabled']
['class' => 'absentschedule', 'disabled' => 'disabled']
);
$checkbox3 .= html_writer::end_tag('span');
}
Expand Down Expand Up @@ -671,7 +671,9 @@ public function render_scheduler_student_list(scheduler_student_list $studentlis
if ($studentlist->showgrades && $student->grade) {
$grade = $this->format_grade($studentlist->scheduler, $student->grade, true);
}
$o .= html_writer::div($checkbox . $checkbox2 . $checkbox3 . $picture . ' ' . $name . $studicons . ' ' . $grade, $class);
$o .= html_writer::div(
$checkbox . $checkbox2 . $checkbox3 . $picture . ' ' . $name . $studicons . ' ' . $grade, $class
);
}

if ($editable) {
Expand Down Expand Up @@ -712,8 +714,6 @@ public function render_scheduler_slot_booker(scheduler_slot_booker $booker) {
$canappoint = false;

foreach ($booker->slots as $slot) {


$rowdata = array();

$startdate = $this->userdate($slot->starttime);
Expand Down Expand Up @@ -832,12 +832,11 @@ public function render_scheduler_slot_manager(scheduler_slot_manager $slotman) {

$rowdata = array();

$selectbox="";
$selectbox = "";
if ($slot->canadd || $slot->candelete) {
$selectbox = html_writer::checkbox('selectedslot[]', $slot->slotid, false, '', array('class' => 'slotselect'));
}
$rowdata[] = $slot->editable ? $selectbox : '';

$rowdata[] = $slot->editable ? $selectbox : '';

$startdate = $this->userdate($slot->starttime);
$starttime = $this->usertime($slot->starttime);
Expand Down
23 changes: 10 additions & 13 deletions teacherview.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ function scheduler_action_doaddsession($scheduler, $formdata, moodle_url $return
$slot->timemodified = time();



for ($d = 0; $d <= $fordays; $d ++) {
$starttime = $startfrom + ($d * DAYSECS);
$eventdate = usergetdate($starttime);
Expand All @@ -82,17 +81,15 @@ function scheduler_action_doaddsession($scheduler, $formdata, moodle_url $return
// URCOURSES HACK.
// Check if date matches any included in cancel dates file.
$createslot = true;
if ($canceldates != false){



if( in_array($eventdate['year'].'/'.sprintf("%02d",$eventdate['mon']).'/'.sprintf("%02d",$eventdate['mday']), $canceldates)){
if ($canceldates != false) {
$needle = $eventdate['year'].'/'.sprintf("%02d",$eventdate['mon']).'/'.sprintf("%02d",$eventdate['mday']);
if (in_array($needle, $canceldates)) {
$createslot = false;
}
}

if($createslot){
//END of HACK
if ($createslot) {
// END of HACK.
// This corrects around midnight bug.
if ($data->timestart > $data->timeend) {
$data->timeend += DAYSECS;
Expand Down Expand Up @@ -147,7 +144,7 @@ function scheduler_action_doaddsession($scheduler, $formdata, moodle_url $return
\mod_scheduler\event\slot_added::create_from_slot($slotobj)->trigger();
$countslots++;

//URCOURSE HACK LEFT OFF HERE MUST TEST
// URCOURSE HACK LEFT OFF HERE MUST TEST.
for ($i = 0; $i < $data->appointment_repeats; $i++) {
if (property_exists($data, 'studentid') && $data->studentid[$i] > 0) {

Expand Down Expand Up @@ -184,7 +181,7 @@ function scheduler_action_doaddsession($scheduler, $formdata, moodle_url $return
}
}
}
//END OF HACK
// END OF HACK
}
$slot->starttime += ($slot->duration + $data->break) * 60;
$data->timestart += ($slot->duration + $data->break) * 60;
Expand Down Expand Up @@ -315,7 +312,7 @@ function scheduler_action_delete_slots(array $slots, $action, moodle_url $return
foreach ($slot->get_appointments() as $app) {
$permissions->ensure($permissions->can_edit_attended($app));
$app->attended = (in_array($app->id, $seen)) ? 1 : 0;
$app->absentpaid = 0;
$app->absentpaid = 0;
$app->absentschedule = 0;
$app->timemodified = time();
}
Expand All @@ -333,8 +330,8 @@ function scheduler_action_delete_slots(array $slots, $action, moodle_url $return
if (is_array($absentpaid)) {
foreach ($slot->get_appointments() as $app) {
$app->absentpaid = (in_array($app->id, $absentpaid)) ? 1 : 0;
$app->absentschedule = 0;
$app->attended = 0;
$app->absentschedule = 0;
$app->attended = 0;
$app->timemodified = time();
}
}
Expand Down

0 comments on commit d232016

Please sign in to comment.