ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssQuestionFeedbackEditingGUI Class Reference
+ Collaboration diagram for ilAssQuestionFeedbackEditingGUI:

Public Member Functions

 __construct (assQuestionGUI $questionGUI, ilCtrl $ctrl, ilAccessHandler $access, ilTemplate $tpl, ilTabsGUI $tabs, ilLanguage $lng)
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 
 showSyncCmd ()
 

Data Fields

const CMD_SHOW = 'showFeedbackForm'
 command constants More...
 
const CMD_SAVE = 'saveFeedbackForm'
 
const CMD_SHOW_SYNC = 'showSync'
 

Protected Attributes

 $questionGUI = null
 
 $questionOBJ = null
 
 $feedbackOBJ = null
 
 $ctrl = null
 
 $access = null
 
 $tpl = null
 
 $tabs = null
 
 $lng = null
 

Private Member Functions

 showFeedbackFormCmd ()
 command for rendering the feedback editing form to the content area More...
 
 saveFeedbackFormCmd ()
 command for processing the submitted feedback editing form. More...
 
 buildForm ()
 builds the feedback editing form object More...
 
 isFormSaveable ()
 returns the fact wether the feedback editing form has to be saveable or not. More...
 
 isSyncAfterSaveRequired ()
 returns the fact wether the presentation of the question sync2pool form is required after saving the form or not More...
 

Detailed Description

Definition at line 15 of file class.ilAssQuestionFeedbackEditingGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionFeedbackEditingGUI::__construct ( assQuestionGUI  $questionGUI,
ilCtrl  $ctrl,
ilAccessHandler  $access,
ilTemplate  $tpl,
ilTabsGUI  $tabs,
ilLanguage  $lng 
)

Constructor.

public

Parameters
assQuestionGUI$questionGUI
ilCtrl$ctrl
ilAccessHandler$access
ilTemplate$tpl
ilTabsGUI$tabs
ilLanguage$lng

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

References $access, $ctrl, $lng, $questionGUI, $tabs, and $tpl.

100  {
101  $this->questionGUI = $questionGUI;
102  $this->questionOBJ = $questionGUI->object;
103  $this->feedbackOBJ = $questionGUI->object->feedbackOBJ;
104 
105  $this->ctrl = $ctrl;
106  $this->access = $access;
107  $this->tpl = $tpl;
108  $this->tabs = $tabs;
109  $this->lng = $lng;
110  }

Member Function Documentation

◆ buildForm()

ilAssQuestionFeedbackEditingGUI::buildForm ( )
private

builds the feedback editing form object

private

Returns

Definition at line 199 of file class.ilAssQuestionFeedbackEditingGUI.php.

References isFormSaveable().

Referenced by saveFeedbackFormCmd(), and showFeedbackFormCmd().

200  {
201  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
202 
203  $form = new ilPropertyFormGUI();
204  $form->setFormAction($this->ctrl->getFormAction($this));
205  $form->setTitle($this->lng->txt('feedback_generic'));
206  $form->setTableWidth("100%");
207  $form->setId("feedback");
208 
209  $this->feedbackOBJ->completeGenericFormProperties($form);
210  $this->feedbackOBJ->completeSpecificFormProperties($form);
211 
212  if( $this->isFormSaveable() )
213  {
214  $form->addCommandButton(self::CMD_SAVE, $this->lng->txt("save"));
215  }
216 
217  return $form;
218  }
isFormSaveable()
returns the fact wether the feedback editing form has to be saveable or not.
This class represents a property form user interface.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilAssQuestionFeedbackEditingGUI::executeCommand ( )

Execute Command.

public

Definition at line 117 of file class.ilAssQuestionFeedbackEditingGUI.php.

References $_GET, and $cmd.

118  {
119  $cmd = $this->ctrl->getCmd(self::CMD_SHOW);
120  $nextClass = $this->ctrl->getNextClass($this);
121 
122  $this->ctrl->setParameter($this, 'q_id', (int)$_GET['q_id']);
123 
124  switch($nextClass)
125  {
126  case 'ilassspecfeedbackpagegui':
127  case 'ilassgenfeedbackpagegui':
128  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackPageObjectCommandForwarder.php';
129  $forwarder = new ilAssQuestionFeedbackPageObjectCommandForwarder($this->questionOBJ, $this->ctrl, $this->tabs, $this->lng);
130  $forwarder->forward();
131  break;
132 
133  default:
134 
135  $cmd .= 'Cmd';
136  $this->$cmd();
137  break;
138  }
139  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35

◆ isFormSaveable()

ilAssQuestionFeedbackEditingGUI::isFormSaveable ( )
private

returns the fact wether the feedback editing form has to be saveable or not.

this depends on the additional content editing mode and the current question type, as well as on fact wether the question is writable for current user or not, or the fact if we are in self assessment mode or not

private

Returns
boolean $isFormSaveable

Definition at line 229 of file class.ilAssQuestionFeedbackEditingGUI.php.

References $_GET.

Referenced by buildForm().

230  {
231  $isAdditionalContentEditingModePageObject = $this->questionOBJ->isAdditionalContentEditingModePageObject();
232  $isSaveableInPageObjectEditingMode = $this->feedbackOBJ->isSaveableInPageObjectEditingMode();
233 
234  if( $isAdditionalContentEditingModePageObject && !$isSaveableInPageObjectEditingMode )
235  {
236  return false;
237  }
238 
239  $hasWriteAccess = $this->access->checkAccess("write", "", $_GET['ref_id']);
240  $isSelfAssessmentEditingMode = $this->questionOBJ->getSelfAssessmentEditingMode();
241 
242  return $hasWriteAccess || $isSelfAssessmentEditingMode;
243  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ isSyncAfterSaveRequired()

ilAssQuestionFeedbackEditingGUI::isSyncAfterSaveRequired ( )
private

returns the fact wether the presentation of the question sync2pool form is required after saving the form or not

private

Returns
boolean $isSyncAfterSaveRequired

Definition at line 252 of file class.ilAssQuestionFeedbackEditingGUI.php.

References $_GET, $ilUser, and assQuestion\_isWriteable().

Referenced by saveFeedbackFormCmd().

253  {
254  global $ilUser;
255 
256  if( !$_GET["calling_test"] )
257  {
258  return false;
259  }
260 
261  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
262  {
263  return false;
264  }
265 
266  if( !$this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id) )
267  {
268  return false;
269  }
270 
271  if( !assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId()) )
272  {
273  return false;
274  }
275 
276  return true;
277  }
$_GET["client_id"]
global $ilUser
Definition: imgupload.php:15
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFeedbackFormCmd()

