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. 27
      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. 62
      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. 25
      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. 28
      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. 19
      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); $questions = $repo->matching($criteria);
if (empty($id)) {
$id = '';
}
$params = [ $params = [
'id' => $id, 'id' => $id,
'title' => $title, 'title' => $title,
@ -127,7 +130,6 @@ if ($formSent) {
$url.http_build_query([ $url.http_build_query([
'cidReq' => $courseCode, 'cidReq' => $courseCode,
'id_session' => $exercise->sessionId, 'id_session' => $exercise->sessionId,
'myid' => 1,
'exerciseId' => $exerciseId, 'exerciseId' => $exerciseId,
'type' => $question->getType(), 'type' => $question->getType(),
'editQuestion' => $question->getId(), 'editQuestion' => $question->getId(),
@ -136,10 +138,14 @@ if ($formSent) {
} }
$question->questionData .= '<br />'.$exerciseData; $question->questionData .= '<br />'.$exerciseData;
} else { } else {
$question->questionData .= get_lang('Course').': '.Display::url( $question->questionData = Display::url(
$courseInfo['name'], Display::return_icon('edit.png', get_lang('Edit')),
$exerciseUrl.http_build_query([ $url.http_build_query([
'cidReq' => $courseCode, '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. // only when it is needed.
if ($action == 'add') { if ($action == 'add') {
$dropbox_person = new Dropbox_Person( $dropbox_person = new Dropbox_Person(
$_user['user_id'], $user_id,
$is_courseAdmin, $is_courseAdmin,
$is_courseTutor $is_courseTutor
); );

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

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

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

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

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

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

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

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

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

@ -13,10 +13,10 @@
*/ */
if (isset($_GET['editQuestion'])) { if (isset($_GET['editQuestion'])) {
$objQuestion = Question::read($_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 { } else {
$objQuestion = Question::getInstance($_REQUEST['answerType']); $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)) { if (is_object($objQuestion)) {
@ -50,7 +50,7 @@ if (is_object($objQuestion)) {
$objQuestion->createAnswersForm($form); $objQuestion->createAnswersForm($form);
// this variable $show_quiz_edition comes from admin.php blocks the exercise/quiz modifications // 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(); $form->freeze();
} }
@ -65,6 +65,12 @@ if (is_object($objQuestion)) {
$objQuestion->type != HOT_SPOT_DELINEATION $objQuestion->type != HOT_SPOT_DELINEATION
) { ) {
if (isset($_GET['editQuestion'])) { 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>'; echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&page='.$page.'&message=ItemUpdated"</script>';
} else { } else {
// New question // New question

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

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

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

@ -1282,13 +1282,14 @@ class Event
$course_id, $course_id,
$session_id = 0 $session_id = 0
) { ) {
$track_e_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$user_id = (int) $user_id; $user_id = (int) $user_id;
$exercise_id = (int) $exercise_id; $exercise_id = (int) $exercise_id;
$course_id = (int) $course_id; $course_id = (int) $course_id;
$session_id = (int) $session_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 WHERE
exe_user_id = $user_id AND exe_user_id = $user_id AND
exe_exo_id = $exercise_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. * 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 $courseId
* @param int session id * @param int $session_id
* *
* @return array with the results * @return array with the results
*/ */
@ -1365,8 +1366,8 @@ class Event
/** /**
* Gets all exercise results (NO Exercises in LPs ) from a given exercise id, course, session. * Gets all exercise results (NO Exercises in LPs ) from a given exercise id, course, session.
* *
* @param int $courseId * @param int $courseId
* @param int session id * @param int $session_id
* @param bool $get_count * @param bool $get_count
* *
* @return array with the results * @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. * 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 $courseId
* @param int session id * @param int $session_id
* *
* @return array with the results * @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. * 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 * @param string $status
* *
* @return array with the results * @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. * Count exercise attempts (NO Exercises in LPs ) from a given exercise id, course, session.
* *
* @param int $user_id * @param int $user_id
* @param int exercise id * @param int $exercise_id
* @param int $courseId * @param int $courseId
* @param int session id * @param int $session_id
* *
* @return array with the results * @return array with the results
*/ */

@ -1100,7 +1100,7 @@ class Link extends Model
false 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;"; $event = "javascript: if(!confirm('".get_lang('LinkDelconfirm')."'))return false;";
$title = get_lang('Delete'); $title = get_lang('Delete');

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

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

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

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

@ -8272,4 +8272,6 @@ $VoteDislike = "Dislike";
$GenerateStats = "Gerar estatísticas"; $GenerateStats = "Gerar estatísticas";
$BasicCourseDocuments = "Documentos básicos do curso"; $BasicCourseDocuments = "Documentos básicos do curso";
$WeekX = "Semana %s"; $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"; $WeekX = "Week %s";
$QuizWrongAnswerHereIsTheCorrectOne = "Wrong answer. The correct one was:"; $QuizWrongAnswerHereIsTheCorrectOne = "Wrong answer. The correct one was:";
$ThisQuizCanBeEmbeddable = "This quiz can be embeddable on videos or mobile content"; $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"; $BasicCourseDocuments = "Documents de base du cours";
$WeekX = "Semaine %s"; $WeekX = "Semaine %s";
$QuizWrongAnswerHereIsTheCorrectOne = "Vous vous êtes trompé. La réponse correcte était :"; $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"; $BasicCourseDocuments = "Documentos básicos del curso";
$WeekX = "Semana %s"; $WeekX = "Semana %s";
$QuizWrongAnswerHereIsTheCorrectOne = "Su selección ha sido errónea, la correcta es:"; $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; $lpItemId = (int) $lpItemId;
/** @var learnpathItem $item */ /** @var learnpathItem $item */
$item = $this->items[$lpItemId]; $item = isset($this->items[$lpItemId]) ? $this->items[$lpItemId] : null;
$itemViewId = (int) $item->db_item_view_id; $itemViewId = 0;
if ($item) {
$itemViewId = (int) $item->db_item_view_id;
}
// Getting all the information about the item. // 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 INNER JOIN $tbl_lp_item_view as lp_view
ON (lpi.iid = lp_view.lp_item_id) ON (lpi.iid = lp_view.lp_item_id)
WHERE WHERE
@ -2404,7 +2408,6 @@ class learnpath
} }
$isBlocked = false; $isBlocked = false;
if (!empty($prerequisite)) { if (!empty($prerequisite)) {
$progress = self::getProgress( $progress = self::getProgress(
$prerequisite, $prerequisite,
@ -2438,12 +2441,6 @@ class learnpath
$accumulateWorkTime = ($pl * $tc * $perc / 100); $accumulateWorkTime = ($pl * $tc * $perc / 100);
// Spent time (in seconds) so far in the learning path // 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); $lpTimeList = Tracking::getCalculateTime($studentId, $courseId, $sessionId);
$lpTime = isset($lpTimeList[TOOL_LEARNPATH][$prerequisite]) ? $lpTimeList[TOOL_LEARNPATH][$prerequisite] : 0; $lpTime = isset($lpTimeList[TOOL_LEARNPATH][$prerequisite]) ? $lpTimeList[TOOL_LEARNPATH][$prerequisite] : 0;
@ -2614,7 +2611,6 @@ class learnpath
$userId = (int) $userId; $userId = (int) $userId;
$courseId = (int) $courseId; $courseId = (int) $courseId;
$sessionId = (int) $sessionId; $sessionId = (int) $sessionId;
$progress = 0;
$sessionCondition = api_get_session_condition($sessionId); $sessionCondition = api_get_session_condition($sessionId);
$table = Database::get_course_table(TABLE_LP_VIEW); $table = Database::get_course_table(TABLE_LP_VIEW);
@ -2624,12 +2620,14 @@ class learnpath
lp_id = $lpId AND lp_id = $lpId AND
user_id = $userId $sessionCondition "; user_id = $userId $sessionCondition ";
$res = Database::query($sql); $res = Database::query($sql);
$progress = 0;
if (Database::num_rows($res) > 0) { if (Database::num_rows($res) > 0) {
$row = Database:: fetch_array($res); $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; return false;
} }
if (empty($courseId)) {
return false;
}
$link = self::getCategoryLinkForTool($id); $link = self::getCategoryLinkForTool($id);
/** @var CTool $tool */ /** @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, api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=add_audio&lp_id='.$lp->get_id().'&id='.$lp_item_id,
false, false,
true true
//$folderId = false
); );
$page .= $recordVoiceForm; $page .= $recordVoiceForm;

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

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

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

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

@ -8,7 +8,8 @@ $(function() {
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne"> <div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title"> <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 }} {{ "Skills" | get_lang }}
</a> </a>
<div class="btn-group pull-right"> <div class="btn-group pull-right">

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

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

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

@ -128,13 +128,13 @@ function getQuestionOptions($user, $courseId, $surveyId, $questionId)
$options = Database::getManager() $options = Database::getManager()
->createQuery( ->createQuery(
'SELECT sqo FROM ChamiloCourseBundle:CSurveyQuestionOption sqo 'SELECT sqo FROM ChamiloCourseBundle:CSurveyQuestionOption sqo
INNER JOIN ChamiloCourseBundle:CSurveyAnswer sa INNER JOIN ChamiloCourseBundle:CSurveyAnswer sa
WITH WITH
sqo.cId = sa.cId sqo.cId = sa.cId
AND sqo.questionId = sa.questionId AND sqo.questionId = sa.questionId
AND sqo.surveyId = sa.surveyId AND sqo.surveyId = sa.surveyId
AND sqo.iid = sa.optionId AND sqo.iid = sa.optionId
WHERE sa.user = :user AND sa.cId = :course AND sa.surveyId = :survey AND sa.questionId = :question' WHERE sa.user = :user AND sa.cId = :course AND sa.surveyId = :survey AND sa.questionId = :question'
) )
->setParameters( ->setParameters(
[ [
@ -201,9 +201,10 @@ function otherRow($questions, $user, $courseId)
$question['survey_id'], $question['survey_id'],
$question['question_id'] $question['question_id']
); );
/** @var CSurveyQuestionOption|null $option */
$option = end($options);
/** @var CSurveyQuestionOption $option */ if ($option) {
foreach ($options as $option) {
$value = $option->getSort(); $value = $option->getSort();
$row[] = '"'.$value.'"'; $row[] = '"'.$value.'"';
} }

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

@ -48,6 +48,8 @@ Feature: LP tool
Then I should see "LP 1" Then I should see "LP 1"
And I should see "Document 1" And I should see "Document 1"
And I should see "Exercise 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 # 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" # 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" # Then I should not see an icon with title "Export to PDF"
Scenario: LP exists and LP category exists 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&id_session=0&gidReq=0&gradebook=0&origin="
And I am on "/main/lp/lp_controller.php?cidReq=TEMP"
Then I should see "LP 1" Then I should see "LP 1"
And I should see "LP category 1" And I should see "LP category 1"

Loading…
Cancel
Save