Setting course catalog random by default

skala
Julio Montoya 14 years ago
parent f5703f65bc
commit 3661e17003
  1. 4
      main/auth/courses.php
  2. 6
      main/css/base.css
  3. 98
      main/template/default/auth/courses_categories.php

@ -65,7 +65,7 @@ if (!(api_is_platform_admin() || api_is_course_admin() || api_is_allowed_to_crea
// filter actions // filter actions
$actions = array('sortmycourses', 'createcoursecategory', 'subscribe', 'deletecoursecategory', 'unsubscribe', 'display_courses','display_random_courses'); $actions = array('sortmycourses', 'createcoursecategory', 'subscribe', 'deletecoursecategory', 'unsubscribe', 'display_courses','display_random_courses');
$action = 'subscribe'; $action = 'display_random_courses';
$nameTools = get_lang('SortMyCourses'); $nameTools = get_lang('SortMyCourses');
if (isset($_GET['action']) && in_array($_GET['action'],$actions)) { if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
@ -85,7 +85,7 @@ if (empty($nameTools)) {
$nameTools = get_lang('CourseManagement'); $nameTools = get_lang('CourseManagement');
} else { } else {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'auth/courses.php', 'name' => get_lang('CourseManagement')); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'auth/courses.php', 'name' => get_lang('CourseManagement'));
$interbreadcrumb[] = array('url' => '#', 'name' => $nameTools); $interbreadcrumb[] = array('url' => '#', 'name' => $nameTools);
} }

