pull/3173/head
Alex Aragón 7 years ago
commit 7e823f828e
  1. 14
      main/admin/questions.php
  2. 2
      main/dropbox/dropbox_init.inc.php
  3. 2
      main/dropbox/index.php
  4. 10
      main/exercise/ReadingComprehension.php
  5. 10
      main/exercise/admin.php
  6. 25
      main/exercise/exercise.class.php
  7. 2
      main/exercise/hotspot_actionscript_admin.as.php
  8. 2
      main/exercise/multiple_answer.class.php
  9. 2
      main/exercise/multiple_answer_combination.class.php
  10. 2
      main/exercise/multiple_answer_true_false.class.php
  11. 58
      main/exercise/question.class.php
  12. 12
      main/exercise/question_admin.inc.php
  13. 1
      main/exercise/question_list_admin.inc.php
  14. 7
      main/gradebook/gradebook_add_eval.php
  15. 10
      main/inc/ajax/document.ajax.php
  16. 23
      main/inc/lib/events.lib.php
  17. 2
      main/inc/lib/link.lib.php
  18. 1
      main/inc/lib/pear/HTML/QuickForm/Renderer/Default.php
  19. 3
      main/inc/lib/social.lib.php
  20. 4
      main/inc/lib/system_announcements.lib.php
  21. 8
      main/lang/arabic/trad4all.inc.php
  22. 2
      main/lang/brazilian/trad4all.inc.php
  23. 1
      main/lang/english/trad4all.inc.php
  24. 2
      main/lang/french/trad4all.inc.php
  25. 2
      main/lang/spanish/trad4all.inc.php
  26. 26
      main/lp/learnpath.class.php
  27. 1
      main/lp/lp_add_audio.php
  28. 1
      main/lp/lp_controller.php
  29. 32
      main/mySpace/myStudents.php
  30. 7
      main/social/group_view.php
  31. 1
      main/template/default/social/map.tpl
  32. 3
      main/template/default/social/skills_block.tpl
  33. 2
      main/template/default/social/terms.tpl
  34. 18
      main/template/default/social/user_block.tpl
  35. 38
      main/wiki/wiki.inc.php
  36. 5
      plugin/surveyexportcsv/export.php
  37. 2
      tests/behat/features/bootstrap/FeatureContext.php
  38. 5
      tests/behat/features/toolLp.feature

