Fixing bug when showing/hiding the gotocourse button see #4508

skala
Julio Montoya 14 years ago
parent dcc645c5a3
commit 318d0dba1d
  1. 4
      main/inc/lib/auth.lib.php
  2. 25
      main/template/default/auth/courses_categories.php

@ -429,7 +429,6 @@ class Auth
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLE_COURSE_FIELD = Database::get_main_table(TABLE_MAIN_COURSE_FIELD); $TABLE_COURSE_FIELD = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
$TABLE_COURSE_FIELD_VALUE = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES); $TABLE_COURSE_FIELD_VALUE = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
$table_course_ranking = Database::get_main_table(TABLE_STATISTIC_TRACK_COURSE_RANKING);
// get course list auto-register // get course list auto-register
@ -488,9 +487,7 @@ class Auth
if ($row['tutor_name'] == '0') { if ($row['tutor_name'] == '0') {
$row['tutor_name'] = get_lang('NoManager'); $row['tutor_name'] = get_lang('NoManager');
} }
$point_info = CourseManager::get_course_ranking($row['id'], 0); $point_info = CourseManager::get_course_ranking($row['id'], 0);
$courses[] = array( $courses[] = array(
'real_id' => $row['id'], 'real_id' => $row['id'],
'point_info' => $point_info, 'point_info' => $point_info,
@ -504,6 +501,7 @@ class Auth
'unsubscribe' => $row['unsubscribe'], 'unsubscribe' => $row['unsubscribe'],
'registration_code' => $row['registration_code'], 'registration_code' => $row['registration_code'],
'creation_date' => $row['creation_date'], 'creation_date' => $row['creation_date'],
'visibility' => $row['visibility'],
'count_users' => $count_users, 'count_users' => $count_users,
'count_connections' => $count_connections_last_month 'count_connections' => $count_connections_last_month
); );

@ -31,15 +31,13 @@ $stok = Security::get_token();
<?php if (intval($_GET['hidden_links']) != 1) { ?> <?php if (intval($_GET['hidden_links']) != 1) { ?>
<div id="actions" class="actions"> <div class="actions">
<span id="categories-search"> <form class="form-search" method="post" action="<?php echo api_get_self(); ?>?action=subscribe&amp;hidden_links=0">
<form class="course_list" method="post" action="<?php echo api_get_self(); ?>?action=subscribe&amp;hidden_links=0"> <input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>"> <input type="hidden" name="search_course" value="1" />
<input type="hidden" name="search_course" value="1" /> <input type="text" name="search_term" value="<?php echo (empty($_POST['search_term']) ? '' : api_htmlentities(Security::remove_XSS($_POST['search_term']))); ?>" />
<input type="text" name="search_term" value="<?php echo (empty($_POST['search_term']) ? '' : api_htmlentities(Security::remove_XSS($_POST['search_term']))); ?>" /> &nbsp;<button class="search" type="submit"><?php echo get_lang('SearchCourse'); ?></button>
&nbsp;<button class="search" type="submit"><?php echo get_lang('SearchCourse'); ?></button> </form>
</form>
</span>
</div> </div>
<?php <?php
$hidden_links = 0; $hidden_links = 0;
@ -52,11 +50,6 @@ $stok = Security::get_token();
<div class="well"> <div class="well">
<?php <?php
if (!empty($browse_course_categories)) { if (!empty($browse_course_categories)) {
/*if ($action == 'display_random_courses') {
echo '<strong>'.get_lang('RandomPick').'</strong>';
$code = '';
} else {
}*/
echo '<a class="btn" href="'.api_get_self().'?action=display_random_courses">'.get_lang('RandomPick').'</a><br /><br />'; echo '<a class="btn" href="'.api_get_self().'?action=display_random_courses">'.get_lang('RandomPick').'</a><br /><br />';
// level 1 // level 1
@ -110,6 +103,7 @@ $stok = Security::get_token();
?> ?>
</div> </div>
</div> </div>
<div class="span9"> <div class="span9">
<?php <?php
if (!empty($message)) { Display::display_confirmation_message($message, false); } if (!empty($message)) { Display::display_confirmation_message($message, false); }
@ -141,7 +135,6 @@ $stok = Security::get_token();
$rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&amp;course_id='.$course['real_id'], $course['point_info']); $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&amp;course_id='.$course['real_id'], $course['point_info']);
echo '<div class="well_border"><div class="row">'; echo '<div class="well_border"><div class="row">';
echo '<div class="span2">'; echo '<div class="span2">';
echo '<div class="thumbnail">'; echo '<div class="thumbnail">';
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') { if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
@ -159,8 +152,8 @@ $stok = Security::get_token();
echo '<p>'; echo '<p>';
// we display the icon to subscribe or the text already subscribed // we display the icon to subscribe or the text already subscribed
if (!in_array($course['code'], $user_coursecodes)) {
if (!in_array($course['code'], $user_coursecodes) || empty($user_coursecodes)) {
if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM && !api_is_anonymous())) { if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM && !api_is_anonymous())) {
echo '<a class="btn btn-primary" href="'. api_get_course_url($course['code']).'">'.get_lang('GoToCourse').'</a>'; echo '<a class="btn btn-primary" href="'. api_get_course_url($course['code']).'">'.get_lang('GoToCourse').'</a>';
} else { } else {

Loading…
Cancel
Save