Kaynağa Gözat

Format code.

Julio Montoya 9 yıl önce
ebeveyn
işleme
3837899029

+ 45 - 45
main/dashboard/dashboard.php

@@ -39,52 +39,52 @@ echo '</div>';
 
 // block dashboard view
 if (isset($dashboard_view) && $dashboard_view == 'blocks') {
-	if (count($blocks) > 0) {
-		$columns = array();
-		// group content html by number of column
-		if (is_array($blocks)) {
-			$tmp_columns = array();
-			foreach ($blocks as $block) {
-				$tmp_columns[] = $block['column'];
-				if (in_array($block['column'], $tmp_columns)) {
-					$columns['column_'.$block['column']][] = $block['content_html'];
-				}
-			}
-		}
+    if (isset($blocks) && count($blocks) > 0) {
+        $columns = array();
+        // group content html by number of column
+        if (is_array($blocks)) {
+            $tmp_columns = array();
+            foreach ($blocks as $block) {
+                $tmp_columns[] = $block['column'];
+                if (in_array($block['column'], $tmp_columns)) {
+                    $columns['column_'.$block['column']][] = $block['content_html'];
+                }
+            }
+        }
 
-		echo '<div id="columns" class="row">';
-		if (count($columns) > 0) {
-			$columns_name = array_keys($columns);
-			// blocks for column 1
-			if (in_array('column_1',$columns_name)) {
-				echo '<div id="column1" class="col-md-6">';
-					foreach ($columns['column_1'] as $content) {
-						echo $content;
-					}
-				echo '</div>';
-			} else {
-				echo '<div id="column1" class="col-md-6">';
-				echo '&nbsp;';
-				echo '</div>';
-			}
-			// blocks for column 2
-			if (in_array('column_2',$columns_name)) {
-				// blocks for column 1
-				echo '<div id="column2" class="col-md-6">';
-					foreach ($columns['column_2'] as $content) {
-						echo $content;
-					}
-				echo '</div>';
-			} else {
-				echo '<div id="column2" class="col-md-6">';
-				echo '&nbsp;';
-				echo '</div>';
-			}
-		}
-		echo '</div>';
-	} else {
-		echo '<div style="margin-top:20px;">'.get_lang('YouHaveNotEnabledBlocks').'</div>';
-	}
+        echo '<div id="columns" class="row">';
+        if (count($columns) > 0) {
+            $columns_name = array_keys($columns);
+            // blocks for column 1
+            if (in_array('column_1',$columns_name)) {
+                echo '<div id="column1" class="col-md-6">';
+                    foreach ($columns['column_1'] as $content) {
+                        echo $content;
+                    }
+                echo '</div>';
+            } else {
+                echo '<div id="column1" class="col-md-6">';
+                echo '&nbsp;';
+                echo '</div>';
+            }
+            // blocks for column 2
+            if (in_array('column_2',$columns_name)) {
+                // blocks for column 1
+                echo '<div id="column2" class="col-md-6">';
+                    foreach ($columns['column_2'] as $content) {
+                        echo $content;
+                    }
+                echo '</div>';
+            } else {
+                echo '<div id="column2" class="col-md-6">';
+                echo '&nbsp;';
+                echo '</div>';
+            }
+        }
+        echo '</div>';
+    } else {
+        echo '<div style="margin-top:20px;">'.get_lang('YouHaveNotEnabledBlocks').'</div>';
+    }
 
 } else {
 	// block dashboard list

+ 3 - 8
main/inc/lib/dashboard.lib.php

@@ -1,20 +1,15 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-/**
- * This file contains a class used like library, provides functions for dashboard.
- * @author Christian Fasanando <christian1827@gmail.com>
- * @package chamilo.dashboard
- */
-
 /**
  * DashboardManager can be used to manage dashboard
+ * author Christian Fasanando <christian1827@gmail.com>
  * @package chamilo.dashboard
  */
 class DashboardManager
 {
 	/**
-	 * contructor
+	 * Constructor
 	 */
 	public function __construct()
 	{
@@ -169,7 +164,7 @@ class DashboardManager
 			foreach ($extra_user_data as $key => $user_data) {
 				$user_id = $key;
 				$user_block_data = self::get_user_block_data($user_id);
-				$user_block_id   = array_keys($user_block_data);
+				$user_block_id = array_keys($user_block_data);
 
 				// clean disabled block data
 				foreach ($user_block_id as $block_id) {

+ 0 - 3
main/social/friends.php

@@ -80,9 +80,6 @@ $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Friends'));
 
 //Block Social Menu
 $social_menu_block = SocialManager::show_social_menu('friends');
-
-$user_id = api_get_user_id();
-
 $user_id = api_get_user_id();
 $name_search = isset($_POST['search_name_q']) ? $_POST['search_name_q'] : null;
 $number_friends = 0;

+ 1 - 3
main/social/group_add.php

@@ -1,5 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
  * @package chamilo.social
  * @author Julio Montoya <gugli100@gmail.com>
@@ -43,13 +44,10 @@ $interbreadcrumb[]= array ('url' =>'#','name' => $nameTools);
 
 $social_avatar_block = SocialManager::show_social_avatar_block('group_add');
 $social_menu_block = SocialManager::show_social_menu('group_add');
-
 $social_right_content = $form->returnForm();
 
 $tpl = new Template(null);
-
 SocialManager::setSocialUserBlock($tpl, $user_id, null, null);
-
 $tpl->setHelp('Groups');
 $tpl->assign('social_menu_block', $social_menu_block);
 $tpl->assign('social_right_content', $social_right_content);

+ 1 - 2
main/social/group_edit.php

@@ -31,8 +31,7 @@ if (empty($group_data)) {
 $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups'));
 $interbreadcrumb[] = array('url' => 'group_view.php?id='.$group_id, 'name' => $group_data['name']);
 
-
-//only group admins can edit the group
+// only group admins can edit the group
 if (!$usergroup->is_group_admin($group_id)) {
     api_not_allowed();
 }

+ 4 - 2
main/social/group_invitation.php

@@ -48,7 +48,6 @@ $form_sent = 0;
 $errorMsg = $firstLetterUser = $firstLetterSession = '';
 $UserList = $SessionList = array();
 $users = $sessions = array();
-
 $content = null;
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
@@ -135,7 +134,10 @@ if (!$friends) {
 if (is_array($Users) && count($Users) > 0 ) {
     foreach ($Users as $user) {
         if ($user['group_id'] != $group_id) {
-            $nosessionUsersList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
+            $nosessionUsersList[$user['user_id']] = api_get_person_name(
+                $user['firstname'],
+                $user['lastname']
+            );
         }
     }
 }

+ 1 - 0
main/social/group_members.php

@@ -18,6 +18,7 @@ if (api_get_setting('allow_social_tool') != 'true') {
 $this_section = SECTION_SOCIAL;
 $group_id = intval($_GET['id']);
 $userGroup = new UserGroup();
+$user_role = '';
 
 //todo @this validation could be in a function in group_portal_manager
 if (empty($group_id)) {

+ 3 - 4
main/social/group_topics.php

@@ -14,8 +14,8 @@ if (api_get_setting('allow_social_tool') !='true') {
     api_not_allowed();
 }
 
-$group_id	= intval($_GET['id']);
-$topic_id   = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : null;
+$group_id = intval($_GET['id']);
+$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : null;
 $message_id = isset($_GET['msg_id']) ? intval($_GET['msg_id']) : null;
 
 $usergroup = new UserGroup();
@@ -105,7 +105,6 @@ if (isset($_POST['action'])) {
     $message_id = $res;
 }
 
-
 $htmlHeadXtra[] = '<script>
 
 var counter_image = 1;
@@ -164,7 +163,7 @@ function validate_text_empty(str,msg) {
 }
 
 $(document).ready(function() {
-	if ( $("#msg_'.$message_id.'").length) {
+	if ($("#msg_'.$message_id.'").length) {
 		$("html,body").animate({
 			scrollTop: $("#msg_'.$message_id.'").offset().top
 		})

+ 5 - 1
main/social/group_view.php

@@ -138,7 +138,11 @@ if ($group_id != 0) {
                     Display::return_message(get_lang('UserIsSubscribedToThisGroup'), 'confirmation', false)
                 );
             } else {
-                $usergroup->add_user_to_group($user_join, $group_id, GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER);
+                $usergroup->add_user_to_group(
+                    $user_join,
+                    $group_id,
+                    GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER
+                );
                 Display::addFlash(
                     Display::return_message(get_lang('InvitationSent'), 'confirmation', false)
                 );

+ 1 - 1
main/social/invitations.php

@@ -23,7 +23,7 @@ $userGroup = new UserGroup();
 
 $htmlHeadXtra[] = '
 <script>
-function denied_friend (element_input) {
+function denied_friend(element_input) {
     name_button=$(element_input).attr("id");
     name_div_id="id_"+name_button.substring(13);
     user_id=name_div_id.split("_");

+ 3 - 7
main/social/my_skills_report.php

@@ -8,10 +8,10 @@
 require_once '../inc/global.inc.php';
 
 $isStudent = api_is_student();
-$isStudentBosss = api_is_student_boss();
+$isStudentBoss = api_is_student_boss();
 $isDRH = api_is_drh();
 
-if (!$isStudent && !$isStudentBosss && !$isDRH) {
+if (!$isStudent && !$isStudentBoss && !$isDRH) {
     header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php');
     exit;
 }
@@ -58,19 +58,15 @@ if ($isStudent) {
                 $courseImageThumb->resize(32, 32, 0);
                 $courseImageThumb->send_image($thumbSysPath);
             }
-
             $tableRow['courseImage'] = $thumbWebPath;
         }
-
         $tableRows[] = $tableRow;
     }
 
     $tplPath = 'skill/student_report.tpl';
-} else if ($isStudentBosss) {
+} else if ($isStudentBoss) {
     $selectedStudent = isset($_REQUEST['student']) ? intval($_REQUEST['student']) : 0;
-
     $tableRows = array();
-
     $followedStudents = UserManager::getUsersFollowedByStudentBoss($userId);
 
     foreach ($followedStudents as &$student) {

+ 2 - 3
main/social/profile.php

@@ -170,7 +170,7 @@ function timeAgo() {
 }
 
 function register_friend(element_input) {
-    if(confirm("'.get_lang('AddToFriends').'")) {
+    if (confirm("'.get_lang('AddToFriends').'")) {
         name_button=$(element_input).attr("id");
         name_div_id="id_"+name_button.substring(13);
         user_id=name_div_id.split("_");
@@ -494,8 +494,7 @@ if ($show_full_profile) {
         //$social_course_block = Display::panel($my_courses, get_lang('MyCourses'));
     }
 
-    //Block Social Sessions
-
+    // Block Social Sessions
     if (count($sessionList) > 0) {
         //$social_session_block = $htmlSessionList;
         $social_session_block = $sessionList;

+ 6 - 21
main/tracking/courseLogCSV.php

@@ -11,12 +11,8 @@
  *
  * 	@package chamilo.tracking
  */
-/**
- * Code
- */
-// TODO: Is this file deprecated?
 
-/* INIT SECTION */
+// TODO: Is this file deprecated?
 
 $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
 require_once '../inc/global.inc.php';
@@ -225,12 +221,9 @@ if ($is_allowedToTrack) {
     /* 	Tools */
     $tempView = $view;
     if ($view[2] == '1') {
-
         $tempView[2] = '0';
-
         $title[1] = $nameTools;
         $line = '';
-
         $title_line = get_lang('ToolTitleToolnameColumn') . ";" . get_lang('ToolTitleUsersColumn') . ";" . get_lang('ToolTitleCountColumn') . "\n";
 
         $sql = "SELECT access_tool, COUNT(DISTINCT access_user_id),count( access_tool )
@@ -239,7 +232,7 @@ if ($is_allowedToTrack) {
                     AND c_id = $courseId
                 GROUP BY access_tool";
 
-        $results = getManyResults3Col($sql);
+        $results = StatsUtils::getManyResults3Col($sql);
 
         if (is_array($results)) {
             for ($j = 0; $j < count($results); $j++) {
@@ -250,9 +243,7 @@ if ($is_allowedToTrack) {
         }
     }
 
-
     /* 	Links */
-
     $tempView = $view;
     if ($view[3] == '1') {
 
@@ -281,20 +272,18 @@ if ($is_allowedToTrack) {
         }
     }
 
-
     /* 	Documents */
-
     $tempView = $view;
     if ($view[4] == '1') {
 
         $tempView[4] = '0';
 
         $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path)
-                    FROM $TABLETRACK_DOWNLOADS
-                    WHERE c_id = $courseId
-                    GROUP BY down_doc_path";
+                FROM $TABLETRACK_DOWNLOADS
+                WHERE c_id = $courseId
+                GROUP BY down_doc_path";
 
-        $results = getManyResults3Col($sql);
+        $results = StatsUtils::getManyResults3Col($sql);
 
         $title[1] = $nameTools;
         $line = '';
@@ -312,9 +301,7 @@ if ($is_allowedToTrack) {
     /* 	Scorm contents and Learning Path */
     $tempView = $view;
     if ($view[5] == '1') {
-
         $tempView[5] = '0';
-
         $sql = "SELECT id, name FROM $tbl_learnpath_main WHERE c_id = $course_id ";
         $result = Database::query($sql);
 
@@ -354,7 +341,6 @@ if ($is_allowedToTrack) {
                                 $line .= $ar['id'] . " " . $ar2['user_id'] . " " . api_get_person_name($ar2['firstname'], $ar2['lastname']);
                             }
 
-
                             if ($ar2['user_id'] == $scormstudentopen) { //have to list the student's results
                                 $studentId = $ar2['user_id'];
                                 $sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time " .
@@ -378,7 +364,6 @@ if ($is_allowedToTrack) {
                             $line .= "\n";
                             $ar2 = Database::fetch_array($result2);
                         }
-
                         $title_line .= "\n";
                     }
                 }

+ 0 - 1
main/tracking/course_log_groups.php

@@ -105,7 +105,6 @@ function action_formatter(cellvalue, options, rowObject) {
 
 // Add the JS needed to use the jqgrid
 $htmlHeadXtra[] = api_get_jqgrid_js();
-
 $htmlHeadXtra[] = '
 <script>
 $(function() {

+ 0 - 2
main/tracking/course_log_resources.php

@@ -5,8 +5,6 @@
  *	@package chamilo.tracking
  */
 
-/* INIT SECTION */
-
 $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
 // Including the global initialization file
 require_once '../inc/global.inc.php';

+ 1 - 3
main/tracking/course_session_report.php

@@ -47,9 +47,8 @@ if (count($session_list) == 0) {
 $form->addElement('select', 'session_id', get_lang('Sessions'), $my_session_list);
 $form->addButtonFilter(get_lang('Filter'));
 
-
 if (!empty($_REQUEST['score']))	$filter_score = intval($_REQUEST['score']); else $filter_score = 70;
-if (!empty($_REQUEST['session_id']))	$session_id = intval($_REQUEST['session_id']); else $session_id = 0;
+if (!empty($_REQUEST['session_id'])) $session_id = intval($_REQUEST['session_id']); else $session_id = 0;
 
 if (empty($session_id)) {
 	$session_id = key($my_session_list);
@@ -169,7 +168,6 @@ if (!empty($users) && is_array($users)) {
 			}
 
 			$html_result .= $result;
-
 			$html_result .= "</td>";
 		}
 		if (empty($counter)) {

+ 6 - 4
main/tracking/logins_details.php

@@ -16,15 +16,17 @@
 
 /* 		INIT SECTION */
 $uInfo = $_REQUEST['uInfo'];
-if (!isset($_REQUEST['reqdate']))
+if (!isset($_REQUEST['reqdate'])) {
     $reqdate = time();
-else
+} else {
     $reqdate = $_REQUEST['reqdate'];
+}
 $period = $_REQUEST['period'];
-if (!isset($_REQUEST['view']))
+if (!isset($_REQUEST['view'])) {
     $view = "0000000";
-else
+} else {
     $view = $_REQUEST['view'];
+}
 include('../inc/global.inc.php');
 
 $interbreadcrumb[] = array("url" => "../user/user.php", "name" => get_lang('Users'));

+ 5 - 4
main/user/class.php

@@ -20,21 +20,22 @@ $tool_name = get_lang("Classes");
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // Extra entries in breadcrumb
-$interbreadcrumb[] = array ("url" => "user.php?".api_get_cidreq(), "name" => get_lang("ToolUser"));
+$interbreadcrumb[] = array(
+    "url" => "user.php?".api_get_cidreq(),
+    "name" => get_lang("ToolUser"),
+);
 
 $type = isset($_GET['type']) ? Security::remove_XSS($_GET['type']) : 'registered';
 $groupFilter = isset($_GET['group_filter']) ? intval($_GET['group_filter']) : 0;
 
 $htmlHeadXtra[] = '
 <script>
-
 $(document).ready( function() {
     $("#group_filter").change(function() {
         window.location = "class.php?'.api_get_cidreq().'&type='.$type.'" +"&group_filter=" + $(this).val();
     });
 });
-</script>
-';
+</script>';
 
 Display :: display_header($tool_name, "User");
 $usergroup = new UserGroup();

+ 8 - 5
main/user/resume_session.php

@@ -1,5 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
 *	@author Bart Mollet, Julio Montoya lot of fixes
 *	@package chamilo.admin
@@ -16,7 +17,7 @@ SessionManager::protect_teacher_session_edit($id_session);
 $tool_name = get_lang('SessionOverview');
 
 $allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
-if($allowTutors == 'true') {
+if ($allowTutors == 'true') {
     // Database Table Definitions
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS);
@@ -221,7 +222,7 @@ if($allowTutors == 'true') {
     <?php
     if ($session['nbr_courses'] == 0) {
     	echo '<tr>
-    			<td colspan="4">'.get_lang('NoCoursesForThisSession').'</td>
+            <td colspan="4">'.get_lang('NoCoursesForThisSession').'</td>
     		</tr>';
     } else {
     	// select the courses
@@ -276,7 +277,8 @@ if($allowTutors == 'true') {
     		}
 
     		$orig_param = '&origin=resume_session';
-    		//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb
+    		//hide_course_breadcrumb the parameter has been added to hide the
+            // name of the course, that appeared in the default $interbreadcrumb
     		echo '
     		<tr>
     			<td>'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session),'</td>
@@ -292,7 +294,6 @@ if($allowTutors == 'true') {
     <?php
     echo Display::page_subheader(get_lang('UserList').$url);
     ?>
-
     <!--List of users -->
     <table class="data_table">
         <tr>
@@ -330,7 +331,8 @@ if($allowTutors == 'true') {
 
     	$result = Database::query($sql);
     	$users  = Database::store_result($result);
-    	$orig_param = '&origin=resume_session&id_session='.$id_session; // change breadcrumb in destination page
+        // change breadcrumb in destination page
+    	$orig_param = '&origin=resume_session&id_session='.$id_session;
     	foreach ($users as $user) {
             $user_link = '';
             if (!empty($user['user_id'])) {
@@ -347,6 +349,7 @@ if($allowTutors == 'true') {
                     $link_to_add_user_in_url = '<a href="resume_session.php?action=add_user_to_url&id_session='.$id_session.'&user_id='.$user['user_id'].'">'.$add.'</a>';
                 }
             }
+
     		echo '<tr>
                     <td width="90%">
                         '.$user_link.'

+ 18 - 7
main/user/session_list.php

@@ -1,5 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
  * List sessions in an efficient and usable way
  * @package chamilo.admin
@@ -22,7 +23,7 @@ $tool_name = get_lang('SessionList');
 Display::display_header($tool_name);
 
 $allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
-if($allowTutors == 'true') {
+if ($allowTutors == 'true') {
 
     $error_message = ''; // Avoid conflict with the global variable $error_msg (array type) in add_course.conf.php.
     if (isset($_GET['action']) && $_GET['action'] == 'show_message') {
@@ -41,10 +42,19 @@ if($allowTutors == 'true') {
     }
 
     //The order is important you need to check the the $column variable in the model.ajax.php file
-    $columns        = array(get_lang('Name'), get_lang('NumberOfCourses'), get_lang('NumberOfUsers'), get_lang('SessionCategoryName'),
-                            get_lang('StartDate'), get_lang('EndDate'), get_lang('Coach'),  get_lang('Status'), get_lang('Visibility'), get_lang('Actions'));
+    $columns = array(
+        get_lang('Name'),
+        get_lang('NumberOfCourses'),
+        get_lang('NumberOfUsers'),
+        get_lang('SessionCategoryName'),
+        get_lang('StartDate'),
+        get_lang('EndDate'),
+        get_lang('Coach'),
+        get_lang('Status'),
+        get_lang('Visibility'),
+        get_lang('Actions'),
+    );
 
-    //$activeurl = '?sidx=session_active';
     //Column config
     $column_model   = array(
         array('name'=>'name',           'index'=>'name',          'width'=>'160',  'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
@@ -56,9 +66,10 @@ if($allowTutors == 'true') {
         array('name'=>'coach_name',     'index'=>'coach_name',    'width'=>'80',   'align'=>'left', 'search' => 'false'),
         array('name'=>'status',         'index'=>'session_active','width'=>'40',   'align'=>'left', 'search' => 'true', 'stype'=>'select',
           //for the bottom bar
-          'searchoptions' => array(
-                            'defaultValue'  => '1',
-                            'value'         => '1:'.get_lang('Active').';0:'.get_lang('Inactive')),
+            'searchoptions' => array(
+                'defaultValue' => '1',
+                'value' => '1:'.get_lang('Active').';0:'.get_lang('Inactive')
+            ),
           //for the top bar
           'editoptions' => array('value' => ':'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive'))),
         array('name'=>'visibility',     'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),

+ 2 - 1
main/user/subscribe_class.php

@@ -74,7 +74,8 @@ function get_number_of_classes()
 /**
  * Get the classes to display on the current page.
  */
-function get_class_data($from, $number_of_items, $column, $direction) {
+function get_class_data($from, $number_of_items, $column, $direction)
+{
     $class_table = Database :: get_main_table(TABLE_MAIN_CLASS);
     $course_class_table = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS);
     $class_user_table = Database :: get_main_table(TABLE_MAIN_CLASS_USER);

+ 54 - 48
main/user/subscribe_user.php

@@ -50,50 +50,49 @@ if ($keyword) {
 	$tool_name = get_lang('SearchResults');
 }
 
-
 $current_session_id = api_get_session_id();
 $list_register_user='';
 $list_not_register_user='';
 
 if (isset($_REQUEST['register'])) {
-	if ($type == COURSEMANAGER) {
-		if (!empty($current_session_id)) {
-			$result_simple_sub = SessionManager::set_coach_to_course_session(
-				$_REQUEST['user_id'],
-				$current_session_id,
-				$courseInfo['code']
-			);
-		} else {
-			$result_simple_sub = CourseManager:: subscribe_user(
-				$_REQUEST['user_id'],
-				$courseInfo['code'],
-				COURSEMANAGER
-			);
-		}
-	} else {
+    if ($type == COURSEMANAGER) {
+        if (!empty($current_session_id)) {
+            $result_simple_sub = SessionManager::set_coach_to_course_session(
+                $_REQUEST['user_id'],
+                $current_session_id,
+                $courseInfo['code']
+            );
+        } else {
+            $result_simple_sub = CourseManager:: subscribe_user(
+                $_REQUEST['user_id'],
+                $courseInfo['code'],
+                COURSEMANAGER
+            );
+        }
+    } else {
         $result_simple_sub = CourseManager:: subscribe_user(
             $_REQUEST['user_id'],
             $courseInfo['code']
         );
-	}
+    }
 
 	$user_id_temp = $_SESSION['session_user_id'];
 
-	if (is_array($user_id_temp)) {
-		$counter = count($user_id_temp);
-		for ($j=0; $j<$counter;$j++) {
-			if 	($user_id_temp[$j]==$_GET['user_id']) {
-				if ($result_simple_sub)	{
+    if (is_array($user_id_temp)) {
+        $counter = count($user_id_temp);
+        for ($j=0; $j<$counter;$j++) {
+            if 	($user_id_temp[$j]==$_GET['user_id']) {
+                if ($result_simple_sub)	{
                     Display::addFlash(Display::return_message($_SESSION['session_user_name'][$j].' '.get_lang('AddedToCourse')));
-				} else {
+                } else {
                     Display::addFlash(Display::return_message($_SESSION['session_user_name'][$j].' '.get_lang('NotAddedToCourse'), 'error'));
 
-				}
-			}
-		}
-		unset($_SESSION['session_user_id']);
-		unset($_SESSION['session_user_name']);
-	}
+                }
+            }
+        }
+        unset($_SESSION['session_user_id']);
+        unset($_SESSION['session_user_name']);
+    }
 
     header('Location:'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'&type='.$type);
     exit;
@@ -132,12 +131,12 @@ if (isset($_POST['action'])) {
             $user_id_temp = $_SESSION['session_user_id'];
             $user_name_temp = $_SESSION['session_user_name'];
 
-			unset($_SESSION['session_user_id']);
- 			unset($_SESSION['session_user_name']);
-			$counter = 0;
-			$is_suscribe_counter = count($is_suscribe_user_id);
+            unset($_SESSION['session_user_id']);
+            unset($_SESSION['session_user_name']);
+            $counter = 0;
+            $is_suscribe_counter = count($is_suscribe_user_id);
 
-			$list_register_user='';
+            $list_register_user='';
 
             for ($i = 0; $i < $is_suscribe_counter; $i++) {
                 for ($j = 0; $j < count($user_id_temp); $j++) {
@@ -153,20 +152,20 @@ if (isset($_POST['action'])) {
                 }
             }
 
-			if (!empty($list_register_user)) {
+            if (!empty($list_register_user)) {
                 if ($is_suscribe_counter == 1) {
-					$register_user_message = $temp_unique_user.' '.get_lang('AddedToCourse');
-					Display::addFlash(Display::return_message($register_user_message));
-				} else {
-					$register_user_message = get_lang('UsersRegistered').'<br/><br />'.$list_register_user;
+                    $register_user_message = $temp_unique_user.' '.get_lang('AddedToCourse');
+                    Display::addFlash(Display::return_message($register_user_message));
+                } else {
+                    $register_user_message = get_lang('UsersRegistered').'<br/><br />'.$list_register_user;
                     Display::addFlash(Display::return_message($register_user_message, 'normal', false));
-				}
-			}
+                }
+            }
 
-			if (!empty($list_not_register_user)) {
-				$not_register_user_message = get_lang('UsersNotRegistered').'<br/><br /><br />'.$list_not_register_user;
+            if (!empty($list_not_register_user)) {
+                $not_register_user_message = get_lang('UsersNotRegistered').'<br/><br /><br />'.$list_not_register_user;
                 Display::addFlash(Display::return_message($not_register_user_message, 'error', false));
-			}
+            }
 
             header('Location:'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'&type='.$type);
             exit;
@@ -210,7 +209,7 @@ if (api_get_setting('show_email_addresses') == 'true') {
     $table->set_header($col ++, get_lang('Email'));
     $table->set_column_filter($col -1, 'email_filter');
 }
-$table->set_header($col ++, get_lang('Active'),false);
+$table->set_header($col++, get_lang('Active'), false);
 $table->set_column_filter($col -1, 'active_filter');
 $table->set_header($col ++, get_lang('Actions'), false);
 $table->set_column_filter($col -1, 'reg_filter');
@@ -308,7 +307,9 @@ function get_number_of_users()
 					$sql = "SELECT COUNT(u.user_id)
 							FROM $user_table u
 							LEFT JOIN $tbl_session_rel_course_user cu
-							ON u.user_id = cu.user_id and cu.c_id = '".api_get_course_int_id()."' AND session_id ='".api_get_session_id()."'
+							ON
+							    u.user_id = cu.user_id and cu.c_id = '".api_get_course_int_id()."' AND
+							    session_id ='".api_get_session_id()."'
 							INNER JOIN  $tbl_url_rel_user as url_rel_user
 							ON (url_rel_user.user_id = u.user_id)
 							WHERE
@@ -341,7 +342,6 @@ function get_number_of_users()
 				}
 			}
 		}
-
 	} else {
 		// students
 		if (api_get_session_id() != 0) {
@@ -423,7 +423,13 @@ function get_number_of_users()
 	// when there is a keyword then we are searching and we have to change the SQL statement
 	if (isset($_GET['keyword']) AND !empty($_GET['keyword'])) {
 		$keyword = Database::escape_string(trim($_REQUEST['keyword']));
-		$sql .= " AND (firstname LIKE '%".$keyword."%' OR lastname LIKE '%".$keyword."%'   OR email LIKE '%".$keyword."%'  OR username LIKE '%".$keyword."%'  OR official_code LIKE '%".$keyword."%')";
+		$sql .= " AND (
+		    firstname LIKE '%".$keyword."%' OR
+		    lastname LIKE '%".$keyword."%' OR
+		    email LIKE '%".$keyword."%' OR
+		    username LIKE '%".$keyword."%' OR
+		    official_code LIKE '%".$keyword."%'
+        )";
 
 		// we also want to search for users who have something in their profile fields that matches the keyword
 		if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {

+ 20 - 22
main/user/user.php

@@ -202,14 +202,14 @@ if (api_is_allowed_to_edit(null, true)) {
                 if (api_get_session_id()) {
                     $table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
                     $sql = "SELECT DISTINCT
-                                    user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").",
-                                    user.username,
-                                    $select_email_condition
-                                    phone,
-                                    user.official_code,
-                                    active
-                                    $legal
-                                  FROM $table_session_course_user as session_course_user, $table_users as user ";
+                                user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").",
+                                user.username,
+                                $select_email_condition
+                                phone,
+                                user.official_code,
+                                active
+                                $legal
+                            FROM $table_session_course_user as session_course_user, $table_users as user ";
                     if (api_is_multiple_url_enabled()) {
                         $sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
                     }
@@ -280,7 +280,6 @@ if (api_is_allowed_to_edit(null, true)) {
                 }
 
                 if ($sessionId == 0) {
-
                     // users directly subscribed to the course
                     $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
                     $sql = "SELECT DISTINCT
@@ -446,7 +445,6 @@ if (!$is_allowed_in_course) {
 // Statistics
 Event::event_access_tool(TOOL_USER);
 
-
 /**
  * Get the users to display on the current page.
  */
@@ -609,13 +607,13 @@ function get_user_data($from, $number_of_items, $column, $direction)
 
     foreach ($a_course_users as $user_id => $o_course_user) {
         if ((
-                isset($_GET['keyword']) &&
-                searchUserKeyword(
-                    $o_course_user['firstname'],
-                    $o_course_user['lastname'],
-                    $o_course_user['username'],
-                    $o_course_user['official_code'],
-                    $_GET['keyword'])
+            isset($_GET['keyword']) &&
+            searchUserKeyword(
+                $o_course_user['firstname'],
+                $o_course_user['lastname'],
+                $o_course_user['username'],
+                $o_course_user['official_code'],
+                $_GET['keyword'])
             ) || !isset($_GET['keyword']) || empty($_GET['keyword'])
         ) {
 
@@ -942,7 +940,7 @@ if (api_is_allowed_to_edit(null, true)) {
             $url = api_get_path(WEB_CODE_PATH).'user/subscribe_user.php?'.api_get_cidreq().'&type='.COURSEMANAGER;
             break;
     }
-    
+
     echo '<div class="row">';
     echo '<div class="col-md-6">';
     echo Display::url(
@@ -964,7 +962,7 @@ if (api_is_allowed_to_edit(null, true)) {
     $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&type=pdf">'.
         Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a> ';
     echo $actions;
-    
+
     echo '</div>';
     echo '<div class="col-md-6">';
     echo '<div class="pull-right">';
@@ -973,17 +971,17 @@ if (api_is_allowed_to_edit(null, true)) {
         $form->addText('keyword', '', false);
         $form->addButtonSearch(get_lang('SearchButton'));
         $form->display();
-    echo '</div>';    
     echo '</div>';
     echo '</div>';
-    
+    echo '</div>';
+
     $allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session');
     if (api_is_allowed_to_edit() && $allowTutors == 'true') {
         $actions .= ' <a class="btn btn-default" href="session_list.php?'.api_get_cidreq().'">'.
             get_lang('Sessions').'</a>';
     }
 
-   
+
 
     echo '</div>';
 }

+ 0 - 3
main/user/user_import.php

@@ -40,11 +40,9 @@ $type = '';
 
 if ($form->validate()) {
     if (isset($_FILES['import_file']['size']) && $_FILES['import_file']['size'] !== 0) {
-
         $unsubscribe_users = isset($_POST['unsubscribe_users']) ? true : false;
         //@todo : csvToArray deprecated
         $users  = Import::csvToArray($_FILES['import_file']['tmp_name']);
-
         $invalid_users  = array();
         $clean_users    = array();
 
@@ -134,7 +132,6 @@ if (!empty($message)) {
     } else {
         $empty_line_msg = ($empty_line == 0) ? get_lang('ErrorsWhenImportingFile'): get_lang('ErrorsWhenImportingFile').': '.get_lang('EmptyHeaderLine');
         Display::display_error_message($empty_line_msg);
-
     }
 }
 

+ 22 - 22
plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php

@@ -83,28 +83,28 @@ class BlockEvaluationGraph extends Block
                         </a></div>
                     </div>
                     <div class="panel-body">';
-                        if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
-                            $html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
-                        } else {
-                            // display evaluations base courses graph
-                            if (!empty($evaluations_base_courses_graph)) {
-                                foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
-                                    $html .= '<div><strong>'.$course_code.'</strong></div>';
-                                    $html .= $img_html;
-                                }
-                            }
-                            // display evaluations base courses graph
-                            if (!empty($evaluations_courses_in_sessions_graph)) {
-                                foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
-                                    $session_name = api_get_session_name($session_id);
-                                    $html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';
-                                    foreach ($courses as $course_code => $img_html) {
-                                        $html .= '<div><strong>'.$course_code.'</strong></div>';
-                                        $html .= $img_html;
-                                    }
-                                }
-                            }
-                        }
+        if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
+            $html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
+        } else {
+            // display evaluations base courses graph
+            if (!empty($evaluations_base_courses_graph)) {
+                foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
+                    $html .= '<div><strong>'.$course_code.'</strong></div>';
+                    $html .= $img_html;
+                }
+            }
+            // display evaluations base courses graph
+            if (!empty($evaluations_courses_in_sessions_graph)) {
+                foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
+                    $session_name = api_get_session_name($session_id);
+                    $html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';
+                    foreach ($courses as $course_code => $img_html) {
+                        $html .= '<div><strong>'.$course_code.'</strong></div>';
+                        $html .= $img_html;
+                    }
+                }
+            }
+        }
 		$html .= '</div>
 			     </div>';
 

+ 1 - 1
plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php

@@ -195,7 +195,7 @@ class BlockTeacherGraph extends Block
             }
             $graph = '<img src="' . $imgPath . '" >';
 		} else {
-			$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
+			$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8').'</p>';
 		}
 
  		return $graph;

+ 2 - 8
whoisonline.php

@@ -16,19 +16,13 @@ if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
 }
 
 $_SESSION['who_is_online_counter'] = 2;
-
-//$htmlHeadXtra[] = api_get_js('jquery.endless-scroll.js');
-//social tab
 $this_section = SECTION_SOCIAL;
 // table definitions
 $track_user_table = Database::get_main_table(TABLE_MAIN_USER);
-$htmlHeadXtra[] = '<script>
-
-
-</script>';
 
 $social_right_content = null;
 $whoisonline_list = null;
+$social_search = '';
 
 /* if (isset($_GET['chatid'])) {
     //send out call request
@@ -68,7 +62,7 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
             if (api_get_setting('allow_social_tool') == 'true') {
                 if (!api_is_anonymous()) {
                     $query = isset($_GET['q']) ? $_GET['q']: null;
-                    $social_search .= UserManager::get_search_form($query);
+                    $social_search = UserManager::get_search_form($query);
                 }
             }
             //$social_right_content .= SocialManager::display_user_list($user_list);