Minor - format code

1.9.x
Julio Montoya 11 years ago
parent b7e206ca2d
commit 2a90cccbd7
  1. 27
      main/inc/lib/course.lib.php
  2. 15
      main/inc/lib/sessionmanager.lib.php
  3. 14
      main/inc/lib/tracking.lib.php
  4. 11
      main/mySpace/index.php

@ -2782,7 +2782,8 @@ class CourseManager {
* @param int human resources manager id
* @return array courses
*/
public static function get_courses_followed_by_drh($user_id) {
public static function get_courses_followed_by_drh($user_id)
{
// Database Table Definitions
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
@ -2793,10 +2794,21 @@ class CourseManager {
if (api_get_multiple_access_url()) {
$sql = "SELECT *, id as real_id FROM $tbl_course c
INNER JOIN $tbl_course_rel_user cru ON (cru.course_code = c.code) LEFT JOIN $tbl_course_rel_access_url a ON (a.course_code = c.code) WHERE cru.user_id = '$user_id' AND status = ".DRH." AND relation_type = '".COURSE_RELATION_TYPE_RRHH."' AND access_url_id = ".api_get_current_access_url_id()."";
INNER JOIN $tbl_course_rel_user cru ON (cru.course_code = c.code)
LEFT JOIN $tbl_course_rel_access_url a ON (a.course_code = c.code)
WHERE
cru.user_id = '$user_id' AND
status = ".DRH." AND
relation_type = '".COURSE_RELATION_TYPE_RRHH."' AND
access_url_id = ".api_get_current_access_url_id()."";
} else {
$sql = "SELECT *, id as real_id FROM $tbl_course c
INNER JOIN $tbl_course_rel_user cru ON cru.course_code = c.code AND cru.user_id = '$user_id' AND status = ".DRH." AND relation_type = '".COURSE_RELATION_TYPE_RRHH."' ";
INNER JOIN $tbl_course_rel_user cru
ON
cru.course_code = c.code AND
cru.user_id = '$user_id' AND
status = ".DRH." AND
relation_type = '".COURSE_RELATION_TYPE_RRHH."' ";
}
$rs_assigned_courses = Database::query($sql);
if (Database::num_rows($rs_assigned_courses) > 0) {
@ -2811,12 +2823,15 @@ class CourseManager {
* check if a course is special (autoregister)
* @param string course code
*/
public static function is_special_course($course_code){
public static function is_special_course($course_code)
{
$tbl_course_field_value = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
$tbl_course_field = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
$is_special = false;
$sql = "SELECT course_code FROM $tbl_course_field_value tcfv INNER JOIN $tbl_course_field tcf ON " .
" tcfv.field_id = tcf.id WHERE tcf.field_variable = 'special_course' AND tcfv.field_value = 1 AND course_code='$course_code'";
$sql = "SELECT course_code
FROM $tbl_course_field_value tcfv
INNER JOIN $tbl_course_field tcf ON tcfv.field_id = tcf.id
WHERE tcf.field_variable = 'special_course' AND tcfv.field_value = 1 AND course_code='$course_code'";
$result = Database::query($sql);
$num_rows = Database::num_rows($result);
if ($num_rows > 0){

@ -1541,11 +1541,20 @@ class SessionManager
$assigned_sessions_to_hrm = array();
if (api_is_multiple_url_enabled()) {
$sql = "SELECT * FROM $tbl_session s INNER JOIN $tbl_session_rel_user sru ON (sru.id_session = s.id) LEFT JOIN $tbl_session_rel_access_url a ON (s.id = a.session_id)
WHERE sru.id_user = '$hr_manager_id' AND sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND access_url_id = ".api_get_current_access_url_id()."";
$sql = "SELECT * FROM $tbl_session s
INNER JOIN $tbl_session_rel_user sru ON (sru.id_session = s.id)
LEFT JOIN $tbl_session_rel_access_url a ON (s.id = a.session_id)
WHERE
sru.id_user = '$hr_manager_id' AND
sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND
access_url_id = ".api_get_current_access_url_id()."";
} else {
$sql = "SELECT * FROM $tbl_session s
INNER JOIN $tbl_session_rel_user sru ON sru.id_session = s.id AND sru.id_user = '$hr_manager_id' AND sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' ";
INNER JOIN $tbl_session_rel_user sru
ON
sru.id_session = s.id AND
sru.id_user = '$hr_manager_id' AND
sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' ";
}
$rs_assigned_sessions = Database::query($sql);
if (Database::num_rows($rs_assigned_sessions) > 0) {

@ -1312,13 +1312,13 @@ class Tracking {
* @param int Coach id
* @return array Sessions list
*/
public static function get_sessions_coached_by_user($coach_id) {
public static function get_sessions_coached_by_user($coach_id)
{
// table definition
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
// protect datas
$coach_id = intval($coach_id);
// session where we are general coach
@ -1326,7 +1326,6 @@ class Tracking {
FROM ' . $tbl_session . '
WHERE id_coach=' . $coach_id;
global $_configuration;
if (api_is_multiple_url_enabled()) {
$tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
@ -1350,7 +1349,6 @@ class Tracking {
ON session.id = session_course_user.id_session
AND session_course_user.id_user=' . $coach_id.' AND session_course_user.status=2';
global $_configuration;
if (api_is_multiple_url_enabled()) {
$tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
@ -1381,12 +1379,10 @@ class Tracking {
$time_end = mktime(0, 0, 0, $date_end[1], $date_end[2], $date_end[0]);
if ($time_start < time() && time() < $time_end) {
$session['status'] = get_lang('SessionActive');
}
else{
} else {
if (time() < $time_start) {
$session['status'] = get_lang('SessionFuture');
}
else{
} else {
if (time() > $time_end) {
$session['status'] = get_lang('SessionPast');
}
@ -1395,8 +1391,8 @@ class Tracking {
}
}
}
return $a_sessions;
return $a_sessions;
}
/**

@ -20,7 +20,8 @@ require_once 'myspace.lib.php';
// the section (for the tabs)
$this_section = SECTION_TRACKING;
unset($_SESSION['this_section']);//for hmtl editor repository
//for HTML editor repository
unset($_SESSION['this_section']);
ob_start();
@ -189,7 +190,7 @@ echo '</div>';
if (empty($session_id)) {
//Getting courses followed by a coach (No session courses)
// Getting courses followed by a coach (No session courses)
$courses = CourseManager::get_course_list_as_coach($user_id, false);
if (isset($courses[0])) {
@ -202,10 +203,10 @@ if (empty($session_id)) {
// Sessions for the coach
$sessions = Tracking::get_sessions_coached_by_user($user_id);
//If is drh
// If is drh
if ($is_drh) {
$students = array_keys(UserManager::get_users_followed_by_drh($user_id, STUDENT));
$courses_of_the_platform = CourseManager :: get_courses_followed_by_drh($user_id);
$courses_of_the_platform = CourseManager::get_courses_followed_by_drh($user_id);
foreach ($courses_of_the_platform as $course) {
$courses[$course['code']] = $course['code'];
@ -331,12 +332,10 @@ if (empty($session_id)) {
<td>'.get_lang('InactivesStudents').'</td>
<td align="right">'.$nb_inactive_students.'</td>
</tr>
<tr>
<td>'.get_lang('AverageTimeSpentOnThePlatform').'</td>
<td align="right">'.(is_null($avg_time_spent) ? '' : api_time_to_hms($avg_time_spent)).'</td>
</tr>
<tr>
<td>'.get_lang('AverageProgressInLearnpath').'</td>
<td align="right">'.(is_null($avg_total_progress) ? '' : round($avg_total_progress, 2).'%').'</td>

Loading…
Cancel
Save