ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
assQuestionGUI Class Reference

Basic GUI class for assessment questions. More...

+ Inheritance diagram for assQuestionGUI:
+ Collaboration diagram for assQuestionGUI:

Public Member Functions

 __construct ()
 assQuestionGUI constructor More...
 
executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui (ilTestPlayerAbstractGUI $linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 assessment ()
 output assessment More...
 
_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...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 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...
 
 getSelfAssessmentTags ()
 Get tags allowed in question tags in self assessment mode. 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...
 
 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 ()
 
 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 ()
 
 showHints ()
 

Static Public Member Functions

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...
 

Data Fields

const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 

Protected Member Functions

 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 writeQuestionGenericPostData ()
 

Private Attributes

 $taxonomyIds = array()
 
 $targetGuiClass = null
 

Detailed Description

Basic GUI class for assessment questions.

The assQuestionGUI class encapsulates basic GUI functions for assessment questions.

assQuestionGUI: ilAssQuestionPageGUI

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
Version
$Id$

Definition at line 19 of file class.assQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assQuestionGUI::__construct ( )

assQuestionGUI constructor

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

References $ilCtrl, $lng, and $tpl.

55  {
56  global $lng, $tpl, $ilCtrl;
57 
58 
59  $this->lng =& $lng;
60  $this->tpl =& $tpl;
61  $this->ctrl =& $ilCtrl;
62  $this->ctrl->saveParameter($this, "q_id");
63  $this->ctrl->saveParameter($this, "prev_qid");
64  $this->ctrl->saveParameter($this, "calling_test");
65  $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'test_express_mode');
66  $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'test_express_mode');
67 
68  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
69  $this->errormessage = $this->lng->txt("fill_out_all_required_fields");
70 
71  $this->selfassessmenteditingmode = false;
72  $this->new_id_listeners = array();
73  $this->new_id_listener_cnt = 0;
74  }
global $ilCtrl
Definition: ilias.php:18

Member Function Documentation

◆ _getClassNameForQType()

assQuestionGUI::_getClassNameForQType (   $q_type)
Deprecated:

Definition at line 266 of file class.assQuestionGUI.php.

Referenced by _getGUIClassNameForId().

267  {
268  return $q_type . "GUI";
269  }
+ Here is the caller graph for this function:

◆ _getGUIClassNameForId()

assQuestionGUI::_getGUIClassNameForId (   $a_q_id)
Deprecated:

Definition at line 254 of file class.assQuestionGUI.php.

References _getClassNameForQType(), and assQuestion\getQuestionTypeFromDb().

Referenced by ilQuestionBrowserTableGUI\fillRow().

255  {
256  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
257  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
258  $q_type = assQuestion::getQuestionTypeFromDb($a_q_id);
259  $class_name = assQuestionGUI::_getClassNameForQType($q_type);
260  return $class_name;
261  }
getQuestionTypeFromDb($question_id)
get question type for question id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getQuestionGUI()

& assQuestionGUI::_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.

Parameters
string$question_typeThe question type as it is used in the language database
integer$question_idThe database ID of an existing question to load it into assQuestionGUI
Returns
assQuestionGUI The alias to the question object

Definition at line 222 of file class.assQuestionGUI.php.

References $ilCtrl, $lng, assQuestion\_includeClass(), assQuestion\getFeedbackClassNameByQuestionType(), assQuestion\getGuiClassNameByQuestionType(), and assQuestion\getQuestionTypeFromDb().

Referenced by ilObjQuestionPoolGUI\addLocatorItems(), ilTestExpressPageObjectGUI\addPageOfQuestions(), ilObjQuestionPoolGUI\createQuestionForTestObject(), createQuestionGUI(), ilObjQuestionPoolGUI\createQuestionObject(), ilPCQuestionGUI\edit(), ilObjQuestionPoolGUI\editQuestionForTestObject(), ilObjQuestionPoolGUI\executeCommand(), ilTestExpressPageObjectGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilQuestionEditGUI\executeCommand(), ilPageObjectGUI\executeCommand(), ilSCORM2004Asset\exportHTMLPageObjects(), ilQuestionExporter\exportQuestion(), ilSCORM2004PageGUI\getQuestionHtmlOfPage(), ilTestExpressPageObjectGUI\handleToolbarCommand(), and ilObjQuestionPoolGUI\setTitleAndDescription().

223  {
224  global $ilCtrl, $ilDB, $lng;
225 
226  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
227 
228  if ((!$question_type) and ($question_id > 0))
229  {
230  $question_type = assQuestion::getQuestionTypeFromDb($question_id);
231  }
232 
233  if (strlen($question_type) == 0) return NULL;
234 
235  assQuestion::_includeClass($question_type, 1);
236 
237  $question_type_gui = assQuestion::getGuiClassNameByQuestionType($question_type);
238  $question =& new $question_type_gui();
239 
240  $feedbackObjectClassname = assQuestion::getFeedbackClassNameByQuestionType($question_type);
241  $question->object->feedbackOBJ = new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
242 
243  if ($question_id > 0)
244  {
245  $question->object->loadFromDb($question_id);
246  }
247 
248  return $question;
249  }
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
global $ilCtrl
Definition: ilias.php:18
getQuestionTypeFromDb($question_id)
get question type for question id
static getGuiClassNameByQuestionType($questionType)
static getFeedbackClassNameByQuestionType($questionType)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addBasicQuestionFormProperties()

assQuestionGUI::addBasicQuestionFormProperties (   $form)

Add basic question form properties: assessment: title, author, description, question, working time.

Returns
int Default Nr of Tries

Definition at line 894 of file class.assQuestionGUI.php.

