Example #1
0
 protected function changeValidation($pendingStatus)
 {
     if (!$this->isModifiable()) {
         throw new Exception("Cannot change user " . $this->privileges->getUserId() . " enrolment validation in course " . $this->privileges->getCourseId());
     }
     $tbl_mdb_names = claro_sql_get_main_tbl();
     $updated = Claroline::getDatabase()->exec("\n                UPDATE \n                    `{$tbl_mdb_names['rel_course_user']}` AS rcu\n                SET \n                    isPending = " . $pendingStatus . "\n                WHERE \n                    `rcu`.`user_id` = " . Claroline::getDatabase()->escape($this->privileges->getUserId()) . "\n                AND \n                    `code_cours` = " . Claroline::getDatabase()->quote($this->privileges->getCourseId()));
     if ($updated) {
         if ($this->course->sourceCourseId) {
             $sourceCourseRegistrationValidation = new self(ClaroCourse::getCodeFromId($this->course->sourceCourseId), $this->privileges->getUserId());
             $sourceCourseRegistrationValidation->changeValidation($pendingStatus);
         }
         return true;
     } else {
         return false;
     }
 }