ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
assOrderingQuestionGUI Class Reference

Ordering question GUI representation. More...

+ Inheritance diagram for assOrderingQuestionGUI:
+ Collaboration diagram for assOrderingQuestionGUI:

Public Member Functions

 __construct ($id=-1)
 assOrderingQuestionGUI constructor More...
 
 setClearAnswersOnWritingPostDataEnabled ($clearAnswersOnWritingPostDataEnabled)
 
 isClearAnswersOnWritingPostDataEnabled ()
 
 changeToPictures ()
 
 changeToText ()
 
 orderNestedTerms ()
 
 orderNestedPictures ()
 
 removeElementImage ()
 
 uploadElementImage ()
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 editQuestion ($checkonly=FALSE)
 Creates an output of the edit form for the question. More...
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $forceCorrectSolution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 Get the question solution output. More...
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 getTestOutput ($activeId, $pass, $isPostponed=FALSE, $userSolutionPost=FALSE, $inlineFeedback=false)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 aggregateAnswers ($relevant_answers_chosen, $answers_defined_on_question)
 
 renderAggregateView ($aggregate)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilTemplate $tpl)
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 

Data Fields

 $object
 
 $old_ordering_depth = array()
 
 $leveled_ordering = array()
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 

Protected Member Functions

 writePostData ($forceSaving=false)
 {} More...
 
 buildEditForm ()
 
 isInteractivePresentation ()
 
 persistAuthoringForm ($form)
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

Private Member Functions

 getOldLeveledOrdering ()
 

Private Attributes

 $clearAnswersOnWritingPostDataEnabled
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Protected Attributes inherited from assQuestionGUI
 $editForm
 

Detailed Description

Ordering question GUI representation.

The assOrderingQuestionGUI class encapsulates the GUI representation for ordering questions.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

assOrderingQuestionGUI: ilFormPropertyDispatchGUI

Definition at line 23 of file class.assOrderingQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assOrderingQuestionGUI::__construct (   $id = -1)

assOrderingQuestionGUI constructor

The constructor takes possible arguments an creates an instance of the assOrderingQuestionGUI object.

Parameters
integer$idThe database id of a ordering question object
Returns
assOrderingQuestionGUI

Definition at line 47 of file class.assOrderingQuestionGUI.php.

48  {
49  parent::__construct();
50  include_once "./Modules/TestQuestionPool/classes/class.assOrderingQuestion.php";
51  $this->object = new assOrderingQuestion();
52  if ($id >= 0)
53  {
54  $this->object->loadFromDb($id);
55  }
56  $this->clearAnswersOnWritingPostDataEnabled = false;
57  }
Class for ordering questions.

Member Function Documentation

◆ aggregateAnswers()

assOrderingQuestionGUI::aggregateAnswers (   $relevant_answers_chosen,
  $answers_defined_on_question 
)

Definition at line 810 of file class.assOrderingQuestionGUI.php.

References $data, array, and object.

Referenced by getAggregatedAnswersView().

