Fix exercise tool

pull/3064/head
Julio 5 years ago
parent 832ac1902b
commit 2956bdc684
  1. 2
      public/main/exercise/admin.php
  2. 2
      public/main/exercise/exercise.php
  3. 8
      public/main/exercise/exercise_admin.php
  4. 22
      public/main/exercise/exercise_report.php
  5. 8
      public/main/exercise/question_admin.inc.php
  6. 2
      public/main/exercise/question_list_admin.inc.php
  7. 2
      public/main/inc/lib/api.lib.php

@ -310,7 +310,7 @@ $inATest = isset($exerciseId) && $exerciseId > 0;
if ($inATest) {
echo '<div class="actions">';
if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion'])) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?id='.$exerciseId.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('Go back to the questions list'), '', ICON_SIZE_MEDIUM).'</a>';
}

@ -99,7 +99,7 @@ if ($is_allowedToEdit && !empty($action)) {
case 'delete':
$result = $objExerciseTmp->delete();
if ($result) {
Display::addFlash(Display::return_message(get_lang('ExerciseDeleted'), 'confirmation'));
Display::addFlash(Display::return_message(get_lang('Deleted'), 'confirmation'));
}
break;
case 'enable':

@ -132,7 +132,7 @@ if (!empty($exerciseId)) {
$form = new FormValidator(
'exercise_admin',
'post',
api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId
api_get_self().'?'.api_get_cidreq().'&id='.$exerciseId
);
$objExercise->read($exerciseId, false);
$form->addElement('hidden', 'edit', 'true');
@ -161,7 +161,7 @@ if ($form->validate()) {
}
$exercise_id = $objExercise->id;
Session::erase('objExercise');
header('Location:admin.php?exerciseId='.$exercise_id.'&'.api_get_cidreq());
header('Location:admin.php?id='.$exercise_id.'&'.api_get_cidreq());
exit;
} else {
if (api_is_in_gradebook()) {
@ -176,7 +176,7 @@ if ($form->validate()) {
'name' => get_lang('Tests'),
];
$interbreadcrumb[] = [
'url' => 'admin.php?exerciseId='.$objExercise->id.'&'.api_get_cidreq(),
'url' => 'admin.php?id='.$objExercise->id.'&'.api_get_cidreq(),
'name' => $objExercise->selectTitle(true),
];
@ -184,7 +184,7 @@ if ($form->validate()) {
echo '<div class="actions">';
if ($objExercise->id != 0) {
echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.
echo '<a href="admin.php?'.api_get_cidreq().'&id='.$objExercise->id.'">'.
Display::return_icon('back.png', get_lang('Go back to the questions list'), '', ICON_SIZE_MEDIUM).'</a>';
} else {
if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {

@ -39,7 +39,7 @@ if ($limitTeacherAccess && !api_is_platform_admin()) {
$_course = api_get_course_info();
// document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
//$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$origin = api_get_origin();
$is_allowedToEdit = api_is_allowed_to_edit(null, true) ||
api_is_drh() ||
@ -298,7 +298,7 @@ if (isset($_REQUEST['comments']) &&
Display::addFlash(Display::return_message(get_lang('Learning path updated')));
}
$sql = "UPDATE $TBL_LP_ITEM_VIEW
$sql = "UPDATE $TBL_LP_ITEM_VIEW
SET score = '".floatval($tot)."'
$statusCondition
WHERE c_id = ".$course_id." AND id = ".$lp_item_view_id;
@ -433,7 +433,7 @@ if (($is_allowedToEdit || $is_tutor || api_is_coach()) &&
) {
// Close the user attempt otherwise left pending
$exe_id = (int) $_GET['id'];
$sql = "UPDATE $TBL_TRACK_EXERCISES SET status = ''
$sql = "UPDATE $TBL_TRACK_EXERCISES SET status = ''
WHERE exe_id = $exe_id AND status = 'incomplete'";
Database::query($sql);
}
@ -669,7 +669,7 @@ $extra_params['height'] = 'auto';
$extra_params['gridComplete'] = "
defaultGroupId = Cookies.get('default_group_".$exercise_id."');
if (typeof defaultGroupId !== 'undefined') {
$('#gs_group_name').val(defaultGroupId);
$('#gs_group_name').val(defaultGroupId);
}
";
@ -682,18 +682,18 @@ if (typeof defaultGroupId !== 'undefined') {
} else {
// get from cookies
defaultGroupId = Cookies.get('default_group_".$exercise_id."');
$('#gs_group_name').val(defaultGroupId);
$('#gs_group_name').val(defaultGroupId);
}
if (typeof defaultGroupId !== 'undefined') {
var posted_data = $(\"#results\").jqGrid('getGridParam', 'postData');
var extraFilter = ',{\"field\":\"group_id\",\"op\":\"eq\",\"data\":\"'+ defaultGroupId +'\"}]}';
var filters = posted_data.filters;
var stringObj = new String(filters);
stringObj.replace(']}', extraFilter);
var extraFilter = ',{\"field\":\"group_id\",\"op\":\"eq\",\"data\":\"'+ defaultGroupId +'\"}]}';
var filters = posted_data.filters;
var stringObj = new String(filters);
stringObj.replace(']}', extraFilter);
posted_data['group_id_in_toolbar'] = defaultGroupId;
$(this).jqGrid('setGridParam', 'postData', posted_data);
$(this).jqGrid('setGridParam', 'postData', posted_data);
}
";

@ -65,11 +65,11 @@ if (is_object($objQuestion)) {
if (isset($_GET['editQuestion'])) {
if (empty($exerciseId)) {
Display::addFlash(Display::return_message(get_lang('Item updated')));
$url = 'admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&editQuestion='.$objQuestion->id;
$url = 'admin.php?id='.$exerciseId.'&'.api_get_cidreq().'&editQuestion='.$objQuestion->id;
echo '<script type="text/javascript">window.location.href="'.$url.'"</script>';
exit;
}
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&page='.$page.'&message=Item updated"</script>';
echo '<script type="text/javascript">window.location.href="admin.php?id='.$exerciseId.'&'.api_get_cidreq().'&page='.$page.'&message=Item updated"</script>';
} else {
// New question
$page = 1;
@ -77,10 +77,10 @@ if (is_object($objQuestion)) {
if (!empty($length)) {
$page = round($objExercise->getQuestionCount() / $length);
}
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'&page='.$page.'&message=ItemAdded"</script>';
echo '<script type="text/javascript">window.location.href="admin.php?id='.$exerciseId.'&'.api_get_cidreq().'&page='.$page.'&message=ItemAdded"</script>';
}
} else {
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&page='.$page.'&hotspotadmin='.$objQuestion->id.'&'.api_get_cidreq().'"</script>';
echo '<script type="text/javascript">window.location.href="admin.php?id='.$exerciseId.'&page='.$page.'&hotspotadmin='.$objQuestion->id.'&'.api_get_cidreq().'"</script>';
}
} else {
if (isset($questionName)) {

@ -272,7 +272,7 @@ if (!$inATest) {
),
api_get_self().'?'.api_get_cidreq().'&'
.http_build_query([
'exerciseId' => $exerciseId,
'id' => $exerciseId,
'deleteQuestion' => $id,
'page' => $page,
]),

@ -795,7 +795,7 @@ function api_get_path($path = '', $configuration = [])
SYS_PATH => $root_sys.'public/',
REL_PATH => '',
CONFIGURATION_PATH => 'app/config/',
LIBRARY_PATH => $root_sys.'public/inc/lib/',
LIBRARY_PATH => $root_sys.'public/main/inc/lib/',
REL_COURSE_PATH => '',
REL_CODE_PATH => '/main/',

Loading…
Cancel
Save