/**
  * Handle view action.
  *
  * @return string
  * @throws \coding_exception
  */
 public function handle_view()
 {
     $event = course_module_viewed::create(array('objectid' => $this->cm->instance, 'context' => $this->context));
     $event->add_record_snapshot('course', $this->course);
     $event->add_record_snapshot($this->cm->modname, $this->collaborate);
     $event->trigger();
     if ($this->collaborate->sessionid === null && has_capability('mod/collaborate:addinstance', $this->context)) {
         collaborate_update_instance($this->collaborate);
     }
     // Completion tracking on view.
     $completion = new \completion_info($this->course);
     $completion->set_module_viewed($this->cm);
     return $this->renderer->view_action($this->collaborate, $this->cm);
 }
 /**
  * Handle testing api.
  *
  * @return string
  * @throws \coding_exception
  */
 public function handle_testapi()
 {
     return $this->renderer->connection_verified(local::api_verified(true));
 }