当前位置: 首页>>代码示例>>PHP>>正文


PHP assQuestion::_isWriteable方法代码示例

本文整理汇总了PHP中assQuestion::_isWriteable方法的典型用法代码示例。如果您正苦于以下问题:PHP assQuestion::_isWriteable方法的具体用法?PHP assQuestion::_isWriteable怎么用?PHP assQuestion::_isWriteable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在assQuestion的用法示例。


在下文中一共展示了assQuestion::_isWriteable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveFormCmd

 /**
  * saves the form on successfull validation and redirects to showForm command
  * 
  * @access	private
  * @global	ilCtrl		$ilCtrl
  * @global	ilLanguage	$lng
  */
 private function saveFormCmd()
 {
     global $ilCtrl, $lng, $ilUser;
     $form = $this->buildForm();
     if ($form->checkInput()) {
         $questionHint = new ilAssQuestionHint();
         if ((int) $form->getInput('hint_id')) {
             $questionHint->load((int) $form->getInput('hint_id'));
             $hintJustCreated = false;
         } else {
             $questionHint->setQuestionId($this->questionOBJ->getId());
             $questionHint->setIndex(ilAssQuestionHintList::getNextIndexByQuestionId($this->questionOBJ->getId()));
             $hintJustCreated = true;
         }
         $questionHint->setText($form->getInput('hint_text'));
         $questionHint->setPoints($form->getInput('hint_points'));
         $questionHint->save();
         ilUtil::sendSuccess($lng->txt('tst_question_hints_form_saved_msg'), true);
         $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId())) {
             $ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
         }
         if ($hintJustCreated && $this->questionOBJ->isAdditionalContentEditingModePageObject()) {
             $ilCtrl->setParameterByClass('ilasshintpagegui', 'hint_id', $questionHint->getId());
             $ilCtrl->redirectByClass('ilasshintpagegui', 'edit');
         } else {
             $ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
         }
     }
     ilUtil::sendFailure($lng->txt('tst_question_hints_form_invalid_msg'));
     $this->showFormCmd($form);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:40,代码来源:class.ilAssQuestionHintGUI.php

示例2: suggestedsolution

 /**
  * Allows to add suggested solutions for questions
  *
  * @access public
  */
 public function suggestedsolution()
 {
     global $ilUser;
     global $ilAccess;
     if ($_POST["deleteSuggestedSolution"] == 1) {
         $this->object->deleteSuggestedSolutions();
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
         $this->ctrl->redirect($this, "suggestedsolution");
     }
     $save = is_array($_POST["cmd"]) && array_key_exists("suggestedsolution", $_POST["cmd"]) ? TRUE : FALSE;
     $output = "";
     $solution_array = $this->object->getSuggestedSolution(0);
     $options = array("lm" => $this->lng->txt("obj_lm"), "st" => $this->lng->txt("obj_st"), "pg" => $this->lng->txt("obj_pg"), "git" => $this->lng->txt("glossary_term"), "file" => $this->lng->txt("fileDownload"), "text" => $this->lng->txt("solutionText"));
     if (strcmp($_POST["solutiontype"], "file") == 0 && strcmp($solution_array["type"], "file") != 0) {
         $solution_array = array("type" => "file");
     } elseif (strcmp($_POST["solutiontype"], "text") == 0 && strcmp($solution_array["type"], "text") != 0) {
         $solution_array = array("type" => "text", "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE));
     }
     if ($save && strlen($_POST["filename"])) {
         $solution_array["value"]["filename"] = $_POST["filename"];
     }
     if ($save && strlen($_POST["solutiontext"])) {
         $solution_array["value"] = $_POST["solutiontext"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     if (count($solution_array)) {
         $form = new ilPropertyFormGUI();
         $form->setFormAction($this->ctrl->getFormAction($this));
         $form->setTitle($this->lng->txt("solution_hint"));
         $form->setMultipart(TRUE);
         $form->setTableWidth("100%");
         $form->setId("suggestedsolutiondisplay");
         // suggested solution output
         include_once "./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
         $title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype");
         $template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE, "Modules/TestQuestionPool");
         if (strlen($solution_array["internal_link"])) {
             $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
             $template->setCurrentBlock("preview");
             $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
             $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . $this->lng->txt("view") . "</a> ");
             $template->parseCurrentBlock();
         } elseif (strcmp($solution_array["type"], "file") == 0 && is_array($solution_array["value"])) {
             $href = $this->object->getSuggestedSolutionPathWeb() . $solution_array["value"]["name"];
             $template->setCurrentBlock("preview");
             $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
             $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . ilUtil::prepareFormOutput(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]) . "</a> ");
             $template->parseCurrentBlock();
         }
         $template->setVariable("TEXT_TYPE", $this->lng->txt("type"));
         $template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]);
         $title->setHtml($template->get());
         $deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution");
         $deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution"));
         $title->addSubItem($deletesolution);
         $form->addItem($title);
         if (strcmp($solution_array["type"], "file") == 0) {
             // file
             $file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file");
             $file->setRequired(TRUE);
             $file->enableFileNameSelection("filename");
             //$file->setSuffixes(array("doc","xls","png","jpg","gif","pdf"));
             if ($_FILES["file"]["tmp_name"] && $file->checkInput()) {
                 if (!file_exists($this->object->getSuggestedSolutionPath())) {
                     ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
                 }
                 $res = ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"], $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]);
                 if ($res) {
                     ilUtil::renameExecutables($this->object->getSuggestedSolutionPath());
                     // remove an old file download
                     if (is_array($solution_array["value"])) {
                         @unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]);
                     }
                     $file->setValue($_FILES["file"]["name"]);
                     $this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"]));
                     $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
                     if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
                         return $this->originalSyncForm("suggestedsolution");
                     } else {
                         ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
                         $this->ctrl->redirect($this, "suggestedsolution");
                     }
                 } else {
                     // BH: $res as info string? wtf? it holds a bool or something else!!?
                     ilUtil::sendInfo($res);
                 }
             } else {
                 if (is_array($solution_array["value"])) {
                     $file->setValue($solution_array["value"]["name"]);
                     $file->setFilename(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]);
                 }
             }
             $form->addItem($file);
             $hidden = new ilHiddenInputGUI("solutiontype");
             $hidden->setValue("file");
