Task #1765 - LP tool, cleaning files (8).

skala
Ivan Tcholakov 15 years ago
parent 1ef3c90085
commit 6cd582b541
  1. 478
      main/newscorm/lp_list.php
  2. 18
      main/newscorm/lp_log.php
  3. 24
      main/newscorm/lp_message.php
  4. 97
      main/newscorm/lp_move_item.php
  5. 29
      main/newscorm/lp_nav.php
  6. 3
      main/newscorm/lp_save.php
  7. 273
      main/newscorm/lp_stats.php

@ -1,5 +1,6 @@
<?php //$id:$ <?php //$id:$
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This file was origially the copy of document.php, but many modifications happened since then ; * This file was origially the copy of document.php, but many modifications happened since then ;
* the direct file view is not any more needed, if the user uploads a scorm zip file, a directory * the direct file view is not any more needed, if the user uploads a scorm zip file, a directory
@ -8,12 +9,9 @@
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
/**
* Script
*/
$this_section=SECTION_COURSES; $this_section = SECTION_COURSES;
if(empty($lp_controller_touched) || $lp_controller_touched!=1){ if (empty($lp_controller_touched) || $lp_controller_touched != 1) {
header('location: lp_controller.php?action=list'); header('location: lp_controller.php?action=list');
} }
@ -29,7 +27,7 @@ require_once 'learnpathItem.class.php';
/** /**
* Display initialisation and security checks * Display initialisation and security checks
*/ */
//extra javascript functions for in html head: // Extra javascript functions for in html head:
$htmlHeadXtra[] = $htmlHeadXtra[] =
"<script language='javascript' type='text/javascript'> "<script language='javascript' type='text/javascript'>
@ -44,25 +42,23 @@ function confirmation(name)
$nameTools = get_lang(ucfirst(TOOL_LEARNPATH)); $nameTools = get_lang(ucfirst(TOOL_LEARNPATH));
event_access_tool(TOOL_LEARNPATH); event_access_tool(TOOL_LEARNPATH);
if (! $is_allowed_in_course) api_not_allowed(); if (!$is_allowed_in_course) api_not_allowed();
/** /**
* Display * Display
*/ */
/* Require the search widget and prepare the header with its stuff */ /* Require the search widget and prepare the header with its stuff. */
if (api_get_setting('search_enabled') == 'true') { if (api_get_setting('search_enabled') == 'true') {
require api_get_path(LIBRARY_PATH).'search/search_widget.php'; require api_get_path(LIBRARY_PATH).'search/search_widget.php';
search_widget_prepare(&$htmlHeadXtra); search_widget_prepare(&$htmlHeadXtra);
} }
Display::display_header($nameTools,"Path"); Display::display_header($nameTools, 'Path');
$current_session = api_get_session_id(); $current_session = api_get_session_id();
//api_display_tool_title($nameTools); //api_display_tool_title($nameTools);
/* /* Introduction section (editable by course admins) */
Introduction section
(editable by course admins)
*/
Display::display_introduction_section(TOOL_LEARNPATH, array( Display::display_introduction_section(TOOL_LEARNPATH, array(
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/', 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/', 'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/',
@ -70,46 +66,44 @@ Display::display_introduction_section(TOOL_LEARNPATH, array(
) )
); );
$is_allowed_to_edit = api_is_allowed_to_edit(null,true); $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if ($is_allowed_to_edit) { if ($is_allowed_to_edit) {
/*
DIALOG BOX SECTION /* DIALOG BOX SECTION */
*/
if (!empty($dialog_box)) {
if (!empty($dialog_box)) { switch ($_GET['dialogtype']) {
switch ($_GET['dialogtype']) case 'confirmation':
{ Display::display_confirmation_message($dialog_box);
case 'confirmation': break;
Display::display_confirmation_message($dialog_box); case 'error':
break; Display::display_error_message($dialog_box);
case 'error': break;
Display::display_error_message($dialog_box); case 'warning':
break; Display::display_warning_message($dialog_box);
case 'warning': break;
Display::display_warning_message($dialog_box); default:
break; Display::display_normal_message($dialog_box);
default: break;
Display::display_normal_message($dialog_box); }
break; }
} if (api_failure::get_last_failure()) {
} Display::display_normal_message(api_failure::get_last_failure());
if (api_failure::get_last_failure()) { }
Display::display_normal_message(api_failure::get_last_failure());
} //include 'content_makers.inc.php';
echo '<div class="actions">';
//include 'content_makers.inc.php'; echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'.
echo '<div class="actions">';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'.
'<img src="../img/wizard.gif" border="0" align="absmiddle" alt="'.get_lang('_add_learnpath'). '<img src="../img/wizard.gif" border="0" align="absmiddle" alt="'.get_lang('_add_learnpath').
'">&nbsp;'.get_lang('_add_learnpath'). '">&nbsp;'.get_lang('_add_learnpath').
'</a>' . '</a>' .
str_repeat('&nbsp;',3). str_repeat('&nbsp;', 3).
'<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/file_zip.gif" border="0" alt="'.get_lang("UploadScorm").'" align="absmiddle">&nbsp;'.get_lang("UploadScorm").'</a>'; '<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/file_zip.gif" border="0" alt="'.get_lang('UploadScorm').'" align="absmiddle">&nbsp;'.get_lang('UploadScorm').'</a>';
if (api_get_setting('service_ppt2lp', 'active') == 'true') { if (api_get_setting('service_ppt2lp', 'active') == 'true') {
echo str_repeat('&nbsp;',3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/powerpoint.gif" border="0" alt="'.get_lang("PowerPointConvert").'" align="absmiddle">&nbsp;'.get_lang("PowerPointConvert").'</a>'; echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_ppt.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/powerpoint.gif" border="0" alt="'.get_lang('PowerPointConvert').'" align="absmiddle">&nbsp;'.get_lang('PowerPointConvert').'</a>';
//echo str_repeat('&nbsp;',3).'<a href="../upload/upload_word.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/word.gif" border="0" alt="'.get_lang("WordConvert").'" align="absmiddle">&nbsp;'.get_lang("WordConvert").'</a>'; //echo str_repeat('&nbsp;', 3).'<a href="../upload/upload_word.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/word.gif" border="0" alt="'.get_lang('WordConvert').'" align="absmiddle">&nbsp;'.get_lang('WordConvert').'</a>';
} }
echo '</div>'; echo '</div>';
} }
@ -117,32 +111,30 @@ echo '<table width="100%" border="0" cellspacing="2" class="data_table">';
$is_allowed_to_edit ? $colspan = 9 : $colspan = 3; $is_allowed_to_edit ? $colspan = 9 : $colspan = 3;
/* /*
if ($curDirName) // if the $curDirName is empty, we're in the root point and we can't go to a parent dir if ($curDirName) { // If the $curDirName is empty, we're in the root point and we can't go to a parent dir.
{ ?>
?> <!-- parent dir -->
<!-- parent dir --> <a href="<?php echo api_get_self().'?'.api_get_cidreq().'&openDir='.$cmdParentDir.'&subdirs=yes'; ?>">
<a href="<?php echo api_get_self().'?'.api_get_cidreq().'&openDir='.$cmdParentDir.'&subdirs=yes'; ?>"> <img src="../img/parent.gif" border="0" align="absbottom" hspace="5" alt="parent" />
<img src="../img/parent.gif" border="0" align="absbottom" hspace="5" alt="parent" /> <?php echo get_lang('Up'); ?></a>&nbsp;
<?php echo get_lang("Up"); ?></a>&nbsp; <?php
<?php
} }
*/ */
if (!empty($curDirPath)) if (!empty($curDirPath)) {
{ if (substr($curDirPath, 1, 1) == '/') {
if(substr($curDirPath,1,1)=='/'){ $tmpcurDirPath=substr($curDirPath,1,strlen($curDirPath));
$tmpcurDirPath=substr($curDirPath,1,strlen($curDirPath)); } else {
}else{ $tmpcurDirPath = $curDirPath;
$tmpcurDirPath = $curDirPath; }
} ?>
?> <!-- current dir name -->
<!-- current dir name --> <tr>
<tr> <td colspan="<?php echo $colspan; ?>" align="left" bgcolor="#4171B5">
<td colspan="<?php echo $colspan ?>" align="left" bgcolor="#4171B5"> <img src="../img/opendir.gif" align="absbottom" vspace="2" hspace="3" alt="open_dir" />
<img src="../img/opendir.gif" align="absbottom" vspace="2" hspace="3" alt="open_dir" /> <font color="#ffffff"><b><?php echo $tmpcurDirPath; ?></b></font>
<font color="#ffffff"><b><?php echo $tmpcurDirPath ?></b></font> </td>
</td> </tr>
</tr> <?php
<?php
} }
/* CURRENT DIRECTORY */ /* CURRENT DIRECTORY */
@ -151,22 +143,21 @@ echo '<tr>';
echo '<th>'.get_lang('Title').'</th>'."\n" . echo '<th>'.get_lang('Title').'</th>'."\n" .
'<th>'.get_lang('Progress')."</th>\n"; '<th>'.get_lang('Progress')."</th>\n";
if ($is_allowed_to_edit) { if ($is_allowed_to_edit) {
echo '<th>'.get_lang('CourseSettings')."</th>\n" . echo '<th>'.get_lang('CourseSettings')."</th>\n" .
//xport now is inside "Edit" // Export now is inside "Edit"
//'<th>'.get_lang('ExportShort')."</th>\n" . //'<th>'.get_lang('ExportShort')."</th>\n" .
'<th>'.get_lang('AuthoringOptions')."</th>\n"; '<th>'.get_lang('AuthoringOptions')."</th>\n";
// only available for not session mode // Only available for not session mode.
if ($current_session == 0) { if ($current_session == 0) {
echo'<th>'.get_lang('Move')."</th>\n"; echo'<th>'.get_lang('Move')."</th>\n";
} }
} }
echo "</tr>\n"; echo "</tr>\n";
/* DISPLAY SCORM LIST */
/*--------------------------------------
DISPLAY SCORM LIST
--------------------------------------*/
$list = new LearnpathList(api_get_user_id()); $list = new LearnpathList(api_get_user_id());
$flat_list = $list->get_flat_list(); $flat_list = $list->get_flat_list();
$test_mode = api_get_setting('server_type'); $test_mode = api_get_setting('server_type');
@ -176,106 +167,101 @@ if (is_array($flat_list)) {
$counter = 0; $counter = 0;
$current = 0; $current = 0;
foreach ($flat_list as $id => $details) { foreach ($flat_list as $id => $details) {
//validacion when belongs to a session // Validacion when belongs to a session
$session_img = api_get_session_image($details['lp_session'], $_user['status']); $session_img = api_get_session_image($details['lp_session'], $_user['status']);
if(!$is_allowed_to_edit && $details['lp_visibility'] == 0) if (!$is_allowed_to_edit && $details['lp_visibility'] == 0) {
{ // This is a student and this path is invisible, skip.
// This is a student and this path is invisible, skip continue;
continue; }
}
// check if the learnpath is visible for student // Check if the learnpath is visible for student.
if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id,api_get_user_id())) { if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, api_get_user_id())) {
continue; continue;
} }
$counter++; $counter++;
if (($counter % 2)==0) { $oddclass="row_odd"; } else { $oddclass="row_even"; } if (($counter % 2) == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; }
$url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id; $url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
$name = Security::remove_XSS($details['lp_name']); $name = Security::remove_XSS($details['lp_name']);
$image='<img src="../img/kcmdf.gif" border="0" align="absmiddle" alt="' . $name . '">'."\n"; $image='<img src="../img/kcmdf.gif" border="0" align="absmiddle" alt="' . $name . '">'."\n";
$dsp_line = '<tr align="center" class="'.$oddclass.'">'."\n" . $dsp_line = '<tr align="center" class="'.$oddclass.'">'."\n" .
'<td align="left" valign="top">' . '<td align="left" valign="top">' .
'<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_lp.'">' . '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_lp.'">' .
$image . '</a></div><a href="'.$url_start_lp.'">' . $name . '</a>' . $session_img . $image . '</a></div><a href="'.$url_start_lp.'">' . $name . '</a>' . $session_img .
"</td>\n"; "</td>\n";
//$dsp_desc='<td>'.$details['lp_desc'].'</td>'."\n"; //$dsp_desc='<td>'.$details['lp_desc'].'</td>'."\n";
$dsp_desc = ''; $dsp_desc = '';
$dsp_export = ''; $dsp_export = '';
$dsp_edit = ''; $dsp_edit = '';
$dsp_build = ''; $dsp_build = '';
$dsp_edit_close = ''; $dsp_edit_close = '';
$dsp_delete = ''; $dsp_delete = '';
$dsp_visible = ''; $dsp_visible = '';
$dsp_default_view = ''; $dsp_default_view = '';
$dsp_debug = ''; $dsp_debug = '';
$dsp_order = ''; $dsp_order = '';
// Select course theme // Select course theme.
if (!empty($platform_theme)) if (!empty($platform_theme)) {
{ $mystyle = $platform_theme;
$mystyle=$platform_theme;
} }
if (!empty($user_theme)) if (!empty($user_theme)) {
{ $mystyle = $user_theme;
$mystyle=$user_theme;
} }
if (!empty($mycoursetheme)) if (!empty($mycoursetheme)) {
{ $mystyle = $mycoursetheme;
$mystyle=$mycoursetheme;
} }
$lp_theme_css=$mystyle; $lp_theme_css = $mystyle;
if ($display_progress_bar) {
$dsp_progress = '<td width="140px">'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id, api_get_user_id()), '').'</td>';
} else {
$dsp_progress = '<td width="140px" style="padding-top:1em;">'.learnpath::get_db_progress($id, api_get_user_id(), 'both').'</td>';
}
if ($is_allowed_to_edit) {
if($display_progress_bar) { /*
$dsp_progress = '<td width="140px">'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id,api_get_user_id()),'').'</td>'; if ($current_session == $details['lp_session']) {
} else { $dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'">&nbsp;&nbsp;<img src="../img/edit.gif" border="0" title="'.get_lang('_edit_learnpath').'"></a></td>'."\n";
$dsp_progress = '<td width="140px" style="padding-top:1em;">'.learnpath::get_db_progress($id,api_get_user_id(),'both').'</td>'; } else {
} $dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'<img src="../img/edit_na.gif" border="0" title="'.get_lang('_edit_learnpath').'"></td>'." ";
if($is_allowed_to_edit) { }
*/
/* $dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'</td>'."\n";
if ($current_session == $details['lp_session']) {
$dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'">&nbsp;&nbsp;<img src="../img/edit.gif" border="0" title="'.get_lang('_edit_learnpath').'"></a></td>'."\n";
} else {
$dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'<img src="../img/edit_na.gif" border="0" title="'.get_lang('_edit_learnpath').'"></td>'."\n";
}
*/
$dsp_desc = '<td valign="middle" style="color: grey; padding-top:1em;"><em>'.$details['lp_maker'].'</em> &nbsp;&nbsp; '.$details['lp_proximity'].' &nbsp;&nbsp; '.$details['lp_encoding'].'</td>'."\n"; /* Export */
/* export */ // Export is inside "Edit"
//Export is inside "Edit" // export not available for normal lps yet
//export not available for normal lps yet /*if ($details['lp_type'] == 1) {
/*if($details['lp_type']==1){
$dsp_export = '<td align="center">' . $dsp_export = '<td align="center">' .
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . "<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
"</a>" . "</a>";
""; } elseif ($details['lp_type'] == 2) {
}elseif($details['lp_type']==2){
$dsp_export = '<td align="center">' . $dsp_export = '<td align="center">' .
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" . "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" .
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . "<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
"</a>" . "</a>";
""; } else {
}else{
$dsp_export = '<td align="center">' . $dsp_export = '<td align="center">' .
//"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . //"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
"<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . "<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
//"</a>" . //"</a>";
"";
}*/ }*/
/* edit title and description */
/* Edit title and description */
$dsp_edit = '<td align="center">'; $dsp_edit = '<td align="center">';
$dsp_edit_close = '</td>'; $dsp_edit_close = '</td>';
// EDIT LP // EDIT LP
if ($current_session == $details['lp_session']) { if ($current_session == $details['lp_session']) {
@ -284,152 +270,140 @@ if (is_array($flat_list)) {
$dsp_edit_lp = '<img src="../img/edit_na.gif" border="0" title="'.get_lang('_edit_learnpath').'">&nbsp;'; $dsp_edit_lp = '<img src="../img/edit_na.gif" border="0" title="'.get_lang('_edit_learnpath').'">&nbsp;';
} }
// BUILD // BUILD
if ($current_session == $details['lp_session']) { if ($current_session == $details['lp_session']) {
if($details['lp_type']==1 || $details['lp_type']==2){ if ($details['lp_type'] == 1 || $details['lp_type'] == 2) {
$dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=build&amp;lp_id='.$id.'"><img src="../img/wizard.gif" border="0" title="'.get_lang("Build").'"></a>&nbsp;'; $dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=build&amp;lp_id='.$id.'"><img src="../img/wizard.gif" border="0" title="'.get_lang('Build').'"></a>&nbsp;';
} else { } else {
$dsp_build = '<img src="../img/wizard_gray.gif" border="0" title="'.get_lang("Build").'">&nbsp;'; $dsp_build = '<img src="../img/wizard_gray.gif" border="0" title="'.get_lang('Build').'">&nbsp;';
} }
} else { } else {
$dsp_build = '<img src="../img/wizard_gray.gif" border="0" title="'.get_lang("Build").'">&nbsp;'; $dsp_build = '<img src="../img/wizard_gray.gif" border="0" title="'.get_lang('Build').'">&nbsp;';
} }
/* VISIBILITY COMMAND */ /* VISIBILITY COMMAND */
// session test not necessary if we want to show base course learning paths inside the session (see http://support.chamilo.org/projects/chamilo-18/wiki/Tools_and_sessions) // Session test not necessary if we want to show base course learning paths inside the session (see http://support.chamilo.org/projects/chamilo-18/wiki/Tools_and_sessions).
//if ($current_session == $details['lp_session']) { //if ($current_session == $details['lp_session']) {
if ($details['lp_visibility'] == 0) if ($details['lp_visibility'] == 0) {
{ $dsp_visible = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=1\">" .
$dsp_visible = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=1\">" . "<img src=\"../img/invisible.gif\" border=\"0\" title=\"".get_lang('Show')."\" />" .
"<img src=\"../img/invisible.gif\" border=\"0\" title=\"".get_lang('Show')."\" />" . "</a>";
"</a>"; } else {
}
else
{
$dsp_visible = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=0'>" . $dsp_visible = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=0'>" .
"<img src=\"../img/visible.gif\" border=\"0\" title=\"".get_lang('Hide')."\" />" . "<img src=\"../img/visible.gif\" border=\"0\" title=\"".get_lang('Hide')."\" />" .
"</a>"; "</a>";
} }
//} else { //} else {
// $dsp_visible = '<img src="../img/invisible.gif" border="0" title="'.get_lang('Show').'" />'; // $dsp_visible = '<img src="../img/invisible.gif" border="0" title="'.get_lang('Show').'" />';
//} //}
/* PUBLISH COMMAND */ /* PUBLISH COMMAND */
if ($current_session == $details['lp_session']) { if ($current_session == $details['lp_session']) {
if ($details['lp_published'] == "i") if ($details['lp_published'] == "i") {
{ $dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">" .
$dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">" . "<img src=\"../img/invisible_LP_list.gif\" border=\"0\" title=\"".get_lang('_publish')."\" />" .
"<img src=\"../img/invisible_LP_list.gif\" border=\"0\" title=\"".get_lang('_publish')."\" />" . "</a>";
"</a>" . } else {
"";
}
else
{
$dsp_publish = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=i'>" . $dsp_publish = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=i'>" .
"<img src=\"../img/visible_LP_list.gif\" border=\"0\" title=\"".get_lang('_no_publish')."\" />" . "<img src=\"../img/visible_LP_list.gif\" border=\"0\" title=\"".get_lang('_no_publish')."\" />" .
"</a>". "</a>";
"";
} }
} else { } else {
$dsp_publish = '<img src="../img/invisible_LP_list.gif" border="0" title="'.get_lang('_no_publish').'" />'; $dsp_publish = '<img src="../img/invisible_LP_list.gif" border="0" title="'.get_lang('_no_publish').'" />';
} }
/* MULTIPLE ATTEMPTS */
/* MULTIPLE ATTEMPTS */
if ($current_session == $details['lp_session']) { if ($current_session == $details['lp_session']) {
if($details['lp_prevent_reinit']==1){ if ($details['lp_prevent_reinit'] == 1) {
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' . $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' .
'<img src="../img/kaboodleloop_gray.gif" border="0" alt="Allow reinit" title="'.get_lang("AllowMultipleAttempts").'"/>' . '<img src="../img/kaboodleloop_gray.gif" border="0" alt="Allow reinit" title="'.get_lang('AllowMultipleAttempts').'"/>' .
'</a>&nbsp;'; '</a>&nbsp;';
}else{ } else {
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' . $dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_reinit&lp_id='.$id.'">' .
'<img src="../img/kaboodleloop.gif" border="0" alt="Prevent reinit" title="'.get_lang("PreventMultipleAttempts").'"/>' . '<img src="../img/kaboodleloop.gif" border="0" alt="Prevent reinit" title="'.get_lang('PreventMultipleAttempts').'"/>' .
'</a>&nbsp;'; '</a>&nbsp;';
} }
} else { } else {
$dsp_reinit = '<img src="../img/kaboodleloop_gray.gif" border="0" alt="Allow reinit" title="'.get_lang("AllowMultipleAttempts").'"/>'; $dsp_reinit = '<img src="../img/kaboodleloop_gray.gif" border="0" alt="Allow reinit" title="'.get_lang('AllowMultipleAttempts').'"/>';
} }
/* FUll screen VIEW */ /* FUll screen VIEW */
if ($current_session == $details['lp_session']) { if ($current_session == $details['lp_session']) {
/* Default view mode settings (fullscreen/embedded) */ /* Default view mode settings (fullscreen/embedded) */
if($details['lp_view_mode'] == 'fullscreen'){ if ($details['lp_view_mode'] == 'fullscreen') {
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' . $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
'<img src="../img/view_fullscreen.gif" border="0" alt="'.get_lang("ViewModeEmbedded").'" title="'.get_lang("ViewModeEmbedded").'"/>' . '<img src="../img/view_fullscreen.gif" border="0" alt="'.get_lang('ViewModeEmbedded').'" title="'.get_lang('ViewModeEmbedded').'"/>' .
'</a>&nbsp;'; '</a>&nbsp;';
}else{ } else {
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' . $dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.'">' .
'<img src="../img/view_choose.gif" border="0" alt="'.get_lang("ViewModeFullScreen").'" title="'.get_lang("ViewModeFullScreen").'"/>' . '<img src="../img/view_choose.gif" border="0" alt="'.get_lang('ViewModeFullScreen').'" title="'.get_lang('ViewModeFullScreen').'"/>' .
'</a>&nbsp;'; '</a>&nbsp;';
} }
} else { } else {
if($details['lp_view_mode'] == 'fullscreen') if ($details['lp_view_mode'] == 'fullscreen')
$dsp_default_view = '<img src="../img/view_fullscreen_na.gif" border="0" alt="'.get_lang("ViewModeEmbedded").'" title="'.get_lang("ViewModeEmbedded").'"/>'; $dsp_default_view = '<img src="../img/view_fullscreen_na.gif" border="0" alt="'.get_lang('ViewModeEmbedded').'" title="'.get_lang('ViewModeEmbedded').'"/>';
else else
$dsp_default_view = '<img src="../img/view_choose_na.gif" border="0" alt="'.get_lang("ViewModeEmbedded").'" title="'.get_lang("ViewModeFullScreen").'"/>'; $dsp_default_view = '<img src="../img/view_choose_na.gif" border="0" alt="'.get_lang('ViewModeEmbedded').'" title="'.get_lang('ViewModeFullScreen').'"/>';
} }
/* Increase SCORM recording */ /* Increase SCORM recording */
/* /*
if($details['lp_force_commit'] == 1){ if ($details['lp_force_commit'] == 1) {
$dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' . $dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
'<img src="../img/clock.gif" border="0" alt="Normal SCORM recordings" title="'.get_lang("MakeScormRecordingNormal").'"/>' . '<img src="../img/clock.gif" border="0" alt="Normal SCORM recordings" title="'.get_lang('MakeScormRecordingNormal').'"/>' .
'</a>&nbsp;'; '</a>&nbsp;';
}else{ }else{
$dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' . $dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
'<img src="../img/clock_gray.gif" border="0" alt="Extra SCORM recordings" title="'.get_lang("MakeScormRecordingExtra").'"/>' . '<img src="../img/clock_gray.gif" border="0" alt="Extra SCORM recordings" title="'.get_lang('MakeScormRecordingExtra').'"/>' .
'</a>&nbsp;'; '</a>&nbsp;';
} }
*/ */
/* DEBUG */ /* DEBUG */
if($test_mode == 'test' or api_is_platform_admin()) { if ($test_mode == 'test' or api_is_platform_admin()) {
if($details['lp_scorm_debug']==1){ if ($details['lp_scorm_debug'] == 1) {
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' . $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' .
'<img src="../img/bug.gif" border="0" alt="'.get_lang("HideDebug").'" title="'.get_lang("HideDebug").'"/>' . '<img src="../img/bug.gif" border="0" alt="'.get_lang("HideDebug").'" title="'.get_lang("HideDebug").'"/>' .
'</a>'; '</a>';
}else{ }else{
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' . $dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">' .
'<img src="../img/bug_gray.gif" border="0" alt="'.get_lang("ShowDebug").'" title="'.get_lang("ShowDebug").'"/>' . '<img src="../img/bug_gray.gif" border="0" alt="'.get_lang("ShowDebug").'" title="'.get_lang("ShowDebug").'"/>' .
'</a>'; '</a>';
} }
} }
/* DELETE COMMAND */ /* DELETE COMMAND */
if ($current_session == $details['lp_session']) { if ($current_session == $details['lp_session']) {
$dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" " . $dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" " .
"onClick=\"return confirmation('".addslashes($name)."');\">" . "onclick=\"javascript: return confirmation('".addslashes($name)."');\">" .
"<img src=\"../img/delete.gif\" border=\"0\" title=\"".get_lang('_delete_learnpath')."\" />" . "<img src=\"../img/delete.gif\" border=\"0\" title=\"".get_lang('_delete_learnpath')."\" />" .
"</a>"; "</a>";
} else { } else {
$dsp_delete = '<img src="../img/delete_na.gif" border="0" title="'.get_lang('_delete_learnpath').'" />'; $dsp_delete = '<img src="../img/delete_na.gif" border="0" title="'.get_lang('_delete_learnpath').'" />';
} }
/* Export */
if($details['lp_type']==1){ /* Export */
if ($details['lp_type'] == 1) {
$dsp_disk = $dsp_disk =
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . "<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
"</a>" . "</a>" .
""; "";
}elseif($details['lp_type']==2){ } elseif ($details['lp_type'] == 2) {
$dsp_disk = $dsp_disk =
"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name,'strict').".zip'>" . "<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".replace_dangerous_char($name, 'strict').".zip'>" .
"<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . "<img src=\"../img/cd.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
"</a>" . "</a>" .
""; "";
}else{ } else {
$dsp_disk = $dsp_disk =
//"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" . //"<a href='".api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id'>" .
"<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" . "<img src=\"../img/cd_gray.gif\" border=\"0\" title=\"".get_lang('Export')."\">" .
@ -441,50 +415,44 @@ if (is_array($flat_list)) {
//$dsp_disk=''; //$dsp_disk='';
/* COLUMN ORDER */ /* COLUMN ORDER */
// only active in a not session mode // Only active while session mode is not active
if ($current_session == 0) { if ($current_session == 0) {
if($details['lp_display_order'] == 1 && $max != 1) if ($details['lp_display_order'] == 1 && $max != 1) {
{ $dsp_order .= '<td><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' .
$dsp_order .= '<td><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' . '<img src="../img/arrow_down_0.gif" border="0" alt="'.get_lang('MoveDown').'" title="'.get_lang('MoveDown').'"/>' .
'<img src="../img/arrow_down_0.gif" border="0" alt="'.get_lang("MoveDown").'" title="'.get_lang("MoveDown").'"/>' . '</a><img src="../img/blanco.png" border="0" alt="" title="" /></td>';
'</a><img src="../img/blanco.png" border="0" alt="" title="" /></td>'; }
} elseif ($current == $max-1 && $max != 1) {
elseif($current == $max-1 && $max != 1) //last element $dsp_order .= '<td><img src="../img/blanco.png" border="0" alt="" title="" /><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' .
{ '<img src="../img/arrow_up_0.gif" border="0" alt="'.get_lang('MoveUp').'" title="'.get_lang('MoveUp').'"/>' .
$dsp_order .= '<td><img src="../img/blanco.png" border="0" alt="" title="" /><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' . '</a></td>';
'<img src="../img/arrow_up_0.gif" border="0" alt="'.get_lang("MoveUp").'" title="'.get_lang("MoveUp").'"/>' . }
'</a></td>'; elseif ($max == 1) {
} $dsp_order = '<td></td>';
elseif($max == 1) }
{ else {
$dsp_order = '<td></td>'; $dsp_order .= '<td><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' .
} '<img src="../img/arrow_down_0.gif" border="0" alt="'.get_lang('MoveDown').'" title="'.get_lang('MoveDown').'"/>' .
else '</a>&nbsp;';
{ $dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' .
$dsp_order .= '<td><a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">' . '<img src="../img/arrow_up_0.gif" border="0" alt="'.get_lang('MoveUp').'" title="'.get_lang('MoveUp').'"/>' .
'<img src="../img/arrow_down_0.gif" border="0" alt="'.get_lang("MoveDown").'" title="'.get_lang("MoveDown").'"/>' . '</a></td>';
'</a>&nbsp;'; }
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">' .
'<img src="../img/arrow_up_0.gif" border="0" alt="'.get_lang("MoveUp").'" title="'.get_lang("MoveUp").'"/>' .
'</a></td>';
}
} }
} // end if($is_allowedToEdit) } // end if ($is_allowedToEdit)
//echo $dsp_line.$dsp_desc.$dsp_export.$dsp_edit.$dsp_delete.$dsp_visible; //echo $dsp_line.$dsp_desc.$dsp_export.$dsp_edit.$dsp_delete.$dsp_visible;
echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_publish.$dsp_reinit.$dsp_default_view.$dsp_debug.$dsp_edit_lp.$dsp_delete.$dsp_disk.$dsp_order.$dsp_edit_close; echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_publish.$dsp_reinit.$dsp_default_view.$dsp_debug.$dsp_edit_lp.$dsp_delete.$dsp_disk.$dsp_order.$dsp_edit_close;
//echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_reinit.$dsp_force_commit.$dsp_delete; //echo $dsp_line.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_visible.$dsp_reinit.$dsp_force_commit.$dsp_delete;
echo "</tr>\n"; echo "</tr>\n";
$current ++; //counter for number of elements treated $current ++; //counter for number of elements treated
} // end foreach ($flat_list) } // end foreach ($flat_list)
//TODO print some user-friendly message if counter is still = 0 to tell nothing can be displayd yet // TODO: Erint some user-friendly message if counter is still = 0 to tell nothing can be displayd yet.
}// end if ( is_array($flat_list) } // end if ( is_array($flat_list)
echo "</table>"; echo "</table>";
echo "<br/><br/>"; echo "<br /><br />";
/* FOOTER */
/*
FOOTER
*/
Display::display_footer(); Display::display_footer();
?>

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Container script for the messages coming from the learnpath object. Initially, this wasn't supposed to be * Container script for the messages coming from the learnpath object. Initially, this wasn't supposed to be
* a separate file but rather some text included in lp_view.php, but SCORM involves loading a script that * a separate file but rather some text included in lp_view.php, but SCORM involves loading a script that
@ -14,11 +15,10 @@
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
/**
* Script // Flag to allow for anonymous user - needs to be set before global.inc.php.
*/
//flag to allow for anonymous user - needs to be set before global.inc.php
$use_anonymous = true; $use_anonymous = true;
require_once 'back_compat.inc.php'; require_once 'back_compat.inc.php';
$htmlHeadXtra[] = '<script language="javascript"> $htmlHeadXtra[] = '<script language="javascript">
@ -29,14 +29,14 @@ function cleanlog(){
} }
</script>'; </script>';
$scorm_css_header=true; $scorm_css_header = true;
$display_mode=''; $display_mode = '';
$lp_theme_log=true; $lp_theme_log = true;
include_once '../inc/reduced_header.inc.php'; include_once '../inc/reduced_header.inc.php';
?> ?>
<body> <body dir="<?php echo api_get_text_direction(); ?>">
<div id="log_content"> <div id="log_content">
</div> </div>
<div style="color: white;" onclick="cleanlog();">.</div> <div style="color: white;" onclick="javascript: cleanlog();">.</div>
</body> </body>
</html> </html>

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Container script for the messages coming from the learnpath object. Initially, this wasn't supposed to be * Container script for the messages coming from the learnpath object. Initially, this wasn't supposed to be
* a separate file but rather some text included in lp_view.php, but SCORM involves loading a script that * a separate file but rather some text included in lp_view.php, but SCORM involves loading a script that
@ -14,17 +15,18 @@
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
*/ */
/**
* Script // Flag to allow for anonymous user - needs to be set before global.inc.php.
*/
//flag to allow for anonymous user - needs to be set before global.inc.php
$use_anonymous = true; $use_anonymous = true;
// name of the language file that needs to be included
$language_file = "learnpath"; // Name of the language file that needs to be included.
$language_file = 'learnpath';
require_once 'back_compat.inc.php'; require_once 'back_compat.inc.php';
require_once 'learnpath.class.php'; require_once 'learnpath.class.php';
require_once 'scorm.class.php'; require_once 'scorm.class.php';
if (empty($debug)) {$debug=0;}
if (empty($debug)) { $debug = 0; }
$error = ''; $error = '';
$display_mode = ''; $display_mode = '';
if (isset($_SESSION['lpobject'])) { if (isset($_SESSION['lpobject'])) {
@ -33,18 +35,18 @@ if (isset($_SESSION['lpobject'])) {
$error = $_SESSION['oLP']->error; $error = $_SESSION['oLP']->error;
$display_mode = $_SESSION['oLP']->mode; $display_mode = $_SESSION['oLP']->mode;
} }
if ($debug>0) {error_log('New LP - Loaded lp_message : '.$_SERVER['REQUEST_URI'].' from '.$_SERVER['HTTP_REFERER'],0);} if ($debug > 0) { error_log('New LP - Loaded lp_message : '.$_SERVER['REQUEST_URI'].' from '.$_SERVER['HTTP_REFERER'], 0); }
$htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript"> $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var dokeos_xajax_handler = window.parent.oxajax; var dokeos_xajax_handler = window.parent.oxajax;
</script>'; </script>';
$lp_theme_css=$_SESSION['oLP']->get_theme(); $lp_theme_css=$_SESSION['oLP']->get_theme();
$scorm_css_header=true; $scorm_css_header = true;
include_once '../inc/reduced_header.inc.php'; include_once '../inc/reduced_header.inc.php';
//close the session immediately to avoid concurrent access problems // Close the session immediately to avoid concurrent access problems.
session_write_close(); session_write_close();
?> ?>
<body> <body dir="<?php echo api_get_text_direction(); ?>">
<div id="msg_div_id"> <div id="msg_div_id">
<?php <?php
echo $error; echo $error;

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php * This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php
* *
@ -10,34 +11,31 @@
* @package chamilo.learnpath * @package chamilo.learnpath
*/ */
/* /* INIT SECTION */
INIT SECTION
*/ $this_section = SECTION_COURSES;
$this_section=SECTION_COURSES;
api_protect_course_script(); api_protect_course_script();
/* /* Libraries */
Libraries
*/ // The main_api.lib.php, database.lib.php and display.lib.php
//the main_api.lib.php, database.lib.php and display.lib.php // libraries are included by default.
//libraries are included by default
include 'learnpath_functions.inc.php'; include 'learnpath_functions.inc.php';
//include '../resourcelinker/resourcelinker.inc.php'; //include '../resourcelinker/resourcelinker.inc.php';
include 'resourcelinker.inc.php'; include 'resourcelinker.inc.php';
//rewrite the language file, sadly overwritten by resourcelinker.inc.php // Rewrite the language file, sadly overwritten by resourcelinker.inc.php.
// name of the language file that needs to be included // Name of the language file that needs to be included.
$language_file = "learnpath"; $language_file = 'learnpath';
/* Header and action code */
/*
Header and action code
*/
$htmlHeadXtra[] = $_SESSION['oLP']->create_js(); $htmlHeadXtra[] = $_SESSION['oLP']->create_js();
/*
Constants and variables /* Constants and variables */
*/
$is_allowed_to_edit = api_is_allowed_to_edit(null,true); $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN); $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
@ -59,59 +57,49 @@ $moduleid = $_REQUEST['moduleid'];
$prereq = $_REQUEST['prereq']; $prereq = $_REQUEST['prereq'];
$type = $_REQUEST['type']; $type = $_REQUEST['type'];
*/ */
/*
MAIN CODE /* MAIN CODE */
*/
// using the resource linker as a tool for adding resources to the learning path // Using the resource linker as a tool for adding resources to the learning path.
if ($action=="add" and $type=="learnpathitem") if ($action == 'add' && $type == 'learnpathitem') {
{
$htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>"; $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
} }
if ( (! $is_allowed_to_edit) or ($isStudentView) ) if ((!$is_allowed_to_edit) || ($isStudentView)) {
{
error_log('New LP - User not authorized in lp_add_item.php'); error_log('New LP - User not authorized in lp_add_item.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id); header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
} }
//from here on, we are admin because of the previous condition, so don't check anymore // From here on, we are admin because of the previous condition, so don't check anymore.
$sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id"; $sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id";
$result=Database::query($sql_query); $result = Database::query($sql_query);
$therow=Database::fetch_array($result); $therow = Database::fetch_array($result);
//$admin_output = ''; //$admin_output = '';
/* /*
Course admin section Course admin section
- all the functions not available for students - always available in this case (page only shown to admin) - all the functions not available for students - always available in this case (page only shown to admin)
*/ */
/* /* SHOWING THE ADMIN TOOLS */
SHOWING THE ADMIN TOOLS
*/
/*
prerequisites setting end
*/
if (isset($_SESSION['gradebook'])){ if (isset($_SESSION['gradebook'])){
$gradebook= $_SESSION['gradebook']; $gradebook= $_SESSION['gradebook'];
} }
if (!empty($gradebook) && $gradebook=='view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[]= array ( $interbreadcrumb[] = array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook') 'name' => get_lang('ToolGradebook')
); );
} }
$interbreadcrumb[]= array ("url"=>"lp_controller.php?action=list", "name"=> get_lang("_learning_path")); $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('_learning_path'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
$interbreadcrumb[]= array ("url"=>api_get_self()."?action=build&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}")); // Theme calls
$show_learn_path = true;
$lp_theme_css = $_SESSION['oLP']->get_theme();
//Theme calls Display::display_header(null, 'Path');
$show_learn_path=true;
$lp_theme_css=$_SESSION['oLP']->get_theme();
Display::display_header(null,'Path');
//api_display_tool_title($therow['name']); //api_display_tool_title($therow['name']);
$suredel = trim(get_lang('AreYouSureToDelete')); $suredel = trim(get_lang('AreYouSureToDelete'));
@ -143,20 +131,19 @@ function confirmation(name)
//echo $admin_output; //echo $admin_output;
/* /* DISPLAY SECTION */
DISPLAY SECTION
*/
echo $_SESSION['oLP']->build_action_menu(); echo $_SESSION['oLP']->build_action_menu();
echo '<table cellpadding="0" cellspacing="0" class="lp_build">'; echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '<tr>'; echo '<tr>';
echo '<td class="tree">'; echo '<td class="tree">';
echo '<div class="lp_tree">'; echo '<div class="lp_tree">';
//build the tree with the menu items in it // Build the tree with the menu items in it.
echo $_SESSION['oLP']->build_tree(); echo $_SESSION['oLP']->build_tree();
echo '</div>'; echo '</div>';
echo '</td>'; echo '</td>';
echo '<td class="workspace">'; echo '<td class="workspace">';
if(isset($is_success) && $is_success === true) { if (isset($is_success) && $is_success === true) {
$msg = '<div class="lp_message" style="margin-bottom:10px;">'; $msg = '<div class="lp_message" style="margin-bottom:10px;">';
$msg .= 'The item has been moved.'; $msg .= 'The item has been moved.';
$msg .= '</div>'; $msg .= '</div>';
@ -168,8 +155,6 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
/* /* FOOTER */
FOOTER
*/
Display::display_footer(); Display::display_footer();
?>

@ -1,28 +1,31 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Script opened in an iframe and containing the learning path's navigation and progress bar * Script opened in an iframe and containing the learning path's navigation and progress bar
* @package chamilo.learnpath * @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL * @license GNU/GPL
*/ */
/**
* Script // Flag to allow for anonymous user - needs to be set before global.inc.php.
*/
//flag to allow for anonymous user - needs to be set before global.inc.php
$use_anonymous = true; $use_anonymous = true;
// name of the language file that needs to be included
$language_file[] = "scormdocument"; // Language files that needs to be included.
$language_file[] = "scorm"; $language_file[] = 'scormdocument';
$language_file[] = "learnpath"; $language_file[] = 'scorm';
$language_file[] = 'learnpath';
require_once 'back_compat.inc.php'; require_once 'back_compat.inc.php';
require_once 'learnpath.class.php'; require_once 'learnpath.class.php';
require_once 'scorm.class.php'; require_once 'scorm.class.php';
require_once 'aicc.class.php'; require_once 'aicc.class.php';
//error_log('New LP - Loaded lp_nav: '.$_SERVER['REQUEST_URI'],0);
//error_log('New LP - Loaded lp_nav: '.$_SERVER['REQUEST_URI'], 0);
$htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript"> $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
var dokeos_xajax_handler = window.parent.oxajax; var dokeos_xajax_handler = window.parent.oxajax;
</script>'; </script>';
$progress_bar = ''; $progress_bar = '';
$navigation_bar = ''; $navigation_bar = '';
$display_mode = ''; $display_mode = '';
@ -43,16 +46,16 @@ if (isset($_SESSION['lpobject'])) {
//Setting up the CSS theme if exists //Setting up the CSS theme if exists
include_once '../inc/reduced_header.inc.php'; include_once '../inc/reduced_header.inc.php';
if (!empty($lp_theme_css) && !empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1 ) { if (!empty($lp_theme_css) && !empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
global $lp_theme_css; global $lp_theme_css;
} else { } else {
$lp_theme_css=$my_style; $lp_theme_css = $my_style;
} }
//$progress_bar = $_SESSION['oLP']->get_progress_bar(); //$progress_bar = $_SESSION['oLP']->get_progress_bar();
$progress_bar = $_SESSION['oLP']->get_progress_bar('',-1,'',true); $progress_bar = $_SESSION['oLP']->get_progress_bar('', -1, '', true);
$navigation_bar = $_SESSION['oLP']->get_navigation_bar(); $navigation_bar = $_SESSION['oLP']->get_navigation_bar();
$mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart); $mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart);
} }
session_write_close(); session_write_close();
?> ?>
<span><?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?></span> <span><?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?></span>

