Fixing queries due the single database see #3910

skala
Julio Montoya 14 years ago
parent e6fc393767
commit 2dff2a39a3
  1. 2
      main/group/group.php
  2. 2
      main/inc/lib/database.lib.php
  3. 8
      main/mySpace/index.php
  4. 18
      main/mySpace/myStudents.php
  5. 3
      main/mySpace/myspace.lib.php
  6. 3
      main/mySpace/student.php
  7. 18
      main/tracking/courseLog.php
  8. 4
      main/tracking/exams.php

@ -156,7 +156,7 @@ if (api_is_allowed_to_edit(false, true)) {
echo '<div class="actions">';
if (api_is_allowed_to_edit(false, true)) {
echo '<a href="group_creation.php?'.api_get_cidreq().'">'.Display::return_icon('new_group.png', get_lang('NewGroupCreate'),'','32').'</a>';
if (Database::count_rows(Database::get_course_table(TABLE_GROUP)) > 0) {
if (CourseManager::count_rows_course_table(Database::get_course_table(TABLE_GROUP),api_get_session_id(), api_get_course_int_id())) > 0) {
//echo '<a href="group_overview.php?'.api_get_cidreq().'">'.Display::return_icon('group_view.gif').'&nbsp;'.get_lang('GroupOverview').'</a>&nbsp;';
echo '<a href="group_overview.php?'.api_get_cidreq().'">'.Display::return_icon('group_summary.png', get_lang('GroupOverview'),'','32').'</a>';
}

@ -378,7 +378,7 @@ class Database {
* @return int The number of rows in the given table.
*/
public static function count_rows($table) {
$obj = self::fetch_object(self::query("SELECT COUNT(*) AS n FROM $table WHERE c_id = ".api_get_course_int_id())); //
$obj = self::fetch_object(self::query("SELECT COUNT(*) AS n FROM $table")); //
return $obj->n;
}

@ -367,10 +367,10 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') {
$table->set_additional_parameters($parameters);
$table -> set_header(0, get_lang('CourseTitle'), false, 'align="center"');
$table -> set_header(1, get_lang('NbStudents'), false);
$table -> set_header(2, get_lang('AvgTimeSpentInTheCourse').Display :: return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(3, get_lang('AvgStudentsProgress').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(4, get_lang('AvgCourseScore').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(5, get_lang('AvgExercisesScore').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(2, get_lang('AvgTimeSpentInTheCourse').' '.Display :: return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(3, get_lang('AvgStudentsProgress').' '.Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(4, get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(5, get_lang('AvgExercisesScore').' '.Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
$table -> set_header(6, get_lang('AvgMessages'), false);
$table -> set_header(7, get_lang('AvgAssignments'), false);
$table -> set_header(8, get_lang('Details'), false);

@ -511,11 +511,11 @@ if (!empty($student_id)) {
<td align="left"><?php echo $time_spent_on_the_course ?></td>
</tr>
<tr>
<td align="right"><?php echo get_lang('Progress'); Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));?></td>
<td align="right"><?php echo get_lang('Progress').' '; Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));?></td>
<td align="left"><?php echo $avg_student_progress.'%' ?></td>
</tr>
<tr>
<td align="right"><?php echo get_lang('Score'); Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
<td align="right"><?php echo get_lang('Score').' '; Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
</td>
<td align="left"><?php if (is_numeric($avg_student_score)) { echo $avg_student_score.'%';} else { echo $avg_student_score ;} ?></td>
</tr>
@ -634,7 +634,7 @@ if (empty($_GET['details'])) {
$scoretotal_display = '0/0 (0%)';
if (!empty($scoretotal)) {
$scoretotal_display = round($scoretotal[0],2).'/'.round($scoretotal[1],2).'('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
$scoretotal_display = round($scoretotal[0],1).'/'.round($scoretotal[1],1).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
}
$progress = Tracking::get_avg_student_progress($info_user['user_id'], $course_code, null, $session_id);
@ -712,11 +712,11 @@ if (empty($_GET['details'])) {
<table class="data_table">
<tr>
<th><?php echo get_lang('Learnpaths');?></th>
<th><?php echo get_lang('Time'); Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('AverageScore'); Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('LatestAttemptAverageScore'); Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('Progress'); Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
<th><?php echo get_lang('LastConnexion'); Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
<th><?php echo get_lang('Time').' '; Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('AverageScore').' '; Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('LatestAttemptAverageScore').' '; Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
<th><?php echo get_lang('Progress').' '; Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
<th><?php echo get_lang('LastConnexion').' '; Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
<?php
echo '<th>'.get_lang('Details').'</th>';
if (api_is_course_admin()) {
@ -841,7 +841,7 @@ if (empty($_GET['details'])) {
<table class="data_table">
<tr>
<th><?php echo get_lang('Exercices'); ?></th>
<th><?php echo get_lang('AverageScore').Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
<th><?php echo get_lang('AverageScore').' '.Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
<th><?php echo get_lang('Attempts'); ?></th>
<th><?php echo get_lang('LatestAttempt'); ?></th>
<th><?php echo get_lang('AllAttempts'); ?></th>

@ -2,7 +2,6 @@
/* For licensing terms, see /license.txt */
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
class MySpace {
@ -1346,7 +1345,7 @@ class MySpace {
// database table definition
$access_url_id = api_get_current_access_url_id();
$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
$main_user_table = Database::get_main_table(TABLE_MAIN_USER);
if ($_configuration['multiple_access_urls']) {
$condition_multi_url = ", $tbl_url_rel_user as url_user WHERE user.user_id=url_user.user_id AND access_url_id='$access_url_id'";

@ -280,6 +280,9 @@ if (api_is_allowed_to_create_course() || api_is_drh()) {
$row[] = $string_date;
if ($export_csv) {
$row[count($row) - 1] = strip_tags($row[count($row) - 1]);
$row[count($row) - 2] = strip_tags($row[count($row) - 2]);
$csv_content[] = $row;
}

@ -12,7 +12,7 @@ $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
// Language files that need to be included.
$language_file = array('admin', 'tracking','scorm');
// Including the global initialization file.
// Including the global initialization file
require_once '../inc/global.inc.php';
$from_myspace = false;
@ -534,16 +534,21 @@ if ($_GET['studentlist'] == 'false') {
$table->set_header(10, get_lang('Survey'), false);
$table->set_header(11, get_lang('FirstLogin'), false, 'align="center"');
$table->set_header(12, get_lang('LatestLogin'), false, 'align="center"');
$table->set_header(13, get_lang('AdditionalProfileField'), false);
$table->set_header(14, get_lang('Details'), false);
if (isset($_GET['additional_profile_field']) AND is_numeric($_GET['additional_profile_field'])) {
$table->set_header(13, $extra_info['field_display_text'], false);
$table->set_header(14, get_lang('Details'), false);
} else {
$table->set_header(13, get_lang('Details'), false);
}
} else {
$table->set_header(10, get_lang('FirstLogin'), false, 'align="center"');
$table->set_header(11, get_lang('LatestLogin'), false, 'align="center"');
if (isset($_GET['additional_profile_field']) AND is_numeric($_GET['additional_profile_field'])) {
$table->set_header(12, $extra_info['field_display_text'], false);
$table->set_header(13, get_lang('Details'), false);
} else {
$table->set_header(13, get_lang('Details'), false);
} else {
$table->set_header(12, get_lang('Details'), false);
}
}
@ -577,8 +582,7 @@ if ($_GET['studentlist'] == 'false') {
}
$csv_headers[] = get_lang('FirstLogin', '');
$csv_headers[] = get_lang('LatestLogin', '');
$csv_headers[] = get_lang('LatestLogin', '');
if (isset($_GET['additional_profile_field']) AND is_numeric($_GET['additional_profile_field'])) {
$csv_headers[] = $extra_info['field_display_text'];

@ -120,7 +120,7 @@ if (!$export_to_xls) {
if ($global) {
$html_result .= '<table class="data_table">';
$html_result .= '<tr><th>'.get_lang('Courses').'</th>';
$html_result .= '<th>'.get_lang('Exercises').'</th>';
$html_result .= '<th>'.get_lang('Quiz').'</th>';
$html_result .= '<th>'.get_lang('ExamTaken').'</th>';
$html_result .= '<th>'.get_lang('ExamNotTaken').'</th>';
$html_result .= '<th>'.sprintf(get_lang('ExamPassX'), $filter_score).'%</th>';
@ -129,7 +129,7 @@ if ($global) {
$html_result .= '</tr>';
} else {
$html_result .= '<table class="data_table">';
$html_result .= '<tr><th>'.get_lang('Exercises').'</th>';
$html_result .= '<tr><th>'.get_lang('Quiz').'</th>';
$html_result .= '<th>'.get_lang('User').'</th>';
//$html_result .= '<th>'.sprintf(get_lang('ExamPassX'), $filter_score).'</th>';
$html_result .= '<th>'.get_lang('Percentage').' %</th>';

Loading…
Cancel
Save