/** * Build the test category * $session_id, $course_code, $with_base_content, $this->specific_id_list[$tool] * @todo add course session */ public function build_test_category($session_id = 0, $course_code = '', $with_base_content = false, $id_list = array()) { $course_id = api_get_course_int_id(); // get all test category in course $tab_test_categories_id = Testcategory::getCategoryListInfo("id", $course_id); foreach ($tab_test_categories_id as $test_category_id) { $test_category = new Testcategory($test_category_id); $copy_course_test_category = new CourseCopyTestcategory($test_category_id, $test_category->name, $test_category->description); $this->course->add_resource($copy_course_test_category); } }
/** * Return an array (id=>name) * tabresult[0] = get_lang('NoCategory'); * */ static function getCategoriesIdAndName($in_courseid = 0) { $tabcatobject = Testcategory::getCategoryListInfo("", $in_courseid); $tabresult = array("0" => get_lang('NoCategorySelected')); for ($i = 0; $i < count($tabcatobject); $i++) { $tabresult[$tabcatobject[$i]->id] = $tabcatobject[$i]->name; } return $tabresult; }
/** * Return true if a category already exists with the same name * @param string $in_name * * @return bool */ public static function category_exists_with_title($in_name) { $tab_test_category = Testcategory::getCategoryListInfo("title"); foreach ($tab_test_category as $title) { if ($title == $in_name) { return true; } } return false; }