/**
  * @todo : add session id when used for session
  */
 public function restore_test_category($session_id, $respect_base_content, $destination_course_code)
 {
     $course_id = api_get_course_int_id();
     // Let's restore the categories
     $tab_test_category_id_old_new = array();
     // used to build the quiz_question_rel_category table
     if ($this->course->has_resources(RESOURCE_TEST_CATEGORY)) {
         $resources = $this->course->resources;
         foreach ($resources[RESOURCE_TEST_CATEGORY] as $id => $CourseCopyTestcategory) {
             $tab_test_category_id_old_new[$CourseCopyTestcategory->source_id] = $id;
             // check if this test_category already exist in the destination BDD
             // do not Database::escape_string $title and $description, it will be done later
             $title = $CourseCopyTestcategory->title;
             $description = $CourseCopyTestcategory->description;
             if (Testcategory::category_exists_with_title($title)) {
                 switch ($this->file_option) {
                     case FILE_SKIP:
                         //Do nothing
                         break;
                     case FILE_RENAME:
                         $new_title = $title . "_";
                         while (Testcategory::category_exists_with_title($new_title)) {
                             $new_title .= "_";
                         }
                         $test_category = new Testcategory(0, $new_title, $description);
                         $new_id = $test_category->addCategoryInBDD();
                         $tab_test_category_id_old_new[$CourseCopyTestcategory->source_id] = $new_id;
                         break;
                     case FILE_OVERWRITE:
                         $id = Testcategory::get_category_id_for_title($title);
                         $my_cat = new Testcategory($id);
                         $my_cat->name = $title;
                         $my_cat->modifyCategory();
                         $tab_test_category_id_old_new[$CourseCopyTestcategory->source_id] = $id;
                         break;
                 }
             } else {
                 // create a new test_category
                 $test_category = new Testcategory(0, $title, $description);
                 $new_id = $test_category->addCategoryInBDD();
                 $tab_test_category_id_old_new[$CourseCopyTestcategory->source_id] = $new_id;
             }
             $this->course->resources[RESOURCE_TEST_CATEGORY][$id]->destination_id = $tab_test_category_id_old_new[$CourseCopyTestcategory->source_id];
         }
     }
     // lets check if quizzes-question are restored too, to redo the link between test_category and quizzes question for questions restored
     // we can use the source_id field
     // question source_id => category source_id
     if ($this->course->has_resources(RESOURCE_QUIZQUESTION)) {
         // check the category number of each question restored
         if (!empty($resources[RESOURCE_QUIZQUESTION])) {
             foreach ($resources[RESOURCE_QUIZQUESTION] as $id => $CourseCopyQuestion) {
                 $new_quiz_question_id = $resources[RESOURCE_QUIZQUESTION][$id]->destination_id;
                 $question_category = $CourseCopyQuestion->question_category;
                 if ($question_category > 0) {
                     Testcategory::add_category_for_question_id($tab_test_category_id_old_new[$question_category], $new_quiz_question_id, $course_id);
                 }
             }
         }
     }
 }