Minor - format code.

pull/2487/head
jmontoyaa 9 years ago
parent af1b9d2469
commit d5719ce226
  1. 34
      main/inc/lib/tracking.lib.php
  2. 74
      main/mySpace/myStudents.php

@ -2891,13 +2891,18 @@ class Tracking
/**
* This function gets last connection time to one learning path
* @param int|array Student id(s)
* @param string Course code
* @param int Learning path id
* @return int Total time
* @param int|array $student_id Student id(s)
* @param string $course_code Course code
* @param int $lp_id Learning path id
* @param int $session_id
* @return int Total time
*/
public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0)
{
public static function get_last_connection_time_in_lp(
$student_id,
$course_code,
$lp_id,
$session_id = 0
) {
$course = CourseManager :: get_course_information($course_code);
$student_id = intval($student_id);
$lp_id = intval($lp_id);
@ -2905,16 +2910,15 @@ class Tracking
$session_id = intval($session_id);
if (!empty($course)) {
$course_id = $course['real_id'];
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$t_lpv = Database :: get_course_table(TABLE_LP_VIEW);
$t_lpiv = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = $course['real_id'];
$lp_table = Database:: get_course_table(TABLE_LP_MAIN);
$t_lpv = Database:: get_course_table(TABLE_LP_VIEW);
$t_lpiv = Database:: get_course_table(TABLE_LP_ITEM_VIEW);
// Check the real number of LPs corresponding to the filter in the
// database (and if no list was given, get them all)
$res_row_lp = Database::query("SELECT id FROM $lp_table WHERE c_id = $course_id AND id = $lp_id ");
$sql = "SELECT id FROM $lp_table WHERE c_id = $course_id AND id = $lp_id ";
$res_row_lp = Database::query($sql);
$count_row_lp = Database::num_rows($res_row_lp);
// calculates last connection time
@ -2922,7 +2926,7 @@ class Tracking
$sql = 'SELECT MAX(start_time)
FROM ' . $t_lpiv . ' AS item_view
INNER JOIN ' . $t_lpv . ' AS view
ON item_view.lp_view_id = view.id
ON (item_view.lp_view_id = view.id)
WHERE
item_view.c_id = '.$course_id.' AND
view.c_id = '.$course_id.' AND
@ -2941,7 +2945,7 @@ class Tracking
/**
* gets the list of students followed by coach
* @param int Coach id
* @param int $coach_id Coach id
* @return array List of students
*/
public static function get_student_followed_by_coach($coach_id)

@ -1,6 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CLp;
/**
* Implements the tracking of students in the Reporting pages
* @package chamilo.reporting
@ -74,7 +75,7 @@ if ($export) {
$csv_content = array();
$from_myspace = false;
if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
$from_myspace = true;
$this_section = SECTION_TRACKING;
} else {
@ -203,7 +204,10 @@ switch ($action) {
break;
case 'delete_legal':
$extraFieldValue = new ExtraFieldValue('user');
$value = $extraFieldValue->get_values_by_handler_and_field_variable($student_id, 'legal_accept');
$value = $extraFieldValue->get_values_by_handler_and_field_variable(
$student_id,
'legal_accept'
);
$result = $extraFieldValue->delete($value['id']);
if ($result) {
Display::addFlash(Display::return_message(get_lang('Deleted')));
@ -477,17 +481,19 @@ if (!empty($student_id)) {
$coachs_name = '';
$session_name = '';
$table_title = Display::return_icon(
'user.png',
get_lang('User'),
array(),
ICON_SIZE_SMALL
).$user_info['complete_name'];
'user.png',
get_lang('User'),
array(),
ICON_SIZE_SMALL
).$user_info['complete_name'];
echo Display::page_subheader($table_title);
$userPicture = UserManager::getUserPicture($user_info['user_id']);
$userGroupManager = new UserGroup();
$userGroups = $userGroupManager->getNameListByUser($user_info['user_id'], UserGroup::NORMAL_CLASS);
$userGroups = $userGroupManager->getNameListByUser(
$user_info['user_id'],
UserGroup::NORMAL_CLASS
);
?>
<img src="<?php echo $userPicture ?>">
<div class="row">
@ -503,9 +509,11 @@ if (!empty($student_id)) {
<td><?php echo get_lang('Name') . ' : '.$user_info['complete_name']; ?></td>
</tr>
<tr>
<td><?php echo get_lang('Email') . ' : ';
if (!empty ($user_info['email'])) {
echo '<a href="mailto:' . $user_info['email'] . '">' . $user_info['email'] . '</a>';
<td>
<?php
echo get_lang('Email') . ' : ';
if (!empty($user_info['email'])) {
echo '<a href="mailto:'.$user_info['email'].'">'.$user_info['email'].'</a>';
} else {
echo get_lang('NoEmail');
} ?>
@ -513,7 +521,7 @@ if (!empty($student_id)) {
</tr>
<tr>
<td> <?php echo get_lang('Tel') . ' : ';
if (!empty ($user_info['phone'])) {
if (!empty($user_info['phone'])) {
echo $user_info['phone'];
} else {
echo get_lang('NoTel');
@ -522,8 +530,10 @@ if (!empty($student_id)) {
</td>
</tr>
<tr>
<td> <?php echo get_lang('OfficialCode') . ' : ';
if (!empty ($user_info['official_code'])) {
<td>
<?php
echo get_lang('OfficialCode').' : ';
if (!empty($user_info['official_code'])) {
echo $user_info['official_code'];
} else {
echo get_lang('NoOfficialCode');
@ -547,7 +557,10 @@ if (!empty($student_id)) {
// Display timezone if the user selected one and if the admin allows the use of user's timezone
$timezone = null;
$timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'], 'timezone');
$timezone_user = UserManager::get_extra_user_data_by_field(
$user_info['user_id'],
'timezone'
);
$use_users_timezone = api_get_setting('use_users_timezone', 'timezones');
if ($timezone_user['timezone'] != null && $use_users_timezone == 'true') {
$timezone = $timezone_user['timezone'];
@ -621,7 +634,6 @@ if (!empty($student_id)) {
if (api_get_setting('allow_terms_conditions') === 'true') {
$isBoss = UserManager::userIsBossOfStudent(api_get_user_id(), $student_id);
if ($isBoss || api_is_platform_admin()) {
$extraFieldValue = new ExtraFieldValue('user');
$value = $extraFieldValue->get_values_by_handler_and_field_variable($student_id, 'legal_accept');
@ -689,11 +701,11 @@ if (!empty($student_id)) {
$access_end_date = '';
$date_session = '';
$title = Display::return_icon(
'course.png',
get_lang('Courses'),
array(),
ICON_SIZE_SMALL
).' '.get_lang('Courses');
'course.png',
get_lang('Courses'),
array(),
ICON_SIZE_SMALL
).' '.get_lang('Courses');
$session_info = api_get_session_info($sId);
if ($session_info) {
@ -734,14 +746,22 @@ if (!empty($student_id)) {
$courseInfoItem = api_get_course_info_by_id($courseId);
$courseId = $courseInfoItem['real_id'];
$courseCodeItem = $courseInfoItem['code'];
if (CourseManager :: is_user_subscribed_in_course($student_id, $courseCodeItem, true)) {
$isSubscribed = CourseManager:: is_user_subscribed_in_course(
$student_id,
$courseCodeItem,
true
);
if ($isSubscribed) {
$time_spent_on_course = api_time_to_hms(
Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sId)
);
// get average of faults in attendances by student
$results_faults_avg = $attendance->get_faults_average_by_course($student_id, $courseCodeItem, $sId);
$results_faults_avg = $attendance->get_faults_average_by_course(
$student_id,
$courseCodeItem,
$sId
);
if (!empty($results_faults_avg['total'])) {
if (api_is_drh()) {
$attendances_faults_avg =
@ -780,7 +800,7 @@ if (!empty($student_id)) {
$scoretotal_display = '0/0 (0%)';
if (!empty($scoretotal) && !empty($scoretotal[1])) {
$scoretotal_display =
round($scoretotal[0], 1 ).'/'.
round($scoretotal[0], 1).'/'.
round($scoretotal[1], 1).
' ('.round(($scoretotal[0] / $scoretotal[1]) * 100, 2).' %)';
}
@ -949,7 +969,7 @@ if (!empty($student_id)) {
<?php
$i = 0;
/** @var \Chamilo\CourseBundle\Entity\CLp $learnpath */
/** @var CLp $learnpath */
foreach ($lps as $learnpath) {
$lp_id = $learnpath->getId();
$lp_name = $learnpath->getName();

Loading…
Cancel
Save