//.........这里部分代码省略.........
开发者ID:bheyser,项目名称:qplskl,代码行数:101,代码来源:class.assQuestionGUI.php

示例3: saveReturnFQ

 public function saveReturnFQ()
 {
     global $ilUser;
     $old_id = $_GET["q_id"];
     $result = $this->writePostData();
     if ($result == 0) {
         $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
         $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
         $this->saveTaxonomyAssignments();
         $this->object->saveToDb();
         $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
             $this->ctrl->redirect($this, "originalSyncForm");
             return;
         } elseif ($_GET["calling_test"]) {
             require_once 'Modules/Test/classes/class.ilObjTest.php';
             $test = new ilObjTest($_GET["calling_test"]);
             #var_dump(assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId()));
             $q_id = $this->object->getId();
             if (!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())) {
                 global $tree, $ilDB, $ilPluginAdmin;
                 include_once "./Modules/Test/classes/class.ilObjTest.php";
                 $_GET["ref_id"] = $_GET["calling_test"];
                 $test = new ilObjTest($_GET["calling_test"], true);
                 require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
                 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
                 $new_id = $test->insertQuestion($testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId());
                 $q_id = $new_id;
                 if (isset($_REQUEST['prev_qid'])) {
                     $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST['prev_qid']);
                 }
                 $this->ctrl->setParameter($this, 'q_id', $new_id);
                 $this->ctrl->setParameter($this, 'calling_test', $_GET['calling_test']);
                 #$this->ctrl->setParameter($this, 'test_ref_id', false);
             }
             ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
             if ($_REQUEST['test_express_mode']) {
                 ilUtil::redirect(ilTestExpressPage::getReturnToPageLink($q_id));
             } else {
                 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["calling_test"]);
             }
         } else {
             if ($this->object->getId() != $old_id) {
                 $this->callNewIdListeners($this->object->getId());
                 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
                 $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
             }
             if (strcmp($_SESSION["info"], "") != 0) {
                 ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), true);
             } else {
                 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
             }
             $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
         }
     } else {
         $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
         $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
         $this->object->saveToDb();
         $this->editQuestion();
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:62,代码来源:class.assFormulaQuestionGUI.php

示例4: isSyncAfterSaveRequired

 /**
  * returns the fact wether the presentation of the question sync2pool form
  * is required after saving the form or not
  * 
  * @access private
  * @return boolean $isSyncAfterSaveRequired
  */
 private function isSyncAfterSaveRequired()
 {
     global $ilUser;
     if (!$_GET["calling_test"]) {
         return false;
     }
     if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
         return false;
     }
     if (!$this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id)) {
         return false;
     }
     if (!assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
         return false;
     }
     return true;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:24,代码来源:class.ilAssQuestionFeedbackEditingGUI.php

示例5: saveListOrderCmd

 /**
  * saves the order based on index values passed from table's form
  * (the table must not be paginated, because ALL hints index values are required)
  *
  * @access	private
  * @global	ilCtrl		$ilCtrl
  * @global	ilLanguage	$lng
  */
 private function saveListOrderCmd()
 {
     global $ilCtrl, $lng;
     $hintIndexes = self::orderHintIndexes(self::fetchHintIndexesParameter());
     if (!count($hintIndexes)) {
         ilUtil::sendFailure($lng->txt('tst_question_hints_save_order_unkown_failure_msg'), true);
         $ilCtrl->redirect($this);
     }
     $curQuestionHintList = ilAssQuestionHintList::getListByQuestionId($this->questionOBJ->getId());
     $newQuestionHintList = new ilAssQuestionHintList();
     foreach ($hintIndexes as $hintId => $hintIndex) {
         if (!$curQuestionHintList->hintExists($hintId)) {
             ilUtil::sendFailure($lng->txt('tst_question_hints_save_order_unkown_failure_msg'), true);
             $ilCtrl->redirect($this);
         }
         $questionHint = $curQuestionHintList->getHint($hintId);
         $newQuestionHintList->addHint($questionHint);
     }
     $newQuestionHintList->reIndex();
     ilUtil::sendSuccess($lng->txt('tst_question_hints_save_order_success_msg'), true);
     $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     global $ilUser;
     if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId())) {
         $ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
     }
     $ilCtrl->redirect($this);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:36,代码来源:class.ilAssQuestionHintsGUI.php


注:本文中的assQuestion::_isWriteable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。