Adding teacher's name in hot courses and catalog of courses + adding an admin setting to turn off/on the hot courses see #

skala
Julio Montoya 14 years ago
parent 74e8c44b3b
commit 159b7f6e26
  1. 18
      index.php
  2. 851
      main/inc/lib/course.lib.php
  3. 7
      main/install/db_main.sql
  4. 7
      main/install/migrate-db-1.8.8-1.9.0-pre.sql
  5. 98
      main/template/default/auth/courses_categories.php
  6. 35
      main/template/default/layout/hot_courses.tpl

@ -82,9 +82,9 @@ if (api_get_setting('allow_terms_conditions') == 'true') {
}
//If we are not logged in and customapages activated
if (!api_get_user_id() && CustomPages::enabled()) {
if (Request::get('loggedout')) {
if (Request::get('loggedout')) {
CustomPages::display(CustomPages::LOGGED_OUT);
} else {
} else {
CustomPages::display(CustomPages::INDEX_UNLOGGED);
}
}
@ -141,10 +141,10 @@ $controller->set_login_form();
//@todo move this inside the IndexManager
if (!api_is_anonymous()) {
$controller->tpl->assign('profile_block', $controller->return_profile_block());
if (api_is_platform_admin()) {
$controller->tpl->assign('course_block', $controller->return_course_block());
} else {
} else {
$controller->tpl->assign('teacher_block', $controller->return_teacher_link());
}
}
@ -155,12 +155,14 @@ $announcements_block = null;
// When loading a chamilo page do not include the hot courses and news
if (!isset($_REQUEST['include'])) {
$hot_courses = $controller->return_hot_courses();
$announcements_block = $controller->return_announcements();
if (api_get_setting('show_hot_courses') == 'true') {
$hot_courses = $controller->return_hot_courses();
}
$announcements_block = $controller->return_announcements();
}
$controller->tpl->assign('hot_courses', $hot_courses);
$controller->tpl->assign('announcements_block', $announcements_block);
$controller->tpl->assign('hot_courses', $hot_courses);
$controller->tpl->assign('announcements_block', $announcements_block);
$controller->tpl->assign('home_page_block', $controller->return_home_page());
$controller->tpl->assign('notice_block', $controller->return_notice());

File diff suppressed because it is too large Load Diff

@ -868,7 +868,8 @@ VALUES
('platform_unsubscribe_allowed', NULL, 'radio', 'Platform', 'false', 'PlatformUnsubscribeTitle', 'PlatformUnsubscribeComment', NULL, NULL, 1),
('activate_email_template', NULL, 'radio', 'Platform', 'false', 'ActivateEmailTemplateTitle', 'ActivateEmailTemplateComment', NULL, NULL, 0),
('enable_iframe_inclusion', NULL, 'radio', 'Editor', 'false', 'EnableIframeInclusionTitle', 'EnableIframeInclusionComment', NULL, NULL, 1),
('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.18149','DatabaseVersion','', NULL, NULL, 0);
('show_hot_courses', NULL, 'radio', 'Platform', 'true', 'ShowHotCoursesTitle', 'ShowHotCoursesComment', NULL, NULL, 1),
('chamilo_database_version', NULL, 'textfield',NULL, '1.9.0.18163','DatabaseVersion','', NULL, NULL, 0);
/*
@ -1222,7 +1223,9 @@ VALUES
('activate_email_template', 'true', 'Yes'),
('activate_email_template', 'false', 'No'),
('enable_iframe_inclusion', 'true', 'Yes'),
('enable_iframe_inclusion', 'false', 'No');
('enable_iframe_inclusion', 'false', 'No'),
('show_hot_courses', 'true', 'Yes'),
('show_hot_courses', 'false', 'No');
UNLOCK TABLES;

@ -171,6 +171,11 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_iframe_inclusion', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_iframe_inclusion', 'false', 'No');
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_hot_courses', NULL, 'radio', 'Platform', 'true', 'ShowHotCoursesTitle', 'ShowHotCoursesComment', NULL, NULL, 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_hot_courses', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_hot_courses', 'false', 'No');
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_default_weight', NULL, 'textfield', 'Gradebook', '100', 'GradebookDefaultWeightTitle', 'GradebookDefaultWeightComment', NULL, NULL, 1);
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('gradebook_default_grade_model_id', NULL, 'select', 'Gradebook', '', 'GradebookDefaultGradeModelTitle', 'GradebookDefaultGradeModelComment', NULL, NULL, 1);
@ -255,7 +260,7 @@ INSERT INTO settings_options (variable, value, display_text) values ('platform_u
-- Do not move this query
UPDATE settings_current SET selected_value = '1.9.0.18149' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.9.0.18163' WHERE variable = 'chamilo_database_version';
-- xxSTATSxx
ALTER TABLE track_e_exercices ADD COLUMN questions_to_check TEXT NOT NULL DEFAULT '';

@ -10,21 +10,21 @@ $stok = Security::get_token();
?>
<script type="text/javascript">
$(document).ready( function() {
$('.star-rating li a').live('click', function(event) {
var id = $(this).parents('ul').attr('id');
$('#vote_label2_' + id).html("<?php echo get_lang('Loading'); ?>");
$('.star-rating li a').live('click', function(event) {
var id = $(this).parents('ul').attr('id');
$('#vote_label2_' + id).html("<?php echo get_lang('Loading'); ?>");
$.ajax({
url: $(this).attr('data-link'),
success: function(data) {
$("#rating_wrapper_"+id).html(data);
if(data == 'added') {
if(data == 'added') {
//$('#vote_label2_' + id).html("{'Saved'|get_lang}");
}
if(data == 'updated') {
//$('#vote_label2_' + id).html("{'Saved'|get_lang}");
}
}
});
});
});
});
</script>
@ -32,26 +32,26 @@ $stok = Security::get_token();
<?php if (intval($_GET['hidden_links']) != 1) { ?>
<div class="actions">
<form class="form-search" method="post" action="<?php echo api_get_self(); ?>?action=subscribe&amp;hidden_links=0">
<form class="form-search" 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="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']))); ?>" />
&nbsp;<button class="search" type="submit"><?php echo get_lang('SearchCourse'); ?></button>
</form>
</form>
</div>
<?php
<?php
$hidden_links = 0;
} else {
$hidden_links = 1;
}
} else {
$hidden_links = 1;
}
?>
<div class="row">
<div class="span3">
<div class="well">
<?php
if (!empty($browse_course_categories)) {
<?php
if (!empty($browse_course_categories)) {
echo '<a class="btn" href="'.api_get_self().'?action=display_random_courses">'.get_lang('RandomPick').'</a><br /><br />';
// level 1
foreach ($browse_course_categories[0] as $category) {
$category_name = $category['name'];
@ -64,11 +64,11 @@ $stok = Security::get_token();
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.')';
} else {
$category_link = ''.$category_name.' ('.$count_courses_lv1.')';
$category_link = ''.$category_name.' ('.$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) {
@ -82,7 +82,7 @@ $stok = Security::get_token();
}
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) {
@ -99,25 +99,25 @@ $stok = Security::get_token();
}
}
}
}
}
?>
</div>
</div>
<div class="span9">
<?php
if (!empty($message)) { Display::display_confirmation_message($message, false); }
if (!empty($error)) { Display::display_error_message($error, false); }
<?php
if (!empty($message)) { Display::display_confirmation_message($message, false); }
if (!empty($error)) { Display::display_error_message($error, false); }
if (!empty($search_term)) {
echo "<p><strong>".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."</strong><br />";
}
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
if (!empty($browse_courses_in_category)) {
foreach ($browse_courses_in_category as $course) {
foreach ($browse_courses_in_category as $course) {
// if course is closed, don't show it.
if ($course['visibility'] == COURSE_VISIBILITY_CLOSED) {
continue;
@ -125,57 +125,59 @@ $stok = Security::get_token();
// course isn't closed
$title = cut($course['title'], 70);
$tutor_name = $course['tutor'];
$creation_date = substr($course['creation_date'],0,10);
$count_connections = $course['count_connections'];
$course_path = api_get_path(SYS_COURSE_PATH).$course['directory']; // course path
if (file_exists($course_path.'/course-pic85x85.png')) {
if (file_exists($course_path.'/course-pic85x85.png')) {
$course_medium_image = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic85x85.png'; // redimensioned image 85x85
} else {
$course_medium_image = api_get_path(WEB_IMG_PATH).'without_picture.png'; // without picture
}
$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="thumbnail">';
echo '<div class="thumbnail">';
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
echo '<a class="ajax" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&amp;code='.$course['code'].'" title="'.$icon_title.'" rel="gb_page_center[778]">';
echo '<a class="ajax" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&amp;code='.$course['code'].'" title="'.$icon_title.'" rel="gb_page_center[778]">';
echo '<img src="'.$course_medium_image.'" />';
echo '</a>';
} else {
echo '<img src="'.$course_medium_image.'" />';
}
}
echo '</div>';//thumb
echo '</div>';
echo '<div class="span4">';
echo '<div class="categories-course-description"><h3>'.cut($title, 60).'</h3>'.$rating.'</div>';
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
$teachers = '<h5>'.$teachers.'</h5>';
echo '<div class="categories-course-description"><h3>'.cut($title, 60).'</h3>'.$teachers.$rating.'</div>';
echo '<p>';
// we display the icon to subscribe or the text already subscribed
echo '<div class="btn-toolbar">';
echo '<div class="btn-toolbar">';
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
echo '<a class="ajax btn" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&amp;code='.$course['code'].'" title="'.$icon_title.'" class="thickbox">'.get_lang('Description').'</a>';
}
// Go To Course button
if (!api_is_anonymous()
if (!api_is_anonymous()
&& ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)) {
echo ' <a class="btn btn-primary" href="'. api_get_course_url($course['code']).'">'.get_lang('GoToCourse').'</a>';
}
// Subscribe button
if (!api_is_anonymous()
&& ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)
&& $course['subscribe'] == SUBSCRIBE_ALLOWED
if (!api_is_anonymous()
&& ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)
&& $course['subscribe'] == SUBSCRIBE_ALLOWED
&& (!in_array($course['code'], $user_coursecodes) || empty($user_coursecodes))) {
echo ' <a class="btn btn-primary" href="'. api_get_self().'?action=subscribe_course&amp;sec_token='.$stok.'&amp;subscribe_course='.$course['code'].'&amp;search_term='.$search_term.'&amp;category_code='.$code.'">'.get_lang('Subscribe').'</a>';
}
// If user is already subscribed to the course
if (!api_is_anonymous() && in_array($course['code'], $user_coursecodes)) {
echo '<br />';
@ -183,11 +185,11 @@ $stok = Security::get_token();
echo Display::label(get_lang("AlreadyRegisteredToCourse"), "info");
}
echo '</div>';
echo '</p>';
echo '</div>';
echo '</div>';
echo '<div class="span2">';
echo '<div class="span2">';
echo '<div class="course-block-popularity"><span>'.get_lang('ConnectionsLastMonth').'</span><div class="course-block-popularity-score">'.$count_connections.'</div></div>';
echo '</div>';
echo '</div></div>';
@ -195,6 +197,6 @@ $stok = Security::get_token();
} else {
echo Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
}
?>
?>
</div>
</div>

@ -1,48 +1,49 @@
{% if hot_courses is not null and hot_courses is not empty %}
{% if hot_courses is not null and hot_courses is not empty %}
<script type="text/javascript">
$(document).ready( function() {
$('.star-rating li a').live('click', function(event) {
var id = $(this).parents('ul').attr('id');
$('#vote_label2_' + id).html("{{'Loading'|get_lang}}");
$('.star-rating li a').live('click', function(event) {
var id = $(this).parents('ul').attr('id');
$('#vote_label2_' + id).html("{{'Loading'|get_lang}}");
$.ajax({
url: $(this).attr('data-link'),
success: function(data) {
$("#rating_wrapper_"+id).html(data);
if(data == 'added') {
if(data == 'added') {
//$('#vote_label2_' + id).html("{{'Saved'|get_lang}}");
}
if(data == 'updated') {
//$('#vote_label2_' + id).html("{{'Saved'|get_lang}}");
}
}
});
});
});
});
</script>
<section id="hot_courses">
<div class="row">
<div class="row">
<div class="span9">
{{"HottestCourses"|display_page_header}}
{{"HottestCourses"|display_page_header}}
</div>
{% for hot_course in hot_courses %}
<div class="span9">
<div class="well_border">
<div class="well_border">
<div class="row">
<div class="span2">
<div class="span2">
<div class="thumbnail">
<img src="{{ hot_course.extra_info.course_image }}" />
{# html_image file=$hot_course.extra_info.course_image #}
</div>
</div>
</div>
<div class="span6">
<div class="categories-course-description">
<h3>{{ hot_course.extra_info.name }}</h3>
<h5>{{ hot_course.extra_info.teachers }}</h5>
{{ hot_course.extra_info.rating_html }}
</div>
</div>
<p>
{# World #}
{% if hot_course.extra_info.visibility == 3 or (hot_course.extra_info.visibility == 2 and _u.logged == 1 ) %}
@ -52,16 +53,16 @@ $(document).ready( function() {
{% endif %}
{# Description #}
{% if hot_course.extra_info.visibility == 3 %}
{% if hot_course.extra_info.visibility == 3 %}
<a class="ajax btn" title="" href="{{ _p.web_ajax}}course_home.ajax.php?a=show_course_information&code={{hot_course.course_code}}">
{{"Description"|get_lang}}
</a>
{% endif %}
</p>
{% endif %}
</p>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</section>

Loading…
Cancel
Save