@ -54,6 +54,9 @@ if ($formSent) {
$questions = $repo->matching($criteria);
if (empty($id)) {
$id = '';
}
$params = [
'id' => $id,
'title' => $title,
@ -127,7 +130,6 @@ if ($formSent) {
$url.http_build_query([
'cidReq' => $courseCode,
'id_session' => $exercise->sessionId,
'myid' => 1,
'exerciseId' => $exerciseId,
'type' => $question->getType(),
'editQuestion' => $question->getId(),
@ -136,10 +138,14 @@ if ($formSent) {
}
$question->questionData .= '<br />'.$exerciseData;
} else {
$question->questionData .= get_lang('Course').': '.Display::url(
$courseInfo['name'],
$exerciseUrl.http_build_query([
$question->questionData = Display::url(
Display::return_icon('edit.png', get_lang('Edit')),
$url.http_build_query([
'cidReq' => $courseCode,
'id_session' => $exercise->sessionId,
'exerciseId' => $exerciseId,
'type' => $question->getType(),
'editQuestion' => $question->getId(),
])
);
}

@ -180,7 +180,7 @@ if (empty($session_id)) {
// only when it is needed.
if ($action == 'add') {
$dropbox_person = new Dropbox_Person(
$_user['user_id'],
$user_id,
$is_courseAdmin,
$is_courseTutor
);

@ -4,6 +4,8 @@
// The file that contains all the initialisation stuff (and includes all the configuration stuff)
require_once 'dropbox_init.inc.php';
$_course = api_get_course_info();
$last_access = '';
// get the last time the user accessed the tool
if (isset($_SESSION[$_course['id']]) &&

@ -155,10 +155,8 @@ class ReadingComprehension extends UniqueAnswer
}
// hidden values
$my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
$form->addElement('hidden', 'myid', $my_id);
$form->addRule('questionName', get_lang('GiveQuestion'), 'required');
$isContent = isset($_REQUEST['isContent']) ? intval($_REQUEST['isContent']) : null;
$isContent = isset($_REQUEST['isContent']) ? (int) $_REQUEST['isContent'] : null;
// default values
$defaults = [];
@ -172,12 +170,8 @@ class ReadingComprehension extends UniqueAnswer
$form->setDefaults($defaults);
}
if (!empty($_REQUEST['myid'])) {
if (!isset($_GET['newQuestion']) || $isContent) {
$form->setDefaults($defaults);
} else {
if ($isContent == 1) {
$form->setDefaults($defaults);
}
}
}

@ -62,7 +62,7 @@ if (!$is_allowedToEdit) {
api_not_allowed(true);
}
$exerciseId = isset($_GET['exerciseId']) ? (int) $_GET['exerciseId'] : '0';
$exerciseId = isset($_GET['exerciseId']) ? (int) $_GET['exerciseId'] : 0;
/* stripslashes POST data */
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@ -253,6 +253,8 @@ if (!empty($clone_question) && !empty($objExercise->id)) {
// Reloading tne $objExercise obj
$objExercise->read($objExercise->id, false);
Display::addFlash(Display::return_message(get_lang('ItemCopied')));
header('Location: admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&page='.$page);
exit;
}
@ -299,7 +301,7 @@ if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) {
}
// if the question is duplicated, disable the link of tool name
if ($modifyIn == 'thisExercise') {
if ($modifyIn === 'thisExercise') {
if ($buttonBack) {
$modifyIn = 'allExercises';
}
@ -328,12 +330,12 @@ $inATest = isset($exerciseId) && $exerciseId > 0;
if ($inATest) {
echo '<div class="actions">';
if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) {
if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion'])) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
}
if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['editQuestion'])) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
}

@ -1720,23 +1720,36 @@ class Exercise
/**
* Updates question position.
*
* @return bool
*/
public function update_question_positions()
{
$table = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
// Fixes #3483 when updating order
$question_list = $this->selectQuestionList(true);
if (!empty($question_list)) {
foreach ($question_list as $position => $questionId) {
$questionList = $this->selectQuestionList(true);
$this->id = (int) $this->id;
if (empty($this->id)) {
return false;
}
if (!empty($questionList)) {
foreach ($questionList as $position => $questionId) {
$position = (int) $position;
$questionId = (int) $questionId;
$sql = "UPDATE $table SET
question_order ='".intval($position)."'
question_order ='".$position."'
WHERE
c_id = ".$this->course_id." AND
question_id = ".intval($questionId)." AND
exercice_id=".intval($this->id);
question_id = ".$questionId." AND
exercice_id=".$this->id;
Database::query($sql);
}
}
return true;
}
/**

@ -59,11 +59,9 @@ $data['image_height'] = $pictureHeight;
$data['courseCode'] = $_course['path'];
$data['hotspots'] = [];
// Init
$i = 0;
$nmbrTries = 0;
$answer_type = $objQuestion->type;
$answers = Session::read('tmp_answers');
$nbrAnswers = count($answers['answer']);

@ -188,7 +188,7 @@ class MultipleAnswer extends Question
*/
public function processAnswersCreation($form, $exercise)
{
$questionWeighting = $nbrGoodAnswers = 0;
$questionWeighting = 0;
$objAnswer = new Answer($this->id);
$nb_answers = $form->getSubmitValue('nb_answers');

@ -182,7 +182,7 @@ class MultipleAnswerCombination extends Question
*/
public function processAnswersCreation($form, $exercise)
{
$questionWeighting = $nbrGoodAnswers = 0;
$questionWeighting = 0;
$objAnswer = new Answer($this->id);
$nb_answers = $form->getSubmitValue('nb_answers');

@ -239,7 +239,7 @@ class MultipleAnswerTrueFalse extends Question
*/
public function processAnswersCreation($form, $exercise)
{
$questionWeighting = $nbrGoodAnswers = 0;
$questionWeighting = 0;
$objAnswer = new Answer($this->id);
$nb_answers = $form->getSubmitValue('nb_answers');
$course_id = api_get_course_int_id();

@ -952,6 +952,7 @@ abstract class Question
if ($exercise->questionFeedbackEnabled) {
$params['feedback'] = $this->feedback;
}
Database::update(
$TBL_QUESTIONS,
$params,
@ -974,24 +975,17 @@ abstract class Question
api_get_user_id()
);
}
if (api_get_setting('search_enabled') == 'true') {
if ($exerciseId != 0) {
if (api_get_setting('search_enabled') === 'true') {
$this->search_engine_edit($exerciseId);
} else {
/**
* actually there is *not* an user interface for
* creating questions without a relation with an exercise.
*/
}
}
} else {
// creates a new question
// Creates a new question
$sql = "SELECT max(position)
FROM $TBL_QUESTIONS as question,
$TBL_EXERCISE_QUESTION as test_question
WHERE
question.id = test_question.question_id AND
test_question.exercice_id = ".intval($exerciseId)." AND
test_question.exercice_id = ".$exerciseId." AND
question.c_id = $c_id AND
test_question.c_id = $c_id ";
$result = Database::query($sql);
@ -1087,33 +1081,33 @@ abstract class Question
}
}
if (api_get_setting('search_enabled') == 'true') {
if ($exerciseId != 0) {
if (api_get_setting('search_enabled') === 'true') {
$this->search_engine_edit($exerciseId, true);
} else {
/**
* actually there is *not* an user interface for
* creating questions without a relation with an exercise.
*/
}
}
}
}
// if the question is created in an exercise
if ($exerciseId) {
if (!empty($exerciseId)) {
// adds the exercise into the exercise list of this question
$this->addToList($exerciseId, true);
}
}
/**
* @param int $exerciseId
* @param bool $addQs
* @param bool $rmQs
*/
public function search_engine_edit(
$exerciseId,
$addQs = false,
$rmQs = false
) {
// update search engine and its values table if enabled
if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
if (!empty($exerciseId) && api_get_setting('search_enabled') == 'true' &&
extension_loaded('xapian')
) {
$course_id = api_get_course_id();
// get search_did
$tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
@ -1260,9 +1254,11 @@ abstract class Question
public function addToList($exerciseId, $fromSave = false)
{
$exerciseRelQuestionTable = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$id = $this->id;
$id = (int) $this->id;
$exerciseId = (int) $exerciseId;
// checks if the exercise ID is not in the list
if (!in_array($exerciseId, $this->exerciseList)) {
if (!empty($exerciseId) && !in_array($exerciseId, $this->exerciseList)) {
$this->exerciseList[] = $exerciseId;
$courseId = isset($this->course['real_id']) ? $this->course['real_id'] : 0;
$newExercise = new Exercise($courseId);
@ -1270,7 +1266,7 @@ abstract class Question
$count = $newExercise->getQuestionCount();
$count++;
$sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order)
VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')";
VALUES ({$this->course['real_id']}, ".$id.", ".$exerciseId.", '$count')";
Database::query($sql);
// we do not want to reindex if we had just saved adnd indexed the question
@ -1606,10 +1602,10 @@ abstract class Question
$form->addRule('questionName', get_lang('GiveQuestion'), 'required');
// default content
$isContent = isset($_REQUEST['isContent']) ? intval($_REQUEST['isContent']) : null;
$isContent = isset($_REQUEST['isContent']) ? (int) $_REQUEST['isContent'] : null;
// Question type
$answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null;
$answerType = isset($_REQUEST['answerType']) ? (int) $_REQUEST['answerType'] : null;
$form->addElement('hidden', 'answerType', $answerType);
// html editor
@ -1632,10 +1628,6 @@ abstract class Question
$editorConfig
);
// hidden values
$my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
$form->addElement('hidden', 'myid', $my_id);
if ($this->type != MEDIA_QUESTION) {
// Advanced parameters
$select_level = self::get_default_levels();
@ -1746,13 +1738,17 @@ abstract class Question
$form->setDefaults($defaults);
}
if (!empty($_REQUEST['myid'])) {
if (!isset($_GET['newQuestion']) || $isContent) {
$form->setDefaults($defaults);
}
/*if (!empty($_REQUEST['myid'])) {
$form->setDefaults($defaults);
} else {
if ($isContent == 1) {
$form->setDefaults($defaults);
}
}
}*/
}
/**

@ -13,10 +13,10 @@
*/
if (isset($_GET['editQuestion'])) {
$objQuestion = Question::read($_GET['editQuestion']);
$action = api_get_self()."?".api_get_cidreq()."&myid=1&modifyQuestion=".$modifyQuestion."&editQuestion=".$objQuestion->id.'&page='.$page;
$action = api_get_self().'?'.api_get_cidreq().'&modifyQuestion='.$modifyQuestion.'&editQuestion='.$objQuestion->id.'&page='.$page;
} else {
$objQuestion = Question::getInstance($_REQUEST['answerType']);
$action = api_get_self()."?".api_get_cidreq()."&modifyQuestion=".$modifyQuestion."&newQuestion=".$newQuestion;
$action = api_get_self().'?'.api_get_cidreq().'&modifyQuestion='.$modifyQuestion.'&newQuestion='.$newQuestion;
}
if (is_object($objQuestion)) {
@ -50,7 +50,7 @@ if (is_object($objQuestion)) {
$objQuestion->createAnswersForm($form);
// this variable $show_quiz_edition comes from admin.php blocks the exercise/quiz modifications
if ($objExercise->edit_exercise_in_lp == false) {
if (!empty($objExercise->id) && $objExercise->edit_exercise_in_lp == false) {
$form->freeze();
}
@ -65,6 +65,12 @@ if (is_object($objQuestion)) {
$objQuestion->type != HOT_SPOT_DELINEATION
) {
if (isset($_GET['editQuestion'])) {
if (empty($exerciseId)) {
Display::addFlash(Display::return_message(get_lang('ItemUpdated')));
$url = 'admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&editQuestion='.$objQuestion->id;
echo '<script type="text/javascript">window.location.href="'.$url.'"</script>';
exit;
}
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&page='.$page.'&message=ItemUpdated"</script>';
} else {
// New question

@ -254,7 +254,6 @@ if (!$inATest) {
api_get_self().'?'.api_get_cidreq().'&'
.http_build_query([
'type' => $objQuestionTmp->selectType(),
'myid' => 1,
'editQuestion' => $id,
'page' => $page,
]),

@ -14,9 +14,12 @@ api_block_anonymous_users();
GradebookUtils::block_students();
$select_cat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$is_allowedToEdit = $is_courseAdmin;
$is_allowedToEdit = api_is_course_admin();
$userId = api_get_user_id();
$evaladd = new Evaluation();
$evaladd->set_user_id($_user['user_id']);
$evaladd->set_user_id($userId);
if (!empty($select_cat)) {
$evaladd->set_category_id($_GET['selectcat']);
$cat = Category::load($_GET['selectcat']);

@ -20,16 +20,10 @@ switch ($action) {
$courseQuota = DocumentManager::get_course_quota();
// Calculating the total space
$already_consumed_space_course = DocumentManager::documents_total_space(
api_get_course_int_id()
);
$total = DocumentManager::documents_total_space(api_get_course_int_id());
// Displaying the quota
echo DocumentManager::displaySimpleQuota(
$courseQuota,
$already_consumed_space_course
);
echo DocumentManager::displaySimpleQuota($courseQuota, $total);
break;
case 'upload_file':
api_protect_course_script(true);

@ -1282,13 +1282,14 @@ class Event
$course_id,
$session_id = 0
) {
$track_e_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$user_id = (int) $user_id;
$exercise_id = (int) $exercise_id;
$course_id = (int) $course_id;
$session_id = (int) $session_id;
if (!empty($user_id) && !empty($exercise_id) && !empty($course_code)) {
$sql = "DELETE FROM $track_e_exercises
if (!empty($user_id) && !empty($exercise_id) && !empty($course_id)) {
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$sql = "DELETE FROM $table
WHERE
exe_user_id = $user_id AND
exe_exo_id = $exercise_id AND
@ -1311,9 +1312,9 @@ class Event
/**
* Gets all exercise results (NO Exercises in LPs ) from a given exercise id, course, session.
*
* @param int exercise id
* @param int $exercise_id
* @param int $courseId
* @param int session id
* @param int $session_id
*
* @return array with the results
*/
@ -1366,7 +1367,7 @@ class Event
* Gets all exercise results (NO Exercises in LPs ) from a given exercise id, course, session.
*
* @param int $courseId
* @param int session id
* @param int $session_id
* @param bool $get_count
*
* @return array with the results
@ -1409,9 +1410,9 @@ class Event
/**
* Gets all exercise results (NO Exercises in LPs) from a given exercise id, course, session.
*
* @param int exercise id
* @param int $user_id
* @param int $courseId
* @param int session id
* @param int $session_id
*
* @return array with the results
*/
@ -1454,7 +1455,7 @@ class Event
/**
* Gets exercise results (NO Exercises in LPs) from a given exercise id, course, session.
*
* @param int $exe_id exercise id
* @param int $exe_id attempt id
* @param string $status
*
* @return array with the results
@ -1574,9 +1575,9 @@ class Event
* Count exercise attempts (NO Exercises in LPs ) from a given exercise id, course, session.
*
* @param int $user_id
* @param int exercise id
* @param int $exercise_id
* @param int $courseId
* @param int session id
* @param int $session_id
*
* @return array with the results
*/

@ -1100,7 +1100,7 @@ class Link extends Model
false
);
$url .= api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletelink&id='.$linkId.'&category_id='.$categoryId;
$url = api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletelink&id='.$linkId.'&category_id='.$categoryId;
$event = "javascript: if(!confirm('".get_lang('LinkDelconfirm')."'))return false;";
$title = get_lang('Delete');

@ -334,6 +334,7 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
} else {
$html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->.*<!-- END required -->([ \t\n\r]*)?/isU", '', $html);
}
if (isset($error)) {
$html = str_replace('{error}', $error, $html);
$html = str_replace('{error_class}', 'error has-error', $html);

@ -3132,7 +3132,8 @@ class SocialManager extends UserManager
}
} else {
// Load my groups
$results = $userGroup->get_groups_by_user($userId,
$results = $userGroup->get_groups_by_user(
$userId,
[
GROUP_USER_PERMISSION_ADMIN,
GROUP_USER_PERMISSION_READER,

@ -843,7 +843,7 @@ class SystemAnnouncementManager
$sql .= self::getVisibilityCondition($visible);
if (isset($id) && !empty($id)) {
$id = intval($id);
$id = (int) $id;
$sql .= " AND id = $id ";
}
@ -852,7 +852,7 @@ class SystemAnnouncementManager
$sql .= " AND access_url_id IN ('1', '$current_url_id') ";
}
$sql .= " ORDER BY date_start DESC";
$sql .= ' ORDER BY date_start DESC';
$result = Database::query($sql);
$announcements = [];

@ -1192,7 +1192,7 @@ $HideAndSubscribeClosed = " مخفي / مغلق";
$HideAndSubscribeOpen = " مخفي / مفتوح";
$ShowAndSubscribeOpen = " ظاهر / مفتوح";
$ShowAndSubscribeClosed = " ظاهر / مغلق";
$AdminThisUser = " Back to user";
$AdminThisUser = "الرجوع للمستخدم";
$Manage = " Portal ادارة الـ";
$EnrollToCourseSuccessful = " لقد تم تسجيلك في المقرر";
$SubCat = " التصانيف الفرعية";
@ -1644,7 +1644,7 @@ $ShowIconsInNavigationsMenuComment = " هل ستظهر قائمة التصفح
$Plugin = " ادخال";
$MainMenu = " القائمة الرئيسية";
$MainMenuLogged = " القائمة الرئيسية بعد تسجيل الدخول";
$Banner = " Banner";
$Banner = "لافتة";
$ImageResizeTitle = " تغيير حجم صور المستخدم التي تم تحميلها";
$ImageResizeComment = " .غير متاح يتم تجاهل هذا الإعداد بشكل صامت (GD) إذا كان جي دي <a href=\"http://php.net/manual/en/ref.image.php\" target=\"_blank\">GD library - مكتبة معالجة الصور </a> بـ PHP ال (compile) يمكن إعادة تحجيم صور المستخدم عند التحميل إذا تم تجميع";
$MaxImageWidthTitle = " الحد الأقصى لعرض صورة المستخدم";
@ -3098,7 +3098,7 @@ $Logout = "تسجيل خروج";
$MyAgenda = "التقويم الشخصي";
$CourseHomepage = "صفحة المقرر";
$SwitchToTeacherView = "معاينة منظور المدرس";
$SwitchToStudentView = " معاينة واجهة الطلاب";
$SwitchToStudentView = "عرض منظور الطالب";
$AddResource = "أضفه";
$AddedResources = "مرفقات";
$TimeReportForTeacherX = "تقرير الوقت للمدرس %s";
@ -8419,4 +8419,6 @@ $VoteDislike = "لا يعجبني";
$GenerateStats = "توليد احصاءات";
$BasicCourseDocuments = "المستندات الاساسية للمقرر";
$WeekX = "اسبوعX";
$QuizWrongAnswerHereIsTheCorrectOne = ":اجابة خاطئة. الاجابة الصحيحة كانت";
$ThisQuizCanBeEmbeddable = "يمكن تضمين الاختبار في الفيديوهات او محتوى الموبايل";
?>

@ -8272,4 +8272,6 @@ $VoteDislike = "Dislike";
$GenerateStats = "Gerar estatísticas";
$BasicCourseDocuments = "Documentos básicos do curso";
$WeekX = "Semana %s";
$QuizWrongAnswerHereIsTheCorrectOne = "Resposta errada. O correto foi:";
$ThisQuizCanBeEmbeddable = "Este questionário pode ser incorporado em vídeos ou conteúdo para dispositivos móveis";
?>

@ -8390,4 +8390,5 @@ $BasicCourseDocuments = "Basic course documents";
$WeekX = "Week %s";
$QuizWrongAnswerHereIsTheCorrectOne = "Wrong answer. The correct one was:";
$ThisQuizCanBeEmbeddable = "This quiz can be embeddable on videos or mobile content";
$SearchGeolocalization = "Search for this location";
?>

@ -8321,4 +8321,6 @@ $GenerateStats = "Générer les statistiques";
$BasicCourseDocuments = "Documents de base du cours";
$WeekX = "Semaine %s";
$QuizWrongAnswerHereIsTheCorrectOne = "Vous vous êtes trompé. La réponse correcte était :";
$ThisQuizCanBeEmbeddable = "Cet exercice peut être inséré dans une vidéo ou du contenu mobile";
$SearchGeolocalization = "Localiser par l'adresse";
?>

@ -8415,4 +8415,6 @@ $GenerateStats = "Generar estatisticas";
$BasicCourseDocuments = "Documentos básicos del curso";
$WeekX = "Semana %s";
$QuizWrongAnswerHereIsTheCorrectOne = "Su selección ha sido errónea, la correcta es:";
$ThisQuizCanBeEmbeddable = "Este ejercicio puede ser integrado con videos o contenido móvil";
$SearchGeolocalization = "Localizar por esta dirección";
?>

@ -2299,11 +2299,15 @@ class learnpath
$lpItemId = (int) $lpItemId;
/** @var learnpathItem $item */
$item = $this->items[$lpItemId];
$item = isset($this->items[$lpItemId]) ? $this->items[$lpItemId] : null;
$itemViewId = 0;
if ($item) {
$itemViewId = (int) $item->db_item_view_id;
}
// Getting all the information about the item.
$sql = "SELECT lpi.audio, lpi.item_type, lp_view.status FROM $tbl_lp_item as lpi
$sql = "SELECT lpi.audio, lpi.item_type, lp_view.status
FROM $tbl_lp_item as lpi
INNER JOIN $tbl_lp_item_view as lp_view
ON (lpi.iid = lp_view.lp_item_id)
WHERE
@ -2404,7 +2408,6 @@ class learnpath
}
$isBlocked = false;
if (!empty($prerequisite)) {
$progress = self::getProgress(
$prerequisite,
@ -2438,12 +2441,6 @@ class learnpath
$accumulateWorkTime = ($pl * $tc * $perc / 100);
// Spent time (in seconds) so far in the learning path
/*$lpTime = Tracking::get_time_spent_in_lp(
$studentId,
$courseInfo['code'],
[$prerequisite],
$sessionId
);*/
$lpTimeList = Tracking::getCalculateTime($studentId, $courseId, $sessionId);
$lpTime = isset($lpTimeList[TOOL_LEARNPATH][$prerequisite]) ? $lpTimeList[TOOL_LEARNPATH][$prerequisite] : 0;
@ -2614,7 +2611,6 @@ class learnpath
$userId = (int) $userId;
$courseId = (int) $courseId;
$sessionId = (int) $sessionId;
$progress = 0;
$sessionCondition = api_get_session_condition($sessionId);
$table = Database::get_course_table(TABLE_LP_VIEW);
@ -2624,12 +2620,14 @@ class learnpath
lp_id = $lpId AND
user_id = $userId $sessionCondition ";
$res = Database::query($sql);
$progress = 0;
if (Database::num_rows($res) > 0) {
$row = Database:: fetch_array($res);
$progress = $row['progress'];
$progress = (int) $row['progress'];
}
return (int) $progress;
return $progress;
}
/**
@ -4718,6 +4716,10 @@ class learnpath
return false;
}
if (empty($courseId)) {
return false;
}
$link = self::getCategoryLinkForTool($id);
/** @var CTool $tool */

@ -162,7 +162,6 @@ $documentTree = DocumentManager::get_document_preview(
api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=add_audio&lp_id='.$lp->get_id().'&id='.$lp_item_id,
false,
true
//$folderId = false
);
$page .= $recordVoiceForm;

@ -310,7 +310,6 @@ if (isset($_SESSION['oLP'])) {
$_SESSION['oLP']->update_queue = [];
}
$action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : '';
if ($debug) {

@ -95,12 +95,10 @@ if ($export) {
}
$csv_content = [];
$from_myspace = false;
$this_section = SECTION_COURSES;
if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
$from_myspace = true;
$this_section = SECTION_TRACKING;
} else {
$this_section = SECTION_COURSES;
}
$nameTools = get_lang('StudentDetails');
@ -163,7 +161,7 @@ if (!empty($details)) {
}
$nameTools = get_lang('DetailsStudentInCourse');
} else {
if ($origin == 'resume_session') {
if ($origin === 'resume_session') {
$interbreadcrumb[] = [
'url' => "../session/session_list.php",
'name' => get_lang('SessionList'),
@ -393,7 +391,6 @@ switch ($action) {
$params = [
'pdf_title' => get_lang('Resume'),
//'course_code' => api_get_course_id(),
'session_info' => $sessionInfo,
'course_info' => '',
'pdf_date' => '',
@ -572,6 +569,7 @@ switch ($action) {
default:
break;
}
$courses_in_session = [];
// See #4676
@ -657,15 +655,7 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
if (api_is_drh() && !api_is_platform_admin()) {
if (!empty($student_id)) {
if (api_drh_can_access_all_session_content()) {
//@todo securize drh with student id
/*$users = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', api_get_user_id());
$userList = array();
foreach ($users as $user) {
$userList[] = $user['user_id'];
}
if (!in_array($student_id, $userList)) {
api_not_allowed(true);
}*/
} else {
if (!$isDrhOfCourse) {
if (api_is_drh() &&
@ -775,7 +765,12 @@ $avg_student_progress = $avg_student_score = 0;
if (empty($sessionId)) {
$isSubscribedToCourse = CourseManager::is_user_subscribed_in_course($user_info['user_id'], $course_code);
} else {
$isSubscribedToCourse = CourseManager::is_user_subscribed_in_course($user_info['user_id'], $course_code, true, $sessionId);
$isSubscribedToCourse = CourseManager::is_user_subscribed_in_course(
$user_info['user_id'],
$course_code,
true,
$sessionId
);
}
if ($isSubscribedToCourse) {
@ -884,7 +879,7 @@ $userInfo = [
'profile_url' => $user_info['profile_url'],
'groups' => $userGroupManager,
'avatar' => $userPicture,
'online' => $online
'online' => $online,
];
if (!empty($course_code)) {
@ -973,8 +968,11 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
?>
<div class="row">
<div class="col-sm-5">
<?php if (!empty($userGroups)) {
?>
<table class="table table-striped table-hover">
@ -1632,7 +1630,7 @@ if (empty($details)) {
$i = 0;
if (Database::num_rows($result_exercices) > 0) {
while ($exercices = Database::fetch_array($result_exercices)) {
$exercise_id = intval($exercices['id']);
$exercise_id = (int) $exercices['id'];
$count_attempts = Tracking::count_student_exercise_attempts(
$student_id,
$courseInfo['real_id'],

@ -112,8 +112,7 @@ if ($group_id != 0) {
$groupInfo = $usergroup->get($group_id);
$groupInfo['name'] = Security::remove_XSS($groupInfo['name']);
$groupInfo['description'] = Security::remove_XSS($groupInfo['description']);
$interbreadcrumb[] = ['url' => '#', 'name' => $group_info['name']];
$interbreadcrumb[] = ['url' => '#', 'name' => $groupInfo['name']];
if (isset($_GET['action']) && $_GET['action'] == 'leave') {
$user_leaved = intval($_GET['u']);
@ -244,7 +243,7 @@ if ($is_group_member || $groupInfo['visibility'] == GROUP_PERMISSION_OPEN) {
// My friends
$friend_html = SocialManager::listMyFriendsBlock(
$user_id,
api_get_user_id(),
'',
''
);
@ -328,7 +327,7 @@ $social_menu_block = SocialManager::show_social_menu('groups', $group_id);
$tpl->setHelp('Groups');
$tpl->assign('create_link', $create_thread_link);
$tpl->assign('is_group_member', $is_group_member);
$tpl->assign('group_info', $group_info);
$tpl->assign('group_info', $groupInfo);
$tpl->assign('social_friend_block', $friend_html);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_forum', $socialForum);

@ -61,7 +61,6 @@ function start()
});
// Auto-boxing
if (markers.length) {
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < markers.length; ++i) {

@ -8,7 +8,8 @@ $(function() {
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#skill-block" href="#skillList" aria-expanded="true" aria-controls="skillList">
<a role="button" data-toggle="collapse"
data-parent="#skill-block" href="#skillList" aria-expanded="true" aria-controls="skillList">
{{ "Skills" | get_lang }}
</a>
<div class="btn-group pull-right">

@ -13,8 +13,6 @@
{% if term %}
{{ display.panel('TermsAndConditions'|get_lang, term.content, term.date_text ) }}
{% endif %}
</div>
</div>
{% endblock %}

@ -3,7 +3,8 @@
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-sn">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#sn-avatar" href="#sn-avatar-one" aria-expanded="true" aria-controls="sn-avatar-one">
<a role="button" data-toggle="collapse" data-parent="#sn-avatar"
href="#sn-avatar-one" aria-expanded="true" aria-controls="sn-avatar-one">
{{ "Profile" | get_lang }}
</a>
</h4>
@ -21,7 +22,7 @@
<img src="{{ _p.web_img }}icons/svg/identifier_student.svg" width="32px" height="32px">
{% endif %}
</div>
{% elseif user.status == 1 %}
{% elseif user.status == 1 or user.status == 17 %}
<div class="avatar-icon">
{% if user.is_admin %}
<img src="{{ _p.web_img }}icons/svg/identifier_admin.svg" width="32px" height="32px">
@ -33,9 +34,7 @@
<!-- END TYPE PROFILE -->
<!-- LM -->
<div class="avatar-lm">
<h5></h5>
{% if user.language %}
{% if user.language.code == 'fr' %}
<img src="{{ _p.web }}web/assets/flag-icon-css/flags/4x3/fr.svg" width="36px">
@ -56,7 +55,6 @@
<h5></h5>
{% for item in extra_info %}
{% if item.variable == 'langue_cible' %}
{% if item.value == 'French2' %}
<img src="{{ _p.web }}web/assets/flag-icon-css/flags/4x3/fr.svg" width="36px">
{% elseif item.value == 'German2' %}
@ -70,18 +68,12 @@
{% elseif item.value == 'English' %}
<img src="{{ _p.web }}web/assets/flag-icon-css/flags/4x3/gb.svg" width="36px">
{% endif %}
{% endif %}
{% endfor %}
</div>
<!-- END LC -->
</div>
{# Ofaj #}
<ul class="list-user-data">
<li class="item item-name">
<h5>{{ user.complete_name }} </h5>
@ -149,13 +141,9 @@
{{ "Chat" | get_lang }} ({{ "Online" | get_lang }})
</a>
</li>
{# else #}
{# <img src="{{ "offline.png" | icon }}" alt="{{ "Online" | get_lang }}"> #}
{# {{ "Chat" | get_lang }} ({{ "Offline" | get_lang }}) #}
{% endif %}
{% endif %}
{% endif %}
<dl class="list-info">
{% for item in extra_info %}
{% if item.variable != 'langue_cible' %}

@ -2739,23 +2739,17 @@ class Wiki
$sql = "SELECT * FROM ".$tbl_wiki."
WHERE
c_id = $course_id AND
title LIKE '%".Database::escape_string(
$search_term
)."%' OR
title LIKE '%".Database::escape_string($search_term)."%' OR
content LIKE '%".Database::escape_string(
$search_term
)."%' AND
".$groupfilter.$condition_session."";
//search all pages and all versions
)."%' AND ".$groupfilter.$condition_session;
} else {
$sql = "SELECT * FROM ".$tbl_wiki."
WHERE
c_id = $course_id AND
title LIKE '%".Database::escape_string(
$search_term
)."%' AND
".$groupfilter.$condition_session."";
//search all pages and all versions
)."%' AND ".$groupfilter.$condition_session;
}
} else {
if ($search_content == '1') {
@ -2797,24 +2791,16 @@ class Wiki
WHERE
c_id = $course_id AND
visibility=1 AND
title LIKE '%".Database::escape_string(
$search_term
)."%' OR
content LIKE '%".Database::escape_string(
$search_term
)."%' AND
".$groupfilter.$condition_session."";
//search all pages and all versions
title LIKE '%".Database::escape_string($search_term)."%' OR
content LIKE '%".Database::escape_string($search_term)."%' AND
".$groupfilter.$condition_session;
} else {
$sql = "SELECT * FROM ".$tbl_wiki."
WHERE
c_id = $course_id AND
visibility=1 AND
title LIKE '%".Database::escape_string(
$search_term
)."%' AND
".$groupfilter.$condition_session."";
//search all pages and all versions
title LIKE '%".Database::escape_string($search_term)."%' AND
".$groupfilter.$condition_session;
}
} else {
if ($search_content == '1') {
@ -2822,12 +2808,8 @@ class Wiki
WHERE
s1.c_id = $course_id AND
visibility=1 AND
title LIKE '%".Database::escape_string(
$search_term
)."%' OR
content LIKE '%".Database::escape_string(
$search_term
)."%' AND
title LIKE '%".Database::escape_string($search_term)."%' OR
content LIKE '%".Database::escape_string($search_term)."%' AND
id=(
SELECT MAX(s2.id)
FROM ".$tbl_wiki." s2

@ -201,9 +201,10 @@ function otherRow($questions, $user, $courseId)
$question['survey_id'],
$question['question_id']
);
/** @var CSurveyQuestionOption|null $option */
$option = end($options);
/** @var CSurveyQuestionOption $option */
foreach ($options as $option) {
if ($option) {
$value = $option->getSort();
$row[] = '"'.$value.'"';
}

@ -21,7 +21,7 @@ class FeatureContext extends MinkContext
*/
public function iAmAPlatformAdministrator()
{
$this->visit('/index.php?logout=logout');
$this->visit('/index.php?logout=logout&uid=1');
$this->iAmOnHomepage();
$this->fillField('login', 'admin');
$this->fillField('password', 'admin');

@ -48,6 +48,8 @@ Feature: LP tool
Then I should see "LP 1"
And I should see "Document 1"
And I should see "Exercise 1"
And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"
Then I should see "LP 1"
# Scenario: Check the PDF export in LP list if hide SCORM PDF link is false
# Given I am on "/main/admin/settings.php?category=Course"
@ -64,8 +66,7 @@ Feature: LP tool
# Then I should not see an icon with title "Export to PDF"
Scenario: LP exists and LP category exists
Given I am on course "TEMP" homepage
And I am on "/main/lp/lp_controller.php?cidReq=TEMP"
And I am on "/main/lp/lp_controller.php?cidReq=TEMP&id_session=0&gidReq=0&gradebook=0&origin="
Then I should see "LP 1"
And I should see "LP category 1"

Loading…
Cancel
Save