diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php
index 6b5e8ee12f..1d8287d33a 100755
--- a/main/exercice/exercice.php
+++ b/main/exercice/exercice.php
@@ -333,10 +333,7 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook']=='view' ) {
}
if (!empty($gradebook) && $gradebook=='view') {
- $interbreadcrumb[] = array (
- 'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
- 'name' => get_lang('ToolGradebook')
- );
+ $interbreadcrumb[] = array ('url' => '../gradebook/' . $_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook'));
}
if ($show != 'result') {
@@ -344,16 +341,10 @@ if ($show != 'result') {
} else {
if ($is_allowedToEdit || $is_tutor) {
$nameTools = get_lang('StudentScore');
- $interbreadcrumb[] = array (
- "url" => "exercice.php?gradebook=$gradebook",
- "name" => get_lang('Exercices')
- );
+ $interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
} else {
$nameTools = get_lang('YourScore');
- $interbreadcrumb[] = array (
- "url" => "exercice.php?gradebook=$gradebook",
- "name" => get_lang('Exercices')
- );
+ $interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
}
}
@@ -406,8 +397,7 @@ if (!empty ($_POST['export_report']) && $_POST['export_report'] == 'export_repor
require_once ('exercise_result.class.php');
switch ($_POST['export_format']) {
case 'xls' :
- $export = new ExerciseResult();
-
+ $export = new ExerciseResult();
$export->exportCompleteReportXLS($documentPath, $user_id, $_SESSION['export_user_fields'], $_POST['export_filter']);
exit;
break;
@@ -465,7 +455,6 @@ if ($is_allowedToEdit) {
switch ($choice) {
case 'delete' : // deletes an exercise
$objExerciseTmp->delete();
-
//delete link of exercise of gradebook tool
$sql = 'SELECT gl.id FROM ' . $tbl_grade_link . ' gl WHERE gl.type="1" AND gl.ref_id="' . $exerciseId . '";';
$result = Database::query($sql);
@@ -512,7 +501,6 @@ if ($is_allowedToEdit) {
}
}
}
-
// destruction of Exercise
unset ($objExerciseTmp);
Security::clear_token();
@@ -555,13 +543,6 @@ if ($is_allowedToEdit) {
break;
}
}
- if ($show == 'test') {
- $sql = "SELECT id,title,type,active,description, results_disabled FROM $TBL_EXERCICES WHERE active<>'-1' ORDER BY title LIMIT " . (int) $from . "," . (int) ($limitExPage +1);
- $result = Database::query($sql);
- }
-} elseif ($show == 'test') { // only for students
- $sql = "SELECT id,title,type,description, results_disabled FROM $TBL_EXERCICES WHERE active='1' ORDER BY title LIMIT " . (int) $from . "," . (int) ($limitExPage +1);
- $result = Database::query($sql);
}
// the actions
@@ -584,7 +565,8 @@ if ($is_allowedToEdit) {
$sql = "SELECT id, title, type, active, description, results_disabled, session_id, start_time, end_time, random,max_attempt FROM $TBL_EXERCICES WHERE active<>'-1' $condition_session ORDER BY title LIMIT " . (int) $from . "," . (int) ($limitExPage +1);
$result = Database::query($sql);
}
-} elseif ($show == 'test') { // only for students
+} elseif ($show == 'test') {
+ // only for students
$sql = "SELECT id, title, type, description, results_disabled, session_id, start_time, end_time FROM $TBL_EXERCICES WHERE active='1' $condition_session ORDER BY title LIMIT " . (int) $from . "," . (int) ($limitExPage +1);
$result = Database::query($sql);
}
@@ -627,14 +609,14 @@ if ($show == 'test') {
echo '';
}
-if (($is_allowedToEdit) and ($origin != 'learnpath')) {
+if ($is_allowedToEdit && $origin != 'learnpath') {
if ($_GET['show'] != 'result') {
echo '' . Display :: return_icon('more.png', get_lang('NewEx')) . get_lang('NewEx') . '';
echo '' . Display :: return_icon('question_add.gif', get_lang('AddQuestionToExercise')) . get_lang('AddQuestionToExercise') . '';
echo '' . Display :: return_icon('hotpotatoes_s.png', get_lang('ImportHotPotatoesQuiz')) . get_lang('ImportHotPotatoesQuiz') . '';
// link to import qti2 ...
echo '' . Display :: return_icon('import_db.png', get_lang('ImportQtiQuiz')) . get_lang('ImportQtiQuiz') . '';
- echo '' . Display :: return_icon('show_test_results.gif', get_lang('Results')) . get_lang('Results') . '';
+ //echo '' . Display :: return_icon('show_test_results.gif', get_lang('Results')) . get_lang('Results') . '';
}
// the actions for the statistics
@@ -678,37 +660,37 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) {
}
}
-if ($_configuration['tracking_enabled']) {
- if ($show == 'result') {
- if (api_is_allowed_to_edit(null,true)) {
- if (!$_GET['filter']) {
- $filter_by_not_revised = true;
- $filter = 1;
- } else {
- $filter=Security::remove_XSS($_GET['filter']);
- }
- $filter = (int) $_GET['filter'];
- switch ($filter) {
- case 1 :
- $filter_by_not_revised = true;
- break;
- case 2 :
- $filter_by_revised = true;
- break;
- default :
- null;
- }
- if ($_GET['filter'] == '1' or !isset ($_GET['filter']) or $_GET['filter'] == 0 ) {
- $view_result = ''.Display :: return_icon('check.gif', get_lang('ShowCorrectedOnly')).get_lang('ShowCorrectedOnly').'';
- } else {
- $view_result = ''.Display :: return_icon('un_check.gif', get_lang('ShowUnCorrectedOnly')).get_lang('ShowUnCorrectedOnly').'';
- }
- echo $view_result;
+if ($show == 'result') {
+ if (api_is_allowed_to_edit(null,true)) {
+ if (!$_GET['filter']) {
+ $filter_by_not_revised = true;
+ $filter = 1;
+ } else {
+ $filter=Security::remove_XSS($_GET['filter']);
+ }
+ $filter = (int) $_GET['filter'];
+
+ switch ($filter) {
+ case 1 :
+ $filter_by_not_revised = true;
+ break;
+ case 2 :
+ $filter_by_revised = true;
+ break;
+ default :
+ null;
}
+ if ($_GET['filter'] == '1' or !isset ($_GET['filter']) or $_GET['filter'] == 0 ) {
+ $view_result = ''.Display :: return_icon('check.gif', get_lang('ShowCorrectedOnly')).get_lang('ShowCorrectedOnly').'';
+ } else {
+ $view_result = ''.Display :: return_icon('un_check.gif', get_lang('ShowUnCorrectedOnly')).get_lang('ShowUnCorrectedOnly').'';
+ }
+ echo $view_result;
}
}
+
echo ''; // closing the actions div
if ($show == 'test') {
@@ -729,33 +711,13 @@ if ($show == 'test') {
.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; border-right-width: 1px; }
.ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: left; width: 40em;}
-
-
-
- |
- |
- |
-
-
- |
- |
- |
-
- '12px'));
+ $online_icon = Display::return_icon('online.png', get_lang('Visible'),array('width'=>'12px'));
$offline_icon = Display::return_icon('offline.png',get_lang('Invisible'),array('width'=>'12px'));
while ($row = Database :: fetch_array($result,'ASSOC')) {
@@ -769,625 +731,194 @@ if ($show == 'test') {
$lis.= Display::tag('li','
'.$status.' '.$row['title'].'');
$i++;
$exercise_list[] = $row;
- }
- echo Display::tag('ul', $lis);
-
- /* Listing exercises */
+ }
- if ($origin != 'learnpath') {
- //avoid sending empty parameters
- $myorigin = (empty ($origin) ? '' : '&origin=' . $origin);
- $mylpid = (empty ($learnpath_id) ? '' : '&learnpath_id=' . $learnpath_id);
- $mylpitemid = (empty ($learnpath_item_id) ? '' : '&learnpath_item_id=' . $learnpath_item_id);
-
- $token = Security::get_token();
- $i=1;
- foreach ($exercise_list as $row) {
- echo '
';
- $i++;
- //validacion when belongs to a session
- $session_img = api_get_session_image($row['session_id'], $_user['status']);
-
- $time_limits = false;
- if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') {
- $time_limits = true;
- }
-
- if ($time_limits) {
- // check if start time
- $start_time = api_strtotime($row['start_time']);
- $end_time = api_strtotime($row['end_time']);
- $now = time();
- $is_actived_time = false;
- if ($now > $start_time && $end_time > $now ) {
- $is_actived_time = true;
- }
- }
-
- // prof only
- if ($is_allowedToEdit) {
-
- //Showing exercise title
- $row['title']=text_filter($row['title']);
- echo Display::tag('h1',$row['title']);
-
- echo '
';
- echo $session_img;
- $exid = $row['id'];
-
- //count number exercice - teacher
- $sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
- $sqlresult = Database::query($sqlquery);
- $rowi = Database :: result($sqlresult, 0);
-
- $random_label = '';
- if ($row['random'] > 0) {
- $random_label = ' ('.get_lang('Random').') ';
- echo $row['random'] . ' ' . api_strtolower(get_lang(($row['random'] > 1 ? 'Questions' : 'Question'))) .$random_label. '';
- } else {
- echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question'))) . '';
- }
-
- if ($session_id == $row['session_id']) {
- ?>
-
-
- ')) return false;">
-
- ')) return false;" >
-
- 'exercice.php?'.api_get_cidreq().'&choice=disable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id']));
- } else { // else if not active
- echo Display::tag('a', Display::return_icon('invisible.gif', get_lang('Activate')) , array('href'=>'exercice.php?'.api_get_cidreq().'&choice=enable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id']));
- }
- // Export qti ...
- echo '
';
- } else { // not session resource
- echo Display::return_icon('wizard_gray_small.gif', get_lang('ExerciseEditionNotAvailableInSession'));
- ?>
- ')) return false;">
-
- ')) return false;">
- ';
- }
-
- echo '
'.get_count_exam_results($row['id']).' '.get_lang('Attempts');
+ if (!empty($exercise_list)) {
+
+ echo '';
+ echo Display::tag('ul', $lis);
+
+ /* Listing exercises */
+
+ if ($origin != 'learnpath') {
+ //avoid sending empty parameters
+ $myorigin = (empty ($origin) ? '' : '&origin=' . $origin);
+ $mylpid = (empty ($learnpath_id) ? '' : '&learnpath_id=' . $learnpath_id);
+ $mylpitemid = (empty ($learnpath_item_id) ? '' : '&learnpath_item_id=' . $learnpath_item_id);
+
+ $token = Security::get_token();
+ $i=1;
+ foreach ($exercise_list as $row) {
+ echo '
';
+ $i++;
+ //validacion when belongs to a session
+ $session_img = api_get_session_image($row['session_id'], $_user['status']);
- echo '
';
- echo Display::tag('a', get_lang('Preview'), array('href'=>'exercice_submit.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id']));
- echo ' ';
- echo Display::tag('a', get_lang('Results'), array('href'=>'exercice.php?'.api_get_cidreq().'&show=result&exerciseId='.$row['id']));
- echo '
';
- } else {
- // student only
- $row['title']=text_filter($row['title']);
-
- // if time is actived show link to exercise
- if ($time_limits) {
- if ($is_actived_time) {
- echo '
'.$row['title'].'';
- } else {
- echo $row['title'];
- }
- } else {
- echo '
'.$row['title'].'';
+ $time_limits = false;
+ if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') {
+ $time_limits = true;
}
-
- $exid = $row['id'];
- //count number exercise questions
- $sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
- $sqlresult = Database::query($sqlquery);
- $rowi = Database :: result($sqlresult, 0);
- //count number random exercice
- $sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
- $rs_random = Database::query($sql_random_query);
- $row_random = Database :: fetch_array($rs_random);
- if ($row_random['random'] > 0) {
- echo $row_random['random'] . ' ' . api_strtolower(get_lang(($row_random['random'] > 1 ? 'Questions' : 'Question')));
- } else {
- //show results student
- echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question')));
- }
- $eid = $row['id'];
- $uid = api_get_user_id();
- //this query might be improved later on by ordering by the new "tms" field rather than by exe_id
- $qry = "SELECT * FROM $TBL_TRACK_EXERCICES
- WHERE exe_exo_id = '" . Database :: escape_string($eid) . "' and exe_user_id = '" . Database :: escape_string($uid) . "' AND exe_cours_id = '" . api_get_course_id() . "' AND status <>'incomplete' AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = '" . api_get_session_id() . "'
- ORDER BY exe_id DESC";
- $qryres = Database::query($qry);
- $num = Database :: num_rows($qryres);
-
- //hide the results
- $my_result_disabled = $row['results_disabled'];
if ($time_limits) {
- if ($my_result_disabled == 0) {
- if ($num > 0) {
- echo sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_get_local_time($row['start_time']), api_get_local_time($row['end_time']));
+ // check if start time
+ $start_time = api_strtotime($row['start_time']);
+ $end_time = api_strtotime($row['end_time']);
+ $now = time();
+ $is_actived_time = false;
+ if ($now > $start_time && $end_time > $now ) {
+ $is_actived_time = true;
+ }
+ }
+
+ // prof only
+ if ($is_allowedToEdit) {
+
+ //Showing exercise title
+ $row['title']=text_filter($row['title']);
+ echo Display::tag('h1',$row['title']);
+
+ echo '
';
+ echo $session_img;
+ $exid = $row['id'];
+
+ //count number exercice - teacher
+ $sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
+ $sqlresult = Database::query($sqlquery);
+ $rowi = Database :: result($sqlresult, 0);
+
+ $random_label = '';
+
+ if ($row['random'] > 0) {
+ $random_label = ' ('.get_lang('Random').') ';
+ echo $row['random'] . ' ' . api_strtolower(get_lang(($row['random'] > 1 ? 'Questions' : 'Question'))) .$random_label;
+ } else {
+ echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question')));
+ }
+
+
+ if ($session_id == $row['session_id']) {
+ //Settings
+ //echo Display::tag('a', Display::return_icon('settings.png', get_lang('Edit')), array('href'=>'admin.php?'.api_get_cidreq().'&exerciseId='.$row['id']));
+ //Export
+ echo Display::tag('a', Display::return_icon('cd.gif', get_lang('CopyExercise')), array('onclick'=>"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset))." ".addslashes($row['title'])."?"."')) return false;",'href'=>'exercice.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
+ //Clean exercise
+ echo Display::tag('a', Display::return_icon('clean_group.png', get_lang('CleanStudentResults')),array('onclick'=>"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToDeleteResults'),ENT_QUOTES,$charset))." ".addslashes($row['title'])."?"."')) return false;",'href'=>'exercice.php?'.api_get_cidreq().'&choice=clean_results&sec_token='.$token.'&exerciseId='.$row['id']));
+ //Visible / invisible
+ if ($row['active']) {
+ echo Display::tag('a', Display::return_icon('visible.gif', get_lang('Deactivate')) , array('href'=>'exercice.php?'.api_get_cidreq().'&choice=disable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id']));
+ } else { // else if not active
+ echo Display::tag('a', Display::return_icon('invisible.gif', get_lang('Activate')) , array('href'=>'exercice.php?'.api_get_cidreq().'&choice=enable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id']));
+ }
+ // Export qti ...
+ echo Display::tag('a', Display::return_icon('export_db.png', 'IMS/QTI'), array('href'=>'exercice.php?choice=exportqti2&exerciseId='.$row['id']));
+ } else { // not session resource
+ echo Display::return_icon('wizard_gray_small.gif', get_lang('ExerciseEditionNotAvailableInSession'));
+ echo Display::tag('a', Display::return_icon('cd.gif', get_lang('CopyExercise')), array('onclick'=>"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset))." ".addslashes($row['title'])."?"."')) return false;",'href'=>'exercice.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
+ }
+
+ //Delete
+ if ($session_id == $row['session_id']) {
+ echo Display::tag('a', Display::return_icon('delete.png', get_lang('Delete')),array('onclick'=>"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToDelete'),ENT_QUOTES,$charset))." ".addslashes($row['title'])."?"."')) return false;",'href'=>'exercice.php?'.api_get_cidreq().'&choice=delete&sec_token='.$token.'&exerciseId='.$row['id']));
+ }
+ //Attempts
+ echo '
'.get_count_exam_results($row['id']).' '.get_lang('Attempts');
+
+ //Special buttons
+ echo '
';
+ echo Display::tag('a', Display::return_icon('settings.png',get_lang('EditQuestions'), array('width'=>'22px'))." ".get_lang('Edit'), array('href'=>'admin.php?'.api_get_cidreq().'&exerciseId='.$row['id']));
+ echo ' ';
+ echo Display::tag('a', Display::return_icon('preview.gif',get_lang('Preview'), array('width'=>'22px'))." ".get_lang('Preview'), array('href'=>'exercice_submit.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id']));
+ echo ' ';
+ echo Display::tag('a', Display::return_icon('show_test_results.gif',get_lang('Results'), array('width'=>'22px'))." ".get_lang('Results'), array('href'=>'exercice.php?'.api_get_cidreq().'&show=result&exerciseId='.$row['id']));
+ echo '
';
+
+ } else {
+ // Student only
+ $row['title']=text_filter($row['title']);
+
+ // if time is actived show link to exercise
+ if ($time_limits) {
+ if ($is_actived_time) {
+ echo '
'.$row['title'].'';
} else {
- echo get_lang('NotAttempted');
- }
+ echo $row['title'];
+ }
} else {
- echo get_lang('CantShowResults');
+ echo '
'.$row['title'].'';
}
- } else {
- if ($my_result_disabled == 0) {
- if ($num > 0) {
- $row = Database :: fetch_array($qryres);
- $percentage = 0;
- if ($row['exe_weighting'] != 0) {
- $percentage = ($row['exe_result'] / $row['exe_weighting']) * 100;
- }
- echo get_lang('Attempted') . ' (' . get_lang('Score') . ': ';
- printf("%1.2f\n", $percentage);
- echo " %)";
+
+ $exid = $row['id'];
+ //count number exercise questions
+ $sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
+ $sqlresult = Database::query($sqlquery);
+ $rowi = Database :: result($sqlresult, 0);
+ //count number random exercice
+ $sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
+ $rs_random = Database::query($sql_random_query);
+ $row_random = Database :: fetch_array($rs_random);
+ if ($row_random['random'] > 0) {
+ echo $row_random['random'] . ' ' . api_strtolower(get_lang(($row_random['random'] > 1 ? 'Questions' : 'Question')));
+ } else {
+ //show results student
+ echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question')));
+ }
+ $eid = $row['id'];
+ $uid = api_get_user_id();
+ //this query might be improved later on by ordering by the new "tms" field rather than by exe_id
+ $qry = "SELECT * FROM $TBL_TRACK_EXERCICES
+ WHERE exe_exo_id = '" . Database :: escape_string($eid) . "' and exe_user_id = '" . Database :: escape_string($uid) . "' AND exe_cours_id = '" . api_get_course_id() . "' AND status <>'incomplete' AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = '" . api_get_session_id() . "'
+ ORDER BY exe_id DESC";
+ $qryres = Database::query($qry);
+ $num = Database :: num_rows($qryres);
+
+ //hide the results
+ $my_result_disabled = $row['results_disabled'];
+
+ if ($time_limits) {
+ if ($my_result_disabled == 0) {
+ if ($num > 0) {
+ echo sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_get_local_time($row['start_time']), api_get_local_time($row['end_time']));
+ } else {
+ echo get_lang('NotAttempted');
+ }
} else {
- //echo get_lang('WillBeActivated' .' '. $row['start_time']);
- echo get_lang('NotAttempted');
+ echo get_lang('CantShowResults');
}
} else {
- echo get_lang('CantShowResults');
- }
- }
- }
- echo '';
+ if ($my_result_disabled == 0) {
+ if ($num > 0) {
+ $row = Database :: fetch_array($qryres);
+ $percentage = 0;
+ if ($row['exe_weighting'] != 0) {
+ $percentage = ($row['exe_result'] / $row['exe_weighting']) * 100;
+ }
+ echo get_lang('Attempted') . ' (' . get_lang('Score') . ': ';
+ printf("%1.2f\n", $percentage);
+ echo " %)";
+ } else {
+ //echo get_lang('WillBeActivated' .' '. $row['start_time']);
+ echo get_lang('NotAttempted');
+ }
+ } else {
+ echo get_lang('CantShowResults');
+ }
+ }
+ }
+ echo '';
+ echo '
';
+
+ } // end foreach()
echo '
';
- } // end while()
- echo '
';
- Display :: display_footer();
- exit;
-
- $ind = $i;
- if (($from + $limitExPage -1) > $nbrexerc) {
- if ($from > $nbrexerc) {
- $from = $from - $nbrexerc;
- $to = $limitExPage;
- } else {
- $to = $limitExPage - ($nbrexerc - $from);
- $from = 0;
- }
- } else {
- $to = $limitExPage;
- }
-
- if ($is_allowedToEdit) {
- $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
- FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
- WHERE d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')
- AND d.path LIKE '" . Database :: escape_string($uploadPath) . "/%/%' LIMIT " . (int) $from . "," . (int) $to; // only .htm or .html files listed
+ }
} else {
- $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
- FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
- WHERE d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')
- AND d.path LIKE '" . Database :: escape_string($uploadPath) . "/%/%' AND ip.visibility='1' LIMIT " . (int) $from . "," . (int) $to;
- }
-
- $result = Database::query($sql);
-
- while ($row = Database :: fetch_array($result, 'ASSOC')) {
- $attribute['path'][] = $row['path'];
- $attribute['visibility'][] = $row['visibility'];
- $attribute['comment'][] = $row['comment'];
+ //echo Display::display_warning_message(get_lang('NoExercises'));
}
- $nbrActiveTests = 0;
- if (is_array($attribute['path'])) {
- while (list ($key, $path) = each($attribute['path'])) {
- list ($a, $vis) = each($attribute['visibility']);
- if (strcmp($vis, "1") == 0) {
- $active = 1;
- } else {
- $active = 0;
- }
- echo "
\n";
-
- $title = GetQuizName($path, $documentPath);
- if ($title == '') {
- $title = basename($path);
- }
- // prof only
- if ($is_allowedToEdit) {
- echo '
'.
- '  | '.
- ' '.($ind+($page*$limitExPage)).'. | '.
- ' '.$title.' | '.
- ' - | '.
- ' ' .
- ' '.
- ' ' .
- ' '.
- ' ';
- // if active
- if ($active) {
- $nbrActiveTests = $nbrActiveTests +1;
- echo ' ';
- } else { // else if not active
- echo ' ';
- }
- echo ' ';
- echo ' | ';
- } else { // student only
- if ($active == 1) {
- $nbrActiveTests = $nbrActiveTests +1;
- echo '
'.
- ' | '.($ind+($page*$limitExPage)).'. | ' .
- ' '.$title.' | '.
- ' - | - | '.
- '
';
- }
- }
- if ($ind == $limitExPage) {
- break;
- }
- if ($is_allowedToEdit) {
- $ind++;
- } else {
- if ($active == 1) {
- $ind++;
- }
- }
- }
- }
-
- } //end if ($origin != 'learnpath') {
-echo '';
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Display :: display_footer();
exit;
+}
- //everything as always
-
-?>
-
-
-
- |
- |
- |
-
-
- |
- |
- |
-
-
-
- | > |
-
- $start_time && $end_time > $now ) {
- $is_actived_time = true;
- }
- }
-
-
- if ($i % 2 == 0)
- $s_class = "row_odd";
- else
- $s_class = "row_even";
- // prof only
- if ($is_allowedToEdit) {
- echo '';
- echo '| '.Display::return_icon('quiz.gif', get_lang('Exercice')) .' | ';
- echo ''.($i+($page*$limitExPage)).'.'.' | ';
-
- //Showing exercise title
- $row['title']=text_filter($row['title']);
-
- echo '';
- $class_invisible = '';
- if (!$row['active']) {
- $class_invisible = 'class="invisible"';
- }
- echo '';
- echo Security::remove_XSS($row['title']);
- echo '';
- echo $session_img;
- echo ' | ';
- echo '';
- $exid = $row['id'];
-
- //count number exercice - teacher
- $sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
- $sqlresult = Database::query($sqlquery);
- $rowi = Database :: result($sqlresult, 0);
-
- $random_label = '';
- if ($row['random'] > 0) {
- $random_label = ' ('.get_lang('Random').') ';
- echo $row['random'] . ' ' . api_strtolower(get_lang(($row['random'] > 1 ? 'Questions' : 'Question'))) .$random_label. ' | ';
- } else {
- echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question'))) . '';
- }
- echo '';
- if ($session_id == $row['session_id']) {
- ?>
-
-
- ')) return false;">
-
- ')) return false;" >
-
-
-
-
-
-
-
- ';
- } else { // not session resource
- echo Display::return_icon('wizard_gray_small.gif', get_lang('ExerciseEditionNotAvailableInSession'), array('title'=>get_lang('ExerciseEditionNotAvailableInSession')));
- ?>
- ')) return false;">
-
- ')) return false;">
-
- ";
- echo " |
";
- } else { // student only
- ?>
-
- |
-
-
-
- '.$row['title'].'';
- } else {
- echo $row['title'];
- }
- } else {
- echo ''.$row['title'].'';
- }
- echo ' | ';
- $exid = $row['id'];
- //count number exercise questions
- $sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '" . Database :: escape_string($exid) . "'";
- $sqlresult = Database::query($sqlquery);
- $rowi = Database :: result($sqlresult, 0);
- //count number random exercice
- $sql_random_query = 'SELECT type,random,active,results_disabled,max_attempt FROM ' . $TBL_EXERCICES . ' WHERE id="' . Database :: escape_string($exid) . '" ';
- $rs_random = Database::query($sql_random_query);
- $row_random = Database :: fetch_array($rs_random);
- if ($row_random['random'] > 0) {
- echo $row_random['random'] . ' ' . api_strtolower(get_lang(($row_random['random'] > 1 ? 'Questions' : 'Question')));
- } else {
- //show results student
- echo $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question')));
- }
- echo ' | ';
- echo '';
- $eid = $row['id'];
- $uid = api_get_user_id();
- //this query might be improved later on by ordering by the new "tms" field rather than by exe_id
- $qry = "SELECT * FROM $TBL_TRACK_EXERCICES
- WHERE exe_exo_id = '" . Database :: escape_string($eid) . "' and exe_user_id = '" . Database :: escape_string($uid) . "' AND exe_cours_id = '" . api_get_course_id() . "' AND status <>'incomplete' AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = '" . api_get_session_id() . "'
- ORDER BY exe_id DESC";
- $qryres = Database::query($qry);
- $num = Database :: num_rows($qryres);
-
- //hide the results
- $my_result_disabled = $row['results_disabled'];
-
- if ($time_limits) {
- if ($my_result_disabled == 0) {
- if ($num > 0) {
- echo sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_get_local_time($row['start_time']), api_get_local_time($row['end_time']));
- } else {
- echo get_lang('NotAttempted');
- }
- } else {
- echo get_lang('CantShowResults');
- }
- } else {
- if ($my_result_disabled == 0) {
- if ($num > 0) {
- $row = Database :: fetch_array($qryres);
- $percentage = 0;
- if ($row['exe_weighting'] != 0) {
- $percentage = ($row['exe_result'] / $row['exe_weighting']) * 100;
- }
- echo get_lang('Attempted') . ' (' . get_lang('Score') . ': ';
- printf("%1.2f\n", $percentage);
- echo " %)";
- } else {
- //echo get_lang('WillBeActivated' .' '. $row['start_time']);
- echo get_lang('NotAttempted');
- }
- } else {
- echo get_lang('CantShowResults');
- }
- }
- echo ' |
';
- }
- // skips the last exercise, that is only used to know if we have or not to create a link "Next page"
- if ($i == $limitExPage) {
- break;
- }
- $i++;
- } // end while()
- $ind = $i;
- if (($from + $limitExPage -1) > $nbrexerc) {
- if ($from > $nbrexerc) {
- $from = $from - $nbrexerc;
- $to = $limitExPage;
- } else {
- $to = $limitExPage - ($nbrexerc - $from);
- $from = 0;
- }
- } else {
- $to = $limitExPage;
- }
-
- if ($is_allowedToEdit) {
- $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
- FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
- WHERE d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')
- AND d.path LIKE '" . Database :: escape_string($uploadPath) . "/%/%' LIMIT " . (int) $from . "," . (int) $to; // only .htm or .html files listed
- } else {
- $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
- FROM $TBL_DOCUMENT d, $TBL_ITEM_PROPERTY ip
- WHERE d.id = ip.ref AND ip.tool = '" . TOOL_DOCUMENT . "' AND (d.path LIKE '%htm%')
- AND d.path LIKE '" . Database :: escape_string($uploadPath) . "/%/%' AND ip.visibility='1' LIMIT " . (int) $from . "," . (int) $to;
- }
-
- $result = Database::query($sql);
-
- while ($row = Database :: fetch_array($result, 'ASSOC')) {
- $attribute['path'][] = $row['path'];
- $attribute['visibility'][] = $row['visibility'];
- $attribute['comment'][] = $row['comment'];
- }
- $nbrActiveTests = 0;
- if (is_array($attribute['path'])) {
- while (list ($key, $path) = each($attribute['path'])) {
- list ($a, $vis) = each($attribute['visibility']);
- if (strcmp($vis, "1") == 0) {
- $active = 1;
- } else {
- $active = 0;
- }
- echo "\n";
-
- $title = GetQuizName($path, $documentPath);
- if ($title == '') {
- $title = basename($path);
- }
- // prof only
- if ($is_allowedToEdit) {
- echo '
'.
- '  | '.
- ' '.($ind+($page*$limitExPage)).'. | '.
- ' '.$title.' | '.
- ' - | '.
- ' ' .
- ' '.
- ' ' .
- ' '.
- ' ';
- // if active
- if ($active) {
- $nbrActiveTests = $nbrActiveTests +1;
- echo ' ';
- } else { // else if not active
- echo ' ';
- }
- echo ' ';
- echo ' | ';
- } else { // student only
- if ($active == 1) {
- $nbrActiveTests = $nbrActiveTests +1;
- echo '
'.
- ' | '.($ind+($page*$limitExPage)).'. | ' .
- ' '.$title.' | '.
- ' - | - | '.
- '
';
- }
- }
- if ($ind == $limitExPage) {
- break;
- }
- if ($is_allowedToEdit) {
- $ind++;
- } else {
- if ($active == 1) {
- $ind++;
- }
- }
- }
- }
-
- } //end if ($origin != 'learnpath') {
-echo '
';
-}
+
/* Exercise Results (uses tracking tool) */
@@ -1409,356 +940,14 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
$table->set_header(1, get_lang('FirstName'));
}
}
-
$table->set_header(-$secuence + 2, get_lang('Exercice'));
$table->set_header(-$secuence + 3, get_lang('Duration'),false);
$table->set_header(-$secuence + 4, get_lang('Date'));
$table->set_header(-$secuence + 5, get_lang('Result'),false);
$table->set_header(-$secuence + 6, (($is_allowedToEdit||$is_tutor) ? get_lang('CorrectTest') : get_lang('ViewTest')), false);
- $table->display();
-
+ $table->display();
}
+
if ($origin != 'learnpath') { //so we are not in learnpath tool
Display :: display_footer();
-} else {
-?>
-
-".COURSE_RELATION_TYPE_RRHH." AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
- $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0
- AND cuser.course_code=te.exe_cours_id ORDER BY col1, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";*/
-
- $sql="SELECT count(*) as count
- FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
- WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 $exercise_where ";
-
- $hpsql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
- FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
- WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid) . " $user_id_and $exercise_where
- ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
-
-
-
- } else {
- // get only this user's results
- $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
-
- /*$sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", ce.title as extitle, te.exe_result as exresult, " .
- "te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
- "te.start_date as exstart, steps_counter as exstep, cuser.user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
- FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
- WHERE user.user_id=cuser.user_id AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id
- AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
- AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." $user_id_and $session_id_and AND ce.active <>-1 AND" .
- " orig_lp_id = 0 AND orig_lp_item_id = 0 AND cuser.course_code=te.exe_cours_id ORDER BY col1, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";*/
-
- $sql="SELECT count(*) as count
- FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
- WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND" .
- " orig_lp_id = 0 AND orig_lp_item_id = 0 ";
-
- $hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date
- FROM $TBL_TRACK_HOTPOTATOES
- WHERE exe_user_id = '" . $_user['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
- ORDER BY exe_cours_id ASC, exe_date DESC";
- }
-
- $resx = Database::query($sql);
- $rowx = Database::fetch_array($resx,'ASSOC');
- return $rowx['count'];
}
-
-
-
-
-/**
- * Gets the exam'data results
- * @todo this function should be moved in a library + no global calls
- */
-function get_exam_results_data($from, $number_of_items, $column, $direction) {
-
- global $is_allowedToEdit, $is_tutor,$_cid,$_user,$TBL_USER, $TBL_EXERCICES,$TBL_TRACK_EXERCICES, $TBL_TRACK_ATTEMPT_RECORDING,$filter_by_not_revised,$filter_by_revised,$documentPath;
- $session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' ';
- if ($is_allowedToEdit || $is_tutor) {
- $user_id_and = '';
- if (!empty ($_POST['filter_by_user'])) {
- if ($_POST['filter_by_user'] == 'all') {
- $user_id_and = " AND user_id like '%'";
- } else {
- $user_id_and = " AND user_id = '" . Database :: escape_string((int) $_POST['filter_by_user']) . "' ";
- }
- }
-
- if ($_GET['gradebook'] == 'view') {
- $exercise_where_query = ' te.exe_exo_id =ce.id AND ';
- }
-
- $exercise_where = '';
- if (isset($_GET['exerciseId'])) {
- $exercise_where .= ' AND te.exe_exo_id = '.intval($_GET['exerciseId']).' ';
- }
-
-
- //@todo fix to work with COURSE_RELATION_TYPE_RRHH in both queries
-
- /*$sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", ce.title as extitle, te.exe_result as exresult ,
- te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, te.start_date as exstart, steps_counter as exstep,cuser.user_id as excruid,te.exe_duration as exduration
- FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
- WHERE user.user_id=cuser.user_id AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
- $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0
- AND cuser.course_code=te.exe_cours_id ORDER BY col1, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";*/
-
- $sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", ce.title as col2, te.exe_result as exresult , te.exe_weighting as exweight,
- te.exe_date as exdate, te.exe_id as exid, email as exemail, te.start_date as col4, steps_counter as exstep, exe_user_id as excruid,te.exe_duration as exduration
- FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
- WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 $exercise_where ";
-
- $hpsql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
- FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
- WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid)." $user_id_and $exercise_where
- ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
-
-
-
- } else {
- // get only this user's results
- $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
-
- /*$sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", ce.title as extitle, te.exe_result as exresult, " .
- "te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
- "te.start_date as exstart, steps_counter as exstep, cuser.user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
- FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
- WHERE user.user_id=cuser.user_id AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id
- AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
- AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." $user_id_and $session_id_and AND ce.active <>-1 AND" .
- " orig_lp_id = 0 AND orig_lp_item_id = 0 AND cuser.course_code=te.exe_cours_id ORDER BY col1, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";*/
-
-
-
- $sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1")." , ce.title as col2, te.exe_result as exresult, " .
- "te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
- "te.start_date as col4, steps_counter as exstep, exe_user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
- FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
- WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND" .
- " orig_lp_id = 0 AND orig_lp_item_id = 0 ";
-
- $hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date
- FROM $TBL_TRACK_HOTPOTATOES
- WHERE exe_user_id = '" . $_user['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
- ORDER BY exe_cours_id ASC, exe_date DESC";
- }
-
-
- $column = intval($column);
- $from = intval($from);
- $number_of_items = intval($number_of_items);
- $sql .= " ORDER BY col$column $direction ";
- $sql .= " LIMIT $from,$number_of_items";
-
- $results = array();
-
- $resx = Database::query($sql);
- while ($rowx = Database::fetch_array($resx,'ASSOC')) {
- $results[] = $rowx;
- }
- $hpresults = getManyResultsXCol($hpsql, 5);
-
- $has_test_results = false;
- $list_info = array();
-
- // Print test results.
- $lang_nostartdate = get_lang('NoStartDate') . ' / ';
-
-
- if (is_array($results)) {
- $has_test_results = true;
- $users_array_id = array ();
- if ($_GET['gradebook'] == 'view') {
- $filter_by_no_revised = true;
- $from_gradebook = true;
- }
- $sizeof = sizeof($results);
-
- $user_list_id = array ();
- $user_last_name = '';
- $user_first_name = '';
- $quiz_name_list = '';
- $duration_list = '';
- $date_list = '';
- $result_list = '';
- $more_details_list = '';
- for ($i = 0; $i < $sizeof; $i++) {
- $revised = false;
- $sql_exe = 'SELECT exe_id FROM ' . $TBL_TRACK_ATTEMPT_RECORDING . '
- WHERE author != ' . "''" . ' AND exe_id = ' . "'" . Database :: escape_string($results[$i]['exid']) . "'" . ' LIMIT 1';
- $query = Database::query($sql_exe);
-
- if (Database :: num_rows($query) > 0) {
- $revised = true;
- }
- if ($filter_by_not_revised && $revised) {
- continue;
- }
- if ($filter_by_revised && !$revised) {
- continue;
- }
- if ($from_gradebook && ($is_allowedToEdit || $is_tutor)) {
- if (in_array($results[$i]['col2'] . $results[$i]['col0'] . $results[$i]['col1'], $users_array_id)) {
- continue;
- }
- $users_array_id[] = $results[$i]['col2'] . $results[$i]['col0'] . $results[$i]['col1'];
- }
-
- $user_first_name = $results[$i]['col0'];
- $user_last_name = $results[$i]['col1'];
- $user_list_id[] = $results[$i]['excruid'];
- $id = $results[$i]['exid'];
-
- $user = $results[$i]['col0'] . $results[$i]['col1'];
- $test = $results[$i]['col2'];
- $quiz_name_list = $test;
- $dt = api_convert_and_format_date($results[$i]['exweight'], null, date_default_timezone_get());
- $res = $results[$i]['exresult'];
-
- $duration = intval($results[$i]['exduration']);
- // we filter the results if we have the permission to
- if (isset ($results[$i]['exdisabled']))
- $result_disabled = intval($results[$i]['exdisabled']);
- else
- $result_disabled = 0;
-
- if ($result_disabled == 0) {
- $add_start_date = $lang_nostartdate;
-
- if ($is_allowedToEdit || $is_tutor) {
- $user = $results[$i]['col0'] . $results[$i]['col1'];
- }
- if ($results[$i]['col4'] != "0000-00-00 00:00:00") {
- //echo ceil((($results[$i][4] - $results[$i][7]) / 60)) . ' ' . get_lang('MinMinutes');
- $exe_date_timestamp = api_strtotime($results[$i]['exdate'], date_default_timezone_get());
- $start_date_timestamp = api_strtotime($results[$i]['col4'], date_default_timezone_get());
-
- $my_duration = ceil((($exe_date_timestamp - $start_date_timestamp) / 60));
- if ($my_duration == 1 ) {
- $duration_list = $my_duration . ' ' . get_lang('MinMinute');
- } else {
- $duration_list = $my_duration. ' ' . get_lang('MinMinutes');
- }
- if ($results[$i]['exstep'] > 1) {
- //echo ' ( ' . $results[$i][8] . ' ' . get_lang('Steps') . ' )';
- $duration_list = ' ( ' . $results[$i]['exstep'] . ' ' . get_lang('Steps') . ' )';
- }
- $add_start_date = api_convert_and_format_date($results[$i]['col4'], null, date_default_timezone_get()) . ' / ';
- } else {
- $duration_list = get_lang('NoLogOfDuration');
- //echo get_lang('NoLogOfDuration');
- }
- // Date conversion
- $date_list = api_get_local_time($results[$i]['col4']). ' / ' . api_get_local_time($results[$i]['exdate']);
- // there are already a duration test period calculated??
- //echo '
'.sprintf(get_lang('DurationFormat'), $duration).' | ';
-
- // if the float look like 10.00 we show only 10
-
- $my_res = float_format($results[$i]['exresult'],1);
- $my_total = float_format($results[$i]['exweight'],1);
-
- $result_list = round(($my_res / ($my_total != 0 ? $my_total : 1)) * 100, 2) . '% (' . $my_res . ' / ' . $my_total . ')';
-
- $html_link = '';
- if ($is_allowedToEdit || $is_tutor) {
- if ($revised) {
- $html_link.= "
".Display :: return_icon('edit.gif', get_lang('Edit'));
- $html_link.= ' ';
- } else {
- $html_link.="".Display :: return_icon('quizz_small.gif', get_lang('Qualify'));
- $html_link.=' ';
- }
- $html_link.="";
- if (api_is_platform_admin() || $is_tutor) {
- $html_link.='
'.Display :: return_icon('delete.gif', get_lang('Delete')).'';
- $html_link.=' ';
- }
- if ($is_allowedToEdit) {
- if ($filter==2){
- $html_link.='
' .Display :: return_icon('history.gif', get_lang('ViewHistoryChange')).'';
- }
- }
- } else {
- if ($revised) {
- $html_link.="
" . get_lang('Show') . " ";
- } else {
- $html_link.=' ' . get_lang('NoResult');
- }
- }
- $more_details_list = $html_link;
- if ($is_allowedToEdit || $is_tutor) {
- $list_info [] = array($user_first_name,$user_last_name,$quiz_name_list,$duration_list,$date_list,$result_list,$more_details_list);
- } else {
- $list_info [] = array($quiz_name_list,$duration_list,$date_list,$result_list,$more_details_list);
- }
- }
- }
- }
- // Print HotPotatoes test results.
- if (is_array($hpresults)) {
- $has_test_results = true;
- for ($i = 0; $i < sizeof($hpresults); $i++) {
- $hp_title = GetQuizName($hpresults[$i][1], $documentPath);
- if ($hp_title == '') {
- $hp_title = basename($hpresults[$i][1]);
- }
- //$hp_date = api_convert_and_format_date($hpresults[$i][4], null, date_default_timezone_get());
- $hp_date = api_get_local_time($hpresults[$i][4], null, date_default_timezone_get());
- $hp_result = round(($hpresults[$i][2] / ($hpresults[$i][3] != 0 ? $hpresults[$i][3] : 1)) * 100, 2).'% ('.$hpresults[$i][2].' / '.$hpresults[$i][3].')';
- if ($is_allowedToEdit) {
- $list_info[] = array($hpresults[$i][0], $hp_title, '-', $hp_date , $hp_result , '-');
- } else {
- $list_info[] = array($hp_title, '-', $hp_date , $hp_result , '-');
- }
- }
- }
- return $list_info;
- }
-
-
-?>
diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php
index 0eed668971..ae233f5d58 100755
--- a/main/exercice/exercise.lib.php
+++ b/main/exercice/exercise.lib.php
@@ -580,3 +580,337 @@ function get_session_time_control_key($exercise_id) {
$return_value = $_SESSION['expired_time'][$time_control_key];
return $return_value;
}
+
+
+
+
+/**
+ * Gets count of exam results
+ * @todo this function should be moved in a library + no global calls
+ */
+function get_count_exam_results($exercise_id = null) {
+ global $is_allowedToEdit, $is_tutor,$_cid,$_user,$TBL_USER, $TBL_EXERCICES,$TBL_TRACK_EXERCICES, $TBL_TRACK_ATTEMPT_RECORDING,$filter_by_not_revised,$filter_by_revised,$documentPath;
+ $session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' ';
+ if ($is_allowedToEdit || $is_tutor) {
+ $user_id_and = '';
+ if (!empty ($_POST['filter_by_user'])) {
+ if ($_POST['filter_by_user'] == 'all') {
+ $user_id_and = " AND user_id like '%'";
+ } else {
+ $user_id_and = " AND user_id = '" . Database :: escape_string((int) $_POST['filter_by_user']) . "' ";
+ }
+ }
+ if ($_GET['gradebook'] == 'view') {
+ $exercise_where_query = 'te.exe_exo_id =ce.id AND ';
+ }
+
+ $exercise_where = '';
+ if (isset($_GET['exerciseId'])) {
+ $exercise_where = ' AND te.exe_exo_id = '.intval($_GET['exerciseId']).' ';
+ }
+
+ if (!empty($exercise_id)) {
+ $exercise_where = ' AND te.exe_exo_id = '.intval($exercise_id).' ';
+ }
+
+ //@todo fix to work with COURSE_RELATION_TYPE_RRHH in both queries
+
+ /*$sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname col1" : "lastname as userpart1, firstname as col1").", ce.title as extitle, te.exe_result as exresult ,
+ te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, te.start_date as exstart, steps_counter as exstep,cuser.user_id as excruid,te.exe_duration as exduration
+ FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
+ WHERE user.user_id=cuser.user_id AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
+ $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0
+ AND cuser.course_code=te.exe_cours_id ORDER BY col1, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";*/
+
+ $sql="SELECT count(*) as count
+ FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
+ WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 $exercise_where ";
+
+ $hpsql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
+ FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
+ WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid) . " $user_id_and $exercise_where
+ ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
+
+
+
+ } else {
+ // get only this user's results
+ $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
+
+ /*$sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", ce.title as extitle, te.exe_result as exresult, " .
+ "te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
+ "te.start_date as exstart, steps_counter as exstep, cuser.user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
+ FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
+ WHERE user.user_id=cuser.user_id AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id
+ AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
+ AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." $user_id_and $session_id_and AND ce.active <>-1 AND" .
+ " orig_lp_id = 0 AND orig_lp_item_id = 0 AND cuser.course_code=te.exe_cours_id ORDER BY col1, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";*/
+
+ $sql="SELECT count(*) as count
+ FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
+ WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND" .
+ " orig_lp_id = 0 AND orig_lp_item_id = 0 ";
+
+ $hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date
+ FROM $TBL_TRACK_HOTPOTATOES
+ WHERE exe_user_id = '" . $_user['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
+ ORDER BY exe_cours_id ASC, exe_date DESC";
+ }
+
+ $resx = Database::query($sql);
+ $rowx = Database::fetch_array($resx,'ASSOC');
+ return $rowx['count'];
+}
+
+
+
+
+/**
+ * Gets the exam'data results
+ * @todo this function should be moved in a library + no global calls
+ */
+function get_exam_results_data($from, $number_of_items, $column, $direction) {
+
+ global $is_allowedToEdit, $is_tutor,$_cid,$_user,$TBL_USER, $TBL_EXERCICES,$TBL_TRACK_EXERCICES, $TBL_TRACK_ATTEMPT_RECORDING,$filter_by_not_revised,$filter_by_revised,$documentPath;
+ $session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' ';
+ if ($is_allowedToEdit || $is_tutor) {
+ $user_id_and = '';
+ if (!empty ($_POST['filter_by_user'])) {
+ if ($_POST['filter_by_user'] == 'all') {
+ $user_id_and = " AND user_id like '%'";
+ } else {
+ $user_id_and = " AND user_id = '" . Database :: escape_string((int) $_POST['filter_by_user']) . "' ";
+ }
+ }
+
+ if ($_GET['gradebook'] == 'view') {
+ $exercise_where_query = ' te.exe_exo_id =ce.id AND ';
+ }
+
+ $exercise_where = '';
+ if (isset($_GET['exerciseId'])) {
+ $exercise_where .= ' AND te.exe_exo_id = '.intval($_GET['exerciseId']).' ';
+ }
+
+
+ //@todo fix to work with COURSE_RELATION_TYPE_RRHH in both queries
+
+ /*$sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", ce.title as extitle, te.exe_result as exresult ,
+ te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, te.start_date as exstart, steps_counter as exstep,cuser.user_id as excruid,te.exe_duration as exduration
+ FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
+ WHERE user.user_id=cuser.user_id AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
+ $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0
+ AND cuser.course_code=te.exe_cours_id ORDER BY col1, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";*/
+
+ $sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", ce.title as col2, te.exe_result as exresult , te.exe_weighting as exweight,
+ te.exe_date as exdate, te.exe_id as exid, email as exemail, te.start_date as col4, steps_counter as exstep, exe_user_id as excruid,te.exe_duration as exduration
+ FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
+ WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 $exercise_where ";
+
+ $hpsql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
+ FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
+ WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid)." $user_id_and $exercise_where
+ ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
+
+
+
+ } else {
+ // get only this user's results
+ $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
+
+ /*$sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", ce.title as extitle, te.exe_result as exresult, " .
+ "te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
+ "te.start_date as exstart, steps_counter as exstep, cuser.user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
+ FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
+ WHERE user.user_id=cuser.user_id AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id
+ AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
+ AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." $user_id_and $session_id_and AND ce.active <>-1 AND" .
+ " orig_lp_id = 0 AND orig_lp_item_id = 0 AND cuser.course_code=te.exe_cours_id ORDER BY col1, te.exe_cours_id ASC, ce.title ASC, te.exe_date DESC";*/
+
+
+
+ $sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1")." , ce.title as col2, te.exe_result as exresult, " .
+ "te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
+ "te.start_date as col4, steps_counter as exstep, exe_user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
+ FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
+ WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND" .
+ " orig_lp_id = 0 AND orig_lp_item_id = 0 ";
+
+ $hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date
+ FROM $TBL_TRACK_HOTPOTATOES
+ WHERE exe_user_id = '" . $_user['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
+ ORDER BY exe_cours_id ASC, exe_date DESC";
+ }
+
+
+ $column = intval($column);
+ $from = intval($from);
+ $number_of_items = intval($number_of_items);
+ $sql .= " ORDER BY col$column $direction ";
+ $sql .= " LIMIT $from,$number_of_items";
+
+ $results = array();
+
+ $resx = Database::query($sql);
+ while ($rowx = Database::fetch_array($resx,'ASSOC')) {
+ $results[] = $rowx;
+ }
+ $hpresults = getManyResultsXCol($hpsql, 5);
+
+ $has_test_results = false;
+ $list_info = array();
+
+ // Print test results.
+ $lang_nostartdate = get_lang('NoStartDate') . ' / ';
+
+
+ if (is_array($results)) {
+ $has_test_results = true;
+ $users_array_id = array ();
+ if ($_GET['gradebook'] == 'view') {
+ $filter_by_no_revised = true;
+ $from_gradebook = true;
+ }
+ $sizeof = sizeof($results);
+
+ $user_list_id = array ();
+ $user_last_name = '';
+ $user_first_name = '';
+ $quiz_name_list = '';
+ $duration_list = '';
+ $date_list = '';
+ $result_list = '';
+ $more_details_list = '';
+ for ($i = 0; $i < $sizeof; $i++) {
+ $revised = false;
+ $sql_exe = 'SELECT exe_id FROM ' . $TBL_TRACK_ATTEMPT_RECORDING . '
+ WHERE author != ' . "''" . ' AND exe_id = ' . "'" . Database :: escape_string($results[$i]['exid']) . "'" . ' LIMIT 1';
+ $query = Database::query($sql_exe);
+
+ if (Database :: num_rows($query) > 0) {
+ $revised = true;
+ }
+ if ($filter_by_not_revised && $revised) {
+ continue;
+ }
+ if ($filter_by_revised && !$revised) {
+ continue;
+ }
+ if ($from_gradebook && ($is_allowedToEdit || $is_tutor)) {
+ if (in_array($results[$i]['col2'] . $results[$i]['col0'] . $results[$i]['col1'], $users_array_id)) {
+ continue;
+ }
+ $users_array_id[] = $results[$i]['col2'] . $results[$i]['col0'] . $results[$i]['col1'];
+ }
+
+ $user_first_name = $results[$i]['col0'];
+ $user_last_name = $results[$i]['col1'];
+ $user_list_id[] = $results[$i]['excruid'];
+ $id = $results[$i]['exid'];
+
+ $user = $results[$i]['col0'] . $results[$i]['col1'];
+ $test = $results[$i]['col2'];
+ $quiz_name_list = $test;
+ $dt = api_convert_and_format_date($results[$i]['exweight'], null, date_default_timezone_get());
+ $res = $results[$i]['exresult'];
+
+ $duration = intval($results[$i]['exduration']);
+ // we filter the results if we have the permission to
+ if (isset ($results[$i]['exdisabled']))
+ $result_disabled = intval($results[$i]['exdisabled']);
+ else
+ $result_disabled = 0;
+
+ if ($result_disabled == 0) {
+ $add_start_date = $lang_nostartdate;
+
+ if ($is_allowedToEdit || $is_tutor) {
+ $user = $results[$i]['col0'] . $results[$i]['col1'];
+ }
+ if ($results[$i]['col4'] != "0000-00-00 00:00:00") {
+ //echo ceil((($results[$i][4] - $results[$i][7]) / 60)) . ' ' . get_lang('MinMinutes');
+ $exe_date_timestamp = api_strtotime($results[$i]['exdate'], date_default_timezone_get());
+ $start_date_timestamp = api_strtotime($results[$i]['col4'], date_default_timezone_get());
+
+ $my_duration = ceil((($exe_date_timestamp - $start_date_timestamp) / 60));
+ if ($my_duration == 1 ) {
+ $duration_list = $my_duration . ' ' . get_lang('MinMinute');
+ } else {
+ $duration_list = $my_duration. ' ' . get_lang('MinMinutes');
+ }
+ if ($results[$i]['exstep'] > 1) {
+ //echo ' ( ' . $results[$i][8] . ' ' . get_lang('Steps') . ' )';
+ $duration_list = ' ( ' . $results[$i]['exstep'] . ' ' . get_lang('Steps') . ' )';
+ }
+ $add_start_date = api_convert_and_format_date($results[$i]['col4'], null, date_default_timezone_get()) . ' / ';
+ } else {
+ $duration_list = get_lang('NoLogOfDuration');
+ //echo get_lang('NoLogOfDuration');
+ }
+ // Date conversion
+ $date_list = api_get_local_time($results[$i]['col4']). ' / ' . api_get_local_time($results[$i]['exdate']);
+ // there are already a duration test period calculated??
+ //echo '
'.sprintf(get_lang('DurationFormat'), $duration).' | ';
+
+ // if the float look like 10.00 we show only 10
+
+ $my_res = float_format($results[$i]['exresult'],1);
+ $my_total = float_format($results[$i]['exweight'],1);
+
+ $result_list = round(($my_res / ($my_total != 0 ? $my_total : 1)) * 100, 2) . '% (' . $my_res . ' / ' . $my_total . ')';
+
+ $html_link = '';
+ if ($is_allowedToEdit || $is_tutor) {
+ if ($revised) {
+ $html_link.= "
".Display :: return_icon('edit.gif', get_lang('Edit'));
+ $html_link.= ' ';
+ } else {
+ $html_link.="".Display :: return_icon('quizz_small.gif', get_lang('Qualify'));
+ $html_link.=' ';
+ }
+ $html_link.="";
+ if (api_is_platform_admin() || $is_tutor) {
+ $html_link.='
'.Display :: return_icon('delete.gif', get_lang('Delete')).'';
+ $html_link.=' ';
+ }
+ if ($is_allowedToEdit) {
+ if ($filter==2){
+ $html_link.='
' .Display :: return_icon('history.gif', get_lang('ViewHistoryChange')).'';
+ }
+ }
+ } else {
+ if ($revised) {
+ $html_link.="
" . get_lang('Show') . " ";
+ } else {
+ $html_link.=' ' . get_lang('NoResult');
+ }
+ }
+ $more_details_list = $html_link;
+ if ($is_allowedToEdit || $is_tutor) {
+ $list_info [] = array($user_first_name,$user_last_name,$quiz_name_list,$duration_list,$date_list,$result_list,$more_details_list);
+ } else {
+ $list_info [] = array($quiz_name_list,$duration_list,$date_list,$result_list,$more_details_list);
+ }
+ }
+ }
+ }
+ // Print HotPotatoes test results.
+ if (is_array($hpresults)) {
+ $has_test_results = true;
+ for ($i = 0; $i < sizeof($hpresults); $i++) {
+ $hp_title = GetQuizName($hpresults[$i][1], $documentPath);
+ if ($hp_title == '') {
+ $hp_title = basename($hpresults[$i][1]);
+ }
+ //$hp_date = api_convert_and_format_date($hpresults[$i][4], null, date_default_timezone_get());
+ $hp_date = api_get_local_time($hpresults[$i][4], null, date_default_timezone_get());
+ $hp_result = round(($hpresults[$i][2] / ($hpresults[$i][3] != 0 ? $hpresults[$i][3] : 1)) * 100, 2).'% ('.$hpresults[$i][2].' / '.$hpresults[$i][3].')';
+ if ($is_allowedToEdit) {
+ $list_info[] = array($hpresults[$i][0], $hp_title, '-', $hp_date , $hp_result , '-');
+ } else {
+ $list_info[] = array($hp_title, '-', $hp_date , $hp_result , '-');
+ }
+ }
+ }
+ return $list_info;
+}