Minor - format code

pull/2858/head
Julio Montoya 7 years ago
parent ea9730827b
commit 3be1a491ff
  1. 12
      main/admin/course_category.php
  2. 20
      main/auth/courses_controller.php

@ -76,7 +76,7 @@ if (!empty($action)) {
$tool_name = get_lang('AdminCategories'); $tool_name = get_lang('AdminCategories');
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => 'index.php', 'url' => 'index.php',
"name" => get_lang('PlatformAdmin'), 'name' => get_lang('PlatformAdmin'),
]; ];
Display::display_header($tool_name); Display::display_header($tool_name);
@ -85,7 +85,7 @@ $urlId = api_get_current_access_url_id();
if ($action == 'add' || $action == 'edit') { if ($action == 'add' || $action == 'edit') {
echo '<div class="actions">'; echo '<div class="actions">';
echo Display::url( echo Display::url(
Display::return_icon('folder_up.png', get_lang("Back"), '', ICON_SIZE_MEDIUM), Display::return_icon('folder_up.png', get_lang('Back'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'admin/course_category.php?category='.Security::remove_XSS($category) api_get_path(WEB_CODE_PATH).'admin/course_category.php?category='.Security::remove_XSS($category)
); );
echo '</div>'; echo '</div>';
@ -118,7 +118,7 @@ if ($action == 'add' || $action == 'edit') {
$form->createElement( $form->createElement(
'radio', 'radio',
'auth_course_child', 'auth_course_child',
get_lang("AllowCoursesInCategory"), get_lang('AllowCoursesInCategory'),
get_lang('Yes'), get_lang('Yes'),
'TRUE' 'TRUE'
), ),
@ -130,7 +130,7 @@ if ($action == 'add' || $action == 'edit') {
'FALSE' 'FALSE'
), ),
]; ];
$form->addGroup($group, null, get_lang("AllowCoursesInCategory")); $form->addGroup($group, null, get_lang('AllowCoursesInCategory'));
if ($myCourseListAsCategory) { if ($myCourseListAsCategory) {
$form->addHtmlEditor( $form->addHtmlEditor(
@ -156,12 +156,12 @@ if ($action == 'add' || $action == 'edit') {
} }
if (!empty($categoryInfo)) { if (!empty($categoryInfo)) {
$class = "save"; $class = 'save';
$text = get_lang('Save'); $text = get_lang('Save');
$form->setDefaults($categoryInfo); $form->setDefaults($categoryInfo);
$form->addButtonSave($text); $form->addButtonSave($text);
} else { } else {
$class = "add"; $class = 'add';
$text = get_lang('AddCategory'); $text = get_lang('AddCategory');
$form->setDefaults(['auth_course_child' => 'TRUE']); $form->setDefaults(['auth_course_child' => 'TRUE']);
$form->addButtonCreate($text); $form->addButtonCreate($text);

@ -108,32 +108,23 @@ class CoursesController
$limit = [] $limit = []
) { ) {
$data = []; $data = [];
//$browse_course_categories = CoursesAndSessionsCatalog::getCourseCategories();
$listCategories = CoursesAndSessionsCatalog::getCourseCategoriesTree(); $listCategories = CoursesAndSessionsCatalog::getCourseCategoriesTree();
$data['countCoursesInCategory'] = CourseCategory::countCoursesInCategory($category_code); $data['countCoursesInCategory'] = CourseCategory::countCoursesInCategory($category_code);
if ($action === 'display_random_courses') { if ($action === 'display_random_courses') {
// Random value is used instead limit filter // Random value is used instead limit filter
$data['browse_courses_in_category'] = CoursesAndSessionsCatalog::getCoursesInCategory( $data['browse_courses_in_category'] = CoursesAndSessionsCatalog::getCoursesInCategory(null, 12);
null,
12
);
$data['countCoursesInCategory'] = count($data['browse_courses_in_category']); $data['countCoursesInCategory'] = count($data['browse_courses_in_category']);
} else { } else {
if (!isset($category_code)) { if (!isset($category_code)) {
$category_code = $listCategories['ALL']['code']; // by default first category $category_code = $listCategories['ALL']['code']; // by default first category
} }
$limit = isset($limit) ? $limit : self::getLimitArray(); $limit = isset($limit) ? $limit : self::getLimitArray();
$listCourses = CoursesAndSessionsCatalog::getCoursesInCategory( $listCourses = CoursesAndSessionsCatalog::getCoursesInCategory($category_code, null, $limit);
$category_code,
null,
$limit
);
$data['browse_courses_in_category'] = $listCourses; $data['browse_courses_in_category'] = $listCourses;
} }
//$data['browse_course_categories'] = $browse_course_categories;
$data['list_categories'] = $listCategories; $data['list_categories'] = $listCategories;
$data['code'] = Security::remove_XSS($category_code); $data['code'] = Security::remove_XSS($category_code);
@ -193,10 +184,7 @@ class CoursesController
$data = []; $data = [];
$limit = !empty($limit) ? $limit : self::getLimitArray(); $limit = !empty($limit) ? $limit : self::getLimitArray();
$browse_course_categories = CoursesAndSessionsCatalog::getCourseCategories(); $browse_course_categories = CoursesAndSessionsCatalog::getCourseCategories();
$data['countCoursesInCategory'] = CourseCategory::countCoursesInCategory( $data['countCoursesInCategory'] = CourseCategory::countCoursesInCategory('ALL', $search_term);
'ALL',
$search_term
);
$data['browse_courses_in_category'] = CoursesAndSessionsCatalog::search_courses( $data['browse_courses_in_category'] = CoursesAndSessionsCatalog::search_courses(
$search_term, $search_term,
$limit, $limit,

Loading…
Cancel
Save