811  {
812  $passdata = array(); // Regroup answers into units of passes.
813  foreach($relevant_answers_chosen as $answer_chosen)
814  {
815  $passdata[$answer_chosen['active_fi'].'-'. $answer_chosen['pass']][$answer_chosen['value2']] = $answer_chosen['value1'];
816  }
817 
818  $variants = array(); // Determine unique variants.
819  foreach($passdata as $key => $data)
820  {
821  $hash = md5(implode('-', $data));
822  $value_set = false;
823  foreach ($variants as $vkey => $variant)
824  {
825  if ($variant['hash'] == $hash)
826  {
827  $variant['count']++;
828  $value_set = true;
829  }
830  }
831  if (!$value_set)
832  {
833  $variants[$key]['hash'] = $hash;
834  $variants[$key]['count'] = 1;
835  }
836  }
837 
838  $aggregate = array(); // Render aggregate from variant.
839  foreach ($variants as $key => $variant_entry)
840  {
841  $variant = $passdata[$key];
842 
843  foreach($variant as $variant_key => $variant_line)
844  {
845  $i = 0;
846  $aggregated_info_for_answer['count'] = $variant_entry['count'];
847  foreach ($answers_defined_on_question as $element)
848  {
849  $i++;
850 
851  if($this->object->isImageOrderingType())
852  {
853  $element->setImageThumbnailPrefix($this->object->getThumbPrefix());
854  $element->setImagePathWeb($this->object->getImagePathWeb());
855  $element->setImagePathFs($this->object->getImagePath());
856 
857  $src = $element->getPresentationImageUrl();
858  $alt = $element->getContent();
859  $content = "<img src='{$src}' alt='{$alt}' title='{$alt}'/>";
860  }
861  else
862  {
863  $content = $element->getContent();
864  }
865 
866  $aggregated_info_for_answer[$i . ' - ' . $content]
867  = $passdata[$key][$i];
868  }
869 
870  }
871  $aggregate[] = $aggregated_info_for_answer;
872  }
873  return $aggregate;
874  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ buildEditForm()

assOrderingQuestionGUI::buildEditForm ( )
protected
Returns
ilAssOrderingQuestionAuthoringFormGUI

Definition at line 419 of file class.assOrderingQuestionGUI.php.

References assQuestionGUI\addBasicQuestionFormProperties(), object, OQ_PICTURES, assQuestionGUI\outQuestionType(), populateAnswerSpecificFormPart(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by changeToPictures(), changeToText(), editQuestion(), orderNestedPictures(), orderNestedTerms(), removeElementImage(), uploadElementImage(), and writePostData().

420  {
421  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingQuestionAuthoringFormGUI.php';
423  $this->editForm = $form;
424 
425  $form->setFormAction($this->ctrl->getFormAction($this));
426  $form->setTitle($this->outQuestionType());
427  $form->setMultipart(( $this->object->getOrderingType() == OQ_PICTURES ) ? TRUE : FALSE);
428  $form->setTableWidth("100%");
429  $form->setId("ordering");
430  // title, author, description, question, working time (assessment mode)
431  $this->addBasicQuestionFormProperties($form);
432  $this->populateQuestionSpecificFormPart($form);
433  $this->populateAnswerSpecificFormPart($form);
434 
435  $this->populateTaxonomyFormSection($form);
436 
437  $form->addSpecificOrderingQuestionCommandButtons($this->object);
438  $form->addGenericAssessmentQuestionCommandButtons($this->object);
439 
440  return $form;
441  }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
Adds the answer specific form parts to a question property form gui.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
const OQ_PICTURES
Ordering question constants.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeToPictures()

assOrderingQuestionGUI::changeToPictures ( )

Definition at line 75 of file class.assOrderingQuestionGUI.php.

References buildEditForm(), object, OQ_NESTED_PICTURES, OQ_PICTURES, persistAuthoringForm(), assQuestionGUI\renderEditForm(), and setClearAnswersOnWritingPostDataEnabled().

76  {
77  if($this->object->getOrderingType() != OQ_NESTED_PICTURES && $this->object->getOrderingType() != OQ_PICTURES)
78  {
80  }
81 
82  $form = $this->buildEditForm();
83  $form->setValuesByPost();
84  $this->persistAuthoringForm($form);
85 
86  $this->object->setOrderingType(OQ_PICTURES);
87  $this->object->saveToDb();
88 
89  $form->ensureReprintableFormStructure($this->object);
90  $this->renderEditForm($form);
91  }
setClearAnswersOnWritingPostDataEnabled($clearAnswersOnWritingPostDataEnabled)
const OQ_PICTURES
Ordering question constants.
Create new PHPExcel object
obj_idprivate
const OQ_NESTED_PICTURES
+ Here is the call graph for this function:

◆ changeToText()

assOrderingQuestionGUI::changeToText ( )

Definition at line 93 of file class.assOrderingQuestionGUI.php.

References buildEditForm(), object, OQ_NESTED_TERMS, OQ_TERMS, persistAuthoringForm(), assQuestionGUI\renderEditForm(), and setClearAnswersOnWritingPostDataEnabled().

94  {
95  if($this->object->getOrderingType() != OQ_NESTED_TERMS && $this->object->getOrderingType() != OQ_TERMS)
96  {
98  }
99 
100  $form = $this->buildEditForm();
101  $form->setValuesByPost();
102  $this->persistAuthoringForm($form);
103 
104  $this->object->setOrderingType(OQ_TERMS);
105  $this->object->saveToDb();
106 
107  $form->ensureReprintableFormStructure($this->object);
108  $this->renderEditForm($form);
109  }
const OQ_NESTED_TERMS
setClearAnswersOnWritingPostDataEnabled($clearAnswersOnWritingPostDataEnabled)
const OQ_TERMS
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ editQuestion()

assOrderingQuestionGUI::editQuestion (   $checkonly = FALSE)

Creates an output of the edit form for the question.

Definition at line 411 of file class.assOrderingQuestionGUI.php.

References buildEditForm(), and assQuestionGUI\renderEditForm().

412  {
413  $this->renderEditForm( $this->buildEditForm() );
414  }
+ Here is the call graph for this function:

◆ getAfterParticipationSuppressionAnswerPostVars()

assOrderingQuestionGUI::getAfterParticipationSuppressionAnswerPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiAnswerScoringAdjustable.

Definition at line 774 of file class.assOrderingQuestionGUI.php.

References array.

775  {
776  return array();
777  }
Create styles array
The data for the language used.

◆ getAfterParticipationSuppressionQuestionPostVars()

assOrderingQuestionGUI::getAfterParticipationSuppressionQuestionPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiQuestionScoringAdjustable.

Definition at line 788 of file class.assOrderingQuestionGUI.php.

References array.

789  {
790  return array();
791  }
Create styles array
The data for the language used.

◆ getAggregatedAnswersView()

assOrderingQuestionGUI::getAggregatedAnswersView (   $relevant_answers)

Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface.

Parameters
array$relevant_answers
Returns
string

Implements ilGuiQuestionScoringAdjustable.

Definition at line 801 of file class.assOrderingQuestionGUI.php.

References aggregateAnswers(), object, and renderAggregateView().

802  {
803  $aggView = $this->aggregateAnswers(
804  $relevant_answers, $this->object->getOrderingElementList()
805  );
806 
807  return $this->renderAggregateView($aggView)->get();
808  }
aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ getOldLeveledOrdering()

assOrderingQuestionGUI::getOldLeveledOrdering ( )
private

Definition at line 752 of file class.assOrderingQuestionGUI.php.

References $ilDB, $old_ordering_depth, $res, $row, array, and object.

753  {
754  global $ilDB;
755 
756  $res = $ilDB->queryF('SELECT depth FROM qpl_a_ordering WHERE question_fi = %s ORDER BY solution_key ASC',
757  array('integer'), array($this->object->getId()));
758  while($row = $ilDB->fetchAssoc($res))
759  {
760  $this->old_ordering_depth[] = $row['depth'];
761  }
763  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
global $ilDB

◆ getPreview()

assOrderingQuestionGUI::getPreview (   $show_question_only = FALSE,
  $showInlineFeedback = false 
)

Definition at line 541 of file class.assOrderingQuestionGUI.php.

References ilAssNestedOrderingElementsInputGUI\CONTEXT_QUESTION_PREVIEW, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), isInteractivePresentation(), and object.

542  {
543  if( $this->getPreviewSession() && $this->getPreviewSession()->hasParticipantSolution() )
544  {
545  $solutionOrderingElementList = unserialize(
546  $this->getPreviewSession()->getParticipantsSolution()
547  );
548  }
549  else
550  {
551  $solutionOrderingElementList = $this->object->getShuffledOrderingElementList();
552  }
553 
554  $answers = $this->object->buildNestedOrderingElementInputGui();
555  $answers->setNestingEnabled($this->object->isOrderingTypeNested());
557  $answers->setInteractionEnabled($this->isInteractivePresentation());
558  $answers->setElementList($solutionOrderingElementList);
559 
560  $template = new ilTemplate("tpl.il_as_qpl_ordering_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
561 
562  $template->setCurrentBlock('nested_ordering_output');
563  $template->setVariable('NESTED_ORDERING', $answers->getHTML());
564  $template->parseCurrentBlock();
565 
566  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
567 
568  if( $show_question_only )
569  {
570  return $template->get();
571  }
572 
573  return $this->getILIASPage($template->get());
574 
575  //$this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/ordering.js");
576  }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ getSolutionOutput()

assOrderingQuestionGUI::getSolutionOutput (   $active_id,
  $pass = NULL,
  $graphicalOutput = FALSE,
  $result_output = FALSE,
  $show_question_only = TRUE,
  $show_feedback = FALSE,
  $forceCorrectSolution = FALSE,
  $show_manual_scoring = FALSE,
  $show_question_text = TRUE 
)

Get the question solution output.

Parameters
integer$active_idThe active user id
integer$passThe test pass
boolean$graphicalOutputShow visual feedback for right/wrong answers
boolean$result_outputShow the reached points for parts of the question
boolean$show_question_onlyShow the question without the ILIAS content around
boolean$show_feedbackShow the question feedback
boolean$show_correct_solutionShow the correct solution instead of the user solution
boolean$show_manual_scoringShow specific information for the manual scoring output
bool$show_question_text
Returns
string The solution output of the question as HTML code

Definition at line 458 of file class.assOrderingQuestionGUI.php.

References $pass, ilAssNestedOrderingElementsInputGUI\CONTEXT_CORRECT_SOLUTION_PRESENTATION, ilAssNestedOrderingElementsInputGUI\CONTEXT_USER_SOLUTION_PRESENTATION, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), getSpecificFeedbackOutput(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), and object.

469  {
470  $solutionOrderingList = $this->object->getOrderingElementListForSolutionOutput(
471  $forceCorrectSolution, $active_id, $pass
472  );
473 
474  $answers_gui = $this->object->buildNestedOrderingElementInputGui();
475 
476  if( $forceCorrectSolution )
477  {
479  }
480  else
481  {
483  }
484 
485  $answers_gui->setInteractionEnabled(false);
486 
487  $answers_gui->setElementList( $solutionOrderingList );
488 
489  $answers_gui->setCorrectnessTrueElementList(
490  $solutionOrderingList->getParityTrueElementList($this->object->getOrderingElementList())
491  );
492 
493  $solution_html = $answers_gui->getHTML();
494 
495  $template = new ilTemplate("tpl.il_as_qpl_nested_ordering_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
496  $template->setVariable('SOLUTION_OUTPUT', $solution_html);
497  if ($show_question_text==true)
498  {
499  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
500  }
501  $questionoutput = $template->get();
502 
503  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
504  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
505 
506  if($show_feedback)
507  {
508  $feedback = '';
509 
510  if( !$this->isTestPresentationContext() )
511  {
512  $fb = $this->getGenericFeedbackOutput($active_id, $pass);
513  $feedback .= strlen($fb) ? $fb : '';
514  }
515 
516  $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
517  $feedback .= strlen($fb) ? $fb : '';
518 
519  if (strlen($feedback))
520  {
521  $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
523  );
524 
525  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
526  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
527  }
528  }
529 
530  if( $show_question_only )
531  {
532  return $solutiontemplate->get();
533  }
534 
535  return $this->getILIASPage( $solutiontemplate->get() );
536 
537  // is this template still in use? it is not used at this point any longer!
538  // $template = new ilTemplate("tpl.il_as_qpl_ordering_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
539  }
hasCorrectSolution($activeId, $passIndex)
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
Create new PHPExcel object
obj_idprivate
getSpecificFeedbackOutput($active_id, $pass)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assOrderingQuestionGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Definition at line 704 of file class.assOrderingQuestionGUI.php.

References assQuestionGUI\$tpl, and object.

Referenced by getSolutionOutput().

705  {
706  if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists($this->object->getOrderingElementList()) )
707  {
708  return '';
709  }
710 
711  $tpl = new ilTemplate('tpl.il_as_qpl_ordering_elem_fb.html', true, true, 'Modules/TestQuestionPool');
712 
713  foreach( $this->object->getOrderingElementList() as $element)
714  {
715  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
716  $this->object->getId(), $element->getPosition()
717  );
718 
719  if( $this->object->isImageOrderingType() )
720  {
721  $imgSrc = $this->object->getImagePathWeb().$element->getContent();
722  $tpl->setCurrentBlock('image');
723  $tpl->setVariable('IMG_SRC', $imgSrc);
724  }
725  else
726  {
727  $tpl->setCurrentBlock('text');
728  }
729  $tpl->setVariable('CONTENT', $element->getContent());
730  $tpl->parseCurrentBlock();
731 
732  $tpl->setCurrentBlock('element');
733  $tpl->setVariable('FEEDBACK', $feedback);
734  $tpl->parseCurrentBlock();
735  }
736 
737  return $this->object->prepareTextareaOutput($tpl->get(), TRUE);
738  }
special template class to simplify handling of ITX/PEAR
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ getTestOutput()

