|
|
|
|
@ -11,7 +11,7 @@ require_once '../../../main/inc/global.inc.php'; |
|
|
|
|
require_once '../config.php'; |
|
|
|
|
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php'; |
|
|
|
|
|
|
|
|
|
$letters = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); |
|
|
|
|
$letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* List exercises |
|
|
|
|
@ -25,7 +25,7 @@ function showExerciseCourse($course_id, $session_id = 0) |
|
|
|
|
$course_id = (int) $course_id; |
|
|
|
|
$session_id = (int) $session_id; |
|
|
|
|
$tableQuiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
|
|
|
$tableLpItem = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$tableLpItem = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$sql = "SELECT a.* |
|
|
|
|
FROM $tableQuiz a |
|
|
|
|
LEFT JOIN $tableLpItem b |
|
|
|
|
@ -35,10 +35,10 @@ function showExerciseCourse($course_id, $session_id = 0) |
|
|
|
|
AND (a.active = 1 OR (item_type = 'quiz' AND b.c_id = $course_id)) |
|
|
|
|
ORDER BY a.title ASC;"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuiz"); |
|
|
|
|
} |
|
|
|
|
$aux = array(); |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuiz"); |
|
|
|
|
} |
|
|
|
|
$aux = []; |
|
|
|
|
while ($row = Database::fetch_assoc($res)) { |
|
|
|
|
$aux[] = $row; |
|
|
|
|
} |
|
|
|
|
@ -46,7 +46,7 @@ function showExerciseCourse($course_id, $session_id = 0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* List quiz details |
|
|
|
|
* List quiz details |
|
|
|
|
* @return array Results (list of quiz details) |
|
|
|
|
* @throws Exception |
|
|
|
|
*/ |
|
|
|
|
@ -54,12 +54,12 @@ function getInfoQuiz($c_id, $id) |
|
|
|
|
{ |
|
|
|
|
$c_id = (int) $c_id; |
|
|
|
|
$id = (int) $id; |
|
|
|
|
$tableQuiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
|
|
|
$sql = "SELECT * FROM $tableQuiz WHERE c_id = $c_id AND iid = $id"; |
|
|
|
|
$tableQuiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
|
|
|
$sql = "SELECT * FROM $tableQuiz WHERE c_id = $c_id AND iid = $id"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuiz"); |
|
|
|
|
} |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuiz"); |
|
|
|
|
} |
|
|
|
|
$row = Database::fetch_assoc($res); |
|
|
|
|
return $row; |
|
|
|
|
} |
|
|
|
|
@ -73,27 +73,27 @@ function getQuestions($c_id, $quizId) |
|
|
|
|
{ |
|
|
|
|
$c_id = (int) $c_id; |
|
|
|
|
$quizId = (int) $quizId; |
|
|
|
|
$tableQuizQuestion = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
|
|
|
$tableQuestion = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
|
|
|
$sql = "SELECT a.question_id AS question_id |
|
|
|
|
$tableQuizQuestion = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
|
|
|
$tableQuestion = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
|
|
|
$sql = "SELECT a.question_id AS question_id |
|
|
|
|
FROM $tableQuizQuestion a |
|
|
|
|
INNER JOIN $tableQuestion b ON a.question_id = b.iid |
|
|
|
|
WHERE a.c_id = $c_id AND b.c_id = a.c_id AND a.exercice_id = $quizId |
|
|
|
|
AND (b.type IN (1, 2, 9, 10, 11, 12, 14)) |
|
|
|
|
ORDER BY question_order ASC;"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuizQuestion"); |
|
|
|
|
} |
|
|
|
|
$aux = array(); |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuizQuestion"); |
|
|
|
|
} |
|
|
|
|
$aux = []; |
|
|
|
|
while ($row = Database::fetch_assoc($res)) { |
|
|
|
|
$aux[] = $row['question_id']; |
|
|
|
|
} |
|
|
|
|
return $aux; |
|
|
|
|
$aux[] = $row['question_id']; |
|
|
|
|
} |
|
|
|
|
return $aux; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* List question details |
|
|
|
|
* List question details |
|
|
|
|
* @return array Results (list of question details) |
|
|
|
|
* @throws Exception |
|
|
|
|
*/ |
|
|
|
|
@ -101,15 +101,15 @@ function getInfoQuestion($c_id, $id) |
|
|
|
|
{ |
|
|
|
|
$c_id = (int) $c_id; |
|
|
|
|
$id = (int) $id; |
|
|
|
|
$tableQuestion = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
|
|
|
$sql = "SELECT * FROM $tableQuestion |
|
|
|
|
$tableQuestion = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
|
|
|
$sql = "SELECT * FROM $tableQuestion |
|
|
|
|
WHERE c_id = $c_id |
|
|
|
|
AND iid = $id |
|
|
|
|
AND (type IN (1, 2, 9, 10, 11, 12, 14))"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuestion"); |
|
|
|
|
} |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuestion"); |
|
|
|
|
} |
|
|
|
|
$row = Database::fetch_assoc($res); |
|
|
|
|
return $row; |
|
|
|
|
} |
|
|
|
|
@ -123,19 +123,19 @@ function getAnswers($c_id, $id) |
|
|
|
|
{ |
|
|
|
|
$c_id = (int) $c_id; |
|
|
|
|
$id = (int) $id; |
|
|
|
|
$tableQuizAnswer = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
|
|
|
$sql = "SELECT * FROM $tableQuizAnswer |
|
|
|
|
$tableQuizAnswer = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
|
|
|
$sql = "SELECT * FROM $tableQuizAnswer |
|
|
|
|
WHERE c_id = $c_id AND question_id = $id |
|
|
|
|
ORDER BY position ASC;"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuizAnswer"); |
|
|
|
|
} |
|
|
|
|
$aux = array(); |
|
|
|
|
if (!$res) { |
|
|
|
|
die("Error Database $tableQuizAnswer"); |
|
|
|
|
} |
|
|
|
|
$aux = []; |
|
|
|
|
while ($row = Database::fetch_assoc($res)) { |
|
|
|
|
$aux[] = $row; |
|
|
|
|
} |
|
|
|
|
return $aux; |
|
|
|
|
$aux[] = $row; |
|
|
|
|
} |
|
|
|
|
return $aux; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -145,49 +145,49 @@ function getAnswers($c_id, $id) |
|
|
|
|
*/ |
|
|
|
|
function removeHtml($string) |
|
|
|
|
{ |
|
|
|
|
$txt=str_replace("<html>","",$string); |
|
|
|
|
$txt=str_replace("<head>","",$txt); |
|
|
|
|
$txt=str_replace("<title>","",$txt); |
|
|
|
|
$txt=str_replace("</title>","",$txt); |
|
|
|
|
$txt=str_replace("</head>","",$txt); |
|
|
|
|
$txt=str_replace("<body>","",$txt); |
|
|
|
|
$txt=str_replace("</body>","",$txt); |
|
|
|
|
$txt=str_replace("</html>","",$txt); |
|
|
|
|
$txt=strip_tags($txt); |
|
|
|
|
$txt=str_replace(chr(13).chr(10),"",$txt); |
|
|
|
|
$txt=str_replace("<html>", "", $string); |
|
|
|
|
$txt=str_replace("<head>", "", $txt); |
|
|
|
|
$txt=str_replace("<title>", "", $txt); |
|
|
|
|
$txt=str_replace("</title>", "", $txt); |
|
|
|
|
$txt=str_replace("</head>", "", $txt); |
|
|
|
|
$txt=str_replace("<body>", "", $txt); |
|
|
|
|
$txt=str_replace("</body>", "", $txt); |
|
|
|
|
$txt=str_replace("</html>", "", $txt); |
|
|
|
|
$txt=strip_tags($txt); |
|
|
|
|
$txt=str_replace(chr(13).chr(10), "", $txt); |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
$txt=str_replace(" "," ",$txt); |
|
|
|
|
$txt=str_replace("Á","Á",$txt); |
|
|
|
|
$txt=str_replace("á","á",$txt); |
|
|
|
|
$txt=str_replace("É","É",$txt); |
|
|
|
|
$txt=str_replace("é","é",$txt); |
|
|
|
|
$txt=str_replace("Í","Í",$txt); |
|
|
|
|
$txt=str_replace("í","í",$txt); |
|
|
|
|
$txt=str_replace("Ó","Ó",$txt); |
|
|
|
|
$txt=str_replace("ó","ó",$txt); |
|
|
|
|
$txt=str_replace("Ú","Ú",$txt); |
|
|
|
|
$txt=str_replace("ú","ú",$txt); |
|
|
|
|
$txt=str_replace("Ñ","Ñ",$txt); |
|
|
|
|
$txt=str_replace("ñ","ñ",$txt); |
|
|
|
|
$txt=str_replace("à","à",$txt); |
|
|
|
|
$txt=str_replace("À","À",$txt); |
|
|
|
|
$txt=str_replace("¡","¡",$txt); |
|
|
|
|
$txt=str_replace("·","·",$txt); |
|
|
|
|
$txt=str_replace("Ç","Ç",$txt); |
|
|
|
|
$txt=str_replace("ç","ç",$txt); |
|
|
|
|
$txt=str_replace(""",'"',$txt); |
|
|
|
|
$txt=str_replace("ª",'ª',$txt); |
|
|
|
|
$txt=str_replace("º",'º',$txt); |
|
|
|
|
$txt=str_replace("&",'&',$txt); |
|
|
|
|
$txt=str_replace("•",'•',$txt); |
|
|
|
|
$txt=str_replace("¿",'¿',$txt); |
|
|
|
|
$txt=str_replace("€",'EUR',$txt); |
|
|
|
|
$txt=str_replace("ü",'ü',$txt); |
|
|
|
|
$txt=str_replace("Ü",'Ü',$txt); |
|
|
|
|
$txt=str_replace("¨",'¨',$txt);*/ |
|
|
|
|
|
|
|
|
|
return $txt; |
|
|
|
|
/* |
|
|
|
|
$txt=str_replace(" "," ",$txt); |
|
|
|
|
$txt=str_replace("Á","Á",$txt); |
|
|
|
|
$txt=str_replace("á","á",$txt); |
|
|
|
|
$txt=str_replace("É","É",$txt); |
|
|
|
|
$txt=str_replace("é","é",$txt); |
|
|
|
|
$txt=str_replace("Í","Í",$txt); |
|
|
|
|
$txt=str_replace("í","í",$txt); |
|
|
|
|
$txt=str_replace("Ó","Ó",$txt); |
|
|
|
|
$txt=str_replace("ó","ó",$txt); |
|
|
|
|
$txt=str_replace("Ú","Ú",$txt); |
|
|
|
|
$txt=str_replace("ú","ú",$txt); |
|
|
|
|
$txt=str_replace("Ñ","Ñ",$txt); |
|
|
|
|
$txt=str_replace("ñ","ñ",$txt); |
|
|
|
|
$txt=str_replace("à","à",$txt); |
|
|
|
|
$txt=str_replace("À","À",$txt); |
|
|
|
|
$txt=str_replace("¡","¡",$txt); |
|
|
|
|
$txt=str_replace("·","·",$txt); |
|
|
|
|
$txt=str_replace("Ç","Ç",$txt); |
|
|
|
|
$txt=str_replace("ç","ç",$txt); |
|
|
|
|
$txt=str_replace(""",'"',$txt); |
|
|
|
|
$txt=str_replace("ª",'ª',$txt); |
|
|
|
|
$txt=str_replace("º",'º',$txt); |
|
|
|
|
$txt=str_replace("&",'&',$txt); |
|
|
|
|
$txt=str_replace("•",'•',$txt); |
|
|
|
|
$txt=str_replace("¿",'¿',$txt); |
|
|
|
|
$txt=str_replace("€",'EUR',$txt); |
|
|
|
|
$txt=str_replace("ü",'ü',$txt); |
|
|
|
|
$txt=str_replace("Ü",'Ü',$txt); |
|
|
|
|
$txt=str_replace("¨",'¨',$txt);*/ |
|
|
|
|
|
|
|
|
|
return $txt; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -197,37 +197,37 @@ function removeHtml($string) |
|
|
|
|
*/ |
|
|
|
|
function removeQuotes($string) |
|
|
|
|
{ |
|
|
|
|
//$txt=strip_tags($cadena); |
|
|
|
|
$txt=str_replace(" "," ",$string); |
|
|
|
|
$txt=str_replace("Á","Á",$txt); |
|
|
|
|
$txt=str_replace("á","á",$txt); |
|
|
|
|
$txt=str_replace("É","É",$txt); |
|
|
|
|
$txt=str_replace("é","é",$txt); |
|
|
|
|
$txt=str_replace("Í","Í",$txt); |
|
|
|
|
$txt=str_replace("í","í",$txt); |
|
|
|
|
$txt=str_replace("Ó","Ó",$txt); |
|
|
|
|
$txt=str_replace("ó","ó",$txt); |
|
|
|
|
$txt=str_replace("Ú","Ú",$txt); |
|
|
|
|
$txt=str_replace("ú","ú",$txt); |
|
|
|
|
$txt=str_replace("Ñ","Ñ",$txt); |
|
|
|
|
$txt=str_replace("ñ","ñ",$txt); |
|
|
|
|
$txt=str_replace(""",'"',$txt); |
|
|
|
|
$txt=str_replace("ª",'ª',$txt); |
|
|
|
|
$txt=str_replace("º",'º',$txt); |
|
|
|
|
$txt=str_replace("&",'&',$txt); |
|
|
|
|
$txt=str_replace("•",'•',$txt); |
|
|
|
|
$txt=str_replace("¿ &",'¿',$txt); |
|
|
|
|
$txt=str_replace("à","à",$txt); |
|
|
|
|
$txt=str_replace("À","À",$txt); |
|
|
|
|
$txt=str_replace("¡","¡",$txt); |
|
|
|
|
$txt=str_replace("·","·",$txt); |
|
|
|
|
$txt=str_replace("Ç","Ç",$txt); |
|
|
|
|
$txt=str_replace("ç","ç",$txt); |
|
|
|
|
$txt=str_replace("€",'EUR',$txt); |
|
|
|
|
$txt=str_replace("ü",'ü',$txt); |
|
|
|
|
$txt=str_replace("Ü",'Ü',$txt); |
|
|
|
|
$txt=str_replace("uml;",'¨',$txt); |
|
|
|
|
return $txt; |
|
|
|
|
//$txt=strip_tags($cadena); |
|
|
|
|
$txt=str_replace(" ", " ", $string); |
|
|
|
|
$txt=str_replace("Á", "Á", $txt); |
|
|
|
|
$txt=str_replace("á", "á", $txt); |
|
|
|
|
$txt=str_replace("É", "É", $txt); |
|
|
|
|
$txt=str_replace("é", "é", $txt); |
|
|
|
|
$txt=str_replace("Í", "Í", $txt); |
|
|
|
|
$txt=str_replace("í", "í", $txt); |
|
|
|
|
$txt=str_replace("Ó", "Ó", $txt); |
|
|
|
|
$txt=str_replace("ó", "ó", $txt); |
|
|
|
|
$txt=str_replace("Ú", "Ú", $txt); |
|
|
|
|
$txt=str_replace("ú", "ú", $txt); |
|
|
|
|
$txt=str_replace("Ñ", "Ñ", $txt); |
|
|
|
|
$txt=str_replace("ñ", "ñ", $txt); |
|
|
|
|
$txt=str_replace(""", '"', $txt); |
|
|
|
|
$txt=str_replace("ª", 'ª', $txt); |
|
|
|
|
$txt=str_replace("º", 'º', $txt); |
|
|
|
|
$txt=str_replace("&", '&', $txt); |
|
|
|
|
$txt=str_replace("•", '•', $txt); |
|
|
|
|
$txt=str_replace("¿ &", '¿', $txt); |
|
|
|
|
$txt=str_replace("à", "à", $txt); |
|
|
|
|
$txt=str_replace("À", "À", $txt); |
|
|
|
|
$txt=str_replace("¡", "¡", $txt); |
|
|
|
|
$txt=str_replace("·", "·", $txt); |
|
|
|
|
$txt=str_replace("Ç", "Ç", $txt); |
|
|
|
|
$txt=str_replace("ç", "ç", $txt); |
|
|
|
|
$txt=str_replace("€", 'EUR', $txt); |
|
|
|
|
$txt=str_replace("ü", 'ü', $txt); |
|
|
|
|
$txt=str_replace("Ü", 'Ü', $txt); |
|
|
|
|
$txt=str_replace("uml;", '¨', $txt); |
|
|
|
|
return $txt; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -243,7 +243,7 @@ function hex2dec($color = '#000000') |
|
|
|
|
$vert = hexdec($V); |
|
|
|
|
$B = substr($color, 5, 2); |
|
|
|
|
$bleu = hexdec($B); |
|
|
|
|
$tbl_couleur = array(); |
|
|
|
|
$tbl_couleur = []; |
|
|
|
|
$tbl_couleur['R'] = $rouge; |
|
|
|
|
$tbl_couleur['V'] = $vert; |
|
|
|
|
$tbl_couleur['B'] = $bleu; |
|
|
|
|
@ -271,4 +271,3 @@ function txtentities($html) |
|
|
|
|
$trans = array_flip($trans); |
|
|
|
|
return strtr($html, $trans); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|