/** * Handle target parameter * @param object $a_target * @return */ public static function handleCode($a_ref_id, $a_type, $a_code) { global $lng, $tree, $ilUser; include_once './Services/Link/classes/class.ilLink.php'; $lng->loadLanguageModule($a_type); try { self::useCode($a_code, $a_ref_id); $title = ilObject::_lookupTitle(ilObject::_lookupObjectId($a_ref_id)); ilUtil::sendSuccess(sprintf($lng->txt($a_type . "_admission_link_success_registration"), $title), true); ilUtil::redirect(ilLink::_getLink($a_ref_id)); } catch (ilMembershipRegistrationException $e) { switch ($e->getCode()) { case 124: //added to waiting list ilUtil::sendSuccess($e->getMessage(), true); break; case 123: //object is full ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_membership_limited"), true); break; case 789: //out of registration period ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_registration_period"), true); break; default: ilUtil::sendFailure($e->getMessage(), true); break; } $GLOBALS['ilLog']->logStack(); $GLOBALS['ilLog']->write($e->getCode() . ': ' . $e->getMessage()); $parent_id = $tree->getParentId($a_ref_id); ilUtil::redirect(ilLink::_getLink($parent_id)); } }
/** * create new instance and save it */ public function save() { global $ilUser; $lm_id = $_REQUEST["lm_id"]; if ($lm_id) { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $type = ilObjSAHSLearningModule::_lookupSubType($lm_id); if ($type == "scorm") { include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php"; $lm = new ilObjSCORMLearningModule($lm_id, false); } else { include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; $lm = new ilObjSCORM2004LearningModule($lm_id, false); } include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php"; $newObj = ilObjSCORMVerification::createFromSCORMLM($lm, $ilUser->getId()); if ($newObj) { $parent_id = $this->node_id; $this->node_id = null; $this->putObjectInTree($newObj, $parent_id); $this->afterSave($newObj); } else { ilUtil::sendFailure($this->lng->txt("msg_failed")); } } else { ilUtil::sendFailure($this->lng->txt("select_one")); } $this->create(); }
/** * Saves settings fetched from $_POST */ public function saveSettings() { /** * @var $ilCtrl ilCtrl * @var $lng ilLanguage */ global $ilCtrl, $lng; require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php'; $factory = new ilChatroomFormFactory(); $form = $factory->getGeneralSettingsForm(); if (!$form->checkInput()) { $form->setValuesByPost(); $this->serversettings($form); return; } if (!$this->checkPrivHosts($form->getInput('priv_hosts'))) { $form->setValuesByPost(); ilUtil::sendFailure($lng->txt('invalid_priv_hosts')); $this->serversettings($form); return; } $settings = array('protocol' => $form->getInput('protocol'), 'instance' => $form->getInput('instance'), 'port' => $form->getInput('port'), 'address' => $form->getInput('address'), 'priv_hosts' => $form->getInput('priv_hosts'), 'keystore' => $form->getInput('keystore'), 'keypass' => $form->getInput('keypass'), 'storepass' => $form->getInput('storepass')); require_once 'Modules/Chatroom/classes/class.ilChatroomAdmin.php'; $adminSettings = new ilChatroomAdmin($this->gui->object->getId()); $adminSettings->saveGeneralSettings((object) $settings); $this->writeDataToFile($settings); ilUtil::sendSuccess($lng->txt('settings_has_been_saved'), true); $ilCtrl->redirect($this->gui, 'view-serversettings'); }
public function addAdministratorRole($a_usr_id) { /** * @var $rbacreview ilRbacReview * @var $rbacadmin ilRbacAdmin * @var $lng $lng */ global $rbacreview, $rbacadmin, $lng; $role_list = $rbacreview->getRoleListByObject($this->getRefId()); if (!$role_list) { ilUtil::sendFailure($lng->txt('missing_rolelist')); return false; } $a_rol_id = null; foreach ($role_list as $role) { if (strpos($role['title'], 'il_xavc_admin') !== false) { $a_rol_id = $role['obj_id']; break; } } if ((int) $a_rol_id) { $rbacadmin->assignUser($a_rol_id, $a_usr_id); return true; } else { return false; } }
/** * Add a precondition for a survey question or question block */ public function constraintsAddObject() { if (strlen($_POST["v"]) == 0) { ilUtil::sendFailure($this->lng->txt("msg_enter_value_for_valid_constraint")); return $this->constraintStep3Object(); } $survey_questions =& $this->object->getSurveyQuestions(); $structure =& $_SESSION["constraintstructure"]; $include_elements = $_SESSION["includeElements"]; foreach ($include_elements as $elementCounter) { if (is_array($structure[$elementCounter])) { if (strlen($_GET["precondition"])) { $this->object->updateConstraint($_GET['precondition'], $_POST["q"], $_POST["r"], $_POST["v"], $_POST['c']); } else { $constraint_id = $this->object->addConstraint($_POST["q"], $_POST["r"], $_POST["v"], $_POST['c']); foreach ($structure[$elementCounter] as $key => $question_id) { $this->object->addConstraintToQuestion($question_id, $constraint_id); } } if (count($structure[$elementCounter]) > 1) { $this->object->updateConjunctionForQuestions($structure[$elementCounter], $_POST['c']); } } } unset($_SESSION["includeElements"]); unset($_SESSION["constraintstructure"]); $this->ctrl->redirect($this, "constraints"); }
function changeOwner() { global $rbacsystem, $ilObjDataCache; if (!($user_id = ilObjUser::_lookupId($_POST['owner']))) { ilUtil::sendFailure($this->lng->txt('user_not_known')); $this->owner(); return true; } // no need to change? if ($user_id != $this->gui_obj->object->getOwner()) { $this->gui_obj->object->setOwner($user_id); $this->gui_obj->object->updateOwner(); $ilObjDataCache->deleteCachedEntry($this->gui_obj->object->getId()); include_once "Services/AccessControl/classes/class.ilRbacLog.php"; if (ilRbacLog::isActive()) { ilRbacLog::add(ilRbacLog::CHANGE_OWNER, $this->gui_obj->object->getRefId(), array($user_id)); } } ilUtil::sendSuccess($this->lng->txt('owner_updated'), true); if (!$rbacsystem->checkAccess("edit_permission", $this->gui_obj->object->getRefId())) { $this->ctrl->redirect($this->gui_obj); return true; } $this->ctrl->redirect($this, 'owner'); return true; }
public function executeCommand() { /** * @var $ilCtrl ilCtrl * @var $ilTabs ilTabsGUI * @var $lng ilLanguage */ global $ilCtrl, $ilTabs, $lng; if (!$this->object->getHighscoreEnabled()) { ilUtil::sendFailure($lng->txt('permission_denied'), true); $ilCtrl->redirectByClass('ilObjTestGUI'); } $ilTabs->activateTab('info_short'); $ilTabs->addSubTabTarget('toplist_by_score', $ilCtrl->getLinkTarget($this, 'showResultsToplistByScore'), array('outResultsToplist', 'showResultsToplistByScore')); $ilTabs->addSubTabTarget('toplist_by_time', $ilCtrl->getLinkTarget($this, 'showResultsToplistByTime'), array('showResultsToplistByTime')); $cmd = $ilCtrl->getCmd(); $ilCtrl->saveParameter($this, 'active_id'); switch ($cmd) { case 'showResultsToplistByScore': $ilTabs->setSubTabActive('toplist_by_score'); $this->showResultsToplistByScore(); break; case 'showResultsToplistByTime': $ilTabs->setSubTabActive('toplist_by_time'); $this->showResultsToplistByTime(); break; default: $this->showResultsToplistByScore(); } }
public function doCreate() { global $ilLog; $message = "Standard fields cannot be written to DB"; ilUtil::sendFailure($message); $ilLog->write("[ilDataCollectionStandardField] " . $message); }
/** * insert new file item */ function newFileItem() { global $lng; if ($_FILES["file"]["name"] == "") { $_GET["subCmd"] = "-"; ilUtil::sendFailure($lng->txt("upload_error_file_not_found")); return false; } include_once "./Modules/File/classes/class.ilObjFile.php"; $fileObj = new ilObjFile(); $fileObj->setType("file"); $fileObj->setTitle($_FILES["file"]["name"]); $fileObj->setDescription(""); $fileObj->setFileName($_FILES["file"]["name"]); $fileObj->setFileType($_FILES["file"]["type"]); $fileObj->setFileSize($_FILES["file"]["size"]); $fileObj->setMode("filelist"); $fileObj->create(); $fileObj->raiseUploadError(false); // upload file to filesystem $fileObj->createDirectory(); $fileObj->getUploadFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]); $this->file_object =& $fileObj; return true; }
/** * Constructor * @access public */ function ilObjectStatusGUI(&$a_obj) { global $ilUser, $ilCtrl, $ilias, $ilErr, $lng, $rbacreview; $this->ctrl =& $ilCtrl; $this->object =& $a_obj; $this->tpl = new ilTemplate("tpl.info_layout.html", false, false, "Services/AccessControl"); $this->tpl->setVariable("INFO_REMARK_INTERRUPTED", $lng->txt('info_remark_interrupted')); if (empty($_POST['Fuserid'])) { $this->user =& $ilUser; } else { if ($_POST['Fselect_type'] == "id") { $this->user = $ilias->obj_factory->getInstanceByObjId($_POST['Fuserid'], false); } else { include_once 'Services/User/classes/class.ilObjUser.php'; $user_id = ilObjUser::_lookupId($_POST['Fuserid']); $this->user = $ilias->obj_factory->getInstanceByObjId($user_id, false); } if ($this->user === false or $this->user->getType() != 'usr') { $this->user =& $ilUser; ilUtil::sendFailure($lng->txt('info_err_user_not_exist')); } else { ilUtil::sendInfo($lng->txt('info_user_view_changed')); } } // get all user roles and all valid roles in scope $this->user_roles = $rbacreview->assignedRoles($this->user->getId()); $this->global_roles = $rbacreview->getGlobalRoles(); $this->valid_roles = $rbacreview->getParentRoleIds($this->object->getRefId()); $this->assigned_valid_roles = $this->getAssignedValidRoles(); $this->getPermissionInfo(); $this->getRoleAssignmentInfo(); $this->getObjectSummary(); }
private function saveEnteredPasswordCmd() { $this->passwordChecker->setUserEnteredPassword($_POST["password"]); if (!$this->passwordChecker->isUserEnteredPasswordCorrect()) { ilUtil::sendFailure($this->lng->txt("tst_password_entered_wrong_password"), true); } $this->ctrl->redirectByClass($this->getNextCommandClass(), $this->getNextCommandCmd()); }
/** * Constructor * * @access public * @param assQuestion $questionOBJ * @param ilCtrl $ctrl * @param ilTabsGUI $tabs * @param ilLanguage $lng */ public function __construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng) { parent::__construct($questionOBJ, $ctrl, $tabs, $lng); $this->questionHint = new ilAssQuestionHint(); if (!isset($_GET['hint_id']) || !(int) $_GET['hint_id'] || !$this->questionHint->load((int) $_GET['hint_id'])) { ilUtil::sendFailure('invalid hint id given: ' . (int) $_GET['hint_id'], true); $this->ctrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST); } }
/** * Save data to DB */ function save() { $plugin = $this->object->getPlugin(); $result = $this->writePostData(); if ($result == 1) { ilUtil::sendFailure($plugin->txt("errorInput"), true); $this->editQuestion(); } else { parent::save(); } }
protected function show() { $this->tpl->getStandardTemplate(); global $ilLocator, $ilAccess; if (!$ilAccess->checkAccess('write', '', $_GET['ref_id'])) { ilUtil::sendFailure("Access denied!"); return; } $this->buildHeader($ilLocator); $form = $this->buildForm(); $this->tpl->setContent($form->getHTML()); }
/** * Constructor * * @access public * @param assQuestion $questionOBJ * @param ilCtrl $ctrl * @param ilTabsGUI $tabs * @param ilLanguage $lng */ public function __construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng) { parent::__construct($questionOBJ, $ctrl, $tabs, $lng); if (!isset($_GET['feedback_id']) || !(int) $_GET['feedback_id']) { ilUtil::sendFailure('invalid feedback id given: ' . (int) $_GET['feedback_id'], true); $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW); } if (!isset($_GET['feedback_type']) || !ilAssQuestionFeedback::isValidFeedbackPageObjectType($_GET['feedback_type'])) { ilUtil::sendFailure('invalid feedback type given: ' . $_GET['feedback_type'], true); $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW); } }
/** * check whether goto script will succeed */ public function _checkGoto($a_target) { global $ilAccess, $lng; $t_arr = explode("_", $a_target); if ($t_arr[0] != "bibl" || (int) $t_arr[1] <= 0) { return false; } if ($ilAccess->checkAccess("visible", "", $t_arr[1])) { return true; } $object_title = ilObject::_lookupTitle(ilObject::_lookupObjId($t_arr[1])); ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"), $object_title), true); return false; }
public function decryptSignature() { $form = new certCheckSignatureFormGUI(); if (!$form->checkInput()) { ilUtil::sendFailure($this->pl->txt('decrypt_failed'), true); } $public_key = openssl_get_publickey('file://' . ilCertificateConfig::get('signature_publickey')); openssl_public_decrypt(base64_decode($form->getInput('signature')), $decrypted, $public_key); if ($decrypted) { ilUtil::sendInfo($this->pl->txt('decrypt_successful') . '<br/>' . $decrypted, true); } else { ilUtil::sendFailure($this->pl->txt('decrypt_failed'), true); } }
public function saveTopic() { $this->objCurrentTopic->setTitle(ilUtil::stripSlashes(trim($_POST['title']))); $this->objCurrentTopic->setSorting((int) ilUtil::stripSlashes(trim($_POST['sorting']))); if ($_POST['title'] == '') { ilUtil::sendFailure($this->lng->txt('fill_out_all_required_fields')); $this->showTopicForm(); } else { $mode = $this->objCurrentTopic->getId() ? 'edit' : 'create'; if ($this->objCurrentTopic->save()) { ilUtil::sendSuccess($this->lng->txt($mode == 'create' ? 'topic_saved' : 'topic_edited')); } $this->showTopicsList(); } return true; }
/** * Remove a participations. * * @param integer $booking_id The booking id of the participation. */ public function removeParticipations(array $a_booking_ids) { foreach ($a_booking_ids as $a_booking_id) { if (!ilRoomSharingNumericUtils::isPositiveNumber($a_booking_id)) { ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_id_submitted"), true); } } //In order to prevent unnessary prepareManip statements, use different function if only one booking shoud be left. if (count($a_booking_ids) == 1) { $this->ilRoomsharingDatabase->deleteParticipation($this->ilUser->getId(), $a_booking_ids[0]); } else { $this->ilRoomsharingDatabase->deleteParticipations($this->ilUser->getId(), $a_booking_ids); } $this->sendQuitMail($a_booking_ids); ilUtil::sendSuccess($this->lng->txt('rep_robj_xrs_participations_left'), true); }
/** * Checks user permissions by given array and ref_id. * * @global Rbacsystem $rbacsystem * @param mixed $permissions * @param integer $ref_id */ public static function checkUserPermissions($permissions, $ref_id, $send_info = true) { global $rbacsystem, $lng; if (!is_array($permissions)) { $permissions = array($permissions); } foreach ($permissions as $permission) { if (!$rbacsystem->checkAccess($permission, $ref_id)) { if ($send_info) { ilUtil::sendFailure($lng->txt("permission_denied"), true); } return false; } } return true; }
/** * @param $parent_gui */ function __construct($parent_gui) { global $tpl, $ilCtrl, $ilTabs, $ilToolbar, $lng, $ilAccess; $this->tpl = $tpl; $this->ctrl = $ilCtrl; $this->parent_gui = $parent_gui; $this->parent_object = $parent_gui->object; $this->tabs_gui = $this->parent_gui->tabs_gui; $this->toolbar = $ilToolbar; $this->lng = $lng; $this->ilAccess = $ilAccess; $this->lng->loadLanguageModule('user'); if (!$this->ilAccess->checkaccess("write", "", $this->parent_gui->object->getRefId())) { ilUtil::sendFailure($this->lng->txt("permission_denied"), true); } }
/** * The only thing this execute Command does is forward the command in the command chain. */ function executeCommand() { $next_class = $this->ctrl->getNextClass($this); switch ($next_class) { default: $class_file = $this->ctrl->lookupClassPath($next_class); if (is_file($class_file)) { include_once $class_file; $gui = new $next_class(); $this->ctrl->forwardCommand($gui); } else { ilUtil::sendFailure('Plugin GUI-Class not found! (' . $next_class . ')'); } break; } }
/** * Save settings */ protected function save() { global $lng, $ilCtrl; $form = $this->initConfigurationForm(); $settings = ilFhoevEventSettings::getInstance(); if ($form->checkInput()) { $settings->setActive($form->getInput('active')); $settings->setTemplateId($form->getInput('dtpl')); $settings->save(); ilUtil::sendSuccess($lng->txt('settings_saved'), true); $ilCtrl->redirect($this, 'configure'); } $error = $lng->txt('err_check_input'); $form->setValuesByPost(); ilUtil::sendFailure($e); $this->configure($form); }
/** * Constructor * * @param object $a_parent_obj parent gui object * @param string $a_parent_cmd parent default command * @param object $a_handler workspace access handler * @param bool $a_load_data * @param int $a_parent_node_id */ function __construct($a_parent_obj, $a_parent_cmd, $a_handler, $a_parent_node_id = null, $a_load_data = false) { global $ilCtrl, $lng; $this->handler = $a_handler; if (stristr(get_class($a_parent_obj), "portfolio")) { $this->parent_node_id = $a_parent_node_id; $this->portfolio_mode = true; } parent::__construct($a_parent_obj, $a_parent_cmd); $this->setId("il_tbl_wspsh"); $this->setTitle($lng->txt("wsp_shared_resources")); $this->addColumn($this->lng->txt("lastname"), "lastname"); $this->addColumn($this->lng->txt("firstname"), "firstname"); $this->addColumn($this->lng->txt("login"), "login"); if (!$this->portfolio_mode) { $this->addColumn($this->lng->txt("wsp_shared_object_type"), "obj_type"); } $this->addColumn($this->lng->txt("wsp_shared_date"), "acl_date"); $this->addColumn($this->lng->txt("wsp_shared_title"), "title"); $this->addColumn($this->lng->txt("wsp_shared_type")); if (!$this->portfolio_mode) { $this->addColumn($this->lng->txt("action")); } $this->setDefaultOrderField("acl_date"); $this->setDefaultOrderDirection("desc"); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.shared_row.html", "Services/PersonalWorkspace"); $this->setDisableFilterHiding(true); $this->setResetCommand("resetsharefilter"); $this->setFilterCommand("applysharefilter"); $this->initFilter(); // reset will remove all filters if ($this->portfolio_mode && !$this->filter["obj_type"]) { $this->filter["obj_type"] = "prtf"; } if ($a_load_data) { if ($this->filter["user"] && strlen($this->filter["user"]) > 3 || $this->filter["title"] && strlen($this->filter["title"]) > 3 || $this->filter["acl_date"] || $this->filter["obj_type"] || $this->filter["acl_type"] || $this->filter["crsgrp"]) { $this->importData(); include_once "Services/User/classes/class.ilUserUtil.php"; return; } ilUtil::sendFailure($lng->txt("wsp_shared_mandatory_filter_info")); } $this->disable("header"); $this->disable("content"); }
/** * Constructor * * @param ilObjDataCollectionGUI $a_parent_obj * @param int $table_id */ public function __construct(ilObjDataCollectionGUI $a_parent_obj, $table_id) { global $ilCtrl, $lng, $ilToolbar, $tpl, $ilTabs; $this->main_table_id = $a_parent_obj->object->getMainTableId(); $this->table_id = $table_id; $this->parent_obj = $a_parent_obj; $this->obj_id = $a_parent_obj->obj_id; $this->ctrl = $ilCtrl; $this->lng = $lng; $this->tpl = $tpl; $this->tabs = $ilTabs; $this->toolbar = $ilToolbar; if (!$this->checkAccess()) { ilUtil::sendFailure($this->lng->txt('permission_denied'), true); $this->ctrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords'); } }
/** * Show a list of all rooms. */ public function showRoomsObject() { if (!$this->permission->checkPrivilege(PRIVC::ACCESS_ROOMS)) { ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action")); $this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary'); return false; } $roomsTable = new ilRoomSharingRoomsTableGUI($this, 'showRooms', $this->ref_id); $roomsTable->initFilter(); $roomsTable->getItems($roomsTable->getCurrentFilter()); $toolbar = new ilToolbarGUI(); if ($this->permission->checkPrivilege(PRIVC::ADD_ROOMS)) { $toolbar->addButton($this->lng->txt('rep_robj_xrs_add_room'), $this->ctrl->getLinkTargetByClass('ilroomsharingroomgui', 'addRoom')); } // the commands (functions) to be called when the correspondent buttons are clicked $roomsTable->setResetCommand("resetRoomFilter"); $roomsTable->setFilterCommand("applyRoomFilter"); $this->tpl->setContent($toolbar->getHTML() . $roomsTable->getHTML()); }
/** * show send mail * * @access public * @param * @return */ public function sendMailToSelectedUsers() { if (isset($_GET['member_id'])) { $_POST['participants'] = array($_GET['member_id']); } else { $_POST['participants'] = array_unique(array_merge((array) $_POST['admins'], (array) $_POST['tutors'], (array) $_POST['members'], (array) $_POST['roles'], (array) $_POST['waiting'], (array) $_POST['subscribers'])); } if (!count($_POST['participants'])) { ilUtil::sendFailure($GLOBALS['lng']->txt("no_checkbox"), TRUE); $this->ctrl->returnToParent($this); return false; } foreach ($_POST['participants'] as $usr_id) { $rcps[] = ilObjUser::_lookupLogin($usr_id); } require_once 'Services/Mail/classes/class.ilMailFormCall.php'; ilUtil::redirect(ilMailFormCall::getRedirectTarget($this->getCurrentObject(), 'members', array(), array('type' => 'new', 'rcp_to' => implode(',', $rcps), 'sig' => $this->createMailSignature()))); return true; }
/** * Executes the action provided by the user. */ public function executeRoomAttributeAction() { $this->createAttributesForm(); if ($this->attributesForm->checkInput()) { try { $updatedRoomsAmount = $this->proceedRoomAttributeAction(); } catch (ilRoomSharingAttributesException $exc) { ilUtil::sendFailure($this->lng->txt($exc->getMessage()), true); $this->ctrl->redirect($this, ATTRC::SHOW_ROOM_ATTR_ACTIONS); } if (isset($updatedRoomsAmount) && $updatedRoomsAmount > 0) { ilUtil::sendSuccess($this->createDeletionMessage($updatedRoomsAmount), true); } else { ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true); } $this->ctrl->redirect($this, ATTRC::SHOW_ROOM_ATTR_ACTIONS); } $this->attributesForm->setValuesByPost(); $this->tpl->setContent($this->attributesForm->getHtml()); }
public function substituteFormula($variables, $results) { global $lng; $formula = $this->getFormula(); if (preg_match_all("/(\\\$r\\d+)/ims", $formula, $matches)) { foreach ($matches[1] as $result) { if (strcmp($result, $this->getResult()) == 0) { ilUtil::sendFailure($lng->txt("errRecursionInResult")); return false; } if (is_object($results[$result])) { $formula = str_replace($result, $results[$result]->substituteFormula($variables, $results), $formula); } else { ilUtil::sendFailure($lng->txt("errFormulaQuestion")); return false; } } } return "(" . $formula . ")"; }
/** * create new instance and save it */ public function save() { global $ilUser; $exercise_id = $_REQUEST["exc_id"]; if ($exercise_id) { include_once "Modules/Exercise/classes/class.ilObjExercise.php"; $exercise = new ilObjExercise($exercise_id, false); include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php"; $newObj = ilObjExerciseVerification::createFromExercise($exercise, $ilUser->getId()); if ($newObj) { $parent_id = $this->node_id; $this->node_id = null; $this->putObjectInTree($newObj, $parent_id); $this->afterSave($newObj); } else { ilUtil::sendFailure($this->lng->txt("msg_failed")); } } else { ilUtil::sendFailure($this->lng->txt("select_one")); } $this->create(); }