References ilObjAdvancedEditing\_getUsedHTMLTags(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT, ilUtil\prepareFormOutput(), ilDurationInputGUI\setShowHours(), ilTextInputGUI\setValue(), ilNumberInputGUI\setValue(), and ilTextAreaInputGUI\setValue().

Referenced by assTextSubsetGUI\editQuestion(), assTextQuestionGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assMultipleChoiceGUI\editQuestion(), assFileUploadGUI\editQuestion(), assNumericGUI\editQuestion(), assErrorTextGUI\editQuestion(), assJavaAppletGUI\editQuestion(), assFlashQuestionGUI\editQuestion(), assImagemapQuestionGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assOrderingQuestionGUI\editQuestion(), and assFormulaQuestionGUI\isSaveCommand().

895  {
896  // title
897  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
898  $title->setValue($this->object->getTitle());
899  $title->setRequired(TRUE);
900  $form->addItem($title);
901 
902  if (!$this->object->getSelfAssessmentEditingMode())
903  {
904  // author
905  $author = new ilTextInputGUI($this->lng->txt("author"), "author");
906  $author->setValue($this->object->getAuthor());
907  $author->setRequired(TRUE);
908  $form->addItem($author);
909 
910  // description
911  $description = new ilTextInputGUI($this->lng->txt("description"), "comment");
912  $description->setValue($this->object->getComment());
913  $description->setRequired(FALSE);
914  $form->addItem($description);
915  }
916  else
917  {
918  // author as hidden field
919  $hi = new ilHiddenInputGUI("author");
920  $author = ilUtil::prepareFormOutput($this->object->getAuthor());
921  if (trim($author) == "")
922  {
923  $author = "-";
924  }
925  $hi->setValue($author);
926  $form->addItem($hi);
927 
928  }
929 
930  // questiontext
931  $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
932  $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
933  $question->setRequired(TRUE);
934  $question->setRows(10);
935  $question->setCols(80);
936  if (!$this->object->getSelfAssessmentEditingMode())
937  {
938  if( $this->object->getAdditionalContentEditingMode() != assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT )
939  {
940  $question->setUseRte(TRUE);
941  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
942  $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
943  $question->addPlugin("latex");
944  $question->addButton("latex");
945  $question->addButton("pastelatex");
946  $question->setRTESupport($this->object->getId(), "qpl", "assessment");
947  }
948  }
949  else
950  {
951  $question->setRteTags(self::getSelfAssessmentTags());
952  $question->setUseTagsForRteOnly(false);
953  }
954  $form->addItem($question);
955 
956  if (!$this->object->getSelfAssessmentEditingMode())
957  {
958  // duration
959  $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated");
960  $duration->setShowHours(TRUE);
961  $duration->setShowMinutes(TRUE);
962  $duration->setShowSeconds(TRUE);
963  $ewt = $this->object->getEstimatedWorkingTime();
964  $duration->setHours($ewt["h"]);
965  $duration->setMinutes($ewt["m"]);
966  $duration->setSeconds($ewt["s"]);
967  $duration->setRequired(FALSE);
968  $form->addItem($duration);
969  }
970  else
971  {
972  // number of tries
973  if (strlen($this->object->getNrOfTries()))
974  {
975  $nr_tries = $this->object->getNrOfTries();
976  }
977  else
978  {
979  $nr_tries = $this->object->getDefaultNrOfTries();
980  }
981  /*if ($nr_tries <= 0)
982  {
983  $nr_tries = 1;
984  }*/
985 
986  if ($nr_tries < 0)
987  {
988  $nr_tries = 0;
989  }
990 
991  $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
992  $ni->setValue($nr_tries);
993  //$ni->setMinValue(1);
994  $ni->setMinValue(0);
995  $ni->setSize(5);
996  $ni->setMaxLength(5);
997  $ni->setRequired(true);
998  $form->addItem($ni);
999  }
1000  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents a duration (typical hh:mm:ss) property in a property form.
setValue($a_value)
Set Value.
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
setShowHours($a_showhours)
Set Show Hours.
setValue($a_value)
Set Value.
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
This class represents a text property in a property form.
& _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
This class represents a text area property in a property form.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addErrorMessage()

assQuestionGUI::addErrorMessage (   $errormessage)

Definition at line 802 of file class.assQuestionGUI.php.

References $errormessage.

Referenced by assFormulaQuestionGUI\checkInput(), and assFormulaQuestionGUI\writePostData().

803  {
804  $this->errormessage .= ((strlen($this->errormessage)) ? "<br />" : "") . $errormessage;
805  }
+ Here is the caller graph for this function:

◆ addGIT()

assQuestionGUI::addGIT ( )

Definition at line 1636 of file class.assQuestionGUI.php.

References $_GET, and ilUtil\sendSuccess().

1637  {
1638  $subquestion_index = 0;
1639  if (strlen($_GET["subquestion_index"]) && $_GET["subquestion_index"] >= 0)
1640  {
1641  $subquestion_index = $_GET["subquestion_index"];
1642  }
1643  $this->object->saveSuggestedSolution("git", "il__git_" . $_GET["git"], $subquestion_index);
1644  ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
1645  $this->ctrl->redirect($this, "suggestedsolution");
1646  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
+ Here is the call graph for this function:

◆ addNewIdListener()

assQuestionGUI::addNewIdListener ( $a_object,
  $a_method,
  $a_parameters = "" 
)

Add a listener that is notified with the new question ID, when a new question is saved.

Definition at line 846 of file class.assQuestionGUI.php.

847  {
848  $cnt = $this->new_id_listener_cnt;
849  $this->new_id_listeners[$cnt]["object"] =& $a_object;
850  $this->new_id_listeners[$cnt]["method"] = $a_method;
851  $this->new_id_listeners[$cnt]["parameters"] = $a_parameters;
852  $this->new_id_listener_cnt++;
853  }

◆ addPG()

assQuestionGUI::addPG ( )

Definition at line 1612 of file class.assQuestionGUI.php.

References $_GET, and ilUtil\sendSuccess().

1613  {
1614  $subquestion_index = 0;
1615  if (strlen($_GET["subquestion_index"]) && $_GET["subquestion_index"] >= 0)
1616  {
1617  $subquestion_index = $_GET["subquestion_index"];
1618  }
1619  $this->object->saveSuggestedSolution("pg", "il__pg_" . $_GET["pg"], $subquestion_index);
1620  ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
1621  $this->ctrl->redirect($this, "suggestedsolution");
1622  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
+ Here is the call graph for this function:

◆ addQuestionFormCommandButtons()

assQuestionGUI::addQuestionFormCommandButtons (   $form)

Add the command buttons of a question properties form.

Definition at line 878 of file class.assQuestionGUI.php.

Referenced by assTextSubsetGUI\editQuestion(), assTextQuestionGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assMultipleChoiceGUI\editQuestion(), assFileUploadGUI\editQuestion(), assNumericGUI\editQuestion(), assErrorTextGUI\editQuestion(), assJavaAppletGUI\editQuestion(), assFlashQuestionGUI\editQuestion(), assImagemapQuestionGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assClozeTestGUI\editQuestion(), and assOrderingQuestionGUI\editQuestion().

879  {
880  //if (!$this->object->getSelfAssessmentEditingMode() && !$_GET["calling_test"]) $form->addCommandButton("saveEdit", $this->lng->txt("save_edit"));
881  if(!$this->object->getSelfAssessmentEditingMode())
882  {
883  $form->addCommandButton("saveReturn", $this->lng->txt("save_return"));
884  }
885  $form->addCommandButton("save", $this->lng->txt("save"));
886  }
+ Here is the caller graph for this function:

◆ addST()

assQuestionGUI::addST ( )

Definition at line 1624 of file class.assQuestionGUI.php.

References $_GET, and ilUtil\sendSuccess().

1625  {
1626  $subquestion_index = 0;
1627  if (strlen($_GET["subquestion_index"]) && $_GET["subquestion_index"] >= 0)
1628  {
1629  $subquestion_index = $_GET["subquestion_index"];
1630  }
1631  $this->object->saveSuggestedSolution("st", "il__st_" . $_GET["st"], $subquestion_index);
1632  ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
1633  $this->ctrl->redirect($this, "suggestedsolution");
1634  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
+ Here is the call graph for this function:

◆ addTab_QuestionFeedback()

assQuestionGUI::addTab_QuestionFeedback ( ilTabsGUI  $tabs)
protected

adds the feedback tab to ilTabsGUI

ilCtrl $ilCtrl

Parameters
ilTabsGUI$tabs

Definition at line 1693 of file class.assQuestionGUI.php.

References $ilCtrl, ilTabsGUI\addTarget(), and ilAssQuestionFeedbackEditingGUI\CMD_SHOW.

Referenced by assNumericGUI\getTestOutput(), assFormulaQuestionGUI\setQuestionTabs(), assTextSubsetGUI\setQuestionTabs(), assOrderingHorizontalGUI\setQuestionTabs(), assFileUploadGUI\setQuestionTabs(), assErrorTextGUI\setQuestionTabs(), assTextQuestionGUI\setQuestionTabs(), assFlashQuestionGUI\setQuestionTabs(), assSingleChoiceGUI\setQuestionTabs(), assMultipleChoiceGUI\setQuestionTabs(), assJavaAppletGUI\setQuestionTabs(), assImagemapQuestionGUI\setQuestionTabs(), assClozeTestGUI\setQuestionTabs(), assMatchingQuestionGUI\setQuestionTabs(), and assOrderingQuestionGUI\setQuestionTabs().

1694  {
1695  global $ilCtrl;
1696 
1697  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1698  $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionFeedbackEditingGUI');
1699 
1700  $tabLink = $ilCtrl->getLinkTargetByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
1701 
1702  $tabs->addTarget('feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), '');
1703  }
addTarget($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTab_QuestionHints()

assQuestionGUI::addTab_QuestionHints ( ilTabsGUI  $tabs)
protected

adds the hints tab to ilTabsGUI

ilCtrl $ilCtrl

Parameters
ilTabsGUI$tabs

Definition at line 1724 of file class.assQuestionGUI.php.

References $ilCtrl, $pass, ilTabsGUI\addTarget(), ilAssQuestionHintsGUI\CMD_SHOW_LIST, and getSolutionOutput().

Referenced by assNumericGUI\getTestOutput(), assFormulaQuestionGUI\setQuestionTabs(), assTextSubsetGUI\setQuestionTabs(), assOrderingHorizontalGUI\setQuestionTabs(), assFileUploadGUI\setQuestionTabs(), assErrorTextGUI\setQuestionTabs(), assTextQuestionGUI\setQuestionTabs(), assFlashQuestionGUI\setQuestionTabs(), assSingleChoiceGUI\setQuestionTabs(), assMultipleChoiceGUI\setQuestionTabs(), assJavaAppletGUI\setQuestionTabs(), assImagemapQuestionGUI\setQuestionTabs(), assClozeTestGUI\setQuestionTabs(), assMatchingQuestionGUI\setQuestionTabs(), and assOrderingQuestionGUI\setQuestionTabs().

1725  {
1726  global $ilCtrl;
1727 
1728  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
1729 
1730  switch( $ilCtrl->getCmdClass() )
1731  {
1732  case 'ilassquestionhintsgui':
1733 
1734  $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionHintsGUI');
1735  break;
1736 
1737  case 'ilassquestionhintgui':
1738 
1739  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
1740  $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionHintGUI');
1741  break;
1742 
1743  default:
1744 
1745  $tabCommands = array();
1746  }
1747 
1748  $tabLink = $ilCtrl->getLinkTargetByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
1749 
1750  $tabs->addTarget('tst_question_hints_tab', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), '');
1751  }
addTarget($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
const CMD_SHOW_LIST
command constants
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply()

assQuestionGUI::apply ( )

apply changes

Definition at line 738 of file class.assQuestionGUI.php.

References writePostData().

739  {
740  $this->writePostData();
741  $this->object->saveToDb();
742  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
743  $this->editQuestion();
744  }
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
+ Here is the call graph for this function:

◆ assessment()

assQuestionGUI::assessment ( )

output assessment

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

References $_GET, and $ref_id.

147  {
148  $this->tpl->addBlockFile("CONTENT", "content", "tpl.il_as_qpl_content.html", "Modules/TestQuestionPool");
149  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
150 
151  $total_of_answers = $this->object->getTotalAnswers();
152  $counter = 0;
153  $color_class = array("tblrow1", "tblrow2");
154  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_qpl_assessment_of_questions.html", "Modules/TestQuestionPool");
155  if (!$total_of_answers)
156  {
157  $this->tpl->setCurrentBlock("emptyrow");
158  $this->tpl->setVariable("TXT_NO_ASSESSMENT", $this->lng->txt("qpl_assessment_no_assessment_of_questions"));
159  $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
160  $this->tpl->parseCurrentBlock();
161  }
162  else
163  {
164  $this->tpl->setCurrentBlock("row");
165  $this->tpl->setVariable("TXT_RESULT", $this->lng->txt("qpl_assessment_total_of_answers"));
166  $this->tpl->setVariable("TXT_VALUE", $total_of_answers);
167  $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
168  $counter++;
169  $this->tpl->parseCurrentBlock();
170  $this->tpl->setCurrentBlock("row");
171  $this->tpl->setVariable("TXT_RESULT", $this->lng->txt("qpl_assessment_total_of_right_answers"));
172  $this->tpl->setVariable("TXT_VALUE", sprintf("%2.2f", $this->object->_getTotalRightAnswers($_GET["q_id"]) * 100.0) . " %");
173  $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
174  $this->tpl->parseCurrentBlock();
175  }
176 
177  $instances =& $this->object->getInstances();
178  $counter = 0;
179  foreach ($instances as $instance)
180  {
181  if (is_array($instance["refs"]))
182  {
183  foreach ($instance["refs"] as $ref_id)
184  {
185  $this->tpl->setCurrentBlock("references");
186  $this->tpl->setVariable("GOTO", "./goto.php?target=tst_" . $ref_id);
187  $this->tpl->setVariable("TEXT_GOTO", $this->lng->txt("perma_link"));
188  $this->tpl->parseCurrentBlock();
189  }
190  }
191  $this->tpl->setCurrentBlock("instance_row");
192  $this->tpl->setVariable("TEST_TITLE", $instance["title"]);
193  $this->tpl->setVariable("TEST_AUTHOR", $instance["author"]);
194  $this->tpl->setVariable("QUESTION_ID", $instance["question_id"]);
195  $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
196  $counter++;
197  $this->tpl->parseCurrentBlock();
198  }
199  $this->tpl->setCurrentBlock("instances");
200  $this->tpl->setVariable("TEXT_TEST_TITLE", $this->lng->txt("title"));
201  $this->tpl->setVariable("TEXT_TEST_AUTHOR", $this->lng->txt("author"));
202  $this->tpl->setVariable("TEXT_TEST_LOCATION", $this->lng->txt("location"));
203  $this->tpl->setVariable("INSTANCES_TITLE", $this->lng->txt("question_instances_title"));
204  $this->tpl->parseCurrentBlock();
205 
206  $this->tpl->setCurrentBlock("adm_content");
207  $this->tpl->setVariable("TXT_QUESTION_TITLE", $this->lng->txt("question_cumulated_statistics"));
208  $this->tpl->setVariable("TXT_RESULT", $this->lng->txt("result"));
209  $this->tpl->setVariable("TXT_VALUE", $this->lng->txt("value"));
210  $this->tpl->parseCurrentBlock();
211  }
$_GET["client_id"]
$ref_id
Definition: sahs_server.php:39

◆ callNewIdListeners()

assQuestionGUI::callNewIdListeners (   $a_new_id)

Call the new id listeners.

Definition at line 858 of file class.assQuestionGUI.php.

Referenced by save(), saveReturn(), and assFormulaQuestionGUI\saveReturnFQ().

859  {
860 
861  for ($i=0; $i<$this->new_id_listener_cnt; $i++)
862  {
863  $this->new_id_listeners[$i]["parameters"]["new_id"] = $a_new_id;
864  $object =& $this->new_id_listeners[$i]["object"];
865  $method = $this->new_id_listeners[$i]["method"];
866  $parameters = $this->new_id_listeners[$i]["parameters"];
867 //var_dump($object);
868 //var_dump($method);
869 //var_dump($parameters);
870 
871  $object->$method($parameters);
872  }
873  }
+ Here is the caller graph for this function:

◆ cancel()

assQuestionGUI::cancel ( )

cancel action

Definition at line 386 of file class.assQuestionGUI.php.

References $_GET, and ilUtil\redirect().

387  {
388  if ($_GET["calling_test"])
389  {
390  $_GET["ref_id"] = $_GET["calling_test"];
391  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=".$_GET["calling_test"]);
392  }
393  elseif ($_GET["test_ref_id"])
394  {
395  $_GET["ref_id"] = $_GET["test_ref_id"];
396  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=".$_GET["test_ref_id"]);
397  }
398  else
399  {
400  if ($_GET["q_id"] > 0)
401  {
402  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
403  $this->ctrl->redirectByClass("ilAssQuestionPageGUI", "edit");
404  }
405  else
406  {
407  $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
408  }
409  }
410  }
$_GET["client_id"]
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ cancelExplorer()

assQuestionGUI::cancelExplorer ( )

Definition at line 1459 of file class.assQuestionGUI.php.

1460  {
1461  $this->ctrl->redirect($this, "suggestedsolution");
1462  }

◆ cancelSync()

assQuestionGUI::cancelSync ( )

Definition at line 460 of file class.assQuestionGUI.php.

References $_GET, $_REQUEST, and ilUtil\redirect().

461  {
462  if (strlen($_GET["return_to"]))
463  {
464  $this->ctrl->redirect($this, $_GET["return_to"]);
465  }
466  if(strlen($_REQUEST['return_to_fb']))
467  {
468  $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', 'show');
469  }
470  else
471  {
472  $_GET["ref_id"] = $_GET["calling_test"];
473  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=".$_GET["calling_test"]);
474  }
475  }
$_GET["client_id"]
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ createQuestionGUI()

& assQuestionGUI::createQuestionGUI (   $question_type,
  $question_id = -1 
)

Creates a question gui representation.

Creates a question gui representation and returns the alias to the question gui

Parameters
string$question_typeThe question type as it is used in the language database
integer$question_idThe database ID of an existing question to load it into assQuestionGUI
Returns
object The alias to the question object public
Deprecated:
: WTF is this? GUIobject::question should be a GUIobject !? WTF is a question alias !?

Definition at line 283 of file class.assQuestionGUI.php.

References _getQuestionGUI().

284  {
285  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
286  $this->question =& assQuestionGUI::_getQuestionGUI($question_type, $question_id);
287  }
& _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
+ Here is the call graph for this function:

◆ executeCommand()

& assQuestionGUI::executeCommand ( )

execute command

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

References $cmd, $ret, and getCommand().

80  {
81  $cmd = $this->ctrl->getCmd("editQuestion");
82  $next_class = $this->ctrl->getNextClass($this);
83 
84  $cmd = $this->getCommand($cmd);
85 
86  switch($next_class)
87  {
88  default:
89  $ret =& $this->$cmd();
90  break;
91  }
92  return $ret;
93  }
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ getAnswerFeedbackOutput()

assQuestionGUI::getAnswerFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer generic feedback depending on the results of the question.

Deprecated:
Use getGenericFeedbackOutput instead.
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback public

Definition at line 1077 of file class.assQuestionGUI.php.

References $pass, and getGenericFeedbackOutput().

Referenced by assTextSubsetGUI\getSolutionOutput(), assSingleChoiceGUI\getSolutionOutput(), assMultipleChoiceGUI\getSolutionOutput(), assFileUploadGUI\getSolutionOutput(), assJavaAppletGUI\getSolutionOutput(), assImagemapQuestionGUI\getSolutionOutput(), and assOrderingQuestionGUI\getSolutionOutput().

1078  {
1079  return $this->getGenericFeedbackOutput($active_id, $pass);
1080  }
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAsValueAttribute()

assQuestionGUI::getAsValueAttribute (   $a_value)

Returns a HTML value attribute.

Parameters
mixed$a_valueA given text or value
Returns
string The value as HTML value attribute public

Definition at line 831 of file class.assQuestionGUI.php.

References $result.

832  {
833  $result = "";
834  if (strlen($a_value))
835  {
836  $result = " value=\"$a_value\" ";
837  }
838  return $result;
839  }
$result

◆ getCommand()

assQuestionGUI::getCommand (   $cmd)

Definition at line 95 of file class.assQuestionGUI.php.

References $cmd.

Referenced by executeCommand().

96  {
97  return $cmd;
98  }
$cmd
Definition: sahs_server.php:35
+ Here is the caller graph for this function:

◆ getCommandsFromClassConstants()

static assQuestionGUI::getCommandsFromClassConstants (   $guiClassName,
  $cmdConstantNameBegin = 'CMD_' 
)
static

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

Parameters
string$guiClassName
string$cmdConstantNameBegin
Returns
array

Definition at line 1661 of file class.assQuestionGUI.php.

Referenced by ilPCQuestionGUI\setTabs().

1662  {
1663  $reflectionClass = new ReflectionClass($guiClassName);
1664 
1665  $commands = null;
1666 
1667  if( $reflectionClass instanceof ReflectionClass )
1668  {
1669  $commands = array();
1670 
1671  foreach($reflectionClass->getConstants() as $constName => $constValue)
1672  {
1673  if( substr($constName, 0, strlen($cmdConstantNameBegin)) == $cmdConstantNameBegin )
1674  {
1675  $commands[] = $constValue;
1676  }
1677  }
1678  }
1679 
1680  return $commands;
1681  }
+ Here is the caller graph for this function:

◆ getContextPath()

assQuestionGUI::getContextPath (   $cont_obj,
  $a_endnode_id,
  $a_startnode_id = 1 
)

get context path in content object tree

Parameters
int$a_endnode_idid of endnode
int$a_startnode_idid of startnode

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

References $path.

Referenced by outPageSelector().

753  {
754  $path = "";
755 
756  $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
757 
758  // count -1, to exclude the learning module itself
759  for ($i = 1; $i < (count($tmpPath) - 1); $i++)
760  {
761  if ($path != "")
762  {
763  $path .= " > ";
764  }
765 
766  $path .= $tmpPath[$i]["title"];
767  }
768 
769  return $path;
770  }
$path
Definition: index.php:22
+ Here is the caller graph for this function:

◆ getErrorMessage()

assQuestionGUI::getErrorMessage ( )

Definition at line 792 of file class.assQuestionGUI.php.

References $errormessage.

Referenced by assTextQuestionGUI\addSuggestedSolution(), assFlashQuestionGUI\suggestRange(), and assFormulaQuestionGUI\suggestRange().

793  {
794  return $this->errormessage;
795  }
+ Here is the caller graph for this function:

◆ getGenericFeedbackOutput()

assQuestionGUI::getGenericFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer specific feedback for the question.

Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback public

Definition at line 1091 of file class.assQuestionGUI.php.

References $pass, ilObjTest\getManualFeedback(), and getSpecificFeedbackOutput().

Referenced by getAnswerFeedbackOutput(), assOrderingHorizontalGUI\getSolutionOutput(), assTextQuestionGUI\getSolutionOutput(), assNumericGUI\getSolutionOutput(), assErrorTextGUI\getSolutionOutput(), assMatchingQuestionGUI\getSolutionOutput(), assOrderingQuestionGUI\getSolutionOutput(), and assClozeTestGUI\getSolutionOutput().

1092  {
1093  $output = "";
1094  include_once "./Modules/Test/classes/class.ilObjTest.php";
1095  $manual_feedback = ilObjTest::getManualFeedback($active_id, $this->object->getId(), $pass);
1096  if (strlen($manual_feedback))
1097  {
1098  return $manual_feedback;
1099  }
1100  $correct_feedback = $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), true);
1101  $incorrect_feedback = $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), false);
1102  if (strlen($correct_feedback.$incorrect_feedback))
1103  {
1104  $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
1105  $max_points = $this->object->getMaximumPoints();
1106  if ($reached_points == $max_points)
1107  {
1108  $output = $correct_feedback;
1109  }
1110  else
1111  {
1112  $output = $incorrect_feedback;
1113  }
1114  }
1115  return $this->object->prepareTextareaOutput($output, TRUE);
1116  }
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the manual feedback for a question in a test.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getILIASPage()

assQuestionGUI::getILIASPage (   $html = "")

Returns the ILIAS Page around a question.

Returns
string The ILIAS page content public

Definition at line 305 of file class.assQuestionGUI.php.

References ilPageObjectGUI\setQuestionHTML().

Referenced by assOrderingHorizontalGUI\getPreview(), assTextSubsetGUI\getPreview(), assNumericGUI\getPreview(), assTextQuestionGUI\getPreview(), assFileUploadGUI\getPreview(), assErrorTextGUI\getPreview(), assFlashQuestionGUI\getPreview(), assSingleChoiceGUI\getPreview(), assMultipleChoiceGUI\getPreview(), assJavaAppletGUI\getPreview(), assImagemapQuestionGUI\getPreview(), assMatchingQuestionGUI\getPreview(), assClozeTestGUI\getPreview(), assOrderingQuestionGUI\getPreview(), assFormulaQuestionGUI\getPreview(), assMatchingQuestionGUI\getPreviewJS(), assOrderingQuestionGUI\getSolutionOutput(), assFormulaQuestionGUI\getSolutionOutput(), assOrderingHorizontalGUI\getTestOutput(), assErrorTextGUI\getTestOutput(), and assFileUploadGUI\getTestOutput().

306  {
307  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
308  $page_gui = new ilAssQuestionPageGUI($this->object->getId());
309  $page_gui->setQuestionHTML(array($this->object->getId() => $html));
310  $page_gui->setOutputMode("presentation");
311  $presentation = $page_gui->presentation();
312  $presentation = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $presentation);
313  return $presentation;
314  }
Question page GUI class.
setQuestionHTML($question_html)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionCount()

assQuestionGUI::getQuestionCount ( )

Definition at line 787 of file class.assQuestionGUI.php.

References $question_count.

Referenced by outQuestionPage().

788  {
789  return $this->question_count;
790  }
$question_count
question count in test
+ Here is the caller graph for this function:

◆ getQuestionTemplate()

assQuestionGUI::getQuestionTemplate ( )

get question template

Definition at line 292 of file class.assQuestionGUI.php.

Referenced by assTextQuestionGUI\addSuggestedSolution(), assImagemapQuestionGUI\areaEditor(), assTextSubsetGUI\editQuestion(), assTextQuestionGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assMultipleChoiceGUI\editQuestion(), assFileUploadGUI\editQuestion(), assNumericGUI\editQuestion(), assErrorTextGUI\editQuestion(), assJavaAppletGUI\editQuestion(), assFlashQuestionGUI\editQuestion(), assImagemapQuestionGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assClozeTestGUI\editQuestion(), assOrderingQuestionGUI\editQuestion(), and assFormulaQuestionGUI\isSaveCommand().

293  {
294  $this->tpl->addBlockFile("CONTENT", "content", "tpl.il_as_qpl_content.html", "Modules/TestQuestionPool");
295  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
296  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_question.html", "Modules/TestQuestionPool");
297  }
+ Here is the caller graph for this function:

◆ getQuestionType()

assQuestionGUI::getQuestionType ( )

Returns the question type string.

Returns the question type string

Returns
string The question type string public

Definition at line 819 of file class.assQuestionGUI.php.

Referenced by ilScoringAdjustmentGUI\allowedInAdjustment(), and getType().

820  {
821  return $this->object->getQuestionType();
822  }
+ Here is the caller graph for this function:

◆ getSelfAssessmentTags()

assQuestionGUI::getSelfAssessmentTags ( )

Get tags allowed in question tags in self assessment mode.

Returns
array array of tags

Definition at line 1047 of file class.assQuestionGUI.php.

References ilUtil\getSecureTags().

Referenced by ilPCQuestion\copyPoolQuestionIntoPage().

1048  {
1049  // set tags we allow in self assessment mode
1050  $st = ilUtil::getSecureTags();
1051 
1052  // we allow these tags, since they are typically used in the Tiny Assessment editor
1053  // and should not be deleted, if questions are copied from pools to learning modules
1054  $not_supported = array("img", "p");
1055  $tags = array();
1056  foreach ($st as $s)
1057  {
1058  if (!in_array($s, $not_supported))
1059  {
1060  $tags[] = $s;
1061  }
1062  }
1063 
1064  return $tags;
1065  }
static getSecureTags()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSequenceNumber()

assQuestionGUI::getSequenceNumber ( )

Definition at line 777 of file class.assQuestionGUI.php.

References $sequence_no.

Referenced by outQuestionPage().

778  {
779  return $this->sequence_no;
780  }
$sequence_no
sequence number in test
+ Here is the caller graph for this function:

◆ getSolutionOutput()

assQuestionGUI::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 
)
abstract

Referenced by addTab_QuestionHints(), and suggestedsolution().

+ Here is the caller graph for this function:

◆ getSpecificFeedbackOutput()

assQuestionGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)
abstract

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback public

