$moduleImg = get_icon_url('quiz', 'CLQWZ'); } else { $moduleImg = get_icon_url(choose_image(basename($module['path']))); } $out .= '<img src="' . $moduleImg . '" alt="' . $contentType_alt . '" border="0" /> ' . "\n" . claro_htmlspecialchars(claro_utf8_decode($module['name'], get_conf('charset'))); } $out .= '</td>' . "\n"; if (claro_is_user_authenticated() && $module['contentType'] != CTLABEL_) { // display the progress value for current module $out .= '<td align="right">' . claro_html_progress_bar($progress, 1) . '</td>' . "\n" . '<td align="left">' . '<small> ' . $progress . '%</small>' . '</td>' . "\n"; } elseif (claro_is_user_authenticated() && $module['contentType'] == CTLABEL_) { $out .= '<td colspan="2"> </td>' . "\n"; } //-- reset link for current module if (claro_is_user_authenticated() && (get_conf('cllnp_resetByUserAllowed', false) || claro_is_allowed_to_edit())) { if (getModuleProgression(claro_get_current_user_id(), $_SESSION['path_id'], $module['learnPath_module_id'])) { $out .= '<td><a href="' . Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=resetModuleProgression&learnPath_module_id=' . $module['learnPath_module_id'] . '&path_id=' . $_SESSION['path_id']) . '" onclick="return confirm(\'' . clean_str_for_javascript(get_lang('Do you really want to reset module ') . $module['name']) . '?\');"><img src="' . get_icon_url('delete') . '" alt="' . get_lang('Reset') . '" /></a></td>' . "\n"; } else { $out .= '<td>' . get_lang('No results available') . '</td>' . "\n"; } } if ($progress > 0) { $globalProg = $globalProg + $progress; } if ($module['contentType'] != CTLABEL_) { $moduleNb++; } // increment number of modules used to compute global progression except if the module is a title $out .= '</tr>' . "\n\n"; $atleastOne = true; }
$out .= ' <a href="userReport.php?uInfo=' . $_REQUEST['uInfo'] . '&view=0100000&exoDet=' . $module['path'] . '">' . strtolower($module['lesson_status']) . '</a>'; } else { $out .= strtolower($module['lesson_status']); } $out .= '</td>' . "\n"; //-- progression if ($module['contentType'] != CTLABEL_) { // display the progress value for current module $out .= '<td align="right">' . claro_html_progress_bar($progress, 1) . '</td>' . "\n"; $out .= '<td align="left"><small> ' . $progress . '%</small></td>' . "\n"; } else { $out .= '<td colspan="2"> </td>' . "\n"; } if (isAnwsersViewingSupported($module['contentType'])) { if (claro_get_current_user_id() != (int) $_REQUEST['uInfo']) { if (getModuleProgression((int) $_REQUEST['uInfo'], (int) $_REQUEST['path_id'], (int) $module['module_id'])) { $out .= '<td>' . "\n" . '<a href="' . get_path('clarolineRepositoryWeb') . 'learnPath/module.php?cidReset=true&cidReq=' . claro_get_current_course_id() . '&module_id=' . (int) $module['module_id'] . '&path_id=' . (int) $_REQUEST['path_id'] . '©From=' . (int) $_REQUEST['uInfo'] . '" ' . 'onclick="return confirm(\'' . clean_str_for_javascript(get_lang('This will copy the learning path user progression over your own. Do you want to proceed anyway?')) . '\');">' . "\n" . '<img src="' . get_icon_url('login_as') . '" alt="' . get_lang('Consult') . '" />' . "\n" . '</a>' . "\n" . '</td>' . "\n"; } else { $out .= '<td>' . get_lang('No results available') . '</td>' . "\n"; } } else { $out .= '<td>' . get_lang('Consulting your own results is not allowed') . '</td>' . "\n"; } } else { $out .= '<td>' . get_lang('Unsupported module type') . '</td>' . "\n"; } if ($progress > 0) { $globalProg += $progress; } if ($module['contentType'] != CTLABEL_) { $moduleNb++;
function updateModuleProgression($user_id = 0, $user_progression = array(), $learnPath_id = 0, $learnPath_module_id = 0) { if (empty($learnPath_id) || empty($learnPath_module_id) || empty($user_id) || !is_array($user_progression)) { return false; } $courseTableList = get_module_course_tbl(array('lp_user_module_progress')); if (!getModuleProgression($user_id, $learnPath_id, $learnPath_module_id)) { $sql = "INSERT INTO `" . $courseTableList['lp_user_module_progress'] . "`\n ( `user_id` , `learnPath_id` , `learnPath_module_id`, `suspend_data` )\n VALUES ( " . (int) claro_get_current_user_id() . " , " . (int) $learnPath_id . " , " . (int) $learnPath_module_id . ", '')"; if (!claro_sql_query($sql)) { return false; } } foreach (array('lesson_location', 'lesson_status', 'entry', 'raw', 'scoreMin', 'scoreMax', 'total_time', 'session_time', 'suspend_data', 'credit') as $key) { if (!isset($user_progression[$key])) { $user_progression[$key] = ''; } } $sql = "UPDATE `" . $courseTableList['lp_user_module_progress'] . "` \n SET \n `lesson_location` = '" . claro_sql_escape($user_progression['lesson_location']) . "',\n `lesson_status` = '" . claro_sql_escape($user_progression['lesson_status']) . "',\n `entry` = '" . claro_sql_escape($user_progression['entry']) . "',\n `raw` = '" . claro_sql_escape($user_progression['raw']) . "',\n `scoreMin` = '" . claro_sql_escape($user_progression['scoreMin']) . "',\n `scoreMax` = '" . claro_sql_escape($user_progression['scoreMax']) . "',\n `total_time` = '" . claro_sql_escape($user_progression['total_time']) . "',\n `session_time` = '" . claro_sql_escape($user_progression['session_time']) . "',\n `suspend_data` = '" . claro_sql_escape($user_progression['suspend_data']) . "',\n `credit` = '" . claro_sql_escape($user_progression['credit']) . "'\n WHERE `learnPath_module_id` = " . (int) $learnPath_module_id . "\n AND `learnPath_id` = " . (int) $learnPath_id . "\n AND `user_id` = " . (int) $user_id; return claro_sql_query($sql); }