@ -809,9 +809,9 @@ button:hover {
margin-top:5px; margin-top:5px;
} }
.course-block-main-item { .course-block-main-item {
height: 32px; height: 45px;
padding: 3px 0px 3px 0px; padding: 5px 0px;
} }
.categories-block-course { .categories-block-course {

@ -8,10 +8,9 @@
*/ */
$stok = Security::get_token(); $stok = Security::get_token();
?> // Actions: The menu with the different options in cathe course management
<!-- Actions: The menu with the different options in cathe course management -->
<?php if(intval($_GET['hidden_links']) != 1) { ?> if (intval($_GET['hidden_links']) != 1) { ?>
<div id="actions" class="actions"> <div id="actions" class="actions">
<?php if ($action != 'subscribe') { ?> <?php if ($action != 'subscribe') { ?>
@ -32,69 +31,68 @@ $stok = Security::get_token();
</form> </form>
</span> </span>
</div> </div>
<?php <?php
$hidden_links = 0; $hidden_links = 0;
} else { } else {
$hidden_links = 1; $hidden_links = 1;
} ?> }
?>
<div id="categories-content" > <div id="categories-content" >
<div id="categories-content-first"> <div id="categories-content-first">
<div id="categories-list"> <div id="categories-list">
<?php
<?php if (!empty($browse_course_categories)) { if (!empty($browse_course_categories)) {
if ($_GET['action'] == 'display_random_courses') { if ($action == 'display_random_courses') {
echo '<strong>'.get_lang('RandomPick').'</strong>'; echo '<strong>'.get_lang('RandomPick').'</strong>';
$code = ''; $code = '';
} else {
echo '<a href="'.api_get_self().'?action=display_random_courses">'.get_lang('RandomPick').'</a>';
}
// level 1
foreach ($browse_course_categories[0] as $category) {
$category_name = $category['name'];
$category_code = $category['code'];
$count_courses_lv1 = $category['count_courses'];
if ($code == $category_code) {
$category_link = '<strong>'.$category_name.' ('.$count_courses_lv1.')</strong>';
} else { } else {
echo '<a href="'.api_get_self().'?action=display_random_courses">'.get_lang('RandomPick').'</a>'; if (!empty($count_courses_lv1)) {
} $category_link = '<a href="'. api_get_self().'?action=display_courses&amp;category_code='.$category_code.'&amp;hidden_links='.$hidden_links.'">'.$category_name.'</a> ('.$count_courses_lv1.')';
// level 1
foreach ($browse_course_categories[0] as $category) {
$category_name = $category['name'];
$category_code = $category['code'];
$count_courses_lv1 = $category['count_courses'];
if ($code == $category_code) {
$category_link = '<strong>'.$category_name.' ('.$count_courses_lv1.')</strong>';
} else { } else {
if (!empty($count_courses_lv1)) { $category_link = '<a href="#">'.$category_name.' ('.$count_courses_lv1.')</a>';
$category_link = '<a href="'. api_get_self().'?action=display_courses&amp;category_code='.$category_code.'&amp;hidden_links='.$hidden_links.'">'.$category_name.'</a> ('.$count_courses_lv1.')'; }
}
echo '<div>'.$category_link.'</div>';
// level 2
if (!empty($browse_course_categories[$category_code])) {
foreach ($browse_course_categories[$category_code] as $subcategory1) {
$subcategory1_name = $subcategory1['name'];
$subcategory1_code = $subcategory1['code'];
$count_courses_lv2 = $subcategory1['count_courses'];
if ($code == $subcategory1_code) {
$subcategory1_link = '<strong>'.$subcategory1_name.' ('.$count_courses_lv2.')</strong>';
} else { } else {
$category_link = '<a href="#">'.$category_name.' ('.$count_courses_lv1.')</a>'; $subcategory1_link = '<a href="'. api_get_self().'?action=display_courses&amp;category_code='.$subcategory1_code.'&amp;hidden_links='.$hidden_links.'">'.$subcategory1_name.'</a> ('.$count_courses_lv2.')';
} }
} echo '<div style="margin-left:20px;">'.$subcategory1_link.'</div>';
echo '<div>'.$category_link.'</div>'; }
// level 2 // level 3
if (!empty($browse_course_categories[$category_code])) { if (!empty($browse_course_categories[$subcategory1_code])) {
foreach ($browse_course_categories[$category_code] as $subcategory1) { foreach ($browse_course_categories[$subcategory1_code] as $subcategory2) {
$subcategory1_name = $subcategory1['name']; $subcategory2_name = $subcategory2['name'];
$subcategory1_code = $subcategory1['code']; $subcategory2_code = $subcategory2['code'];
$count_courses_lv2 = $subcategory1['count_courses']; $count_courses_lv3 = $subcategory2['count_courses'];
if ($code == $subcategory1_code) { if ($code == $subcategory2_code) {
$subcategory1_link = '<strong>'.$subcategory1_name.' ('.$count_courses_lv2.')</strong>'; $subcategory2_link = '<strong>'.$subcategory2_name.' ('.$count_courses_lv3.')</strong>';
} else { } else {
$subcategory1_link = '<a href="'. api_get_self().'?action=display_courses&amp;category_code='.$subcategory1_code.'&amp;hidden_links='.$hidden_links.'">'.$subcategory1_name.'</a> ('.$count_courses_lv2.')'; $subcategory2_link = '<a href="'. api_get_self().'?action=display_courses&amp;category_code='.$subcategory2_code.'&amp;hidden_links='.$hidden_links.'">'.$subcategory2_name.'</a> ('.$count_courses_lv3.')';
}
echo '<div style="margin-left:20px;">'.$subcategory1_link.'</div>';
}
// level 3
if (!empty($browse_course_categories[$subcategory1_code])) {
foreach ($browse_course_categories[$subcategory1_code] as $subcategory2) {
$subcategory2_name = $subcategory2['name'];
$subcategory2_code = $subcategory2['code'];
$count_courses_lv3 = $subcategory2['count_courses'];
if ($code == $subcategory2_code) {
$subcategory2_link = '<strong>'.$subcategory2_name.' ('.$count_courses_lv3.')</strong>';
} else {
$subcategory2_link = '<a href="'. api_get_self().'?action=display_courses&amp;category_code='.$subcategory2_code.'&amp;hidden_links='.$hidden_links.'">'.$subcategory2_name.'</a> ('.$count_courses_lv3.')';
}
echo '<div style="margin-left:40px;">'.$subcategory2_link.'</div>';
} }
echo '<div style="margin-left:40px;">'.$subcategory2_link.'</div>';
} }
} }
} }
}
} }
?> ?>
</div> </div>

Loading…
Cancel
Save