Ejemplo n.º 1
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!strstr($this->other['cmielement'], '.score.raw')) {
         throw new \coding_exception("The 'cmielement' must represents a valid CMI raw score ({$this->other['cmielement']}).");
     }
     // Note: we trust that 'cmivalue' represents a valid SCORM CMI score value.
 }
Ejemplo n.º 2
0
 /**
  * Custom validation.
  *
  * @throws \coding_exception
  * @return void
  */
 protected function validate_data()
 {
     parent::validate_data();
     if (!in_array($this->other['cmielement'], array('cmi.completion_status', 'cmi.core.lesson_status', 'cmi.success_status'))) {
         throw new \coding_exception("The 'cmielement' must represents a valid CMI status element ({$this->other['cmielement']}).");
     }
     if (!in_array($this->other['cmivalue'], array('passed', 'completed', 'failed', 'incomplete', 'browsed', 'not attempted', 'unknown'))) {
         throw new \coding_exception("The 'cmivalue' must represents a valid CMI status value ({$this->other['cmivalue']}).");
     }
 }