if ($is_allowed_to_edit) { if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'view' && !isset($_REQUEST['exeId'])) { $_REQUEST['action'] = 'build'; } //$_SESSION['studentview'] = null; } } $action = (!empty($_REQUEST['action']) ? $_REQUEST['action'] : ''); // format title to be displayed correctly if QUIZ $post_title = ""; if (isset($_POST['title'])) { $post_title = Security::remove_XSS($_POST['title']); if (isset($_POST['type']) && isset($_POST['title']) && $_POST['type'] == TOOL_QUIZ && !empty($_POST['title'])) { $post_title = Exercise::format_title_variable($_POST['title']); } } switch ($action) { case 'add_item': if (!$is_allowed_to_edit) { api_not_allowed(true); } if ($debug > 0) error_log('New LP - add item action triggered', 0); if (!$lp_found) { //check if the learnpath ID was defined, otherwise send back to list if ($debug > 0) error_log('New LP - No learnpath given for add item', 0); require 'lp_list.php'; } else {
$folderId = isset($_GET['folder_id']) ? $_GET['folder_id'] : null; if (empty($folderId)) { exit; } $lpId = isset($_GET['lp_id']) ? $_GET['lp_id'] : null; $url = isset($_GET['url']) ? $_GET['url'] : null; echo DocumentManager::get_document_preview($courseInfo, $lpId, null, api_get_session_id(), true, null, $url, true, false, $folderId); break; case 'add_lp_item': if (api_is_allowed_to_edit(null, true)) { if ($_SESSION['oLP']) { //Updating the lp.modified_on $_SESSION['oLP']->set_modified_on(); $title = $_REQUEST['title']; if ($_REQUEST['type'] == TOOL_QUIZ) { $title = Exercise::format_title_variable($title); } echo $_SESSION['oLP']->add_item($_REQUEST['parent_id'], $_REQUEST['previous_id'], $_REQUEST['type'], $_REQUEST['id'], $title, null); } } break; case 'update_lp_item_order': if (api_is_allowed_to_edit(null, true)) { $new_order = $_POST['new_order']; $sections = explode('^', $new_order); $new_array = array(); // We have to update parent_item_id, previous_item_id, next_item_id, display_order in the database $LP_item_list = new LP_item_order_list(); foreach ($sections as $items) { if (!empty($items)) { list($id, $parent_id) = explode('|', $items);
/** * function which process the creation of exercises * @param FormValidator $form * @param string */ function processCreation($form, $type = '') { $this->updateTitle(Exercise::format_title_variable($form->getSubmitValue('exerciseTitle'))); $this->updateDescription($form->getSubmitValue('exerciseDescription')); $this->updateAttempts($form->getSubmitValue('exerciseAttempts')); $this->updateFeedbackType($form->getSubmitValue('exerciseFeedbackType')); $this->updateType($form->getSubmitValue('exerciseType')); $this->setRandom($form->getSubmitValue('randomQuestions')); $this->updateRandomAnswers($form->getSubmitValue('randomAnswers')); $this->updateResultsDisabled($form->getSubmitValue('results_disabled')); $this->updateExpiredTime($form->getSubmitValue('enabletimercontroltotalminutes')); $this->updatePropagateNegative($form->getSubmitValue('propagate_neg')); $this->updateRandomByCat($form->getSubmitValue('randomByCat')); $this->updateTextWhenFinished($form->getSubmitValue('text_when_finished')); $this->updateDisplayCategoryName($form->getSubmitValue('display_category_name')); $this->updateReviewAnswers($form->getSubmitValue('review_answers')); $this->updatePassPercentage($form->getSubmitValue('pass_percentage')); if ($form->getSubmitValue('activate_start_date_check') == 1) { $start_time = $form->getSubmitValue('start_time'); $this->start_time = api_get_utc_datetime($start_time); } else { $this->start_time = '0000-00-00 00:00:00'; } if ($form->getSubmitValue('activate_end_date_check') == 1) { $end_time = $form->getSubmitValue('end_time'); $this->end_time = api_get_utc_datetime($end_time); } else { $this->end_time = '0000-00-00 00:00:00'; } if ($form->getSubmitValue('enabletimercontrol') == 1) { $expired_total_time = $form->getSubmitValue('enabletimercontroltotalminutes'); if ($this->expired_time == 0) { $this->expired_time = $expired_total_time; } } else { $this->expired_time = 0; } if ($form->getSubmitValue('randomAnswers') == 1) { $this->random_answers = 1; } else { $this->random_answers = 0; } $this->save($type); }
/** * function which process the creation of exercises * @param FormValidator $form * @param string */ public function processCreation($form, $type = '') { $this->updateTitle(Exercise::format_title_variable($form->getSubmitValue('exerciseTitle'))); $this->updateDescription($form->getSubmitValue('exerciseDescription')); $this->updateAttempts($form->getSubmitValue('exerciseAttempts')); $this->updateFeedbackType($form->getSubmitValue('exerciseFeedbackType')); $this->updateType($form->getSubmitValue('exerciseType')); $this->setRandom($form->getSubmitValue('randomQuestions')); $this->updateRandomAnswers($form->getSubmitValue('randomAnswers')); $this->updateResultsDisabled($form->getSubmitValue('results_disabled')); $this->updateExpiredTime($form->getSubmitValue('enabletimercontroltotalminutes')); $this->updatePropagateNegative($form->getSubmitValue('propagate_neg')); $this->updateSaveCorrectAnswers($form->getSubmitValue('save_correct_answers')); $this->updateRandomByCat($form->getSubmitValue('randomByCat')); $this->updateTextWhenFinished($form->getSubmitValue('text_when_finished')); $this->updateDisplayCategoryName($form->getSubmitValue('display_category_name')); $this->updateReviewAnswers($form->getSubmitValue('review_answers')); $this->updatePassPercentage($form->getSubmitValue('pass_percentage')); $this->updateCategories($form->getSubmitValue('category')); $this->updateEndButton($form->getSubmitValue('end_button')); $this->setOnSuccessMessage($form->getSubmitValue('on_success_message')); $this->setOnFailedMessage($form->getSubmitValue('on_failed_message')); $this->updateEmailNotificationTemplate($form->getSubmitValue('email_notification_template')); $this->updateEmailNotificationTemplateToUser($form->getSubmitValue('email_notification_template_to_user')); $this->setNotifyUserByEmail($form->getSubmitValue('notify_user_by_email')); $this->setModelType($form->getSubmitValue('model_type')); $this->setQuestionSelectionType($form->getSubmitValue('question_selection_type')); $this->setHideQuestionTitle($form->getSubmitValue('hide_question_title')); $this->setQuestionSelectionType($form->getSubmitValue('question_selection_type')); $this->setScoreTypeModel($form->getSubmitValue('score_type_model')); $this->setGlobalCategoryId($form->getSubmitValue('global_category_id')); if ($form->getSubmitValue('activate_start_date_check') == 1) { $start_time = $form->getSubmitValue('start_time'); $this->start_time = api_get_utc_datetime($start_time); } else { $this->start_time = '0000-00-00 00:00:00'; } if ($form->getSubmitValue('activate_end_date_check') == 1) { $end_time = $form->getSubmitValue('end_time'); $this->end_time = api_get_utc_datetime($end_time); } else { $this->end_time = '0000-00-00 00:00:00'; } if ($form->getSubmitValue('enabletimercontrol') == 1) { $expired_total_time = $form->getSubmitValue('enabletimercontroltotalminutes'); if ($this->expired_time == 0) { $this->expired_time = $expired_total_time; } } else { $this->expired_time = 0; } if ($form->getSubmitValue('randomAnswers') == 1) { $this->random_answers = 1; } else { $this->random_answers = 0; } $this->save($type); }