assOrderingQuestionGUI::getTestOutput (   $activeId,
  $pass,
  $isPostponed = FALSE,
  $userSolutionPost = FALSE,
  $inlineFeedback = false 
)

Definition at line 579 of file class.assOrderingQuestionGUI.php.

References $pass, array, ilAssNestedOrderingElementsInputGUI\CONTEXT_USER_SOLUTION_SUBMISSION, object, and assQuestionGUI\outQuestionPage().

581  {
582  $userSolutionPost = is_array($userSolutionPost) ? $userSolutionPost : array();
583 
584  $orderingGUI = $this->object->buildNestedOrderingElementInputGui();
585  $orderingGUI->setNestingEnabled($this->object->isOrderingTypeNested());
586 
587  $solutionOrderingElementList = $this->object->getSolutionOrderingElementListForTestOutput(
588  $orderingGUI, $userSolutionPost, $activeId, $pass
589  );
590 
591  $template = new ilTemplate('tpl.il_as_qpl_ordering_output.html', TRUE, TRUE, 'Modules/TestQuestionPool');
592 
594  $orderingGUI->setElementList( $solutionOrderingElementList );
595 
596  $template->setCurrentBlock('nested_ordering_output');
597  $template->setVariable('NESTED_ORDERING',$orderingGUI->getHTML());
598  $template->parseCurrentBlock();
599 
600  $template->setVariable('QUESTIONTEXT', $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
601 
602  $pageoutput = $this->outQuestionPage('', $isPostponed, $activeId, $template->get());
603 
604  return $pageoutput;
605  }
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
+ Here is the call graph for this function:

◆ isClearAnswersOnWritingPostDataEnabled()

assOrderingQuestionGUI::isClearAnswersOnWritingPostDataEnabled ( )
Returns
boolean

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

References $clearAnswersOnWritingPostDataEnabled.

Referenced by writeAnswerSpecificPostData().

+ Here is the caller graph for this function:

◆ isInteractivePresentation()

assOrderingQuestionGUI::isInteractivePresentation ( )
protected

Definition at line 607 of file class.assOrderingQuestionGUI.php.

References assQuestionGUI\isRenderPurposeDemoplay(), and assQuestionGUI\isRenderPurposePlayback().

Referenced by getPreview().

608  {
609  if( $this->isRenderPurposePlayback() )
610  {
611  return true;
612  }
613 
614  if( $this->isRenderPurposeDemoplay() )
615  {
616  return true;
617  }
618 
619  return false;
620  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ orderNestedPictures()

assOrderingQuestionGUI::orderNestedPictures ( )

Definition at line 120 of file class.assOrderingQuestionGUI.php.

References buildEditForm(), OQ_NESTED_PICTURES, assQuestionGUI\renderEditForm(), and writePostData().

121  {
122  $this->writePostData(true);
123  $this->object->setOrderingType(OQ_NESTED_PICTURES);
124  $this->object->saveToDb();
125 
126  $this->renderEditForm($this->buildEditForm());
127  }
const OQ_NESTED_PICTURES
writePostData($forceSaving=false)
{}
+ Here is the call graph for this function:

◆ orderNestedTerms()

assOrderingQuestionGUI::orderNestedTerms ( )

Definition at line 111 of file class.assOrderingQuestionGUI.php.

References buildEditForm(), OQ_NESTED_TERMS, assQuestionGUI\renderEditForm(), and writePostData().

112  {
113  $this->writePostData(true);
114  $this->object->setOrderingType(OQ_NESTED_TERMS);
115  $this->object->saveToDb();
116 
117  $this->renderEditForm($this->buildEditForm());
118  }
const OQ_NESTED_TERMS
writePostData($forceSaving=false)
{}
+ Here is the call graph for this function:

◆ persistAuthoringForm()

assOrderingQuestionGUI::persistAuthoringForm (   $form)
protected
Parameters
$form
Exceptions
ilTestQuestionPoolException

Definition at line 744 of file class.assOrderingQuestionGUI.php.

References assQuestionGUI\saveTaxonomyAssignments(), writeAnswerSpecificPostData(), assQuestionGUI\writeQuestionGenericPostData(), and writeQuestionSpecificPostData().

Referenced by changeToPictures(), changeToText(), and writePostData().

745  {
747  $this->writeQuestionSpecificPostData($form);
748  $this->writeAnswerSpecificPostData($form);
749  $this->saveTaxonomyAssignments();
750  }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateAnswerSpecificFormPart()

assOrderingQuestionGUI::populateAnswerSpecificFormPart ( ilPropertyFormGUI  $form)

Adds the answer specific form parts to a question property form gui.

Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Implements ilGuiAnswerScoringAdjustable.

Definition at line 299 of file class.assOrderingQuestionGUI.php.

References $header, ilPropertyFormGUI\addItem(), assQuestionGUI\isAdjustmentEditContext(), assQuestionGUI\isRenderPurposePrintPdf(), and object.

Referenced by buildEditForm().

300  {
302  $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
303  $form->addItem($header);
304 
305  if( $this->isAdjustmentEditContext() )
306  {
307  $orderingElementInput = $this->object->buildNestedOrderingElementInputGui();
308  }
309  else
310  {
311  $orderingElementInput = $this->object->buildOrderingElementInputGui();
312  }
313 
314  $orderingElementInput->setStylingDisabled($this->isRenderPurposePrintPdf());
315  $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
316 
317  $orderingElementInput->setElementList( $this->object->getOrderingElementList() );
318 
319  $form->addItem($orderingElementInput);
320 
321  return $form;
322  }
This class represents a section header in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
$header
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 324 of file class.assOrderingQuestionGUI.php.

References ilPropertyFormGUI\addItem(), ilNumberInputGUI\allowDecimals(), object, and ilNumberInputGUI\setValue().

Referenced by buildEditForm().

325  {
326  if (!$this->object->getSelfAssessmentEditingMode())
327  {
328  $element_height = new ilNumberInputGUI($this->lng->txt( "element_height" ), "element_height");
329  $element_height->setValue( $this->object->getElementHeight() );
330  $element_height->setRequired( false );
331  $element_height->setMaxLength( 6 );
332  $element_height->setMinValue( 20 );
333  $element_height->setSize( 6 );
334  $element_height->setInfo( $this->lng->txt( "element_height_info" ) );
335  $form->addItem( $element_height );
336  }
337 
338  if( $this->object->isImageOrderingType() )
339  {
340  $geometry = new ilNumberInputGUI($this->lng->txt( "thumb_geometry" ), "thumb_geometry");
341  $geometry->setValue( $this->object->getThumbGeometry() );
342  $geometry->setRequired( true );
343  $geometry->setMaxLength( 6 );
344  $geometry->setMinValue( 20 );
345  $geometry->setSize( 6 );
346  $geometry->setInfo( $this->lng->txt( "thumb_geometry_info" ) );
347  $form->addItem( $geometry );
348  }
349 
350  // points
351  $points = new ilNumberInputGUI($this->lng->txt( "points" ), "points");
352  $points->allowDecimals( true );
353  $points->setValue( $this->object->getPoints() );
354  $points->setRequired( TRUE );
355  $points->setSize( 3 );
356  $points->setMinValue( 0 );
357  $points->setMinvalueShouldBeGreater( true );
358  $form->addItem( $points );
359 
360  return $form;
361  }
setValue($a_value)
Set Value.
allowDecimals($a_value)
Toggle Decimals.
This class represents a number property in a property form.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeElementImage()

assOrderingQuestionGUI::removeElementImage ( )

Definition at line 129 of file class.assOrderingQuestionGUI.php.

References array, buildEditForm(), ilAssOrderingElementList\buildInstance(), object, and assQuestionGUI\renderEditForm().

130  {
131  $orderingInput = $this->object->buildOrderingImagesInputGui();
132  $this->object->initOrderingElementAuthoringProperties($orderingInput);
133 
134  $form = $this->buildEditForm();
135  $form->replaceFormItemByPostVar($orderingInput);
136  $form->setValuesByPost();
137 
138  $replacementElemList = ilAssOrderingElementList::buildInstance(
139  $this->object->getId(), array()
140  );
141 
142  $storedElementList = $this->object->getOrderingElementList();
143 
144  foreach($orderingInput->getElementList($this->object->getId()) as $submittedElement)
145  {
146  if( $submittedElement->isImageRemovalRequest() )
147  {
148  if( $this->object->isImageFileStored($submittedElement->getContent()) )
149  {
150  $this->object->dropImageFile($submittedElement->getContent());
151  }
152 
153  $submittedElement->setContent(null);
154  }
155 
156  if( $storedElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier()) )
157  {
158  $storedElement = $storedElementList->getElementByRandomIdentifier(
159  $submittedElement->getRandomIdentifier()
160  );
161 
162  $submittedElement->setSolutionIdentifier($storedElement->getSolutionIdentifier());
163  $submittedElement->setIndentation($storedElement->getIndentation());
164  }
165 
166  $replacementElemList->addElement($submittedElement);
167  }
168 
169  $replacementElemList->saveToDb();
170 
171  $orderingInput->setElementList( $replacementElemList );
172  $this->renderEditForm($form);
173  }
static buildInstance($questionId, $orderingElements=array())
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ renderAggregateView()

assOrderingQuestionGUI::renderAggregateView (   $aggregate)
Parameters
$aggregate
Returns
ilTemplate

Definition at line 881 of file class.assOrderingQuestionGUI.php.

References $html, and assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

882  {
883  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
884 
885  foreach ($aggregate as $line_data)
886  {
887  $tpl->setCurrentBlock( 'aggregaterow' );
888  $count = array_shift($line_data);
889  $html = '<ul>';
890  foreach($line_data as $key => $line)
891  {
892  $html .= '<li>'. ++$line .'&nbsp;-&nbsp;' .$key. '</li>';
893  }
894  $html .= '</ul>';
895  $tpl->setVariable( 'COUNT', $count );
896  $tpl->setVariable( 'OPTION', $html );
897 
898  $tpl->parseCurrentBlock();
899  }
900  return $tpl;
901  }
special template class to simplify handling of ITX/PEAR
$html
Definition: example_001.php:87
+ Here is the caller graph for this function:

◆ setClearAnswersOnWritingPostDataEnabled()

assOrderingQuestionGUI::setClearAnswersOnWritingPostDataEnabled (   $clearAnswersOnWritingPostDataEnabled)
Parameters
boolean$clearAnswersOnWritingPostDataEnabled

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

References $clearAnswersOnWritingPostDataEnabled.

Referenced by changeToPictures(), and changeToText().

63  {
64  $this->clearAnswersOnWritingPostDataEnabled = $clearAnswersOnWritingPostDataEnabled;
65  }
+ Here is the caller graph for this function:

◆ setQuestionTabs()

assOrderingQuestionGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Definition at line 629 of file class.assOrderingQuestionGUI.php.

References $_GET, $_POST, $url, assQuestionGUI\addBackTab(), assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), assQuestionGUI\addTab_QuestionPreview(), assQuestionGUI\addTab_SuggestedSolution(), and array.

