Browse Source

fix css items list courses, hotcourses, catalog courses BT#11017

Alex Aragon 9 years ago
parent
commit
213bfe371f

+ 8 - 2
app/Resources/public/css/base.css

@@ -4880,6 +4880,9 @@ div#chat-remote-video video {
     border: 1px solid #DFDFDF;
     border-radius: 5px;
 }
+#hot_courses .grid-courses .items{
+   min-height: 275px;
+}
 .grid-courses .items .title{
     line-height: 1.4;
     font-size: 13px;
@@ -4887,6 +4890,9 @@ div#chat-remote-video video {
     padding: 0px;
     margin: 5px;
 }
+.grid-courses .items .toolbar{
+    text-align: right;
+}
 .grid-courses .items .image{
     position: relative;
 }
@@ -4919,12 +4925,12 @@ div#chat-remote-video video {
     margin-top: 5px;
     text-align: center;
 }
-.grid-courses .items .admin-actions{
+.grid-courses .items .admin-actions, .grid-courses .items .user-actions{
     position: absolute;
     bottom: 0px;
     left: 0px;
 }
-.grid-courses .items .admin-actions .btn-sm{
+.grid-courses .items .admin-actions .btn-sm,.grid-courses .items .user-actions .btn-sm{
     border-radius: 0;
     border: none;
 }

+ 1 - 0
main/auth/courses_controller.php

@@ -142,6 +142,7 @@ class CoursesController
         }
 
         // render to the view
+        
         $this->view->set_data($data);
         $this->view->set_layout('catalog_layout');
         $this->view->set_template('courses_categories');

+ 4 - 2
main/inc/lib/auth.lib.php

@@ -63,6 +63,7 @@ class Auth
                     course.unsubscribe unsubscr,
                     course.title i,
                     course.tutor_name t,
+                    course.category_code cat,
                     course.directory dir,
                     course_rel_user.status status,
                     course_rel_user.sort sort,
@@ -85,12 +86,13 @@ class Auth
                 'status' => $row['status'],
                 'tutor' => $row['t'],
                 'subscribe' => $row['subscr'],
+                'category' => $row['cat'],
                 'unsubscribe' => $row['unsubscr'],
                 'sort' => $row['sort'],
                 'user_course_category' => $row['user_course_cat']
             );
         }
-
+        
         return $courses;
     }
 
@@ -718,7 +720,7 @@ SQL;
 
         return $count;
     }
-
+    
     /**
      * Search sessions by the tags in their courses
      * @param string $termTag Term for search in tags

+ 23 - 0
main/inc/lib/course.lib.php

@@ -2938,6 +2938,29 @@ class CourseManager
         $sql = "SELECT * FROM $table_categories WHERE code = '$code';";
         return Database::fetch_array(Database::query($sql));
     }
+    
+    /**
+     * Returns the details of a course category
+     *
+     * @param string Category code
+     * @return array Course category
+     */
+    public static function getListCategory()
+    {
+        $table_categories = Database::get_main_table(TABLE_MAIN_CATEGORY);
+        $sql = "SELECT * FROM $table_categories ";
+        $result =  Database::query($sql);
+        $count = 0;
+        $list = array();
+        $category = array();
+        while($row = Database::fetch_array($result, 'ASSOC')){
+            $category['code'] = $row['code'];
+            $category['name'] = $row['name'];
+            $count++;
+            $list[$count] = $category;
+        }
+        return $list;
+    }
 
     /**
      *  Get count rows of a table inside a course database

+ 1 - 1
main/inc/lib/course_category.lib.php

@@ -796,11 +796,11 @@ class CourseCategory
                 'registration_code' => $row['registration_code'],
                 'creation_date' => $row['creation_date'],
                 'visibility' => $row['visibility'],
+                'category' => $row['category_code'],
                 'count_users' => $count_users,
                 'count_connections' => $count_connections_last_month
             );
         }
-
         return $courses;
     }
 

+ 1 - 11
main/inc/lib/display.lib.php

@@ -2481,14 +2481,4 @@ HTML;
         }
         return $html;
     }
-    /**
-     * @param string $string
-     * @return null|string
-     */
-     
-    public static function shortName($string){
-        $ispace = strpos($string," ");
-        $text = substr($string, 0, $ispace);
-        return $text;
-    }
-}
+}

+ 1 - 0
main/install/configuration.dist.php

@@ -238,3 +238,4 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
 //$_configuration['messaging_gdc_project_number'] = '';
 //Api Key in the Google Developer Console
 //$_configuration['messaging_gdc_api_key'] = '';
