Restore changes from 1.11.x + update changes from 1.11.x

- Replace CSS "float-right" class with legacy "pull-right"
in order to avoid diffs from 1.11.x.
- New UI changes should be added only in the templates in master or
if a change need to be done in the PHP code, then send it also to 1.11.x
in order to maintain both branches as close as possible.
pull/2881/head
Julio Montoya 7 years ago
parent 2a697d4ac0
commit 2fc9bba087
  1. 4
      assets/css/scss/_base.scss
  2. 14
      main/admin/questions.php
  3. 2
      main/admin/system_announcements.php
  4. 2
      main/announcements/announcements.php
  5. 2
      main/attendance/attendance_calendar.php
  6. 4
      main/attendance/attendance_sheet.php
  7. 1
      main/badge/issued.php
  8. 3
      main/document/showinframes.php
  9. 2
      main/dropbox/dropbox_functions.inc.php
  10. 25
      main/dropbox/index.php
  11. 10
      main/exercise/ReadingComprehension.php
  12. 10
      main/exercise/admin.php
  13. 27
      main/exercise/exercise.class.php
  14. 152
      main/exercise/exercise.php
  15. 1
      main/exercise/fill_blanks.class.php
  16. 4
      main/exercise/hotspot_answers.as.php
  17. 2
      main/exercise/multiple_answer.class.php
  18. 2
      main/exercise/multiple_answer_combination.class.php
  19. 2
      main/exercise/multiple_answer_true_false.class.php
  20. 60
      main/exercise/question.class.php
  21. 12
      main/exercise/question_admin.inc.php
  22. 1
      main/exercise/question_list_admin.inc.php
  23. 3
      main/forum/index.php
  24. 2
      main/forum/viewforumcategory.php
  25. 5
      main/glossary/glossary.js.php
  26. 2
      main/gradebook/lib/fe/displaygradebook.php
  27. 19
      main/inc/ajax/document.ajax.php
  28. 37
      main/inc/ajax/exercise.ajax.php
  29. 58
      main/inc/ajax/lang.ajax.php
  30. 35
      main/inc/lib/AnnouncementManager.php
  31. 31
      main/inc/lib/exercise.lib.php
  32. 10
      main/inc/lib/extra_field.lib.php
  33. 116
      main/inc/lib/glossary.lib.php
  34. 239
      main/inc/lib/link.lib.php
  35. 130
      main/inc/lib/myspace.lib.php
  36. 1
      main/inc/lib/online.inc.php
  37. 11
      main/inc/lib/pear/HTML/QuickForm/Renderer/Default.php
  38. 23
      main/inc/lib/skill.lib.php
  39. 368
      main/inc/lib/social.lib.php
  40. 2
      main/inc/lib/text.lib.php
  41. 26
      main/inc/lib/usergroup.lib.php
  42. 2
      main/lp/embed.php
  43. 77
      main/lp/learnpath.class.php
  44. 55
      main/lp/learnpathItem.class.php
  45. 2
      main/lp/lp_ajax_initialize.php
  46. 2
      main/lp/lp_ajax_save_item.php
  47. 92
      main/lp/lp_controller.php
  48. 30
      main/lp/lp_list.php
  49. 5
      main/lp/lp_update_scorm.php
  50. 4
      main/lp/lp_view.php
  51. 61
      main/mySpace/myStudents.php
  52. 2
      main/session/session_category_list.php
  53. 15
      main/session/session_course_user_list.php
  54. 4
      main/session/session_list.php
  55. 1
      main/social/group_topics.php
  56. 23
      main/social/group_view.php
  57. 58
      main/social/groups.php
  58. 2
      main/social/invitations.php
  59. 2
      main/social/profile.php
  60. 2
      main/survey/meeting.php
  61. 2
      main/survey/surveyUtil.class.php
  62. 2
      main/ticket/ticket_details.php
  63. 2
      main/ticket/tickets.php
  64. 2
      main/tracking/courseLog.php
  65. 2
      main/tracking/messages.php
  66. 2
      main/tracking/total_time.php
  67. 4
      main/user/user.php
  68. 1
      main/wiki/wiki.inc.php
  69. 2
      main/work/add_user.php

@ -4070,3 +4070,7 @@ table.certaintyTable {
margin-bottom: 10px;
vertical-align: top;
}
.pull-right {
@extend .float-right;
}

@ -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(),
])
);
}

@ -17,7 +17,7 @@ require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
$_SESSION['this_section'] = $this_section;
$action = $_GET['action'] ?? null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
$action_todo = false;
// Access restrictions

