Skip to content

Commit 518ef60

Browse files
committed
Merge branch 'master' of github.com:chamilo/chamilo-lms
2 parents 7e2ecc0 + d0d5d60 commit 518ef60

File tree

10 files changed

+226
-211
lines changed

10 files changed

+226
-211
lines changed

assets/vue/components/layout/TopbarLoggedIn.vue

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -97,33 +97,44 @@ const ticketUrl = computed(() => {
9797
})
9898
9999
const elUserSubmenu = ref(null)
100-
const userSubmenuItems = computed(() => [
101-
{
102-
label: props.currentUser.fullName,
103-
items: [
104-
{
105-
label: t("My profile"),
106-
url: router.resolve({ name: "AccountHome" }).href,
107-
},
108-
{
109-
label: t("My General Certificate"),
110-
url: "/main/social/my_skills_report.php?a=generate_custom_skill",
111-
},
112-
{
113-
label: t("My skills"),
114-
url: "/main/social/my_skills_report.php",
115-
},
116-
{
117-
separator: true,
118-
},
119-
{
120-
label: t("Sign out"),
121-
url: "/logout",
122-
icon: "mdi mdi-logout-variant",
123-
},
124-
],
125-
},
126-
])
100+
const userSubmenuItems = computed(() => {
101+
const items = [
102+
{
103+
label: props.currentUser.fullName,
104+
items: [
105+
{
106+
label: t("My profile"),
107+
url: router.resolve({ name: "AccountHome" }).href,
108+
},
109+
],
110+
},
111+
]
112+
113+
if (platformConfigStore.getSetting("platform.show_tabs").indexOf("topbar_certificate") > -1) {
114+
items[0].items.push({
115+
label: t("My General Certificate"),
116+
url: "/main/social/my_skills_report.php?a=generate_custom_skill",
117+
})
118+
}
119+
120+
if (platformConfigStore.getSetting("platform.show_tabs").indexOf("topbar_skills") > -1) {
121+
items[0].items.push({
122+
label: t("My skills"),
123+
url: "/main/social/my_skills_report.php",
124+
})
125+
}
126+
127+
items[0].items.push(
128+
{ separator: true },
129+
{
130+
label: t("Sign out"),
131+
url: "/logout",
132+
icon: "mdi mdi-logout-variant",
133+
}
134+
)
135+
136+
return items
137+
})
127138
128139
function toggleUserMenu(event) {
129140
elUserSubmenu.value.toggle(event)

assets/vue/composables/sidebarMenu.js

Lines changed: 80 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,29 @@ export function useSidebarMenu() {
2525
return false
2626
}
2727

28-
const menuItemsBeforeMyCourse = computed(() => {
29-
const items = []
30-
31-
if (showTabsSetting.indexOf("campus_homepage") > -1) {
32-
items.push({
33-
icon: "mdi mdi-home",
34-
label: t("Home"),
35-
route: { name: "Home" },
36-
})
28+
const createMenuItem = (key, icon, label, routeName, subItems = null) => {
29+
if (showTabsSetting.indexOf(key) > -1) {
30+
const item = {
31+
icon: `mdi ${icon}`,
32+
label: t(label),
33+
}
34+
if (routeName) item.route = { name: routeName }
35+
if (subItems) item.items = subItems
36+
return item
3737
}
38+
return null
39+
}
3840

39-
return items
41+
const menuItemsBeforeMyCourse = computed(() => {
42+
const items = []
43+
items.push(createMenuItem("campus_homepage", "mdi-home", "Home", "Home"))
44+
return items.filter(Boolean)
4045
})
4146

4247
const menuItemMyCourse = computed(() => {
4348
const items = []
4449

45-
if (securityStore.isAuthenticated) {
50+
if (securityStore.isAuthenticated && showTabsSetting.indexOf("my_courses") > -1) {
4651
const courseItems = []
4752

4853
if (enrolledStore.isEnrolledInCourses) {
@@ -76,33 +81,33 @@ export function useSidebarMenu() {
7681
const menuItemsAfterMyCourse = computed(() => {
7782
const items = []
7883

79-
if (showCatalogue > -1) {
84+
if (showTabsSetting.indexOf("catalogue") > -1) {
8085
if (showCatalogue == 0 || showCatalogue == 2) {
81-
items.push({
82-
icon: "mdi mdi-bookmark-multiple",
83-
label: t("Explore more courses"),
84-
route: { name: "CatalogueCourses" },
85-
})
86+
items.push(
87+
createMenuItem(
88+
"catalogue",
89+
"mdi-bookmark-multiple",
90+
"Explore more courses",
91+
"CatalogueCourses"
92+
)
93+
)
8694
}
8795
if (showCatalogue > 0) {
88-
items.push({
89-
icon: "mdi mdi-bookmark-multiple-outline",
90-
label: t("Sessions catalogue"),
91-
route: { name: "CatalogueSessions" },
92-
})
96+
items.push(
97+
createMenuItem(
98+
"catalogue",
99+
"mdi-bookmark-multiple-outline",
100+
"Sessions catalogue",
101+
"CatalogueSessions"
102+
)
103+
)
93104
}
94105
}
95106

96-
if (showTabsSetting.indexOf("my_agenda") > -1) {
97-
items.push({
98-
icon: "mdi mdi-calendar-text",
99-
label: t("Events"),
100-
route: { name: "CCalendarEventList" },
101-
})
102-
}
107+
items.push(createMenuItem("my_agenda", "mdi-calendar-text", "Events", "CCalendarEventList"))
103108

104109
if (showTabsSetting.indexOf("reporting") > -1) {
105-
let subItems = []
110+
const subItems = []
106111

107112
if (securityStore.isTeacher || securityStore.isHRM || securityStore.isSessionAdmin) {
108113
subItems.push({
@@ -155,75 +160,58 @@ export function useSidebarMenu() {
155160
})
156161
}
157162

158-
if (platformConfigStore.plugins?.bbb?.show_global_conference_link) {
159-
items.push({
160-
icon: "mdi mdi-video",
161-
label: t("Videoconference"),
162-
url: platformConfigStore.plugins.bbb.listingURL,
163-
})
164-
}
165-
166-
if (securityStore.isStudentBoss || securityStore.isStudent) {
167-
items.push({
168-
icon: "mdi mdi-text-box-search",
169-
items: [
170-
{
171-
label: t("Diagnosis Management"),
172-
url: "/main/search/load_search.php",
173-
visible: securityStore.isStudentBoss,
174-
},
175-
{
176-
label: t("Diagnostic Form"),
177-
url: "/main/search/search.php",
178-
},
179-
],
180-
label: t("Diagnosis"),
181-
})
182-
}
183-
184-
if (securityStore.isAdmin || securityStore.isSessionAdmin) {
185-
const adminItems = [
163+
items.push(
164+
createMenuItem(
165+
"videoconference",
166+
"mdi-video",
167+
"Videoconference",
168+
null,
169+
platformConfigStore.plugins?.bbb?.show_global_conference_link
170+
? [
171+
{
172+
label: t("Conference Room"),
173+
url: platformConfigStore.plugins.bbb.listingURL,
174+
},
175+
]
176+
: null
177+
)
178+
)
179+
180+
items.push(
181+
createMenuItem("diagnostics", "mdi-text-box-search", "Diagnosis Management", null, [
186182
{
187-
label: t("Administration"),
188-
route: { name: "AdminIndex" },
183+
label: t("Diagnosis Management"),
184+
url: "/main/search/load_search.php",
185+
visible: securityStore.isStudentBoss,
189186
},
190-
]
191-
192-
if (
193-
securityStore.isSessionAdmin &&
194-
"true" === platformConfigStore.getSetting("session.limit_session_admin_list_users")
195-
) {
196-
adminItems.push({
197-
label: t("Add user"),
198-
url: "/main/admin/user_add.php",
199-
})
200-
} else {
201-
adminItems.push({
202-
label: t("Users"),
203-
url: "/main/admin/user_list.php",
204-
})
205-
}
187+
{
188+
label: t("Diagnostic Form"),
189+
url: "/main/search/search.php",
190+
},
191+
])
192+
)
193+
194+
if (showTabsSetting.indexOf("platform_administration") > -1) {
195+
if (securityStore.isAdmin || securityStore.isSessionAdmin) {
196+
const adminItems = [
197+
{ label: t("Administration"), route: { name: "AdminIndex" } },
198+
...(securityStore.isSessionAdmin &&
199+
"true" === platformConfigStore.getSetting("session.limit_session_admin_list_users")
200+
? [{ label: t("Add user"), url: "/main/admin/user_add.php" }]
201+
: [{ label: t("Users"), url: "/main/admin/user_list.php" }]),
202+
{ label: t("Courses"), url: "/main/admin/course_list.php" },
203+
{ label: t("Sessions"), url: "/main/session/session_list.php" },
204+
]
206205

207-
if (securityStore.isAdmin) {
208-
adminItems.push({
209-
label: t("Courses"),
210-
url: "/main/admin/course_list.php",
206+
items.push({
207+
icon: "mdi mdi-cog",
208+
items: adminItems,
209+
label: t("Administration"),
211210
})
212211
}
213-
214-
adminItems.push({
215-
label: t("Sessions"),
216-
url: "/main/session/session_list.php",
217-
})
218-
219-
items.push({
220-
icon: "mdi mdi-cog",
221-
items: adminItems,
222-
label: t("Administration"),
223-
})
224212
}
225213

226-
return items
214+
return items.filter(Boolean)
227215
})
228216

229217
async function initialize() {

public/main/admin/course_user_import.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ function parse_csv_data($file)
163163
$form->addElement('header', '', $tool_name);
164164
$form->addElement('file', 'import_file', get_lang('Import marks in an assessment'));
165165
$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('Add user in the course only if not yet in'));
166-
$form->addElement('checkbox', 'unsubscribe', '', get_lang('Remove user from course if his name is not in the list'));
166+
$form->addElement('checkbox', 'unsubscribe', '', get_lang('Remove users from any courses that are not mentioned explicitly in this file'));
167167
$form->addButtonImport(get_lang('Import'));
168168
$form->setDefaults(['subscribe' => '1', 'unsubscribe' => 1]);
169169
$errors = [];
@@ -174,7 +174,7 @@ function parse_csv_data($file)
174174
if (0 == count($errors)) {
175175
$inserted_in_course = save_data($users_courses);
176176
// Build the alert message in case there were visual codes subscribed to.
177-
if ($_POST['subscribe']) {
177+
if (isset($_POST['subscribe']) && $_POST['subscribe']) {
178178
//$warn = get_lang('The users have been subscribed to the following courses because several courses share the same visual code').': ';
179179
} else {
180180
$warn = get_lang('The users have been unsubscribed from the following courses because several courses share the same visual code').': ';

public/main/exercise/question_list_admin.inc.php

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,7 @@
135135
//deletes a session when using don't know question type (ugly fix)
136136
Session::erase('less_answer');
137137

138-
// If we are in a test
139-
$inATest = isset($exerciseId) && $exerciseId > 0;
140-
if (!$inATest) {
141-
echo Display::return_message(get_lang('Choose question type'), 'warning');
142-
} else {
138+
if (isset($exerciseId) && $exerciseId > 0) {
143139
if ($nbrQuestions) {
144140
// In the building exercise mode show question list ordered as is.
145141
$objExercise->setCategoriesGrouping(false);
@@ -149,32 +145,14 @@
149145
$objExercise->questionSelectionType = EX_Q_SELECTION_ORDERED;
150146
$allowQuestionOrdering = true;
151147
$showPagination = api_get_setting('exercise.show_question_pagination');
148+
$length = api_get_setting('exercise.question_pagination_length');
149+
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
150+
152151
if (!empty($showPagination) && $nbrQuestions > $showPagination) {
153-
$length = api_get_setting('exercise.question_pagination_length');
154-
$url = api_get_self().'?'.api_get_cidreq();
155-
// Use pagination for exercise with more than 200 questions.
156152
$allowQuestionOrdering = false;
157153
$start = ($page - 1) * $length;
158-
$questionList = $objExercise->getQuestionForTeacher($start, $length);
159-
$paginator = new Knp\Component\Pager\Paginator();
160-
$pagination = $paginator->paginate([]);
161-
$pagination->setTotalItemCount($nbrQuestions);
162-
$pagination->setItemNumberPerPage($length);
163-
$pagination->setCurrentPageNumber($page);
164-
$pagination->renderer = function ($data) use ($url) {
165-
$render = '<ul class="pagination">';
166-
for ($i = 1; $i <= $data['pageCount']; $i++) {
167-
$pageContent = '<li><a href="'.$url.'&page='.$i.'">'.$i.'</a></li>';
168-
if ($data['current'] == $i) {
169-
$pageContent = '<li class="active"><a href="#" >'.$i.'</a></li>';
170-
}
171-
$render .= $pageContent;
172-
}
173-
$render .= '</ul>';
174-
175-
return $render;
176-
};
177-
echo $pagination;
154+
$questionList = $objExercise->selectQuestionList(true, true);
155+
$questionList = array_slice($questionList, $start, $length);
178156
} else {
179157
// Classic order
180158
$questionList = $objExercise->selectQuestionList(true, true);
@@ -331,7 +309,17 @@
331309
}
332310

333311
echo '</div>'; //question list div
312+
// Pagination navigation
313+
$totalPages = ceil($nbrQuestions / $length);
314+
echo '<div class="pagination flex justify-center mt-4">';
315+
for ($i = 1; $i <= $totalPages; $i++) {
316+
$isActive = ($i == $page) ? 'bg-primary text-white' : 'border-gray-300 text-gray-700 hover:bg-gray-200';
317+
echo '<a href="?'.http_build_query(array_merge($_GET, ['page' => $i])).'" class="mx-1 px-4 py-2 border '.$isActive.' rounded">'.$i.'</a>';
318+
}
319+
echo '</div>';
334320
} else {
335321
echo Display::return_message(get_lang('Questions list (there is no question so far).'), 'warning');
336322
}
323+
} else {
324+
echo Display::return_message(get_lang('Choose question type'), 'warning');
337325
}

src/CoreBundle/Component/Utils/ActionIcon.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,8 @@ enum ActionIcon: string
160160
case EDIT_BADGE = 'shield-edit-outline';
161161

162162
case ADD_EVENT_REMINDER = 'alarm-plus';
163+
164+
case SWAP_FILE = 'file-swap';
165+
166+
case ADD_FILE_VARIATION = 'file-replace';
163167
}

0 commit comments

Comments
 (0)