/**
  * Convenience method to instantiate the event.
  *
  * @param user_evidence $userevidence The evidence of prior learning.
  * @return self
  */
 public static final function create_from_user_evidence(user_evidence $userevidence)
 {
     if (!$userevidence->get_id()) {
         throw new \coding_exception('The evidence of prior learning ID must be set.');
     }
     $event = static::create(array('contextid' => $userevidence->get_context()->id, 'objectid' => $userevidence->get_id(), 'relateduserid' => $userevidence->get_userid()));
     $event->add_record_snapshot(user_evidence::TABLE, $userevidence->to_record());
     return $event;
 }
Beispiel #2
0
 /**
  * Send request review for user evidence competencies.
  *
  * @param  int $id The user evidence ID.
  * @return bool
  */
 public static function request_review_of_user_evidence_linked_competencies($id)
 {
     $userevidence = new user_evidence($id);
     $context = $userevidence->get_context();
     $userid = $userevidence->get_userid();
     if (!$userevidence->can_manage()) {
         throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
     }
     $usercompetencies = user_evidence_competency::get_user_competencies_by_userevidenceid($id);
     foreach ($usercompetencies as $usercompetency) {
         if ($usercompetency->get_status() == user_competency::STATUS_IDLE) {
             static::user_competency_request_review($userid, $usercompetency->get_competencyid());
         }
     }
     return true;
 }