本文整理汇总了PHP中Exercise::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::delete方法的具体用法?PHP Exercise::delete怎么用?PHP Exercise::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exercise
的用法示例。
在下文中一共展示了Exercise::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Exercise
Display::display_introduction_section(TOOL_QUIZ);
HotPotGCt($documentPath, 1, api_get_user_id());
// Only for administrator
if ($is_allowedToEdit) {
if (!empty($choice)) {
// Construction of Exercise
$objExerciseTmp = new Exercise();
$check = Security::check_token('get');
$exercise_action_locked = api_resource_is_locked_by_gradebook($exerciseId, LINK_EXERCISE);
if ($objExerciseTmp->read($exerciseId)) {
if ($check) {
switch ($choice) {
case 'delete':
// deletes an exercise
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());
if ($link_info !== false) {
remove_resource_from_course_gradebook($link_info['id']);
}
Display::display_confirmation_message(get_lang('ExerciseDeleted'));
}
break;
case 'enable':
// enables an exercise
$objExerciseTmp->enable();
$objExerciseTmp->save();
api_item_property_update($course_info, TOOL_QUIZ, $objExerciseTmp->id, 'visible', api_get_user_id());
// "WHAT'S NEW" notification: update table item_property (previously last_tooledit)
Display::display_confirmation_message(get_lang('VisibilityChanged'));
示例2: Exercise
}
break;
}
$htmlcontent .= '</tbody>' . "\n" . '</table></p>' . "\n";
$pdf->writeHTML(claro_utf8_encode($htmlcontent, get_conf('charset')), true, 0, true, 0);
$i++;
}
//Close and output PDF document
$pdf->Output('exercise' . $exercise->getId() . '.pdf', 'D');
exit;
}
//-- delete
if ($cmd == 'exDel' && $exId) {
$exercise = new Exercise();
$exercise->load($exId);
$exercise->delete();
//notify manager that the exercise is deleted
$eventNotifier->notifyCourseEvent("exercise_deleted", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0");
}
//-- change visibility
if ($cmd == 'exMkVis' && $exId) {
Exercise::updateExerciseVisibility($exId, 'VISIBLE');
$eventNotifier->notifyCourseEvent("exercise_visible", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0");
$eventNotifier->notifyCourseEvent("exercise_updated", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0");
}
if ($cmd == 'exMkInvis' && $exId) {
Exercise::updateExerciseVisibility($exId, 'INVISIBLE');
$eventNotifier->notifyCourseEvent("exercise_invisible", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0");
$eventNotifier->notifyCourseEvent("exercise_updated", claro_get_current_course_id(), claro_get_current_tool_id(), $exId, claro_get_current_group_id(), "0");
}
}