Referenced by getGenericFeedbackOutput().

+ Here is the caller graph for this function:

◆ getTargetGuiClass()

assQuestionGUI::getTargetGuiClass ( )

Definition at line 128 of file class.assQuestionGUI.php.

References $targetGuiClass.

Referenced by assImagemapQuestionGUI\getTestOutput().

129  {
130  return $this->targetGuiClass;
131  }
+ Here is the caller graph for this function:

◆ getTaxonomyIds()

assQuestionGUI::getTaxonomyIds ( )

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

References $taxonomyIds.

Referenced by populateTaxonomyFormSection(), and saveTaxonomyAssignments().

114  {
115  return $this->taxonomyIds;
116  }
+ Here is the caller graph for this function:

◆ getType()

assQuestionGUI::getType ( )

needed for page editor compliance

Definition at line 103 of file class.assQuestionGUI.php.

References getQuestionType().

104  {
105  return $this->getQuestionType();
106  }
getQuestionType()
Returns the question type string.
+ Here is the call graph for this function:

◆ isAutosaveable()

assQuestionGUI::isAutosaveable ( )

Definition at line 1765 of file class.assQuestionGUI.php.

1766  {
1767  return $this->object->isAutosaveable();
1768  }

◆ isSaveCommand()

◆ linkChilds()

