Minor - format code, fix PHP warnings.

1.10.x
Julio Montoya 11 years ago
parent 87990e9dda
commit 254eaf32e4
  1. 3
      main/admin/course_export.php
  2. 15
      main/admin/course_import.php
  3. 2
      main/admin/session_category_add.php
  4. 1
      main/admin/user_information.php
  5. 17
      main/inc/lib/usermanager.lib.php
  6. 45
      main/mySpace/myStudents.php
  7. 2
      main/tracking/courseLog.php

@ -86,9 +86,8 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
if (!empty($msg)) {
Display::display_normal_message($msg, false);
}
// @todo use FormValidator!
?>
<form method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;">
<input type="hidden" name="formSent" value="1">
<legend><?php echo $tool_name; ?></legend>

@ -112,12 +112,12 @@ function save_data($courses)
}
$params = array();
$params['title'] = $course['Title'];
$params['wanted_code'] = $course['Code'];
$params['tutor_name'] = null;
$params['course_category'] = $course['CourseCategory'];
$params['course_language'] = $course_language;
$params['user_id'] = $creatorId;
$params['title'] = $course['Title'];
$params['wanted_code'] = $course['Code'];
$params['tutor_name'] = null;
$params['course_category'] = $course['CourseCategory'];
$params['course_language'] = $course_language;
$params['user_id'] = $creatorId;
$addMeAsTeacher = isset($_POST['add_me_as_teacher']) ? $_POST['add_me_as_teacher'] : false;
$params['add_user_as_teacher'] = $addMeAsTeacher;
@ -211,9 +211,8 @@ $form = new FormValidator('import', 'post', api_get_self(), null, array('enctype
$form->addHeader($tool_name);
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
$form->addElement('checkbox', 'add_me_as_teacher', null, get_lang('AddMeAsTeacherInCourses'));
$form->addElement('button', 'save', get_lang('Import'));
$form->addButtonImport(get_lang('Import'), 'save');
$form->addElement('hidden', 'formSent', 1);
//$form->setDefaults(array('add_me_as_teacher' => 0));
$form->display();
?>

@ -63,7 +63,7 @@ if (!empty($return)) {
<tr >
<td colspan="2">
<a href="javascript://" onclick="if(document.getElementById('options').style.display == 'none'){document.getElementById('options').style.display = 'block';}else{document.getElementById('options').style.display = 'none';}"><?php echo get_lang('AddTimeLimit') ?></a>
<div style="display: <?php if($formSent && ($nb_days_acess_before!=0 || $nb_days_acess_after!=0)) echo 'block'; else echo 'none'; ?>;" id="options">
<div style="display: none" id="options">
<br>
<div>
<table border="0" cellpadding="5" cellspacing="0" width="100%">

@ -154,7 +154,6 @@ if (count($sessions) > 0) {
$csvContent[] = array($session_item['session_name']);
$csvContent[] = $headerList;
foreach ($session_item['courses'] as $my_course) {
$courseInfo = api_get_course_info($my_course['code']);
$sessionStatus = SessionManager::get_user_status_in_session(

@ -2831,10 +2831,10 @@ class UserManager
public static function get_courses_list_by_session($user_id, $session_id)
{
// Database Table Definitions
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tableCourse = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$user_id = intval($user_id);
$session_id = intval($session_id);
@ -2842,11 +2842,11 @@ class UserManager
$join_access_url = $where_access_url = '';
if (api_get_multiple_access_url()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$urlId = api_get_current_access_url_id();
if ($urlId != -1) {
$tbl_url_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$join_access_url = " , $tbl_url_session url_rel_session ";
$where_access_url = " AND access_url_id = $access_url_id AND url_rel_session.session_id = $session_id ";
$where_access_url = " AND access_url_id = $urlId AND url_rel_session.session_id = $session_id ";
}
}
@ -2858,7 +2858,8 @@ class UserManager
to our user or not */
$sql = "SELECT DISTINCT
c.visibility, c.id as real_id
c.visibility,
c.id as real_id
FROM $tbl_session_course_user as scu
INNER JOIN $tbl_session_course sc
ON (scu.session_id = sc.session_id AND scu.c_id = sc.c_id)

@ -45,7 +45,7 @@ if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
$nameTools = get_lang('StudentDetails');
$get_course_code = Security :: remove_XSS($_GET['course']);
$get_course_code = isset($_GET['course']) ? Security :: remove_XSS($_GET['course']) : '';
if (isset($_GET['details'])) {
if (!empty ($_GET['origin']) && $_GET['origin'] == 'user_course') {
@ -157,7 +157,7 @@ if (isset($_GET['user_id']) && $_GET['user_id'] != "") {
$user_id = api_get_user_id();
}
$session_id = intval($_GET['id_session']);
$session_id = isset($_GET['id_session']) ? intval($_GET['id_session']) : 0;
if (empty($session_id)) {
$session_id = api_get_session_id();
}
@ -186,7 +186,8 @@ if ($check) {
$session_id
);
//@todo delete the stats.track_e_exercises records. First implement this http://support.chamilo.org/issues/1334
// @todo delete the stats.track_e_exercises records.
// First implement this http://support.chamilo.org/issues/1334
$message = Display::return_message(
get_lang('LPWasReset'),
'success'
@ -345,10 +346,12 @@ if (!empty($student_id)) {
// get average of score and average of progress by student
$avg_student_progress = $avg_student_score = 0;
$course_code = Security :: remove_XSS($_GET['course']);
$course_code = isset($_GET['course']) ? Security :: remove_XSS($_GET['course']) : '';
if (!CourseManager :: is_user_subscribed_in_course($user_info['user_id'], $course_code, true)) {
unset($courses[$key]);
if (isset($courses[$key])) {
unset($courses[$key]);
}
} else {
$avg_student_progress = Tracking::get_avg_student_progress(
@ -372,13 +375,16 @@ if (!empty($student_id)) {
// time spent on the course
$courseInfo = api_get_course_info($course_code);
$time_spent_on_the_course = api_time_to_hms(
Tracking:: get_time_spent_on_the_course(
$user_info['user_id'],
$courseInfo['real_id'],
$session_id
)
);
$time_spent_on_the_course = 0;
if (!empty($courseInfo)) {
$time_spent_on_the_course = api_time_to_hms(
Tracking:: get_time_spent_on_the_course(
$user_info['user_id'],
$courseInfo['real_id'],
$session_id
)
);
}
// get information about connections on the platform by student
$first_connection_date = Tracking :: get_first_connection_date($user_info['user_id']);
@ -622,9 +628,12 @@ if (!empty($student_id)) {
$attendance = new Attendance();
foreach ($courses_in_session as $key => $courses) {
$session_id = $key;
$session_id = $key;
$session_info = api_get_session_info($session_id);
$session_name = $session_info['name'];
$session_name = '';
if ($session_info) {
$session_name = $session_info['name'];
}
$date_start = '';
if (!empty($session_info['date_start']) && $session_info['date_start'] != '0000-00-00') {
@ -721,10 +730,12 @@ if (!empty($student_id)) {
<td >'.$attendances_faults_avg.'</td>
<td >'.$scoretotal_display.'</td>';
if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent">
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
} else {
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent">
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
}
echo '</tr>';
}

@ -18,7 +18,7 @@ $from = isset($_GET['from']) ? $_GET['from'] : null;
// Starting the output buffering when we are exporting the information.
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$session_id = intval($_REQUEST['id_session']);
$session_id = isset($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : 0;
if ($from == 'myspace') {
$from_myspace = true;

Loading…
Cancel
Save