630  {
631  global $rbacsystem, $ilTabs;
632 
633  $ilTabs->clearTargets();
634 
635  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
636  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
637  $q_type = $this->object->getQuestionType();
638 
639  if (strlen($q_type))
640  {
641  $classname = $q_type . "GUI";
642  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
643  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
644  }
645 
646  if ($_GET["q_id"])
647  {
648  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
649  {
650  // edit page
651  $ilTabs->addTarget("edit_page",
652  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
653  array("edit", "insert", "exec_pg"),
654  "", "", false);
655  }
656 
657  $this->addTab_QuestionPreview($ilTabs);
658  }
659 
660  $force_active = false;
661  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
662  {
663  $url = "";
664  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
665  $commands = $_POST["cmd"];
666  if (is_array($commands))
667  {
668  foreach ($commands as $key => $value)
669  {
670  if (preg_match("/^delete_.*/", $key, $matches))
671  {
672  $force_active = true;
673  }
674  }
675  }
676  // edit question properties
677  $ilTabs->addTarget("edit_question",
678  $url,
679  array("orderNestedTerms","orderNestedPictures","editQuestion", "save", "saveEdit", "addanswers", "removeanswers", "changeToPictures", "uploadElementImage", "changeToText", "upanswers", "downanswers", "originalSyncForm"),
680  $classname, "", $force_active);
681  }
682 
683  // add tab for question feedback within common class assQuestionGUI
684  $this->addTab_QuestionFeedback($ilTabs);
685 
686  // add tab for question hint within common class assQuestionGUI
687  $this->addTab_QuestionHints($ilTabs);
688 
689  // add tab for question's suggested solution within common class assQuestionGUI
690  $this->addTab_SuggestedSolution($ilTabs, $classname);
691 
692  // Assessment of questions sub menu entry
693  if ($_GET["q_id"])
694  {
695  $ilTabs->addTarget("statistics",
696  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
697  array("assessment"),
698  $classname, "");
699  }
700 
701  $this->addBackTab($ilTabs);
702  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
$url
Definition: shib_logout.php:72
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
Create styles array
The data for the language used.
addBackTab(ilTabsGUI $ilTabs)
$_POST["username"]
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
+ Here is the call graph for this function:

◆ uploadElementImage()

assOrderingQuestionGUI::uploadElementImage ( )

Definition at line 175 of file class.assOrderingQuestionGUI.php.

References buildEditForm(), object, assQuestionGUI\renderEditForm(), ilUtil\sendFailure(), and writeAnswerSpecificPostData().

176  {
177  $orderingInput = $this->object->buildOrderingImagesInputGui();
178  $this->object->initOrderingElementAuthoringProperties($orderingInput);
179 
180  $form = $this->buildEditForm();
181  $form->replaceFormItemByPostVar($orderingInput);
182  $form->setValuesByPost();
183 
184  if(!$orderingInput->checkInput())
185  {
186  ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
187  }
188 
189  $this->writeAnswerSpecificPostData($form);
190  $this->object->getOrderingElementList()->saveToDb();
191  $orderingInput->setElementList($this->object->getOrderingElementList());
192 
193  $this->renderEditForm($form);
194  }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

assOrderingQuestionGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the answer specific values from $_POST and applies them to the data object.

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiAnswerScoringAdjustable.

Definition at line 204 of file class.assOrderingQuestionGUI.php.

References $_POST, array, assQuestionGUI\isAdjustmentEditContext(), isClearAnswersOnWritingPostDataEnabled(), object, and assOrderingQuestion\ORDERING_ELEMENT_FORM_FIELD_POSTVAR.

Referenced by persistAuthoringForm(), and uploadElementImage().

205  {
207  {
208  throw new ilTestQuestionPoolException('form submit request missing the form submit!?');
209  }
210 
211  #$submittedElementList = $this->object->fetchSolutionListFromFormSubmissionData($_POST);
212  $submittedElementList = $this->object->fetchSolutionListFromSubmittedForm($form);
213 
214  $replacementElementList = new ilAssOrderingElementList();
215  $replacementElementList->setQuestionId($this->object->getId());
216 
217  $currentElementList = $this->object->getOrderingElementList();
218 
219  foreach($submittedElementList as $submittedElement)
220  {
221  if( $this->object->hasOrderingTypeUploadSupport() )
222  {
223  if( $submittedElement->isImageUploadAvailable() )
224  {
225  $suffix = strtolower(array_pop(explode(".", $submittedElement->getUploadImageName())));
226  if( in_array($suffix, array("jpg", "jpeg", "png", "gif")) )
227  {
228  $submittedElement->setUploadImageName( $this->object->buildHashedImageFilename(
229  $submittedElement->getUploadImageName(), true
230  ));
231 
232  $wasImageFileStored = $this->object->storeImageFile(
233  $submittedElement->getUploadImageFile(), $submittedElement->getUploadImageName()
234  );
235 
236  if( $wasImageFileStored )
237  {
238  if( $this->object->isImageFileStored( $submittedElement->getContent() ) )
239  {
240  $this->object->dropImageFile( $submittedElement->getContent() );
241  }
242 
243  $submittedElement->setContent( $submittedElement->getUploadImageName() );
244  }
245  }
246  }
247  }
248 
249  if( $currentElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier()) )
250  {
251  $storedElement = $currentElementList->getElementByRandomIdentifier(
252  $submittedElement->getRandomIdentifier()
253  );
254 
255  $submittedElement->setSolutionIdentifier($storedElement->getSolutionIdentifier());
256 
257  if( $this->isAdjustmentEditContext() || $this->object->isOrderingTypeNested() )
258  {
259  $submittedElement->setContent($storedElement->getContent());
260  }
261 
262  if( !$this->object->isOrderingTypeNested() )
263  {
264  $submittedElement->setIndentation($storedElement->getIndentation());
265  }
266 
267  if( $this->object->isImageReplaced($submittedElement, $storedElement) )
268  {
269  $this->object->dropImageFile($storedElement->getContent());
270  }
271  }
272 
273  $replacementElementList->addElement($submittedElement);
274  }
275 
276  if( $this->object->isImageOrderingType() )
277  {
278  $this->object->handleThumbnailCreation($replacementElementList);
279  }
280 
282  {
283  $replacementElementList->clearElementContents();
284  }
285 
286  if( $this->object->hasOrderingTypeUploadSupport() )
287  {
288  $obsoleteElementList = $currentElementList->getDifferenceElementList($replacementElementList);
289 
290  foreach($obsoleteElementList as $obsoleteElement)
291  {
292  $this->object->dropImageFile($obsoleteElement->getContent());
293  }
294  }
295 
296  $this->object->setOrderingElementList($replacementElementList);
297  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writePostData()

assOrderingQuestionGUI::writePostData (   $forceSaving = false)
protected

{}

Definition at line 366 of file class.assOrderingQuestionGUI.php.

References buildEditForm(), assQuestionGUI\isSaveCommand(), persistAuthoringForm(), and assQuestionGUI\renderEditForm().

Referenced by orderNestedPictures(), and orderNestedTerms().

367  {
368  $savingAllowed = true; // assume saving allowed first
369 
370  if( !$forceSaving )
371  {
372  // this case seems to be a regular save call, so we consider
373  // the validation result for the decision of saving as well
374 
375  // inits {this->editForm} and performs validation
376  $form = $this->buildEditForm();
377  $form->setValuesByPost(); // manipulation and distribution of values
378 
379  if( !$form->checkInput() ) // manipulations regular style input propeties
380  {
381  $form->prepareValuesReprintable($this->object);
382  $this->renderEditForm($form);
383 
384  // consequence of vaidation
385  $savingAllowed = false;
386  }
387  }
388  elseif( !$this->isSaveCommand() )
389  {
390  // this case handles form workflow actions like the mode/view switching requests,
391  // so saving must not be skipped, even for inputs invalid by business rules
392 
393  $form = $this->buildEditForm();
394  $form->setValuesByPost(); // manipulation and distribution of values
395  $form->checkInput(); // manipulations regular style input propeties
396  }
397 
398  if( $savingAllowed )
399  {
400  $this->persistAuthoringForm($form);
401 
402  return 0; // return 0 = all fine, was saved either forced or validated
403  }
404 
405  return 1; // return 1 = something went wrong, no saving happened
406  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeQuestionSpecificPostData()

assOrderingQuestionGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the question specific values from $_POST and applies them to the data object.

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiQuestionScoringAdjustable.

Definition at line 196 of file class.assOrderingQuestionGUI.php.

References $_POST.

Referenced by persistAuthoringForm().

197  {
198  $this->object->setThumbGeometry( $_POST["thumb_geometry"] );
199  $this->object->setElementHeight( $_POST["element_height"] );
200  //$this->object->setOrderingType( $_POST["ordering_type"] );
201  $this->object->setPoints($_POST["points"]);
202  }
$_POST["username"]
+ Here is the caller graph for this function:

Field Documentation

◆ $clearAnswersOnWritingPostDataEnabled

assOrderingQuestionGUI::$clearAnswersOnWritingPostDataEnabled
private

◆ $leveled_ordering

assOrderingQuestionGUI::$leveled_ordering = array()

Definition at line 31 of file class.assOrderingQuestionGUI.php.

◆ $object

assOrderingQuestionGUI::$object

Definition at line 28 of file class.assOrderingQuestionGUI.php.

◆ $old_ordering_depth

assOrderingQuestionGUI::$old_ordering_depth = array()

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

Referenced by getOldLeveledOrdering().


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