/** * This function stores the edit of a post in the forum_post table. * * @param array * @return void HTML * * @author Patrick Cool <*****@*****.**>, Ghent University * @version february 2006, dokeos 1.8 */ function store_edit_post($values) { $threadTable = Database::get_course_table(TABLE_FORUM_THREAD); $table_posts = Database::get_course_table(TABLE_FORUM_POST); $course_id = api_get_course_int_id(); //check if this post is the first of the thread // First we check if the change affects the thread and if so we commit // the changes (sticky and post_title=thread_title are relevant). $posts = getPosts($values['thread_id']); $first_post = null; if (!empty($posts) && count($posts) > 0 && isset($posts[0])) { $first_post = $posts[0]; } if (!empty($first_post) && $first_post['post_id'] == $values['post_id']) { $params = ['thread_title' => $values['post_title'], 'thread_sticky' => isset($values['thread_sticky']) ? $values['thread_sticky'] : null, 'thread_title_qualify' => $values['calification_notebook_title'], 'thread_qualify_max' => $values['numeric_calification'], 'thread_weight' => $values['weight_calification'], 'thread_peer_qualify' => $values['thread_peer_qualify']]; $where = ['c_id = ? AND thread_id = ?' => [$course_id, $values['thread_id']]]; Database::update($threadTable, $params, $where); } // Update the post_title and the post_text. $params = ['post_title' => $values['post_title'], 'post_text' => $values['post_text'], 'post_notification' => isset($values['post_notification']) ? $values['post_notification'] : '']; $where = ['c_id = ? AND post_id = ?' => [$course_id, $values['post_id']]]; Database::update($table_posts, $params, $where); // Update attached files if (!empty($_POST['file_ids']) && is_array($_POST['file_ids'])) { foreach ($_POST['file_ids'] as $key => $id) { editAttachedFile(array('comment' => $_POST['file_comments'][$key], 'post_id' => $values['post_id']), $id); } } if (!empty($values['remove_attach'])) { delete_attachment($values['post_id']); } if (empty($values['id_attach'])) { add_forum_attachment_file(isset($values['file_comment']) ? $values['file_comment'] : null, $values['post_id']); } else { edit_forum_attachment_file(isset($values['file_comment']) ? $values['file_comment'] : null, $values['post_id'], $values['id_attach']); } if (api_is_course_admin() == true) { $ccode = api_get_course_id(); $sid = api_get_session_id(); $link_info = GradebookUtils::is_resource_in_course_gradebook($ccode, 5, $values['thread_id'], $sid); $link_id = $link_info['id']; $thread_qualify_gradebook = isset($values['thread_qualify_gradebook']) ? $values['thread_qualify_gradebook'] : null; if ($thread_qualify_gradebook != 1) { if ($link_info !== false) { GradebookUtils::remove_resource_from_course_gradebook($link_id); } } else { if ($link_info === false && !$_GET['thread']) { $weigthqualify = $values['weight_calification']; GradebookUtils::add_resource_to_course_gradebook($values['category_id'], $ccode, 5, $values['thread_id'], Database::escape_string(stripslashes($values['calification_notebook_title'])), $weigthqualify, $values['numeric_calification'], null, 0, $sid); } } } // Storing the attachments if any. //update_added_resources('forum_post', $values['post_id']); $message = get_lang('EditPostStored') . '<br />'; $message .= get_lang('ReturnTo') . ' <a href="viewforum.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&"> ' . get_lang('Forum') . '</a><br />'; $message .= get_lang('ReturnTo') . ' <a href="viewthread.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&thread=' . $values['thread_id'] . '&post=' . intval($_GET['post']) . '">' . get_lang('Message') . '</a>'; Session::erase('formelements'); Session::erase('origin'); Session::erase('breadcrumbs'); Session::erase('addedresource'); Session::erase('addedresourceid'); Display::display_confirmation_message($message, false); }
/** * This function stores a survey in the database. * * @param array $values * * @return array $return the type of return message that has to be displayed and the message in it * * @author Patrick Cool <*****@*****.**>, Ghent University * @version February 2007 */ public static function store_survey($values) { $_user = api_get_user_info(); $course_id = api_get_course_int_id(); $session_id = api_get_session_id(); $courseCode = api_get_course_id(); $table_survey = Database::get_course_table(TABLE_SURVEY); $shared_survey_id = 0; if (!isset($values['survey_id'])) { // Check if the code doesn't soon exists in this language $sql = 'SELECT 1 FROM ' . $table_survey . ' WHERE c_id = ' . $course_id . ' AND code="' . Database::escape_string($values['survey_code']) . '" AND lang="' . Database::escape_string($values['survey_language']) . '"'; $rs = Database::query($sql); if (Database::num_rows($rs) > 0) { Display::addFlash(Display::return_message(get_lang('ThisSurveyCodeSoonExistsInThisLanguage'), 'error')); $return['type'] = 'error'; $return['id'] = isset($values['survey_id']) ? $values['survey_id'] : 0; return $return; } if (!isset($values['anonymous'])) { $values['anonymous'] = 0; } $values['anonymous'] = intval($values['anonymous']); $additional['columns'] = ''; $extraParams = []; if ($values['anonymous'] == 0) { // Input_name_list $values['show_form_profile'] = isset($values['show_form_profile']) ? $values['show_form_profile'] : 0; $extraParams['show_form_profile'] = $values['show_form_profile']; if ($values['show_form_profile'] == 1) { // Input_name_list $fields = explode(',', $values['input_name_list']); $field_values = ''; foreach ($fields as &$field) { if ($field != '') { if ($values[$field] == '') { $values[$field] = 0; } $field_values .= $field . ':' . $values[$field] . '@'; } } $extraParams['form_fields'] = $field_values; } else { $extraParams['form_fields'] = ''; } } else { // Input_name_list $extraParams['show_form_profile'] = 0; $extraParams['form_fields'] = ''; } if ($values['survey_type'] == 1) { $extraParams['survey_type'] = 1; $extraParams['shuffle'] = $values['shuffle']; $extraParams['one_question_per_page'] = $values['one_question_per_page']; $extraParams['parent_id'] = $values['parent_id']; // Logic for versioning surveys if (!empty($values['parent_id'])) { $versionValue = ''; $sql = 'SELECT survey_version FROM ' . $table_survey . ' WHERE c_id = ' . $course_id . ' AND parent_id = ' . intval($values['parent_id']) . ' ORDER BY survey_version DESC LIMIT 1'; $rs = Database::query($sql); if (Database::num_rows($rs) === 0) { $sql = 'SELECT survey_version FROM ' . $table_survey . ' WHERE c_id = ' . $course_id . ' AND survey_id = ' . intval($values['parent_id']); $rs = Database::query($sql); $getversion = Database::fetch_array($rs, 'ASSOC'); if (empty($getversion['survey_version'])) { $versionValue = ++$getversion['survey_version']; } else { $versionValue = $getversion['survey_version']; } } else { $row = Database::fetch_array($rs, 'ASSOC'); $pos = api_strpos($row['survey_version']); if ($pos === false) { $row['survey_version'] = $row['survey_version'] + 1; $versionValue = $row['survey_version']; } else { $getlast = explode('\\.', $row['survey_version']); $lastversion = array_pop($getlast); $lastversion = $lastversion + 1; $add = implode('.', $getlast); if ($add != '') { $insertnewversion = $add . '.' . $lastversion; } else { $insertnewversion = $lastversion; } $versionValue = $insertnewversion; } } $extraParams['survey_version'] = $versionValue; } } $params = ['c_id' => $course_id, 'code' => strtolower(CourseManager::generate_course_code($values['survey_code'])), 'title' => $values['survey_title'], 'subtitle' => $values['survey_subtitle'], 'author' => $_user['user_id'], 'lang' => $values['survey_language'], 'avail_from' => $values['start_date'], 'avail_till' => $values['end_date'], 'is_shared' => $shared_survey_id, 'template' => 'template', 'intro' => $values['survey_introduction'], 'surveythanks' => $values['survey_thanks'], 'creation_date' => api_get_utc_datetime(), 'anonymous' => $values['anonymous'], 'session_id' => api_get_session_id(), 'visible_results' => $values['visible_results']]; $params = array_merge($params, $extraParams); $survey_id = Database::insert($table_survey, $params); if ($survey_id > 0) { $sql = "UPDATE {$table_survey} SET survey_id = {$survey_id}\n WHERE iid = {$survey_id}"; Database::query($sql); // Insert into item_property api_item_property_update(api_get_course_info(), TOOL_SURVEY, $survey_id, 'SurveyAdded', api_get_user_id()); } if ($values['survey_type'] == 1 && !empty($values['parent_id'])) { SurveyManager::copy_survey($values['parent_id'], $survey_id); } Display::addFlash(Display::return_message(get_lang('SurveyCreatedSuccesfully'), 'success')); $return['id'] = $survey_id; } else { // Check whether the code doesn't soon exists in this language $sql = 'SELECT 1 FROM ' . $table_survey . ' WHERE c_id = ' . $course_id . ' AND code = "' . Database::escape_string($values['survey_code']) . '" AND lang = "' . Database::escape_string($values['survey_language']) . '" AND survey_id !=' . intval($values['survey_id']); $rs = Database::query($sql); if (Database::num_rows($rs) > 0) { Display::addFlash(Display::return_message(get_lang('ThisSurveyCodeSoonExistsInThisLanguage'), 'error')); $return['type'] = 'error'; $return['id'] = isset($values['survey_id']) ? $values['survey_id'] : 0; return $return; } if (!isset($values['anonymous']) || isset($values['anonymous']) && $values['anonymous'] == '') { $values['anonymous'] = 0; } $values['shuffle'] = isset($values['shuffle']) ? $values['shuffle'] : null; $values['one_question_per_page'] = isset($values['one_question_per_page']) ? $values['one_question_per_page'] : null; $values['show_form_profile'] = isset($values['show_form_profile']) ? $values['show_form_profile'] : null; $extraParams = []; $extraParams['shuffle'] = $values['shuffle']; $extraParams['one_question_per_page'] = $values['one_question_per_page']; $extraParams['shuffle'] = $values['shuffle']; if ($values['anonymous'] == 0) { $extraParams['show_form_profile'] = $values['show_form_profile']; if ($values['show_form_profile'] == 1) { $fields = explode(',', $values['input_name_list']); $field_values = ''; foreach ($fields as &$field) { if ($field != '') { if (!isset($values[$field]) || isset($values[$field]) && $values[$field] == '') { $values[$field] = 0; } $field_values .= $field . ':' . $values[$field] . '@'; } } $extraParams['form_fields'] = $field_values; } else { $extraParams['form_fields'] = ''; } } else { $extraParams['show_form_profile'] = 0; $extraParams['form_fields'] = ''; } $params = ['title' => $values['survey_title'], 'subtitle' => $values['survey_subtitle'], 'author' => $_user['user_id'], 'lang' => $values['survey_language'], 'avail_from' => $values['start_date'], 'avail_till' => $values['end_date'], 'is_shared' => $shared_survey_id, 'template' => 'template', 'intro' => $values['survey_introduction'], 'surveythanks' => $values['survey_thanks'], 'anonymous' => $values['anonymous'], 'session_id' => api_get_session_id(), 'visible_results' => $values['visible_results']]; $params = array_merge($params, $extraParams); Database::update($table_survey, $params, ['c_id = ? AND survey_id = ?' => [$course_id, $values['survey_id']]]); // Update into item_property (update) api_item_property_update(api_get_course_info(), TOOL_SURVEY, $values['survey_id'], 'SurveyUpdated', api_get_user_id()); Display::addFlash(Display::return_message(get_lang('SurveyUpdatedSuccesfully'), 'confirmation')); $return['id'] = $values['survey_id']; } $survey_id = intval($return['id']); // Gradebook $gradebook_option = false; if (isset($values['survey_qualify_gradebook'])) { $gradebook_option = $values['survey_qualify_gradebook'] > 0; } $gradebook_link_type = 8; $link_info = GradebookUtils::is_resource_in_course_gradebook($courseCode, $gradebook_link_type, $survey_id, $session_id); $gradebook_link_id = $link_info ? $link_info->getId() : false; if ($gradebook_option) { if ($survey_id > 0) { $title_gradebook = ''; // Not needed here. $description_gradebook = ''; // Not needed here. $survey_weight = floatval($_POST['survey_weight']); $max_score = 1; if (!$gradebook_link_id) { GradebookUtils::add_resource_to_course_gradebook($values['category_id'], $courseCode, $gradebook_link_type, $survey_id, $title_gradebook, $survey_weight, $max_score, $description_gradebook, 1, $session_id); } else { GradebookUtils::update_resource_from_course_gradebook($gradebook_link_id, $courseCode, $survey_weight); } } } else { // Delete everything of the gradebook for this $linkId GradebookUtils::remove_resource_from_course_gradebook($gradebook_link_id); //comenting this line to correctly return the function msg //exit; } return $return; }
$message = change_visibility($_GET['content'], $_GET['id'], $_GET['action']); } // Locking and unlocking. if (($my_action == 'lock' || $my_action == 'unlock') && isset($_GET['content']) && isset($_GET['id']) && api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) { $message = change_lock_status($_GET['content'], $_GET['id'], $my_action); } // Deleting. if ($my_action == 'delete' && isset($_GET['content']) && isset($_GET['id']) && api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) { $locked = api_resource_is_locked_by_gradebook($_GET['id'], LINK_FORUM_THREAD); if ($locked == false) { $message = deleteForumCategoryThread($_GET['content'], $_GET['id']); // Delete link $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 5, intval($_GET['id']), api_get_session_id()); $link_id = $link_info->getId(); if ($link_info) { GradebookUtils::remove_resource_from_course_gradebook($link_id); } } } // Moving. if ($my_action == 'move' && isset($_GET['thread']) && api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) { $message = move_thread_form(); } // Notification. if ($my_action == 'notify' && isset($_GET['content']) && isset($_GET['id']) && api_is_allowed_to_session_edit(false, true)) { $return_message = set_notification($_GET['content'], $_GET['id']); Display::display_confirmation_message($return_message, false); } // Student list if ($my_action == 'liststd' && isset($_GET['content']) && isset($_GET['id']) && (api_is_allowed_to_edit(null, true) || $is_group_tutor)) { $active = null;
} // single exercise 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(); $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 1, $exerciseId, api_get_session_id()); if ($link_info !== false) { GradebookUtils::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($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();
/** * Static admin function allowing removal of a learnpath * @param string Course code * @param integer Learnpath ID * @param string Whether to delete data or keep it (default: 'keep', others: 'remove') * @return boolean True on success, false on failure (might change that to return number of elements deleted) */ public function delete($course = null, $id = null, $delete = 'keep') { $course_id = api_get_course_int_id(); // TODO: Implement a way of getting this to work when the current object is not set. // In clear: implement this in the item class as well (abstract class) and use the given ID in queries. // If an ID is specifically given and the current LP is not the same, prevent delete. if (!empty($id) && $id != $this->lp_id) { return false; } $lp = Database::get_course_table(TABLE_LP_MAIN); $lp_item = Database::get_course_table(TABLE_LP_ITEM); $lp_view = Database::get_course_table(TABLE_LP_VIEW); $lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW); // Delete lp item id. foreach ($this->items as $id => $dummy) { $sql = "DELETE FROM {$lp_item_view}\n WHERE c_id = {$course_id} AND lp_item_id = '" . $id . "'"; Database::query($sql); } // Proposed by Christophe (nickname: clefevre) $sql = "DELETE FROM {$lp_item} WHERE c_id = " . $course_id . " AND lp_id = " . $this->lp_id; Database::query($sql); $sql = "DELETE FROM {$lp_view} WHERE c_id = " . $course_id . " AND lp_id = " . $this->lp_id; Database::query($sql); self::toggle_publish($this->lp_id, 'i'); if ($this->type == 2 || $this->type == 3) { // This is a scorm learning path, delete the files as well. $sql = "SELECT path FROM {$lp}\n WHERE c_id = " . $course_id . " AND id = " . $this->lp_id; $res = Database::query($sql); if (Database::num_rows($res) > 0) { $row = Database::fetch_array($res); $path = $row['path']; $sql = "SELECT id FROM {$lp}\n WHERE c_id = " . $course_id . " AND path = '{$path}' AND id != " . $this->lp_id; $res = Database::query($sql); if (Database::num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it. if ($this->debug > 2) { error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0); } } else { // No other LP uses that directory, delete it. $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course. if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty($course_scorm_dir)) { if ($this->debug > 2) { error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0); } // Proposed by Christophe (clefevre). if (strcmp(substr($path, -2), "/.") == 0) { $path = substr($path, 0, -1); // Remove "." at the end. } //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way. rmdirr($course_scorm_dir . $path); } } } } $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $this->lp_id; // Delete tools $sql = "DELETE FROM {$tbl_tool}\n WHERE c_id = " . $course_id . " AND (link LIKE '{$link}%' AND image='scormbuilder.gif')"; Database::query($sql); $sql = "DELETE FROM {$lp} WHERE c_id = " . $course_id . " AND id = " . $this->lp_id; Database::query($sql); // Updates the display order of all lps. $this->update_display_order(); api_item_property_update(api_get_course_info(), TOOL_LEARNPATH, $this->lp_id, 'delete', api_get_user_id()); $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id()); if ($link_info !== false) { GradebookUtils::remove_resource_from_course_gradebook($link_info['id']); } if (api_get_setting('search_enabled') == 'true') { require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; delete_all_values_for_item($this->cc, TOOL_LEARNPATH, $this->lp_id); } }
/** * @param int $workId * @param array $params * @param array $courseInfo * @param int $groupId */ function updatePublicationAssignment($workId, $params, $courseInfo, $groupId) { $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT); $workTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $workId = intval($workId); $time = api_get_utc_datetime(); $course_id = $courseInfo['real_id']; // Insert into agenda $agendaId = 0; if (isset($params['add_to_calendar']) && $params['add_to_calendar'] == 1) { require_once api_get_path(SYS_CODE_PATH) . 'resourcelinker/resourcelinker.inc.php'; // Setting today date $date = $end_date = $time; if (isset($params['enableExpiryDate'])) { $end_date = $params['expires_on']; $date = $end_date; } $title = sprintf(get_lang('HandingOverOfTaskX'), $params['new_dir']); $description = isset($params['description']) ? $params['description'] : ''; $content = '<a href="' . api_get_path(WEB_CODE_PATH) . 'work/work_list.php?' . api_get_cidreq() . '&id=' . $workId . '">' . $params['new_dir'] . '</a>' . $description; $agendaId = agendaExistsForWork($workId, $courseInfo); // Add/edit agenda $agenda = new Agenda(); $agenda->set_course($courseInfo); $agenda->type = 'course'; if (empty($agendaId)) { $agendaId = $agenda->addEvent($date, $end_date, 'false', $title, $content, array('GROUP:' . $groupId)); } else { $agenda->editEvent($agendaId, $end_date, $end_date, 'false', $title, $content); } } $qualification = isset($params['qualification']) && !empty($params['qualification']) ? 1 : 0; $expiryDate = isset($params['enableExpiryDate']) && $params['enableExpiryDate'] == 1 ? api_get_utc_datetime($params['expires_on']) : ''; $endDate = isset($params['enableEndDate']) && $params['enableEndDate'] == 1 ? api_get_utc_datetime($params['ends_on']) : ''; $data = get_work_assignment_by_id($workId, $course_id); if (!empty($expiryDate)) { $expiryDateCondition = "expires_on = '" . Database::escape_string($expiryDate) . "', "; } else { $expiryDateCondition = "expires_on = null, "; } if (!empty($endDate)) { $endOnCondition = "ends_on = '" . Database::escape_string($endDate) . "', "; } else { $endOnCondition = "ends_on = null, "; } if (empty($data)) { $sql = "INSERT INTO {$table} SET\n c_id = {$course_id} ,\n {$expiryDateCondition}\n {$endOnCondition}\n add_to_calendar = {$agendaId},\n enable_qualification = '{$qualification}',\n publication_id = '{$workId}'"; Database::query($sql); $my_last_id = Database::insert_id(); if ($my_last_id) { $sql = "UPDATE {$table} SET\n id = iid\n WHERE iid = {$my_last_id}"; Database::query($sql); $sql = "UPDATE {$workTable} SET\n has_properties = {$my_last_id},\n view_properties = 1\n WHERE c_id = {$course_id} AND id = {$workId}"; Database::query($sql); } } else { $sql = "UPDATE {$table} SET\n {$expiryDateCondition}\n {$endOnCondition}\n add_to_calendar = {$agendaId},\n enable_qualification = '" . $qualification . "'\n WHERE\n publication_id = {$workId} AND\n c_id = {$course_id} AND\n id = " . $data['id']; Database::query($sql); } if (!empty($params['category_id'])) { $link_info = GradebookUtils::is_resource_in_course_gradebook($courseInfo['code'], LINK_STUDENTPUBLICATION, $workId, api_get_session_id()); $linkId = null; if (!empty($link_info)) { $linkId = $link_info['id']; } if (isset($params['make_calification']) && $params['make_calification'] == 1) { if (empty($linkId)) { GradebookUtils::add_resource_to_course_gradebook($params['category_id'], $courseInfo['code'], LINK_STUDENTPUBLICATION, $workId, $params['new_dir'], (double) $params['weight'], (double) $params['qualification'], $params['description'], 1, api_get_session_id()); } else { GradebookUtils::update_resource_from_course_gradebook($linkId, $courseInfo['code'], $params['weight']); } } else { // Delete everything of the gradebook for this $linkId GradebookUtils::remove_resource_from_course_gradebook($linkId); } } }
} // single exercise 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(); $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 1, $exerciseId, api_get_session_id()); if ($link_info) { GradebookUtils::remove_resource_from_course_gradebook($link_info->getId()); } Display::display_confirmation_message(get_lang('ExerciseDeleted')); } break; case 'enable': // enables an exercise if (empty($sessionId)) { $objExerciseTmp->enable(); $objExerciseTmp->save(); } else { if (!empty($objExerciseTmp->sessionId)) { $objExerciseTmp->enable(); $objExerciseTmp->save(); } }