|
|
|
|
@ -51,6 +51,7 @@ $courseInfo = api_get_course_info(); |
|
|
|
|
$courseId = api_get_course_int_id(); |
|
|
|
|
$userId = api_get_user_id(); |
|
|
|
|
$userInfo = api_get_user_info(); |
|
|
|
|
$sessionId = api_get_session_id(); |
|
|
|
|
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh( |
|
|
|
|
$userId, |
|
|
|
|
$courseInfo |
|
|
|
|
@ -194,7 +195,7 @@ if ($is_allowedToEdit) { |
|
|
|
|
// we got variable $courseId $courseInfo session api_get_session_id() |
|
|
|
|
$exerciseList = get_all_exercises_for_course_id( |
|
|
|
|
$courseInfo, |
|
|
|
|
api_get_session_id(), |
|
|
|
|
$sessionId, |
|
|
|
|
$courseId, |
|
|
|
|
false |
|
|
|
|
); |
|
|
|
|
@ -235,7 +236,7 @@ if ($is_allowedToEdit) { |
|
|
|
|
if ($exercise_action_locked == false) { |
|
|
|
|
$objExerciseTmp->delete(); |
|
|
|
|
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php'; |
|
|
|
|
$link_info = is_resource_in_course_gradebook(api_get_course_id(), 1, $exerciseId, api_get_session_id()); |
|
|
|
|
$link_info = is_resource_in_course_gradebook(api_get_course_id(), 1, $exerciseId, $sessionId); |
|
|
|
|
if ($link_info !== false) { |
|
|
|
|
remove_resource_from_course_gradebook($link_info['id']); |
|
|
|
|
} |
|
|
|
|
@ -244,17 +245,33 @@ if ($is_allowedToEdit) { |
|
|
|
|
break; |
|
|
|
|
case 'enable' : |
|
|
|
|
// enables an exercise |
|
|
|
|
$objExerciseTmp->enable(); |
|
|
|
|
$objExerciseTmp->save(); |
|
|
|
|
api_item_property_update($courseInfo, TOOL_QUIZ, $objExerciseTmp->id, 'visible', $userId); |
|
|
|
|
if (empty($sessionId)) { |
|
|
|
|
$objExerciseTmp->enable(); |
|
|
|
|
$objExerciseTmp->save(); |
|
|
|
|
} |
|
|
|
|
api_item_property_update( |
|
|
|
|
$courseInfo, |
|
|
|
|
TOOL_QUIZ, |
|
|
|
|
$objExerciseTmp->id, |
|
|
|
|
'visible', |
|
|
|
|
$userId |
|
|
|
|
); |
|
|
|
|
// "WHAT'S NEW" notification: update table item_property (previously last_tooledit) |
|
|
|
|
Display :: display_confirmation_message(get_lang('VisibilityChanged')); |
|
|
|
|
break; |
|
|
|
|
case 'disable' : |
|
|
|
|
// disables an exercise |
|
|
|
|
$objExerciseTmp->disable(); |
|
|
|
|
$objExerciseTmp->save(); |
|
|
|
|
api_item_property_update($courseInfo, TOOL_QUIZ, $objExerciseTmp->id, 'invisible', $userId); |
|
|
|
|
if (empty($sessionId)) { |
|
|
|
|
$objExerciseTmp->disable(); |
|
|
|
|
$objExerciseTmp->save(); |
|
|
|
|
} |
|
|
|
|
api_item_property_update( |
|
|
|
|
$courseInfo, |
|
|
|
|
TOOL_QUIZ, |
|
|
|
|
$objExerciseTmp->id, |
|
|
|
|
'invisible', |
|
|
|
|
$userId |
|
|
|
|
); |
|
|
|
|
Display :: display_confirmation_message(get_lang('VisibilityChanged')); |
|
|
|
|
break; |
|
|
|
|
case 'disable_results' : |
|
|
|
|
@ -625,7 +642,24 @@ if (!empty($exercise_list)) { |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$visibility = api_get_item_visibility($courseInfo, TOOL_QUIZ, $my_exercise_id); |
|
|
|
|
$visibility = api_get_item_visibility( |
|
|
|
|
$courseInfo, |
|
|
|
|
TOOL_QUIZ, |
|
|
|
|
$my_exercise_id, |
|
|
|
|
0 |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!empty($sessionId)) { |
|
|
|
|
if ($visibility == 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
$visibility = api_get_item_visibility( |
|
|
|
|
$courseInfo, |
|
|
|
|
TOOL_QUIZ, |
|
|
|
|
$my_exercise_id, |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($row['active'] == 0 || $visibility == 0) { |
|
|
|
|
$title = Display::tag('font', $cut_title, array('style' => 'color:grey')); |
|
|
|
|
@ -697,17 +731,44 @@ if (!empty($exercise_list)) { |
|
|
|
|
$actions .= Display::return_icon('invisible.png', get_lang('AddedToLPCannotBeAccessed'), '', ICON_SIZE_SMALL); |
|
|
|
|
} else { |
|
|
|
|
if ($row['active'] == 0 || $visibility == 0) { |
|
|
|
|
$actions .= Display::url(Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL), 'exercice.php?'.api_get_cidreq().'&choice=enable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id']); |
|
|
|
|
$actions .= Display::url( |
|
|
|
|
Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL), |
|
|
|
|
'exercice.php?'.api_get_cidreq().'&choice=enable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id'] |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
// else if not active |
|
|
|
|
$actions .= Display::url(Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL), 'exercice.php?'.api_get_cidreq().'&choice=disable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id']); |
|
|
|
|
$actions .= Display::url( |
|
|
|
|
Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL), |
|
|
|
|
'exercice.php?'.api_get_cidreq().'&choice=disable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id'] |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Export qti ... |
|
|
|
|
$actions .= Display::url(Display::return_icon('export_qti2.png', 'IMS/QTI', '', ICON_SIZE_SMALL), 'exercice.php?choice=exportqti2&exerciseId='.$row['id'].'&'.api_get_cidreq()); |
|
|
|
|
} else { |
|
|
|
|
// not session |
|
|
|
|
$actions = Display::return_icon('edit_na.png', get_lang('ExerciseEditionNotAvailableInSession')); |
|
|
|
|
|
|
|
|
|
// Check if this exercise was added in a LP |
|
|
|
|
if ($exercise_obj->exercise_was_added_in_lp == true) { |
|
|
|
|
$actions .= Display::return_icon('invisible.png', get_lang('AddedToLPCannotBeAccessed'), '', ICON_SIZE_SMALL); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
if ($row['active'] == 0 || $visibility == 0) { |
|
|
|
|
$actions .= Display::url( |
|
|
|
|
Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL), |
|
|
|
|
'exercice.php?'.api_get_cidreq().'&choice=enable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id'] |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
// else if not active |
|
|
|
|
$actions .= Display::url( |
|
|
|
|
Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL), |
|
|
|
|
'exercice.php?'.api_get_cidreq().'&choice=disable&sec_token='.$token.'&page='.$page.'&exerciseId='.$row['id'] |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
|
|
|
Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
|
|
|
|
$actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercice.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id'])); |
|
|
|
|
@ -759,7 +820,12 @@ if (!empty($exercise_list)) { |
|
|
|
|
$item .= Display::tag('td', $number_of_questions); |
|
|
|
|
} else { |
|
|
|
|
// Student only. |
|
|
|
|
$visibility = api_get_item_visibility($courseInfo, TOOL_QUIZ, $my_exercise_id); |
|
|
|
|
$visibility = api_get_item_visibility( |
|
|
|
|
$courseInfo, |
|
|
|
|
TOOL_QUIZ, |
|
|
|
|
$my_exercise_id, |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if ($visibility == 0) { |
|
|
|
|
continue; |
|
|
|
|
@ -982,7 +1048,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) { |
|
|
|
|
$path, |
|
|
|
|
$userId, |
|
|
|
|
api_get_course_int_id(), |
|
|
|
|
api_get_session_id() |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$nbrActiveTests = $nbrActiveTests + 1; |
|
|
|
|
|