|
@@ -106,24 +106,21 @@ $code = isset($code) ? $code : null;
|
|
|
</script>
|
|
|
|
|
|
<div class="row">
|
|
|
- <div class="col-md-3">
|
|
|
- <div class="panel panel-default">
|
|
|
- <div class="panel-heading"><?php echo get_lang('Search'); ?></div>
|
|
|
- <div class="panel-body">
|
|
|
- <?php if ($showCourses) { ?>
|
|
|
- <?php if (!isset($_GET['hidden_links']) || intval($_GET['hidden_links']) != 1) { ?>
|
|
|
- <form class="form-search" method="post" action="<?php echo getCourseCategoryUrl(1, $pageLength, 'ALL', 0, 'subscribe'); ?>">
|
|
|
- <fieldset>
|
|
|
- <input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
|
|
|
- <input type="hidden" name="search_course" value="1" />
|
|
|
- <div class="control-group">
|
|
|
- <div class="controls">
|
|
|
- <div class="input-append">
|
|
|
- <input type="text" name="search_term" value="<?php echo (empty($_POST['search_term']) ? '' : api_htmlentities(Security::remove_XSS($_POST['search_term']))); ?>" />
|
|
|
- <div class="btn-group">
|
|
|
- <button class="btn btn-default btn-sm" type="submit">
|
|
|
- <i class="fa fa-search"></i> <?php echo get_lang('Search'); ?>
|
|
|
- </button>
|
|
|
+ <div class="col-md-6">
|
|
|
+ <h2><?php echo get_lang('Search'); ?></h2>
|
|
|
+ <?php if ($showCourses) { ?>
|
|
|
+ <?php if (!isset($_GET['hidden_links']) || intval($_GET['hidden_links']) != 1) { ?>
|
|
|
+ <form class="form-search" method="post" action="<?php echo getCourseCategoryUrl(1, $pageLength, 'ALL', 0, 'subscribe'); ?>">
|
|
|
+ <input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
|
|
|
+ <input type="hidden" name="search_course" value="1" />
|
|
|
+ <div class="control-group">
|
|
|
+ <div class="controls">
|
|
|
+ <div class="input-append">
|
|
|
+ <input type="text" name="search_term" value="<?php echo (empty($_POST['search_term']) ? '' : api_htmlentities(Security::remove_XSS($_POST['search_term']))); ?>" />
|
|
|
+ <div class="btn-group">
|
|
|
+ <button class="btn btn-default btn-sm" type="submit">
|
|
|
+ <i class="fa fa-search"></i> <?php echo get_lang('Search'); ?>
|
|
|
+ </button>
|
|
|
<?php
|
|
|
$hidden_links = 0;
|
|
|
} else {
|
|
@@ -137,14 +134,122 @@ $code = isset($code) ? $code : null;
|
|
|
if (!empty($browse_course_categories)) {
|
|
|
echo '<a class="btn btn-default btn-sm" href="'.api_get_self().'?action=display_random_courses">'.get_lang('RandomPick').'</a>';
|
|
|
?>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </fieldset>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <div class="col-md-6"></div>
|
|
|
+</div>
|
|
|
+<div class="row">
|
|
|
+ <?php if ($showCourses && $action != 'display_sessions') {
|
|
|
+
|
|
|
+
|
|
|
+ if (!empty($message)) {
|
|
|
+ Display::display_confirmation_message($message, false);
|
|
|
+ }
|
|
|
+ if (!empty($error)) {
|
|
|
+ Display::display_error_message($error, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($content)) {
|
|
|
+ echo $content;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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';
|
|
|
+ $user_id = api_get_user_id();
|
|
|
+
|
|
|
+ if (!empty($browse_courses_in_category)) {
|
|
|
+ foreach ($browse_courses_in_category as $course) {
|
|
|
+ $course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN);
|
|
|
+
|
|
|
+ if ($course_hidden) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ $user_registerd_in_course = CourseManager::is_user_subscribed_in_course($user_id, $course['code']);
|
|
|
+ $user_registerd_in_course_as_teacher = CourseManager::is_course_teacher($user_id, $course['code']);
|
|
|
+ $user_registerd_in_course_as_student = ($user_registerd_in_course && !$user_registerd_in_course_as_teacher);
|
|
|
+ $course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD);
|
|
|
+ $course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM);
|
|
|
+ $course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED);
|
|
|
+ $course_closed = ($course['visibility'] == COURSE_VISIBILITY_CLOSED);
|
|
|
+ $course_subscribe_allowed = ($course['subscribe'] == 1);
|
|
|
+ $course_unsubscribe_allowed = ($course['unsubscribe'] == 1);
|
|
|
+ $count_connections = $course['count_connections'];
|
|
|
+ $creation_date = substr($course['creation_date'],0,10);
|
|
|
+
|
|
|
+ $icon_title = null;
|
|
|
+ $html = null;
|
|
|
+ // display the course bloc
|
|
|
+ $html .= '<div class="col-md-3"><div class="items-course">';
|
|
|
+
|
|
|
+ // display thumbnail
|
|
|
+ $html .= return_thumbnail($course, $icon_title);
|
|
|
+
|
|
|
+ // display course title and button bloc
|
|
|
+ $html .= '<div class="items-course-info">';
|
|
|
+ $html .= return_title($course);
|
|
|
+ // display button line
|
|
|
+ $html .= '<div class="btn-toolbar">';
|
|
|
+ // if user registered as student
|
|
|
+ if ($user_registerd_in_course_as_student) {
|
|
|
+ if (!$course_closed) {
|
|
|
+ //$html .= return_goto_button($course);
|
|
|
+ $html .= return_description_button($course, $icon_title);
|
|
|
+ if ($course_unsubscribe_allowed) {
|
|
|
+ $html .= return_unregister_button($course, $stok, $search_term, $code);
|
|
|
+ }
|
|
|
+ $html .= return_already_registered_label('student');
|
|
|
+ }
|
|
|
+ } elseif ($user_registerd_in_course_as_teacher) {
|
|
|
+ // if user registered as teacher
|
|
|
+ //$html .= return_goto_button($course);
|
|
|
+ $html .= return_description_button($course, $icon_title);
|
|
|
+ if ($course_unsubscribe_allowed) {
|
|
|
+ $html .= return_unregister_button($course, $stok, $search_term, $code);
|
|
|
+ }
|
|
|
+ $html .= return_already_registered_label('teacher');
|
|
|
+ } else {
|
|
|
+ // if user not registered in the course
|
|
|
+ if (!$course_closed) {
|
|
|
+ if (!$course_private) {
|
|
|
+ $html .= return_goto_button($course);
|
|
|
+ if ($course_subscribe_allowed) {
|
|
|
+ $html .= return_register_button($course, $stok, $code, $search_term);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $html .= return_description_button($course, $icon_title);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $html .= '</div>';
|
|
|
+ $html .= '</div>';
|
|
|
+ $html .= '</div>';
|
|
|
+ $html .= '</div>';
|
|
|
+ echo $html;
|
|
|
+
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!isset($_REQUEST['subscribe_user_with_password']) &&
|
|
|
+ !isset($_REQUEST['subscribe_course'])
|
|
|
+ ) {
|
|
|
+ Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ echo $cataloguePagination;
|
|
|
+?>
|
|
|
+</div>
|
|
|
+
|
|
|
+
|
|
|
+<div class="row">
|
|
|
+ <div class="col-md-3">
|
|
|
<div class="panel panel-default">
|
|
|
<div class="panel-heading">
|
|
|
<?php
|
|
@@ -277,116 +382,7 @@ $code = isset($code) ? $code : null;
|
|
|
<?php } ?>
|
|
|
</div>
|
|
|
|
|
|
- <div class="col-md-9">
|
|
|
- <h2><?php echo get_lang('CourseCatalog')?></h2>
|
|
|
-
|
|
|
- <?php if ($showCourses && $action != 'display_sessions') { ?>
|
|
|
- <?php
|
|
|
-
|
|
|
- if (!empty($message)) {
|
|
|
- Display::display_confirmation_message($message, false);
|
|
|
- }
|
|
|
- if (!empty($error)) {
|
|
|
- Display::display_error_message($error, false);
|
|
|
- }
|
|
|
-
|
|
|
- if (!empty($content)) {
|
|
|
- echo $content;
|
|
|
- }
|
|
|
-
|
|
|
- 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';
|
|
|
- $user_id = api_get_user_id();
|
|
|
-
|
|
|
- if (!empty($browse_courses_in_category)) {
|
|
|
- foreach ($browse_courses_in_category as $course) {
|
|
|
- $course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN);
|
|
|
-
|
|
|
- if ($course_hidden) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- $user_registerd_in_course = CourseManager::is_user_subscribed_in_course($user_id, $course['code']);
|
|
|
- $user_registerd_in_course_as_teacher = CourseManager::is_course_teacher($user_id, $course['code']);
|
|
|
- $user_registerd_in_course_as_student = ($user_registerd_in_course && !$user_registerd_in_course_as_teacher);
|
|
|
- $course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD);
|
|
|
- $course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM);
|
|
|
- $course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED);
|
|
|
- $course_closed = ($course['visibility'] == COURSE_VISIBILITY_CLOSED);
|
|
|
- $course_subscribe_allowed = ($course['subscribe'] == 1);
|
|
|
- $course_unsubscribe_allowed = ($course['unsubscribe'] == 1);
|
|
|
- $count_connections = $course['count_connections'];
|
|
|
- $creation_date = substr($course['creation_date'],0,10);
|
|
|
-
|
|
|
- $icon_title = null;
|
|
|
-
|
|
|
- // display the course bloc
|
|
|
- echo '<div class="well_border"><div class="row">';
|
|
|
-
|
|
|
- // display thumbnail
|
|
|
- display_thumbnail($course, $icon_title);
|
|
|
-
|
|
|
- // display course title and button bloc
|
|
|
- echo '<div class="col-md-8">';
|
|
|
- display_title($course);
|
|
|
- // display button line
|
|
|
- echo '<div class="btn-toolbar">';
|
|
|
- // if user registered as student
|
|
|
- if ($user_registerd_in_course_as_student) {
|
|
|
- if (!$course_closed) {
|
|
|
- display_goto_button($course);
|
|
|
- display_description_button($course, $icon_title);
|
|
|
- if ($course_unsubscribe_allowed) {
|
|
|
- display_unregister_button($course, $stok, $search_term, $code);
|
|
|
- }
|
|
|
- display_already_registered_label('student');
|
|
|
- }
|
|
|
- } elseif ($user_registerd_in_course_as_teacher) {
|
|
|
- // if user registered as teacher
|
|
|
- display_goto_button($course);
|
|
|
- display_description_button($course, $icon_title);
|
|
|
- if ($course_unsubscribe_allowed) {
|
|
|
- display_unregister_button($course, $stok, $search_term, $code);
|
|
|
- }
|
|
|
- display_already_registered_label('teacher');
|
|
|
- } else {
|
|
|
- // if user not registered in the course
|
|
|
- if (!$course_closed) {
|
|
|
- if (!$course_private) {
|
|
|
- display_goto_button($course);
|
|
|
- if ($course_subscribe_allowed) {
|
|
|
- display_register_button($course, $stok, $code, $search_term);
|
|
|
- }
|
|
|
- }
|
|
|
- display_description_button($course, $icon_title);
|
|
|
- }
|
|
|
- }
|
|
|
- echo '</div>'; // btn-toolbar
|
|
|
- echo '</div>'; // span4
|
|
|
-
|
|
|
- // display counter
|
|
|
- echo '<div class="col-md-2">';
|
|
|
- echo '<div class="course-block-popularity"><span>'.get_lang('ConnectionsLastMonth').'</span><div class="course-block-popularity-score">'.$count_connections.'</div></div>';
|
|
|
- echo '</div>';
|
|
|
-
|
|
|
- // end of course bloc
|
|
|
- echo '</div></div>'; // well_border row
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (!isset($_REQUEST['subscribe_user_with_password']) &&
|
|
|
- !isset($_REQUEST['subscribe_course'])
|
|
|
- ) {
|
|
|
- Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
|
|
|
- }
|
|
|
- } ?>
|
|
|
- <?php } ?>
|
|
|
- <?php
|
|
|
- echo $cataloguePagination;
|
|
|
- ?>
|
|
|
- </div>
|
|
|
+
|
|
|
</div>
|
|
|
<?php
|
|
|
|
|
@@ -395,49 +391,48 @@ $code = isset($code) ? $code : null;
|
|
|
* @param $course
|
|
|
* @param $icon_title
|
|
|
*/
|
|
|
-function display_thumbnail($course, $icon_title)
|
|
|
+function return_thumbnail($course, $icon_title)
|
|
|
{
|
|
|
+ $html = '';
|
|
|
$title = cut($course['title'], 70);
|
|
|
// course path
|
|
|
$course_path = api_get_path(SYS_COURSE_PATH).$course['directory'];
|
|
|
-
|
|
|
- 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
|
|
|
+
|
|
|
+ if (file_exists($course_path.'/course-pic.png')) {
|
|
|
+ $course_medium_image = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic.png'; // redimensioned image 85x85
|
|
|
} else {
|
|
|
- $course_medium_image = Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true); // without picture
|
|
|
+ $course_medium_image = api_get_path(WEB_IMG_PATH).'session_default.png'; // without picture
|
|
|
}
|
|
|
|
|
|
// course image
|
|
|
- echo '<div class="col-md-2">';
|
|
|
- echo '<div class="thumbnail">';
|
|
|
+
|
|
|
+ $html .= '<div class="items-course-image">';
|
|
|
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&code='.$course['code'].'" data-title="'.$icon_title.'" title="'.$icon_title.'" rel="gb_page_center[778]">';
|
|
|
- echo '<img src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'" />';
|
|
|
- echo '</a>';
|
|
|
+ $html .= '<a class="ajax" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="'.$icon_title.'" rel="gb_page_center[778]">';
|
|
|
+ $html .= '<img class="img-responsive" src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'" />';
|
|
|
+ $html .= '</a>';
|
|
|
} else {
|
|
|
- echo '<img src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'"/>';
|
|
|
+ $html .= '<img class="img-responsive" src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'"/>';
|
|
|
}
|
|
|
- echo '</div>'; // thumbail
|
|
|
- echo '</div>'; // span2
|
|
|
+ $html .= '</div>'; // thumbail
|
|
|
+ return $html;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Display the title of a course in course catalog
|
|
|
* @param $course
|
|
|
*/
|
|
|
-function display_title($course)
|
|
|
-{
|
|
|
+function return_title($course)
|
|
|
+{ $html = '';
|
|
|
+ $linkCourse = api_get_course_url($course['code']);
|
|
|
$title = cut($course['title'], 70);
|
|
|
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
|
|
|
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
|
|
|
- $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']);
|
|
|
-
|
|
|
- $teachers = '<h5>'.$teachers.'</h5>';
|
|
|
- echo '<div class="categories-course-description">';
|
|
|
- echo '<h3>'.cut($title, 60).'</h3>';
|
|
|
- echo $teachers;
|
|
|
- echo $rating;
|
|
|
- echo '</div>'; // categories-course-description
|
|
|
+ $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']);
|
|
|
+ $html .= '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>';
|
|
|
+ $html .= '<div class="teachers">'.$teachers.'</div>';
|
|
|
+ $html .= '<div class="ranking">'. $rating . '</div>';
|
|
|
+ return $html;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -445,33 +440,37 @@ function display_title($course)
|
|
|
* @param $course
|
|
|
* @param $icon_title
|
|
|
*/
|
|
|
-function display_description_button($course, $icon_title)
|
|
|
-{
|
|
|
+function return_description_button($course, $icon_title)
|
|
|
+{
|
|
|
+ $title = $course['title'];
|
|
|
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
|
|
|
- echo '<a class="ajax btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="'.$icon_title.'" data-title="'.get_lang('Description').'">'.get_lang('Description').'</a>';
|
|
|
+ $html = '<a data-title="' . $title . '" class="ajax btn btn-default btn-sm btn-block" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="'.$icon_title.'">'.get_lang('Description').'</a>';
|
|
|
}
|
|
|
+ return $html;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Display the goto course button of a course in the course catalog
|
|
|
* @param $course
|
|
|
*/
|
|
|
-function display_goto_button($course)
|
|
|
+function return_goto_button($course)
|
|
|
{
|
|
|
- echo ' <a class="btn btn-primary" href="'.api_get_course_url($course['code']).'">'.get_lang('GoToCourse').'</a>';
|
|
|
+ $html = ' <a class="btn btn-primary" href="'.api_get_course_url($course['code']).'">'.get_lang('GoToCourse').'</a>';
|
|
|
+ return $html;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Display the already registerd text in a course in the course catalog
|
|
|
* @param $in_status
|
|
|
*/
|
|
|
-function display_already_registered_label($in_status)
|
|
|
+function return_already_registered_label($in_status)
|
|
|
{
|
|
|
- $icon = Display::return_icon('teachers.gif', get_lang('Teacher'));
|
|
|
+ $icon = Display::return_icon('teacher.png', get_lang('Teacher'), null, ICON_SIZE_TINY);
|
|
|
if ($in_status == 'student') {
|
|
|
- $icon = Display::return_icon('students.gif', get_lang('Student'));
|
|
|
+ $icon = Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY);
|
|
|
}
|
|
|
- echo Display::label($icon.' '.get_lang("AlreadyRegisteredToCourse"), "info");
|
|
|
+ $html = Display::div($icon.' '.get_lang("AlreadyRegisteredToCourse"), array('id' => 'register', 'class' => 'user-register'));
|
|
|
+ return $html;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -481,9 +480,11 @@ function display_already_registered_label($in_status)
|
|
|
* @param $code
|
|
|
* @param $search_term
|
|
|
*/
|
|
|
-function display_register_button($course, $stok, $code, $search_term)
|
|
|
+function return_register_button($course, $stok, $code, $search_term)
|
|
|
{
|
|
|
- echo ' <a class="btn btn-primary" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'.get_lang('Subscribe').'</a>';
|
|
|
+ $html = ' <a class="btn btn-primary" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'.get_lang('Subscribe').'</a>';
|
|
|
+ return $html;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -493,9 +494,9 @@ function display_register_button($course, $stok, $code, $search_term)
|
|
|
* @param $search_term
|
|
|
* @param $code
|
|
|
*/
|
|
|
-function display_unregister_button($course, $stok, $search_term, $code)
|
|
|
+function return_unregister_button($course, $stok, $search_term, $code)
|
|
|
{
|
|
|
- echo ' <a class="btn btn-primary" href="'. api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'.get_lang('Unsubscribe').'</a>';
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
+ $html = ' <a class="btn btn-primary" href="'. api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'.get_lang('Unsubscribe').'</a>';
|
|
|
+ return $html;
|
|
|
+
|
|
|
+}
|