diff --git a/main/admin/course_list.php b/main/admin/course_list.php
index 85041076d1..976b52c74b 100755
--- a/main/admin/course_list.php
+++ b/main/admin/course_list.php
@@ -85,17 +85,20 @@ function get_course_data($from, $number_of_items, $column, $direction)
{
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
- $sql = "SELECT code AS col0,
- title AS col1,
- code AS col2,
- course_language AS col3,
- category_code AS col4,
- subscribe AS col5,
- unsubscribe AS col6,
- code AS col7,
- visibility AS col8,
- directory as col9,
- visual_code
+ $sql = "SELECT
+ code AS col0,
+ title AS col1,
+ code AS col2,
+ course_language AS col3,
+ category_code AS col4,
+ subscribe AS col5,
+ unsubscribe AS col6,
+ code AS col7,
+ visibility AS col8,
+ directory as col9,
+ visual_code,
+ directory,
+ course.id
FROM $course_table course";
if ((api_is_platform_admin() || api_is_session_admin()) &&
@@ -146,11 +149,15 @@ function get_course_data($from, $number_of_items, $column, $direction)
$res = Database::query($sql);
$courses = array();
$languages = api_get_languages_to_array();
+
+ $path = api_get_path(WEB_CODE_PATH);
+ $coursePath = api_get_path(WEB_COURSE_PATH);
+
while ($course = Database::fetch_array($res)) {
// Place colour icons in front of courses.
$show_visual_code = $course['visual_code'] != $course[2] ? Display::label($course['visual_code'], 'info') : null;
$course[1] = get_course_visibility_icon($course[8]).
- ''.
+ ''.
Security::remove_XSS($course[1]).
' '.
$show_visual_code
@@ -159,6 +166,22 @@ function get_course_data($from, $number_of_items, $column, $direction)
$course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
$language = isset($languages[$course[3]]) ? $languages[$course[3]] : $course[3];
+ $courseCode = $course[0];
+ $courseId = $course['id'];
+
+ $actions = ''.
+ Display::return_icon('synthese_view.gif', get_lang('Info')).' '.
+ ''.
+ Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '.
+ ''.
+ Display::return_icon('statistics.gif', get_lang('Tracking')).' '.
+ ''.
+ Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).' '.
+ ''.
+ Display::return_icon('backup.gif', get_lang('CreateBackup')).' '.
+ ''.
+ Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'';
+
$courseItem = array(
$course[0],
$course[1],
@@ -167,7 +190,7 @@ function get_course_data($from, $number_of_items, $column, $direction)
$course[4],
$course[5],
$course[6],
- $course[7],
+ $actions
);
$courses[] = $courseItem;
}
@@ -216,50 +239,45 @@ function get_course_data_by_session($from, $number_of_items, $column, $direction
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql);
- $courses = array();
+
+ $courseUrl = api_get_path(WEB_COURSE_PATH);
+ $courses = [];
while ($course = Database::fetch_array($res)) {
// Place colour icons in front of courses.
- $show_visual_code = $course['visual_code'] != $course[2] ? Display::label($course['visual_code'], 'info') : null;
- $course[1] = get_course_visibility_icon($course[8]).''.$course[1].' '.$show_visual_code;
+ $showVisualCode = $course['visual_code'] != $course[2] ? Display::label($course['visual_code'], 'info') : null;
+ $course[1] = get_course_visibility_icon($course[8]).
+ ''.
+ $course[1].
+ ' '.
+ $showVisualCode;
$course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
$course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
- $course_rem = array($course[0], $course[1], $course[2], $course[3], $course[4], $course[5], $course[6], $course[7]);
- $courses[] = $course_rem;
+ $row = [
+ $course[0],
+ $course[1],
+ $course[2],
+ $course[3],
+ $course[4],
+ $course[5],
+ $course[6],
+ $course[7]
+ ];
+ $courses[] = $row;
}
return $courses;
}
-/**
- * Filter to display the edit-buttons
- */
-function modify_courses_filter($code)
-{
- $icourse = api_get_course_info($code);
- $path = api_get_path(WEB_CODE_PATH);
-
- return
- ''.
- Display::return_icon('synthese_view.gif', get_lang('Info')).' '.
- ''.
- Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '.
- ''.
- Display::return_icon('statistics.gif', get_lang('Tracking')).' '.
- ''.
- Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).' '.
- ''.
- Display::return_icon('backup.gif', get_lang('CreateBackup')).' '.
- ''.
- Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'';
-}
-
/**
* Return an icon representing the visibility of the course
+ *
+ * @param string $visibility
+ * @return string
*/
-function get_course_visibility_icon($v)
+function get_course_visibility_icon($visibility)
{
$style = 'margin-bottom:0;margin-right:5px;';
- switch ($v) {
+ switch ($visibility) {
case 0:
return Display::return_icon(
'bullet_red.png',
@@ -372,14 +390,13 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
} else {
$interbreadcrumb[] = array(
'url' => 'index.php',
- "name" => get_lang('PlatformAdmin')
+ 'name' => get_lang('PlatformAdmin')
);
$tool_name = get_lang('CourseList');
if (isset($_GET['delete_course'])) {
CourseManager::delete_course($_GET['delete_course']);
$obj_cat = new Category();
$obj_cat->update_category_delete($_GET['delete_course']);
-
}
// Create a search-box
$form = new FormValidator(
@@ -397,7 +414,9 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
array('id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse'))
);
$form->addButtonSearch(get_lang('SearchCourse'));
- $advanced = ' '.get_lang('AdvancedSearch').'';
+ $advanced = '
+ '.
+ get_lang('AdvancedSearch').'';
// Create a filter by session
$sessionFilter = new FormValidator(
@@ -419,7 +438,11 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
if (!empty($sessionId)) {
$sessionInfo = SessionManager::fetch($sessionId);
- $sessionSelect->addOption($sessionInfo['name'], $sessionInfo['id'], ['selected' => 'selected']);
+ $sessionSelect->addOption(
+ $sessionInfo['name'],
+ $sessionInfo['id'],
+ ['selected' => 'selected']
+ );
}
$courseListUrl = api_get_self();
@@ -490,8 +513,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
);
}
- $parameters = array();
-
+ $parameters = [];
if (isset($_GET['keyword'])) {
$parameters = array('keyword' => Security::remove_XSS($_GET['keyword']));
} elseif (isset($_GET['keyword_code'])) {
@@ -513,7 +535,6 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
$table->set_header(4, get_lang('Category'));
$table->set_header(5, get_lang('SubscriptionAllowed'), true, 'width="60px"');
$table->set_header(6, get_lang('UnsubscriptionAllowed'), false, 'width="50px"');
-
$table->set_header(
7,
get_lang('Action'),
@@ -521,7 +542,6 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
null,
array('class' => 'td_actions')
);
- $table->set_column_filter(7, 'modify_courses_filter');
$table->set_form_actions(
array('delete_courses' => get_lang('DeleteCourse')),
'course'