assQuestionGUI::linkChilds ( )

Definition at line 1589 of file class.assQuestionGUI.php.

References $_GET, outChapterSelector(), outGlossarySelector(), outPageSelector(), and ilUtil\sendSuccess().

1590  {
1591  $this->ctrl->saveParameter($this, array("subquestion_index", "link_new_type", "search_link_type"));
1592  switch ($_GET["search_link_type"])
1593  {
1594  case "pg":
1595  return $this->outPageSelector();
1596  break;
1597  case "st":
1598  return $this->outChapterSelector();
1599  break;
1600  case "glo":
1601  return $this->outGlossarySelector();
1602  break;
1603  case "lm":
1604  $subquestion_index = ($_GET["subquestion_index"] > 0) ? $_GET["subquestion_index"] : 0;
1605  $this->object->saveSuggestedSolution("lm", "il__lm_" . $_GET["source_id"], $subquestion_index);
1606  ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
1607  $this->ctrl->redirect($this, "suggestedsolution");
1608  break;
1609  }
1610  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
+ Here is the call graph for this function:

◆ originalSyncForm()

assQuestionGUI::originalSyncForm (   $return_to = "",
  $return_to_feedback = '' 
)
Parameters
string$return_to
string$return_to_feedbackilAssQuestionFeedbackEditingGUI

Definition at line 416 of file class.assQuestionGUI.php.

References $_REQUEST.

Referenced by suggestedsolution().

417  {
418  if (strlen($return_to))
419  {
420  $this->ctrl->setParameter($this, "return_to", $return_to);
421  }
422  else if ($_REQUEST['return_to']) {
423  $this->ctrl->setParameter($this, "return_to", $_REQUEST['return_to']);
424  }
425  if(strlen($return_to_feedback))
426  {
427  $this->ctrl->setParameter($this, 'return_to_fb', 'true');
428  }
429 
430  $template = new ilTemplate("tpl.il_as_qpl_sync_original.html",TRUE, TRUE, "Modules/TestQuestionPool");
431  $template->setVariable("BUTTON_YES", $this->lng->txt("yes"));
432  $template->setVariable("BUTTON_NO", $this->lng->txt("no"));
433  $template->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
434  $template->setVariable("TEXT_SYNC", $this->lng->txt("confirm_sync_questions"));
435  $this->tpl->setVariable("ADM_CONTENT", $template->get());
436  }
special template class to simplify handling of ITX/PEAR
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the caller graph for this function:

◆ outAdditionalOutput()

assQuestionGUI::outAdditionalOutput ( )

Definition at line 807 of file class.assQuestionGUI.php.

808  {
809  }

◆ outChapterSelector()

assQuestionGUI::outChapterSelector ( )

Definition at line 1528 of file class.assQuestionGUI.php.

References $_GET.

Referenced by linkChilds().

1529  {
1530  $template = new ilTemplate("tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE, "Modules/TestQuestionPool");
1531  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
1532  $color_class = array("tblrow1", "tblrow2");
1533  $counter = 0;
1534  include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1535  $cont_obj_gui =& new ilObjContentObjectGUI("", $_GET["source_id"], true);
1536  $cont_obj = $cont_obj_gui->object;
1537  // get all chapters
1538  $ctree =& $cont_obj->getLMTree();
1539  $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
1540  foreach($nodes as $node)
1541  {
1542  if($node["type"] == $_GET["search_link_type"])
1543  {
1544  $template->setCurrentBlock("linktable_row");
1545  $template->setVariable("TEXT_LINK", $node["title"]);
1546  $template->setVariable("TEXT_ADD", $this->lng->txt("add"));
1547  $template->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($node["type"])) . "&" . $node["type"] . "=" . $node["obj_id"]);
1548  $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
1549  $template->parseCurrentBlock();
1550  $counter++;
1551  }
1552  }
1553  $template->setCurrentBlock("link_selection");
1554  $template->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
1555  $template->setVariable("TEXT_LINK_TYPE", $this->lng->txt("obj_" . $_GET["search_link_type"]));
1556  $template->setVariable("FORMACTION",$this->ctrl->getFormAction($this, "cancelExplorer"));
1557  $template->parseCurrentBlock();
1558  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1559  }
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
Class ilObjContentObjectGUI.
+ Here is the caller graph for this function:

◆ outGlossarySelector()

assQuestionGUI::outGlossarySelector ( )

Definition at line 1561 of file class.assQuestionGUI.php.

References $_GET.

Referenced by linkChilds().

1562  {
1563  $template = new ilTemplate("tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE, "Modules/TestQuestionPool");
1564  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
1565  $color_class = array("tblrow1", "tblrow2");
1566  $counter = 0;
1567  include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
1568  $glossary =& new ilObjGlossary($_GET["source_id"], true);
1569  // get all glossary items
1570  $terms = $glossary->getTermList();
1571  foreach($terms as $term)
1572  {
1573  $template->setCurrentBlock("linktable_row");
1574  $template->setVariable("TEXT_LINK", $term["term"]);
1575  $template->setVariable("TEXT_ADD", $this->lng->txt("add"));
1576  $template->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "addGIT") . "&git=" . $term["id"]);
1577  $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
1578  $template->parseCurrentBlock();
1579  $counter++;
1580  }
1581  $template->setCurrentBlock("link_selection");
1582  $template->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
1583  $template->setVariable("TEXT_LINK_TYPE", $this->lng->txt("glossary_term"));
1584  $template->setVariable("FORMACTION",$this->ctrl->getFormAction($this, "cancelExplorer"));
1585  $template->parseCurrentBlock();
1586  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1587  }
$_GET["client_id"]
Class ilObjGlossary.
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ outPageSelector()

assQuestionGUI::outPageSelector ( )

Definition at line 1464 of file class.assQuestionGUI.php.

References $_GET, getContextPath(), ilLMPageObject\getPageList(), and ilUtil\prepareFormOutput().

Referenced by linkChilds().

