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');
$interbreadcrumb[] = [
'url' => 'index.php',
"name" => get_lang('PlatformAdmin'),
'name' => get_lang('PlatformAdmin'),
];
Display::display_header($tool_name);
@ -85,7 +85,7 @@ $urlId = api_get_current_access_url_id();
if ($action == 'add' || $action == 'edit') {
echo '<div class="actions">';
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)
);
echo '</div>';
@ -118,7 +118,7 @@ if ($action == 'add' || $action == 'edit') {
$form->createElement(
'radio',
'auth_course_child',
get_lang("AllowCoursesInCategory"),
get_lang('AllowCoursesInCategory'),
get_lang('Yes'),
'TRUE'
),
@ -130,7 +130,7 @@ if ($action == 'add' || $action == 'edit') {
'FALSE'
),
];
$form->addGroup($group, null, get_lang("AllowCoursesInCategory"));
$form->addGroup($group, null, get_lang('AllowCoursesInCategory'));
if ($myCourseListAsCategory) {
$form->addHtmlEditor(
@ -156,12 +156,12 @@ if ($action == 'add' || $action == 'edit') {
}
if (!empty($categoryInfo)) {
$class = "save";
$class = 'save';
$text = get_lang('Save');
$form->setDefaults($categoryInfo);
$form->addButtonSave($text);
} else {
$class = "add";
$class = 'add';
$text = get_lang('AddCategory');
$form->setDefaults(['auth_course_child' => 'TRUE']);
$form->addButtonCreate($text);

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

Loading…
Cancel
Save