ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilQuestionEditGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilQuestionEditGUI:

Public Member Functions

 __construct ()
 
 setSelfAssessmentEditingMode (bool $a_selfassessmenteditingmode)
 
 getSelfAssessmentEditingMode ()
 
 setDefaultNrOfTries (?int $a_defaultnroftries)
 
 getDefaultNrOfTries ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 addNewIdListener (object $a_object, string $a_method, string $a_parameters='')
 
 executeCommand ()
 
 setQuestionId (?int $a_questionid)
 
 getQuestionId ()
 
 setPoolRefId (?int $a_poolrefid)
 
 getPoolRefId ()
 
 setPoolObjId (?int $a_poolobjid)
 
 getPoolObjId ()
 
 setQuestionType (?string $a_questiontype)
 
 getQuestionType ()
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 
ILIAS TestQuestionPool InternalRequestService $request
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilRbacSystem $rbac_system
 
int $questionid = null
 
int $poolrefid = null
 
int $poolobjid = null
 
string $questiontype = null
 
array $new_id_listeners
 
int $new_id_listener_cnt
 
bool $selfassessmenteditingmode = false
 
int $defaultnroftries = null
 
ilPageConfig $page_config = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilQuestionEditGUI

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e ilQuestionEditGUI: assMultipleChoiceGUI, assClozeTestGUI, assMatchingQuestionGUI, assKprimChoiceGUI ilQuestionEditGUI: assOrderingQuestionGUI, assImagemapQuestionGUI ilQuestionEditGUI: assNumericGUI, assTextSubsetGUI, assSingleChoiceGUI, assTextQuestionGUI ilQuestionEditGUI: assErrorTextGUI, assOrderingHorizontalGUI, assTextSubsetGUI, assFormulaQuestionGUI ilQuestionEditGUI: assLongMenuGUI

Definition at line 30 of file class.ilQuestionEditGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilQuestionEditGUI::__construct ( )

Definition at line 48 of file class.ilQuestionEditGUI.php.

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), setPoolObjId(), setPoolRefId(), setQuestionId(), and setQuestionType().

49  {
50  global $DIC;
51 
52  $this->main_tpl = $DIC->ui()->mainTemplate();
53  $this->ctrl = $DIC['ilCtrl'];
54  $this->request = $DIC->testQuestionPool()->internal()->request();
55  $this->lng = $DIC->language();
56  $this->rbac_system = $DIC->rbac()->system();
57 
58  if ($this->request->raw('qpool_ref_id')) {
59  $this->setPoolRefId($this->request->raw('qpool_ref_id'));
60  } elseif ($this->request->raw('qpool_obj_id')) {
61  $this->setPoolObjId($this->request->raw('qpool_obj_id'));
62  }
63  $this->setQuestionId($this->request->getQuestionId());
64  $this->setQuestionType($this->request->raw('q_type'));
65  $this->lng->loadLanguageModule('assessment');
66 
67  $this->ctrl->saveParameter($this, ['qpool_ref_id', 'qpool_obj_id', 'q_id', 'q_type']);
68 
69 
70  $this->new_id_listeners = [];
71  $this->new_id_listener_cnt = 0;
72  }
setQuestionId(?int $a_questionid)
global $DIC
Definition: feed.php:28
setPoolRefId(?int $a_poolrefid)
setPoolObjId(?int $a_poolobjid)
setQuestionType(?string $a_questiontype)
+ Here is the call graph for this function:

Member Function Documentation

◆ addNewIdListener()

ilQuestionEditGUI::addNewIdListener ( object  $a_object,
string  $a_method,
string  $a_parameters = '' 
)

Definition at line 104 of file class.ilQuestionEditGUI.php.

References $new_id_listener_cnt.

104  : void
105  {
107  $this->new_id_listeners[$cnt]['object'] = $a_object;
108  $this->new_id_listeners[$cnt]['method'] = $a_method;
109  $this->new_id_listeners[$cnt]['parameters'] = $a_parameters;
110  $this->new_id_listener_cnt++;
111  }

◆ executeCommand()

ilQuestionEditGUI::executeCommand ( )

Definition at line 113 of file class.ilQuestionEditGUI.php.

References $i, $new_id_listener_cnt, assQuestionGUI\_getQuestionGUI(), ILIAS\Repository\ctrl(), getDefaultNrOfTries(), getPageConfig(), getPoolObjId(), getQuestionId(), getQuestionType(), getSelfAssessmentEditingMode(), and ILIAS\Repository\lng().