1465  {
1466  include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
1467  include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1468  $cont_obj_gui =& new ilObjContentObjectGUI("", $_GET["source_id"], true);
1469  $cont_obj = $cont_obj_gui->object;
1470  $pages = ilLMPageObject::getPageList($cont_obj->getId());
1471  $shownpages = array();
1472  $tree = $cont_obj->getLMTree();
1473  $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1474  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
1475  $color_class = array("tblrow1", "tblrow2");
1476  $counter = 0;
1477  $template = new ilTemplate("tpl.il_as_qpl_internallink_selection.html", TRUE, TRUE, "Modules/TestQuestionPool");
1478  foreach ($chapters as $chapter)
1479  {
1480  $chapterpages = $tree->getChildsByType($chapter["obj_id"], "pg");
1481  foreach ($chapterpages as $page)
1482  {
1483  if($page["type"] == $_GET["search_link_type"])
1484  {
1485  array_push($shownpages, $page["obj_id"]);
1486  $template->setCurrentBlock("linktable_row");
1487  $template->setVariable("TEXT_LINK", $page["title"]);
1488  $template->setVariable("TEXT_ADD", $this->lng->txt("add"));
1489  $template->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($page["type"])) . "&" . $page["type"] . "=" . $page["obj_id"]);
1490  $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
1491  if ($tree->isInTree($page["obj_id"]))
1492  {
1493  $path_str = $this->getContextPath($cont_obj, $page["obj_id"]);
1494  }
1495  else
1496  {
1497  $path_str = "---";
1498  }
1499  $template->setVariable("TEXT_DESCRIPTION", ilUtil::prepareFormOutput($path_str));
1500  $template->parseCurrentBlock();
1501  $counter++;
1502  }
1503  }
1504  }
1505  foreach ($pages as $page)
1506  {
1507  if (!in_array($page["obj_id"], $shownpages))
1508  {
1509  $template->setCurrentBlock("linktable_row");
1510  $template->setVariable("TEXT_LINK", $page["title"]);
1511  $template->setVariable("TEXT_ADD", $this->lng->txt("add"));
1512  $template->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($page["type"])) . "&" . $page["type"] . "=" . $page["obj_id"]);
1513  $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
1514  $path_str = "---";
1515  $template->setVariable("TEXT_DESCRIPTION", ilUtil::prepareFormOutput($path_str));
1516  $template->parseCurrentBlock();
1517  $counter++;
1518  }
1519  }
1520  $template->setCurrentBlock("link_selection");
1521  $template->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
1522  $template->setVariable("TEXT_LINK_TYPE", $this->lng->txt("obj_" . $_GET["search_link_type"]));
1523  $template->setVariable("FORMACTION",$this->ctrl->getFormAction($this, "cancelExplorer"));
1524  $template->parseCurrentBlock();
1525  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1526  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
getPageList($lm_id)
static
getContextPath($cont_obj, $a_endnode_id, $a_startnode_id=1)
get context path in content object tree
Class ilObjContentObjectGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outQuestionPage()

assQuestionGUI::outQuestionPage (   $a_temp_var,
  $a_postponed = false,
  $active_id = "",
  $html = "" 
)

output question page

Definition at line 319 of file class.assQuestionGUI.php.

References ilObjTest\_getTitleOutput(), getQuestionCount(), getSequenceNumber(), ilObjTest\isQuestionObligatory(), and ilPageObjectGUI\setTemplateTargetVar().

Referenced by assOrderingHorizontalGUI\getTestOutput(), assTextSubsetGUI\getTestOutput(), assNumericGUI\getTestOutput(), assErrorTextGUI\getTestOutput(), assFileUploadGUI\getTestOutput(), assTextQuestionGUI\getTestOutput(), assFlashQuestionGUI\getTestOutput(), assSingleChoiceGUI\getTestOutput(), assMultipleChoiceGUI\getTestOutput(), assJavaAppletGUI\getTestOutput(), assImagemapQuestionGUI\getTestOutput(), assClozeTestGUI\getTestOutput(), assOrderingQuestionGUI\getTestOutput(), assMatchingQuestionGUI\getTestOutput(), assFormulaQuestionGUI\getTestOutput(), and assMatchingQuestionGUI\getTestOutputJS().

320  {
321  $postponed = "";
322  if ($a_postponed)
323  {
324  $postponed = " (" . $this->lng->txt("postponed") . ")";
325  }
326 
327  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
328  $this->lng->loadLanguageModule("content");
329  $page_gui = new ilAssQuestionPageGUI($this->object->getId());
330  $page_gui->setTemplateTargetVar($a_temp_var);
331  if (strlen($html))
332  {
333  $page_gui->setQuestionHTML(array($this->object->getId() => $html));
334  }
335  $page_gui->setOutputMode("presentation");
336 
337  include_once "./Modules/Test/classes/class.ilObjTest.php";
338  $title_output = ilObjTest::_getTitleOutput($active_id);
339 
340  if( $this->object->areObligationsToBeConsidered() && ilObjTest::isQuestionObligatory($this->object->getId()) )
341  {
342  $obligatoryString = '([-_-])';
343  }
344  else
345  {
346  $obligatoryString = '';
347  }
348 
349  switch ($title_output)
350  {
351  case 1:
352  $page_gui->setPresentationTitle(sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount())." - ".$this->object->getTitle().$postponed . $obligatoryString);
353  break;
354  case 2:
355  $page_gui->setPresentationTitle(sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount()).$postponed . $obligatoryString);
356  break;
357  case 0:
358  default:
359  $maxpoints = $this->object->getMaximumPoints();
360  if ($maxpoints == 1)
361  {
362  $maxpoints = " (".$maxpoints." ".$this->lng->txt("point").")";
363  }
364  else
365  {
366  $maxpoints = " (".$maxpoints." ".$this->lng->txt("points").")";
367  }
368  $page_gui->setPresentationTitle(sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount())." - ".$this->object->getTitle().$postponed.$maxpoints . $obligatoryString);
369  break;
370  }
371  $presentation = $page_gui->presentation();
372  if (strlen($maxpoints)) $presentation = str_replace($maxpoints, "<em>$maxpoints</em>", $presentation);
373  if (strlen($obligatoryString))
374  {
375  $replacement ='<br><span class="obligatory" style="font-size:small">'.
376  $this->lng->txt("tst_you_have_to_answer_this_question").'</span>';
377  $presentation = str_replace($obligatoryString, $replacement, $presentation);
378  }
379  $presentation = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $presentation);
380  return $presentation;
381  }
_getTitleOutput($active_id)
Returns the value of the title_output status.
Question page GUI class.
setTemplateTargetVar($a_variable)
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outQuestionType()

assQuestionGUI::outQuestionType ( )

Definition at line 1131 of file class.assQuestionGUI.php.

References $_GET, assQuestion\_getQuestionTypeName(), assQuestion\_questionExistsInPool(), and ilUtil\getImagePath().

Referenced by assTextSubsetGUI\editQuestion(), assTextQuestionGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assMultipleChoiceGUI\editQuestion(), assFileUploadGUI\editQuestion(), assNumericGUI\editQuestion(), assErrorTextGUI\editQuestion(), assJavaAppletGUI\editQuestion(), assFlashQuestionGUI\editQuestion(), assImagemapQuestionGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assClozeTestGUI\editQuestion(), assOrderingQuestionGUI\editQuestion(), and assFormulaQuestionGUI\isSaveCommand().

1132  {
1133  include_once "./Services/UICore/classes/class.ilTemplate.php";
1134  $template = new ilTemplate("tpl.il_as_qpl_questiontype.html", TRUE, TRUE, "Modules/TestQuestionPool");
1135  $count = $this->object->isInUse();
1136  if (assQuestion::_questionExistsInPool($this->object->getId()) && $count)
1137  {
1138  global $rbacsystem;
1139  if ($rbacsystem->checkAccess("write", $_GET["ref_id"]))
1140  {
1141  $template->setCurrentBlock("infosign");
1142  $template->setVariable("INFO_IMG_SRC", ilUtil::getImagePath("messagebox_tip.png"));
1143  $template->setVariable("INFO_IMG_ALT", sprintf($this->lng->txt("qpl_question_is_in_use"), $count));
1144  $template->setVariable("INFO_IMG_TITLE", sprintf($this->lng->txt("qpl_question_is_in_use"), $count));
1145  $template->parseCurrentBlock();
1146  }
1147  }
1148  $template->setVariable("TEXT_QUESTION_TYPE", assQuestion::_getQuestionTypeName($this->object->getQuestionType()));
1149  return $template->get();
1150  }
_questionExistsInPool($question_id)
Returns true if the question already exists in the database and is assigned to a question pool...
$_GET["client_id"]
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outSolutionExplorer()

assQuestionGUI::outSolutionExplorer ( )

Definition at line 1383 of file class.assQuestionGUI.php.

References $_GET, ilUtil\sendInfo(), and ilExplorer\setExpand().

1384  {
1385  global $tree;
1386 
1387  include_once("./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1388  $type = $_GET["link_new_type"];
1389  $search = $_GET["search_link_type"];
1390  $this->ctrl->setParameter($this, "link_new_type", $type);
1391  $this->ctrl->setParameter($this, "search_link_type", $search);
1392  $this->ctrl->saveParameter($this, array("subquestion_index", "link_new_type", "search_link_type"));
1393 
1394  ilUtil::sendInfo($this->lng->txt("select_object_to_link"));
1395 
1396  $parent_ref_id = $tree->getParentId($_GET["ref_id"]);
1397  $exp = new ilSolutionExplorer($this->ctrl->getLinkTarget($this, 'suggestedsolution'), get_class($this));
1398  $exp->setExpand($_GET['expand_sol'] ? $_GET['expand_sol'] : $parent_ref_id);
1399  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'outSolutionExplorer'));
1400  $exp->setTargetGet("ref_id");
1401  $exp->setRefId($_GET["ref_id"]);
1402  $exp->addFilter($type);
1403  $exp->setSelectableType($type);
1404  if(isset($_GET['expandCurrentPath']) && $_GET['expandCurrentPath'])
1405  {
1406  $exp->expandPathByRefId($parent_ref_id);
1407  }
1408 
1409  // build html-output
1410  $exp->setOutput(0);
1411 
1412  $template = new ilTemplate("tpl.il_as_qpl_explorer.html", TRUE, TRUE, "Modules/TestQuestionPool");
1413  $template->setVariable("EXPLORER_TREE",$exp->getOutput());
1414  $template->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
1415  $template->setVariable("FORMACTION",$this->ctrl->getFormAction($this, "suggestedsolution"));
1416  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1417  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
special template class to simplify handling of ITX/PEAR
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
+ Here is the call graph for this function:

◆ populateTaxonomyFormSection()

assQuestionGUI::populateTaxonomyFormSection ( ilPropertyFormGUI  $form)
protected

Definition at line 1019 of file class.assQuestionGUI.php.

References ilPropertyFormGUI\addItem(), getTaxonomyIds(), and ilTaxAssignInputGUI\setCurrentValues().

