Skip to content

Commit

Permalink
CONTRIB-6891 Show other students in "Upcoming slots" table
Browse files Browse the repository at this point in the history
  • Loading branch information
bostelm committed May 9, 2017
1 parent 68933ab commit 495121e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class scheduler_slot_table implements renderable {
public $scheduler;
public $showgrades;
public $showactions;
public $hasotherstudents = false;

public $actionurl;

public function add_slot(scheduler_slot $slotmodel, scheduler_appointment $appointmentmodel, $otherstudents, $cancancel = false) {
Expand All @@ -40,6 +42,7 @@ public function add_slot(scheduler_slot $slotmodel, scheduler_appointment $appoi
$slot->grade = $appointmentmodel->grade;
}
$this->showactions = $this->showactions || $cancancel;
$this->hasotherstudents = $this->hasotherstudents || (bool) $otherstudents;

$this->slots[] = $slot;
}
Expand Down
8 changes: 6 additions & 2 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ public function render_scheduler_slot_table(scheduler_slot_table $slottable) {
if ($slottable->showgrades) {
$table->head[] = get_string('grade', 'scheduler');
$table->align[] = 'left';
} else if ($slottable->hasotherstudents) {
$table->head[] = get_string('otherstudents', 'scheduler');
$table->align[] = 'left';
}
if ($slottable->showactions) {
$table->head[] = '';
Expand Down Expand Up @@ -311,10 +314,11 @@ public function render_scheduler_slot_table(scheduler_slot_table $slottable) {

$rowdata[] = $studentnotes;

if ($slottable->showgrades) {
if ($slottable->showgrades || $slottable->hasotherstudents) {
$gradedata = '';
if ($slot->otherstudents) {
$gradedata = $this->render($slot->otherstudents);
} else {
} else if ($slottable->showgrades) {
$gradedata = $this->format_grade($slottable->scheduler, $slot->grade);
}
$rowdata[] = $gradedata;
Expand Down

0 comments on commit 495121e

Please sign in to comment.