Exemplo n.º 1
0
 /**
  * Process a course competency settings.
  *
  * @param array $data The data.
  */
 public function process_course_competency_settings($data)
 {
     global $DB;
     $data = (object) $data;
     // We do not restore the course settings during merge.
     $target = $this->get_task()->get_target();
     if ($target == backup::TARGET_CURRENT_ADDING || $target == backup::TARGET_EXISTING_ADDING) {
         return;
     }
     $courseid = $this->task->get_courseid();
     $exists = \core_competency\course_competency_settings::record_exists_select('courseid = :courseid', array('courseid' => $courseid));
     // Strangely the course settings already exist, let's just leave them as is then.
     if ($exists) {
         $this->log('Course competency settings not restored, existing settings have been found.', backup::LOG_WARNING);
         return;
     }
     $data = (object) array('courseid' => $courseid, 'pushratingstouserplans' => $data->pushratingstouserplans);
     $settings = new \core_competency\course_competency_settings(0, $data);
     $settings->create();
 }