Referenced by assTextSubsetGUI\editQuestion(), assTextQuestionGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assMultipleChoiceGUI\editQuestion(), assFileUploadGUI\editQuestion(), assNumericGUI\editQuestion(), assErrorTextGUI\editQuestion(), assJavaAppletGUI\editQuestion(), assFlashQuestionGUI\editQuestion(), assImagemapQuestionGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assClozeTestGUI\editQuestion(), assOrderingQuestionGUI\editQuestion(), and assFormulaQuestionGUI\isSaveCommand().

1020  {
1021  if( count($this->getTaxonomyIds()) )
1022  {
1023  $sectHeader = new ilFormSectionHeaderGUI();
1024  $sectHeader->setTitle($this->lng->txt('qpl_qst_edit_form_taxonomy_section'));
1025  $form->addItem($sectHeader);
1026 
1027  require_once 'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php';
1028 
1029  foreach($this->getTaxonomyIds() as $taxonomyId)
1030  {
1031  $taxonomy = new ilObjTaxonomy($taxonomyId);
1032  $label = sprintf($this->lng->txt('qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle());
1033  $postvar = "tax_node_assign_$taxonomyId";
1034 
1035  $taxNodeAssign = new ilTaxAssignInputGUI($taxonomy->getId(), true, $label, $postvar);
1036  // TODO: determine tst/qpl when tax assigns become maintainable within tests
1037  $taxNodeAssign->setCurrentValues('qpl', $this->object->getObjId(), 'quest', $this->object->getId());
1038  $form->addItem($taxNodeAssign);
1039  }
1040  }
1041  }
This class represents a section header in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
setCurrentValues($a_component_id, $a_obj_id, $a_item_type, $a_item_id)
Set current values.
Input GUI class for taxonomy assignments.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

assQuestionGUI::save ( )

save question

in express mode, so add question to test directly

Definition at line 538 of file class.assQuestionGUI.php.

References $_GET, $_REQUEST, $_SESSION, $ilUser, $result, $test, assQuestion\_isWriteable(), assQuestion\_questionExistsInTest(), callNewIdListeners(), ilTestExpressPage\getReturnToPageLink(), ilUtil\redirect(), ilUtil\sendSuccess(), and writePostData().

Referenced by assFormulaQuestionGUI\saveFQ().

539  {
540  global $ilUser;
541  $old_id = $_GET["q_id"];
542  $result = $this->writePostData();
543 
544  if($result == 0)
545  {
546  $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
547  $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
548  $this->object->saveToDb();
549  $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
550 
551 
552  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
553  if($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
554  {
555  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
556  $this->ctrl->setParameter($this, 'return_to', 'editQuestion');
557  $this->ctrl->redirect($this, "originalSyncForm");
558  return;
559  }
560  elseif($_GET["calling_test"])
561  {
562  require_once 'Modules/Test/classes/class.ilObjTest.php';
563  $test = new ilObjTest($_GET["calling_test"]);
564  if(!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId()))
565  {
566  global $tree, $ilDB, $ilPluginAdmin;
567 
568  include_once("./Modules/Test/classes/class.ilObjTest.php");
569  $_GET["ref_id"] = $_GET["calling_test"];
570  $test = new ilObjTest($_GET["calling_test"], true);
571 
572  require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
573  $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
574 
575  $new_id = $test->insertQuestion(
576  $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId()
577  );
578 
579  if(isset($_REQUEST['prev_qid']))
580  {
581  $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST['prev_qid']);
582  }
583 
584  $this->ctrl->setParameter($this, 'q_id', $new_id);
585  $this->ctrl->setParameter($this, 'calling_test', $_GET['calling_test']);
586  #$this->ctrl->setParameter($this, 'test_ref_id', false);
587  }
588  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
589  $this->ctrl->redirect($this, 'editQuestion');
590 
591  }
592  else
593  {
594  $this->callNewIdListeners($this->object->getId());
595 
596  if($this->object->getId() != $old_id)
597  {
598  // first save
599  $this->ctrl->setParameterByClass($_GET["cmdClass"], "q_id", $this->object->getId());
600  $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
601  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
602 
603  //global $___test_express_mode;
607  if($_REQUEST['prev_qid'])
608  {
609  // @todo: bheyser/mbecker wtf? ..... thx@jposselt ....
610  // mbecker: Possible fix: Just instantiate the obj?
611  include_once("./Modules/Test/classes/class.ilObjTest.php");
612  $test =& new ilObjTest($_GET["ref_id"], true);
613  $test->moveQuestionAfter($_REQUEST['prev_qid'], $this->object->getId());
614  }
615  if( /*$___test_express_mode || */ $_REQUEST['express_mode'] )
616  {
617  global $tree, $ilDB, $ilPluginAdmin;
618 
619  include_once("./Modules/Test/classes/class.ilObjTest.php");
620  $test = new ilObjTest($_GET["ref_id"], true);
621 
622  require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
623  $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
624 
625  $test->insertQuestion(
626  $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId()
627  );
628 
629  require_once 'Modules/Test/classes/class.ilTestExpressPage.php';
630  $_REQUEST['q_id'] = $this->object->getId();
632  }
633 
634  $this->ctrl->redirectByClass($_GET["cmdClass"], "editQuestion");
635  }
636  if(strcmp($_SESSION["info"], "") != 0)
637  {
638  ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), true);
639  }
640  else
641  {
642  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
643  }
644  $this->ctrl->redirect($this, 'editQuestion');
645  }
646  }
647  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
$result
$_GET["client_id"]
callNewIdListeners($a_new_id)
Call the new id listeners.
_questionExistsInTest($question_id, $test_id)
static getReturnToPageLink($q_id=null)
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static redirect($a_script)
http redirect to other script
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveEdit()

assQuestionGUI::saveEdit ( )

save question

Definition at line 480 of file class.assQuestionGUI.php.

References $_GET, $_SESSION, $ilUser, $result, $test, assQuestion\_isWriteable(), ilUtil\redirect(), ilUtil\sendSuccess(), and writePostData().

481  {
482  global $ilUser;
483 
484  $result = $this->writePostData();
485  if ($result == 0)
486  {
487  $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
488  $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
489  $this->object->saveToDb();
490  $originalexists = $this->object->_questionExists($this->object->original_id);
491  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
492  if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
493  {
494  $this->ctrl->redirect($this, "originalSyncForm");
495  }
496  elseif ($_GET["calling_test"])
497  {
498  $_GET["ref_id"] = $_GET["calling_test"];
499  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=".$_GET["calling_test"]);
500  return;
501  }
502  elseif ($_GET["test_ref_id"])
503  {
504  global $tree, $ilDB, $ilPluginAdmin;
505 
506  include_once ("./Modules/Test/classes/class.ilObjTest.php");
507  $_GET["ref_id"] = $_GET["test_ref_id"];
508  $test =& new ilObjTest($_GET["test_ref_id"], true);
509 
510  require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
511  $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
512 
513  $test->insertQuestion( $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId() );
514 
515  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=".$_GET["test_ref_id"]);
516  }
517  else
518  {
519  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
520  $this->editQuestion();
521  if (strcmp($_SESSION["info"], "") != 0)
522  {
523  ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), false);
524  }
525  else
526  {
527  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), false);
528  }
529  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $this->object->getId());
530  $this->ctrl->redirectByClass("ilAssQuestionPageGUI", "edit");
531  }
532  }
533  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
$result
$_GET["client_id"]
global $ilUser
Definition: imgupload.php:15
static redirect($a_script)
http redirect to other script
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ saveReturn()

assQuestionGUI::saveReturn ( )

save question

Definition at line 652 of file class.assQuestionGUI.php.

References $_GET, $_REQUEST, $_SESSION, $ilUser, $result, $test, assQuestion\_isWriteable(), assQuestion\_questionExistsInTest(), callNewIdListeners(), ilTestExpressPage\getReturnToPageLink(), ilUtil\redirect(), ilUtil\sendSuccess(), and writePostData().

653  {
654  global $ilUser;
655  $old_id = $_GET["q_id"];
656  $result = $this->writePostData();
657  if($result == 0)
658  {
659  $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
660  $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
661  $this->object->saveToDb();
662  $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
663  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
664  if($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
665  {
666  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
667  $this->ctrl->redirect($this, "originalSyncForm");
668  return;
669  }
670  elseif($_GET["calling_test"])
671  {
672  require_once 'Modules/Test/classes/class.ilObjTest.php';
673  $test = new ilObjTest($_GET["calling_test"]);
674  #var_dump(assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId()));
675  $q_id = $this->object->getId();
676  if(!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId()))
677  {
678  global $tree, $ilDB, $ilPluginAdmin;
679 
680  include_once("./Modules/Test/classes/class.ilObjTest.php");
681  $_GET["ref_id"] = $_GET["calling_test"];
682  $test = new ilObjTest($_GET["calling_test"], true);
683 
684  require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
685  $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
686 
687  $new_id = $test->insertQuestion(
688  $testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId()
689  );
690 
691  $q_id = $new_id;
692  if(isset($_REQUEST['prev_qid']))
693  {
694  $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST['prev_qid']);
695  }
696 
697  $this->ctrl->setParameter($this, 'q_id', $new_id);
698  $this->ctrl->setParameter($this, 'calling_test', $_GET['calling_test']);
699  #$this->ctrl->setParameter($this, 'test_ref_id', false);
700 
701  }
702  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
703  if( /*$___test_express_mode || */
704  $_REQUEST['test_express_mode']
705  )
706  {
708  }
709  else
710  {
711  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["calling_test"]);
712  }
713  }
714  else
715  {
716  if($this->object->getId() != $old_id)
717  {
718  $this->callNewIdListeners($this->object->getId());
719  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
720  $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
721  }
722  if(strcmp($_SESSION["info"], "") != 0)
723  {
724  ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), true);
725  }
726  else
727  {
728  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
729  }
730  $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
731  }
732  }
733  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
$result
$_GET["client_id"]
callNewIdListeners($a_new_id)
Call the new id listeners.
_questionExistsInTest($question_id, $test_id)
static getReturnToPageLink($q_id=null)
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static redirect($a_script)
http redirect to other script
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ saveSuggestedSolution()

assQuestionGUI::saveSuggestedSolution ( )

Definition at line 1419 of file class.assQuestionGUI.php.

References $_POST, and suggestedsolution().

