Browse Source

Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

Yannick Warnier 10 years ago
parent
commit
9495dd3296

+ 5 - 3
main/admin/configure_homepage.php

@@ -36,9 +36,11 @@ function home_tabs($file_logged_in)
 			$data_logged_in[] = $line;
 		}
 		//tabs file for logged out users
-		$fp = fopen($file_logged_out, 'w');
-		fputs($fp, implode("\n", $data_logged_out));
-		fclose($fp);
+		if (file_exists($file_logged_out)) {
+			$fp = fopen($file_logged_out, 'w');
+			fputs($fp, implode("\n", $data_logged_out));
+			fclose($fp);
+		}
 		//tabs file for logged in users
 		$fp = fopen($file_logged_in, 'w');
 		fputs($fp, implode("\n", $data_logged_in));

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

@@ -1546,9 +1546,11 @@ function api_get_course_int_id($code = null) {
         $row = Database::select(
             'id',
             Database::get_main_table(TABLE_MAIN_COURSE),
-            array('where'=> array('code = ?' => array($code)))
+            array('where'=> array('code = ?' => array($code))),
+            'first'
         );
-        if (is_array($row) && count($row == 1)) {
+
+        if (is_array($row) && isset($row['id'])) {
             return $row['id'];
         } else {
             return false;

+ 5 - 5
main/inc/lib/course.lib.php

@@ -3449,7 +3449,7 @@ class CourseManager
     {
         $html = '<div class="course_item">';
         $html .= '<div class="row">';
-        $html .= '<div class="span7">';
+        $html .= '<div class="col-md-7">';
 
         $notifications = isset($params['notifications']) ? $params['notifications'] : null;
 
@@ -3491,9 +3491,9 @@ class CourseManager
         }
         $html .= '<div class="' . $class . '">';
         $html .= '<div class="row">';
-        $html .= '<div class="span7">';
+        $html .= '<div class="col-md-7">';
         $html .= ' <div class="row">';
-        $html .= '<div class="span1 course-box-thumbnail-box">';
+        $html .= '<div class="col-md-2 course-box-thumbnail-box">';
         if (!empty($params['link'])) {
             $html .= '<a class="thumbnail" href="' . $params['link'] . '">';
             $html .= $params['icon'];
@@ -3508,7 +3508,7 @@ class CourseManager
         $notifications = isset($params['notifications']) ? $params['notifications'] : null;
         $param_class = isset($params['class']) ? $params['class'] : null;
 
-        $html .= '<div class="span6 ' . $param_class . '">';
+        $html .= '<div class="col-md-6 ' . $param_class . '">';
         $html .= '<h3>' . $params['title'] . $notifications . '</h3> ';
 
         if (isset($params['show_description'], $params['description']) && $params['show_description'] == 1) {
@@ -5594,4 +5594,4 @@ class CourseManager
         }
         return $courses;
     }
-}
+}

+ 2 - 2
main/inc/lib/course_home.lib.php

@@ -869,7 +869,7 @@ class CourseHome
                 switch ($theme) {
                     case 'activity_big':
                         $data = '';
-                        $html .= '<div class="span4 course-tool">';
+                        $html .= '<div class="col-md-4 course-tool">';
                         $image = (substr($item['tool']['image'], 0, strpos($item['tool']['image'], '.'))).'.png';
                         $toolId = isset($item['tool']['id']) ? $item['tool']['id'] : null;
                         if (isset($item['tool']['custom_image'])) {
@@ -895,7 +895,7 @@ class CourseHome
 
                         break;
                     case 'activity':
-                        $html .= '<div class="offset2 span4 course-tool">';
+                        $html .= '<div class="offset2 col-md-4 course-tool">';
                         $html .= $item['extra'];
                         $html .= $item['visibility'];
                         $html .= $item['icon'];

+ 5 - 5
main/inc/lib/javascript/chat/js/chat.js

@@ -79,21 +79,21 @@ $(document).ready(function() {
 	});
 
 	// User name header toogle
-	$('.chatboxtitle').on('click', function(){
+	$('body').on('click', '.chatboxtitle', function(){
 		chatbox = $(this).parents(".chatbox");
 		var chat_id = chatbox.attr('id');
 		chat_id = chat_id.split('_')[1];
 		toggleChatBoxGrowth(chat_id);
 	});
 
-	//Minimize button
-	$('.chatboxhead .togglelink').on('click', function(){
+	// Minimize button
+	$('body').on('click', '.chatboxhead .togglelink', function(){
 		var chat_id =  $(this).attr('rel');
 		toggleChatBoxGrowth(chat_id);
 	});
 
-	//Close button
-	$('.chatboxhead .closelink').on('click', function(){
+	// Close button
+	$('body').on('click', '.chatboxhead .closelink', function(){
 		var chat_id =  $(this).attr('rel');
 		closeChatBox(chat_id);
 	});

+ 9 - 2
main/inc/lib/online.inc.php

@@ -425,8 +425,11 @@ function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit
 	}
 }
 
-function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null) {
-	if(empty($coursecode)) return false;
+function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null)
+{
+	if (empty($coursecode)) {
+		return false;
+	}
 	$track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
 	$coursecode = Database::escape_string($coursecode);
 	$time_limit = Database::escape_string($time_limit);
@@ -435,6 +438,10 @@ function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null)
     $current_date = api_get_utc_datetime($online_time);
 	$courseId = api_get_course_int_id($coursecode);
 
+	if (empty($courseId)) {
+		return false;
+	}
+
 	$query = "SELECT count(login_user_id) as count
               FROM $track_online_table
               WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' ";

+ 1 - 1
main/mySpace/index.php

@@ -27,9 +27,9 @@ $csv_content = array();
 $nameTools = get_lang('MySpace');
 
 $user_id = api_get_user_id();
-$is_coach = api_is_coach($_GET['session_id']);
 $session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
 
+$is_coach = api_is_coach($session_id);
 $is_platform_admin 	= api_is_platform_admin();
 $is_drh 			= api_is_drh();
 $is_session_admin 	= api_is_session_admin();

+ 1 - 1
main/social/home.php

@@ -127,7 +127,7 @@ $socialRightContent .= '
         ' . get_lang('EditProfile') . '
     </a>
     </div></div></div>';
-$socialRightInformation = '<div class="span4">';
+$socialRightInformation = '<div class="col-md-4">';
 if (api_get_setting('allow_skills_tool') == 'true') {
     $socialRightInformation .= '<div class="well_border">';
     $skill = new Skill();

+ 2 - 2
main/social/search.php

@@ -226,12 +226,12 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
                                 <div class="span12">
                                     '.$user_info['complete_name'].'
                                 </div>
-                                <div class="span4">
+                                <div class="col-md-4">
                                     <div class="media">
                                     '.$img.'
                                     </div>
                                 </div>
-                                <div class="span5">
+                                <div class="col-md-5">
                                     <div class="media">
                                     '.$invitations.'
                                     </div>

+ 5 - 5
main/template/default/layout/social_layout.tpl

@@ -2,15 +2,15 @@
 
 {% block content %}
     <div class="row">
-        <div class="span3">
+        <div class="col-md-3">
             <div class="social-menu">
             {{ social_avatar_block }}
             {{ social_menu_block }}
             </div>
         </div>
-        <div id="wallMessages" class="span5" style="min-height:1px">
+        <div id="wallMessages" class="col-md-5" style="min-height:1px">
             <div class="row">
-                <div class="span5">
+                <div class="col-md-5">
                     <div id="message_ajax_reponse" class=""></div>
                 </div>
             </div>
@@ -20,10 +20,10 @@
             <div id="display_response_id" class="span5"></div>
             {{ socialAutoExtendLink }}
         </div>
-        <div class="span4">
+        <div class="col-md-4">
             <div class="row">
                 {{ socialRightInformation}}
             </div>
         </div>
     </div>
-{% endblock %}
+{% endblock %}

+ 0 - 1
main/template/default/layout/topbar.tpl

@@ -90,5 +90,4 @@
             {% endif %}
         </div> <!-- /container-->
     </nav><!-- /topbar -->
-    <div id="topbar_push"></div>
 {% endif %}