protected function set_appointment(\scheduler_appointment $appointment)
 {
     $this->add_record_snapshot('scheduler_appointment', $appointment->data);
     $this->add_record_snapshot('scheduler_slots', $appointment->get_parent()->data);
     $this->add_record_snapshot('scheduler', $appointment->get_parent()->get_parent()->data);
     $this->appointment = $appointment;
     $this->data['objecttable'] = 'scheduler_appointments';
 }
 public function prepare_appointment_data(scheduler_appointment $appointment)
 {
     $newdata = clone $appointment->get_data();
     $newdata->appointmentnote = array();
     $newdata->appointmentnote['text'] = $appointment->appointmentnote;
     $newdata->appointmentnote['format'] = $appointment->appointmentnoteformat;
     return $newdata;
 }
 public function add_student(scheduler_appointment $appointmentmodel, $highlight, $checked = false, $showgrade = true)
 {
     $student = new stdClass();
     $student->user = $appointmentmodel->get_student();
     if ($this->showgrades && $showgrade) {
         $student->grade = $appointmentmodel->grade;
     } else {
         $student->grade = null;
     }
     $student->highlight = $highlight;
     $student->checked = $checked;
     $student->entryid = $appointmentmodel->id;
     $this->students[] = $student;
 }
 /**
  * retrieves an appointment and the corresponding slot
  */
 public function get_slot_appointment($appointmentid)
 {
     global $DB;
     $appointrec = $DB->get_record('scheduler_appointment', array('id' => $appointmentid), '*', MUST_EXIST);
     $slotrec = $DB->get_record('scheduler_slots', array('id' => $appointrec->slotid), '*', MUST_EXIST);
     $slot = new scheduler_slot($this);
     $slot->load_record($slotrec);
     $appointment = new scheduler_appointment($slot);
     $appointment->load_record($appointrec);
     return array($slot, $appointment);
 }