1420  {
1421  global $tree;
1422 
1423  include_once("./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1424  switch ($_POST["solutiontype"])
1425  {
1426  case "lm":
1427  $type = "lm";
1428  $search = "lm";
1429  break;
1430  case "git":
1431  $type = "glo";
1432  $search = "glo";
1433  break;
1434  case "st":
1435  $type = "lm";
1436  $search = "st";
1437  break;
1438  case "pg":
1439  $type = "lm";
1440  $search = "pg";
1441  break;
1442  case "file":
1443  case "text":
1444  return $this->suggestedsolution();
1445  break;
1446  default:
1447  return $this->suggestedsolution();
1448  break;
1449  }
1450  if(isset($_POST['solutiontype']))
1451  {
1452  $this->ctrl->setParameter($this, 'expandCurrentPath', 1);
1453  }
1454  $this->ctrl->setParameter($this, "link_new_type", $type);
1455  $this->ctrl->setParameter($this, "search_link_type", $search);
1456  $this->ctrl->redirect($this, "outSolutionExplorer");
1457  }
$_POST['username']
Definition: cron.php:12
suggestedsolution()
Allows to add suggested solutions for questions.
+ Here is the call graph for this function:

◆ saveTaxonomyAssignments()

assQuestionGUI::saveTaxonomyAssignments ( )
protected

Definition at line 1002 of file class.assQuestionGUI.php.

References getTaxonomyIds().

Referenced by assFormulaQuestionGUI\saveFQ(), assFormulaQuestionGUI\saveReturnFQ(), assTextQuestionGUI\writePostData(), assTextSubsetGUI\writePostData(), assFileUploadGUI\writePostData(), assSingleChoiceGUI\writePostData(), assMatchingQuestionGUI\writePostData(), assMultipleChoiceGUI\writePostData(), assErrorTextGUI\writePostData(), assOrderingHorizontalGUI\writePostData(), assJavaAppletGUI\writePostData(), assNumericGUI\writePostData(), assClozeTestGUI\writePostData(), assImagemapQuestionGUI\writePostData(), assFlashQuestionGUI\writePostData(), and assOrderingQuestionGUI\writePostData().

1003  {
1004  if( count($this->getTaxonomyIds()) )
1005  {
1006  require_once 'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php';
1007 
1008  foreach($this->getTaxonomyIds() as $taxonomyId)
1009  {
1010  $postvar = "tax_node_assign_$taxonomyId";
1011 
1012  $tax_node_assign = new ilTaxAssignInputGUI($taxonomyId, true, '', $postvar);
1013  // TODO: determine tst/qpl when tax assigns become maintainable within tests
1014  $tax_node_assign->saveInput("qpl", $this->object->getObjId(), "quest", $this->object->getId());
1015  }
1016  }
1017  }
Input GUI class for taxonomy assignments.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setErrorMessage()

assQuestionGUI::setErrorMessage (   $errormessage)

◆ setQuestionCount()

assQuestionGUI::setQuestionCount (   $a_question_count)

Definition at line 782 of file class.assQuestionGUI.php.

783  {
784  $this->question_count = $a_question_count;
785  }

◆ setQuestionTabs()

assQuestionGUI::setQuestionTabs ( )

Definition at line 1683 of file class.assQuestionGUI.php.

Referenced by assNumericGUI\getTestOutput().

1684  {
1685  }
+ Here is the caller graph for this function:

◆ setSequenceNumber()

assQuestionGUI::setSequenceNumber (   $nr)

Definition at line 772 of file class.assQuestionGUI.php.

773  {
774  $this->sequence_no = $nr;
775  }

◆ setTargetGui()

assQuestionGUI::setTargetGui ( ilTestPlayerAbstractGUI  $linkTargetGui)

Definition at line 118 of file class.assQuestionGUI.php.

References setTargetGuiClass().

119  {
120  $this->setTargetGuiClass( get_class($linkTargetGui) );
121  }
setTargetGuiClass($targetGuiClass)
+ Here is the call graph for this function:

◆ setTargetGuiClass()

assQuestionGUI::setTargetGuiClass (   $targetGuiClass)

Definition at line 123 of file class.assQuestionGUI.php.

References $targetGuiClass.

Referenced by setTargetGui().

124  {
125  $this->targetGuiClass = $targetGuiClass;
126  }
+ Here is the caller graph for this function:

◆ setTaxonomyIds()

assQuestionGUI::setTaxonomyIds (   $taxonomyIds)

Definition at line 108 of file class.assQuestionGUI.php.

References $taxonomyIds.

109  {
110  $this->taxonomyIds = $taxonomyIds;
111  }

◆ showHints()

assQuestionGUI::showHints ( )

Definition at line 1787 of file class.assQuestionGUI.php.

References $ilCtrl, and ilAssQuestionHintsGUI\CMD_SHOW_LIST.

1788  {
1789  global $ilCtrl;
1790 
1791  $ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
1792  }
const CMD_SHOW_LIST
command constants
global $ilCtrl
Definition: ilias.php:18

◆ showSuggestedSolution()

assQuestionGUI::showSuggestedSolution ( )

Definition at line 1152 of file class.assQuestionGUI.php.

References suggestedsolution().

1153  {
1154  $this->suggestedsolution();
1155  }
suggestedsolution()
Allows to add suggested solutions for questions.
+ Here is the call graph for this function:

◆ suggestedsolution()

assQuestionGUI::suggestedsolution ( )

Allows to add suggested solutions for questions.

public

Definition at line 1162 of file class.assQuestionGUI.php.

References $_GET, $_POST, $file, $ilUser, $options, $res, assQuestion\_getInternalLinkHref(), assQuestion\_isWriteable(), ilRadioGroupInputGUI\addOption(), getSolutionOutput(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), originalSyncForm(), ilUtil\prepareFormOutput(), ilUtil\renameExecutables(), ilUtil\sendInfo(), ilUtil\sendSuccess(), ilCustomInputGUI\setHtml(), and ilTextAreaInputGUI\setValue().

Referenced by saveSuggestedSolution(), and showSuggestedSolution().

1163  {
1164  global $ilUser;
1165  global $ilAccess;
1166 
1167  $save = (is_array($_POST["cmd"]) && array_key_exists("suggestedsolution", $_POST["cmd"])) ? TRUE : FALSE;
1168 
1169  if ($save && $_POST["deleteSuggestedSolution"] == 1)
1170  {
1171  $this->object->deleteSuggestedSolutions();
1172  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1173  $this->ctrl->redirect($this, "suggestedsolution");
1174  }
1175 
1176  $output = "";
1177  $solution_array = $this->object->getSuggestedSolution(0);
1178  $options = array(
1179  "lm" => $this->lng->txt("obj_lm"),
1180  "st" => $this->lng->txt("obj_st"),
1181  "pg" => $this->lng->txt("obj_pg"),
1182  "git" => $this->lng->txt("glossary_term"),
1183  "file" => $this->lng->txt("fileDownload"),
1184  "text" => $this->lng->txt("solutionText")
1185  );
1186 
1187  if ((strcmp($_POST["solutiontype"], "file") == 0) && (strcmp($solution_array["type"], "file") != 0))
1188  {
1189  $solution_array = array(
1190  "type" => "file"
1191  );
1192  }
1193  elseif ((strcmp($_POST["solutiontype"], "text") == 0) && (strcmp($solution_array["type"], "text") != 0))
1194  {
1195  $solution_array = array(
1196  "type" => "text",
1197  "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE)
1198  );
1199  }
1200  if ($save && strlen($_POST["filename"]))
1201  {
1202  $solution_array["value"]["filename"] = $_POST["filename"];
1203  }
1204  if ($save && strlen($_POST["solutiontext"]))
1205  {
1206  $solution_array["value"] = $_POST["solutiontext"];
1207  }
1208  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1209  if (count($solution_array))
1210  {
1211  $form = new ilPropertyFormGUI();
1212  $form->setFormAction($this->ctrl->getFormAction($this));
1213  $form->setTitle($this->lng->txt("solution_hint"));
1214  $form->setMultipart(TRUE);
1215  $form->setTableWidth("100%");
1216  $form->setId("suggestedsolutiondisplay");
1217 
1218  // suggested solution output
1219  include_once "./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
1220  $title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype");
1221  $template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE, "Modules/TestQuestionPool");
1222  if (strlen($solution_array["internal_link"]))
1223  {
1224  $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
1225  $template->setCurrentBlock("preview");
1226  $template->setVariable("TEXT_SOLUTION", $this->lng->txt("solution_hint"));
1227  $template->setVariable("VALUE_SOLUTION", " <a href=\"$href\" target=\"content\">" . $this->lng->txt("view"). "</a> ");
1228  $template->parseCurrentBlock();
1229  }
1230  elseif ((strcmp($solution_array["type"], "file") == 0) && (is_array($solution_array["value"])))
1231  {
1232  $href = $this->object->getSuggestedSolutionPathWeb() . $solution_array["value"]["name"];
1233  $template->setCurrentBlock("preview");
1234  $template->setVariable("TEXT_SOLUTION", $this->lng->txt("solution_hint"));
1235  $template->setVariable("VALUE_SOLUTION", " <a href=\"$href\" target=\"content\">" . ilUtil::prepareFormOutput((strlen($solution_array["value"]["filename"])) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]). "</a> ");
1236  $template->parseCurrentBlock();
1237  }
1238  $template->setVariable("TEXT_TYPE", $this->lng->txt("type"));
1239  $template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]);
1240  $title->setHtml($template->get());
1241  $deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution");
1242  $deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution"));
1243  $title->addSubItem($deletesolution);
1244  $form->addItem($title);
1245 
1246  if (strcmp($solution_array["type"], "file") == 0)
1247  {
1248  // file
1249  $file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file");
1250  $file->setRequired(TRUE);
1251  $file->enableFileNameSelection("filename");
1252  //$file->setSuffixes(array("doc","xls","png","jpg","gif","pdf"));
1253  if( $_FILES["file"]["tmp_name"] && $file->checkInput() )
1254  {
1255  if (!file_exists($this->object->getSuggestedSolutionPath())) ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
1256 
1257  $res = ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"], $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]);
1258  if ($res)
1259  {
1260  ilUtil::renameExecutables($this->object->getSuggestedSolutionPath());
1261 
1262  // remove an old file download
1263  if (is_array($solution_array["value"])) @unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]);
1264  $file->setValue($_FILES["file"]["name"]);
1265  $this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"]));
1266  $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
1267  if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
1268  {
1269  return $this->originalSyncForm("suggestedsolution");
1270  }
1271  else
1272  {
1273  ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
1274  $this->ctrl->redirect($this, "suggestedsolution");
1275  }
1276  }
1277  else
1278  {
1279  // BH: $res as info string? wtf? it holds a bool or something else!!?
1280  ilUtil::sendInfo($res);
1281  }
1282  }
1283  else
1284  {
1285  if (is_array($solution_array["value"]))
1286  {
1287  $file->setValue($solution_array["value"]["name"]);
1288  $file->setFilename((strlen($solution_array["value"]["filename"])) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]);
1289  }
1290  }
1291  $form->addItem($file);
1292  $hidden = new ilHiddenInputGUI("solutiontype");
1293  $hidden->setValue("file");
1294  $form->addItem($hidden);
1295  }
1296  else if (strcmp($solution_array["type"], "text") == 0)
1297  {
1298  $question = new ilTextAreaInputGUI($this->lng->txt("solutionText"), "solutiontext");
1299  $question->setValue($this->object->prepareTextareaOutput($solution_array["value"]));
1300  $question->setRequired(TRUE);
1301  $question->setRows(10);
1302  $question->setCols(80);
1303  $question->setUseRte(TRUE);
1304  $question->addPlugin("latex");
1305  $question->addButton("latex");
1306  $question->setRTESupport($this->object->getId(), "qpl", "assessment");
1307  $hidden = new ilHiddenInputGUI("solutiontype");
1308  $hidden->setValue("text");
1309  $form->addItem($hidden);
1310  $form->addItem($question);
1311  }
1312  if ($ilAccess->checkAccess("write", "", $_GET['ref_id']))
1313  {
1314  $form->addCommandButton('showSuggestedSolution', $this->lng->txt('cancel'));
1315  $form->addCommandButton('suggestedsolution', $this->lng->txt('save'));
1316  }
1317 
1318  if ($save)
1319  {
1320  if ($form->checkInput())
1321  {
1322  switch ($solution_array["type"])
1323  {
1324  case "file":
1325  $this->object->saveSuggestedSolution("file", "", 0, array("name" => $solution_array["value"]["name"], "type" => $solution_array["value"]["type"], "size" => $solution_array["value"]["size"], "filename" => $_POST["filename"]));
1326  break;
1327  case "text":
1328  $this->object->saveSuggestedSolution("text", "", 0, $solution_array["value"]);
1329  break;
1330  }
1331  $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
1332  if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
1333  {
1334  return $this->originalSyncForm("suggestedsolution");
1335  }
1336  else
1337  {
1338  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1339  $this->ctrl->redirect($this, "suggestedsolution");
1340  }
1341  }
1342  }
1343 
1344  $output = $form->getHTML();
1345  }
1346 
1347  $savechange = (strcmp($this->ctrl->getCmd(), "saveSuggestedSolution") == 0) ? TRUE : FALSE;
1348 
1349  $changeoutput = "";
1350  if ($ilAccess->checkAccess("write", "", $_GET['ref_id']))
1351  {
1352  $formchange = new ilPropertyFormGUI();
1353  $formchange->setFormAction($this->ctrl->getFormAction($this));
1354  $formchange->setTitle((count($solution_array)) ? $this->lng->txt("changeSuggestedSolution") : $this->lng->txt("addSuggestedSolution"));
1355  $formchange->setMultipart(FALSE);
1356  $formchange->setTableWidth("100%");
1357  $formchange->setId("suggestedsolution");
1358 
1359  $solutiontype = new ilRadioGroupInputGUI($this->lng->txt("suggestedSolutionType"), "solutiontype");
1360  foreach($options as $opt_value => $opt_caption)
1361  {
1362  $solutiontype->addOption(new ilRadioOption($opt_caption, $opt_value));
1363  }
1364  if (count($solution_array))
1365  {
1366  $solutiontype->setValue($solution_array["type"]);
1367  }
1368  $solutiontype->setRequired(TRUE);
1369  $formchange->addItem($solutiontype);
1370 
1371  $formchange->addCommandButton("saveSuggestedSolution", $this->lng->txt("select"));
1372 
1373  if ($savechange)
1374  {
1375  $formchange->checkInput();
1376  }
1377  $changeoutput = $formchange->getHTML();
1378  }
1379 
1380  $this->tpl->setVariable("ADM_CONTENT", $changeoutput . $output);
1381  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
print $file
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)
setHtml($a_html)
Set Html.
$_POST['username']
Definition: cron.php:12
This class represents a property form user interface.
$_GET["client_id"]
This class represents a file property in a property form.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
This class represents a custom property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class represents a hidden form property in a property form.
This class represents a property in a property form.
addOption($a_option)
Add Option.
if(!is_array($argv)) $options
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
special template class to simplify handling of ITX/PEAR
originalSyncForm($return_to="", $return_to_feedback='')
_getInternalLinkHref($target="")
global $ilUser
Definition: imgupload.php:15
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
This class represents a text area property in a property form.
_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:

