Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3533

Add a "location" column to the scheduler's teacher and student views

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3
    • 2.1, 2.2
    • Module: Scheduler
    • None
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_23_STABLE

      Despite having the ability to set a location for appointments within the scheduler, there is currently no way for a student to view where their appointment is taking place (except for the reminder email they can potentially receive).

      As such, I've added the following to the scheduler code which creates a new "location" column and adds the room location of the appointment to only the student's view.

      --------------------------------------------------------------------------

      $$$$$ ADD to locallib.php $$$$$

      /**

      • Get the meeting location for a specific scheduler slot
        **/

      function scheduler_get_slot_location($slotid){
      global $CFG, $DB;
      $sql = "SELECT appointmentlocation FROM

      {scheduler_slots}

      WHERE id = ?";
      $location = $DB->get_record_sql($sql, array($slotid));
      if( !$location->appointmentlocation)

      { $slotloc = '<span style="text-align: center;"> - </span>'; }

      else

      { $slotloc = $location->appointmentlocation; }

      return $slotloc;
      }

      $$$$$ MODIFY studentview.php $$$$$

      Line 197:

      $table->align = array ('LEFT', 'LEFT', 'CENTER', 'CENTER', 'CENTER', 'LEFT');

      line 196:

      $table->head = array ($strdate, $strstart, $strend, get_string('location', 'scheduler'), get_string('choice', 'scheduler'), format_string($scheduler->staffrolename), get_string('groupsession', 'scheduler'));

      ADD line 210:

      $loc = scheduler_get_slot_location($aSlot->id);

      line 214:

      $table->data[] = array ("<b>$startdatestr</b>", "<b>$starttime</b>", "<b>$endtime</b>", "<b>$loc</b>", $radio, "<b>"."<a href=\"../../user/view.php?id={$aSlot->teacherid}&course=$scheduler->course\">".fullname($teacher).'</a></b>','<b>'.$aSlot->groupsession.'</b>');

      Line 232:

      $table->data[] = array ($startdatestr, $starttimestr, $endtimestr, $loc, $radio, "<a href=\"../../user/view.php?id={$aSlot->teacherid}&course={$scheduler->course}\">".fullname($teacher).'</a>', $aSlot->groupsession);

      --------------------------------------------------------------------------

      I have no idea if I did that right, but it works well enough. It's at least a start!

      I didn't have time to figure out how to add the column to teacher's view because it wasn't as high of a priority and it also looked a lot more complicated. If I remember correctly, there was no $aSlot array created for the teacherview.php with which I could easily extract the aSlot->id from to plug into the scheduler_get_slot_location() function.

      It would be very nice if this could also be done, though!

      There's a screenshot of what the new table looks like in this forum discussion: http://moodle.org/mod/forum/discuss.php?d=195093&parent=850046

            bostelm Henning Bostelmann
            tonybox Tony Box
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.