+//$_configuration['view_grid_courses'] = true (new grid view courses);

+ 44 - 21
main/template/default/auth/courses_categories.php

@@ -171,6 +171,7 @@ $code = isset($code) ? $code : null;
     <?php } ?>
 </div>
  <?php  } ?>
+<div class="grid-courses">
 <div class="row">
 <?php
 if ($showCourses && $action != 'display_sessions') {
@@ -189,10 +190,11 @@ if ($showCourses && $action != 'display_sessions') {
     if (!empty($search_term)) {
         echo "<p><strong>".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."</strong><br />";
     }
-
+    $listCategory = CourseManager::getListCategory();
+    
     $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);
@@ -213,17 +215,17 @@ if ($showCourses && $action != 'display_sessions') {
             $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-xs-6 col-sm-6 col-md-3"><div class="items-course">';
+            $html .= '<div class="col-xs-6 col-sm-6 col-md-3"><div class="items">';
 
             // display thumbnail
-            $html .= return_thumbnail($course, $icon_title);
+            $html .= return_thumbnail($course, $icon_title, $listCategory);
 
             // display course title and button bloc
-            $html .= '<div class="items-course-info">';
+            $html .= '<div class="description">';
             $html .= return_title($course);
             // display button line
             $html .= '<div class="toolbar">';
@@ -242,7 +244,7 @@ if ($showCourses && $action != 'display_sessions') {
                 }
             } elseif ($user_registerd_in_course_as_teacher) {
                 // if user registered as teacher
-                $html .= return_goto_button($course);
+                
 
                 if ($course_unsubscribe_allowed) {
                     $html .= return_unregister_button($course, $stok, $search_term, $code);
@@ -253,7 +255,7 @@ if ($showCourses && $action != 'display_sessions') {
                 // 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);
                         }
@@ -279,6 +281,7 @@ if ($showCourses && $action != 'display_sessions') {
 }
 ?>
 </div>
+</div>
 <?php
 
 echo $cataloguePagination;
@@ -288,7 +291,7 @@ echo $cataloguePagination;
  * @param $course
  * @param $icon_title
  */
-function return_thumbnail($course, $icon_title)
+function return_thumbnail($course, $icon_title, $list = array())
 {
     $html = '';
     $title = cut($course['title'], 70);
@@ -301,22 +304,44 @@ function return_thumbnail($course, $icon_title)
         // without picture
         $course_medium_image = Display::returnIconPath('session_default.png');
     }
-
-    // course image
-
-    $html .= '<div class="items-course-image">';
-    if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
-        $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 {
+    
+        $html .= '<div class="image">';
         $html .= '<img class="img-responsive" src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'"/>';
-    }
+        foreach ($list as $cat) {
+                if($course['category'] == $cat['code']){
+                    $html .= '<span class="category">'. $cat['name'].'</span>';
+                    $html .= '<div class="cribbon"></div>';
+                }
+        }
+        $teachers = CourseManager::getTeacheCourseCode($course['code']);
+        $html .= '<div class="black_shadow">';
+        $html .= '<div class="author-card">';
+        $count = 0;
+        foreach ($teachers as $value) {
+            if($count<=3){
+                $name = $value['firstname'].' ' . $value['lastname'];
+                $html .= '<a href="'.$value['url'].'" class="ajax" data-title="'.$name.'">';
+                $html .= '<img src="'.$value['avatar'].'"/>';
+                $html .= '</a>';
+                $html .= '<div class="teachers-details">';
+                $html .= '<h5>';
+                $html .= '<a href="'.$value['url'].'" class="ajax" data-title="'.$name.'">';
+                $html .= $name;
+                $html .= '</a>';
+                $html .= '</h5>';
+                $html .= '</div>';
+            }
+            $count ++;
+        }
+        $html .= '</div>';
+        $html .= '</div>';
+    // }
     $html .= '</div>';
 
     return $html;
 }
 
+
 /**
  * Display the title of a course in course catalog
  * @param $course
@@ -327,10 +352,8 @@ function return_title($course)
     $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']);
     $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;

+ 2 - 1
main/template/default/layout/hot_course_item.tpl

@@ -27,6 +27,7 @@
                     {% endfor %}
                     </div>
                 </div>
+                <div class="user-actions">{{ item.description_button }}</div>
             </div>
             <div class="description">
                 <h4 class="title">
@@ -37,7 +38,7 @@
                 </div>
                 <div class="toolbar">
                     <div class="btn-group" role="group">
-                        {{ item.description_button }}
+                        
                         {{ item.register_button }}
                         {{ item.unsubscribe_button }}
                     </div>