ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilAssQuestionPageCommandForwarder.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
14 {
18  protected $testObj;
19 
23  public function getTestObj()
24  {
25  return $this->testObj;
26  }
27 
31  public function setTestObj($testObj)
32  {
33  $this->testObj = $testObj;
34  }
35 
36  public function forward()
37  {
38  global $DIC;
39  $ctrl = $DIC->ctrl();
40  $lng = $DIC->language();
41  $ui = $DIC->ui()->mainTemplate();
42 
43  $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
44  $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
45  $q_gui->setQuestionTabs();
46  $q_gui->outAdditionalOutput();
47  $q_gui->object->setObjId($this->getTestObj()->getId());
48  $question = &$q_gui->object;
49 
50 
51  if ($ctrl->getCmd() === 'edit' && $question->isInActiveTest()) {
52  ilUtil::sendFailure($lng->txt("question_is_part_of_running_test"), true);
53  $ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
54  }
55 
56  if ($_REQUEST['prev_qid']) {
57  $ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
58  }
59 
60  $_GET['calling_test'] = $this->getTestObj()->getRefId();
61  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
62  $ui->setCurrentBlock("ContentStyle");
63  $ui->setVariable(
64  "LOCATION_CONTENT_STYLESHEET",
66  );
67  $ui->parseCurrentBlock();
68 
69  // syntax style
70  $ui->setCurrentBlock("SyntaxStyle");
71  $ui->setVariable(
72  "LOCATION_SYNTAX_STYLESHEET",
74  );
75  $ui->parseCurrentBlock();
76  $ctrl->saveParameter($this, "q_id");
77  $lng->loadLanguageModule("content");
78  $ctrl->setReturnByClass("ilAssQuestionPageGUI", "view");
79  $ctrl->setReturnByClass("ilObjTestGUI", "questions");
80  $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]);
81  $page_gui->setEditPreview(true);
82  if (strlen($ctrl->getCmd()) == 0) {
83  $ctrl->setCmdClass(get_class($page_gui));
84  $ctrl->setCmd("preview");
85  }
86  $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(true)));
87  $page_gui->setTemplateTargetVar("ADM_CONTENT");
88  $page_gui->setOutputMode($this->getTestObj()->evalTotalPersons() == 0 ? "edit" : 'preview');
89  $page_gui->setHeader($question->getTitle());
90  $page_gui->setPresentationTitle($question->getTitle() . ' [' . $DIC->language()->txt('question_id_short') . ': ' . $question->getId() . ']');
91 
92  $html = $ctrl->forwardCommand($page_gui);
93  $ui->setContent($html);
94  }
95 }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
$_GET["client_id"]
Question page GUI class.
$lng
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
global $DIC
Definition: goto.php:24
static getSyntaxStylePath()
get syntax style path
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.