From ca5b52f7478eb5d8c9da8b8850ef0b444543dcae Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 23 Mar 2012 12:42:00 +0100 Subject: [PATCH] Improving usability + showing the "gotocourse" button instead of "subscription" for "open to world" and "open to platform" courses see #4508 --- main/auth/courses_controller.php | 2 + main/css/base.css | 122 +----------------- main/inc/lib/auth.lib.php | 43 +++--- .../default/auth/courses_categories.php | 82 ++++++------ main/template/default/layout/hot_courses.tpl | 58 ++++----- 5 files changed, 96 insertions(+), 211 deletions(-) diff --git a/main/auth/courses_controller.php b/main/auth/courses_controller.php index 93a09eef84..4bd385be94 100644 --- a/main/auth/courses_controller.php +++ b/main/auth/courses_controller.php @@ -91,6 +91,7 @@ class CoursesController { // extends Controller { } $data['browse_courses_in_category'] = $this->model->browse_courses_in_category($category_code); } + $data['browse_course_categories'] = $browse_course_categories; $data['code'] = Security::remove_XSS($category_code); @@ -105,6 +106,7 @@ class CoursesController { // extends Controller { $user_coursecodes[] = $value['code']; } } + $data['user_coursecodes'] = $user_coursecodes; $data['action'] = $action; $data['message'] = $message; diff --git a/main/css/base.css b/main/css/base.css index 2edda588a0..1e77d65769 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -1154,126 +1154,21 @@ button.next.disabled, .a_button.disabled { border:1pt solid #ccc; } -#categories-content-first { - width:290px; - float:left; -} - #categories-search { text-align:center; /*height:55px; */ float: left; } -#categories-list { - -moz-border-radius-topleft:8px; - -moz-border-radius-topright:8px; - -webkit-border-top-left-radius: 8px; - -webkit-border-top-right-radius: 8px; - border-top-left-radius: 8px; - border-top-right-radius: 8px; - -moz-box-shadow:0 -1px 10px 2px #CCCCCC; - -Webkit-box-shadow: 0 -1px 10px 2px #CCCCCC; - box-shadow: 0 -1px 10px 2px #CCCCCC; - border:1px solid #CCCCCC; - float:left; - margin:8px; - width:240px; - min-height:132px; - padding:18px; - font-size:11pt; -} - -#categories-content-second { - margin-left: 308px; - margin-top:5px; -} - .course-block-main-item { height: 45px; padding: 5px 0px; } -.categories-block-course { - -moz-border-radius-topleft:8px; - -moz-border-radius-topright:8px; - -webkit-border-top-left-radius: 8px; - -webkit-border-top-right-radius: 8px; - border-top-left-radius: 8px; - border-top-right-radius: 8px; - -moz-box-shadow:0 -1px 10px 2px #CCCCCC; - -Webkit-box-shadow: 0 -1px 10px 2px #CCCCCC; - box-shadow: 0 -1px 10px 2px #CCCCCC; - border:1px solid #CCCCCC; - float:left; - margin:10px 0px 10px 0px; - padding:12px; - width:95%; - color: #bbb; -} - -.categories-content-course { - float:left; - width:100%; -} - -.categories-course-picture { - width:95px; - height:95px; - float:left; - overflow:hidden; - - border-radius:4px; - -moz-border-radius:4px; - -webkit-border-radius:4px; - - box-shadow:0 -1px 5px 2px #CCCCCC; - -moz-box-shadow:0 -1px 5px 2px #CCCCCC; - -Webkit-box-shadow: 0 -1px 5px 2px #CCCCCC; - box-shadow: 0 -1px 5px 2px #CCCCCC; - margin-left: 8px; -} - -.categories-course-picture img { - height: 95px; - background-color: #eeeeee; -} - .categories-course-description { - margin-left:18px; - font-family:arial; - font-size:11px; - margin-bottom: 10px; - float:left; -} - -.categories-course-links div { - padding-left:10px; + padding-bottom: 10px; } -.categories-course-description .course-block-title { - font-family: arial; - font-size: medium; - margin-bottom: 10px; - color: #222222; -} - -.categories-course-description .course-block-teacher { - font-size: large; - font-style: italic; - text-align: right; - color: #444444; - float: right; - text-align: right; - width: 197px; -} -.categories-course-description .course-block-date { - font-size: large; - font-style: italic; - text-align: right; - color: #444444; - line-height: 10px; -} .course-block-popularity { width: 90px; float: right; @@ -1282,8 +1177,7 @@ button.next.disabled, .a_button.disabled { text-align: right; background-color: #eeeeee; min-height:95px; - padding-right: 5px; - + padding-right: 5px; -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px; -webkit-border-top-left-radius: 4px; @@ -1304,18 +1198,6 @@ button.next.disabled, .a_button.disabled { text-shadow: gray 3px 3px 2px; } -.categories-course-links { - float:left; - margin-top:15px; - height:26px; - padding:2px; - width:100%; -} - -.course-link-desc { - float:left; -} - /* THEMATIC ADVANCE */ .thematic-postit { width:250px; diff --git a/main/inc/lib/auth.lib.php b/main/inc/lib/auth.lib.php index 19042f0044..cd978c0293 100644 --- a/main/inc/lib/auth.lib.php +++ b/main/inc/lib/auth.lib.php @@ -520,23 +520,23 @@ class Auth */ public function search_courses($search_term) { $TABLECOURS = 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); // get course list auto-register - $sql = "SELECT course_code FROM $TABLE_COURSE_FIELD_VALUE tcfv INNER JOIN $TABLE_COURSE_FIELD tcf ON " . - " tcfv.field_id = tcf.id WHERE tcf.field_variable = 'special_course' AND tcfv.field_value = 1 "; + $sql = "SELECT course_code FROM $TABLE_COURSE_FIELD_VALUE tcfv INNER JOIN $TABLE_COURSE_FIELD tcf ON tcfv.field_id = tcf.id + WHERE tcf.field_variable = 'special_course' AND tcfv.field_value = 1 "; $special_course_result = Database::query($sql); - if(Database::num_rows($special_course_result)>0) { - $special_course_list = array(); - while ($result_row = Database::fetch_array($special_course_result)) { - $special_course_list[] = '"'.$result_row['course_code'].'"'; - } + if (Database::num_rows($special_course_result)>0) { + $special_course_list = array(); + while ($result_row = Database::fetch_array($special_course_result)) { + $special_course_list[] = '"'.$result_row['course_code'].'"'; + } } $without_special_courses = ''; if (!empty($special_course_list)) { - $without_special_courses = ' AND course.code NOT IN ('.implode(',',$special_course_list).')'; + $without_special_courses = ' AND course.code NOT IN ('.implode(',',$special_course_list).')'; } $search_term_safe = Database::escape_string($search_term); @@ -553,27 +553,26 @@ class Auth } } $result_find = Database::query($sql_find); + $courses = array(); while ($row = Database::fetch_array($result_find)) { - - $row['registration_code'] = !empty($row['registration_code']); $count_users = count(CourseManager::get_user_list_from_course_code($row['code'])); $count_connections_last_month = Tracking::get_course_connections_count($row['code'], 0, api_get_utc_datetime(time()-(30*86400))); $courses[] = array( - 'code' => $row['code'], - 'directory' => $row['directory'], - 'db' => $row['db_name'], - 'visual_code' => $row['visual_code'], - 'title' => $row['title'], - 'tutor' => $row['tutor_name'], - 'subscribe' => $row['subscribe'], - 'unsubscribe' => $row['unsubscribe'], + 'code' => $row['code'], + 'directory' => $row['directory'], + 'db' => $row['db_name'], + 'visual_code' => $row['visual_code'], + 'title' => $row['title'], + 'tutor' => $row['tutor_name'], + 'subscribe' => $row['subscribe'], + 'unsubscribe' => $row['unsubscribe'], 'registration_code' => $row['registration_code'], - 'creation_date' => $row['creation_date'], - 'count_users' => $count_users, + 'creation_date' => $row['creation_date'], + 'visibility' => $row['visibility'], + 'count_users' => $count_users, 'count_connections' => $count_connections_last_month ); - // $courses[] = array('code' => $row['code'], 'directory' => $row['directory'], 'db' => $row['db_name'], 'visual_code' => $row['visual_code'], 'title' => $row['title'], 'tutor' => $row['tutor_name'], 'subscribe' => $row['subscribe'], 'unsubscribe' => $row['unsubscribe']); } return $courses; } diff --git a/main/template/default/auth/courses_categories.php b/main/template/default/auth/courses_categories.php index 926e927061..d075b59b3d 100644 --- a/main/template/default/auth/courses_categories.php +++ b/main/template/default/auth/courses_categories.php @@ -47,17 +47,17 @@ $stok = Security::get_token(); $hidden_links = 1; } ?> -
-
-
+
+
+
'.get_lang('RandomPick').''; $code = ''; - } else { - echo ''.get_lang('RandomPick').''; - } + } else { + }*/ + echo ''.get_lang('RandomPick').'

