|
|
|
@ -1255,6 +1255,7 @@ abstract class Question |
|
|
|
Database::insert($TBL_QUESTION_OPTIONS, $item); |
|
|
|
Database::insert($TBL_QUESTION_OPTIONS, $item); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->duplicate_category_question($new_question_id, $course_id); |
|
|
|
$this->duplicate_category_question($new_question_id, $course_id); |
|
|
|
|
|
|
|
|
|
|
|
// Duplicates the picture of the hotspot |
|
|
|
// Duplicates the picture of the hotspot |
|
|
|
@ -1263,20 +1264,31 @@ abstract class Question |
|
|
|
return $new_question_id; |
|
|
|
return $new_question_id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Get categories from question |
|
|
|
|
|
|
|
* @return array |
|
|
|
|
|
|
|
*/ |
|
|
|
public function get_categories_from_question() |
|
|
|
public function get_categories_from_question() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return Testcategory::getCategoryForQuestion($this->id); |
|
|
|
return Testcategory::getCategoryForQuestion($this->id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function duplicate_category_question($question_id, $course_id) |
|
|
|
/** |
|
|
|
|
|
|
|
* @param int $questionId |
|
|
|
|
|
|
|
* @param int $courseId |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function duplicate_category_question($questionId, $courseId) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$question = Question::read($question_id, $course_id); |
|
|
|
$question = Question::read($questionId, $courseId); |
|
|
|
$categories = $this->get_categories_from_question(); |
|
|
|
$categories = $this->get_categories_from_question(); |
|
|
|
if (!empty($categories)) { |
|
|
|
if (!empty($categories)) { |
|
|
|
$question->saveCategories($categories); |
|
|
|
$question->saveCategories($categories); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @return array|string |
|
|
|
|
|
|
|
*/ |
|
|
|
public function get_question_type_name() |
|
|
|
public function get_question_type_name() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$key = self::$questionTypes[$this->type]; |
|
|
|
$key = self::$questionTypes[$this->type]; |
|
|
|
@ -1284,6 +1296,10 @@ abstract class Question |
|
|
|
return get_lang($key[1]); |
|
|
|
return get_lang($key[1]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param string $type |
|
|
|
|
|
|
|
* @return null |
|
|
|
|
|
|
|
*/ |
|
|
|
public static function get_question_type($type) |
|
|
|
public static function get_question_type($type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($type == ORAL_EXPRESSION && api_get_setting('enable_nanogong') != 'true') { |
|
|
|
if ($type == ORAL_EXPRESSION && api_get_setting('enable_nanogong') != 'true') { |
|
|
|
@ -1293,6 +1309,9 @@ abstract class Question |
|
|
|
return self::$questionTypes[$type]; |
|
|
|
return self::$questionTypes[$type]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @return array |
|
|
|
|
|
|
|
*/ |
|
|
|
public static function get_question_type_list() |
|
|
|
public static function get_question_type_list() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (api_get_setting('enable_nanogong') != 'true') { |
|
|
|
if (api_get_setting('enable_nanogong') != 'true') { |
|
|
|
|