@ -8,9 +8,8 @@
*/ */
/** /**
* Init * Initialization is to be done by lp_controller.php.
*/ */
//done by lp_controller.php
/** /**
* Switching within the field to update * Switching within the field to update

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script displays statistics on the current learning path (scorm) * This script displays statistics on the current learning path (scorm)
* *
@ -14,7 +15,7 @@ require_once 'resourcelinker.inc.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php'; require_once api_get_path(LIBRARY_PATH).'course.lib.php';
if(empty($_SESSION['_course']['id']) && isset($_GET['course'])) { if (empty($_SESSION['_course']['id']) && isset($_GET['course'])) {
$course_code = Security::remove_XSS($_GET['course']); $course_code = Security::remove_XSS($_GET['course']);
} else { } else {
$course_code = $_SESSION['_course']['id']; $course_code = $_SESSION['_course']['id'];
@ -30,9 +31,9 @@ $session_condition = api_get_session_condition($session_id);
//$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id); //$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
//$user_id = $_user['user_id']; //$user_id = $_user['user_id'];
//$stats_charset = $_SESSION['oLP']->encoding //$stats_charset = $_SESSION['oLP']->encoding
if(!isset($origin)) if (!isset($origin))
$origin = ''; $origin = '';
if($origin != 'tracking') { if ($origin != 'tracking') {
if (!empty ($stats_charset)) { if (!empty ($stats_charset)) {
$lp_charset = $stats_charset; $lp_charset = $stats_charset;
} else { } else {
@ -48,28 +49,28 @@ if($origin != 'tracking') {
include_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php'; include_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php';
echo '<body>'; echo '<body>';
} else { } else {
//Get learning path's encoding // Get learning path's encoding.
$TBL_LP = Database :: get_course_table(TABLE_LP_MAIN); $TBL_LP = Database :: get_course_table(TABLE_LP_MAIN);
$sql = "SELECT default_encoding FROM $TBL_LP " . $sql = "SELECT default_encoding FROM $TBL_LP " .
"WHERE id = '".(int)$_GET['lp_id']."'"; "WHERE id = '".(int)$_GET['lp_id']."'";
$res = Database::query($sql); $res = Database::query($sql);
if (Database :: num_rows($res) > 0) { if (Database :: num_rows($res) > 0) {
$row = Database::fetch_array($res); $row = Database::fetch_array($res);
$lp_charset = $row['default_encoding']; $lp_charset = $row['default_encoding'];
} }
} }
// The dokeos interface's encoding // The Chamilo interface's encoding
$dokeos_charset = api_get_setting('platform_charset'); $dokeos_charset = api_get_setting('platform_charset');
$output = ''; $output = '';
//if display in fullscreen required // if display in fullscreen required.
if (!empty($_GET['fs']) && strcmp($_GET['fs'], 'true') == 0) { if (!empty($_GET['fs']) && strcmp($_GET['fs'], 'true') == 0) {
$output .= '<table width="100%" align="center">'; $output .= '<table width="100%" align="center">';
} else { } else {
$output .= '<table width="100%">'; $output .= '<table width="100%">';
} }
//check if the user asked for the "extend all" option // Check if the user asked for the "extend all" option.
$extend_all_link = ''; $extend_all_link = '';
$extend_all = 0; $extend_all = 0;
if ($origin == 'tracking') { if ($origin == 'tracking') {
@ -89,9 +90,10 @@ if ($origin != 'tracking') {
$output .= "<tr><td><div class='title'>" . api_convert_encoding(get_lang('ScormMystatus'), $lp_charset, $dokeos_charset) . "</div></td></tr>"; $output .= "<tr><td><div class='title'>" . api_convert_encoding(get_lang('ScormMystatus'), $lp_charset, $dokeos_charset) . "</div></td></tr>";
} }
$output .= "<tr><td>&nbsp;</td></tr>" . "<tr><td>" . "<table border='0' class='data_table'><tr>\n" . '<td width="16">' . $extend_all_link . '</td>' . '<td colspan="4" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormLessonTitle'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormStatus'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormScore'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormTime'), $lp_charset, $dokeos_charset) . "</div></td><td class='title'><div class='mystatusfirstrow'>" . api_convert_encoding(get_lang('Actions'), $lp_charset, $dokeos_charset) . "</div></td></tr>\n"; $output .= "<tr><td>&nbsp;</td></tr>" . "<tr><td>" . "<table border='0' class='data_table'><tr>\n" . '<td width="16">' . $extend_all_link . '</td>' . '<td colspan="4" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormLessonTitle'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormStatus'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormScore'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormTime'), $lp_charset, $dokeos_charset) . "</div></td><td class='title'><div class='mystatusfirstrow'>" . api_convert_encoding(get_lang('Actions'), $lp_charset, $dokeos_charset) . "</div></td></tr>\n";
//going through the items using the $items[] array instead of the database order ensures
// Going through the items using the $items[] array instead of the database order ensures
// we get them in the same order as in the imsmanifest file, which is rather random when using // we get them in the same order as in the imsmanifest file, which is rather random when using
// the database table // the database table.
$TBL_LP_ITEM = Database :: get_course_table(TABLE_LP_ITEM); $TBL_LP_ITEM = Database :: get_course_table(TABLE_LP_ITEM);
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$TBL_LP_VIEW = Database :: get_course_table(TABLE_LP_VIEW); $TBL_LP_VIEW = Database :: get_course_table(TABLE_LP_VIEW);
@ -99,7 +101,7 @@ $tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_E
$tbl_stats_attempts= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $tbl_stats_attempts= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$tbl_quiz_questions= Database :: get_course_table(TABLE_QUIZ_QUESTION); $tbl_quiz_questions= Database :: get_course_table(TABLE_QUIZ_QUESTION);
$sql = "SELECT max(view_count) FROM $TBL_LP_VIEW " . $sql = "SELECT max(view_count) FROM $TBL_LP_VIEW " .
"WHERE lp_id = $lp_id AND user_id = '" . $user_id . "' $session_condition"; "WHERE lp_id = $lp_id AND user_id = '" . $user_id . "' $session_condition";
$res = Database::query($sql); $res = Database::query($sql);
$view = ''; $view = '';
$num = 0; $num = 0;
@ -109,7 +111,7 @@ if (Database :: num_rows($res) > 0) {
} }
$counter = 0; $counter = 0;
//error_log('New LP - Querying views for latest attempt: '.$sql,0); //error_log('New LP - Querying views for latest attempt: '.$sql, 0);
$total_score = 0; $total_score = 0;
$total_max_score = 0; $total_max_score = 0;
$total_time = 0; $total_time = 0;
@ -124,7 +126,7 @@ if (!empty($export_csv)) {
); );
} }
// get attempts of a exercise // Get attempts of a exercise.
if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) { if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) {
$clean_lp_item_id = Database::escape_string($_GET['my_lp_id']); $clean_lp_item_id = Database::escape_string($_GET['my_lp_id']);
$clean_lp_id = Database::escape_string($_GET['lp_id']); $clean_lp_id = Database::escape_string($_GET['lp_id']);
@ -133,7 +135,7 @@ if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) {
$res_path = Database::query($sql_path); $res_path = Database::query($sql_path);
$row_path = Database::fetch_array($res_path); $row_path = Database::fetch_array($res_path);
if (Database::num_rows($res_path) > 0 ){ if (Database::num_rows($res_path) > 0) {
if ($origin != 'tracking') { if ($origin != 'tracking') {
$sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row_path['path'] . '" AND exe_user_id="' . (int)api_get_user_id() . '" AND orig_lp_id = "'.(int)$clean_lp_id.'" AND orig_lp_item_id = "'.(int)$clean_lp_item_id.'" AND exe_cours_id="' . $clean_course_code. '" AND status <> "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date'; $sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row_path['path'] . '" AND exe_user_id="' . (int)api_get_user_id() . '" AND orig_lp_id = "'.(int)$clean_lp_id.'" AND orig_lp_item_id = "'.(int)$clean_lp_item_id.'" AND exe_cours_id="' . $clean_course_code. '" AND status <> "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date';
} else { } else {
@ -141,7 +143,6 @@ if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) {
} }
$sql_attempts; $sql_attempts;
} }
} }
$TBL_QUIZ = Database :: get_course_table(TABLE_QUIZ_TEST); $TBL_QUIZ = Database :: get_course_table(TABLE_QUIZ_TEST);
@ -150,12 +151,12 @@ if (is_array($list) && count($list) > 0) {
foreach ($list as $my_item_id) { foreach ($list as $my_item_id) {
$extend_this = 0; $extend_this = 0;
$qry_order = 'DESC'; $qry_order = 'DESC';
if ((!empty ($_GET['extend_id']) and $_GET['extend_id'] == $my_item_id) OR $extend_all) { if ((!empty ($_GET['extend_id']) && $_GET['extend_id'] == $my_item_id) || $extend_all) {
$extend_this = 1; $extend_this = 1;
$qry_order = 'ASC'; $qry_order = 'ASC';
} }
//prepare statement to go through each attempt
// Prepare statement to go through each attempt.
if (!empty ($view)) { if (!empty ($view)) {
$sql = "SELECT iv.status as mystatus, v.view_count as mycount, " . $sql = "SELECT iv.status as mystatus, v.view_count as mycount, " .
" iv.score as myscore, iv.total_time as mytime, i.id as myid, i.lp_id as mylpid, iv.lp_view_id as mylpviewid, " . " iv.score as myscore, iv.total_time as mytime, i.id as myid, i.lp_id as mylpid, iv.lp_view_id as mylpviewid, " .
@ -188,37 +189,37 @@ if (is_array($list) && count($list) > 0) {
" AND v.session_id = $session_id " . " AND v.session_id = $session_id " .
" ORDER BY iv.view_count $qry_order "; " ORDER BY iv.view_count $qry_order ";
} }
//$sql.'<br/>'; //echo $sql.'<br />';
$result = Database::query($sql); $result = Database::query($sql);
$num = Database :: num_rows($result); $num = Database :: num_rows($result);
$time_for_total = 'NaN'; $time_for_total = 'NaN';
$is_allowed_to_edit = api_is_allowed_to_edit(null,true); $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if (($extend_this || $extend_all) && $num > 0) { if (($extend_this || $extend_all) && $num > 0) {
$row = Database :: fetch_array($result); $row = Database :: fetch_array($result);
$result_disabled_ext_all = false; $result_disabled_ext_all = false;
if($row['item_type'] == 'quiz') { if ($row['item_type'] == 'quiz') {
//check results_disabled in quiz table // Check results_disabled in quiz table.
$my_path = Database::escape_string($row['path']); $my_path = Database::escape_string($row['path']);
$sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'"; $sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'";
$res_result_disabled = Database::query($sql); $res_result_disabled = Database::query($sql);
$row_result_disabled = Database::fetch_row($res_result_disabled); $row_result_disabled = Database::fetch_row($res_result_disabled);
if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0]===1) { if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0] === 1) {
$result_disabled_ext_all = true; $result_disabled_ext_all = true;
} }
} }
//echo '<br><pre>'; print_r($row); echo '</pre><br>'; //echo '<br /><pre>'; print_r($row); echo '</pre><br />';
//if there are several attempts, and the link to extend has been clicked, show each attempt... // If there are several attempts, and the link to extend has been clicked, show each attempt...
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
$extend_link=''; $extend_link = '';
if (!empty($inter_num)) { if (!empty($inter_num)) {
$extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n"; $extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n";
} }
@ -239,24 +240,24 @@ if (is_array($list) && count($list) > 0) {
do { do {
$row['iv_view_count']; $row['iv_view_count'];
//check if there are interactions below // Check if there are interactions below.
$extend_attempt_link = ''; $extend_attempt_link = '';
$extend_this_attempt = 0; $extend_this_attempt = 0;
if ((learnpath :: get_interactions_count_from_db($row['iv_id']) > 0 || learnpath :: get_objectives_count_from_db($row['iv_id']) > 0) && !$extend_all) { if ((learnpath :: get_interactions_count_from_db($row['iv_id']) > 0 || learnpath :: get_objectives_count_from_db($row['iv_id']) > 0) && !$extend_all) {
if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) { if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
//the extend button for this attempt has been clicked // The extend button for this attempt has been clicked.
$extend_this_attempt = 1; $extend_this_attempt = 1;
$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n"; $extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n";
} else { //same case if fold_attempt_id is set, so not implemented explicitly } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
//the extend button for this attempt has not been clicked // The extend button for this attempt has not been clicked.
$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n"; $extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n";
} }
} }
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
$lesson_status = $row['mystatus']; $lesson_status = $row['mystatus'];
$score = $row['myscore']; $score = $row['myscore'];
@ -277,15 +278,13 @@ if (is_array($list) && count($list) > 0) {
} else { } else {
$maxscore = $row['mymaxscore']; $maxscore = $row['mymaxscore'];
} }
} } else {
else
{
$maxscore = $row['mymaxscore']; $maxscore = $row['mymaxscore'];
} }
} }
//Remove "NaN" if any (@todo: locate the source of these NaN) // Remove "NaN" if any (@todo: locate the source of these NaN)
$time = str_replace('NaN', '00' . $h . '00\'00"', $time); $time = str_replace('NaN', '00' . $h . '00\'00"', $time);
if (($lesson_status == 'completed') or ($lesson_status == 'passed')) { if (($lesson_status == 'completed') || ($lesson_status == 'passed')) {
$color = 'green'; $color = 'green';
} else { } else {
$color = 'black'; $color = 'black';
@ -296,14 +295,11 @@ if (is_array($list) && count($list) > 0) {
'failed' => 'ScormFailed', 'failed' => 'ScormFailed',
'passed' => 'ScormPassed', 'passed' => 'ScormPassed',
'browsed' => 'ScormBrowsed', 'browsed' => 'ScormBrowsed',
'not attempted' => 'ScormNotAttempted', 'not attempted' => 'ScormNotAttempted'
); );
$my_lesson_status = api_convert_encoding(get_lang($mylanglist[$lesson_status]), $lp_charset, $dokeos_charset); $my_lesson_status = api_convert_encoding(get_lang($mylanglist[$lesson_status]), $lp_charset, $dokeos_charset);
if ($row['item_type'] != 'dokeos_chapter') { if ($row['item_type'] != 'dokeos_chapter') {
if (!$is_allowed_to_edit && $result_disabled_ext_all) { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
@ -342,19 +338,19 @@ if (is_array($list) && count($list) > 0) {
$list1 = learnpath :: get_iv_interactions_array($row['iv_id']); $list1 = learnpath :: get_iv_interactions_array($row['iv_id']);
foreach ($list1 as $id => $interaction) { foreach ($list1 as $id => $interaction) {
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
$student_response=urldecode($interaction['student_response']);//code added by isaac flores $student_response = urldecode($interaction['student_response']); // Code added by Isaac Flores.
$content_student_response=array(); $content_student_response = array();
$content_student_response=explode('__|',$student_response); $content_student_response = explode('__|',$student_response);
if (count($content_student_response)>0) { if (count($content_student_response)>0) {
if (count($content_student_response)>=3) { if (count($content_student_response) >= 3) {
$new_content_student_response=array_pop($content_student_response);//Pop the element off the end of array $new_content_student_response = array_pop($content_student_response); // Pop the element off the end of array.
} }
$student_response=implode(',',$content_student_response); $student_response = implode(',',$content_student_response);
} }
$output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td>' . $interaction['id'] . '</td>' . "\n" $output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td>' . $interaction['id'] . '</td>' . "\n"
//."<td><font color='$color'><div class='mystatus'>".api_convert_encoding($array_status[$lesson_status],$lp_charset,$lp_charset)."</div></font></td>\n" //."<td><font color='$color'><div class='mystatus'>".api_convert_encoding($array_status[$lesson_status],$lp_charset,$lp_charset)."</div></font></td>\n"
@ -366,9 +362,9 @@ if (is_array($list) && count($list) > 0) {
$list2 = learnpath :: get_iv_objectives_array($row['iv_id']); $list2 = learnpath :: get_iv_objectives_array($row['iv_id']);
foreach ($list2 as $id => $interaction) { foreach ($list2 as $id => $interaction) {
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
$output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td colspan="2">' . $interaction['objective_id'] . '</td>' . "\n" . $output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td colspan="2">' . $interaction['objective_id'] . '</td>' . "\n" .
'<td colspan="2">' . $interaction['status'] . "</td>\n" . '<td colspan="2">' . $interaction['status'] . "</td>\n" .
@ -387,39 +383,39 @@ if (is_array($list) && count($list) > 0) {
$result_disabled_ext_all = false; $result_disabled_ext_all = false;
if($row['item_type'] == 'quiz') { if ($row['item_type'] == 'quiz') {
//check results_disabled in quiz table // Check results_disabled in quiz table.
$my_path = Database::escape_string($my_path); $my_path = Database::escape_string($my_path);
$sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'"; $sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'";
$res_result_disabled = Database::query($sql); $res_result_disabled = Database::query($sql);
$row_result_disabled = Database::fetch_row($res_result_disabled); $row_result_disabled = Database::fetch_row($res_result_disabled);
if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0]===1) { if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0] === 1) {
$result_disabled_ext_all = true; $result_disabled_ext_all = true;
} }
} }
//check if there are interactions below // Check if there are interactions below.
$extend_attempt_link = ''; $extend_attempt_link = '';
$extend_this_attempt = 0; $extend_this_attempt = 0;
$inter_num = learnpath :: get_interactions_count_from_db($row['iv_id']); $inter_num = learnpath :: get_interactions_count_from_db($row['iv_id']);
$objec_num = learnpath :: get_objectives_count_from_db($row['iv_id']); $objec_num = learnpath :: get_objectives_count_from_db($row['iv_id']);
if (($inter_num > 0 || $objec_num > 0) && !$extend_all) { if (($inter_num > 0 || $objec_num > 0) && !$extend_all) {
if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) { if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
//the extend button for this attempt has been clicked // The extend button for this attempt has been clicked.
$extend_this_attempt = 1; $extend_this_attempt = 1;
$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'" border="0"></a>' . "\n"; $extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'" border="0"></a>' . "\n";
} else { //same case if fold_attempt_id is set, so not implemented explicitly } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
//the extend button for this attempt has not been clicked // The extend button for this attempt has not been clicked.
$extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" border="0"></a>' . "\n"; $extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" border="0"></a>' . "\n";
} }
} }
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
//$extend_link = '<img src="../img/invisible.gif" alt="extend_disabled">'; //$extend_link = '<img src="../img/invisible.gif" alt="extend_disabled">';
$extend_link = ''; $extend_link = '';
@ -427,14 +423,14 @@ if (is_array($list) && count($list) > 0) {
$extend_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" border="0"></a>'; $extend_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" border="0"></a>';
} }
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
$lesson_status = $row['mystatus']; $lesson_status = $row['mystatus'];
$score = $row['myscore']; $score = $row['myscore'];
$subtotal_time = $row['mytime']; $subtotal_time = $row['mytime'];
//if($row['mytime']==0){ //if ($row['mytime'] == 0) {
while ($tmp_row = Database :: fetch_array($result)) { while ($tmp_row = Database :: fetch_array($result)) {
$subtotal_time += $tmp_row['mytime']; $subtotal_time += $tmp_row['mytime'];
} }
@ -444,7 +440,7 @@ if (is_array($list) && count($list) > 0) {
$scoIdentifier = $row['myid']; $scoIdentifier = $row['myid'];
$title = $row['mytitle']; $title = $row['mytitle'];
// selecting the exe_id from stats attempts tables in order to look the max score value // Selecting the exe_id from stats attempts tables in order to look the max score value.
if ($origin != 'tracking') { if ($origin != 'tracking') {
$sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date DESC limit 1'; $sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" AND session_id = '.$session_id.' ORDER BY exe_date DESC limit 1';
} else { } else {
@ -473,7 +469,7 @@ if (is_array($list) && count($list) > 0) {
} }
} else { } else {
if ($row['item_type'] == 'quiz') { if ($row['item_type'] == 'quiz') {
// get score and total time from last attempt of a exercise en lp // Get score and total time from last attempt of a exercise en lp.
$sql = "SELECT score FROM $TBL_LP_ITEM_VIEW WHERE lp_item_id = '".(int)$my_id."' and lp_view_id = '".(int)$my_lp_view_id."' $sql = "SELECT score FROM $TBL_LP_ITEM_VIEW WHERE lp_item_id = '".(int)$my_id."' and lp_view_id = '".(int)$my_lp_view_id."'
ORDER BY view_count DESC limit 1"; ORDER BY view_count DESC limit 1";
$res_score = Database::query($sql); $res_score = Database::query($sql);
@ -489,11 +485,10 @@ if (is_array($list) && count($list) > 0) {
} else { } else {
$score = 0; $score = 0;
$subtotal_time = 0; $subtotal_time = 0;
} }
//echo $subtotal_time ; //echo $subtotal_time ;
//$time = learnpathItem :: get_scorm_time('js', $subtotal_time); //$time = learnpathItem :: get_scorm_time('js', $subtotal_time);
// selecting the max score from an attempt // Selecting the max score from an attempt.
$sql = "SELECT SUM(t.ponderation) as maxscore from ( SELECT distinct question_id, marks,ponderation FROM $tbl_stats_attempts as at " . $sql = "SELECT SUM(t.ponderation) as maxscore from ( SELECT distinct question_id, marks,ponderation FROM $tbl_stats_attempts as at " .
"INNER JOIN $tbl_quiz_questions as q on(q.id = at.question_id) where exe_id ='$id_last_attempt' ) as t"; "INNER JOIN $tbl_quiz_questions as q on(q.id = at.question_id) where exe_id ='$id_last_attempt' ) as t";
@ -512,7 +507,7 @@ if (is_array($list) && count($list) > 0) {
if (empty ($title)) { if (empty ($title)) {
$title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']); $title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);
} }
//Remove "NaN" if any (@todo: locate the source of these NaN) // Remove "NaN" if any (@todo: locate the source of these NaN)
//$time = str_replace('NaN', '00'.$h.'00\'00"', $time); //$time = str_replace('NaN', '00'.$h.'00\'00"', $time);
if (($lesson_status == 'completed') or ($lesson_status == 'passed')) { if (($lesson_status == 'completed') or ($lesson_status == 'passed')) {
@ -582,7 +577,7 @@ if (is_array($list) && count($list) > 0) {
} }
} else { } else {
$output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore)); $output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
} }
$output .= "</div></td>\n" . '<td colspan="2"><div class="mystatus">' . $time . "</div></td><td>$correct_test_link</td>\n"; $output .= "</div></td>\n" . '<td colspan="2"><div class="mystatus">' . $time . "</div></td><td>$correct_test_link</td>\n";
$output .= "</tr>\n"; $output .= "</tr>\n";
@ -608,14 +603,15 @@ if (is_array($list) && count($list) > 0) {
$csv_content[] = $temp; $csv_content[] = $temp;
} }
} }
$counter++; $counter++;
if ($extend_this_attempt OR $extend_all) { if ($extend_this_attempt OR $extend_all) {
$list1 = learnpath :: get_iv_interactions_array($row['iv_id']); $list1 = learnpath :: get_iv_interactions_array($row['iv_id']);
foreach ($list1 as $id => $interaction) { foreach ($list1 as $id => $interaction) {
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
$output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td>' . $interaction['id'] . '</td>' . "\n" $output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td>' . $interaction['id'] . '</td>' . "\n"
//."<td><font color='$color'><div class='mystatus'>"api_convert_encoding($array_status[$lesson_status],$lp_charset,$lp_charset)."</div></font></td>\n" //."<td><font color='$color'><div class='mystatus'>"api_convert_encoding($array_status[$lesson_status],$lp_charset,$lp_charset)."</div></font></td>\n"
@ -627,9 +623,9 @@ if (is_array($list) && count($list) > 0) {
$list2 = learnpath :: get_iv_objectives_array($row['iv_id']); $list2 = learnpath :: get_iv_objectives_array($row['iv_id']);
foreach ($list2 as $id => $interaction) { foreach ($list2 as $id => $interaction) {
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
$output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td colspan="2">' . $interaction['objective_id'] . '</td>' . "\n" . $output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td colspan="2">' . $interaction['objective_id'] . '</td>' . "\n" .
'<td colspan="2">' . $interaction['status'] . "</td>\n" . '<td colspan="2">' . $interaction['status'] . "</td>\n" .
@ -638,70 +634,70 @@ if (is_array($list) && count($list) > 0) {
} }
} }
// attempts list by exercise // Attempts listing by exercise.
if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id)) { if ((isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id)) {
$res_attempts = Database::query($sql_attempts); $res_attempts = Database::query($sql_attempts);
$num_attempts = Database :: num_rows($res_attempts); $num_attempts = Database :: num_rows($res_attempts);
if ($row['item_type'] === 'quiz') { if ($row['item_type'] === 'quiz') {
if ($num_attempts > 0) { if ($num_attempts > 0) {
$n=1; $n = 1;
while ($row_attempts = Database :: fetch_array($res_attempts)) { while ($row_attempts = Database :: fetch_array($res_attempts)) {
$my_score = $row_attempts['exe_result']; $my_score = $row_attempts['exe_result'];
$my_maxscore = $row_attempts['exe_weighting']; $my_maxscore = $row_attempts['exe_weighting'];
$my_exe_id = $row_attempts['exe_id']; $my_exe_id = $row_attempts['exe_id'];
$my_orig_lp = $row_attempts['orig_lp_id']; $my_orig_lp = $row_attempts['orig_lp_id'];
$my_orig_lp_item = $row_attempts['orig_lp_item_id']; $my_orig_lp_item = $row_attempts['orig_lp_item_id'];
$my_exo_exe_id=$row_attempts['exe_exo_id']; $my_exo_exe_id=$row_attempts['exe_exo_id'];
$mktime_start_date = convert_mysql_date($row_attempts['start_date']); $mktime_start_date = convert_mysql_date($row_attempts['start_date']);
$mktime_exe_date = convert_mysql_date($row_attempts['exe_date']); $mktime_exe_date = convert_mysql_date($row_attempts['exe_date']);
$mytime = ((int)$mktime_exe_date-(int)$mktime_start_date); $mytime = ((int)$mktime_exe_date-(int)$mktime_start_date);
$time_attemp = learnpathItem :: get_scorm_time('js', $mytime); $time_attemp = learnpathItem :: get_scorm_time('js', $mytime);
$time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
if (!$is_allowed_to_edit && $result_disabled_ext_all) { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
} else {
// Show only float when need it.
$my_score = float_format( $my_score, 1);
$my_maxscore =float_format($my_maxscore, 1);
if ($my_score == 0 ) {
$view_score = '0/'.$my_maxscore;
} else { } else {
//show only float when need it if ($my_maxscore == 0)
$my_score = float_format( $my_score, 1); $view_score = $my_score;
$my_maxscore =float_format($my_maxscore, 1); else
if ($my_score == 0 ){ $view_score = $my_score . '/' . $my_maxscore;
$view_score = '0/'.$my_maxscore;
} else {
if ($my_maxscore==0)
$view_score = $my_score;
else
$view_score = $my_score . '/' . $my_maxscore;
}
//$view_score = ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore));
} }
$time_attemp; //$view_score = ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore));
$output .= '<tr class="'.$oddclass.'" ><td>&nbsp;</td><td>'.$extend_attempt_link.'</td><td colspan="3">' . api_convert_encoding(get_lang('Attempt'), $lp_charset, $dokeos_charset) . ' ' . $n . '</td>' }
. '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . '</div></font></td><td colspan="2"><div class="mystatus" align="center">' . $view_score . '</div></td><td colspan="2"><div class="mystatus">' . $time_attemp . '</div></td>'; $time_attemp;
if ($origin != 'tracking') { $output .= '<tr class="'.$oddclass.'" ><td>&nbsp;</td><td>'.$extend_attempt_link.'</td><td colspan="3">' . api_convert_encoding(get_lang('Attempt'), $lp_charset, $dokeos_charset) . ' ' . $n . '</td>'
if (!$is_allowed_to_edit && $result_disabled_ext_all) { . '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . '</div></font></td><td colspan="2"><div class="mystatus" align="center">' . $view_score . '</div></td><td colspan="2"><div class="mystatus">' . $time_attemp . '</div></td>';
$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"></td>'; if ($origin != 'tracking') {
} else { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$output .= '<td><a href="../exercice/exercise_show.php?origin=student_progress&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id .$from_link. '" target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"></a></td>'; $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"></td>';
}
} else { } else {
if (!$is_allowed_to_edit && $result_disabled_ext_all ) { $output .= '<td><a href="../exercice/exercise_show.php?origin=student_progress&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id .$from_link. '" target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"></a></td>';
$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"></td>'; }
} else { } else {
$output .= '<td><a href="../exercice/exercise_show.php?origin=tracking_course&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id . '&total_time='.$mytime.'&my_exe_exo_id='.$my_exo_exe_id.$from_link.' " target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"></a></td>'; if (!$is_allowed_to_edit && $result_disabled_ext_all ) {
} $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"></td>';
} else {
$output .= '<td><a href="../exercice/exercise_show.php?origin=tracking_course&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id . '&total_time='.$mytime.'&my_exe_exo_id='.$my_exo_exe_id.$from_link.' " target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"></a></td>';
} }
$output .= '</tr>';
$n++;
} }
$output .= '</tr>';
$n++;
} }
$output .= '<tr><td colspan="12">&nbsp;</td></tr>';
} }
$output .= '<tr><td colspan="12">&nbsp;</td></tr>';
} }
}
} }
$total_time += $time_for_total; $total_time += $time_for_total;
//QUIZZ IN LP // QUIZZ IN LP
$a_my_id = array(); $a_my_id = array();
if (!empty($my_lp_id)) { if (!empty($my_lp_id)) {
$a_my_id[] = $my_lp_id; $a_my_id[] = $my_lp_id;
@ -721,7 +717,6 @@ if (!empty($a_my_id)) {
} }
$total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id); $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id);
} else { } else {
if ($origin == 'tracking') { if ($origin == 'tracking') {
$my_studen_id = $student_id; $my_studen_id = $student_id;
$my_course_id = Database::escape_string($_GET['course']); $my_course_id = Database::escape_string($_GET['course']);
@ -736,12 +731,12 @@ if (!empty($a_my_id)) {
} }
$total_time = learnpathItem :: get_scorm_time('js', $total_time); $total_time = learnpathItem :: get_scorm_time('js', $total_time);
//$total_time = str_replace('NaN','00:00:00',$total_time); //$total_time = str_replace('NaN', '00:00:00' ,$total_time);
$total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
$lp_type = learnpath :: get_type_static($lp_id); $lp_type = learnpath :: get_type_static($lp_id);
$total_percent = 0; $total_percent = 0;
if(!$is_allowed_to_edit && $result_disabled_ext_all) { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
} else { } else {
if (is_numeric($total_score)) if (is_numeric($total_score))
@ -751,9 +746,9 @@ if(!$is_allowed_to_edit && $result_disabled_ext_all) {
} }
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = "row_odd"; $oddclass = 'row_odd';
} else { } else {
$oddclass = "row_even"; $oddclass = 'row_even';
} }
if (empty($extend_all)) { if (empty($extend_all)) {

Loading…
Cancel
Save