'; // level 1 foreach ($browse_course_categories[0] as $category) { @@ -110,8 +110,7 @@ $stok = Security::get_token(); ?>
-
- +
'.get_lang('Teacher').'
'.$tutor_name.'
//
'.get_lang('CreationDate').'
'.api_format_date($creation_date,DATE_FORMAT_SHORT).'
- echo '
-
'; + echo '
'; - echo '
'; - if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') { - echo ''; - echo ''; - echo ''; - } else { - echo ''; - } - echo '
'; - echo '
-
'.cut($title, 60).'
- '.$rating.' -
'; - echo '
'.get_lang('ConnectionsLastMonth').'
'.$count_connections.'
'; - echo '
'; - - echo ''; + echo '

'; + echo '
'; + + echo '
'; + echo '
'.get_lang('ConnectionsLastMonth').'
'.$count_connections.'
'; + echo '
'; + echo '
'; } } else { echo Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory')); } - ?> -
+ ?>
-
\ No newline at end of file +
diff --git a/main/template/default/layout/hot_courses.tpl b/main/template/default/layout/hot_courses.tpl index 794dd96562..af968c82f5 100644 --- a/main/template/default/layout/hot_courses.tpl +++ b/main/template/default/layout/hot_courses.tpl @@ -30,41 +30,37 @@
{foreach $hot_courses as $hot_course}
-
-
- -
- - {* html_image file=$hot_course.extra_info.course_image *} -
+
+
+
+
+ + {* html_image file=$hot_course.extra_info.course_image *} +
+
-
-
{$hot_course.extra_info.name|truncate:60}
- {$hot_course.extra_info.rating_html} -
-
+
+
+

{$hot_course.extra_info.name|truncate:60}

+ {$hot_course.extra_info.rating_html} +
+

+ {* World *} + {if ($hot_course.extra_info.visibility == 3 OR ($hot_course.extra_info.visibility == 2 AND $_u.logged == 1 ))} + + {"GoToCourse"|get_lang} + + {/if} -

{/foreach}