113  : string
114  {
115  $cmd = $this->ctrl->getCmd();
116  $next_class = $this->ctrl->getNextClass();
117 
118  switch ($next_class) {
119  default:
121  $this->getQuestionType() ?? '',
122  $this->getQuestionId()
123  );
124  $q_gui->object->setSelfAssessmentEditingMode(
126  );
127  if ($this->getDefaultNrOfTries() > 0) {
128  $q_gui->object->setDefaultNrOfTries(
129  $this->getDefaultNrOfTries()
130  );
131  }
132 
133  if (is_object($this->page_config)) {
134  $q_gui->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
135  }
136  $q_gui->object->setObjId((int) $this->getPoolObjId());
137 
138  for ($i = 0; $i < $this->new_id_listener_cnt; $i++) {
139  $object = $this->new_id_listeners[$i]['object'];
140  $method = $this->new_id_listeners[$i]['method'];
141  $parameters = $this->new_id_listeners[$i]['parameters'];
142  $q_gui->addNewIdListener(
143  $object,
144  $method,
145  $parameters
146  );
147  }
148 
149  $count = $q_gui->object->usageNumber();
150  if ($count > 0) {
151  if ($this->rbac_system->checkAccess('write', $this->getPoolRefId())) {
152  $this->main_tpl->setOnScreenMessage('info', sprintf($this->lng->txt('qpl_question_is_in_use'), $count));
153  }
154  }
155  $this->ctrl->setCmdClass(get_class($q_gui));
156  $ret = (string) $this->ctrl->forwardCommand($q_gui);
157  break;
158  }
159 
160  return $ret;
161  }
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ getDefaultNrOfTries()

ilQuestionEditGUI::getDefaultNrOfTries ( )

Definition at line 89 of file class.ilQuestionEditGUI.php.

References $defaultnroftries.

Referenced by executeCommand().

89  : ?int
90  {
92  }
+ Here is the caller graph for this function:

◆ getPageConfig()

ilQuestionEditGUI::getPageConfig ( )

Definition at line 99 of file class.ilQuestionEditGUI.php.

References $page_config.

Referenced by executeCommand().