◆ sync()

assQuestionGUI::sync ( )

Definition at line 438 of file class.assQuestionGUI.php.

References $_GET, $_REQUEST, and ilUtil\redirect().

439  {
440  $original_id = $this->object->original_id;
441  if ($original_id)
442  {
443  $this->object->syncWithOriginal();
444  }
445  if (strlen($_GET["return_to"]))
446  {
447  $this->ctrl->redirect($this, $_GET["return_to"]);
448  }
449  if (strlen($_REQUEST["return_to_fb"]))
450  {
451  $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', 'show');
452  }
453  else
454  {
455  $_GET["ref_id"] = $_GET["calling_test"];
456  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=".$_GET["calling_test"]);
457  }
458  }
$_GET["client_id"]
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ writePostData()

assQuestionGUI::writePostData ( )

Evaluates a posted edit form and writes the form data in the question object.

Returns
integer A positive value, if one of the required fields wasn't set, else 0 private

Definition at line 139 of file class.assQuestionGUI.php.

Referenced by assTextSubsetGUI\addanswers(), assOrderingQuestionGUI\addanswers(), assSingleChoiceGUI\addchoice(), assMultipleChoiceGUI\addchoice(), assMatchingQuestionGUI\adddefinitions(), assClozeTestGUI\addgap(), assJavaAppletGUI\addkvp(), assMatchingQuestionGUI\addpairs(), assTextQuestionGUI\addSuggestedSolution(), assMatchingQuestionGUI\addterms(), assErrorTextGUI\analyze(), apply(), assOrderingQuestionGUI\changeToPictures(), assOrderingQuestionGUI\changeToText(), assClozeTestGUI\createGaps(), assOrderingQuestionGUI\downanswers(), assFlashQuestionGUI\flashAddParam(), assOrderingQuestionGUI\orderNestedPictures(), assOrderingQuestionGUI\orderNestedTerms(), assFormulaQuestionGUI\parseQuestion(), assTextSubsetGUI\removeanswers(), assOrderingQuestionGUI\removeanswers(), assImagemapQuestionGUI\removeArea(), assSingleChoiceGUI\removechoice(), assMultipleChoiceGUI\removechoice(), assMatchingQuestionGUI\removedefinitions(), assClozeTestGUI\removegap(), assOrderingQuestionGUI\removeimageanswers(), assSingleChoiceGUI\removeimagechoice(), assMultipleChoiceGUI\removeimagechoice(), assMatchingQuestionGUI\removeimagedefinitions(), assMatchingQuestionGUI\removeimageterms(), assJavaAppletGUI\removekvp(), assMatchingQuestionGUI\removepairs(), assMatchingQuestionGUI\removeterms(), save(), saveEdit(), assFormulaQuestionGUI\saveFQ(), saveReturn(), assFormulaQuestionGUI\saveReturnFQ(), assFlashQuestionGUI\suggestRange(), assFormulaQuestionGUI\suggestRange(), assOrderingQuestionGUI\upanswers(), assOrderingQuestionGUI\uploadanswers(), assSingleChoiceGUI\uploadchoice(), assMultipleChoiceGUI\uploadchoice(), assMatchingQuestionGUI\uploaddefinitions(), and assMatchingQuestionGUI\uploadterms().

140  {
141  }
+ Here is the caller graph for this function:

◆ writeQuestionGenericPostData()

assQuestionGUI::writeQuestionGenericPostData ( )
protected

Definition at line 1770 of file class.assQuestionGUI.php.

References $_POST, and ilUtil\stripOnlySlashes().

Referenced by assTextQuestionGUI\writePostData(), assTextSubsetGUI\writePostData(), assSingleChoiceGUI\writePostData(), assFileUploadGUI\writePostData(), assMultipleChoiceGUI\writePostData(), assMatchingQuestionGUI\writePostData(), assErrorTextGUI\writePostData(), assOrderingHorizontalGUI\writePostData(), assJavaAppletGUI\writePostData(), assNumericGUI\writePostData(), assClozeTestGUI\writePostData(), assImagemapQuestionGUI\writePostData(), assFlashQuestionGUI\writePostData(), and assOrderingQuestionGUI\writePostData().

1771  {
1772  $this->object->setTitle( $_POST["title"] );
1773  $this->object->setAuthor( $_POST["author"] );
1774  $this->object->setComment( $_POST["comment"] );
1775  if ($this->object->getSelfAssessmentEditingMode())
1776  {
1777  $this->object->setNrOfTries( $_POST['nr_of_tries'] );
1778  }
1779  $this->object->setQuestion( ilUtil::stripOnlySlashes($_POST['question']) ); // ?
1780  $this->object->setEstimatedWorkingTime(
1781  $_POST["Estimated"]["hh"],
1782  $_POST["Estimated"]["mm"],
1783  $_POST["Estimated"]["ss"]
1784  );
1785  }
$_POST['username']
Definition: cron.php:12
static stripOnlySlashes($a_str)
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $error

assQuestionGUI::$error

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

◆ $errormessage

assQuestionGUI::$errormessage

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

Referenced by addErrorMessage(), getErrorMessage(), and setErrorMessage().

◆ $lng

assQuestionGUI::$lng

◆ $object

assQuestionGUI::$object

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

Referenced by assFormulaQuestionGUI\isSaveCommand().

◆ $question_count

assQuestionGUI::$question_count

question count in test

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

Referenced by getQuestionCount().

◆ $sequence_no

assQuestionGUI::$sequence_no

sequence number in test

Definition at line 41 of file class.assQuestionGUI.php.

Referenced by getSequenceNumber().

◆ $targetGuiClass

assQuestionGUI::$targetGuiClass = null
private

Definition at line 49 of file class.assQuestionGUI.php.

Referenced by getTargetGuiClass(), and setTargetGuiClass().

◆ $taxonomyIds

assQuestionGUI::$taxonomyIds = array()
private

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

Referenced by getTaxonomyIds(), and setTaxonomyIds().

◆ $tpl

◆ FORM_MODE_ADJUST

const assQuestionGUI::FORM_MODE_ADJUST = 'adjust'

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

◆ FORM_MODE_EDIT

const assQuestionGUI::FORM_MODE_EDIT = 'edit'

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


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