@ -292,7 +292,7 @@ switch ($action) {
if (empty($count)) {
$html = '';
if ($allowToEdit && (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')) {
$html .= '<div id="no-data-view" class="tool-view">';
$html .= '<div id="no-data-view">';
$html .= '<h3>'.get_lang('Announcements').'</h3>';
$html .= Display::return_icon('valves.png', '', [], 64);
$html .= '<div class="controls">';

@ -170,7 +170,7 @@ if (isset($action) && $action == 'calendar_add') {
if (!$is_locked_attendance || api_is_platform_admin()) {
if (api_is_allowed_to_edit()) {
echo '<div class="float-right">';
echo '<div class="pull-right">';
echo '<a href="index.php?'.api_get_cidreq().'&action=calendar_edit&calendar_id='.intval($calendar['id']).'&attendance_id='.$attendance_id.'">'.
Display::return_icon('edit.png', get_lang('Edit'), ['style' => 'vertical-align:middle'], ICON_SIZE_SMALL).'</a>&nbsp;';
echo '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=calendar_delete&calendar_id='.intval($calendar['id']).'&attendance_id='.$attendance_id.'">'.

@ -208,7 +208,7 @@ if (api_is_allowed_to_edit(null, true) ||
<form method="post" action="index.php?action=attendance_sheet_add&<?php echo api_get_cidreq().$param_filter; ?>&attendance_id=<?php echo $attendance_id; ?>" >
<div class="attendance-sheet-content" style="width:100%;background-color:#E1E1E1;margin-top:20px;">
<div class="divTableWithFloatingHeader attendance-users-table" style="width:45%;float:left;margin:0px;padding:0px;">
<table class="tableWithFloatingHeader table" width="100%">
<table class="tableWithFloatingHeader data_table" width="100%">
<thead>
<tr class="tableFloatingHeader" style="position: absolute; top: 0px; left: 0px; visibility: hidden; margin:0px;padding:0px" >
<th width="10px"><?php echo '#'; ?></th>
@ -260,7 +260,7 @@ if (api_is_allowed_to_edit(null, true) ||
<?php
echo '<div class="divTableWithFloatingHeader attendance-calendar-table" style="margin:0px;padding:0px;float:left;width:55%;overflow:auto;overflow-y:hidden;">';
echo '<table class="tableWithFloatingHeader table" width="100%">';
echo '<table class="tableWithFloatingHeader data_table" width="100%">';
echo '<thead>';
$result = null;
if (count($attendant_calendar) > 0) {

@ -16,7 +16,6 @@ use SkillRelUser as SkillRelUserManager;
require_once __DIR__.'/../inc/global.inc.php';
$issue = isset($_REQUEST['issue']) ? (int) $_REQUEST['issue'] : 0;
$userId = isset($_REQUEST['user']) ? (int) $_REQUEST['user'] : 0;
if (empty($issue)) {
api_not_allowed(true);

@ -95,7 +95,7 @@ if (!$is_allowed_to_edit && !$is_visible) {
}
$pathinfo = pathinfo($header_file);
$playerSupportedFiles = ['mp4', 'ogv', 'flv', 'm4v', 'webm'];
$playerSupportedFiles = ['mp3', 'mp4', 'ogv', 'flv', 'm4v', 'webm'];
$playerSupported = false;
if (in_array(strtolower($pathinfo['extension']), $playerSupportedFiles)) {
$playerSupported = true;
@ -338,6 +338,7 @@ if ($execute_iframe) {
}
echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]);
echo '<iframe
id="mainFrame"
name="mainFrame"

@ -1199,7 +1199,7 @@ function feedback_form($url)
$return .= '<textarea name="feedback" class="form-control" rows="4"></textarea>';
$return .= '</div>';
$return .= '<div class="col-sm-3">';
$return .= '<div class="float-right"><a class="btn btn-default btn-sm" href="'.$url.'"><i class="fa fa-times" aria-hidden="true"></i></a></div>';
$return .= '<div class="pull-right"><a class="btn btn-default btn-sm" href="'.$url.'"><i class="fa fa-times" aria-hidden="true"></i></a></div>';
$return .= '<button type="submit" class="btn btn-primary btn-sm" name="store_feedback" value="'.get_lang('Ok').'"
onclick="javascript: document.form_dropbox.attributes.action.value = document.location;">'.get_lang('AddComment').'</button>';
$return .= '</div>';

@ -320,26 +320,19 @@ if ($action != 'add') {
/* THE MENU TABS */
if ($showSentReceivedTabs) {
?>
<ul class="nav nav-tabs">
<?php
$activeSend = $activeReceived = '';
if (!$view || $view == 'sent') {
$activeSend = 'active';
} ?>
<li class="nav-item">
<a class="nav-link <?php echo $activeSend; ?>" href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=sent" >
<li <?php if (!$view || $view == 'sent') {
echo 'class="active"';
} ?> >
<a href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=sent" >
<?php echo get_lang('SentFiles'); ?>
</a>
</li>
<?php
if ($view == 'received') {
$activeReceived = 'active';
} ?>
<li class="nav-item">
<a class="nav-link <?php echo $activeReceived; ?>" href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=received" >
<?php echo get_lang('ReceivedFiles'); ?>
</a>
<li <?php if ($view == 'received') {
echo 'class="active"';
} ?> >
<a href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=received" >
<?php echo get_lang('ReceivedFiles'); ?></a>
</li>
</ul>
<?php

@ -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>';
}

@ -1709,23 +1709,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;
}
/**
@ -7377,7 +7390,7 @@ class Exercise
}
}
echo '<div class="row"><div class="float-right">'.$paginationCounter.'</div></div>';
echo '<div class="row"><div class="pull-right">'.$paginationCounter.'</div></div>';
echo Display::div($exercise_actions, ['class' => 'form-actions']);
echo '</div>';
}

@ -653,9 +653,6 @@ if (isset($list_ordered) && !empty($list_ordered)) {
}
$tableRows = [];
$listExercise = [];
$list = [];
/* LIST EXERCISES */
if (!empty($exerciseList)) {
if ($origin != 'learnpath') {
@ -800,21 +797,26 @@ if (!empty($exerciseList)) {
$url = $move.'<a '.$alt_title.' class="'.$class_tip.'" id="tooltip_'.$row['id'].'" href="overview.php?'.api_get_cidreq().$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">
'.Display::return_icon('quiz.png', $row['title']).'
'.$title.' </a>';
'.$title.' </a>'.PHP_EOL;
$listExercise['id'] = $row['id'];
$listExercise['title'] = $title;
$listExercise['description'] = cut($row['description'], 150, false);
$listExercise['url'] = "overview.php?".api_get_cidreq().$mylpid.$mylpitemid.'&exerciseId='.$row['id'];
$listExercise['lp_blocked'] = $lp_blocked;
$listExercise['visibility'] = $visibility;
$listExercise['active'] = $row['active'];
if (ExerciseLib::isQuizEmbeddable($row)) {
$embeddableIcon = Display::return_icon('om_integration.png', get_lang('ThisQuizCanBeEmbeddable'));
$url .= Display::div($embeddableIcon, ['class' => 'pull-right']);
}
$item = Display::tag('td', $url.' '.$session_img.$lp_blocked);
//$item = Display::tag('td', $url.' '.$session_img.$lp_blocked);
// Count number exercise - teacher
$sql = "SELECT count(*) count FROM $TBL_EXERCISE_QUESTION
WHERE c_id = $courseId AND exercice_id = $my_exercise_id";
$sqlresult = Database::query($sql);
$rowi = (int) Database::result($sqlresult, 0, 0);
if ($sessionId == $row['session_id']) {
$actions = '';
// Questions list
// Questions list
$actions = Display::url(
$actions .= Display::url(
Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL),
'admin.php?'.api_get_cidreq().'&exerciseId='.$row['id']
);
@ -1085,8 +1087,7 @@ if (!empty($exerciseList)) {
} else {
$number_of_questions = $rowi;
}
$listExercise['number_questions'] = $number_of_questions;
//$item .= Display::tag('td', $number_of_questions);
$item .= Display::tag('td', $number_of_questions);
} else {
// Student only.
$visibility = api_get_item_visibility(
@ -1099,15 +1100,12 @@ if (!empty($exerciseList)) {
if ($visibility == 0) {
continue;
}
$score = null;
$url = '<a '.$alt_title.' href="overview.php?'.api_get_cidreq().$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">'.
$cut_title.'</a>';
$listExercise['id'] = $row['id'];
$listExercise['title'] = $cut_title;
$listExercise['url'] = 'overview.php?'.api_get_cidreq().$mylpid.$mylpitemid.'&exerciseId='.$row['id'];
// Link of the exercise.
//$item = Display::tag('td', $url.' '.$session_img);
$item = Display::tag('td', $url.' '.$session_img);
// Count number exercise questions.
/*$sql = "SELECT count(*) FROM $TBL_EXERCISE_QUESTION
@ -1160,8 +1158,10 @@ if (!empty($exerciseList)) {
if ($num > 0) {
$row_track = Database :: fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt').' : ';
$score = ExerciseLib::show_score($row_track['score'], $row_track['max_score']);
$attempt_text .= $score['html'];
$attempt_text .= ExerciseLib::show_score(
$row_track['score'],
$row_track['max_score']
);
} else {
//No attempts
$attempt_text = get_lang('NotAttempted');
@ -1223,11 +1223,10 @@ if (!empty($exerciseList)) {
if ($num > 0) {
$row_track = Database :: fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt').' : ';
$score = ExerciseLib::show_score(
$attempt_text .= ExerciseLib::show_score(
$row_track['score'],
$row_track['max_score']
);
$attempt_text .= $score['html'];
} else {
$attempt_text = get_lang('NotAttempted');
}
@ -1251,10 +1250,7 @@ if (!empty($exerciseList)) {
$num = '<span class="tooltip" style="display: none;">'.$num.'</span>';
}
$listExercise['status'] = $attempt_text;
$listExercise['description'] = cut($row['description'], 150, false);
$listExercise['score'] = $score;
$listExercise['number_questions'] = $rowi;
$item .= Display::tag('td', $attempt_text);
}
if ($is_allowedToEdit) {
@ -1263,17 +1259,23 @@ if (!empty($exerciseList)) {
if (!empty($additionalActions)) {
$actions .= $additionalActions.PHP_EOL;
}
$listExercise['actions'] = $actions;
$item .= Display::tag('td', $actions, ['class' => 'td_actions']);
} else {
if ($isDrhOfCourse) {
$actions = '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
$listExercise['actions'] = $actions;
// .= Display::tag('td', $actions, ['class' => 'td_actions']);
$item .= Display::tag('td', $actions, ['class' => 'td_actions']);
}
}
$list[] = $listExercise;
$tableRows[] = Display::tag(
'tr',
$item,
[
'id' => 'exercise_list_'.$my_exercise_id,
]
);
}
}
}
@ -1310,12 +1312,10 @@ while ($row = Database :: fetch_array($result, 'ASSOC')) {
}
$nbrActiveTests = 0;
$itemHotpotatoes = [];
$listHotpotatoes = [];
if (isset($attribute['path']) && is_array($attribute['path'])) {
$hotpotatoes_exist = true;
foreach ($attribute['path'] as $key => $path) {
$item = '';
$title = GetQuizName($path, $documentPath);
if ($title == '') {
$title = basename($path);
@ -1343,11 +1343,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
);
}
$url = 'showinframes.php?'.api_get_cidreq().'&'.http_build_query(['file' => $path, 'uid' => $userId]);
$itemHotpotatoes['url'] = $url;
$itemHotpotatoes['visibility'] = $visibility;
/*$item = Display::tag(
$item = Display::tag(
'td',
implode(PHP_EOL, [
Display::return_icon('hotpotatoes_s.png', "HotPotatoes"),
@ -1360,11 +1356,9 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
['class' => $visibility == 0 ? 'text-muted' : null]
),
])
);*/
$itemHotpotatoes['title'] = $title;
);
//$item .= Display::tag('td', '-');
$item .= Display::tag('td', '-');
$actions = Display::url(
Display::return_icon(
@ -1390,12 +1384,8 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
}
$actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
$itemHotpotatoes['actions'] = $actions;
$listHotpotatoes[] = $itemHotpotatoes;
//$item .= Display::tag('td', $actions);
//$tableRows[] = Display::tag('tr', $item);
$item .= Display::tag('td', $actions);
$tableRows[] = Display::tag('tr', $item);
} else {
$visibility = api_get_item_visibility(
['real_id' => $courseId],
@ -1403,7 +1393,6 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
$attribute['id'][$key],
$sessionId
);
$itemHotpotatoes['visibility'] = $visibility;
if (0 == $visibility) {
continue;
@ -1417,13 +1406,8 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
api_get_session_id()
);
$url = 'showinframes.php?'.api_get_cidreq().'&'.http_build_query(['file' => $path, 'cid' => api_get_course_id(), 'uid' => $userId]);
$itemHotpotatoes['url'] = $url;
$itemHotpotatoes['title'] = $title;
$itemHotpotatoes['attempt'] = $attempt;
$nbrActiveTests = $nbrActiveTests + 1;
/*$item .= Display::tag(
$item .= Display::tag(
'td',
Display::url(
$title,
@ -1433,60 +1417,46 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
'uid' => $userId,
])
)
);*/
);
if (!empty($attempt)) {
$urlResults = 'hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'&filter_by_user='.$userId;
$itemHotpotatoes['results'] = $url;
/*$actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'&filter_by_user='.$userId.'">'
.Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).
'</a>';*/
$attemptText = get_lang('LatestAttempt');
$score = ExerciseLib::show_score(
$actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'&filter_by_user='.$userId.'">'.Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
$attemptText = get_lang('LatestAttempt').' : ';
$attemptText .= ExerciseLib::show_score(
$attempt['score'],
$attempt['max_score']
);
$itemHotpotatoes['score'] = $score;
).' ';
$attemptText .= $actions;
} else {
// No attempts.
$attemptText = get_lang('NotAttempted').' ';
}
$itemHotpotatoes['status'] = $attemptText;
//$item .= Display::tag('td', $attemptText);
$item .= Display::tag('td', $attemptText);
if ($isDrhOfCourse) {
$urlResults = 'hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path;
$itemHotpotatoes['results'] = $urlResults;
/*$actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
$actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
$item .= Display::tag(
'td',
$actions,
['class' => 'td_actions']
);*/
);
}
$listHotpotatoes[] = $itemHotpotatoes;
//$tableRows[] = Display::tag('tr', $item);
$tableRows[] = Display::tag('tr', $item);
}
}
}
if (empty($exerciseList) && $hotpotatoes_exist == false) {
if ($is_allowedToEdit && $origin != 'learnpath') {
echo '<div id="no-data-view" class="tool-view">';
echo '<div id="no-data-view">';
echo '<h3>'.get_lang('Quiz').'</h3>';
echo Display::return_icon('quiz.png', '', [], 64);
echo '<div class="controls">';
echo Display::url(
'<em class="fa fa-plus"></em> '.get_lang('New Exercise'),
'<em class="fa fa-plus"></em> '.get_lang('NewEx'),
'exercise_admin.php?'.api_get_cidreq(),
['class' => 'btn btn-primary']
);
@ -1494,7 +1464,7 @@ if (empty($exerciseList) && $hotpotatoes_exist == false) {
echo '</div>';
}
} else {
/*if ($is_allowedToEdit) {
if ($is_allowedToEdit) {
$headers = [
get_lang('ExerciseName'),
get_lang('QuantityQuestions'),
@ -1517,7 +1487,7 @@ if (empty($exerciseList) && $hotpotatoes_exist == false) {
}
echo '<div class="table-responsive">';
echo '<table class="table table-hover">';
echo '<table class="table table-striped table-hover">';
echo Display::tag(
'thead',
Display::tag('tr', $headerList)
@ -1530,15 +1500,7 @@ if (empty($exerciseList) && $hotpotatoes_exist == false) {
echo '</tbody>';
echo '</table>';
echo '</div>'*/
$tpl = new Template(null);
$tpl->assign('data', $list);
$tpl->assign('hotpotatoes', $listHotpotatoes);
$tpl->assign('is_teacher', $is_allowedToEdit);
$layout = $tpl->get_template('exercise/index.html.twig');
$content = $tpl->fetch($layout);
echo $content;
echo '</div>';
}
if ($origin != 'learnpath') { //so we are not in learnpath tool

@ -570,7 +570,6 @@ class FillBlanks extends Question
case self::FILL_THE_BLANK_STANDARD:
default:
$attributes['id'] = $labelId;
$attributes['class'] = 'form-control';
$result = Display::input(
'text',
"choice[$questionId][]",

@ -100,9 +100,9 @@ if (in_array(
) {
$showOnlyScore = true;
$showResults = true;
$lpId = isset($trackExerciseInfo['orig_lp_id']) ? $trackExerciseInfo['orig_lp_id'] : 0;
$lpItemId = isset($trackExerciseInfo['orig_lp_item_id']) ? $trackExerciseInfo['orig_lp_item_id'] : 0;
if ($objExercise->attempts > 0) {
$lpId = $trackExerciseInfo['orig_lp_id'] ?? 0;
$lpItemId = $trackExerciseInfo['orig_lp_item_id'] ?? 0;
$attempts = Event::getExerciseResultsByUser(
api_get_user_id(),
$objExercise->id,

@ -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();

@ -959,6 +959,7 @@ abstract class Question
if ($exercise->questionFeedbackEnabled) {
$params['feedback'] = $this->feedback;
}
Database::update(
$TBL_QUESTIONS,
$params,
@ -981,15 +982,8 @@ 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
@ -998,7 +992,7 @@ abstract class 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);
@ -1094,33 +1088,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);
@ -1267,9 +1261,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
// 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);
@ -1277,7 +1273,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
@ -1612,10 +1608,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
@ -1638,10 +1634,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();
@ -1752,13 +1744,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);
}
}
}*/
}
/**
@ -1838,7 +1834,7 @@ abstract class Question
eval('$img = '.$a_type[1].'::$typePicture;');
eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
echo '<li>';
echo '<div class="icon">';
echo '<div class="icon-image">';
$icon = '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'.
Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>';
@ -1856,7 +1852,7 @@ abstract class Question
}
echo '<li>';
echo '<div class="content">';
echo '<div class="icon_image_content">';
if ($objExercise->exercise_was_added_in_lp == true) {
echo Display::return_icon(
'database_na.png',

@ -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,
]),

@ -509,9 +509,6 @@ if (is_array($forumCategories)) {
$forumInfo['last_poster_user'] = display_user_link($poster_id, $name, null, $username);
$forumInfo['last_post_title'] = Security::remove_XSS(cut($forum['last_post_title'], 140));
$forumInfo['last_post_text'] = Security::remove_XSS(cut($forum['last_post_text'], 140));
$forumInfo['avatar'] = UserManager::getUserPicture($poster_id);
} else {
$forumInfo['avatar'] = UserManager::getUserPicture($forum['insert_user_id']);
}
if (api_is_allowed_to_edit(false, true)

@ -225,7 +225,7 @@ if ($action != 'add') {
$html .= Display::tag(
'div',
$iconsEdit,
['class' => 'float-right']
['class' => 'pull-right']
);
}

@ -3,9 +3,11 @@
require_once __DIR__.'/../inc/global.inc.php';
header('Content-type: application/x-javascript');
$origin = api_get_origin();
$tpl = new Template();
$tpl = new Template('', false, false, false, true, false, false);
$glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
@ -24,6 +26,5 @@ if ($showGlossary) {
$addReady = isset($_GET['add_ready']) ? true : false;
$tpl->assign('add_ready', $addReady);
$contentTemplate = $tpl->get_template($templateName);
header('Content-type: application/x-javascript');
$tpl->display($contentTemplate);
}

@ -328,7 +328,7 @@ class DisplayGradebook
if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) {
$additionalButtons = null;
if (!empty($certificateLinkInfo)) {
$additionalButtons .= '<div class="btn-group float-right">';
$additionalButtons .= '<div class="btn-group pull-right">';
$additionalButtons .= isset($certificateLinkInfo['certificate_link']) ? $certificateLinkInfo['certificate_link'] : '';
$additionalButtons .= isset($certificateLinkInfo['badge_link']) ? $certificateLinkInfo['badge_link'] : '';
$additionalButtons .= '</div>';

@ -28,20 +28,31 @@ switch ($action) {
case 'upload_file':
api_protect_course_script(true);
// User access same as upload.php
$allow = api_is_allowed_to_edit(null, true);
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$sessionId = api_get_session_id();
if (!$is_allowed_to_edit && $sessionId && $_REQUEST['curdirpath'] == "/basic-course-documents__{$sessionId}__0") {
$session = SessionManager::fetch($sessionId);
if (!empty($session) && $session['session_admin_id'] == api_get_user_id()) {
$is_allowed_to_edit = true;
}
}
// This needs cleaning!
if (api_get_group_id()) {
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
// Only course admin or group members allowed
if ($allow || GroupManager::is_user_in_group(api_get_user_id(), $groupInfo)) {
if ($is_allowed_to_edit || GroupManager::is_user_in_group(api_get_user_id(), $groupInfo)) {
if (!GroupManager::allowUploadEditDocument(api_get_user_id(), api_get_course_int_id(), $groupInfo)) {
exit;
}
} else {
exit;
}
} elseif ($allow ||
DocumentManager::is_my_shared_folder(api_get_user_id(), $_POST['curdirpath'], api_get_session_id())
} elseif ($is_allowed_to_edit ||
DocumentManager::is_my_shared_folder(api_get_user_id(), $_REQUEST['curdirpath'], api_get_session_id())
) {
// ??
} else {

@ -498,7 +498,7 @@ switch ($action) {
$total_weight = 0;
if ($type == 'simple') {
foreach ($question_list as $my_question_id) {
$objQuestionTmp = Question::read($my_question_id, $course_id);
$objQuestionTmp = Question::read($my_question_id, $objExercise->course);
$total_weight += $objQuestionTmp->selectWeighting();
}
}
@ -521,7 +521,7 @@ switch ($action) {
}
// Creates a temporary Question object
$objQuestionTmp = Question::read($my_question_id, $course_id);
$objQuestionTmp = Question::read($my_question_id, $objExercise->course);
$myChoiceDegreeCertainty = null;
if ($objQuestionTmp->type === MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) {
@ -732,10 +732,10 @@ switch ($action) {
$objQuestion = Question::read($questionId);
$id = '';
if (api_get_configuration_value('show_question_id')) {
$id = '<h4 class="question-type">#'.$objQuestion->course['code'].'-'.$objQuestion->iid.'</h4>';
$id = '<h4>#'.$objQuestion->course['code'].'-'.$objQuestion->iid.'</h4>';
}
echo $id;
echo '<h4 class="question-type">'.$objQuestion->get_question_type_name().'</h4>';
echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
if ($objQuestion->type === FILL_IN_BLANKS) {
echo '<script>
$(function() {
@ -762,6 +762,35 @@ switch ($action) {
true
);
break;
case 'get_quiz_embeddable':
$exercises = ExerciseLib::get_all_exercises_for_course_id(
api_get_course_info(),
api_get_session_id(),
api_get_course_int_id(),
false
);
$exercises = array_filter(
$exercises,
function (array $exercise) {
return ExerciseLib::isQuizEmbeddable($exercise);
}
);
$result = [];
$codePath = api_get_path(WEB_CODE_PATH);
foreach ($exercises as $exercise) {
$result[] = [
'id' => $exercise['iid'],
'title' => Security::remove_XSS($exercise['title']),
];
}
header('Content-Type: application/json');
echo json_encode($result);
break;
default:
echo '';
}

@ -14,63 +14,7 @@ switch ($action) {
case 'translate_html':
header('Content-type: application/x-javascript');
$translate = api_get_configuration_value('translate_html');
if (!$translate) {
exit;
}
$languageList = api_get_languages();
$hideAll = '';
foreach ($languageList['all'] as $language) {
$hideAll .= '$("span:lang('.$language['isocode'].')").filter(
function() {
// Ignore ckeditor classes
return !this.className.match(/cke(.*)/);
}).hide();';
}
$userInfo = api_get_user_info();
$languageId = api_get_language_id($userInfo['language']);
$languageInfo = api_get_language_info($languageId);
echo '
$(function() {
'.$hideAll.'
var defaultLanguageFromUser = "'.$languageInfo['isocode'].'";
$("span:lang('.$languageInfo['isocode'].')").filter(
function() {
// Ignore ckeditor classes
return !this.className.match(/cke(.*)/);
}).show();
var defaultLanguage = "";
var langFromUserFound = false;
$(this).find("span").filter(
function() {
// Ignore ckeditor classes
return !this.className.match(/cke(.*)/);
}).each(function() {
defaultLanguage = $(this).attr("lang");
if (defaultLanguage) {
$(this).before().next("br").remove();
if (defaultLanguageFromUser == defaultLanguage) {
langFromUserFound = true;
}
}
});
// Show default language
if (langFromUserFound == false && defaultLanguage) {
$("span:lang("+defaultLanguage+")").filter(
function() {
// Ignore ckeditor classes
return !this.className.match(/cke(.*)/);
}).show();
}
});
';
echo api_get_language_translate_html();
break;
default:
echo '';

@ -28,7 +28,7 @@ class AnnouncementManager
*
* @return array
*/
public static function getTags($sessionId = 0)
public static function getTags()
{
$tags = [
'((user_name))',
@ -49,7 +49,7 @@ class AnnouncementManager
$tags[] = "((extra_".$extra['variable']."))";
}
}
$sessionId = $sessionId ?: api_get_session_id();
$sessionId = api_get_session_id();
if (!empty($sessionId)) {
$tags[] = '((coaches))';
$tags[] = '((general_coach))';
@ -77,6 +77,21 @@ class AnnouncementManager
$courseInfo = api_get_course_info($courseCode);
$teacherList = CourseManager::getTeacherListFromCourseCodeToString($courseInfo['code']);
$generalCoachName = '';
$generalCoachEmail = '';
$coaches = '';
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
$coaches = CourseManager::get_coachs_from_course_to_string(
$sessionId,
$courseInfo['real_id']
);
$generalCoach = api_get_user_info($sessionInfo['id_coach']);
$generalCoachName = $generalCoach['complete_name'];
$generalCoachEmail = $generalCoach['email'];
}
$data = [];
$data['user_name'] = '';
$data['user_firstname'] = '';
@ -121,21 +136,13 @@ class AnnouncementManager
}
}
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
$coaches = CourseManager::get_coachs_from_course_to_string(
$sessionId,
$courseInfo['real_id']
);
$generalCoach = api_get_user_info($sessionInfo['id_coach']);
if (!empty(api_get_session_id())) {
$data['coaches'] = $coaches;
$data['general_coach'] = $generalCoach['complete_name'];
$data['general_coach_email'] = $generalCoach['email'];
$data['general_coach'] = $generalCoachName;
$data['general_coach_email'] = $generalCoachEmail;
}
$tags = self::getTags($sessionId);
$tags = self::getTags();
foreach ($tags as $tag) {
$simpleTag = str_replace(['((', '))'], '', $tag);
$value = isset($data[$simpleTag]) ? $data[$simpleTag] : '';

@ -526,7 +526,6 @@ class ExerciseLib
$answer = '<div class="thumbnail">'.$answer.'</div>';
}
$answer_input .= '<div class="input-item">';
$answer_input .= '<label class="radio '.$hidingClass.'">';
$answer_input .= Display::input(
'radio',
@ -535,7 +534,7 @@ class ExerciseLib
$attributes
);
$answer_input .= $answer;
$answer_input .= '</label></div>';
$answer_input .= '</label>';
if ($answerType == UNIQUE_ANSWER_IMAGE) {
$answer_input .= "</div>";
@ -579,8 +578,7 @@ class ExerciseLib
if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
$attributes['class'] = 'checkradios';
$answer_input = '<div class="input-item">';
$answer_input .= '<label class="checkbox">';
$answer_input = '<label class="checkbox">';
$answer_input .= Display::input(
'checkbox',
'choice['.$questionId.']['.$numAnswer.']',
@ -588,7 +586,7 @@ class ExerciseLib
$attributes
);
$answer_input .= $answer;
$answer_input .= '</label></div>';
$answer_input .= '</label>';
if ($show_comment) {
$s .= '<tr><td>';
@ -901,7 +899,7 @@ class ExerciseLib
// display the last common word
$answer .= $listAnswerInfo['common_words'][$i];
}
$s .= '<div class="fill-blank">'.$answer.'</div>';
$s .= $answer;
break;
case CALCULATED_ANSWER:
/*
@ -1058,13 +1056,13 @@ class ExerciseLib
$s .= '<tr><td width="45%" valign="top">';
$parsed_answer = $answer;
// Left part questions
$s .= '<div class="indent"><span class="round number">'.$lines_count.'</span>'.$parsed_answer.'</div></td>';
$s .= '<p class="indent">'.$lines_count.'.&nbsp;'.$parsed_answer.'</p></td>';
// Middle part (matches selects)
// Id of select is # question + # of option
$s .= '<td width="10%" valign="top" align="center">
<div class="select-matching">
<select
class="selectpicker" id="choice_id_'.$current_item.'_'.$lines_count.'"
id="choice_id_'.$current_item.'_'.$lines_count.'"
name="choice['.$questionId.']['.$numAnswer.']">';
// fills the list-box
@ -1089,11 +1087,11 @@ class ExerciseLib
$s .= '</select></div></td><td width="5%" class="separate">&nbsp;</td>';
$s .= '<td width="40%" valign="top" >';
if (isset($select_items[$lines_count])) {
$s .= '<div class="text-left">
<div class="indent"><span class="round letter">'.
$select_items[$lines_count]['letter'].'</span> '.
$s .= '<div class="text-right">
<p class="indent">'.
$select_items[$lines_count]['letter'].'.&nbsp; '.
$select_items[$lines_count]['answer'].'
</div>
</p>
</div>';
} else {
$s .= '&nbsp;';
@ -2548,7 +2546,7 @@ HOTSPOT;
$question_list = explode(',', $exercise_stat_info['data_tracking']);
if (!empty($question_list)) {
foreach ($question_list as $questionId) {
$objQuestionTmp = Question::read($questionId, $course_id);
$objQuestionTmp = Question::read($questionId, $objExercise->course);
// We're inside *one* question. Go through each possible answer for this question
$result = $objExercise->manage_answer(
$exeId,
@ -2877,12 +2875,7 @@ HOTSPOT;
$html = Display::span($html, ['class' => 'score_exercise']);
return [
'html' => $html,
'percentage' => $percentage,
'score_obtained' => $score,
'total_score' => $weight,
];
return $html;
}
/**

@ -1108,9 +1108,15 @@ class ExtraField extends Model
if ($help) {
$translatedDisplayHelpText .= get_lang($field_details['display_text'].'Help');
}
$label = [$translatedDisplayText, $translatedDisplayHelpText];
if (!empty($translatedDisplayText)) {
$field_details['display_text'] = $label;
if (!empty($translatedDisplayHelpText)) {
// In this case, exceptionally, display_text is an array
// which is then treated by display_form()
$field_details['display_text'] = [$translatedDisplayText, $translatedDisplayHelpText];
} else {
// We have an helper text, use it
$field_details['display_text'] = $translatedDisplayText;
}
}
switch ($field_details['field_type']) {

@ -393,7 +393,7 @@ class GlossaryManager
{
// This function should always be called with the corresponding
// parameter for view type. Meanwhile, use this cheap trick.
$view = self::getGlossaryView();
// action links
$actionsLeft = '';
if (api_is_allowed_to_edit(null, true)) {
@ -407,11 +407,19 @@ class GlossaryManager
}
if (!api_is_anonymous()) {
$actionsLeft .= '<a id="export-glossary" href="'.api_get_self().'?'.api_get_cidreq().'&action=export" class="btn btn-link btn-export" data-toggle="modal" data-target="#modal-export">'.
$actionsLeft .= '<a id="export_opener" href="'.api_get_self().'?'.api_get_cidreq().'&action=export">'.
Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>';
}
if (!api_is_anonymous()) {
if (($view == 'table') || (!isset($view))) {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'.
Display::return_icon('view_detailed.png', get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
} else {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'.
Display::return_icon('view_text.png', get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
}
if (api_is_allowed_to_edit(true, true, true)) {
$actionsLeft .= Display::url(
Display::return_icon('export_to_documents.png', get_lang('ExportToDocArea'), [], ICON_SIZE_MEDIUM),
api_get_self().'?'.api_get_cidreq().'&'.http_build_query(['action' => 'export_documents'])
@ -422,7 +430,7 @@ class GlossaryManager
if (empty($orderList)) {
$orderList = 'ASC';
}
if (!api_is_anonymous()) {
if (!api_is_allowed_to_edit(true, true, true)) {
if ($orderList === 'ASC') {
$actionsLeft .= Display::url(
Display::return_icon('falling.png', get_lang('Sort Descending'), [], ICON_SIZE_MEDIUM),
@ -449,7 +457,7 @@ class GlossaryManager
$form->addElement('hidden', 'cidReq', api_get_course_id());
$form->addElement('hidden', 'id_session', api_get_session_id());
$form->addButtonSearch(get_lang('Search'));
$actionsRight = '<div class="float-right">'.$form->returnForm().'</div>';
$actionsRight = $form->returnForm();
$toolbar = Display::toolbarAction(
'toolbar-document',
@ -458,14 +466,26 @@ class GlossaryManager
$content = $toolbar;
$list = self::getListGlossary(1000, 0, $orderList);
if (!$view || $view === 'table') {
$table = new SortableTable(
'glossary',
['GlossaryManager', 'get_number_glossary_terms'],
['GlossaryManager', 'get_glossary_data'],
0
);
$tpl = new Template(null);
$isTeacher = api_is_allowed_to_edit(null, true);
$tpl->assign('data', $list);
$tpl->assign('is_allowed_to_edit', $isTeacher);
$layout = $tpl->get_template('glossary/list.html.twig');
$content .= $tpl->fetch($layout);
$table->set_header(0, get_lang('TermName'), true);
$table->set_header(1, get_lang('TermDefinition'), true);
if (api_is_allowed_to_edit(null, true)) {
$table->set_header(2, get_lang('Actions'), false, 'width=90px', ['class' => 'td_actions']);
$table->set_column_filter(2, ['GlossaryManager', 'actions_filter']);
}
$content .= $table->return_table();
}
if ($view === 'list') {
$content .= self::displayGlossaryList();
}
return $content;
}
@ -524,78 +544,6 @@ class GlossaryManager
return $obj->total;
}
public static function getListGlossary($numberOfItems, $column, $direction)
{
$_user = api_get_user_info();
// Database table definition
$t_glossary = Database::get_course_table(TABLE_GLOSSARY);
$t_item_propery = Database::get_course_table(TABLE_ITEM_PROPERTY);
if (api_is_allowed_to_edit(null, true)) {
$col2 = " glossary.glossary_id as col2, ";
} else {
$col2 = ' ';
}
//condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition(
$session_id,
true,
true,
'glossary.session_id'
);
$column = intval($column);
if (!in_array($direction, ['DESC', 'ASC'])) {
$direction = 'ASC';
}
$numberOfItems = intval($numberOfItems);
$keyword = isset($_GET['keyword']) ? Database::escape_string($_GET['keyword']) : '';
$keywordCondition = '';
if (!empty($keyword)) {
$keywordCondition = "AND (glossary.name LIKE '%$keyword%' OR glossary.description LIKE '%$keyword%')";
}
$sql = "SELECT
glossary.name as col0,
glossary.description as col1,
$col2
glossary.session_id
FROM $t_glossary glossary
INNER JOIN $t_item_propery ip
ON (glossary.glossary_id = ip.ref AND glossary.c_id = ip.c_id)
WHERE
tool = '".TOOL_GLOSSARY."'
$condition_session AND
glossary.c_id = ".api_get_course_int_id()." AND
ip.c_id = ".api_get_course_int_id()."
$keywordCondition
ORDER BY col$column $direction
LIMIT 0,$numberOfItems";
$res = Database::query($sql);
$list = [];
$array = [];
while ($data = Database::fetch_array($res)) {
// Validation when belongs to a session
if (api_is_allowed_to_edit(null, true)) {
$array['id'] = $data[2];
$array['edit'] = '/main/glossary/index.php?action=edit_glossary&glossary_id='.$data[2].'&'.api_get_cidreq().'&msg=edit';
$array['delete'] = '/main/glossary/index.php?action=delete_glossary&glossary_id='.$data[2];
}
$session_img = api_get_session_image($data['session_id'], $_user['status']);
$array['title'] = $data[0].$session_img;
$array['description'] = api_html_entity_decode($data[1]);
$list[] = $array;
}
return $list;
}
/**
* Get all the data of a glossary.
*

@ -972,7 +972,7 @@ class Link extends Model
* @param int $courseId
* @param int $session_id
*
* @return array
* @return string
*/
public static function showLinksPerCategory($catid, $courseId, $session_id)
{
@ -981,17 +981,22 @@ class Link extends Model
$catid = intval($catid);
$links = self::getLinksPerCategory($catid, $courseId, $session_id);
$content = '';
$numberOfLinks = count($links);
$listLink = [];
if (!empty($links)) {
$content .= '<div class="link list-group">';
$i = 1;
$linksAdded = [];
foreach ($links as $myrow) {
$linkId = $myrow['id'];
$linksAdded['id'] = $linkId;
if (in_array($linkId, $linksAdded)) {
continue;
}
$linksAdded[] = $linkId;
$categoryId = $myrow['category_id'];
$linksAdded['category'] = $categoryId;
// Validation when belongs to a session.
$session_img = api_get_session_image(
@ -1113,34 +1118,50 @@ class Link extends Model
}
}
$showLink = false;
$titleClass = '';
if ($myrow['visibility'] == '1') {
$showLink = true;
$urlLink = null;
if ($myrow['visibility'] != '1') {
$showLink = false;
} else {
if (api_is_allowed_to_edit(null, true)) {
$showLink = true;
$titleClass = 'text-muted';
}
}
$linksAdded['visibility'] = $showLink;
if ($showLink) {
$urlLink = api_get_path(WEB_CODE_PATH).'link/link_goto.php?'.api_get_cidreq().'&link_id='.$linkId.'&link_url='.urlencode($myrow['url']);
$iconLink = Display::return_icon(
'url.png',
get_lang('Link'),
null,
ICON_SIZE_SMALL
);
$url = api_get_path(WEB_CODE_PATH).'link/link_goto.php?'.api_get_cidreq().'&link_id='.$linkId.'&link_url='.urlencode($myrow['url']);
$content .= '<div class="list-group-item">';
$content .= '<div class="pull-right"><div class="btn-group">'.$toolbar.'</div></div>';
$content .= '<h4 class="list-group-item-heading">';
$content .= $iconLink;
$content .= Display::tag(
'a',
Security::remove_XSS($myrow['title']),
[
'href' => $url,
'target' => $myrow['target'],
'class' => $titleClass,
]
);
$content .= $link_validator;
$content .= $session_img;
$content .= '</h4>';
$content .= '<p class="list-group-item-text">'.$myrow['description'].'</p>';
$content .= '</div>';
}
$i++;
$linksAdded['title'] = Security::remove_XSS($myrow['title']);
$linksAdded['description'] = $myrow['description'];
$linksAdded['target'] = $myrow['target'];
$linksAdded['url'] = $urlLink;
$linksAdded['toolbar'] = $toolbar;
$linksAdded['session'] = $session_img;
$linksAdded['link_validator'] = $link_validator;
$listLink[] = $linksAdded;
}
$content .= '</div>';
}
return $listLink;
return $content;
}
/**
@ -1158,76 +1179,58 @@ class Link extends Model
{
$categoryId = $category['id'];
$token = null;
$urlEdit = api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=editcategory&id='.$categoryId.'&category_id='.$categoryId;
$tools = Display::toolbarButton(
null,
$urlEdit,
'pencil-alt',
null,
[
'title' => get_lang('Modify'),
]);
$tools = '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=editcategory&id='.$categoryId.'&category_id='.$categoryId.'" title='.get_lang('Modify').'">'.
Display:: return_icon(
'edit.png',
get_lang('Modify'),
[],
ICON_SIZE_SMALL
).'</a>';
// DISPLAY MOVE UP COMMAND only if it is not the top link.
if ($currentCategory != 0) {
$url = api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=up&up='.$categoryId.'&category_id='.$categoryId;
$tools .= Display::toolbarButton(
null,
$url,
'level-up-alt',
'outline-secondary',
[
'title' => get_lang("Up"),
]
);
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=up&up='.$categoryId.'&category_id='.$categoryId.'" title="'.get_lang('Up').'">'.
Display:: return_icon(
'up.png',
get_lang('Up'),
[],
ICON_SIZE_SMALL
).'</a>';
} else {
$tools .= Display::toolbarButton(
null,
null,
'level-up-alt',
'outline-secondary',
[
'title' => get_lang("Up"),
'class' => 'disabled',
]
);
$tools .= Display:: return_icon(
'up_na.png',
get_lang('Up'),
[],
ICON_SIZE_SMALL
).'</a>';
}
// DISPLAY MOVE DOWN COMMAND only if it is not the bottom link.
if ($currentCategory < $countCategories - 1) {
$url = api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=down&down='.$categoryId.'&category_id='.$categoryId;
$tools .= Display::toolbarButton(
null,
$url,
'level-down-alt',
'outline-secondary',
[
'title' => get_lang("Down"),
]
);
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=down&down='.$categoryId.'&category_id='.$categoryId.'">'.
Display:: return_icon(
'down.png',
get_lang('Down'),
[],
ICON_SIZE_SMALL
).'</a>';
} else {
$tools .= Display::toolbarButton(
null,
null,
'level-down-alt',
'outline-secondary',
[
'title' => get_lang("Down"),
'class' => 'disabled',
]
);
$tools .= Display:: return_icon(
'down_na.png',
get_lang('Down'),
[],
ICON_SIZE_SMALL
).'</a>';
}
$urlDelete = api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletecategory&id='.$categoryId."&category_id=$categoryId";
$tools .= Display::toolbarButton(
null,
$urlDelete,
'trash',
'outline-secondary',
[
'title' => get_lang("Delete"),
'onclick' => "javascript: if(!confirm('".get_lang('CategoryDelconfirm')."')) return false;",
]
);
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletecategory&id='.$categoryId."&category_id=$categoryId\"
onclick=\"javascript: if(!confirm('".get_lang('CategoryDelconfirm')."')) return false;\">".
Display:: return_icon(
'delete.png',
get_lang('Delete'),
[],
ICON_SIZE_SMALL
).'</a>';
return $tools;
}
@ -1564,9 +1567,7 @@ class Link extends Model
$show = 'none',
$token = null
) {
$tbl_link = Database::get_course_table(TABLE_LINK);
$tblCIP = Database::get_course_table(TABLE_ITEM_PROPERTY);
$categoryId = intval($categoryId);
$categoryId = (int) $categoryId;
/* Action Links */
echo '<div class="actions">';
@ -1587,13 +1588,17 @@ class Link extends Model
echo Display::return_icon('forum_nestedview.png', get_lang('NestedView'), '', ICON_SIZE_MEDIUM).'</a>';
}
echo '</div>';
$linksPerCategory = self::showLinksPerCategory(0, $course_id, $session_id);
$counter = 0;
$category = [];
$listCategory = [];
$list['not_category'] = self::showLinksPerCategory(0, $course_id, $session_id);
if (empty($countCategories)) {
echo $linksPerCategory;
} else {
if (!empty($linksPerCategory)) {
echo Display::panel($linksPerCategory, get_lang('NoCategory'));
}
}
$counter = 0;
foreach ($categories as $myrow) {
// Student don't see invisible categories.
if (!api_is_allowed_to_edit(null, true)) {
@ -1604,46 +1609,40 @@ class Link extends Model
// Validation when belongs to a session
$showChildren = $categoryId == $myrow['id'] || $show == 'all';
$category['id'] = $myrow['id'];
$category['description'] = Security::remove_XSS($myrow['description']);
$myrow['description'] = $myrow['description'];
$strVisibility = '';
$visibilityClass = null;
if ($myrow['visibility'] == '1') {
$url = 'link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=invisible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY;
$title = get_lang('Hide');
$strVisibility = Display::toolbarButton(null, $url, 'eye', null, ['title' => $title]);
$strVisibility = '<a href="link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=invisible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY.'" title="'.get_lang('Hide').'">'.
Display::return_icon('visible.png', get_lang('Hide'), [], ICON_SIZE_SMALL).'</a>';
} elseif ($myrow['visibility'] == '0') {
$visibilityClass = 'text-muted';
$url = 'link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY;
$title = get_lang('Show');
$strVisibility = Display::toolbarButton(null, $url, 'eye-slash', null, ['title' => $title]);
$strVisibility = ' <a href="link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY.'" title="'.get_lang('Show').'">'.
Display::return_icon('invisible.png', get_lang('Show'), [], ICON_SIZE_SMALL).'</a>';
}
$header = '';
if ($showChildren) {
$category['visibility'] = $visibilityClass;
$category['url'] = api_get_self().'?'.api_get_cidreq().'&category_id=';
$header .= '<a class="'.$visibilityClass.'" href="'.api_get_self().'?'.api_get_cidreq().'&category_id=">';
$header .= Display::return_icon('forum_nestedview.png');
} else {
$category['visibility'] = $visibilityClass;
$category['url'] = api_get_self().'?'.api_get_cidreq().'&category_id='.$myrow['id'];
$header .= '<a class="'.$visibilityClass.'" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$myrow['id'].'">';
$header .= Display::return_icon('forum_listview.png');
}
$category['title'] = Security::remove_XSS($myrow['category_title']);
$iconTools = '';
$header .= Security::remove_XSS($myrow['category_title']).'</a>';
$header .= '<div class="pull-right">';
if (api_is_allowed_to_edit(null, true)) {
if ($session_id == $myrow['session_id']) {
$iconTools .= $strVisibility;
$iconTools .= self::showCategoryAdminTools($myrow, $counter, count($categories));
$header .= $strVisibility;
$header .= self::showCategoryAdminTools($myrow, $counter, count($categories));
} else {
$iconTools .= get_lang('EditionNotAvailableFromSession');
$header .= get_lang('EditionNotAvailableFromSession');
}
}
$category['tools'] = $iconTools;
$childrenContent = '';
if ($showChildren) {
$childrenContent = self::showLinksPerCategory(
@ -1652,19 +1651,11 @@ class Link extends Model
api_get_session_id()
);
}
$category['children'] = $childrenContent;
$listCategory[] = $category;
echo Display::panel($myrow['description'].$childrenContent, $header);
$counter++;
}
$list['in_category'] = $listCategory;
$isTeacher = api_is_allowed_to_edit(null, true);
$tpl = new Template(null);
$tpl->assign('list_not_category', $list['not_category']);
$tpl->assign('is_allowed_to_edit', $isTeacher);
$tpl->assign('list_in_category', $list['in_category']);
$courseInfoLayout = $tpl->get_template("link/index.html.twig");
$content = $tpl->fetch($courseInfoLayout);
echo $content;
}
/**

@ -207,13 +207,15 @@ class MySpace
}
// protect data
$user_id = intval($user_id);
$session_id = intval($session_id);
$user_id = (int) $user_id;
$session_id = (int) $session_id;
$new_course_list = [];
foreach ($course_list as $course_item) {
$courseInfo = api_get_course_info($course_item['code']);
$courseId = $courseInfo['real_id'];
$new_course_list[] = '"'.$courseId.'"';
if ($courseInfo) {
$courseId = $courseInfo['real_id'];
$new_course_list[] = '"'.$courseId.'"';
}
}
$course_list = implode(', ', $new_course_list);
@ -259,11 +261,13 @@ class MySpace
// database table definition
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$user_id = (int) $user_id;
// getting all the courses of the user
$sql = "SELECT * FROM $tbl_course_user
WHERE
user_id = '".intval($user_id)."' AND
relation_type<>".COURSE_RELATION_TYPE_RRHH." ";
user_id = '".$user_id."' AND
relation_type <> ".COURSE_RELATION_TYPE_RRHH;
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
$courseInfo = api_get_course_info_by_id($row['c_id']);
@ -317,12 +321,18 @@ class MySpace
*/
public static function returnCourseTracking($user_id)
{
$user_id = (int) $user_id;
if (empty($user_id)) {
return [];
}
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
// getting all the courses of the user
$sql = "SELECT * FROM $tbl_course_user
WHERE
user_id = '".intval($user_id)."' AND
relation_type<>".COURSE_RELATION_TYPE_RRHH." ";
user_id = $user_id AND
relation_type <> ".COURSE_RELATION_TYPE_RRHH;
$result = Database::query($sql);
$list = [];
@ -344,7 +354,12 @@ class MySpace
}
// student exercises results (obtained score, maximum score, number of exercises answered, score percentage)
$exercises_results = self::exercises_results($user_id, $courseCode);
$exercisesResults = self::exercises_results($user_id, $courseCode);
$resultToString = '';
if (!is_null($exercisesResults['percentage'])) {
$resultToString = $exercisesResults['score_obtained'].'/'.$exercisesResults['score_possible'].' ( '.$exercisesResults['percentage'].'% )';
}
$item = [
'code' => $courseInfo['code'],
@ -358,8 +373,8 @@ class MySpace
'student_score' => $avg_score,
'student_message' => Tracking::count_student_messages($user_id, $courseCode),
'student_assignments' => Tracking::count_student_assignments($user_id, $courseCode),
'student_exercises' => (is_null($exercises_results['percentage']) ? '' : $exercises_results['score_obtained'].'/'.$exercises_results['score_possible'].' ( '.$exercises_results['percentage'].'% )'),
'questions_answered' => $exercises_results['questions_answered'],
'student_exercises' => $resultToString,
'questions_answered' => $exercisesResults['questions_answered'],
'last_connection' => Tracking::get_last_connection_date_on_the_course($user_id, $courseInfo),
];
$list[] = $item;
@ -416,7 +431,7 @@ class MySpace
{
self::display_user_overview_export_options();
$addparams = ['view' => 'admin', 'display' => 'user'];
$params = ['view' => 'admin', 'display' => 'user'];
$table = new SortableTable(
'tracking_user_overview',
['MySpace', 'get_number_of_users_tracking_overview'],
@ -428,7 +443,7 @@ class MySpace
'class' => 'table table-transparent',
]
);
$table->additional_parameters = $addparams;
$table->additional_parameters = $params;
$table->set_column_filter(0, ['MySpace', 'returnTrackingUserOverviewFilter']);
$tableContent = $table->return_table();
@ -1038,14 +1053,14 @@ class MySpace
$t_head .= '<th style="padding:0;border-bottom:0"><span>'.cut(get_lang('TotalExercisesAnswered'), 6, true).'</span></th>';
$t_head .= '<th style="padding:0;border-bottom:0;border-right:0;"><span>'.get_lang('LatestLogin').'</span></th>';
$t_head .= '</tr></table>';
$addparams = ['view' => 'admin', 'display' => 'courseoverview'];
$params = ['view' => 'admin', 'display' => 'courseoverview'];
$table = new SortableTable(
'tracking_session_overview',
['MySpace', 'get_total_number_courses'],
['MySpace', 'get_course_data_tracking_overview'],
1
);
$table->additional_parameters = $addparams;
$table->additional_parameters = $params;
$table->set_header(0, '', false, null, ['style' => 'display: none']);
$table->set_header(1, get_lang('Course'), true, ['style' => 'font-size:8pt'], ['style' => 'font-size:8pt']);
@ -1456,14 +1471,14 @@ class MySpace
$head .= '<th style="padding:0;border-bottom:0;border-right:0;"><span>'.get_lang('LatestLogin').'</span></th>';
$head .= '</tr></table>';
$addparams = ['view' => 'admin', 'display' => 'sessionoverview'];
$params = ['view' => 'admin', 'display' => 'sessionoverview'];
$table = new SortableTable(
'tracking_session_overview',
['MySpace', 'get_total_number_sessions'],
['MySpace', 'get_session_data_tracking_overview'],
1
);
$table->additional_parameters = $addparams;
$table->additional_parameters = $params;
$table->set_header(0, '', false, null, ['style' => 'display: none']);
$table->set_header(
@ -1685,21 +1700,19 @@ class MySpace
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
// the values of the sortable table
$from = 0;
if ($_GET['tracking_session_overview_page_nr']) {
$from = $_GET['tracking_session_overview_page_nr'];
} else {
$from = 0;
}
$orderby = 0;
if ($_GET['tracking_session_overview_column']) {
$orderby = $_GET['tracking_session_overview_column'];
} else {
$orderby = 0;
}
$direction = 'ASC';
if ($_GET['tracking_session_overview_direction']) {
$direction = $_GET['tracking_session_overview_direction'];
} else {
$direction = 'ASC';
}
$session_data = self::get_session_data_tracking_overview($from, 1000, $orderby, $direction);
@ -1876,6 +1889,7 @@ class MySpace
*
* @param int $user_id the id of the user
* @param string $course_code the course code
* @param int $session_id
*
* @return array
*
@ -1885,15 +1899,20 @@ class MySpace
*
* @since November 2008
*/
public static function exercises_results($user_id, $course_code, $session_id = false)
public static function exercises_results($user_id, $course_code, $session_id = 0)
{
$user_id = (int) $user_id;
$courseId = api_get_course_int_id($course_code);
$sql = 'SELECT score, max_score
FROM '.Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES)."
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$sql = "SELECT exe_result, exe_weighting
FROM $table
WHERE
c_id = ' . $courseId . ' AND
exe_user_id = '".intval($user_id)."'";
if ($session_id !== false) {
c_id = $courseId AND
exe_user_id = $user_id";
$session_id = (int) $session_id;
if (!empty($session_id)) {
$sql .= " AND session_id = '".$session_id."' ";
}
$result = Database::query($sql);
@ -1906,10 +1925,9 @@ class MySpace
$questions_answered++;
}
$percentage = null;
if ($score_possible != 0) {
$percentage = round(($score_obtained / $score_possible * 100), 2);
} else {
$percentage = null;
}
return [
@ -2208,20 +2226,7 @@ class MySpace
switch ($column) {
case '0':
$column = $isWestern ? 'firstname' : 'lastname';
//$column = 'official_code';
break;
/*case '1':
$column = $isWestern ? 'firstname' : 'lastname';
break;
case '2':
$column = $isWestern ? 'lastname' : 'firstname';
break;
case '3':
$column = 'username';
break;
case '4':
$column = 'username';
break;*/
}
$order = [
@ -2230,12 +2235,6 @@ class MySpace
$userList = UserManager::get_user_list([], $order, $from, $numberItems);
$return = [];
foreach ($userList as $user) {
//$firstPosition = $user['lastname'];
//$secondPosition = $user['firstname'];
/*if ($isWestern) {
$firstPosition = $user['firstname'];
$secondPosition = $user['lastname'];
}*/
$return[] = [
'0' => $user['user_id'],
'col0' => $user['user_id'],
@ -2262,9 +2261,9 @@ class MySpace
public static function get_user_overview_export_extra_fields($user_id)
{
// include the user manager
$extra_data = UserManager::get_extra_user_data($user_id, true);
$data = UserManager::get_extra_user_data($user_id, true);
return $extra_data;
return $data;
}
/**
@ -2293,9 +2292,7 @@ class MySpace
}
$desired_username = UserManager::create_username(
$firstname,
$lastname,
$language,
$encoding
$lastname
);
if (UserManager::is_username_available($desired_username.$sufix)) {
break;
@ -2355,10 +2352,10 @@ class MySpace
{
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$id_session = intval($id_session);
$id_session = (int) $id_session;
$username = Database::escape_string($username);
foreach ($course_list as $courseId) {
$courseId = intval($courseId);
$courseId = (int) $courseId;
$sql = " SELECT u.user_id FROM $tbl_session_rel_course_rel_user rel
INNER JOIN $table_user u
ON (rel.user_id = u.user_id)
@ -2447,9 +2444,8 @@ class MySpace
public static function get_user_creator($users)
{
$errors = [];
$table_user = Database::get_main_table(TABLE_MAIN_USER);
foreach ($users as $index => $user) {
// database table definition
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$username = Database::escape_string($user['UserName']);
$sql = "SELECT creator_id FROM $table_user WHERE username='$username' ";
@ -2563,24 +2559,20 @@ class MySpace
$users = $new_users;
// Inserting users.
$super_list = [];
foreach ($course_list as $enreg_course) {
$nbr_users = 0;
$new_users = [];
$enreg_course = Database::escape_string($enreg_course);
foreach ($users as $index => $user) {
$userid = intval($user['id']);
$userid = (int) $user['id'];
$sql = "INSERT IGNORE INTO $tbl_session_rel_course_rel_user(session_id, c_id, user_id)
VALUES('$id_session','$enreg_course','$userid')";
$course_session = ['course' => $enreg_course, 'added' => 1];
$result = Database::query($sql);
if (Database::affected_rows($result)) {
$nbr_users++;
}
$new_users[] = $user;
}
$super_list[] = $new_users;
//update the nbr_users field
$sql_select = "SELECT COUNT(user_id) as nbUsers FROM $tbl_session_rel_course_rel_user
@ -2610,7 +2602,6 @@ class MySpace
// Sending emails.
$addedto = '';
if ($sendMail) {
$i = 0;
foreach ($users as $index => $user) {
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
$emailbody = get_lang('Dear').' '.
@ -2650,7 +2641,6 @@ class MySpace
$registered_users .= UserManager::getUserProfileLink($userInfo).' - '.$addedto.'<br />';
}
} else {
$i = 0;
foreach ($users as $index => $user) {
$userInfo = api_get_user_info($user['id']);
if (($user['added_at_platform'] == 1 && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
@ -3047,7 +3037,7 @@ class MySpace
$user_id = (int) $user_id;
$connections = [];
if (!empty($course_info)) {
$courseId = intval($course_info['real_id']);
$courseId = (int) $course_info['real_id'];
$end_date = add_day_to($end_date);
$sessionCondition = api_get_session_condition($sessionId);
$sql = "SELECT login_course_date, logout_course_date
@ -3127,8 +3117,8 @@ function get_stats($user_id, $course_info, $sessionId, $start_date = null, $end_
function add_day_to($end_date)
{
$foo_date = strtotime($end_date);
$foo_date = strtotime(" +1 day", $foo_date);
$foo_date = date("Y-m-d", $foo_date);
$foo_date = strtotime(' +1 day', $foo_date);
$foo_date = date('Y-m-d', $foo_date);
return $foo_date;
}
@ -3150,7 +3140,7 @@ function convert_to_array($sql_result)
api_time_to_hms($data['logout'] - $data['login']).'</tr></td>'."\n";
}
$result_to_print .= '</table>';
$result_to_print = ["result" => $result_to_print];
$result_to_print = ['result' => $result_to_print];
return $result_to_print;
}

@ -173,6 +173,7 @@ function online_logout($user_id = null, $logout_redirect = false)
}
}
api_delete_firstpage_parameter();
Session::erase('last_id');
CourseChatUtils::exitChat($user_id);
session_regenerate_id();

@ -282,10 +282,17 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
$label = $element->getLabel();
$labelForId = $element->getAttribute('id');
$extraLabelClass = $element->getAttribute('extra_label_class');
$icon = $element->getIconToHtml();
if (is_array($label)) {
$nameLabel = array_shift($label);
// In some cases, label (coming from display_text) might be a
// double-level array. In this case, take the first item of the
// sub-array as label
if (is_array($nameLabel)) {
$nameLabel = $nameLabel[0];
}
} else {
$nameLabel = $label;
}
@ -297,6 +304,7 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
$html = str_replace('{label}', $nameLabel, $this->_templates[$name]);
} else {
$customElementTemplate = $this->getCustomElementTemplate();
if (empty($customElementTemplate)) {
if (method_exists($element, 'getTemplate')) {
$template = $element->getTemplate(
@ -314,11 +322,8 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
} else {
$template = $customElementTemplate;
}
$html = $template;
if (is_string($nameLabel)) {
$html = str_replace('{label}', $nameLabel, $template);
}
}
$html = str_replace('{label-for}', $labelFor, $html);
$html = str_replace('{icon}', $icon, $html);
$html = str_replace('{extra_label_class}', $extraLabelClass, $html);

@ -1305,7 +1305,7 @@ class Skill extends Model
foreach ($skills as $skill) {
if ($getSkillData) {
$skillData = $this->get($skill['id']);
$skillData['url'] = api_get_path(WEB_PATH).'badge/'.$skill['issue'].'/user/'.$userId;
$skillData['url'] = api_get_path(WEB_PATH).'badge/'.$skill['id'].'/user/'.$userId;
$skillList[$skill['id']] = array_merge($skill, $skillData);
} else {
$skillList[$skill['id']] = $skill['id'];
@ -1412,9 +1412,8 @@ class Skill extends Model
$courseTempList[$courseId] = $courseInfo;
}
}
$tableRow = [
'skill_badge' => $resultData['img_mini'],
'skill_badge' => $resultData['img_small'],
'skill_name' => self::translateName($resultData['name']),
'short_code' => $resultData['short_code'],
'skill_url' => $resultData['url'],
@ -1439,15 +1438,9 @@ class Skill extends Model
}
if ($addTitle) {
$tableResult .= '
<table class="table">
<thead>
<tr>
<th>'.get_lang('AchievedSkills').'</th>
</tr>
</thead>
<tbody>
<tr><td>';
$tableResult .= '<div class="header-title">'.get_lang('AchievedSkills').'</div>
<div class="skills-badges">
';
}
if (!empty($skillParents)) {
@ -1547,11 +1540,7 @@ class Skill extends Model
}
if ($addTitle) {
$tableResult .= '</td>
</tr>
</tbody>
</table>
';
$tableResult .= '</div>';
}
$tableResult .= '</div>';

@ -886,374 +886,6 @@ class SocialManager extends UserManager
return $template->fetch($skillBlock);
}
/**
* Shows the right menu of the Social Network tool.
*
* @param string $show highlight link possible values:
* group_add,
* home,
* messages,
* messages_inbox,
* messages_compose ,
* messages_outbox,
* invitations,
* shared_profile,
* friends,
* groups search
* @param int $group_id group id
* @param int $user_id user id
* @param bool $show_full_profile show profile or not (show or hide the user image/information)
* @param bool $show_delete_account_button
*/
public static function getMenuSocial(
$show = '',
$group_id = 0,
$user_id = 0,
$show_full_profile = false,
$show_delete_account_button = false
) {
$user_id = (int) $user_id;
$group_id = (int) $group_id;
if (empty($user_id)) {
$user_id = api_get_user_id();
}
$usergroup = new UserGroup();
$show_groups = [
'groups',
'group_messages',
'messages_list',
'group_add',
'mygroups',
'group_edit',
'member_list',
'invite_friends',
'waiting_list',
'browse_groups',
];
// get count unread message and total invitations
$count_unread_message = MessageManager::getNumberOfMessages(true);
$count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
$number_of_new_messages_of_friend = self::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = $usergroup->get_groups_by_user(
api_get_user_id(),
GROUP_USER_PERMISSION_PENDING_INVITATION,
false
);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) : '');
$filesIcon = Display::return_icon('sn-files.png', get_lang('MyFiles'), null, ICON_SIZE_SMALL);
$friendsIcon = Display::return_icon('sn-friends.png', get_lang('Friends'), null, ICON_SIZE_SMALL);
$groupsIcon = Display::return_icon('sn-groups.png', get_lang('SocialGroups'), null, ICON_SIZE_SMALL);
$homeIcon = Display::return_icon('sn-home.png', get_lang('Home'), null, ICON_SIZE_SMALL);
$invitationsIcon = Display::return_icon('sn-invitations.png', get_lang('Invitations'), null, ICON_SIZE_SMALL);
$messagesIcon = Display::return_icon('sn-message.png', get_lang('Messages'), null, ICON_SIZE_SMALL);
$sharedProfileIcon = Display::return_icon('sn-profile.png', get_lang('ViewMySharedProfile'));
$searchIcon = Display::return_icon('sn-search.png', get_lang('Search'), null, ICON_SIZE_SMALL);
$portfolioIcon = Display::return_icon('wiki_task.png', get_lang('Portfolio'));
$personalDataIcon = Display::return_icon('database.png', get_lang('PersonalDataReport'));
$forumCourseId = api_get_configuration_value('global_forums_course_id');
$groupUrl = api_get_path(WEB_CODE_PATH).'social/groups.php';
if (!empty($forumCourseId)) {
$courseInfo = api_get_course_info_by_id($forumCourseId);
if (!empty($courseInfo)) {
$groupUrl = api_get_path(WEB_CODE_PATH).'forum/index.php?cidReq='.$courseInfo['code'];
}
}
$html = '';
$active = null;
$links = null;
$itemMenu = [];
if (!in_array(
$show,
['shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends']
)) {
$itemMenu[0] = [
'item' => get_lang('Home'),
'url' => api_get_path(WEB_CODE_PATH).'social/home.php',
'icon' => $homeIcon,
'active' => ($show == 'home' ? 'active' : null),
];
$itemMenu[1] = [
'item' => get_lang('Messages').$count_unread_message,
'url' => api_get_path(WEB_CODE_PATH).'messages/inbox.php',
'icon' => $messagesIcon,
'active' => ($show == 'messages' ? 'active' : null),
];
$itemMenu[2] = [
'item' => get_lang('Invitations').$total_invitations,
'url' => api_get_path(WEB_CODE_PATH).'social/invitations.php',
'icon' => $invitationsIcon,
'active' => ($show == 'invitations' ? 'active' : null),
];
$itemMenu[3] = [
'item' => get_lang('ViewMySharedProfile'),
'url' => api_get_path(WEB_CODE_PATH).'social/profile.php',
'icon' => $sharedProfileIcon,
'active' => ($show == 'shared_profile' ? 'active' : null),
];
$itemMenu[4] = [
'item' => get_lang('Friends'),
'url' => api_get_path(WEB_CODE_PATH).'social/friends.php',
'icon' => $friendsIcon,
'active' => ($show == 'friends' ? 'active' : null),
];
$itemMenu[5] = [
'item' => get_lang('SocialGroups'),
'url' => api_get_path(WEB_CODE_PATH).'social/groups.php',
'icon' => $groupsIcon,
'active' => ($show == 'browse_groups' ? 'active' : null),
];
$itemMenu[6] = [
'item' => get_lang('Search'),
'url' => api_get_path(WEB_CODE_PATH).'social/search.php',
'icon' => $searchIcon,
'active' => ($show == 'search' ? 'active' : null),
];
if (api_get_setting('allow_my_files') === 'false') {
$itemMenu[7] = [
'item' => get_lang('MyFiles'),
'url' => api_get_path(WEB_CODE_PATH).'social/myfiles.php',
'icon' => $filesIcon,
'active' => ($show == 'myfiles' ? 'active' : null),
];
}
if (api_get_configuration_value('allow_portfolio_tool')) {
$itemMenu[8] = [
'item' => get_lang('Portfolio'),
'url' => api_get_path(WEB_CODE_PATH).'portfolio/index.php',
'icon' => $portfolioIcon,
'active' => ($show == 'portfolio' ? 'active' : null),
];
}
if (!api_get_configuration_value('disable_gdpr')) {
$itemMenu[9] = [
'item' => get_lang('PersonalDataReport'),
'url' => api_get_path(WEB_CODE_PATH).'social/personal_data.php',
'icon' => $personalDataIcon,
'active' => ($show == 'personal-data' ? 'active' : null),
];
}
}
//Move group menu to another function
/*if (in_array($show, $show_groups) && !empty($group_id)) {
$html .= $usergroup->show_group_column_information(
$group_id,
api_get_user_id(),
$show
);
}*/
if ($show == 'shared_profile') {
// My own profile
if ($show_full_profile && $user_id == intval(api_get_user_id())) {
$itemMenu[0] = [
'item' => get_lang('Home'),
'url' => api_get_path(WEB_CODE_PATH).'social/home.php',
'icon' => $homeIcon,
'active' => ($show == 'home' ? 'active' : null),
];
$itemMenu[1] = [
'item' => get_lang('Messages').$count_unread_message,
'url' => api_get_path(WEB_CODE_PATH).'messages/inbox.php',
'icon' => $messagesIcon,
'active' => ($show == 'messages' ? 'active' : null),
];
$itemMenu[2] = [
'item' => get_lang('Invitations').$total_invitations,
'url' => api_get_path(WEB_CODE_PATH).'social/invitations.php',
'icon' => $invitationsIcon,
'active' => ($show == 'invitations' ? 'active' : null),
];
$itemMenu[3] = [
'item' => get_lang('ViewMySharedProfile'),
'url' => api_get_path(WEB_CODE_PATH).'social/profile.php',
'icon' => $sharedProfileIcon,
'active' => ($show == 'shared_profile' ? 'active' : null),
];
$itemMenu[4] = [
'item' => get_lang('Friends'),
'url' => api_get_path(WEB_CODE_PATH).'social/friends.php',
'icon' => $friendsIcon,
'active' => ($show == 'friends' ? 'active' : null),
];
$itemMenu[5] = [
'item' => get_lang('SocialGroups'),
'url' => api_get_path(WEB_CODE_PATH).'social/groups.php',
'icon' => $groupsIcon,
'active' => ($show == 'browse_groups' ? 'active' : null),
];
$itemMenu[6] = [
'item' => get_lang('Search'),
'url' => api_get_path(WEB_CODE_PATH).'social/search.php',
'icon' => $searchIcon,
'active' => ($show == 'search' ? 'active' : null),
];
if (api_get_setting('allow_my_files') === 'false') {
$itemMenu[7] = [
'item' => get_lang('MyFiles'),
'url' => api_get_path(WEB_CODE_PATH).'social/myfiles.php',
'icon' => $filesIcon,
'active' => ($show == 'myfiles' ? 'active' : null),
];
}
if (api_get_configuration_value('allow_portfolio_tool')) {
$itemMenu[8] = [
'item' => get_lang('Portfolio'),
'url' => api_get_path(WEB_CODE_PATH).'portfolio/index.php',
'icon' => $portfolioIcon,
'active' => ($show == 'portfolio' ? 'active' : null),
];
}
}
// My friend profile.
if ($user_id != api_get_user_id()) {
$sendMessageIcon = Display::return_icon(
'new-message.png',
get_lang('SendMessage')
);
$sendMessageUrl = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?'.http_build_query([
'a' => 'get_user_popup',
'user_id' => $user_id,
]);
$itemMenu[1] = [
'item' => get_lang('SendMessage'),
'url' => $sendMessageUrl,
'icon' => $sendMessageIcon,
'class' => 'ajax',
];
if (api_get_configuration_value('allow_portfolio_tool')) {
$itemMenu[8] = [
'item' => get_lang('Portfolio'),
'url' => api_get_path(WEB_CODE_PATH).'portfolio/index.php?user='.$user_id,
'icon' => $portfolioIcon,
'active' => ($show == 'portfolio' ? 'active' : null),
];
}
}
// Check if I already sent an invitation message
/*$invitation_sent_list = self::get_list_invitation_sent_by_user_id(
api_get_user_id()
);
if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) &&
count($invitation_sent_list[$user_id]) > 0
) {
$links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.
Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation'))
.'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
} else {
if (!$show_full_profile) {
$links .= '<li>
<a class="btn-to-send-invitation" href="#" data-send-to="'.$user_id.'" title="'.get_lang('SendInvitation').'">'.
Display::return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').
'</a></li>';
}
}*/
// Announcements in Courses
/*if ($show_full_profile && $user_id == intval(api_get_user_id())) {
$personal_course_list = UserManager::get_personal_session_course_list($user_id);
$course_list_code = [];
$i = 1;
if (is_array($personal_course_list)) {
foreach ($personal_course_list as $my_course) {
if ($i <= 10) {
$course_list_code[] = ['code' => $my_course['code']];
} else {
break;
}
$i++;
}
// To avoid repeated courses
$course_list_code = array_unique_dimensional($course_list_code);
}
// Announcements
$my_announcement_by_user_id = intval($user_id);
$announcements = [];
foreach ($course_list_code as $course) {
$course_info = api_get_course_info($course['code']);
if (!empty($course_info)) {
$content = AnnouncementManager::get_all_annoucement_by_user_course(
$course_info['code'],
$my_announcement_by_user_id
);
if (!empty($content)) {
$url = Display::url(
Display::return_icon(
'announcement.png',
get_lang('Announcements')
).$course_info['name'].' ('.$content['count'].')',
api_get_path(WEB_CODE_PATH).'announcements/announcements.php?cidReq='.$course['code']
);
$announcements[] = Display::tag('li', $url);
}
}
}
if (!empty($announcements)) {
$html .= '<div class="social_menu_items">';
$html .= '<ul>';
foreach ($announcements as $announcement) {
$html .= $announcement;
}
$html .= '</ul>';
$html .= '</div>';
}
}*/
}
// if ($show_delete_account_button) {
$deleteIcon = Display::return_icon(
'delete.png',
get_lang('Unsubscribe'),
[],
ICON_SIZE_TINY
);
$itemMenu[9] = [
'item' => get_lang('Unsubscribe'),
'url' => api_get_path(WEB_CODE_PATH).'auth/unsubscribe_account.php',
'icon' => $deleteIcon,
'active' => null,
];
// }
return Display::dropdownMenu($itemMenu);
}
/**
* Shows the right menu of the Social Network tool.
*

@ -789,7 +789,7 @@ function cut($text, $maxchar, $embed = false)
{
if (api_strlen($text) > $maxchar) {
if ($embed) {
return '<div class="embed-text">'.api_substr($text, 0, $maxchar).'...</div>';
return '<p title="'.$text.'">'.api_substr($text, 0, $maxchar).'...</p>';
}
return api_substr($text, 0, $maxchar).' ...';

@ -1665,10 +1665,10 @@ class UserGroup extends Model
$size_picture = GROUP_IMAGE_SIZE_MEDIUM,
$style = ''
) {
$picture = null;
$picture = [];
//$picture['style'] = $style;
if ($picture_file === 'unknown.jpg') {
$picture = Display::returnIconPath($picture_file);
$picture['file'] = Display::returnIconPath($picture_file);
return $picture;
}
@ -1694,19 +1694,19 @@ class UserGroup extends Model
$image_array = $this->get_group_picture_path_by_id($id, 'web', false, true);
$file = $image_array_sys['dir'].$size_picture.$picture_file;
if (file_exists($file)) {
$picture = $image_array['dir'].$size_picture.$picture_file;
$picture['file'] = $image_array['dir'].$size_picture.$picture_file;
//$picture['style'] = '';
if ($height > 0) {
$dimension = api_getimagesize($picture);
$dimension = api_getimagesize($picture['file']);
$margin = ($height - $dimension['width']) / 2;
//@ todo the padding-top should not be here
}
} else {
$file = $image_array_sys['dir'].$picture_file;
if (file_exists($file) && !is_dir($file)) {
$picture = $image_array['dir'].$picture_file;
$picture['file'] = $image_array['dir'].$picture_file;
} else {
$picture = Display::returnIconPath('group_na.png', 64);
$picture['file'] = Display::returnIconPath('group_na.png', 64);
}
}
@ -2147,18 +2147,10 @@ class UserGroup extends Model
$result = Database::query($sql);
$array = [];
while ($row = Database::fetch_array($result, 'ASSOC')) {
$description = Security::remove_XSS($row['description'], STUDENT, true);
$row['description'] = cut($description, 250, true);
$row['name'] = Security::remove_XSS($row['name'], STUDENT, true);
$row['url'] = "group_view.php?id=".$row['id'];
if ($with_image) {
$picture = self::get_picture_group(
$row['id'],
$row['picture'],
null,
GROUP_IMAGE_SIZE_MEDIUM
);
$row['picture'] = $picture;
$picture = self::get_picture_group($row['id'], $row['picture'], 80);
$img = '<img src="'.$picture['file'].'" />';
$row['picture'] = $img;
}
if (empty($row['id'])) {
continue;

@ -5,6 +5,8 @@ use ChamiloSession as Session;
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(true);
$type = $_REQUEST['type'];
$src = Security::remove_XSS($_REQUEST['source']);
if (empty($type) || empty($src)) {

@ -1489,54 +1489,53 @@ class learnpath
*
* @param int $id Element ID
* @param string $prerequisite_id Prerequisite Element ID
* @param int $mastery_score Prerequisite min score
* @param int $max_score Prerequisite max score
* @param int $minScore Prerequisite min score
* @param int $maxScore Prerequisite max score
*
* @return bool True on success, false on error
*/
public function edit_item_prereq(
$id,
$prerequisite_id,
$mastery_score = 0,
$max_score = 100
$minScore = 0,
$maxScore = 100
) {
$course_id = api_get_course_int_id();
if ($this->debug > 0) {
error_log('In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
error_log('In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$minScore.','.$maxScore.')', 0);
}
if (empty($id) || ($id != strval(intval($id))) || empty($prerequisite_id)) {
$id = (int) $id;
$prerequisite_id = (int) $prerequisite_id;
if (empty($id)) {
return false;
}
$prerequisite_id = (int) $prerequisite_id;
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
if (!is_numeric($mastery_score) || $mastery_score < 0) {
$mastery_score = 0;
if (empty($minScore) || $minScore < 0) {
$minScore = 0;
}
if (!is_numeric($max_score) || $max_score < 0) {
$max_score = 100;
if (empty($maxScore) || $maxScore < 0) {
$maxScore = 100;
}
/*if ($mastery_score > $max_score) {
$max_score = $mastery_score;
}*/
$minScore = floatval($minScore);
$maxScore = floatval($maxScore);
if (!is_numeric($prerequisite_id)) {
if (empty($prerequisite_id)) {
$prerequisite_id = 'NULL';
$minScore = 0;
$maxScore = 100;
}
$mastery_score = floatval($mastery_score);
$max_score = floatval($max_score);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$sql = " UPDATE $tbl_lp_item
SET
prerequisite = $prerequisite_id ,
prerequisite_min_score = $mastery_score ,
prerequisite_max_score = $max_score
prerequisite_min_score = $minScore ,
prerequisite_max_score = $maxScore
WHERE iid = $id";
Database::query($sql);
// TODO: Update the item object (can be ignored for now because refreshed).
return true;
@ -2250,10 +2249,19 @@ class learnpath
$lpItemId = (int) $lpItemId;
// Getting all the information about the item.
$sql = "SELECT * FROM $tbl_lp_item as lpi
$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
INNER JOIN $tbl_lp_item_view as lp_view
ON (lpi.iid = lp_view.lp_item_id)
WHERE
lp_view.iid = $itemViewId AND
lpi.iid = $lpItemId AND
lp_view.c_id = $course_id";
$result = Database::query($sql);
@ -2350,7 +2358,6 @@ class learnpath
}
$isBlocked = false;
if (!empty($prerequisite)) {
$progress = self::getProgress(
$prerequisite,
@ -2384,12 +2391,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;
@ -2560,7 +2561,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);
@ -2570,12 +2570,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;
}
/**
@ -12575,7 +12577,11 @@ EOD;
$sql = "DELETE FROM $tbl_tool
WHERE c_id = ".$courseId." AND (link LIKE '$link%' AND image='lp_category.gif')";
Database::query($sql);
return true;
}
return false;
}
/**
@ -13150,7 +13156,8 @@ EOD;
null,
true,
false,
$editorConfig
$editorConfig,
true
);
$form->addHidden('action', 'add_final_item');
$form->addHidden('path', Session::read('pathItem'));

@ -2136,7 +2136,8 @@ class learnpathItem
*/
public function parse_prereq($prereqs_string, $items, $refs_list, $user_id)
{
if (self::DEBUG > 0) {
$debug = self::DEBUG;
if ($debug > 0) {
error_log(
'learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string,
0
@ -2198,7 +2199,7 @@ class learnpathItem
// Parenthesis removed, now look for ORs as it is the lesser-priority
// binary operator (= always uses one text operand).
if (strpos($prereqs_string, '|') === false) {
if (self::DEBUG > 1) {
if ($debug) {
error_log('New LP - Didnt find any OR, looking for AND', 0);
}
if (strpos($prereqs_string, '&') !== false) {
@ -2214,7 +2215,7 @@ class learnpathItem
);
if (!$andstatus) {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - One condition in AND was false, short-circuit',
0
@ -2245,12 +2246,12 @@ class learnpathItem
}
} else {
// No ORs found, now look for ANDs.
if (self::DEBUG > 1) {
if ($debug) {
error_log('New LP - Didnt find any AND, looking for =', 0);
}
if (strpos($prereqs_string, '=') !== false) {
if (self::DEBUG > 1) {
if ($debug) {
error_log('New LP - Found =, looking into it', 0);
}
// We assume '=' signs only appear when there's nothing else around.
@ -2272,7 +2273,7 @@ class learnpathItem
}
} else {
// No ANDs found, look for <>
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Didnt find any =, looking for <>',
0
@ -2280,7 +2281,7 @@ class learnpathItem
}
if (strpos($prereqs_string, '<>') !== false) {
if (self::DEBUG > 1) {
if ($debug) {
error_log('New LP - Found <>, looking into it', 0);
}
// We assume '<>' signs only appear when there's nothing else around.
@ -2302,7 +2303,7 @@ class learnpathItem
}
} else {
// No <> found, look for ~ (unary)
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Didnt find any =, looking for ~',
0
@ -2311,7 +2312,7 @@ class learnpathItem
// Only remains: ~ and X*{}
if (strpos($prereqs_string, '~') !== false) {
// Found NOT.
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Found ~, looking into it',
0
@ -2337,7 +2338,7 @@ class learnpathItem
return $returnstatus;
} else {
// Strange...
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Found ~ but strange string: '.$prereqs_string,
0
@ -2346,7 +2347,7 @@ class learnpathItem
}
} else {
// Finally, look for sets/groups
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Didnt find any ~, looking for groups',
0
@ -2364,7 +2365,7 @@ class learnpathItem
foreach ($groups[1] as $gr) {
// Only take the results that correspond to
// the big brackets-enclosed condition.
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Dealing with group '.$gr,
0
@ -2378,7 +2379,7 @@ class learnpathItem
$multi
)
) {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Found multiplier '.$multi[0],
0
@ -2394,7 +2395,7 @@ class learnpathItem
$status == $this->possible_status[3]
) {
$mytrue++;
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Found true item, counting.. ('.($mytrue).')',
0
@ -2402,7 +2403,7 @@ class learnpathItem
}
}
} else {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - item '.$cond.' does not exist in items list',
0
@ -2411,7 +2412,7 @@ class learnpathItem
}
}
if ($mytrue >= $count) {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Got enough true results, return true',
0
@ -2419,7 +2420,7 @@ class learnpathItem
}
$mycond = true;
} else {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Not enough true results',
0
@ -2427,7 +2428,7 @@ class learnpathItem
}
}
} else {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - No multiplier',
0
@ -2442,14 +2443,14 @@ class learnpathItem
$status == $this->possible_status[3]
) {
$mycond = true;
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Found true item',
0
);
}
} else {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - '.
' Found false item, the set is not true, return false',
@ -2460,13 +2461,13 @@ class learnpathItem
break;
}
} else {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - item '.$cond.' does not exist in items list',
0
);
}
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Found false item, the set is not true, return false',
0
@ -2486,7 +2487,7 @@ class learnpathItem
} else {
// Nothing found there either. Now return the
// value of the corresponding resource completion status.
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Didnt find any group, returning value for '.$prereqs_string,
0
@ -2510,14 +2511,14 @@ class learnpathItem
$itemToCheck->get_title()
);
$this->prereq_alert = $explanation;
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Prerequisite '.$prereqs_string.' not complete',
0
);
}
} else {
if (self::DEBUG > 1) {
if ($debug) {
error_log(
'New LP - Prerequisite '.$prereqs_string.' complete',
0
@ -2548,13 +2549,13 @@ class learnpathItem
$minScore = $myItemToCheck->getPrerequisiteMinScore();
$maxScore = $myItemToCheck->getPrerequisiteMaxScore();
if (empty($minScore)) {
/*if (empty($minScore)) {
// Try with mastery_score
$masteryScoreAsMin = $myItemToCheck->get_mastery_score();
if (!empty($masteryScoreAsMin)) {
$minScore = $masteryScoreAsMin;
}
}
}*/
if (isset($minScore) && isset($minScore)) {
// Taking min/max prerequisites values see BT#5776

@ -15,6 +15,8 @@
$use_anonymous = true;
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();
/**
* Get one item's details.
*

@ -16,6 +16,8 @@ use ChamiloSession as Session;
$use_anonymous = true;
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();
/**
* Writes an item's new values into the database and returns the operation result.
*

@ -18,11 +18,10 @@ use ChamiloSession as Session;
$use_anonymous = true;
$debug = 0;
if ($debug) {
error_log('Entering lp_controller.php. Checking if LP exist in current session');
}
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(true);
$current_course_tool = TOOL_LEARNPATH;
$_course = api_get_course_info();
@ -57,17 +56,6 @@ $htmlHeadXtra[] = '
Script to manipulate Learning Path items with Drag and drop
*/
var newOrderData = "";
var lptree_debug = ""; // for debug
var lp_id_list = ""; // for debug
// uncomment for some debug display utility
/*
$(function() {
buildLPtree_debug($("#lp_item_list"), 0, 0);
alert(lp_id_list+"\n\n"+lptree_debug);
});
*/
function buildLPtree(in_elem, in_parent_id) {
var item_tag = in_elem.get(0).tagName;
var item_id = in_elem.attr("id");
@ -84,26 +72,6 @@ $htmlHeadXtra[] = '
}
// same than buildLPtree with some text display for debug in string lptree_debug
function buildLPtree_debug(in_elem, in_lvl, in_parent_id) {
var item_tag = in_elem.get(0).tagName;
var item_id = in_elem.attr("id");
var parent_id = item_id;
if (item_tag == "LI" && item_id != undefined) {
for (i=0; i < 4 * in_lvl; i++) {
lptree_debug += " ";
}
lptree_debug += " Lvl="+(in_lvl - 1)/2+" ("+item_tag+" "+item_id+" Fils de="+in_parent_id+") \n";
// in_parent_id de la forme UL_x
lp_id_list += item_id+"|"+get_UL_integer_id(in_parent_id)+"^";
}
in_elem.children().each(function () {
buildLPtree_debug($(this), in_lvl + 1, parent_id);
});
}
// return the interge part of an UL id
// (0 for lp_item_list)
function get_UL_integer_id(in_ul_id) {
in_parent_integer_id = in_ul_id;
@ -185,7 +153,6 @@ $htmlHeadXtra[] = '
</script>';
$session_id = api_get_session_id();
api_protect_course_script(true);
$lpfound = false;
$myrefresh = 0;
@ -258,9 +225,6 @@ if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $
}
// Regenerate a new lp object? Not always as some pages don't need the object (like upload?)
if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) {
if ($debug > 0) {
error_log(' lp_id is defined');
}
// Select the lp in the database and check which type it is (scorm/chamilo/aicc) to generate the
// right object.
if (!empty($_REQUEST['lp_id'])) {
@ -298,32 +262,24 @@ if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $
$oLP = new learnpath(api_get_course_id(), $lpIid, api_get_user_id());
if ($oLP !== false) {
$lp_found = true;
} else {
error_log($oLP->error);
}
break;
case 2:
$oLP = new scorm(api_get_course_id(), $lpIid, api_get_user_id());
if ($oLP !== false) {
$lp_found = true;
} else {
error_log($oLP->error);
}
break;
case 3:
$oLP = new aicc(api_get_course_id(), $lpIid, api_get_user_id());
if ($oLP !== false) {
$lp_found = true;
} else {
error_log($oLP->error);
}
break;
default:
$oLP = new learnpath(api_get_course_id(), $lpIid, api_get_user_id());
if ($oLP !== false) {
$lp_found = true;
} else {
error_log($oLP->error);
}
break;
}
@ -344,35 +300,16 @@ if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $
}
if ($debug > 0) {
error_log('Passed oLP creation check', 0);
error_log('Passed oLP creation check');
}
$is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
if (isset($_SESSION['oLP'])) {
$_SESSION['oLP']->update_queue = [];
// Reinitialises array used by javascript to update items in the TOC.
$_SESSION['oLP']->update_queue = [];
}
/*$studentView = api_is_student_view_active();
if ($studentView) {
if (isset($_REQUEST['action']) && !in_array($_REQUEST['action'], ['list', 'view', 'view_category'])) {
if (!empty($_REQUEST['lp_id'])) {
$_REQUEST['action'] = 'view';
} elseif ($_REQUEST['action'] == 'view_category') {
$_REQUEST['action'] = 'view_category';
} else {
$_REQUEST['action'] = 'list';
}
}
} else {
if ($is_allowed_to_edit) {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'view' && !isset($_REQUEST['exeId'])) {
$_REQUEST['action'] = 'build';
}
}
}*/
$action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : '';
if ($debug) {
@ -514,10 +451,9 @@ switch ($action) {
$description = isset($_POST['description']) ? $_POST['description'] : '';
$prerequisites = isset($_POST['prerequisites']) ? $_POST['prerequisites'] : '';
$maxTimeAllowed = isset($_POST['maxTimeAllowed']) ? $_POST['maxTimeAllowed'] : '';
$edit = isset($_GET['edit']) ? $_GET['edit'] : '';
if ($_POST['type'] == TOOL_DOCUMENT) {
if (isset($_POST['path']) && $edit != 'true') {
if (isset($_POST['path']) && $_GET['edit'] != 'true') {
$document_id = $_POST['path'];
} else {
if ($_POST['content_lp']) {
@ -541,7 +477,7 @@ switch ($action) {
$prerequisites
);
} elseif ($_POST['type'] == TOOL_READOUT_TEXT) {
if (isset($_POST['path']) && $edit != 'true') {
if (isset($_POST['path']) && $_GET['edit'] != 'true') {
$document_id = $_POST['path'];
} else {
$document_id = $_SESSION['oLP']->createReadOutText(
@ -661,8 +597,10 @@ switch ($action) {
api_not_allowed(true);
}
if (isset($_REQUEST['id'])) {
learnpath::deleteCategory($_REQUEST['id']);
Display::addFlash(Display::return_message(get_lang('Deleted')));
$result = learnpath::deleteCategory($_REQUEST['id']);
if ($result) {
Display::addFlash(Display::return_message(get_lang('Deleted')));
}
}
require 'lp_list.php';
break;
@ -835,11 +773,14 @@ switch ($action) {
// Updating the lp.modified_on
$_SESSION['oLP']->set_modified_on();
Session::write('refresh', 1);
$min = isset($_POST['min_'.$_POST['prerequisites']]) ? $_POST['min_'.$_POST['prerequisites']] : '';
$max = isset($_POST['max_'.$_POST['prerequisites']]) ? $_POST['max_'.$_POST['prerequisites']] : '';
$editPrerequisite = $_SESSION['oLP']->edit_item_prereq(
$_GET['id'],
$_POST['prerequisites'],
$_POST['min_'.$_POST['prerequisites']],
$_POST['max_'.$_POST['prerequisites']]
$min,
$max
);
if ($editPrerequisite) {
@ -1196,6 +1137,7 @@ switch ($action) {
}
break;
case 'add_sub_item': // Add an item inside a dir/chapter.
// Add an item inside a dir/chapter.
// @todo check if this is @deprecated
if (!$is_allowed_to_edit) {
api_not_allowed(true);

@ -16,11 +16,14 @@ use ChamiloSession as Session;
$this_section = SECTION_COURSES;
//@todo who turns on $lp_controller_touched?
if (empty($lp_controller_touched) || $lp_controller_touched != 1) {
header('location: lp_controller.php?action=list');
header('Location: lp_controller.php?action=list&'.api_get_cidreq());
exit;
}
require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script();
$courseDir = api_get_course_path().'/scorm';
$baseWordDir = $courseDir;
@ -28,8 +31,7 @@ $baseWordDir = $courseDir;
* Display initialisation and security checks.
*/
// Extra javascript functions for in html head:
$htmlHeadXtra[]
= "<script>
$htmlHeadXtra[] = "<script>
function confirmation(name) {
if (confirm(\" ".trim(get_lang('AreYouSureToDeleteJS'))." \"+name+\"?\")) {
return true;
@ -40,7 +42,6 @@ function confirmation(name) {
</script>";
$nameTools = get_lang('LearningPaths');
Event::event_access_tool(TOOL_LEARNPATH);
api_protect_course_script();
/**
* Display.
@ -51,6 +52,8 @@ if (api_get_setting('search_enabled') === 'true') {
search_widget_prepare($htmlHeadXtra);
}
$sessionId = api_get_session_id();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$courseInfo = api_get_course_info();
$subscriptionSettings = learnpath::getSubscriptionSettings();
@ -67,11 +70,8 @@ $introduction = Display::return_introduction_section(
]
);
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$courseInfo = api_get_course_info();
$message = '';
$actions = '';
if ($is_allowed_to_edit) {
$actionLeft = '';
$actionLeft .= Display::url(
@ -200,8 +200,6 @@ foreach ($categories as $item) {
continue;
}
$showBlockedPrerequisite = api_get_configuration_value('show_prerequisite_as_blocked');
$allowLpChamiloExport = api_get_configuration_value('allow_lp_chamilo_export');
$listData = [];
$lpTimeList = [];
if ($allowMinTime) {
@ -217,7 +215,6 @@ foreach ($categories as $item) {
$autolaunch_exists = false;
$accumulateWorkTimeTotal = 0;
if ($allowMinTime) {
// TT --- Tiempo total del curso
$accumulateWorkTimeTotal = learnpath::getAccumulateWorkTimeTotal(api_get_course_int_id());
}
@ -321,11 +318,12 @@ foreach ($categories as $item) {
// student view automatically. Many teachers are confused
// by that, so maybe a solution can be found to avoid it
$url_start_lp .= '&isStudentView=true';
$dsp_desc = '<span>'.$details['lp_maker'].'</span> '
$dsp_desc = '<em>'.$details['lp_maker'].'</em> '
.($lpVisibility
? ''
: ' - ('.get_lang('LPNotVisibleToStudent').')');
$extra = $dsp_desc;
$extra = '<div class ="lp_content_type_label">'.$dsp_desc
.'</div>';
}
$my_title = $name;
@ -390,7 +388,7 @@ foreach ($categories as $item) {
}
if ($is_allowed_to_edit) {
$dsp_progress = learnpath::get_progress_bar($progress, '%');
$dsp_progress = '<center>'.$progress.'%</center>';
} else {
$dsp_progress = '';
if (!api_is_invitee()) {
@ -808,11 +806,9 @@ foreach ($categories as $item) {
'delete.png',
get_lang('LearnpathDeleteLearnpath')
),
'lp_controller.php?'.api_get_cidreq()
."&action=delete&lp_id=$id",
'lp_controller.php?'.api_get_cidreq()."&action=delete&lp_id=$id",
[
'onclick' => "javascript: return confirmation('"
.addslashes($name)."');",
'onclick' => "javascript: return confirmation('".addslashes($name)."');",
]
);
} else {

@ -8,11 +8,12 @@
*
* @package chamilo.learnpath
*/
$this_section = SECTION_COURSES;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
api_protect_course_script();
$allow = api_is_allowed_to_edit(null, true);
$lpId = !empty($_GET['lp_id']) ? (int) $_GET['lp_id'] : 0;

@ -388,7 +388,6 @@ if ($lp->mode == 'fullscreen') {
</script>";
}
// Set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php).
Session::write('loaded_lp_view', true);
$display_none = '';
$margin_left = '340px';
@ -410,7 +409,7 @@ if (!api_is_invitee()) {
$progress_bar = $lp->getProgressBar();
}
$navigation_bar = $lp->get_navigation_bar();
$navigation_bar_bottom = $lp->get_navigation_bar("control-bottom", "display:none");
$navigation_bar_bottom = $lp->get_navigation_bar('control-bottom', 'display:none');
$mediaplayer = $lp->get_mediaplayer($lp->current, $autostart);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
@ -517,6 +516,7 @@ $template->assign('glossary_tool_available_list', ['true', 'lp', 'exercise_and_l
$gamificationMode = api_get_setting('gamification_mode');
// ...AND this learning path is set in gamification mode, then change the display
$gamificationMode = $gamificationMode && $lp->seriousgame_mode;
$template->assign('gamification_mode', $gamificationMode);
$template->assign('glossary_extra_tools', api_get_setting('show_glossary_in_extra_tools'));
$template->assign('show_glossary_in_documents', api_get_setting('show_glossary_in_documents'));

@ -94,12 +94,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');
@ -162,7 +160,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'),
@ -269,7 +267,6 @@ switch ($action) {
$table->setCellContents(1, 4, $last);
$courseTable = '';
if (!empty($courses)) {
$courseTable .= '<table class="data_table">';
$courseTable .= '<thead>';
@ -392,7 +389,6 @@ switch ($action) {
$params = [
'pdf_title' => get_lang('Resume'),
//'course_code' => api_get_course_id(),
'session_info' => $sessionInfo,
'course_info' => '',
'pdf_date' => '',
@ -571,6 +567,7 @@ switch ($action) {
default:
break;
}
$courses_in_session = [];
// See #4676
@ -656,15 +653,6 @@ $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() &&
@ -774,7 +762,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) {
@ -862,11 +855,30 @@ $table_title = Display::return_icon('user.png', get_lang('User')).$user_info['co
echo Display::page_subheader($table_title);
$userPicture = UserManager::getUserPicture($user_info['user_id'], USER_IMAGE_SIZE_BIG);
$userGroupManager = new UserGroup();
$userGroups = $userGroupManager->getNameListByUser(
$user_info['user_id'],
UserGroup::NORMAL_CLASS
);
$userInfo = [
'id' => $user_info['user_id'],
'complete_name' => $user_info['complete_name'],
'complete_name_link' => $user_info['complete_name_with_message_link'],
'phone' => $user_info['phone'],
'code' => $user_info['official_code'],
'username' => $user_info['username'],
'registration_date' => $user_info['registration_date'],
'email' => $user_info['email'],
'has_certificates' => $user_info['has_certificates'],
'last_login' => $user_info['last_login'],
'profile_url' => $user_info['profile_url'],
'groups' => $userGroupManager,
'avatar' => $userPicture,
'online' => $online,
];
?>
<div class="row">
<div class="col-sm-2">
@ -1071,6 +1083,19 @@ $userGroups = $userGroupManager->getNameListByUser(
</div>
<?php
$tpl = new Template(
'',
false,
false,
false,
false,
false,
false
);
$tpl->assign('user', $userInfo);
$templateName = $tpl->get_template('my_space/user_details.tpl');
$content = $tpl->fetch($templateName);
$exportCourseList = [];
$lpIdList = [];
if (empty($details)) {
@ -1703,7 +1728,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'],
@ -2111,4 +2136,6 @@ if ($export) {
exit;
}
echo $content;
Display::display_footer();

@ -115,7 +115,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
); ?>
</div>
<div class="col-md-6">
<div class="float-right">
<div class="pull-right">
<form method="POST" action="session_category_list.php" class="form-inline">
<div class="form-group">
<input class="form-control" type="text" name="keyword" value="<?php echo $keyword; ?>"

@ -152,24 +152,29 @@ echo Display::page_header($tool_name);
<?php if ($is_western_name_order) {
?>
<th>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('FirstName'); ?></a>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname&direction=<?php echo urlencode($direction); ?>">
<?php echo get_lang('FirstName'); ?></a>
</th>
<th>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('LastName'); ?></a>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname&direction=<?php echo urlencode($direction); ?>">
<?php echo get_lang('LastName'); ?></a>
</th>
<?php
} else {
?>
<th>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('LastName'); ?></a>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname&direction=<?php echo urlencode($direction); ?>">
<?php echo get_lang('LastName'); ?></a>
</th>
<th>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('FirstName'); ?></a>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname&direction=<?php echo urlencode($direction); ?>">
<?php echo get_lang('FirstName'); ?></a>
</th>
<?php
} ?>
<th>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=username&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('Login'); ?></a>
<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=username&direction=<?php echo urlencode($direction); ?>">
<?php echo get_lang('Login'); ?></a>
</th>
<th><?php echo get_lang('Actions'); ?></th>
</tr>

@ -381,7 +381,7 @@ if ($list_type == 'complete') {
echo $actions;
if (api_is_platform_admin()) {
echo '<div class="float-right">';
echo '<div class="pull-right">';
// Create a search-box
$form = new FormValidator(
'search_simple',
@ -398,7 +398,7 @@ if (api_is_platform_admin()) {
$form->display();
echo '</div>';
echo '<div class="float-right">';
echo '<div class="pull-right">';
echo $sessionFilter->returnForm();
echo '</div>';
}

@ -207,6 +207,5 @@ $tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_friend_block', $friend_html);
$tpl->assign('group_message', $group_message);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('social/groups_topics.tpl');
$tpl->display($social_layout);

@ -112,7 +112,6 @@ 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' => $groupInfo['name']];
if (isset($_GET['action']) && $_GET['action'] == 'leave') {
@ -180,14 +179,14 @@ if ($is_group_member || $groupInfo['visibility'] == GROUP_PERMISSION_OPEN) {
[GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION]
)) {
$social_right_content .= '<div class="group-tool">';
$social_right_content .= '<div class="float-right">';
$social_right_content .= '<div class="pull-right">';
$social_right_content .= '<a class="btn btn-default btn-sm" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.
get_lang('JoinGroup').'</a>';
$social_right_content .= '</div>';
$social_right_content .= '</div>';
} elseif ($role == GROUP_USER_PERMISSION_PENDING_INVITATION) {
$social_right_content .= '<div class="group-tool">';
$social_right_content .= '<div class="float-right">';
$social_right_content .= '<div class="pull-right">';
$social_right_content .= '<a class="btn btn-default btn-sm" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.
Display::returnFontAwesomeIcon('envelope').' '.
get_lang('YouHaveBeenInvitedJoinNow').'</a>';
@ -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(),
'',
''
);
@ -253,7 +252,7 @@ if ($is_group_member || $groupInfo['visibility'] == GROUP_PERMISSION_OPEN) {
if (count($members) > 0) {
if ($role == GROUP_USER_PERMISSION_ADMIN) {
$member_content .= '<div class="group-tool">';
$member_content .= '<div class="float-right">';
$member_content .= '<div class="pull-right">';
$member_content .= Display::url(
Display::returnFontAwesomeIcon('pencil').' '.get_lang('EditMembersList'),
'group_members.php?id='.$group_id,
@ -300,7 +299,7 @@ if ($is_group_member || $groupInfo['visibility'] == GROUP_PERMISSION_OPEN) {
}
if (!empty($create_thread_link)) {
$create_thread_link = Display::div($create_thread_link, ['class' => 'float-right']);
$create_thread_link = Display::div($create_thread_link, ['class' => 'pull-right']);
}
$headers = [get_lang('Discussions'), get_lang('Members')];
$socialForum = Display::tabs($headers, [$content, $member_content], 'tabs');
@ -328,16 +327,10 @@ $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);
$tpl->assign('list_members', $listMembers);
$tpl->assign('list_topic', $listTopic);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/group_view.html.twig');
$content = $tpl->fetch($social_layout);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
$social_layout = $tpl->get_template('social/group_view.tpl');
$tpl->display($social_layout);

@ -105,7 +105,7 @@ if (is_array($results) && count($results) > 0) {
$result['picture'],
80
);
$result['picture'] = '<img class="mr-3" src="'.$picture.'" />';
$result['picture'] = '<img class="social-groups-image" src="'.$picture['file'].'" />';
$members = Display::returnFontAwesomeIcon('user').$count_users_group;
$html = '<div class="row">';
@ -118,7 +118,9 @@ if (is_array($results) && count($results) > 0) {
$html .= '</div>';
$html .= '<div class="members-groups">'.$members.'</div>';
if ($result['description'] != '') {
$html .= cut($result['description'], 250, true);
$html .= '<div class="description-groups">'.cut($result['description'], 100, true).'</div>';
} else {
$html .= '';
}
$html .= '</div>';
$html .= '</div>';
@ -132,7 +134,6 @@ if (is_array($results) && count($results) > 0) {
$results = $usergroup->get_groups_by_age(4, false);
$grid_newest_groups = [];
$html = '<ul class="list-unstyled">';
foreach ($results as $result) {
$result['name'] = Security::remove_XSS($result['name'], STUDENT, true);
$result['description'] = Security::remove_XSS($result['description'], STUDENT, true);
@ -157,17 +158,20 @@ foreach ($results as $result) {
$url = '<a href="group_view.php?id='.$id.'">'.$name.'</a>';
$picture = $usergroup->get_picture_group($result['id'], $result['picture'], 80);
$result['picture'] = '<img class="mr-3" src="'.$picture.'" />';
$result['picture'] = '<img class="social-groups-image" src="'.$picture['file'].'" />';
$members = Display::returnFontAwesomeIcon('user').$count_users_group;
$html .= '<li class="media item-3">';
$html = '<div class="row">';
$html .= '<div class="col-md-2">';
$html .= $result['picture'];
$html .= '<div class="media-body">';
$html .= Display::tag('h5', $url, ['class' => 'mt-0 mb-1']);
$html .= '<div class="details">'.$members.'</div>';
$html .= '</div>';
$html .= '<div class="col-md-10">';
$html .= '<div class="title-groups">';
$html .= Display::tag('h5', $url);
$html .= '</div>';
$html .= '<div class="members-groups">'.$members.'</div>';
if ($result['description'] != '') {
$html .= cut($result['description'], 250, true);
$html .= '<div class="description-groups">'.cut($result['description'], 100, true).'</div>';
}
// Avoiding my groups
if (!in_array($id, $my_group_list)) {
@ -177,18 +181,15 @@ foreach ($results as $result) {
$html .= '<div class="group-actions" >'.$join_url.'</div>';
$html .= '</div>';
$html .= '</li>';
$html .= '</div>';
$grid_item_2 = $html;
$grid_newest_groups[] = [$grid_item_2];
}
$html .= '</ul>';
// Pop groups
$results = $usergroup->get_groups_by_popularity(4, false);
$grid_pop_groups = [];
$html = '<ul class="list-unstyled">';
if (is_array($results) && count($results) > 0) {
foreach ($results as $result) {
$result['name'] = Security::remove_XSS($result['name'], STUDENT, true);
@ -218,15 +219,21 @@ if (is_array($results) && count($results) > 0) {
$url = '<a href="group_view.php?id='.$id.'">'.$name.'</a>';
$picture = $usergroup->get_picture_group($result['id'], $result['picture'], 80);
$result['picture'] = '<img class="mr-3" src="'.$picture.'" />';
$result['picture'] = '<img class="social-groups-image" src="'.$picture['file'].'" />';
$html .= '<li class="media item-3">';
$html = '<div class="row">';
$html .= '<div class="col-md-2">';
$html .= $result['picture'];
$html .= '<div class="media-body">';
$html .= Display::tag('h5', $url, ['class' => 'mt-0 mb-1']);
$html .= '<div class="details">'.$members.'</div>';
$html .= '</div>';
$html .= '<div class="col-md-10">';
$html .= '<div class="title-groups">';
$html .= Display::tag('h5', $url);
$html .= '</div>';
$html .= '<div class="members-groups">'.$members.'</div>';
if ($result['description'] != '') {
$html .= cut($result['description'], 250, true);
$html .= '<div class="description-groups">'.cut($result['description'], 100, true).'</div>';
} else {
$html .= '';
}
// Avoiding my groups
if (!in_array($id, $my_group_list)) {
@ -236,12 +243,11 @@ if (is_array($results) && count($results) > 0) {
$html .= '<div class="group-actions" >'.$join_url.'</div>';
$html .= '</div>';
$html .= '</li>';
$html .= '</div>';
$grid_item_2 = $html;
$grid_pop_groups[] = [$grid_item_2];
}
$html .= '</ul>';
}
// Display groups (newest, mygroups, pop)
@ -264,12 +270,12 @@ if (isset($_GET['view']) && in_array($_GET['view'], $allowed_views)) {
}
if (api_get_setting('allow_students_to_create_groups_in_social') == 'true') {
$create_group_item =
'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'main/social/group_add.php">'.
'<a class="btn btn-default" href="'.api_get_path(WEB_PATH).'main/social/group_add.php">'.
get_lang('CreateASocialGroup').'</a>';
} else {
if (api_is_allowed_to_edit(null, true)) {
$create_group_item =
'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'main/social/group_add.php">'.
'<a class="btn btn-default" href="'.api_get_path(WEB_PATH).'main/social/group_add.php">'.
get_lang('CreateASocialGroup').'</a>';
}
}
@ -318,12 +324,12 @@ if (isset($_GET['view']) && in_array($_GET['view'], $allowed_views)) {
}
if (api_get_setting('allow_students_to_create_groups_in_social') == 'true') {
$create_group_item =
'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'main/social/group_add.php">'.
'<a class="btn btn-default" href="'.api_get_path(WEB_PATH).'main/social/group_add.php">'.
get_lang('CreateASocialGroup').'</a>';
} else {
if (api_is_allowed_to_edit(null, true)) {
$create_group_item =
'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'main/social/group_add.php">'.
'<a class="btn btn-default" href="'.api_get_path(WEB_PATH).'main/social/group_add.php">'.
get_lang('CreateASocialGroup').'</a>';
}
}

@ -127,7 +127,7 @@ if ($numberLoop != 0) {
$invitationHtml .= '</div>';
$invitationHtml .= '<div class="col-md-10">';
$invitationHtml .= '<div class="float-right">';
$invitationHtml .= '<div class="pull-right">';
$invitationHtml .= '<div class="btn-group btn-group-sm" role="group">';
$invitationHtml .= Display::toolbarButton(
null,

@ -293,7 +293,7 @@ if ($show_full_profile) {
$invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'
.api_get_person_name($userInfo['firstname'], $userInfo['lastname']).'</a>';
$invitations .= '<div class="float-right">';
$invitations .= '<div class="pull-right">';
$invitations .= Display::toolbarButton(
get_lang('SocialAddToFriends'),
api_get_path(WEB_AJAX_PATH).'social.ajax.php?'.http_build_query([

@ -263,7 +263,7 @@ if ($action === 'edit') {
$content .= $table->toHtml();
if ($action === 'edit') {
$content .= '<div class="float-right">
$content .= '<div class="pull-right">
<button name="submit" type="submit" class="btn btn-primary btn-lg">'.get_lang('Save').'</button></div>';
$content .= '</form>';
}

@ -1751,7 +1751,7 @@ class SurveyUtil
if ($display_extra_user_fields) {
//show user fields data, if any, for this user
$user_fields_values = UserManager::get_extra_user_data(
intval($user),
$user,
false,
false,
false,

@ -199,7 +199,7 @@ foreach ($messages as $message) {
$message['user_info']['complete_name_with_message_link']
);
$messageToShow .= ' '.$date.' <span class="float-right">'.$counterLink.'</span></h4>';
$messageToShow .= ' '.$date.' <span class="pull-right">'.$counterLink.'</span></h4>';
$messageToShow .= '<hr />';
if (!empty($entireMessage)) {

@ -222,7 +222,7 @@ if (!empty($projectId)) {
Display::returnFontAwesomeIcon('arrow-right').' '.get_lang('AdvancedSearch'),
'javascript://',
[
'class' => 'btn btn-outline-secondary advanced-parameters',
'class' => 'btn btn-default advanced-parameters',
'onclick' => 'display_advanced_search_form();',
]
);

@ -202,7 +202,7 @@ Display::display_header($nameTools, 'Tracking');
$actionsLeft = TrackingCourseLog::actionsLeft('users', $sessionId);
$actionsRight = '<div class="float-right">';
$actionsRight = '<div class="pull-right">';
$actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';

@ -82,7 +82,7 @@ foreach ($messages as $message) {
$message['title'].
$subText = get_lang('From').': '.$usersData[$message['user_sender_id']]['complete_name'];
$title = empty($message['title']) ? get_lang('Untitled') : $message['title'];
$title = $title.' - '.$subText.'<span class="float-right">'.Display::dateToStringAgoAndLongDate($message['send_date']).'</span>';
$title = $title.' - '.$subText.'<span class="pull-right">'.Display::dateToStringAgoAndLongDate($message['send_date']).'</span>';
$messageId = $message['id'];
$hash = sha1($message['title'].$message['content'].$message['send_date']);

@ -166,7 +166,7 @@ if (!empty($sessionId)) {
);
}
$actionsRight = '<div class="float-right">';
$actionsRight = '<div class="pull-right">';
$actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';

@ -614,7 +614,7 @@ if (api_is_allowed_to_edit(null, true)) {
echo '</div>';
echo '<div class="col-md-6">';
echo '<div class="float-right">';
echo '<div class="pull-right">';
// Build search-form
$form = new FormValidator(
'search_user',
@ -1049,7 +1049,7 @@ function modify_filter($user_id, $row, $data)
$result .= Display::url(
$text,
'user.php?'.api_get_cidreq().'&action=set_tutor&is_tutor='.$isTutor.'&user_id='.$user_id.'&type='.$type,
['class' => 'btn btn-sm btn-primary '.$disabled]
['class' => 'btn btn-default '.$disabled]
).'&nbsp;';
}
}

@ -2797,7 +2797,6 @@ class Wiki
}
} else {
if ($search_content == '1') {
// warning don't use group by reflink because don't return the last version
$sql = "SELECT * FROM ".$tbl_wiki." s1
WHERE
s1.c_id = $course_id AND

@ -78,7 +78,7 @@ if (!empty($items)) {
['class' => 'btn btn-danger btn-sm']
);
echo '<li class="list-group-item">'.
$userInfo['complete_name_with_username'].'<div class="float-right">'.$link.'</div></li>';
$userInfo['complete_name_with_username'].'<div class="pull-right">'.$link.'</div></li>';
}
echo '</ul>';
}

Loading…
Cancel
Save