99  : ?ilPageConfig
100  {
101  return $this->page_config;
102  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getPoolObjId()

ilQuestionEditGUI::getPoolObjId ( )

Definition at line 197 of file class.ilQuestionEditGUI.php.

References $poolobjid.

Referenced by executeCommand().

197  : ?int
198  {
199  return $this->poolobjid;
200  }
+ Here is the caller graph for this function:

◆ getPoolRefId()

ilQuestionEditGUI::getPoolRefId ( )

Definition at line 186 of file class.ilQuestionEditGUI.php.

References $poolrefid.

Referenced by setPoolRefId().

186  : ?int
187  {
188  return $this->poolrefid;
189  }
+ Here is the caller graph for this function:

◆ getQuestionId()

ilQuestionEditGUI::getQuestionId ( )

Definition at line 169 of file class.ilQuestionEditGUI.php.

References $questionid.

Referenced by executeCommand().

169  : ?int
170  {
171  return $this->questionid;
172  }
+ Here is the caller graph for this function:

◆ getQuestionType()

ilQuestionEditGUI::getQuestionType ( )

Definition at line 208 of file class.ilQuestionEditGUI.php.

References $questiontype.

Referenced by executeCommand().

208  : ?string
209  {
210  return $this->questiontype;
211  }
+ Here is the caller graph for this function:

◆ getSelfAssessmentEditingMode()

ilQuestionEditGUI::getSelfAssessmentEditingMode ( )

Definition at line 79 of file class.ilQuestionEditGUI.php.

References $selfassessmenteditingmode.

Referenced by executeCommand().

79  : bool
80  {
82  }
+ Here is the caller graph for this function:

◆ setDefaultNrOfTries()

ilQuestionEditGUI::setDefaultNrOfTries ( ?int  $a_defaultnroftries)

Definition at line 84 of file class.ilQuestionEditGUI.php.

84  : void
85  {
86  $this->defaultnroftries = $a_defaultnroftries;
87  }

◆ setPageConfig()

ilQuestionEditGUI::setPageConfig ( ilPageConfig  $a_val)

Definition at line 94 of file class.ilQuestionEditGUI.php.

94  : void
95  {
96  $this->page_config = $a_val;
97  }

◆ setPoolObjId()

ilQuestionEditGUI::setPoolObjId ( ?int  $a_poolobjid)

Definition at line 191 of file class.ilQuestionEditGUI.php.

References ILIAS\Repository\ctrl().

Referenced by __construct(), and setPoolRefId().

191  : void
192  {
193  $this->poolobjid = $a_poolobjid;
194  $this->ctrl->setParameter($this, 'qpool_obj_id', $this->poolobjid);
195  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPoolRefId()

ilQuestionEditGUI::setPoolRefId ( ?int  $a_poolrefid)

Definition at line 174 of file class.ilQuestionEditGUI.php.

References ilObject\_lookupObjId(), ILIAS\Repository\ctrl(), getPoolRefId(), and setPoolObjId().

Referenced by __construct().

174  : void
175  {
176  $this->poolrefid = $a_poolrefid;
177  $this->ctrl->setParameter($this, 'qpool_ref_id', $this->poolrefid);
178 
179  if ($this->getPoolRefId() > 0) {
181  } else {
182  $this->setPoolObjId(null);
183  }
184  }
static _lookupObjId(int $ref_id)
setPoolObjId(?int $a_poolobjid)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setQuestionId()

ilQuestionEditGUI::setQuestionId ( ?int  $a_questionid)

Definition at line 163 of file class.ilQuestionEditGUI.php.

References ILIAS\Repository\ctrl().

Referenced by __construct().

163  : void
164  {
165  $this->questionid = $a_questionid;
166  $this->ctrl->setParameter($this, 'q_id', $this->questionid);
167  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setQuestionType()

ilQuestionEditGUI::setQuestionType ( ?string  $a_questiontype)

Definition at line 202 of file class.ilQuestionEditGUI.php.

References ILIAS\Repository\ctrl().

Referenced by __construct().

202  : void
203  {
204  $this->questiontype = $a_questiontype;
205  $this->ctrl->setParameter($this, 'q_type', $this->questiontype);
206  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelfAssessmentEditingMode()

ilQuestionEditGUI::setSelfAssessmentEditingMode ( bool  $a_selfassessmenteditingmode)

Definition at line 74 of file class.ilQuestionEditGUI.php.

74  : void
75  {
76  $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
77  }

Field Documentation

◆ $ctrl

ilCtrlInterface ilQuestionEditGUI::$ctrl
private

Definition at line 34 of file class.ilQuestionEditGUI.php.

◆ $defaultnroftries

int ilQuestionEditGUI::$defaultnroftries = null
private

Definition at line 45 of file class.ilQuestionEditGUI.php.

Referenced by getDefaultNrOfTries().

◆ $lng

ilLanguage ilQuestionEditGUI::$lng
private

Definition at line 35 of file class.ilQuestionEditGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilQuestionEditGUI::$main_tpl
private

Definition at line 32 of file class.ilQuestionEditGUI.php.

◆ $new_id_listener_cnt

int ilQuestionEditGUI::$new_id_listener_cnt
private

Definition at line 43 of file class.ilQuestionEditGUI.php.

Referenced by addNewIdListener(), and executeCommand().

◆ $new_id_listeners

array ilQuestionEditGUI::$new_id_listeners
private

Definition at line 42 of file class.ilQuestionEditGUI.php.

◆ $page_config

ilPageConfig ilQuestionEditGUI::$page_config = null
private

Definition at line 46 of file class.ilQuestionEditGUI.php.

Referenced by getPageConfig().

◆ $poolobjid

int ilQuestionEditGUI::$poolobjid = null
private

Definition at line 39 of file class.ilQuestionEditGUI.php.

Referenced by getPoolObjId().

◆ $poolrefid

int ilQuestionEditGUI::$poolrefid = null
private

Definition at line 38 of file class.ilQuestionEditGUI.php.

Referenced by getPoolRefId().

◆ $questionid

int ilQuestionEditGUI::$questionid = null
private

Definition at line 37 of file class.ilQuestionEditGUI.php.

Referenced by getQuestionId().

◆ $questiontype

string ilQuestionEditGUI::$questiontype = null
private

Definition at line 40 of file class.ilQuestionEditGUI.php.

Referenced by getQuestionType().

◆ $rbac_system

ilRbacSystem ilQuestionEditGUI::$rbac_system
private

Definition at line 36 of file class.ilQuestionEditGUI.php.

◆ $request

ILIAS TestQuestionPool InternalRequestService ilQuestionEditGUI::$request
private

Definition at line 33 of file class.ilQuestionEditGUI.php.

◆ $selfassessmenteditingmode

bool ilQuestionEditGUI::$selfassessmenteditingmode = false
private

Definition at line 44 of file class.ilQuestionEditGUI.php.

Referenced by getSelfAssessmentEditingMode().


The documentation for this class was generated from the following file: