ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAssQuestionFeedbackPageObjectCommandForwarder.php
Go to the documentation of this file.
1<?php
2
28{
38 public function __construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng)
39 {
40 global $DIC;
41 $main_tpl = $DIC->ui()->mainTemplate();
42 parent::__construct($questionOBJ, $ctrl, $tabs, $lng);
43
44 if (!$this->request->isset('feedback_id') || !(int) $this->request->raw('feedback_id') || !$questionOBJ->feedbackOBJ->checkFeedbackParent((int) $this->request->raw('feedback_id'))) {
45 $main_tpl->setOnScreenMessage('failure', 'invalid feedback id given: ' . (int) $this->request->raw('feedback_id'), true);
46 $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
47 }
48
49 if (!$this->request->isset('feedback_type') || !ilAssQuestionFeedback::isValidFeedbackPageObjectType($this->request->raw('feedback_type'))) {
50 $main_tpl->setOnScreenMessage('failure', 'invalid feedback type given: ' . $this->request->raw('feedback_type'), true);
51 $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
52 }
53 }
54
58 public function forward(): void
59 {
60 $pageObjectGUI = $this->getPageObjectGUI($this->request->raw('feedback_type'), $this->request->raw('feedback_id'));
61 $pageObjectGUI->setEnabledTabs(true);
62
63 $this->tabs->setBackTarget(
64 $this->lng->txt('tst_question_feedback_back_to_feedback_form'),
65 $this->ctrl->getLinkTargetByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW)
66 );
67
68 $this->ctrl->setParameter($pageObjectGUI, 'feedback_id', $this->request->raw('feedback_id'));
69 $this->ctrl->setParameter($pageObjectGUI, 'feedback_type', $this->request->raw('feedback_type'));
70
71 $this->ctrl->forwardCommand($pageObjectGUI);
72 }
73
79 public function ensurePageObjectExists($pageObjectType, $pageObjectId): void
80 {
82 && !ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId, '', true)) {
83 $pageObject = new ilAssGenFeedbackPage();
84 $pageObject->setParentId($this->questionOBJ->getId());
85 $pageObject->setId($pageObjectId);
86 $pageObject->createFromXML();
87 }
89 && !ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId, '', true)) {
90 $pageObject = new ilAssSpecFeedbackPage();
91 $pageObject->setParentId($this->questionOBJ->getId());
92 $pageObject->setId($pageObjectId);
93 $pageObject->createFromXML();
94 }
95 }
96
103 public function getPageObjectGUI($pageObjectType, $pageObjectId)
104 {
106 $pageObjectGUI = new ilAssGenFeedbackPageGUI($pageObjectId);
107 $pageObjectGUI->obj->addUpdateListener(
108 $this->questionOBJ,
109 'updateTimestamp'
110 );
111 $pageObjectGUI->setTemplateTargetVar('ADM_CONTENT');
112 $pageObjectGUI->setTemplateOutput(true);
113 return $pageObjectGUI;
114 }
115 $pageObjectGUI = new ilAssSpecFeedbackPageGUI($pageObjectId);
116 $pageObjectGUI->obj->addUpdateListener(
117 $this->questionOBJ,
118 'updateTimestamp'
119 );
120 $pageObjectGUI->setTemplateTargetVar('ADM_CONTENT');
121 $pageObjectGUI->setTemplateOutput(true);
122 return $pageObjectGUI;
123 }
124}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with giben type/id
__construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng)
Constructor.
getPageObjectGUI($pageObjectType, $pageObjectId)
instantiates, initialises and returns a page object gui class
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK
type for specific feedback page objects
static isValidFeedbackPageObjectType(string $feedbackPageObjectType)
returns the fact whether the given page object type relates to generic or specific feedback page obje...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
language handling
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26