ilAssQuestionFeedbackEditingGUI::saveFeedbackFormCmd ( )
private

command for processing the submitted feedback editing form.

first it validates the submitted values.

  • in case of successfull validation it saves the properties and redirects to either form presentation again, or to the syncWithOriginal form for question
  • in case of failed validation it renders the form with post values and error info to the content area again

private

Definition at line 165 of file class.ilAssQuestionFeedbackEditingGUI.php.

References buildForm(), isSyncAfterSaveRequired(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

166  {
167  $form = $this->buildForm();
168 
169  $form->setValuesByPost();
170 
171  if( $form->checkInput() )
172  {
173  $this->feedbackOBJ->saveGenericFormProperties($form);
174  $this->feedbackOBJ->saveSpecificFormProperties($form);
175 
176  $this->questionOBJ->cleanupMediaObjectUsage();
177  $this->questionOBJ->updateTimestamp();
178 
179  if( $this->isSyncAfterSaveRequired() )
180  {
181  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
182  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC);
183  }
184 
185  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
186  $this->ctrl->redirect($this, self::CMD_SHOW);
187  }
188 
189  ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
190  $this->tpl->setContent( $this->ctrl->getHTML($form) );
191  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
buildForm()
builds the feedback editing form object
isSyncAfterSaveRequired()
returns the fact wether the presentation of the question sync2pool form is required after saving the ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ showFeedbackFormCmd()

ilAssQuestionFeedbackEditingGUI::showFeedbackFormCmd ( )
private

command for rendering the feedback editing form to the content area

private

Definition at line 146 of file class.ilAssQuestionFeedbackEditingGUI.php.

References buildForm().

147  {
148  $form = $this->buildForm();
149 
150  $this->feedbackOBJ->initGenericFormProperties($form);
151  $this->feedbackOBJ->initSpecificFormProperties($form);
152 
153  $this->tpl->setContent( $this->ctrl->getHTML($form) );
154  }
buildForm()
builds the feedback editing form object
+ Here is the call graph for this function:

◆ showSyncCmd()

ilAssQuestionFeedbackEditingGUI::showSyncCmd ( )

Definition at line 279 of file class.ilAssQuestionFeedbackEditingGUI.php.

280  {
281  $this->questionGUI->originalSyncForm('','true');
282  }

Field Documentation

◆ $access

ilAssQuestionFeedbackEditingGUI::$access = null
protected

Definition at line 62 of file class.ilAssQuestionFeedbackEditingGUI.php.

Referenced by __construct().

◆ $ctrl

ilAssQuestionFeedbackEditingGUI::$ctrl = null
protected

Definition at line 54 of file class.ilAssQuestionFeedbackEditingGUI.php.

Referenced by __construct().

◆ $feedbackOBJ

ilAssQuestionFeedbackEditingGUI::$feedbackOBJ = null
protected

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

◆ $lng

ilAssQuestionFeedbackEditingGUI::$lng = null
protected

Definition at line 86 of file class.ilAssQuestionFeedbackEditingGUI.php.

Referenced by __construct().

◆ $questionGUI

ilAssQuestionFeedbackEditingGUI::$questionGUI = null
protected

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

Referenced by __construct().

◆ $questionOBJ

ilAssQuestionFeedbackEditingGUI::$questionOBJ = null
protected

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

◆ $tabs

ilAssQuestionFeedbackEditingGUI::$tabs = null
protected

Definition at line 78 of file class.ilAssQuestionFeedbackEditingGUI.php.

Referenced by __construct().

◆ $tpl

ilAssQuestionFeedbackEditingGUI::$tpl = null
protected

Definition at line 70 of file class.ilAssQuestionFeedbackEditingGUI.php.

Referenced by __construct().

◆ CMD_SAVE

const ilAssQuestionFeedbackEditingGUI::CMD_SAVE = 'saveFeedbackForm'

Definition at line 21 of file class.ilAssQuestionFeedbackEditingGUI.php.

◆ CMD_SHOW

◆ CMD_SHOW_SYNC

const ilAssQuestionFeedbackEditingGUI::CMD_SHOW_SYNC = 'showSync'

Definition at line 22 of file class.ilAssQuestionFeedbackEditingGUI.php.


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