ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjTestGUI Class Reference

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

+ Inheritance diagram for ilObjTestGUI:
+ Collaboration diagram for ilObjTestGUI:

Public Member Functions

 __construct ($refId=null)
 Constructor public. More...
 
 executeCommand ()
 execute command More...
 
 getTestAccess ()
 
 setTestAccess ($testAccess)
 
 getTabsManager ()
 
 setTabsManager ($tabsManager)
 
 runObject ()
 
 outEvaluationObject ()
 
 addDidacticTemplateOptions (array &$a_options)
 
 afterSave (ilObject $a_new_object)
 save object public More...
 
 backToRepositoryObject ()
 
 uploadTstObject ()
 imports test and question(s) More...
 
 importVerifiedFileObject ()
 imports question(s) into the questionpool (after verification) More...
 
 uploadObject ($redirect=true)
 display status information or report errors messages in case of error More...
 
 downloadFileObject ()
 download file More...
 
 fullscreenObject ()
 show fullscreen view More...
 
 download_paragraphObject ()
 download source code paragraph More...
 
 filterObject ()
 Sets the filter for the question browser. More...
 
 resetFilterObject ()
 Resets the filter for the question browser. More...
 
 backObject ()
 Called when the back button in the question browser was pressed. More...
 
 createQuestionPool ($name="dummy", $description="")
 Creates a new questionpool and returns the reference id. More...
 
 randomselectObject ()
 
 cancelRandomSelectObject ()
 
 createRandomSelectionObject ()
 
 insertRandomSelectionObject ()
 Inserts a random selection into the test. More...
 
 browseForQuestionsObject ()
 
 executeCreateQuestionObject ()
 Called when a new question should be created from a test after confirmation. More...
 
 cancelCreateQuestionObject ()
 Called when the creation of a new question is cancelled. More...
 
 createQuestionObject ()
 Called when a new question should be created from a test. More...
 
 confirmRemoveQuestionsObject ()
 Remove questions from the test after confirmation. More...
 
 cancelRemoveQuestionsObject ()
 Cancels the removal of questions from the test. More...
 
 removeQuestionsForm ($checked_questions)
 Displays a form to confirm the removal of questions from the test. More...
 
 removeQuestionsObject ()
 Called when a selection of questions should be removed from the test. More...
 
 moveQuestionsObject ()
 Marks selected questions for moving. More...
 
 insertQuestionsBeforeObject ()
 Insert checked questions before the actual selection. More...
 
 insertQuestionsAfterObject ()
 Insert checked questions after the actual selection. More...
 
 insertQuestionsObject ()
 Insert questions from the questionbrowser into the test. More...
 
 addQuestionObject ()
 
 questionsObject ()
 
 takenObject ()
 
 historyObject ()
 Creates the change history for a test. More...
 
 initImportForm ($a_new_type)
 
 participantsActionObject ()
 Evaluates the actions on the participants page. More...
 
 printobject ()
 Print tab to create a print of all questions with points and solutions. More...
 
 reviewobject ()
 Review tab to create a print of all questions without points and solutions. More...
 
 deleteDefaultsObject ()
 Deletes selected test defaults. More...
 
 confirmedApplyDefaultsObject ()
 
 applyDefaultsObject ($confirmed=false)
 Applies the selected test defaults. More...
 
 addDefaultsObject ()
 Adds the defaults of this test to the defaults. More...
 
 infoScreenObject ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed More...
 
 redirectToInfoScreenObject ()
 
 addLocatorItems ()
 
 statisticsObject ()
 
 certificateObject ()
 Shows the certificate editor. More...
 
 getTabs ()
 adds tabs to tab gui object More...
 
 buildPageViewToolbar ($qid=0)
 Questions per page. More...
 
 copyQuestionsToPoolObject ()
 
 copyQuestionsToPool ($questionIds, $qplId)
 
 copyQuestionToPool ($sourceQuestionId, $targetParentId)
 
 copyAndLinkQuestionsToPoolObject ()
 ilObjectDataCache $ilObjDataCache More...
 
 copyToQuestionpoolObject ()
 
 copyAndLinkToQuestionpoolObject ()
 
 createQuestionPoolAndCopyObject ()
 
 createQuestionpoolTargetObject ($cmd)
 Called when a new question should be created from a test Important: $cmd may be overwritten if no question pool is available. More...
 
 applyTemplate ($templateData, ilObjTest $object)
 
 saveOrderAndObligationsObject ()
 
 movePageObject ()
 
 showPageObject ()
 
 copyQuestionObject ()
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static accessViolationRedirect ()
 
static _goto ($a_target)
 Redirect script to call a test with the test reference id. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Data Fields

 $object = null
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 redirectAfterMissingWrite ()
 
 redirectAfterMissingRead ()
 
 trackTestObjectReadEvent ()
 
 exportObject ()
 Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::export() More...
 
 fetchAuthoringQuestionIdParameter ()
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 form for new test object import More...
 
 removeImportFailsObject ()
 
 getTargetQuestionpoolForm ($questionpools, $cmd)
 
 movePageFormObject ()
 Move current page. More...
 
 determineObjectiveOrientedContainer ()
 
 getObjectiveOrientedContainer ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Protected Attributes

 $tabsManager
 
 $testAccess
 
- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

Private Member Functions

 questionsTabGatewayObject ()
 
 userResultsGatewayObject ()
 
 testResultsGatewayObject ()
 
 forwardToEvaluationGUI ()
 
 redirectTo_ilObjTestSettingsGeneralGUI_showForm_Object ()
 
 prepareSubGuiOutput ()
 prepares ilias to get output rendered by sub gui class More...
 
 populateQuestionBrowserToolbarButtons (ilToolbarGUI $toolbar, $context)
 
 isCommandClassAnyInfoScreenChild ()
 
 getQuestionpoolCreationForm ()
 

Private Attributes

 $testQuestionSetConfigFactory = null
 
 $testPlayerFactory = null
 
 $testSessionFactory = null
 
 $testSequenceFactory = null
 
 $objectiveOrientedContainer
 
 $error
 

Static Private Attributes

static $infoScreenChildClasses
 

Detailed Description

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

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

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

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

ilObjTestGUI: ilObjCourseGUI, ilObjectMetaDataGUI, ilCertificateGUI, ilPermissionGUI ilObjTestGUI: ilTestPlayerFixedQuestionSetGUI, ilTestPlayerRandomQuestionSetGUI, ilTestPlayerDynamicQuestionSetGUI ilObjTestGUI: ilTestExpresspageObjectGUI, ilAssQuestionPageGUI ilObjTestGUI: ilTestDashboardGUI, ilTestResultsGUI ilObjTestGUI: ilLearningProgressGUI, ilMarkSchemaGUI ilObjTestGUI: ilTestEvaluationGUI, ilParticipantsTestResultsGUI ilObjTestGUI: ilAssGenFeedbackPageGUI, ilAssSpecFeedbackPageGUI ilObjTestGUI: ilInfoScreenGUI, ilObjectCopyGUI, ilTestScoringGUI ilObjTestGUI: ilRepositorySearchGUI, ilTestExportGUI ilObjTestGUI: assMultipleChoiceGUI, assClozeTestGUI, assMatchingQuestionGUI ilObjTestGUI: assOrderingQuestionGUI, assImagemapQuestionGUI, assJavaAppletGUI ilObjTestGUI: assNumericGUI, assErrorTextGUI, ilTestScoringByQuestionsGUI ilObjTestGUI: assTextSubsetGUI, assOrderingHorizontalGUI ilObjTestGUI: assSingleChoiceGUI, assFileUploadGUI, assTextQuestionGUI, assFlashQuestionGUI ilObjTestGUI: assKprimChoiceGUI, assLongMenuGUI ilObjTestGUI: ilObjQuestionPoolGUI, ilEditClipboardGUI ilObjTestGUI: ilObjTestSettingsGeneralGUI, ilObjTestSettingsScoringResultsGUI ilObjTestGUI: ilCommonActionDispatcherGUI ilObjTestGUI: ilTestFixedQuestionSetConfigGUI, ilTestRandomQuestionSetConfigGUI, ilObjTestDynamicQuestionSetConfigGUI ilObjTestGUI: ilAssQuestionHintsGUI, ilAssQuestionFeedbackEditingGUI, ilLocalUnitConfigurationGUI, assFormulaQuestionGUI ilObjTestGUI: ilTestPassDetailsOverviewTableGUI ilObjTestGUI: ilTestResultsToolbarGUI ilObjTestGUI: ilTestCorrectionsGUI ilObjTestGUI: ilTestSettingsChangeConfirmationGUI ilObjTestGUI: ilTestSkillAdministrationGUI ilObjTestGUI: ilAssQuestionPreviewGUI ilObjTestGUI: ilTestQuestionBrowserTableGUI, ilTestInfoScreenToolbarGUI, ilLTIProviderObjectSettingGUI

Definition at line 66 of file class.ilObjTestGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjTestGUI::__construct (   $refId = null)

Constructor public.

Parameters
mixed | null$refId

Definition at line 110 of file class.ilObjTestGUI.php.

References $_GET, $DIC, $ilDB, ilObjectGUI\$lng, $refId, $tabsManager, ilObjectGUI\$tree, ILIAS\GlobalScreen\Provider\__construct(), setTabsManager(), and setTestAccess().

111  {
112  global $DIC;
113  $lng = $DIC['lng'];
114  $ilCtrl = $DIC['ilCtrl'];
115  $ilDB = $DIC['ilDB'];
116  $refinery = $DIC['refinery'];
117  $ilPluginAdmin = $DIC['ilPluginAdmin'];
118  $tree = $DIC['tree'];
119  $lng->loadLanguageModule("assessment");
120  $this->type = "tst";
121  $this->error = $DIC['ilErr'];
122  $this->ctrl = $ilCtrl;
123  $this->ctrl->saveParameter($this, array("ref_id", "test_ref_id", "calling_test", "test_express_mode", "q_id"));
124  if (isset($_GET['ref_id']) && is_numeric($_GET['ref_id'])) {
125  $refId = (int) $_GET['ref_id'];
126  }
127  parent::__construct("", (int) $refId, true, false);
128 
129  if ($this->object instanceof ilObjTest) {
130  require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
131  $this->testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $this->object);
132 
133  require_once 'Modules/Test/classes/class.ilTestPlayerFactory.php';
134  $this->testPlayerFactory = new ilTestPlayerFactory($this->object);
135 
136  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
137  $this->testSessionFactory = new ilTestSessionFactory($this->object);
138 
139  require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
140  $this->testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $refinery, $ilPluginAdmin, $this->object);
141 
142  require_once 'Modules/Test/classes/class.ilTestAccess.php';
143  $this->setTestAccess(new ilTestAccess($this->ref_id, $this->object->getTestId()));
144  }
145 
146  require_once 'Modules/Test/classes/class.ilTestObjectiveOrientedContainer.php';
147  $this->objectiveOrientedContainer = new ilTestObjectiveOrientedContainer();
148 
149  if ($this->object instanceof ilObjTest) {
150  require_once 'Modules/Test/classes/class.ilTestTabsManager.php';
151  $tabsManager = new ilTestTabsManager($this->testAccess, $this->objectiveOrientedContainer);
152  $tabsManager->setTestOBJ($this->object);
153  $tabsManager->setTestSession($this->testSessionFactory->getSession());
154  $tabsManager->setTestQuestionSetConfig($this->testQuestionSetConfigFactory->getQuestionSetConfig());
155  $tabsManager->initSettingsTemplate();
157  }
158  }
$_GET["client_id"]
setTestAccess($testAccess)
$refId
Definition: xapitoken.php:40
global $DIC
Definition: goto.php:24
setTabsManager($tabsManager)
__construct(Container $dic, ilPlugin $plugin)
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjTestGUI::_goto (   $a_target)
static

Redirect script to call a test with the test reference id.

Redirect script to call a test with the test reference id

Parameters
integer$a_targetThe reference id of the test public

Definition at line 3191 of file class.ilObjTestGUI.php.

References $_GET, $DIC, ilObjectGUI\$ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), exit, ROOT_FOLDER_ID, and ilUtil\sendInfo().

3192  {
3193  global $DIC;
3194  $ilAccess = $DIC['ilAccess'];
3195  $ilErr = $DIC['ilErr'];
3196  $lng = $DIC['lng'];
3197 
3198  if ($ilAccess->checkAccess("read", "", $a_target) || $ilAccess->checkAccess("visible", "", $a_target)) {
3199  //include_once "./Services/Utilities/classes/class.ilUtil.php";
3200  $_GET["baseClass"] = "ilObjTestGUI";
3201  $_GET["cmd"] = "infoScreen";
3202  $_GET["ref_id"] = $a_target;
3203  include_once("ilias.php");
3204  exit;
3205  //ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=$a_target");
3206  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
3207  ilUtil::sendInfo(sprintf(
3208  $lng->txt("msg_no_perm_read_item"),
3210  ), true);
3212  }
3213 
3214  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
3215  }
exit
Definition: login.php:29
const ROOT_FOLDER_ID
Definition: constants.php:30
$_GET["client_id"]
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ accessViolationRedirect()

static ilObjTestGUI::accessViolationRedirect ( )
static

◆ addDefaultsObject()

ilObjTestGUI::addDefaultsObject ( )

Adds the defaults of this test to the defaults.

Definition at line 2861 of file class.ilObjTestGUI.php.

References $_POST, and ilUtil\sendInfo().

2862  {
2863  if (strlen($_POST["name"]) > 0) {
2864  $this->object->addDefaults($_POST['name']);
2865  } else {
2866  ilUtil::sendInfo($this->lng->txt("tst_defaults_enter_name"));
2867  }
2868  $this->defaultsObject();
2869  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ addDidacticTemplateOptions()

ilObjTestGUI::addDidacticTemplateOptions ( array &  $a_options)

Definition at line 1193 of file class.ilObjTestGUI.php.

References ilSettingsTemplate\getAllSettingsTemplates().

1194  {
1195  include_once("./Modules/Test/classes/class.ilObjTest.php");
1196  $tst = new ilObjTest();
1197  $defaults = $tst->getAvailableDefaults();
1198  if (count($defaults)) {
1199  foreach ($defaults as $row) {
1200  $a_options["tstdef_" . $row["test_defaults_id"]] = array($row["name"],
1201  $this->lng->txt("tst_default_settings"));
1202  }
1203  }
1204 
1205  // using template?
1206  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
1207  $templates = ilSettingsTemplate::getAllSettingsTemplates("tst");
1208  if ($templates) {
1209  foreach ($templates as $item) {
1210  $a_options["tsttpl_" . $item["id"]] = array($item["title"],
1211  nl2br(trim($item["description"])));
1212  }
1213  }
1214  }
static getAllSettingsTemplates($a_type, $a_include_auto_generated=false)
Get all settings templates of type.
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjTestGUI::addLocatorItems ( )

Definition at line 3083 of file class.ilObjTestGUI.php.

References $_GET, and $DIC.

3084  {
3085  global $DIC;
3086  $ilLocator = $DIC['ilLocator'];
3087  switch ($this->ctrl->getCmd()) {
3088  case "run":
3089  case "infoScreen":
3090  case "redirectToInfoScreen":
3091  case "start":
3092  case "resume":
3093  case "previous":
3094  case "next":
3095  case "summary":
3096  case "finishTest":
3097  case "outCorrectSolution":
3098  case "passDetails":
3099  case "showAnswersOfUser":
3100  case "outUserResultsOverview":
3101  case "backFromSummary":
3102  case "show_answers":
3103  case "setsolved":
3104  case "resetsolved":
3105  case "outTestSummary":
3106  case "outQuestionSummary":
3107  case "gotoQuestion":
3108  case "selectImagemapRegion":
3109  case "confirmSubmitAnswers":
3110  case "finalSubmission":
3111  case "postpone":
3112  case "outUserPassDetails":
3113  case "checkPassword":
3114  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
3115  break;
3116  case "eval_stat":
3117  case "evalAllUsers":
3118  case "evalUserDetail":
3119  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "eval_stat"), "", $_GET["ref_id"]);
3120  break;
3121  case "create":
3122  case "save":
3123  case "cancel":
3124  case "importFile":
3125  case "cloneAll":
3126  case "importVerifiedFile":
3127  case "cancelImport":
3128  break;
3129  default:
3130  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
3131  break;
3132  }
3133  }
$_GET["client_id"]
global $DIC
Definition: goto.php:24

◆ addQuestionObject()

ilObjTestGUI::addQuestionObject ( )

Definition at line 2141 of file class.ilObjTestGUI.php.

References ilObjectGUI\$data, $DIC, ilObjectGUI\$lng, $name, $si, ilObjectGUI\$tpl, ilObjQuestionPool\_getAvailableQuestionpools(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_IPE, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, getTabsManager(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilRadioOption\setValue(), and ilTestTabsManager\SUBTAB_ID_QST_LIST_VIEW.

2142  {
2143  global $DIC;
2144  $lng = $DIC['lng'];
2145  $ilCtrl = $DIC['ilCtrl'];
2146  $tpl = $DIC['tpl'];
2147  global $DIC; /* @var \ILIAS\DI\Container $DIC */
2148  $ilHelp = $DIC['ilHelp']; /* @var ilHelpGUI $ilHelp */
2149 
2150  $this->getTabsManager()->getQuestionsSubTabs();
2152 
2153  $subScreenId = array('createQuestion');
2154 
2155  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
2156 
2157  $ilCtrl->setParameter($this, 'qtype', $_REQUEST['qtype']);
2158 
2159  $form = new ilPropertyFormGUI();
2160 
2161  $form->setFormAction($ilCtrl->getFormAction($this, "executeCreateQuestion"));
2162  $form->setTitle($lng->txt("ass_create_question"));
2163  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
2164 
2165  $pool = new ilObjQuestionPool();
2166  $questionTypes = $pool->getQuestionTypes(false, true, false);
2167  $options = array();
2168 
2169  // question type
2170  foreach ($questionTypes as $label => $data) {
2171  $options[$data['question_type_id']] = $label;
2172  }
2173 
2174  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
2175  $si = new ilSelectInputGUI($lng->txt("question_type"), "qtype");
2176  $si->setOptions($options);
2177  $form->addItem($si, true);
2178 
2179  // position
2180  $questions = $this->object->getQuestionTitlesAndIndexes();
2181  if ($questions) {
2182  $si = new ilSelectInputGUI($lng->txt("position"), "position");
2183  $options = array('0' => $lng->txt('first'));
2184  foreach ($questions as $key => $title) {
2185  $options[$key] = $lng->txt('behind') . ' ' . $title . ' [' . $this->lng->txt('question_id_short') . ': ' . $key . ']';
2186  }
2187  $si->setOptions($options);
2188  $si->setValue($_REQUEST['q_id']);
2189  $form->addItem($si, true);
2190  }
2191 
2192  // content editing mode
2194  $subScreenId[] = 'editMode';
2195 
2196  $ri = new ilRadioGroupInputGUI($lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
2197 
2198  $option_ipe = new ilRadioOption(
2199  $lng->txt('tst_add_quest_cont_edit_mode_IPE'),
2201  );
2202  $option_ipe->setInfo($lng->txt('tst_add_quest_cont_edit_mode_IPE_info'));
2203  $ri->addOption($option_ipe);
2204 
2205  $option_rte = new ilRadioOption(
2206  $lng->txt('tst_add_quest_cont_edit_mode_RTE'),
2208  );
2209  $option_rte->setInfo($lng->txt('tst_add_quest_cont_edit_mode_RTE_info'));
2210  $ri->addOption($option_rte);
2211 
2213 
2214  $form->addItem($ri, true);
2215  } else {
2216  $hi = new ilHiddenInputGUI("question_content_editing_type");
2218  $form->addItem($hi, true);
2219  }
2220 
2221  if ($this->object->getPoolUsage()) {
2222  $subScreenId[] = 'poolSelect';
2223 
2224  // use pool
2225  $usage = new ilRadioGroupInputGUI($this->lng->txt("assessment_pool_selection"), "usage");
2226  $usage->setRequired(true);
2227  $no_pool = new ilRadioOption($this->lng->txt("assessment_no_pool"), 1);
2228  $usage->addOption($no_pool);
2229  $existing_pool = new ilRadioOption($this->lng->txt("assessment_existing_pool"), 3);
2230  $usage->addOption($existing_pool);
2231  $new_pool = new ilRadioOption($this->lng->txt("assessment_new_pool"), 2);
2232  $usage->addOption($new_pool);
2233  $form->addItem($usage);
2234 
2235  $usage->setValue(1);
2236 
2237  $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, true, false, false, "write");
2238  $pools_data = array();
2239  foreach ($questionpools as $key => $p) {
2240  $pools_data[$key] = $p['title'];
2241  }
2242  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_qpl");
2243  $pools->setOptions($pools_data);
2244  $existing_pool->addSubItem($pools);
2245 
2246  $name = new ilTextInputGUI($this->lng->txt("name"), "txt_qpl");
2247  $name->setSize(50);
2248  $name->setMaxLength(50);
2249  $new_pool->addSubItem($name);
2250  }
2251 
2252  $form->addCommandButton("executeCreateQuestion", $lng->txt("create"));
2253  $form->addCommandButton("questions", $lng->txt("cancel"));
2254 
2255  $DIC->tabs()->activateTab('assQuestions');
2256  $ilHelp->setScreenId('assQuestions');
2257  $ilHelp->setSubScreenId(implode('_', $subScreenId));
2258 
2259  return $tpl->setContent($form->getHTML());
2260  }
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
constant for additional content editing mode "pageobject"
This class represents an option in a radio group.
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
This class represents a property form user interface.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
if($format !==null) $name
Definition: metadata.php:230
This class represents a hidden form property in a property form.
This class represents a property in a property form.
setValue($a_value)
Set Value.
global $DIC
Definition: goto.php:24
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
constant for additional content editing mode "default"
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not ...
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ afterSave()

ilObjTestGUI::afterSave ( ilObject  $a_new_object)

save object public

Definition at line 1220 of file class.ilObjTestGUI.php.

References ilObjTest\_getTestDefaults(), applyTemplate(), ilObjectGUI\getDidacticTemplateVar(), ilObject\getRefId(), and ilObjAssessmentFolderGUI\getSettingsTemplateConfig().

1221  {
1222  $tstdef = $this->getDidacticTemplateVar("tstdef");
1223  if ($tstdef) {
1224  $testDefaultsId = $tstdef;
1225  $testDefaults = ilObjTest::_getTestDefaults($testDefaultsId);
1226  $a_new_object->applyDefaults($testDefaults);
1227  }
1228 
1229  $template_id = $this->getDidacticTemplateVar("tsttpl");
1230  if ($template_id) {
1231  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
1233 
1234  $template_settings = $template->getSettings();
1235  if ($template_settings) {
1236  $this->applyTemplate($template_settings, $a_new_object);
1237  }
1238 
1239  $a_new_object->setTemplate($template_id);
1240  }
1241 
1242  $a_new_object->saveToDb();
1243 
1244  // always send a message
1245  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
1246  $this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId());
1247  $this->ctrl->redirectByClass('ilObjTestSettingsGeneralGUI');
1248  }
applyTemplate($templateData, ilObjTest $object)
getRefId()
get reference id public
getDidacticTemplateVar($a_type)
Get didactic template setting from creation screen.
Settings template application class.
static _getTestDefaults($test_defaults_id)
+ Here is the call graph for this function:

◆ applyDefaultsObject()

ilObjTestGUI::applyDefaultsObject (   $confirmed = false)

Applies the selected test defaults.

Definition at line 2773 of file class.ilObjTestGUI.php.

References $_POST, ilObjTest\QUESTION_SET_TYPE_FIXED, ilObjTest\QUESTION_SET_TYPE_RANDOM, and ilUtil\sendInfo().

Referenced by confirmedApplyDefaultsObject().

2774  {
2775  if (!is_array($_POST["chb_defaults"]) || 1 !== count($_POST["chb_defaults"])) {
2777  $this->lng->txt("tst_defaults_apply_select_one")
2778  );
2779 
2780  return $this->defaultsObject();
2781  }
2782 
2783  // do not apply if user datasets exist
2784  if ($this->object->evalTotalPersons() > 0) {
2786  $this->lng->txt("tst_defaults_apply_not_possible")
2787  );
2788 
2789  return $this->defaultsObject();
2790  }
2791 
2792  $defaults = &$this->object->getTestDefaults($_POST["chb_defaults"][0]);
2793  $defaultSettings = unserialize($defaults["defaults"]);
2794 
2795  if (isset($defaultSettings['isRandomTest'])) {
2796  if ($defaultSettings['isRandomTest']) {
2797  $newQuestionSetType = ilObjTest::QUESTION_SET_TYPE_RANDOM;
2798  $this->object->setQuestionSetType(ilObjTest::QUESTION_SET_TYPE_RANDOM);
2799  } else {
2800  $newQuestionSetType = ilObjTest::QUESTION_SET_TYPE_FIXED;
2801  $this->object->setQuestionSetType(ilObjTest::QUESTION_SET_TYPE_FIXED);
2802  }
2803  } elseif (isset($defaultSettings['questionSetType'])) {
2804  $newQuestionSetType = $defaultSettings['questionSetType'];
2805  }
2806  $oldQuestionSetType = $this->object->getQuestionSetType();
2807  $questionSetTypeSettingSwitched = ($oldQuestionSetType != $newQuestionSetType);
2808 
2809  $oldQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfigByType($oldQuestionSetType);
2810 
2811  switch (true) {
2812  case !$questionSetTypeSettingSwitched:
2813  case !$oldQuestionSetConfig->doesQuestionSetRelatedDataExist():
2814  case $confirmed:
2815 
2816  break;
2817 
2818  default:
2819 
2820  require_once 'Modules/Test/classes/confirmations/class.ilTestSettingsChangeConfirmationGUI.php';
2821  $confirmation = new ilTestSettingsChangeConfirmationGUI($this->lng, $this->object);
2822 
2823  $confirmation->setFormAction($this->ctrl->getFormAction($this));
2824  $confirmation->setCancel($this->lng->txt('cancel'), 'defaults');
2825  $confirmation->setConfirm($this->lng->txt('confirm'), 'confirmedApplyDefaults');
2826 
2827  $confirmation->setOldQuestionSetType($this->object->getQuestionSetType());
2828  $confirmation->setNewQuestionSetType($newQuestionSetType);
2829  $confirmation->setQuestionLossInfoEnabled(false);
2830  $confirmation->build();
2831 
2832  $confirmation->populateParametersFromPost();
2833 
2834  $this->tpl->setContent($this->ctrl->getHTML($confirmation));
2835 
2836  return;
2837  }
2838 
2839  if ($questionSetTypeSettingSwitched && !$this->object->getOfflineStatus()) {
2840  $this->object->setOfflineStatus(true);
2841 
2842  $info = $this->lng->txt("tst_set_offline_due_to_switched_question_set_type_setting");
2843 
2844  ilUtil::sendInfo($info, true);
2845  }
2846 
2847  $this->object->applyDefaults($defaults);
2848 
2849  ilUtil::sendSuccess($this->lng->txt("tst_defaults_applied"), true);
2850 
2851  if ($questionSetTypeSettingSwitched && $oldQuestionSetConfig->doesQuestionSetRelatedDataExist()) {
2852  $oldQuestionSetConfig->removeQuestionSetRelatedData();
2853  }
2854 
2855  $this->ctrl->redirect($this, 'defaults');
2856  }
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyTemplate()

ilObjTestGUI::applyTemplate (   $templateData,
ilObjTest  $object 
)

Definition at line 3667 of file class.ilObjTestGUI.php.

References ilObjTestSettingsGeneralGUI\ANSWER_FIXATION_NONE, ilObjTestSettingsGeneralGUI\ANSWER_FIXATION_ON_FOLLOWUP_QUESTION, ilObjTestSettingsGeneralGUI\ANSWER_FIXATION_ON_IFB_OR_FUQST, ilObjTestSettingsGeneralGUI\ANSWER_FIXATION_ON_INSTANT_FEEDBACK, REDIRECT_ALWAYS, REDIRECT_NONE, ilObjTest\setAutosave(), ilObjTest\setAutosaveIval(), ilObjTest\setFollowupQuestionAnswerFixationEnabled(), ilObjTest\setInstantFeedbackAnswerFixationEnabled(), ilObjTest\setRedirectionMode(), and ilObjTest\setRedirectionUrl().

Referenced by afterSave().

3669  {
3670  // map formFieldName => setterName
3671  $simpleSetters = array(
3672 
3673  // general properties
3674  'use_pool' => 'setPoolUsage',
3675  'question_set_type' => 'setQuestionSetType',
3676 
3677  // test intro properties
3678  'intro_enabled' => 'setIntroductionEnabled',
3679  'showinfo' => 'setShowInfo',
3680 
3681  // test access properties
3682  'chb_starting_time' => 'setStartingTimeEnabled',
3683  'chb_ending_time' => 'setEndingTimeEnabled',
3684  'password_enabled' => 'setPasswordEnabled',
3685  'fixedparticipants' => 'setFixedParticipants',
3686  'limitUsers' => 'setLimitUsersEnabled',
3687 
3688  // test run properties
3689  'nr_of_tries' => 'setNrOfTries',
3690  'chb_processing_time' => 'setEnableProcessingTime',
3691  'kiosk' => 'setKiosk',
3692  'examid_in_test_pass' => 'setShowExamIdInTestPassEnabled',
3693 
3694  // question behavior properties
3695  'title_output' => 'setTitleOutput',
3696  'autosave' => null, // handled specially in loop below
3697  'chb_shuffle_questions' => 'setShuffleQuestions',
3698  'offer_hints' => 'setOfferingQuestionHintsEnabled',
3699  'instant_feedback_contents' => 'setInstantFeedbackOptionsByArray',
3700  'instant_feedback_trigger' => 'setForceInstantFeedbackEnabled',
3701  'answer_fixation_handling' => null, // handled specially in loop below
3702  'obligations_enabled' => 'setObligationsEnabled',
3703 
3704  // test sequence properties
3705  'chb_use_previous_answers' => 'setUsePreviousAnswers',
3706  'chb_show_cancel' => 'setShowCancel',
3707  'chb_postpone' => 'setPostponingEnabled',
3708  'list_of_questions' => 'setListOfQuestionsSettings',
3709  'chb_show_marker' => 'setShowMarker',
3710 
3711  // test finish properties
3712  'enable_examview' => 'setEnableExamview',
3713  'showfinalstatement' => 'setShowFinalStatement',
3714  'redirection_enabled' => null, // handled specially in loop below
3715  'sign_submission' => 'setSignSubmission',
3716  'mailnotification' => 'setMailNotification',
3717 
3718  // scoring options properties
3719  'count_system' => 'setCountSystem',
3720  'mc_scoring' => 'setMCScoring',
3721  'score_cutting' => 'setScoreCutting',
3722  'pass_scoring' => 'setPassScoring',
3723  'pass_deletion_allowed' => 'setPassDeletionAllowed',
3724 
3725  // result summary properties
3726  'results_access_enabled' => 'setScoreReporting',
3727  'grading_status' => 'setShowGradingStatusEnabled',
3728  'grading_mark' => 'setShowGradingMarkEnabled',
3729 
3730  // result details properties
3731  'solution_details' => 'setShowSolutionDetails',
3732  'solution_feedback' => 'setShowSolutionFeedback',
3733  'solution_suggested' => 'setShowSolutionSuggested',
3734  'solution_printview' => 'setShowSolutionPrintview',
3735  'highscore_enabled' => 'setHighscoreEnabled',
3736  'solution_signature' => 'setShowSolutionSignature',
3737  'examid_in_test_res' => 'setShowExamIdInTestResultsEnabled',
3738  'exp_sc_short' => 'setExportSettingsSingleChoiceShort',
3739 
3740  // misc scoring & result properties
3741  'anonymity' => 'setAnonymity',
3742  'enable_archiving' => 'setEnableArchiving'
3743  );
3744 
3745  if (!$templateData['results_presentation']['value']) {
3746  $templateData['results_presentation']['value'] = array();
3747  }
3748 
3749  foreach ($simpleSetters as $field => $setter) {
3750  if ($templateData[$field] && strlen($setter)) {
3751  $object->$setter($templateData[$field]['value']);
3752  continue;
3753  }
3754 
3755  switch ($field) {
3756  case 'autosave':
3757  if ($templateData[$field]['value'] > 0) {
3758  $object->setAutosave(true);
3759  $object->setAutosaveIval($templateData[$field]['value'] * 1000);
3760  } else {
3761  $object->setAutosave(false);
3762  }
3763  break;
3764 
3765  case 'redirection_enabled':
3766  /* if( $templateData[$field]['value'] > REDIRECT_NONE )
3767  {
3768  $object->setRedirectionMode($templateData[$field]['value']);
3769  }
3770  else
3771  {
3772  $object->setRedirectionMode(REDIRECT_NONE);
3773  } */
3774  if (strlen($templateData[$field]['value'])) {
3776  $object->setRedirectionUrl($templateData[$field]['value']);
3777  } else {
3779  $object->setRedirectionUrl('');
3780  }
3781  break;
3782 
3783  case 'answer_fixation_handling':
3784  switch ($templateData[$field]['value']) {
3788  break;
3789 
3793  break;
3794 
3798  break;
3799 
3803  break;
3804  }
3805  break;
3806  }
3807  }
3808  }
setAutosave($autosave)
setRedirectionMode($redirection_mode=0)
const REDIRECT_NONE
Redirect after finishing test constants.
setRedirectionUrl($redirection_url=null)
const REDIRECT_ALWAYS
setAutosaveIval($autosave_ival)
setFollowupQuestionAnswerFixationEnabled($followupQuestionAnswerFixationEnabled)
setInstantFeedbackAnswerFixationEnabled($instantFeedbackAnswerFixationEnabled)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ backObject()

ilObjTestGUI::backObject ( )

Called when the back button in the question browser was pressed.

Called when the back button in the question browser was pressed

public

Definition at line 1593 of file class.ilObjTestGUI.php.

1594  {
1595  $this->ctrl->redirect($this, "questions");
1596  }

◆ backToRepositoryObject()

ilObjTestGUI::backToRepositoryObject ( )

Definition at line 1250 of file class.ilObjTestGUI.php.

References ilObjectGUI\getReturnLocation(), and ilUtil\redirect().

1251  {
1252  include_once "./Services/Utilities/classes/class.ilUtil.php";
1253  $path = $this->tree->getPathFull($this->object->getRefID());
1254  ilUtil::redirect($this->getReturnLocation("cancel", "./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
1255  }
static redirect($a_script)
getReturnLocation($a_cmd, $a_location="")
get return location for command (command is method name without "Object", e.g.
+ Here is the call graph for this function:

◆ browseForQuestionsObject()

ilObjTestGUI::browseForQuestionsObject ( )

Definition at line 1713 of file class.ilObjTestGUI.php.

1714  {
1715  $this->questionBrowser();
1716  }

◆ buildPageViewToolbar()

ilObjTestGUI::buildPageViewToolbar (   $qid = 0)

Questions per page.

Parameters

Definition at line 3223 of file class.ilObjTestGUI.php.

References $DIC, $ilUser, ilObjectGUI\$lng, $si, $total, ilObjTestAccess\_lookupOnlineTestAccess(), ilTestQuestionBrowserTableGUI\CONTEXT_PAGE_VIEW, ilLinkButton\getInstance(), and populateQuestionBrowserToolbarButtons().

Referenced by executeCommand().

3224  {
3225  if ($this->create_question_mode) {
3226  return;
3227  }
3228 
3229  global $DIC;
3230  $ilToolbar = $DIC['ilToolbar'];
3231  $ilCtrl = $DIC['ilCtrl'];
3232  $lng = $DIC['lng'];
3233 
3234  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
3235 
3236  $ilCtrl->saveParameter($this, 'q_mode');
3237 
3238  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'test_express_mode', 1);
3239  $ilCtrl->setParameter($this, 'test_express_mode', 1);
3240  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', $_REQUEST['q_id']);
3241  $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
3242  $ilToolbar->setFormAction($ilCtrl->getFormActionByClass('iltestexpresspageobjectgui', 'edit'));
3243 
3244  if ($this->object->evalTotalPersons() == 0) {
3245  /*
3246  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
3247  $pool = new ilObjQuestionPool();
3248  $questionTypes = $pool->getQuestionTypes();$options = array();
3249  foreach($questionTypes as $label => $data) {
3250  $options[$data['question_type_id']] = $label;
3251  }
3252 
3253  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3254  $si = new ilSelectInputGUI($lng->txt("test_add_new_question"), "qtype");
3255  $si->setOptions($options);
3256  $ilToolbar->addInputItem($si, true);
3257  /*
3258  // use pool
3259  if ($this->object->isExpressModeQuestionPoolAllowed()) {
3260  include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
3261  $cb = new ilCheckboxInputGUI($lng->txt("test_use_pool"), "use_pool");
3262  $ilToolbar->addInputItem($cb, true);
3263  }
3264  */
3265  $ilToolbar->addFormButton($lng->txt("ass_create_question"), "addQuestion");
3266 
3267  $ilToolbar->addSeparator();
3268 
3269  if ($this->object->getPoolUsage()) {
3270  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
3271 
3273 
3274  $show_separator = true;
3275  }
3276  }
3277 
3278  $questions = $this->object->getQuestionTitlesAndIndexes();
3279 
3280  // desc
3281  $options = array();
3282  foreach ($questions as $id => $label) {
3283  $options[$id] = $label . ' [' . $this->lng->txt('question_id_short') . ': ' . $id . ']';
3284  }
3285 
3286  $optionKeys = array_keys($options);
3287 
3288  if (!$options) {
3289  $options[] = $lng->txt('none');
3290  }
3291  //else if (count($options) > 1) {
3292 // $addSeparator = false;
3293 // if ($optionKeys[0] != $qid) {
3294 // //$ilToolbar->addFormButton($lng->txt("test_prev_question"), "prevQuestion");
3295 // $ilToolbar->addLink($lng->txt("test_prev_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
3296 // $addSeparator = true;
3297 // }
3298  // else {
3299  // $ilToolbar->addSpacer(45);
3300  // }
3301 //
3302 // if ($optionKeys[count($optionKeys)-1] != $qid) {
3303 // //$ilToolbar->addFormButton($lng->txt("test_next_question"), "nextQuestion");
3304 // $ilToolbar->addLink($lng->txt("test_next_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
3305  // $addSeparator = true;
3306 // }
3307  // else {
3308  // $ilToolbar->addSpacer(45);
3309  // }
3310 //
3311 // //if ($addSeparator) {
3312 // $ilToolbar->addSeparator();
3313 // //}
3314 
3315  if (count($questions)) {
3316  if (isset($show_separator) && $show_separator) {
3317  $ilToolbar->addSeparator();
3318  }
3319 
3320  $btn = ilLinkButton::getInstance();
3321  $btn->setCaption("test_prev_question");
3322  $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
3323  $ilToolbar->addButtonInstance($btn);
3324 
3325  if (count($options) <= 1 || $optionKeys[0] == $qid) {
3326  $btn->setDisabled(true);
3327  }
3328 
3329  $btn = ilLinkButton::getInstance();
3330  $btn->setCaption("test_next_question");
3331  $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
3332  $ilToolbar->addButtonInstance($btn);
3333 
3334  if (count($options) <= 1 || $optionKeys[count($optionKeys) - 1] == $qid) {
3335  $btn->setDisabled(true);
3336  }
3337  }
3338 
3339  if (count($questions) > 1) {
3340  $ilToolbar->addSeparator();
3341 
3342  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3343  $si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
3344  $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
3345  $si->setOptions($options);
3346 
3347  if ($qid) {
3348  $si->setValue($qid);
3349  }
3350 
3351  $ilToolbar->addInputItem($si, true);
3352  }
3353 
3354  $total = $this->object->evalTotalPersons();
3355 
3356  /*if (count($options)) {
3357  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3358  $si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
3359  $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
3360  $si->setOptions($options);
3361 
3362  if ($qid) {
3363  $si->setValue($qid);
3364  }
3365 
3366  $ilToolbar->addInputItem($si, true);
3367  }*/
3368 
3369  if (count($questions) && !$total) {
3370  $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
3371  $ilToolbar->addSeparator();
3372  $ilToolbar->addButton($lng->txt("test_delete_page"), $ilCtrl->getLinkTarget($this, "removeQuestions"));
3373  }
3374 
3375  if (count($questions) > 1 && !$total) {
3376  $ilToolbar->addSeparator();
3377  $ilToolbar->addButton($lng->txt("test_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
3378  }
3379 
3380  global $DIC;
3381  $ilAccess = $DIC['ilAccess'];
3382  $ilUser = $DIC['ilUser'];
3383 
3384  $online_access = false;
3385  if ($this->object->getFixedParticipants()) {
3386  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
3387  $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
3388  if ($online_access_result === true) {
3389  $online_access = true;
3390  }
3391  }
3392 
3393  if (!$this->object->getOfflineStatus() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
3394  if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) {
3395  $testSession = $this->testSessionFactory->getSession();
3396 
3397  $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = true);
3398 
3399  if ($executable["executable"]) {
3400  $player_factory = new ilTestPlayerFactory($this->object);
3401  $player_instance = $player_factory->getPlayerGUI();
3402 
3403  if ($testSession->getActiveId() > 0) {
3404  $ilToolbar->addSeparator();
3405  $ilToolbar->addButton($lng->txt('tst_resume_test'), $ilCtrl->getLinkTarget($player_instance, 'resumePlayer'));
3406  } else {
3407  $ilToolbar->addSeparator();
3408  $ilToolbar->addButton($lng->txt('tst_start_test'), $ilCtrl->getLinkTarget($player_instance, 'startTest'));
3409  }
3410  }
3411  }
3412  }
3413  }
$total
Definition: Utf8Test.php:87
static _lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
global $DIC
Definition: goto.php:24
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar, $context)
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelCreateQuestionObject()

ilObjTestGUI::cancelCreateQuestionObject ( )

Called when the creation of a new question is cancelled.

Called when the creation of a new question is cancelled

public

Definition at line 1788 of file class.ilObjTestGUI.php.

1789  {
1790  $this->ctrl->redirect($this, "questions");
1791  }

◆ cancelRandomSelectObject()

ilObjTestGUI::cancelRandomSelectObject ( )

Definition at line 1664 of file class.ilObjTestGUI.php.

1665  {
1666  $this->ctrl->redirect($this, "questions");
1667  }

◆ cancelRemoveQuestionsObject()

ilObjTestGUI::cancelRemoveQuestionsObject ( )

Cancels the removal of questions from the test.

Cancels the removal of questions from the test

public

Definition at line 1959 of file class.ilObjTestGUI.php.

1960  {
1961  if ($_REQUEST['test_express_mode']) {
1962  $this->ctrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
1963  $this->ctrl->redirect($this, "showPage");
1964  } else {
1965  $this->ctrl->redirect($this, "questions");
1966  }
1967  }

◆ certificateObject()

ilObjTestGUI::certificateObject ( )

Shows the certificate editor.

Definition at line 3142 of file class.ilObjTestGUI.php.

References $DIC, and ilTestTabsManager\TAB_ID_SETTINGS.

3143  {
3144  global $DIC; /* @var ILIAS\DI\Container $DIC */
3145 
3146  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_SETTINGS);
3147 
3148  $guiFactory = new ilCertificateGUIFactory();
3149  $output_gui = $guiFactory->create($this->object);
3150 
3151  $output_gui->certificateEditor();
3152  }
global $DIC
Definition: goto.php:24

◆ confirmedApplyDefaultsObject()

ilObjTestGUI::confirmedApplyDefaultsObject ( )

Definition at line 2764 of file class.ilObjTestGUI.php.

References applyDefaultsObject().

2765  {
2766  $this->applyDefaultsObject(true);
2767  return;
2768  }
applyDefaultsObject($confirmed=false)
Applies the selected test defaults.
+ Here is the call graph for this function:

◆ confirmRemoveQuestionsObject()

ilObjTestGUI::confirmRemoveQuestionsObject ( )

Remove questions from the test after confirmation.

Definition at line 1901 of file class.ilObjTestGUI.php.

References $_POST.

1902  {
1903  $removeQuestionIds = (array) $_POST["q_id"];
1904 
1905  $questions = $this->object->getQuestionTitlesAndIndexes();
1906 
1907  $this->object->removeQuestions($removeQuestionIds);
1908 
1909  $this->object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
1910 
1911  ilUtil::sendSuccess($this->lng->txt("tst_questions_removed"));
1912 
1913  if ($_REQUEST['test_express_mode']) {
1914  $prev = null;
1915  $return_to = null;
1916  $deleted_tmp = $removeQuestionIds;
1917  $first = array_shift($deleted_tmp);
1918  foreach ((array) $questions as $key => $value) {
1919  if (!in_array($key, $removeQuestionIds)) {
1920  $prev = $key;
1921  if (!$first) {
1922  $return_to = $prev;
1923  break;
1924  } else {
1925  continue;
1926  }
1927  } elseif ($key == $first) {
1928  if ($prev) {
1929  $return_to = $prev;
1930  break;
1931  }
1932  $first = array_shift($deleted_tmp);
1933  }
1934  }
1935 
1936  if (
1937  count($questions) == count($removeQuestionIds) ||
1938  !$return_to
1939  ) {
1940  $this->ctrl->setParameter($this, 'q_id', '');
1941  $this->ctrl->redirect($this, 'showPage');
1942  }
1943 
1944  $this->ctrl->setParameter($this, 'q_id', $return_to);
1945  $this->ctrl->redirect($this, "showPage");
1946  } else {
1947  $this->ctrl->setParameter($this, 'q_id', '');
1948  $this->ctrl->redirect($this, 'questions');
1949  }
1950  }
$_POST["username"]

◆ copyAndLinkQuestionsToPoolObject()

ilObjTestGUI::copyAndLinkQuestionsToPoolObject ( )

ilObjectDataCache $ilObjDataCache

Definition at line 3456 of file class.ilObjTestGUI.php.

References $DIC, $result, assQuestion\_instanciateQuestion(), copyAndLinkToQuestionpoolObject(), copyQuestionsToPool(), assQuestion\originalQuestionExists(), and ilUtil\sendFailure().

Referenced by createQuestionPoolAndCopyObject().

3457  {
3458  global $DIC;
3459  $ilObjDataCache = $DIC['ilObjDataCache'];
3460 
3461  if (!(int) $_REQUEST['sel_qpl']) {
3462  ilUtil::sendFailure($this->lng->txt("questionpool_not_selected"));
3463  return $this->copyAndLinkToQuestionpoolObject();
3464  }
3465 
3466  $qplId = $ilObjDataCache->lookupObjId($_REQUEST['sel_qpl']);
3467  $result = $this->copyQuestionsToPool($_REQUEST['q_id'], $qplId);
3468 
3469  foreach ($result->ids as $oldId => $newId) {
3470  $questionInstance = assQuestion::_instanciateQuestion($oldId);
3471 
3472  if (assQuestion::originalQuestionExists($questionInstance->getOriginalId())) {
3473  $oldOriginal = assQuestion::_instanciateQuestion($questionInstance->getOriginalId());
3474  $oldOriginal->delete($oldOriginal->getId());
3475  }
3476 
3477  $questionInstance->setNewOriginalId($newId);
3478  }
3479 
3480  ilUtil::sendSuccess($this->lng->txt('tst_qst_added_to_pool_' . (count($result->ids) > 1 ? 'p' : 's')), true);
3481  $this->ctrl->redirect($this, 'questions');
3482  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
$result
static originalQuestionExists($questionId)
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
copyQuestionsToPool($questionIds, $qplId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyAndLinkToQuestionpoolObject()

ilObjTestGUI::copyAndLinkToQuestionpoolObject ( )

Definition at line 3516 of file class.ilObjTestGUI.php.

References $DIC, ilObjectGUI\$lng, $type, assQuestion\_getOriginalId(), ilObject\_lookupType(), createQuestionpoolTargetObject(), assQuestion\lookupParentObjId(), assQuestion\originalQuestionExists(), and ilUtil\sendFailure().

Referenced by copyAndLinkQuestionsToPoolObject(), and createQuestionPoolAndCopyObject().

3517  {
3518  global $DIC;
3519  $lng = $DIC['lng'];
3520 
3521  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
3522 
3523  // #13761; All methods use for this request should be revised, thx japo ;-)
3524  if (
3525  'copyAndLinkToQuestionpool' == $this->ctrl->getCmd() &&
3526  (!isset($_REQUEST['q_id']) || !is_array($_REQUEST['q_id']))
3527  ) {
3528  ilUtil::sendFailure($this->lng->txt('tst_no_question_selected_for_moving_to_qpl'), true);
3529  $this->ctrl->redirect($this, 'questions');
3530  }
3531 
3532  if (isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id'])) {
3533  foreach ($_REQUEST['q_id'] as $q_id) {
3535  continue;
3536  }
3537 
3539 
3540  if ($type !== 'tst') {
3541  ilUtil::sendFailure($lng->txt('tst_link_only_unassigned'), true);
3542  $this->ctrl->redirect($this, 'questions');
3543  return;
3544  }
3545  }
3546  }
3547 
3548  $this->createQuestionpoolTargetObject('copyAndLinkQuestionsToPool');
3549  }
static _getOriginalId($question_id)
Returns the original id of a question.
static originalQuestionExists($questionId)
$type
createQuestionpoolTargetObject($cmd)
Called when a new question should be created from a test Important: $cmd may be overwritten if no que...
static lookupParentObjId($questionId)
ilDBInterface $ilDB
global $DIC
Definition: goto.php:24
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyQuestionObject()

ilObjTestGUI::copyQuestionObject ( )

Definition at line 3923 of file class.ilObjTestGUI.php.

References $DIC, $i, assQuestion\_instanciateQuestionGUI(), ilUtil\sendFailure(), and ilUtil\sendInfo().

3924  {
3925  global $DIC;
3926  $ilAccess = $DIC['ilAccess'];
3927  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
3928  // allow only write access
3929  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3930  $this->ctrl->redirect($this, "infoScreen");
3931  }
3932 
3933  if ($_REQUEST['q_id'] && !is_array($_REQUEST['q_id'])) {
3934  $ids = array($_REQUEST['q_id']);
3935  } elseif ($_REQUEST['q_id']) {
3936  $ids = $_REQUEST['q_id'];
3937  } else {
3938  ilUtil::sendFailure($this->lng->txt('copy_no_questions_selected'), true);
3939  $this->ctrl->redirect($this, 'questions');
3940  }
3941 
3942  $copy_count = 0;
3943 
3944  $questionTitles = $this->object->getQuestionTitles();
3945 
3946  foreach ($ids as $id) {
3947  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
3948  $question = assQuestion::_instanciateQuestionGUI($id);
3949  if ($question) {
3950  $title = $question->object->getTitle();
3951  $i = 2;
3952  while (in_array($title . ' (' . $i . ')', $questionTitles)) {
3953  $i++;
3954  }
3955 
3956  $title .= ' (' . $i . ')';
3957 
3958  $questionTitles[] = $title;
3959 
3960  $new_id = $question->object->duplicate(false, $title);
3961 
3962  $clone = assQuestion::_instanciateQuestionGUI($new_id);
3963  $clone->object->setObjId($this->object->getId());
3964  $clone->object->saveToDb();
3965 
3966  $this->object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $new_id, true);
3967 
3968  $copy_count++;
3969  }
3970  }
3971 
3972  ilUtil::sendSuccess($this->lng->txt('copy_questions_success'), true);
3973 
3974  $this->ctrl->redirect($this, 'questions');
3975  }
static & _instanciateQuestionGUI($question_id)
Creates an instance of a question gui with a given question id.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ copyQuestionsToPool()

ilObjTestGUI::copyQuestionsToPool (   $questionIds,
  $qplId 
)

Definition at line 3421 of file class.ilObjTestGUI.php.

References $result, and copyQuestionToPool().

Referenced by copyAndLinkQuestionsToPoolObject(), and copyQuestionsToPoolObject().

3422  {
3423  $newIds = array();
3424  foreach ($questionIds as $q_id) {
3425  $newId = $this->copyQuestionToPool($q_id, $qplId);
3426  $newIds[$q_id] = $newId;
3427  }
3428 
3429  $result = new stdClass();
3430  $result->ids = $newIds;
3431  $result->qpoolid = $qplId;
3432 
3433  return $result;
3434  }
$result
copyQuestionToPool($sourceQuestionId, $targetParentId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyQuestionsToPoolObject()

ilObjTestGUI::copyQuestionsToPoolObject ( )

Definition at line 3415 of file class.ilObjTestGUI.php.

References copyQuestionsToPool().

3416  {
3417  $this->copyQuestionsToPool($_REQUEST['q_id'], $_REQUEST['sel_qpl']);
3418  $this->ctrl->redirect($this, 'questions');
3419  }
copyQuestionsToPool($questionIds, $qplId)
+ Here is the call graph for this function:

◆ copyQuestionToPool()

ilObjTestGUI::copyQuestionToPool (   $sourceQuestionId,
  $targetParentId 
)

Definition at line 3436 of file class.ilObjTestGUI.php.

References assQuestion\instantiateQuestionGUI().

Referenced by copyQuestionsToPool().

3437  {
3438  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
3439  $question_gui = assQuestion::instantiateQuestionGUI($sourceQuestionId);
3440 
3441  $newtitle = $question_gui->object->getTitle();
3442  if ($question_gui->object->questionTitleExists($targetParentId, $question_gui->object->getTitle())) {
3443  $counter = 2;
3444  while ($question_gui->object->questionTitleExists($targetParentId, $question_gui->object->getTitle() . " ($counter)")) {
3445  $counter++;
3446  }
3447  $newtitle = $question_gui->object->getTitle() . " ($counter)";
3448  }
3449 
3450  return $question_gui->object->createNewOriginalFromThisDuplicate($targetParentId, $newtitle);
3451  }
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyToQuestionpoolObject()

ilObjTestGUI::copyToQuestionpoolObject ( )

Definition at line 3511 of file class.ilObjTestGUI.php.

References createQuestionpoolTargetObject().

3512  {
3513  $this->createQuestionpoolTargetObject('copyQuestionsToPool');
3514  }
createQuestionpoolTargetObject($cmd)
Called when a new question should be created from a test Important: $cmd may be overwritten if no que...
+ Here is the call graph for this function:

◆ createQuestionObject()

ilObjTestGUI::createQuestionObject ( )

Called when a new question should be created from a test.

Called when a new question should be created from a test

public

Definition at line 1800 of file class.ilObjTestGUI.php.

References $DIC, $ilUser, ilObjectGUI\$lng, $name, ilObjectGUI\$tpl, ilObjQuestionPool\_getAvailableQuestionpools(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, getTabsManager(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), ilUtil\redirect(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilRadioOption\setValue(), and ilTestTabsManager\SUBTAB_ID_QST_LIST_VIEW.

Referenced by executeCreateQuestionObject().

1801  {
1802  global $DIC;
1803  $ilUser = $DIC['ilUser'];
1804  $this->getTabsManager()->getQuestionsSubTabs();
1806  //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_qpl_select.html", "Modules/Test");
1807  $questionpools = &$this->object->getAvailableQuestionpools(false, false, false, true, false, "write");
1808 
1809  if ($this->object->getPoolUsage()) {
1810  global $DIC;
1811  $lng = $DIC['lng'];
1812  $ilCtrl = $DIC['ilCtrl'];
1813  $tpl = $DIC['tpl'];
1814 
1815  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1816 
1817  $form = new ilPropertyFormGUI();
1818  $form->setFormAction($ilCtrl->getFormAction($this, "executeCreateQuestion"));
1819  $form->setTitle($lng->txt("ass_create_question"));
1820  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
1821 
1822 
1823  $hidden = new ilHiddenInputGUI('sel_question_types');
1824  $hidden->setValue($_REQUEST["sel_question_types"]);
1825  $form->addItem($hidden);
1826 
1827  // content editing mode
1829  $ri = new ilRadioGroupInputGUI($lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
1830 
1831  $option_ipe = new ilRadioOption(
1832  $lng->txt('tst_add_quest_cont_edit_mode_IPE'),
1833  assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
1834  );
1835  $option_ipe->setInfo($lng->txt('tst_add_quest_cont_edit_mode_IPE_info'));
1836  $ri->addOption($option_ipe);
1837 
1838  $option_rte = new ilRadioOption(
1839  $lng->txt('tst_add_quest_cont_edit_mode_RTE'),
1841  );
1842  $option_rte->setInfo($lng->txt('tst_add_quest_cont_edit_mode_RTE_info'));
1843  $ri->addOption($option_rte);
1844 
1846 
1847  $form->addItem($ri, true);
1848  } else {
1849  $hi = new ilHiddenInputGUI("question_content_editing_type");
1851  $form->addItem($hi, true);
1852  }
1853 
1854  // use pool
1855  $usage = new ilRadioGroupInputGUI($this->lng->txt("assessment_pool_selection"), "usage");
1856  $usage->setRequired(true);
1857  $no_pool = new ilRadioOption($this->lng->txt("assessment_no_pool"), 1);
1858  $usage->addOption($no_pool);
1859  $existing_pool = new ilRadioOption($this->lng->txt("assessment_existing_pool"), 3);
1860  $usage->addOption($existing_pool);
1861  $new_pool = new ilRadioOption($this->lng->txt("assessment_new_pool"), 2);
1862  $usage->addOption($new_pool);
1863  $form->addItem($usage);
1864 
1865  $usage->setValue(1);
1866 
1867  $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, true, false, false, "write");
1868  $pools_data = array();
1869  foreach ($questionpools as $key => $p) {
1870  $pools_data[$key] = $p['title'];
1871  }
1872  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_qpl");
1873  $pools->setOptions($pools_data);
1874  $existing_pool->addSubItem($pools);
1875 
1876 
1877  $this->lng->loadLanguageModule('rbac');
1878  $name = new ilTextInputGUI($this->lng->txt("rbac_create_qpl"), "txt_qpl");
1879  $name->setSize(50);
1880  $name->setMaxLength(50);
1881  $new_pool->addSubItem($name);
1882 
1883  $form->addCommandButton("executeCreateQuestion", $lng->txt("submit"));
1884  $form->addCommandButton("cancelCreateQuestion", $lng->txt("cancel"));
1885 
1886  return $this->tpl->setVariable('ADM_CONTENT', $form->getHTML());
1887  } else {
1888  global $DIC;
1889  $ilCtrl = $DIC['ilCtrl'];
1890 
1891  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'sel_question_types', $_REQUEST["sel_question_types"]);
1892  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'add_quest_cont_edit_mode', $_REQUEST["add_quest_cont_edit_mode"]);
1893  $link = $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'handleToolbarCommand', '', false, false);
1894  ilUtil::redirect($link);
1895  }
1896  }
This class represents an option in a radio group.
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
This class represents a property form user interface.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
if($format !==null) $name
Definition: metadata.php:230
This class represents a hidden form property in a property form.
This class represents a property in a property form.
setValue($a_value)
Set Value.
global $DIC
Definition: goto.php:24
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
constant for additional content editing mode "default"
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not ...
$ilUser
Definition: imgupload.php:18
static redirect($a_script)
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createQuestionPool()

ilObjTestGUI::createQuestionPool (   $name = "dummy",
  $description = "" 
)

Creates a new questionpool and returns the reference id.

Creates a new questionpool and returns the reference id

Returns
integer Reference id of the newly created questionpool public

Definition at line 1606 of file class.ilObjTestGUI.php.

References $DIC, $name, and ilObjectGUI\$tree.

Referenced by createQuestionPoolAndCopyObject(), and executeCreateQuestionObject().

1607  {
1608  global $DIC;
1609  $tree = $DIC['tree'];
1610  $parent_ref = $tree->getParentId($this->object->getRefId());
1611  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
1612  $qpl = new ilObjQuestionPool();
1613  $qpl->setType("qpl");
1614  $qpl->setTitle($name);
1615  $qpl->setDescription($description);
1616  $qpl->create();
1617  $qpl->createReference();
1618  $qpl->putInTree($parent_ref);
1619  $qpl->setPermissions($parent_ref);
1620  $qpl->setOnline(1); // must be online to be available
1621  $qpl->saveToDb();
1622  return $qpl->getRefId();
1623  }
if($format !==null) $name
Definition: metadata.php:230
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ createQuestionPoolAndCopyObject()

ilObjTestGUI::createQuestionPoolAndCopyObject ( )

Definition at line 3551 of file class.ilObjTestGUI.php.

References ilObjectGUI\$ref_id, copyAndLinkQuestionsToPoolObject(), copyAndLinkToQuestionpoolObject(), createQuestionPool(), and ilUtil\sendFailure().

3552  {
3553  if ($_REQUEST['title']) {
3554  $title = $_REQUEST['title'];
3555  } else {
3556  $title = $_REQUEST['txt_qpl'];
3557  }
3558 
3559  if (!$title) {
3560  ilUtil::sendFailure($this->lng->txt("questionpool_not_entered"));
3561  return $this->copyAndLinkToQuestionpoolObject();
3562  }
3563 
3564  $ref_id = $this->createQuestionPool($title, $_REQUEST['description']);
3565  $_REQUEST['sel_qpl'] = $ref_id;
3566 
3567  //if ($_REQUEST['link'])
3568  //{
3570  //}
3571  //else
3572  //{
3573  // $this->copyQuestionsToPoolObject();
3574  //}
3575  }
copyAndLinkQuestionsToPoolObject()
ilObjectDataCache $ilObjDataCache
createQuestionPool($name="dummy", $description="")
Creates a new questionpool and returns the reference id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ createQuestionpoolTargetObject()

ilObjTestGUI::createQuestionpoolTargetObject (   $cmd)

Called when a new question should be created from a test Important: $cmd may be overwritten if no question pool is available.

public

Definition at line 3583 of file class.ilObjTestGUI.php.

References $DIC, getTabsManager(), getTargetQuestionpoolForm(), and ilTestTabsManager\SUBTAB_ID_QST_LIST_VIEW.

Referenced by copyAndLinkToQuestionpoolObject(), and copyToQuestionpoolObject().

3584  {
3585  global $DIC; /* @var \ILIAS\DI\Container $DIC */
3586 
3587  $this->getTabsManager()->getQuestionsSubTabs();
3589 
3590  $questionpools = $this->object->getAvailableQuestionpools(
3591  false,
3592  false,
3593  false,
3594  true,
3595  false,
3596  "write"
3597  );
3598 
3599  if (count($questionpools) == 0) {
3600  $form = $this->getTargetQuestionpoolForm($questionpools, 'createQuestionPoolAndCopy');
3601  } else {
3602  $form = $this->getTargetQuestionpoolForm($questionpools, $cmd);
3603 
3604  switch ($cmd) {
3605  case 'copyQuestionsToPool':
3606  break;
3607 
3608  case 'copyAndLinkQuestionsToPool':
3609  $hidden = new ilHiddenInputGUI('link');
3610  $hidden->setValue(1);
3611  $form->addItem($hidden);
3612  break;
3613  }
3614  }
3615 
3616  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
3617  }
This class represents a hidden form property in a property form.
global $DIC
Definition: goto.php:24
getTargetQuestionpoolForm($questionpools, $cmd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createRandomSelectionObject()

ilObjTestGUI::createRandomSelectionObject ( )

Definition at line 1669 of file class.ilObjTestGUI.php.

References $_POST, getTabsManager(), and ilTestTabsManager\SUBTAB_ID_QST_LIST_VIEW.

1670  {
1671  $this->getTabsManager()->getQuestionsSubTabs();
1673 
1674  $randomQuestionSelectionTable = new ilTestRandomQuestionSelectionTableGUI($this, 'createRandomSelection', $this->object);
1675 
1676  $this->tpl->setContent(
1677  $randomQuestionSelectionTable
1678  ->build((int) $_POST['nr_of_questions'], (int) $_POST['sel_qpl'])
1679  ->getHtml()
1680  );
1681  }
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteDefaultsObject()

ilObjTestGUI::deleteDefaultsObject ( )

Deletes selected test defaults.

Definition at line 2749 of file class.ilObjTestGUI.php.

References $_POST, and ilUtil\sendInfo().

2750  {
2751  if (isset($_POST['chb_defaults']) && is_array($_POST['chb_defaults']) && count($_POST['chb_defaults'])) {
2752  foreach ($_POST['chb_defaults'] as $test_default_id) {
2753  $this->object->deleteDefaults($test_default_id);
2754  }
2755  } else {
2756  ilUtil::sendInfo($this->lng->txt('select_one'));
2757  }
2758  $this->defaultsObject();
2759  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ determineObjectiveOrientedContainer()

ilObjTestGUI::determineObjectiveOrientedContainer ( )
protected

Definition at line 3977 of file class.ilObjTestGUI.php.

References ilObject\_getAllReferences(), and ilLOSettings\isObjectiveTest().

Referenced by executeCommand().

3978  {
3979  require_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php';
3980  $containerObjId = (int) ilLOSettings::isObjectiveTest($this->ref_id);
3981 
3982  $containerRefId = current(ilObject::_getAllReferences($containerObjId));
3983 
3984  $this->objectiveOrientedContainer->setObjId($containerObjId);
3985  $this->objectiveOrientedContainer->setRefId($containerRefId);
3986  }
static isObjectiveTest($a_trst_ref_id)
Check if test ref_id is used in an objective course.
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ download_paragraphObject()

ilObjTestGUI::download_paragraphObject ( )

download source code paragraph

Definition at line 1554 of file class.ilObjTestGUI.php.

References $_GET, and exit.

1555  {
1556  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1557  $pg_obj = new ilAssQuestionPage($_GET["pg_id"]);
1558  $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
1559  exit;
1560  }
exit
Definition: login.php:29
$_GET["client_id"]
Question page object.

◆ downloadFileObject()

ilObjTestGUI::downloadFileObject ( )

download file

Definition at line 1532 of file class.ilObjTestGUI.php.

References $_GET, and exit.

1533  {
1534  $file = explode("_", $_GET["file_id"]);
1535  include_once("./Modules/File/classes/class.ilObjFile.php");
1536  $fileObj = new ilObjFile($file[count($file) - 1], false);
1537  $fileObj->sendFile();
1538  exit;
1539  }
exit
Definition: login.php:29
$_GET["client_id"]

◆ executeCommand()

ilObjTestGUI::executeCommand ( )

execute command

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

References $_GET, $DIC, Vendor\Package\$e, $GLOBALS, $ilDB, ilObjectGUI\$ilErr, $ilUser, ilObjectGUI\$lng, $object, $ret, ilObjectGUI\$tpl, ilObjectGUI\$tree, assQuestionGUI\_getQuestionGUI(), ilObjectGUI\addHeaderAction(), buildPageViewToolbar(), ilAssQuestionPreviewGUI\CMD_SHOW, determineObjectiveOrientedContainer(), assQuestionGUI\EDIT_CONTEXT_AUTHORING, fetchAuthoringQuestionIdParameter(), forwardToEvaluationGUI(), ilObjStyleSheet\getContentStylePath(), ilObjectGUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), getObjectiveOrientedContainer(), ilObjStyleSheet\getSyntaxStylePath(), getTabsManager(), getTestAccess(), ilAssQuestionPreviewGUI\initQuestion(), ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ilObjectGUI\prepareOutput(), prepareSubGuiOutput(), questionsObject(), redirectAfterMissingRead(), redirectAfterMissingWrite(), assQuestionGUI\RENDER_PURPOSE_PREVIEW, ilUtil\sendFailure(), ilUtil\sendInfo(), ilLTIProviderObjectSettingGUI\setCustomRolesForSelection(), ilTestDashboardGUI\setTestAccess(), ilTestResultsGUI\setTestAccess(), ilUtil\stripSlashes(), ilTestTabsManager\SUBTAB_ID_QST_PAGE_VIEW, ilTestTabsManager\TAB_ID_EXPORT, ilTestTabsManager\TAB_ID_LEARNING_PROGRESS, ilTestTabsManager\TAB_ID_META_DATA, ilTestTabsManager\TAB_ID_PERMISSIONS, ilTestTabsManager\TAB_ID_SETTINGS, and trackTestObjectReadEvent().

164  {
165  global $DIC; /* @var ILIAS\DI\Container $DIC */
166  $ilAccess = $DIC['ilAccess'];
167  $ilNavigationHistory = $DIC['ilNavigationHistory'];
168  $ilCtrl = $DIC['ilCtrl'];
169  $ilErr = $DIC['ilErr'];
170  $tpl = $DIC['tpl'];
171  $lng = $DIC['lng'];
172  $ilTabs = $DIC['ilTabs'];
173  $ilPluginAdmin = $DIC['ilPluginAdmin'];
174  $ilDB = $DIC['ilDB'];
175  $tree = $DIC['tree'];
176  $ilias = $DIC['ilias'];
177  $ilUser = $DIC['ilUser'];
178 
179  $cmd = $this->ctrl->getCmd("infoScreen");
180 
181  $cmdsDisabledDueToOfflineStatus = array(
182  'resumePlayer', 'resumePlayer', 'outUserResultsOverview', 'outUserListOfAnswerPasses'
183  );
184 
185  if (!$this->getCreationMode() && $this->object->getOfflineStatus() && in_array($cmd, $cmdsDisabledDueToOfflineStatus)) {
186  $cmd = 'infoScreen';
187  }
188 
189  $next_class = $this->ctrl->getNextClass($this);
190  $this->ctrl->setReturn($this, "infoScreen");
191 
192  // add entry to navigation history
193  if (!$this->getCreationMode() &&
194  $ilAccess->checkAccess("read", "", $_GET["ref_id"])
195  ) {
196  $ilNavigationHistory->addItem(
197  $_GET["ref_id"],
198  "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $_GET["ref_id"],
199  "tst"
200  );
201  }
202 
203  // elba hack for storing question id for inserting new question after
204  if ($_REQUEST['prev_qid']) {
205  global $___prev_question_id;
206  $___prev_question_id = $_REQUEST['prev_qid'];
207  $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
208  }
209 
210  if (!$this->getCreationMode() && $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken()) {
211  if (!$this->testQuestionSetConfigFactory->getQuestionSetConfig()->isValidRequestOnBrokenQuestionSetDepencies($next_class, $cmd)) {
212  $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
213  }
214  }
215 
217 
218  switch ($next_class) {
219  case 'illtiproviderobjectsettinggui':
220  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
221  $this->redirectAfterMissingRead();
222  return;
223  }
224  $this->prepareOutput();
225  $this->addHeaderAction();
226  $this->tabsManager->getSettingsSubTabs();
227  $GLOBALS['DIC']->tabs()->activateTab('settings');
228  $GLOBALS['DIC']->tabs()->activateSubTab('lti_provider');
229  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
230  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
231  $lti_gui->offerLTIRolesForSelection(false);
232  $this->ctrl->forwardCommand($lti_gui);
233  break;
234 
235 
236  case 'iltestexportgui':
237  if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
238  $this->redirectAfterMissingWrite();
239  return;
240  }
241 
242  $this->prepareOutput();
243  $this->addHeaderAction();
244  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_EXPORT);
245  require_once 'Modules/Test/classes/class.ilTestExportGUI.php';
246  $ilCtrl->forwardCommand(new ilTestExportGUI($this));
247  break;
248 
249  case "ilinfoscreengui":
250  if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) && !$ilAccess->checkAccess("visible", "", $_GET["ref_id"])) {
251  $this->redirectAfterMissingRead();
252  return;
253  }
254  $this->prepareOutput();
255  $this->addHeaderAction();
256  $this->infoScreen(); // forwards command
257  break;
258  case 'ilobjectmetadatagui':
259  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
260  $this->redirectAfterMissingWrite();
261  return;
262  }
263 
264  $this->prepareOutput();
265  $this->addHeaderAction();
266  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_META_DATA);
267  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
268  $md_gui = new ilObjectMetaDataGUI($this->object);
269  $this->ctrl->forwardCommand($md_gui);
270  break;
271 
272  case 'iltestdashboardgui':
273  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
274  $this->redirectAfterMissingRead();
275  return;
276  }
277  $this->prepareOutput();
278  $this->addHeaderAction();
279 
280  require_once 'Modules/Test/classes/class.ilTestDashboardGUI.php';
281 
282  $gui = new ilTestDashboardGUI(
283  $this->object,
284  $this->testQuestionSetConfigFactory->getQuestionSetConfig()
285  );
286 
287  $gui->setTestAccess($this->getTestAccess());
288  $gui->setTestTabs($this->getTabsManager());
289  $gui->setObjectiveParent($this->getObjectiveOrientedContainer());
290 
291  $this->ctrl->forwardCommand($gui);
292  break;
293 
294  case 'iltestresultsgui':
295  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
296  $this->redirectAfterMissingRead();
297  return;
298  }
299  $this->prepareOutput();
300  $this->addHeaderAction();
301 
302  require_once 'Modules/Test/classes/class.ilTestResultsGUI.php';
303 
304  $gui = new ilTestResultsGUI(
305  $this->object,
306  $this->testQuestionSetConfigFactory->getQuestionSetConfig()
307  );
308 
309  $gui->setTestAccess($this->getTestAccess());
310  $gui->setTestSession($this->testSessionFactory->getSession());
311  $gui->setTestTabs($this->getTabsManager());
312  $gui->setObjectiveParent($this->getObjectiveOrientedContainer());
313 
314  $this->ctrl->forwardCommand($gui);
315  break;
316 
317  case "iltestplayerfixedquestionsetgui":
318  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
319  $this->redirectAfterMissingRead();
320  return;
321  }
322  $this->trackTestObjectReadEvent();
323  require_once "./Modules/Test/classes/class.ilTestPlayerFixedQuestionSetGUI.php";
324  if (!$this->object->getKioskMode()) {
325  $this->prepareOutput();
326  }
327  $gui = new ilTestPlayerFixedQuestionSetGUI($this->object);
328  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
329  $this->ctrl->forwardCommand($gui);
330  break;
331 
332  case "iltestplayerrandomquestionsetgui":
333  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
334  $this->redirectAfterMissingRead();
335  return;
336  }
337  $this->trackTestObjectReadEvent();
338  require_once "./Modules/Test/classes/class.ilTestPlayerRandomQuestionSetGUI.php";
339  if (!$this->object->getKioskMode()) {
340  $this->prepareOutput();
341  }
342  $gui = new ilTestPlayerRandomQuestionSetGUI($this->object);
343  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
344  $this->ctrl->forwardCommand($gui);
345  break;
346 
347  case "iltestplayerdynamicquestionsetgui":
348  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
349  $this->redirectAfterMissingRead();
350  return;
351  }
352  $this->trackTestObjectReadEvent();
353  require_once "./Modules/Test/classes/class.ilTestPlayerDynamicQuestionSetGUI.php";
354  if (!$this->object->getKioskMode()) {
355  $this->prepareOutput();
356  }
357  $gui = new ilTestPlayerDynamicQuestionSetGUI($this->object);
358  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
359  $this->ctrl->forwardCommand($gui);
360  break;
361 
362  case "iltestevaluationgui":
363  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
364  $this->redirectAfterMissingRead();
365  return;
366  }
367  $this->forwardToEvaluationGUI();
368  break;
369 
370  case "iltestevalobjectiveorientedgui":
371  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
372  $this->redirectAfterMissingRead();
373  return;
374  }
375  $this->forwardToEvalObjectiveOrientedGUI();
376  break;
377 
378  case "iltestservicegui":
379  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
380  $this->redirectAfterMissingRead();
381  return;
382  }
383  $this->prepareOutput();
384  $this->addHeaderAction();
385  require_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
386  $serviceGUI = new ilTestServiceGUI($this->object);
387  $this->ctrl->forwardCommand($serviceGUI);
388  break;
389 
390  case 'ilpermissiongui':
391  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
392  $this->redirectAfterMissingRead();
393  return;
394  }
395  $this->prepareOutput();
396  $this->addHeaderAction();
397  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_PERMISSIONS);
398  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
399  $perm_gui = new ilPermissionGUI($this);
400  $ret = $this->ctrl->forwardCommand($perm_gui);
401  break;
402 
403  case "illearningprogressgui":
404  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
405  $this->redirectAfterMissingRead();
406  return;
407  }
408  $this->prepareOutput();
409  $this->addHeaderAction();
410  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_LEARNING_PROGRESS);
411  require_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
412  $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
413  $this->ctrl->forwardCommand($new_gui);
414 
415  break;
416 
417  case "ilcertificategui":
418  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
419  $this->redirectAfterMissingRead();
420  return;
421  }
422  $this->prepareOutput();
423  $this->addHeaderAction();
424 
425  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_SETTINGS);
426 
427  $guiFactory = new ilCertificateGUIFactory();
428  $output_gui = $guiFactory->create($this->object);
429 
430  $this->ctrl->forwardCommand($output_gui);
431  break;
432 
433  case "iltestscoringgui":
434  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
435  $this->redirectAfterMissingRead();
436  return;
437  }
438  $this->prepareOutput();
439  $this->addHeaderAction();
440  require_once "./Modules/Test/classes/class.ilTestScoringGUI.php";
441  $output_gui = new ilTestScoringGUI($this->object);
442  $output_gui->setTestAccess($this->getTestAccess());
443  $this->ctrl->forwardCommand($output_gui);
444  break;
445 
446  case 'ilmarkschemagui':
447  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
448  $this->redirectAfterMissingRead();
449  return;
450  }
451  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
452  ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
453  $this->ctrl->redirect($this, 'infoScreen');
454  }
455  $this->prepareOutput();
456  $this->addHeaderAction();
457  require_once 'Modules/Test/classes/class.ilMarkSchemaGUI.php';
458  $mark_schema_gui = new ilMarkSchemaGUI($this->object);
459  $this->ctrl->forwardCommand($mark_schema_gui);
460  break;
461 
462  case 'iltestscoringbyquestionsgui':
463  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
464  $this->redirectAfterMissingRead();
465  return;
466  }
467  $this->prepareOutput();
468  $this->addHeaderAction();
469  include_once 'Modules/Test/classes/class.ilTestScoringByQuestionsGUI.php';
470  $output_gui = new ilTestScoringByQuestionsGUI($this->object);
471  $output_gui->setTestAccess($this->getTestAccess());
472  $this->ctrl->forwardCommand($output_gui);
473  break;
474 
475  case 'ilobjtestsettingsgeneralgui':
476  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
477  $this->redirectAfterMissingRead();
478  return;
479  }
480  $this->prepareOutput();
481  $this->addHeaderAction();
482  require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
483  $gui = new ilObjTestSettingsGeneralGUI(
484  $this->ctrl,
485  $ilAccess,
486  $this->lng,
487  $this->tree,
488  $ilDB,
489  $ilPluginAdmin,
490  $ilUser,
491  $this
492  );
493  $this->ctrl->forwardCommand($gui);
494  break;
495 
496  case 'ilobjtestsettingsscoringresultsgui':
497  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
498  $this->redirectAfterMissingRead();
499  return;
500  }
501  $this->prepareOutput();
502  $this->addHeaderAction();
503  require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php';
505  $this->ctrl,
506  $ilAccess,
507  $this->lng,
508  $this->tree,
509  $ilDB,
510  $ilPluginAdmin,
511  $this
512  );
513  $this->ctrl->forwardCommand($gui);
514  break;
515 
516  case 'ilobjtestfixedquestionsetconfiggui':
517  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
518  $this->redirectAfterMissingRead();
519  return;
520  }
521  $this->prepareOutput();
522  $this->addHeaderAction();
523  require_once 'Modules/Test/classes/class.ilTestFixedQuestionSetConfigGUI.php';
524  $gui = new ilObjTestDynamicQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
525  $this->ctrl->forwardCommand($gui);
526  break;
527 
528  case 'iltestrandomquestionsetconfiggui':
529  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
530  $this->redirectAfterMissingRead();
531  return;
532  }
533  $this->prepareOutput();
534  $this->addHeaderAction();
535  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetConfigGUI.php';
537  $this->ctrl,
538  $ilAccess,
539  $ilTabs,
540  $this->lng,
541  $this->tpl,
542  $ilDB,
543  $tree,
544  $ilPluginAdmin,
545  $this->object,
547  new ilSetting('assessment'),
548  $ilDB
549  ))->withContextId($this->object->getId())
550  );
551  $this->ctrl->forwardCommand($gui);
552  break;
553 
554  case 'ilobjtestdynamicquestionsetconfiggui':
555  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
556  $this->redirectAfterMissingRead();
557  return;
558  }
559  $this->prepareOutput();
560  $this->addHeaderAction();
561  require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfigGUI.php';
562  $gui = new ilObjTestDynamicQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
563  $this->ctrl->forwardCommand($gui);
564  break;
565 
566  case 'iltestquestionbrowsertablegui':
567  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
568  $this->redirectAfterMissingRead();
569  return;
570  }
571  $this->prepareOutput();
572  $this->addHeaderAction();
574  $this->ctrl,
575  $this->tpl,
576  $ilTabs,
577  $this->lng,
578  $tree,
579  $ilDB,
580  $ilPluginAdmin,
581  $this->object,
582  $ilAccess,
583  $DIC['refinery'],
584  $DIC['ui.factory'],
585  $DIC['ui.renderer']
586  );
587  $gui->setWriteAccess($ilAccess->checkAccess("write", "", $this->ref_id));
588  $gui->init();
589  $this->ctrl->forwardCommand($gui);
590  break;
591 
592  case 'iltestskilladministrationgui':
593  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
594  $this->redirectAfterMissingRead();
595  return;
596  }
597  $this->prepareOutput();
598  $this->addHeaderAction();
599  require_once 'Modules/Test/classes/class.ilTestSkillAdministrationGUI.php';
600  $gui = new ilTestSkillAdministrationGUI($ilias, $this->ctrl, $ilAccess, $ilTabs, $this->tpl, $this->lng, $this->refinery, $ilDB, $tree, $ilPluginAdmin, $this->object, $this->ref_id);
601  $this->ctrl->forwardCommand($gui);
602  break;
603 
604  case 'ilobjectcopygui':
605  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
606  $this->redirectAfterMissingRead();
607  return;
608  }
609  $this->prepareOutput();
610  $this->addHeaderAction();
611  require_once './Services/Object/classes/class.ilObjectCopyGUI.php';
612  $cp = new ilObjectCopyGUI($this);
613  $cp->setType('tst');
614  $this->ctrl->forwardCommand($cp);
615  break;
616 
617  case 'ilpageeditorgui':
618  case 'iltestexpresspageobjectgui':
619  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
620  $this->redirectAfterMissingRead();
621  return;
622  }
623  $this->getTabsManager()->getQuestionsSubTabs();
625 
626  require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
627  $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
628  $incompleteQuestionPurger->setOwnerId($ilUser->getId());
629  $incompleteQuestionPurger->purge();
630 
631  try {
632  $qid = $this->fetchAuthoringQuestionIdParameter();
633  } catch (ilTestException $e) {
634  $qid = 0;
635  }
636 
637  $this->prepareOutput();
638  if (!in_array($cmd, array('addQuestion', 'browseForQuestions'))) {
639  $this->buildPageViewToolbar($qid);
640  }
641 
642  if (!$qid || in_array($cmd, array('insertQuestions', 'browseForQuestions'))) {
643  require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
644  $pageObject = new ilTestExpressPageObjectGUI(0);
645  $pageObject->test_object = $this->object;
646  $ret = &$this->ctrl->forwardCommand($pageObject);
647  $this->tpl->setContent($ret);
648  break;
649  }
650  require_once "./Services/Style/Content/classes/class.ilObjStyleSheet.php";
651  $this->tpl->setCurrentBlock("ContentStyle");
652  $this->tpl->setVariable(
653  "LOCATION_CONTENT_STYLESHEET",
655  );
656  $this->tpl->parseCurrentBlock();
657 
658  // syntax style
659  $this->tpl->setCurrentBlock("SyntaxStyle");
660  $this->tpl->setVariable(
661  "LOCATION_SYNTAX_STYLESHEET",
663  );
664  $this->tpl->parseCurrentBlock();
665  require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
666 
667  $q_gui = assQuestionGUI::_getQuestionGUI("", $qid);
668  if (!($q_gui instanceof assQuestionGUI)) {
669  $this->ctrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', '');
670  $this->ctrl->redirectByClass('iltestexpresspageobjectgui', $this->ctrl->getCmd());
671  }
672 
673  $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
674 
675  $q_gui->outAdditionalOutput();
676  $q_gui->object->setObjId($this->object->getId());
677 
678  $q_gui->setTargetGuiClass(null);
679  $q_gui->setQuestionActionCmd(null);
680 
681  $question = $q_gui->object;
682  $this->ctrl->saveParameter($this, "q_id");
683 
684  #$this->lng->loadLanguageModule("content");
685  $this->ctrl->setReturnByClass("ilTestExpressPageObjectGUI", "view");
686  $this->ctrl->setReturn($this, "questions");
687 
688  require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
689  require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
690 
691  $page_gui = new ilTestExpressPageObjectGUI($qid);
692  $page_gui->test_object = $this->object;
693  $page_gui->setEditPreview(true);
694  $page_gui->setEnabledTabs(false);
695  if (strlen($this->ctrl->getCmd()) == 0) {
696  $this->ctrl->setCmdClass(get_class($page_gui));
697  $this->ctrl->setCmd("preview");
698  }
699 
700  $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(true)));
701  $page_gui->setTemplateTargetVar("ADM_CONTENT");
702 
703  $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
704 
705  $page_gui->setHeader($question->getTitle());
706  $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile"));
707  $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "fullscreen"));
708  $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this));
709  $page_gui->setPresentationTitle($question->getTitle() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
710  $ret = $this->ctrl->forwardCommand($page_gui);
711  if ($ret != "") {
712  $tpl->setContent($ret);
713  }
714 
715  global $DIC;
716  $ilTabs = $DIC['ilTabs'];
717  $ilTabs->activateTab('assQuestions');
718 
719  break;
720 
721  case 'ilassquestionpreviewgui':
722  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
723  $this->redirectAfterMissingWrite();
724  }
725  $this->prepareOutput();
726 
727  $this->ctrl->saveParameter($this, "q_id");
728 
729  $gui = new ilAssQuestionPreviewGUI(
730  $this->ctrl,
731  $this->tabs_gui,
732  $this->tpl,
733  $this->lng,
734  $ilDB,
735  $ilUser,
736  $DIC->rbac()
737  );
738 
739  $gui->initQuestion($this->fetchAuthoringQuestionIdParameter(), $this->object->getId());
740  $gui->initPreviewSettings($this->object->getRefId());
741  $gui->initPreviewSession($ilUser->getId(), (int) $_GET['q_id']);
742  $gui->initHintTracking();
743  $gui->initStyleSheets();
744 
745  $this->ctrl->forwardCommand($gui);
746 
747  break;
748 
749  case 'ilassquestionpagegui':
750  if ($cmd == 'finishEditing') {
751  $this->ctrl->redirectByClass('ilassquestionpreviewgui', 'show');
752  break;
753  }
754  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
755  $this->redirectAfterMissingRead();
756  return;
757  }
758  if ($cmd === 'edit' && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
759  $this->redirectAfterMissingWrite();
760  }
761  $_GET['q_id'] = $this->fetchAuthoringQuestionIdParameter();
762  $this->prepareOutput();
763  require_once 'Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php';
764  $forwarder = new ilAssQuestionPageCommandForwarder();
765  $forwarder->setTestObj($this->object);
766  $forwarder->forward();
767  break;
768 
769  case 'ilassspecfeedbackpagegui':
770  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
771  $this->redirectAfterMissingRead();
772  return;
773  }
774  require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php";
775  $pg_gui = new ilAssSpecFeedbackPageGUI((int) $_GET["feedback_id"]);
776  $this->ctrl->forwardCommand($pg_gui);
777  break;
778 
779  case 'ilassgenfeedbackpagegui':
780  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
781  $this->redirectAfterMissingRead();
782  return;
783  }
784  require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php";
785  $pg_gui = new ilAssGenFeedbackPageGUI((int) $_GET["feedback_id"]);
786  $this->ctrl->forwardCommand($pg_gui);
787  break;
788 
789  case 'illocalunitconfigurationgui':
790  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
791  $this->redirectAfterMissingRead();
792  return;
793  }
794  $this->prepareSubGuiOutput();
795 
796  // set return target
797  $this->ctrl->setReturn($this, "questions");
798 
799  // set context tabs
800  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
802  $questionGUI->object->setObjId($this->object->getId());
803  $questionGUI->setQuestionTabs();
804 
805  require_once 'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
806  require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
807  $gui = new ilLocalUnitConfigurationGUI(
808  new ilUnitConfigurationRepository((int) $_GET['q_id'])
809  );
810  $this->ctrl->forwardCommand($gui);
811  break;
812 
813  case "ilcommonactiondispatchergui":
814  if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) && !$ilAccess->checkAccess("visible", "", $_GET["ref_id"])) {
815  $this->redirectAfterMissingRead();
816  return;
817  }
818  $this->prepareOutput();
819  require_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
821  $this->ctrl->forwardCommand($gui);
822  break;
823 
824  case 'ilassquestionhintsgui':
825  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
826  $this->redirectAfterMissingWrite();
827  }
828  $this->prepareSubGuiOutput();
829 
830  // set return target
831  $this->ctrl->setReturn($this, "questions");
832 
833  // set context tabs
834  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
836  $questionGUI->object->setObjId($this->object->getId());
837  $questionGUI->setQuestionTabs();
838 
839  if ($questionGUI->object->isInActiveTest()) {
840  ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true);
841  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
842  }
843 
844  // forward to ilAssQuestionHintsGUI
845  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
846  $gui = new ilAssQuestionHintsGUI($questionGUI);
847 
848  $gui->setEditingEnabled(
849  $DIC->access()->checkAccess('write', '', $this->object->getRefId())
850  );
851 
852  $ilCtrl->forwardCommand($gui);
853 
854  break;
855 
856  case 'ilassquestionfeedbackeditinggui':
857  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
858  $this->redirectAfterMissingWrite();
859  }
860  $this->prepareSubGuiOutput();
861 
862  // set return target
863  $this->ctrl->setReturn($this, "questions");
864 
865  // set context tabs
866  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
868  $questionGUI->object->setObjId($this->object->getId());
869  $questionGUI->setQuestionTabs();
870 
871  if ($questionGUI->object->isInActiveTest()) {
872  ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true);
873  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
874  }
875 
876  // forward to ilAssQuestionFeedbackGUI
877  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
878  $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
879  $ilCtrl->forwardCommand($gui);
880 
881  break;
882 
883  case 'iltestcorrectionsgui':
884  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
885  $this->redirectAfterMissingRead();
886  return;
887  }
888  $this->prepareOutput();
889  require_once './Modules/Test/classes/class.ilTestCorrectionsGUI.php';
890  $gui = new ilTestCorrectionsGUI($DIC, $this->object);
891  $this->ctrl->forwardCommand($gui);
892  break;
893 
894  case '':
895  case 'ilobjtestgui':
896  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) && !$ilAccess->checkAccess("visible", "", $_GET["ref_id"]))) {
897  $this->redirectAfterMissingRead();
898  return;
899  }
900  $this->prepareOutput();
901  $this->addHeaderAction();
902  if ((strcmp($cmd, "properties") == 0) && ($_GET["browse"])) {
903  $this->questionBrowser();
904  return;
905  }
906  if ((strcmp($cmd, "properties") == 0) && ($_GET["up"] || $_GET["down"])) {
907  $this->questionsObject();
908  return;
909  }
910  $cmd .= "Object";
911  $ret = &$this->$cmd();
912  break;
913  default:
914  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) {
915  $this->redirectAfterMissingRead();
916  return;
917  }
918  if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
919  $this->redirectAfterMissingWrite();
920  }
921  // elba hack for storing question id for inserting new question after
922  if ($_REQUEST['prev_qid']) {
923  global $___prev_question_id;
924  $___prev_question_id = $_REQUEST['prev_qid'];
925  $this->ctrl->setParameterByClass('ilassquestionpagegui', 'prev_qid', $_REQUEST['prev_qid']);
926  $this->ctrl->setParameterByClass($_GET['sel_question_types'] . 'gui', 'prev_qid', $_REQUEST['prev_qid']);
927  }
928  $this->create_question_mode = true;
929  $this->prepareOutput();
930 
931  $this->ctrl->setReturn($this, "questions");
932 
933  try {
934  $qid = $this->fetchAuthoringQuestionIdParameter();
935 
936  $questionGui = assQuestionGUI::_getQuestionGUI(
937  ilUtil::stripSlashes($_GET['sel_question_types'] ?? ''),
938  $qid
939  );
940 
941  $questionGui->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING);
942  $questionGui->object->setObjId($this->object->getId());
943 
944  if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && $questionGui->object->isInActiveTest()) {
945  ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true);
946  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
947  }
948 
949  $questionGuiClass = get_class($questionGui);
950  $this->ctrl->setParameterByClass($questionGuiClass, 'prev_qid', $_REQUEST['prev_qid']);
951  $this->ctrl->setParameterByClass($questionGuiClass, 'test_ref_id', $_REQUEST['ref_id']);
952  $this->ctrl->setParameterByClass($questionGuiClass, 'q_id', $qid);
953 
954  if (isset($_REQUEST['test_express_mode'])) {
955  $this->ctrl->setParameterByClass($questionGuiClass, 'test_express_mode', 1);
956  }
957 
958  if (!$questionGui->isSaveCommand()) {
959  $_GET['calling_test'] = $this->object->getRefId();
960  }
961 
962  $questionGui->setQuestionTabs();
963 
964  $this->ctrl->forwardCommand($questionGui);
965  } catch (ilTestException $e) {
966  if (isset($_REQUEST['test_express_mode'])) {
967  $this->ctrl->redirect($this, 'showPage');
968  } else {
969  $this->ctrl->redirect($this, 'questions');
970  }
971  }
972  break;
973  }
974  if (!in_array(strtolower($_GET["baseClass"]), array('iladministrationgui', 'ilrepositorygui')) &&
975  $this->getCreationMode() != true) {
976  $this->tpl->printToStdout();
977  }
978  }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
Class ilObjectMetaDataGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for the workflow of copying objects.
Generic feedback page GUI class.
$_GET["client_id"]
buildPageViewToolbar($qid=0)
Questions per page.
getLocalRoles($a_exclude=array())
Class ilUnitConfigurationRepository.
Scoring class for tests.
Base Exception for all Exceptions relating to Modules/Test.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
prepareSubGuiOutput()
prepares ilias to get output rendered by sub gui class
setCustomRolesForSelection($a_roles)
Set custom roles for mapping to LTI roles.
prepareOutput($a_show_subobjects=true)
prepare output
GUI class for LTI provider object settings.
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getSyntaxStylePath()
get syntax style path
Basic GUI class for assessment questions.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Specific feedback page GUI class.
global $ilDB
$ret
Definition: parser.php:6
initQuestion($questionId, $parentObjId)
getCreationMode()
get creation mode
Class ilLocalUnitConfigurationGUI.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilUser
Definition: imgupload.php:18
addHeaderAction()
Add header action menu.
infoScreen()
Show info screen.
ilTestExpressPageObjectGUI: assMultipleChoiceGUI, assClozeTestGUI, assMatchingQuestionGUI ilTestExpr...
Class ilObjUserTrackingGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ executeCreateQuestionObject()

ilObjTestGUI::executeCreateQuestionObject ( )

Called when a new question should be created from a test after confirmation.

public

Definition at line 1723 of file class.ilObjTestGUI.php.

References $_GET, $_SESSION, ilUtil\appendUrlParameterString(), createQuestionObject(), createQuestionPool(), exit, ilObjQuestionPool\getQuestionTypeByTypeId(), ilUtil\redirect(), and ilUtil\sendInfo().

1724  {
1725  $qpl_ref_id = $_REQUEST["sel_qpl"];
1726 
1727  $qpl_mode = 1;
1728  if (array_key_exists('usage', $_REQUEST) && is_numeric($_REQUEST['usage'])) {
1729  $qpl_mode = $_REQUEST['usage'];
1730  }
1731 
1732  if (isset($_REQUEST['qtype'])) {
1733  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
1734  $sel_question_types = ilObjQuestionPool::getQuestionTypeByTypeId($_REQUEST["qtype"]);
1735  } elseif (isset($_REQUEST['sel_question_types'])) {
1736  $sel_question_types = $_REQUEST["sel_question_types"];
1737  }
1738 
1739  if (($qpl_mode == 2 && strcmp($_REQUEST["txt_qpl"], "") == 0) ||
1740  ($qpl_mode == 3 && strcmp($qpl_ref_id, "") == 0)) {
1741  // Mantis #14890
1742  $_REQUEST['sel_question_types'] = $sel_question_types;
1743  ilUtil::sendInfo($this->lng->txt("questionpool_not_entered"));
1744  $this->createQuestionObject();
1745  return;
1746  } else {
1747  $_SESSION["test_id"] = $this->object->getRefId();
1748  if ($qpl_mode == 2 && strcmp($_REQUEST["txt_qpl"], "") != 0) {
1749  // create a new question pool and return the reference id
1750  $qpl_ref_id = $this->createQuestionPool($_REQUEST["txt_qpl"]);
1751  } elseif ($qpl_mode == 1) {
1752  $qpl_ref_id = $_GET["ref_id"];
1753  }
1754 
1755  $baselink = "ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $qpl_ref_id . "&cmd=createQuestionForTest&test_ref_id=" . $_GET["ref_id"] . "&calling_test=" . $_GET["ref_id"] . "&sel_question_types=" . $sel_question_types;
1756 
1757  if (isset($_REQUEST['prev_qid'])) {
1758  $baselink .= '&prev_qid=' . $_REQUEST['prev_qid'];
1759  } elseif (isset($_REQUEST['position'])) {
1760  $baselink .= '&prev_qid=' . $_REQUEST['position'];
1761  }
1762 
1763  if ($_REQUEST['test_express_mode']) {
1764  $baselink .= '&test_express_mode=1';
1765  }
1766 
1767  if (isset($_REQUEST['add_quest_cont_edit_mode'])) {
1769  $baselink,
1770  "add_quest_cont_edit_mode={$_REQUEST['add_quest_cont_edit_mode']}",
1771  false
1772  );
1773  }
1774 
1775  ilUtil::redirect($baselink);
1776 
1777  exit();
1778  }
1779  }
exit
Definition: login.php:29
createQuestionObject()
Called when a new question should be created from a test.
$_SESSION["AccountId"]
$_GET["client_id"]
static getQuestionTypeByTypeId($type_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
createQuestionPool($name="dummy", $description="")
Creates a new questionpool and returns the reference id.
static redirect($a_script)
+ Here is the call graph for this function:

◆ exportObject()

ilObjTestGUI::exportObject ( )
protected

Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::export()

Definition at line 1016 of file class.ilObjTestGUI.php.

References $DIC.

1017  {
1018  global $DIC; /* @var ILIAS\DI\Container $DIC */
1019  $DIC->ctrl()->redirectByClass('ilTestExportGUI');
1020  }
global $DIC
Definition: goto.php:24

◆ fetchAuthoringQuestionIdParameter()

ilObjTestGUI::fetchAuthoringQuestionIdParameter ( )
protected
Returns
int
Exceptions
ilTestException

Definition at line 1026 of file class.ilObjTestGUI.php.

References $_GET, $_POST, and $keys.

Referenced by executeCommand().

1027  {
1028  $qid = $_REQUEST['q_id'];
1029 
1030  if (!$qid || $qid == 'Array') {
1031  $questions = $this->object->getQuestionTitlesAndIndexes();
1032 
1033  $keys = array_keys($questions);
1034  $qid = (int) ($keys[0] ?? 0);
1035 
1036  $_REQUEST['q_id'] = $qid;
1037  $_GET['q_id'] = $qid;
1038  $_POST['q_id'] = $qid;
1039  }
1040 
1041  if ($this->object->checkQuestionParent($qid)) {
1042  return $qid;
1043  }
1044 
1045  throw new ilTestException('question id does not relate to parent object!');
1046  }
$_GET["client_id"]
Base Exception for all Exceptions relating to Modules/Test.
$keys
Definition: metadata.php:187
$_POST["username"]
+ Here is the caller graph for this function:

◆ filterObject()

ilObjTestGUI::filterObject ( )

Sets the filter for the question browser.

Sets the filter for the question browser

public

Definition at line 1569 of file class.ilObjTestGUI.php.

1570  {
1571  $this->questionBrowser();
1572  }

◆ forwardToEvaluationGUI()

ilObjTestGUI::forwardToEvaluationGUI ( )
private

Definition at line 1118 of file class.ilObjTestGUI.php.

References ilObjectGUI\addHeaderAction(), getObjectiveOrientedContainer(), getTestAccess(), and ilObjectGUI\prepareOutput().

Referenced by executeCommand(), and userResultsGatewayObject().

1119  {
1120  $this->prepareOutput();
1121  $this->addHeaderAction();
1122 
1123  require_once 'Modules/Test/classes/class.ilTestEvaluationGUI.php';
1124  $gui = new ilTestEvaluationGUI($this->object);
1125  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
1126  $gui->setTestAccess($this->getTestAccess());
1127 
1128  $this->ctrl->forwardCommand($gui);
1129  }
prepareOutput($a_show_subobjects=true)
prepare output
Output class for assessment test evaluation.
addHeaderAction()
Add header action menu.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fullscreenObject()

ilObjTestGUI::fullscreenObject ( )

show fullscreen view

Definition at line 1544 of file class.ilObjTestGUI.php.

References $_GET.

1545  {
1546  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
1547  $page_gui = new ilAssQuestionPageGUI($_GET["pg_id"]);
1548  $page_gui->showMediaFullscreen();
1549  }
$_GET["client_id"]
Question page GUI class.

◆ getObjectiveOrientedContainer()

ilObjTestGUI::getObjectiveOrientedContainer ( )
protected

Definition at line 3988 of file class.ilObjTestGUI.php.

References $objectiveOrientedContainer.

Referenced by executeCommand(), forwardToEvaluationGUI(), getTabs(), and redirectToInfoScreenObject().

3989  {
3991  }
+ Here is the caller graph for this function:

◆ getQuestionpoolCreationForm()

ilObjTestGUI::getQuestionpoolCreationForm ( )
private

Definition at line 3484 of file class.ilObjTestGUI.php.

References $DIC, and ilObjectGUI\$lng.

3485  {
3486  global $DIC;
3487  $lng = $DIC['lng'];
3488  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
3489  $form = new ilPropertyFormGUI();
3490 
3491  $title = new ilTextInputGUI($lng->txt('title'), 'title');
3492  $title->setRequired(true);
3493  $form->addItem($title);
3494 
3495  $description = new ilTextAreaInputGUI($lng->txt('description'), 'description');
3496  $form->addItem($description);
3497 
3498  $form->addCommandButton('createQuestionPoolAndCopy', $lng->txt('create'));
3499 
3500  if (isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id'])) {
3501  foreach ($_REQUEST['q_id'] as $id) {
3502  $hidden = new ilHiddenInputGUI('q_id[]');
3503  $hidden->setValue($id);
3504  $form->addItem($hidden);
3505  }
3506  }
3507 
3508  return $form;
3509  }
This class represents a property form user interface.
This class represents a hidden form property in a property form.
global $DIC
Definition: goto.php:24
This class represents a text area property in a property form.

◆ getTabs()

ilObjTestGUI::getTabs ( )

adds tabs to tab gui object

Parameters
ilTabsGUI$tabs_gui

Definition at line 3159 of file class.ilObjTestGUI.php.

References $DIC, ilLink\_getLink(), getObjectiveOrientedContainer(), and getTabsManager().

3160  {
3161  global $DIC;
3162  $help = $DIC['ilHelp'];
3163  $help->setScreenIdComponent("tst");
3164 
3165  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
3166  require_once 'Services/Link/classes/class.ilLink.php';
3167  $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
3168  $this->getTabsManager()->setParentBackLabel($this->lng->txt('back_to_objective_container'));
3169  $this->getTabsManager()->setParentBackHref($courseLink);
3170  }
3171 
3172  $this->getTabsManager()->perform();
3173  }
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ getTabsManager()

ilObjTestGUI::getTabsManager ( )

◆ getTargetQuestionpoolForm()

ilObjTestGUI::getTargetQuestionpoolForm (   $questionpools,
  $cmd 
)
protected

Definition at line 3619 of file class.ilObjTestGUI.php.

References $DIC, and ilFormPropertyGUI\setTitle().

Referenced by createQuestionpoolTargetObject().

3620  {
3621  global $DIC; /* @var \ILIAS\DI\Container $DIC */
3622 
3623  $form = new ilPropertyFormGUI();
3624  $form->setFormAction($DIC->ctrl()->getFormAction($this));
3625  $form->addCommandButton($cmd, $DIC->language()->txt('submit'));
3626  $form->addCommandButton('cancelCreateQuestion', $DIC->language()->txt('cancel'));
3627 
3628  if (count($questionpools) == 0) {
3629  $form->setTitle($this->lng->txt("tst_enter_questionpool"));
3630 
3631  $title = new ilTextInputGUI($DIC->language()->txt('title'), 'title');
3632  $title->setRequired(true);
3633  $form->addItem($title);
3634 
3635  $description = new ilTextAreaInputGUI($DIC->language()->txt('description'), 'description');
3636  $form->addItem($description);
3637  } else {
3638  $form->setTitle($this->lng->txt("tst_select_questionpool"));
3639 
3640  $selectOptions = [
3641  '' => $DIC->language()->txt('please_select')
3642  ];
3643 
3644  foreach ($questionpools as $key => $value) {
3645  $selectOptions[$key] = $value["title"];
3646  }
3647 
3648  $select = new ilSelectInputGUI($DIC->language()->txt('tst_source_question_pool'), 'sel_qpl');
3649  $select->setRequired(true);
3650  $select->setOptions($selectOptions);
3651 
3652  $form->addItem($select);
3653  }
3654 
3655  if (isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id'])) {
3656  foreach ($_REQUEST['q_id'] as $id) {
3657  $hidden = new ilHiddenInputGUI('q_id[]');
3658  $hidden->setValue($id);
3659  $form->addItem($hidden);
3660  }
3661  }
3662 
3663  return $form;
3664  }
This class represents a property form user interface.
This class represents a hidden form property in a property form.
setTitle($a_title)
Set Title.
global $DIC
Definition: goto.php:24
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestAccess()

ilObjTestGUI::getTestAccess ( )
Returns
ilTestAccess

Definition at line 1089 of file class.ilObjTestGUI.php.

References $testAccess.

Referenced by executeCommand(), and forwardToEvaluationGUI().

1090  {
1091  return $this->testAccess;
1092  }
+ Here is the caller graph for this function:

◆ historyObject()

ilObjTestGUI::historyObject ( )

Creates the change history for a test.

Creates the change history for a test

public

Definition at line 2458 of file class.ilObjTestGUI.php.

References $DIC, $log, ilObjAssessmentFolder\_getLog(), and ilTestTabsManager\TAB_ID_HISTORY.

2459  {
2460  global $DIC; /* @var ILIAS\DI\Container $DIC */
2461 
2462  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_HISTORY);
2463 
2464  include_once "./Modules/Test/classes/tables/class.ilTestHistoryTableGUI.php";
2465  $table_gui = new ilTestHistoryTableGUI($this, 'history');
2466  $table_gui->setTestObject($this->object);
2467  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
2468  $log = ilObjAssessmentFolder::_getLog(0, time(), $this->object->getId(), true);
2469  $table_gui->setData($log);
2470  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2471  }
$log
Definition: result.php:15
global $DIC
Definition: goto.php:24
static _getLog($ts_from, $ts_to, $test_id, $test_only=false)
Retrieve assessment log datasets from the database.
+ Here is the call graph for this function:

◆ importFileObject()

ilObjTestGUI::importFileObject (   $parent_id = null,
  $a_catch_errors = true 
)
protected

form for new test object import

Definition at line 1175 of file class.ilObjTestGUI.php.

References ilObjectGUI\checkPermissionBool(), initImportForm(), and uploadTstObject().

1176  {
1177  if (!$this->checkPermissionBool("create", "", $_REQUEST["new_type"])) {
1178  $this->error->raiseError($this->lng->txt("no_create_permission"));
1179  }
1180 
1181  $form = $this->initImportForm($_REQUEST["new_type"]);
1182  if ($form->checkInput()) {
1183  $this->ctrl->setParameter($this, "new_type", $this->type);
1184  $this->uploadTstObject();
1185  return;
1186  }
1187 
1188  // display form to correct errors
1189  $form->setValuesByPost();
1190  $this->tpl->setContent($form->getHTML());
1191  }
initImportForm($a_new_type)
uploadTstObject()
imports test and question(s)
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
+ Here is the call graph for this function:

◆ importVerifiedFileObject()

ilObjTestGUI::importVerifiedFileObject ( )

imports question(s) into the questionpool (after verification)

Definition at line 1437 of file class.ilObjTestGUI.php.

References $_GET, $_POST, $_SESSION, $result, $results, ilObjTest\_getImportDirectory(), ilUtil\delDir(), IL_MO_PARSE_QTI, and ilUtil\redirect().

Referenced by uploadTstObject().

1438  {
1439  include_once "./Modules/Test/classes/class.ilObjTest.php";
1440  // create new questionpool object
1441  $newObj = new ilObjTest(0, true);
1442  // set type of questionpool object
1443  $newObj->setType($_GET["new_type"]);
1444  // set title of questionpool object to "dummy"
1445  $newObj->setTitle("dummy");
1446  // set description of questionpool object
1447  $newObj->setDescription("test import");
1448  // create the questionpool class in the ILIAS database (object_data table)
1449  $newObj->create(true);
1450  // create a reference for the questionpool object in the ILIAS database (object_reference table)
1451  $newObj->createReference();
1452  // put the questionpool object in the administration tree
1453  $newObj->putInTree($_GET["ref_id"]);
1454  // get default permissions and set the permissions for the questionpool object
1455  $newObj->setPermissions($_GET["ref_id"]);
1456  // empty mark schema
1457  $newObj->mark_schema->flush();
1458 
1459  // start parsing of QTI files
1460  include_once "./Services/QTI/classes/class.ilQTIParser.php";
1461 
1462  // Handle selection of "no questionpool" as qpl_id = -1 -> use test object id instead.
1463  // possible hint: chek if empty strings in $_POST["qpl_id"] relates to a bug or not
1464  if (!isset($_POST["qpl"]) || "-1" === (string) $_POST["qpl"]) {
1465  $questionParentObjId = $newObj->getId();
1466  } else {
1467  $questionParentObjId = $_POST["qpl"];
1468  }
1469 
1470  if (is_file($_SESSION["tst_import_dir"] . '/' . $_SESSION["tst_import_subdir"] . "/manifest.xml")) {
1471  $newObj->saveToDb();
1472 
1473  $_SESSION['tst_import_idents'] = $_POST['ident'];
1474  $_SESSION['tst_import_qst_parent'] = $questionParentObjId;
1475 
1476  $fileName = $_SESSION['tst_import_subdir'] . '.zip';
1477  $fullPath = $_SESSION['tst_import_dir'] . '/' . $fileName;
1478 
1479  include_once("./Services/Export/classes/class.ilImport.php");
1480  $imp = new ilImport((int) $_GET["ref_id"]);
1481  $map = $imp->getMapping();
1482  $map->addMapping('Modules/Test', 'tst', 'new_id', $newObj->getId());
1483  $imp->importObject($newObj, $fullPath, $fileName, 'tst', 'Modules/Test', true);
1484  } else {
1485  $qtiParser = new ilQTIParser($_SESSION["tst_import_qti_file"], IL_MO_PARSE_QTI, $questionParentObjId, $_POST["ident"]);
1486  if (!isset($_POST["ident"]) || !is_array($_POST["ident"]) || !count($_POST["ident"])) {
1487  $qtiParser->setIgnoreItemsEnabled(true);
1488  }
1489  $qtiParser->setTestObject($newObj);
1490  $result = $qtiParser->startParsing();
1491  $newObj->saveToDb();
1492 
1493  // import page data
1494  $contParser = new ilQuestionPageParser($newObj, $_SESSION["tst_import_xml_file"], $_SESSION["tst_import_subdir"]);
1495  $contParser->setQuestionMapping($qtiParser->getImportMapping());
1496  $contParser->startParsing();
1497 
1498  if (isset($_POST["ident"]) && is_array($_POST["ident"]) && count($_POST["ident"]) == $qtiParser->getNumImportedItems()) {
1499  // import test results
1500  if (@file_exists($_SESSION["tst_import_results_file"])) {
1501  include_once("./Modules/Test/classes/class.ilTestResultsImportParser.php");
1502  $results = new ilTestResultsImportParser($_SESSION["tst_import_results_file"], $newObj);
1503  $results->setQuestionIdMapping($qtiParser->getQuestionIdMapping());
1504  $results->startParsing();
1505  }
1506  }
1507  $newObj->update();
1508  }
1509 
1510 
1511  // delete import directory
1513 
1514  ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
1515  ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilObjTestGUI");
1516  }
$_SESSION["AccountId"]
$result
$_GET["client_id"]
Import class.
const IL_MO_PARSE_QTI
Legacy Content Object Parser.
$results
static redirect($a_script)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
$_POST["username"]
static _getImportDirectory()
Get the import directory location of the test.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjTestGUI::infoScreenObject ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

Definition at line 2885 of file class.ilObjTestGUI.php.

2886  {
2887  #if( !include 'competenzenRocker.php' ) exit;
2888 
2889  $this->ctrl->setCmd("showSummary");
2890  $this->ctrl->setCmdClass("ilinfoscreengui");
2891  $this->infoScreen();
2892  }
infoScreen()
Show info screen.

◆ initImportForm()

ilObjTestGUI::initImportForm (   $a_new_type)

Definition at line 2473 of file class.ilObjTestGUI.php.

References $_GET, $_POST, and ilFileInputGUI\setSuffixes().

Referenced by importFileObject().

2474  {
2475  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2476  $form = new ilPropertyFormGUI();
2477  $form->setTarget("_top");
2478  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
2479  $this->ctrl->setParameter($this, "new_type", $new_type);
2480  $form->setFormAction($this->ctrl->getFormAction($this));
2481  $form->setTitle($this->lng->txt("import_tst"));
2482 
2483  // file
2484  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
2485  $fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc");
2486  $fi->setSuffixes(array("zip"));
2487  $fi->setRequired(true);
2488  $form->addItem($fi);
2489 
2490  // question pool
2491  include_once("./Modules/Test/classes/class.ilObjTest.php");
2492  $tst = new ilObjTest();
2493  $questionpools = $tst->getAvailableQuestionpools(true, false, true, true);
2494  if (count($questionpools)) {
2495  $options = array("-1" => $this->lng->txt("dont_use_questionpool"));
2496  foreach ($questionpools as $key => $value) {
2497  $options[$key] = $value["title"];
2498  }
2499 
2500  $pool = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "qpl");
2501  $pool->setInfo($this->lng->txt('select_question_pool_info'));
2502  $pool->setOptions($options);
2503  $form->addItem($pool);
2504  }
2505 
2506  $form->addCommandButton("importFile", $this->lng->txt("import"));
2507  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
2508 
2509  return $form;
2510  }
This class represents a property form user interface.
$_GET["client_id"]
This class represents a file property in a property form.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestionsAfterObject()

ilObjTestGUI::insertQuestionsAfterObject ( )

Insert checked questions after the actual selection.

Definition at line 2091 of file class.ilObjTestGUI.php.

References $_POST, $_SESSION, and ilUtil\sendFailure().

2092  {
2093  // get all questions to move
2094  $move_questions = $_SESSION['tst_qst_move_' . $this->object->getTestId()];
2095  if (!is_array($_POST['q_id']) || 0 === count($_POST['q_id'])) {
2096  ilUtil::sendFailure($this->lng->txt("no_target_selected_for_move"), true);
2097  $this->ctrl->redirect($this, 'questions');
2098  }
2099  if (count($_POST['q_id']) > 1) {
2100  ilUtil::sendFailure($this->lng->txt("too_many_targets_selected_for_move"), true);
2101  $this->ctrl->redirect($this, 'questions');
2102  }
2103  $insert_mode = 1;
2104  $this->object->moveQuestions($_SESSION['tst_qst_move_' . $this->object->getTestId()], $_POST['q_id'][0], $insert_mode);
2105  ilUtil::sendSuccess($this->lng->txt("msg_questions_moved"), true);
2106  unset($_SESSION['tst_qst_move_' . $this->object->getTestId()]);
2107  $this->ctrl->redirect($this, "questions");
2108  }
$_SESSION["AccountId"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ insertQuestionsBeforeObject()

ilObjTestGUI::insertQuestionsBeforeObject ( )

Insert checked questions before the actual selection.

Definition at line 2068 of file class.ilObjTestGUI.php.

References $_POST, $_SESSION, and ilUtil\sendFailure().

2069  {
2070  // get all questions to move
2071  $move_questions = $_SESSION['tst_qst_move_' . $this->object->getTestId()];
2072 
2073  if (!is_array($_POST['q_id']) || 0 === count($_POST['q_id'])) {
2074  ilUtil::sendFailure($this->lng->txt("no_target_selected_for_move"), true);
2075  $this->ctrl->redirect($this, 'questions');
2076  }
2077  if (count($_POST['q_id']) > 1) {
2078  ilUtil::sendFailure($this->lng->txt("too_many_targets_selected_for_move"), true);
2079  $this->ctrl->redirect($this, 'questions');
2080  }
2081  $insert_mode = 0;
2082  $this->object->moveQuestions($_SESSION['tst_qst_move_' . $this->object->getTestId()], $_POST['q_id'][0], $insert_mode);
2083  ilUtil::sendSuccess($this->lng->txt("msg_questions_moved"), true);
2084  unset($_SESSION['tst_qst_move_' . $this->object->getTestId()]);
2085  $this->ctrl->redirect($this, "questions");
2086  }
$_SESSION["AccountId"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ insertQuestionsObject()

ilObjTestGUI::insertQuestionsObject ( )

Insert questions from the questionbrowser into the test.

public

Definition at line 2115 of file class.ilObjTestGUI.php.

References $_POST, assQuestion\_needsManualScoring(), and ilUtil\sendInfo().

2116  {
2117  $selected_array = (is_array($_POST['q_id'])) ? $_POST['q_id'] : array();
2118  if (!count($selected_array)) {
2119  ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"), true);
2120  $this->ctrl->redirect($this, "browseForQuestions");
2121  } else {
2122  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
2123  $manscoring = false;
2124  foreach ($selected_array as $key => $value) {
2125  $this->object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value);
2126  if (!$manscoring) {
2127  $manscoring = $manscoring | assQuestion::_needsManualScoring($value);
2128  }
2129  }
2130  $this->object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
2131  if ($manscoring) {
2132  ilUtil::sendInfo($this->lng->txt("manscoring_hint"), true);
2133  } else {
2134  ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), true);
2135  }
2136  $this->ctrl->redirect($this, "questions");
2137  return;
2138  }
2139  }
static _needsManualScoring($question_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ insertRandomSelectionObject()

ilObjTestGUI::insertRandomSelectionObject ( )

Inserts a random selection into the test.

Inserts a random selection into the test

public

Definition at line 1690 of file class.ilObjTestGUI.php.

References $_POST, $total, and ilUtil\sendInfo().

1691  {
1692  $selected_array = explode(",", $_POST["chosen_questions"]);
1693  if (!count($selected_array)) {
1694  ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"));
1695  } else {
1696  $total = $this->object->evalTotalPersons();
1697  if ($total) {
1698  // the test was executed previously
1699  ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
1700  } else {
1701  ilUtil::sendInfo($this->lng->txt("tst_insert_questions"));
1702  }
1703  foreach ($selected_array as $key => $value) {
1704  $this->object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value);
1705  }
1706  $this->object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
1707  ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), true);
1708  $this->ctrl->redirect($this, "questions");
1709  return;
1710  }
1711  }
$total
Definition: Utf8Test.php:87
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ isCommandClassAnyInfoScreenChild()

ilObjTestGUI::isCommandClassAnyInfoScreenChild ( )
private

Definition at line 2871 of file class.ilObjTestGUI.php.

Referenced by redirectToInfoScreenObject().

2872  {
2873  if (in_array($this->ctrl->getCmdClass(), self::$infoScreenChildClasses)) {
2874  return true;
2875  }
2876 
2877  return false;
2878  }
+ Here is the caller graph for this function:

◆ movePageFormObject()

ilObjTestGUI::movePageFormObject ( )
protected

Move current page.

Definition at line 3853 of file class.ilObjTestGUI.php.

References $DIC, ilObjectGUI\$lng, and ilObjectGUI\$tpl.

3854  {
3855  global $DIC;
3856  $lng = $DIC['lng'];
3857  $ilCtrl = $DIC['ilCtrl'];
3858  $tpl = $DIC['tpl'];
3859 
3860  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
3861  $form = new ilPropertyFormGUI();
3862  $form->setFormAction($ilCtrl->getFormAction($this, "movePage"));
3863  $form->setTitle($lng->txt("test_move_page"));
3864 
3865  $old_pos = new ilHiddenInputGUI("q_id");
3866  $old_pos->setValue($_REQUEST['q_id']);
3867  $form->addItem($old_pos);
3868 
3869  $questions = $this->object->getQuestionTitlesAndIndexes();
3870  if (!is_array($questions)) {
3871  $questions = array();
3872  }
3873 
3874  foreach ($questions as $k => $q) {
3875  if ($k == $_REQUEST['q_id']) {
3876  unset($questions[$k]);
3877  continue;
3878  }
3879  $questions[$k] = $lng->txt('behind') . ' ' . $q;
3880  }
3881  #$questions['0'] = $lng->txt('first');
3882 
3883  $options = array(
3884  0 => $lng->txt('first')
3885  );
3886  foreach ($questions as $k => $q) {
3887  $options[$k] = $q . ' [' . $this->lng->txt('question_id_short') . ': ' . $k . ']';
3888  }
3889 
3890  $pos = new ilSelectInputGUI($lng->txt("position"), "position_after");
3891  $pos->setOptions($options);
3892  $form->addItem($pos);
3893 
3894  $form->addCommandButton("movePage", $lng->txt("submit"));
3895  $form->addCommandButton("showPage", $lng->txt("cancel"));
3896 
3897  return $tpl->setContent($form->getHTML());
3898  }
This class represents a property form user interface.
This class represents a hidden form property in a property form.
global $DIC
Definition: goto.php:24

◆ movePageObject()

ilObjTestGUI::movePageObject ( )

Definition at line 3900 of file class.ilObjTestGUI.php.

References $DIC, ilUtil\sendInfo(), and showPageObject().

3901  {
3902  global $DIC;
3903  $ilAccess = $DIC['ilAccess'];
3904  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
3905  // allow only write access
3906  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3907  $this->ctrl->redirect($this, "infoScreen");
3908  }
3909 
3910  $this->object->moveQuestionAfter($_REQUEST['q_id'], $_REQUEST['position_after']);
3911  $this->showPageObject();
3912  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ moveQuestionsObject()

ilObjTestGUI::moveQuestionsObject ( )

Marks selected questions for moving.

Definition at line 2049 of file class.ilObjTestGUI.php.

References $_GET, $_POST, $_SESSION, and ilUtil\sendFailure().

2050  {
2051  $selected_questions = null;
2052  $selected_questions = $_POST['q_id'];
2053  if ($selected_questions === null && is_numeric($_GET['q_id'])) {
2054  $selected_questions = [$_GET['q_id']];
2055  }
2056  if (is_array($selected_questions)) {
2057  $_SESSION['tst_qst_move_' . $this->object->getTestId()] = $selected_questions;
2058  ilUtil::sendSuccess($this->lng->txt("msg_selected_for_move"), true);
2059  } else {
2060  ilUtil::sendFailure($this->lng->txt('no_selection_for_move'), true);
2061  }
2062  $this->ctrl->redirect($this, 'questions');
2063  }
$_SESSION["AccountId"]
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ outEvaluationObject()

ilObjTestGUI::outEvaluationObject ( )

Definition at line 1167 of file class.ilObjTestGUI.php.

1168  {
1169  $this->ctrl->redirectByClass("iltestevaluationgui", "outEvaluation");
1170  }

◆ participantsActionObject()

ilObjTestGUI::participantsActionObject ( )

Evaluates the actions on the participants page.

public

Definition at line 2517 of file class.ilObjTestGUI.php.

References $_POST.

2518  {
2519  $command = $_POST["command"];
2520  if (strlen($command)) {
2521  $method = $command . "Object";
2522  if (method_exists($this, $method)) {
2523  $this->$method();
2524  return;
2525  }
2526  }
2527  $this->ctrl->redirect($this, "participants");
2528  }
$_POST["username"]

◆ populateQuestionBrowserToolbarButtons()

ilObjTestGUI::populateQuestionBrowserToolbarButtons ( ilToolbarGUI  $toolbar,
  $context 
)
private
Parameters
$ilToolbar
$context

Definition at line 2432 of file class.ilObjTestGUI.php.

References $context, ilToolbarGUI\addButton(), ilTestQuestionBrowserTableGUI\CMD_BROWSE_QUESTIONS, ilTestQuestionBrowserTableGUI\CONTEXT_PARAMETER, ilTestQuestionBrowserTableGUI\MODE_BROWSE_POOLS, ilTestQuestionBrowserTableGUI\MODE_BROWSE_TESTS, and ilTestQuestionBrowserTableGUI\MODE_PARAMETER.

Referenced by buildPageViewToolbar(), and questionsObject().

2433  {
2434  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
2435 
2436  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CONTEXT_PARAMETER, $context);
2437 
2438  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::MODE_PARAMETER, ilTestQuestionBrowserTableGUI::MODE_BROWSE_POOLS);
2439 
2440  $toolbar->addButton($this->lng->txt("tst_browse_for_qpl_questions"), $this->ctrl->getLinkTargetByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CMD_BROWSE_QUESTIONS));
2441 
2442  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::MODE_PARAMETER, ilTestQuestionBrowserTableGUI::MODE_BROWSE_TESTS);
2443 
2444  $toolbar->addButton($this->lng->txt("tst_browse_for_tst_questions"), $this->ctrl->getLinkTargetByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CMD_BROWSE_QUESTIONS));
2445  }
$context
Definition: webdav.php:26
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareSubGuiOutput()

ilObjTestGUI::prepareSubGuiOutput ( )
private

prepares ilias to get output rendered by sub gui class

ilLocator $ilLocator ilTemplate $tpl ilObjUser $ilUser

Returns
boolean

Definition at line 1145 of file class.ilObjTestGUI.php.

References $DIC, $ilUser, ilUtil\infoPanel(), ilObjectGUI\setLocator(), and ilObjectGUI\setTitleAndDescription().

Referenced by executeCommand().

1146  {
1147  global $DIC;
1148  $ilUser = $DIC['ilUser'];
1149 
1150  $this->tpl->loadStandardTemplate();
1151 
1152  // set locator
1153  $this->setLocator();
1154 
1155  // catch feedback message
1157 
1158  // set title and description and title icon
1159  $this->setTitleAndDescription();
1160  }
global $DIC
Definition: goto.php:24
static infoPanel($a_keep=true)
setTitleAndDescription()
called by prepare output
$ilUser
Definition: imgupload.php:18
setLocator()
set Locator
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printobject()

ilObjTestGUI::printobject ( )

Print tab to create a print of all questions with points and solutions.

Print tab to create a print of all questions with points and solutions

public

Definition at line 2537 of file class.ilObjTestGUI.php.

References $_GET, $DIC, $ilUser, ilTestPDFGenerator\generatePDF(), ilUtil\getStyleSheetLocation(), getTabsManager(), ilTestPDFGenerator\PDF_OUTPUT_DOWNLOAD, PDF_PRINT_VIEW_QUESTIONS, ilUtil\prepareFormOutput(), ilPDFGeneratorUtils\prepareGenerationRequest(), assQuestionGUI\RENDER_PURPOSE_PRINT_PDF, ilUtil\sendInfo(), and ilWACSignedPath\setTokenMaxLifetimeInSeconds().

2538  {
2539  global $DIC;
2540  $ilAccess = $DIC['ilAccess'];
2541  $ilias = $DIC['ilias'];
2542  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
2543  // allow only write access
2544  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2545  $this->ctrl->redirect($this, "infoScreen");
2546  }
2547 
2548  $isPdfDeliveryRequest = isset($_GET['pdf']) && $_GET['pdf'];
2549 
2550  $this->getTabsManager()->getQuestionsSubTabs();
2551  $template = new ilTemplate("tpl.il_as_tst_print_test_confirm.html", true, true, "Modules/Test");
2552 
2553  if (!$isPdfDeliveryRequest) { // #15243
2554  $this->ctrl->setParameter($this, "pdf", "1");
2555  $template->setCurrentBlock("pdf_export");
2556  $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "print"));
2557  $this->ctrl->setParameter($this, "pdf", "");
2558  $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
2559  $template->parseCurrentBlock();
2560 
2561  $template->setCurrentBlock("navigation_buttons");
2562  $template->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
2563  $template->parseCurrentBlock();
2564  }
2565  // prepare generation before contents are processed (for mathjax)
2566  else {
2568  }
2569 
2570  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
2571 
2572  global $DIC;
2573  $ilUser = $DIC['ilUser'];
2574  $print_date = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
2575  $max_points = 0;
2576  $counter = 1;
2577 
2578  require_once 'Modules/Test/classes/class.ilTestQuestionHeaderBlockBuilder.php';
2579  $questionHeaderBlockBuilder = new ilTestQuestionHeaderBlockBuilder($this->lng);
2580  $questionHeaderBlockBuilder->setHeaderMode($this->object->getTitleOutput());
2581 
2582  if ($isPdfDeliveryRequest) {
2583  require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
2585  }
2586 
2587  foreach ($this->object->questions as $question) {
2588  $template->setCurrentBlock("question");
2589  $question_gui = $this->object->createQuestionGUI("", $question);
2590 
2591  if ($isPdfDeliveryRequest) {
2592  $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
2593  }
2594 
2595  $questionHeaderBlockBuilder->setQuestionTitle($question_gui->object->getTitle());
2596  $questionHeaderBlockBuilder->setQuestionPoints($question_gui->object->getMaximumPoints());
2597  $questionHeaderBlockBuilder->setQuestionPosition($counter);
2598  $template->setVariable("QUESTION_HEADER", $questionHeaderBlockBuilder->getHTML());
2599 
2600  $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
2601  $template->setVariable("QUESTION_ID", $question_gui->object->getId());
2602  $result_output = $question_gui->getSolutionOutput("", null, false, true, false, $this->object->getShowSolutionFeedback());
2603  $template->setVariable("SOLUTION_OUTPUT", $result_output);
2604  $template->parseCurrentBlock("question");
2605  $counter++;
2606  $max_points += $question_gui->object->getMaximumPoints();
2607  }
2608 
2609  $template->setVariable("TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
2610  $template->setVariable("PRINT_TEST", ilUtil::prepareFormOutput($this->lng->txt("tst_print")));
2611  $template->setVariable("TXT_PRINT_DATE", ilUtil::prepareFormOutput($this->lng->txt("date")));
2612  $template->setVariable("VALUE_PRINT_DATE", ilUtil::prepareFormOutput(strftime("%c", $print_date)));
2613  $template->setVariable("TXT_MAXIMUM_POINTS", ilUtil::prepareFormOutput($this->lng->txt("tst_maximum_points")));
2614  $template->setVariable("VALUE_MAXIMUM_POINTS", ilUtil::prepareFormOutput($max_points));
2615 
2616  if ($isPdfDeliveryRequest) {
2617  ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitleFilenameCompliant(), PDF_PRINT_VIEW_QUESTIONS);
2618  } else {
2619  $this->tpl->setVariable("PRINT_CONTENT", $template->get());
2620  }
2621  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
const PDF_PRINT_VIEW_QUESTIONS
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
$ilUser
Definition: imgupload.php:18
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
+ Here is the call graph for this function:

◆ questionsObject()

ilObjTestGUI::questionsObject ( )

Definition at line 2262 of file class.ilObjTestGUI.php.

References $_GET, $_SESSION, $DIC, $ilUser, ilObjectGUI\$lng, $message, $total, ilObjTestAccess\_lookupOnlineTestAccess(), ilTestQuestionBrowserTableGUI\CONTEXT_LIST_VIEW, getTabsManager(), populateQuestionBrowserToolbarButtons(), ilUtil\redirect(), ilUtil\sendInfo(), ilTestQuestionsTableGUI\setPositionInsertCommandsEnabled(), and ilTestTabsManager\SUBTAB_ID_QST_LIST_VIEW.

Referenced by executeCommand().

2263  {
2264  global $DIC; /* @var ILIAS\DI\Container $DIC */
2265  $ilAccess = $DIC['ilAccess'];
2266  $ilTabs = $DIC['ilTabs'];
2267 
2268  // #12590
2269  $this->ctrl->setParameter($this, 'test_express_mode', '');
2270 
2271  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
2272  // allow only write access
2273  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2274  $this->ctrl->redirect($this, "infoScreen");
2275  }
2276 
2277  if ($_GET['browse']) {
2278  return $this->questionbrowser();
2279  }
2280 
2281  $this->getTabsManager()->getQuestionsSubTabs();
2283 
2284  // #11631, #12994
2285  $this->ctrl->setParameter($this, 'q_id', '');
2286 
2287  if ($_GET["eqid"] && $_GET["eqpl"]) {
2288  ilUtil::redirect("ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $_GET["eqpl"] . "&cmd=editQuestionForTest&calling_test=" . $_GET["ref_id"] . "&q_id=" . $_GET["eqid"]);
2289  }
2290 
2291  if ($_GET["up"] > 0) {
2292  $this->object->questionMoveUp($_GET["up"]);
2293  }
2294  if ($_GET["down"] > 0) {
2295  $this->object->questionMoveDown($_GET["down"]);
2296  }
2297 
2298  if ($_GET["add"]) {
2299  $selected_array = array();
2300  array_push($selected_array, $_GET["add"]);
2301  $total = $this->object->evalTotalPersons();
2302  if ($total) {
2303  // the test was executed previously
2304  ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
2305  } else {
2306  ilUtil::sendInfo($this->lng->txt("tst_insert_questions"));
2307  }
2308  $this->insertQuestions($selected_array);
2309  return;
2310  }
2311 
2312  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test");
2313 
2314  $total = $this->object->evalTotalPersons();
2315  if ($ilAccess->checkAccess("write", "", $this->ref_id)) {
2316  if ($total != 0) {
2317  $link = $DIC->ui()->factory()->link()->standard(
2318  $DIC->language()->txt("test_has_datasets_warning_page_view_link"),
2319  $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilParticipantsTestResultsGUI'))
2320  );
2321 
2322  $message = $DIC->language()->txt("test_has_datasets_warning_page_view");
2323 
2324  $msgBox = $DIC->ui()->factory()->messageBox()->info($message)->withLinks(array($link));
2325 
2326  $DIC->ui()->mainTemplate()->setCurrentBlock('mess');
2327  $DIC->ui()->mainTemplate()->setVariable(
2328  'MESSAGE',
2329  $DIC->ui()->renderer()->render($msgBox)
2330  );
2331  $DIC->ui()->mainTemplate()->parseCurrentBlock();
2332  } else {
2333  global $DIC;
2334  $ilToolbar = $DIC['ilToolbar'];
2335 
2336  $ilToolbar->addButton($this->lng->txt("ass_create_question"), $this->ctrl->getLinkTarget($this, "addQuestion"));
2337 
2338  if ($this->object->getPoolUsage()) {
2339  $ilToolbar->addSeparator();
2340 
2341  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
2342 
2344  }
2345 
2346  $ilToolbar->addSeparator();
2347  $ilToolbar->addButton($this->lng->txt("random_selection"), $this->ctrl->getLinkTarget($this, "randomselect"));
2348 
2349 
2350  global $DIC;
2351  $ilAccess = $DIC['ilAccess'];
2352  $ilUser = $DIC['ilUser'];
2353  $lng = $DIC['lng'];
2354  $ilCtrl = $DIC['ilCtrl'];
2355  $online_access = false;
2356  if ($this->object->getFixedParticipants()) {
2357  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
2358  $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
2359  if ($online_access_result === true) {
2360  $online_access = true;
2361  }
2362  }
2363  /*
2364  if (!$this->object->getOfflineStatus() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
2365  if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) {
2366  $testSession = $this->testSessionFactory->getSession();
2367  $testSequence = $this->testSequenceFactory->getSequenceByTestSession($testSession);
2368 
2369  $testPlayerGUI = $this->testPlayerFactory->getPlayerGUI();
2370 
2371  $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = true);
2372 
2373  if ($executable["executable"]) {
2374  if ($testSession->getActiveId() > 0) {
2375  // resume test
2376 
2377  if ($testSequence->hasStarted($testSession)) {
2378  $execTestLabel = $this->lng->txt("tst_resume_test");
2379  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'resumePlayer');
2380  } else {
2381  $execTestLabel = $this->object->getStartTestLabel($testSession->getActiveId());
2382  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'startPlayer');
2383  }
2384  } else {
2385  // start new test
2386 
2387  $execTestLabel = $this->object->getStartTestLabel($testSession->getActiveId());
2388  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'startPlayer');
2389  }
2390 
2391  $ilToolbar->addSeparator();
2392  $ilToolbar->addButton($execTestLabel, $execTestLink);
2393  }
2394  }
2395  }
2396  */
2397  }
2398  }
2399 
2400  $table_gui = new ilTestQuestionsTableGUI(
2401  $this,
2402  'questions',
2403  $this->object->getRefId()
2404  );
2405 
2407  is_array($_SESSION['tst_qst_move_' . $this->object->getTestId()])
2408  && count($_SESSION['tst_qst_move_' . $this->object->getTestId()])
2409  );
2410 
2411  $table_gui->setQuestionPositioningEnabled(!$total);
2412  $table_gui->setQuestionManagingEnabled(!$total);
2413  $table_gui->setObligatoryQuestionsHandlingEnabled($this->object->areObligationsEnabled());
2414 
2415  $table_gui->setTotalPoints($this->object->getFixedQuestionSetTotalPoints());
2416  $table_gui->setTotalWorkingTime($this->object->getFixedQuestionSetTotalWorkingTime());
2417 
2418  $table_gui->init();
2419 
2420  $table_gui->setData($this->object->getTestQuestions());
2421 
2422  $this->tpl->setCurrentBlock("adm_content");
2423  $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
2424  $this->tpl->setVariable('QUESTIONBROWSER', $table_gui->getHTML());
2425  $this->tpl->parseCurrentBlock();
2426  }
$_SESSION["AccountId"]
$_GET["client_id"]
$total
Definition: Utf8Test.php:87
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
setPositionInsertCommandsEnabled(bool $positionInsertCommandsEnabled)
global $DIC
Definition: goto.php:24
$message
Definition: xapiexit.php:14
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar, $context)
$ilUser
Definition: imgupload.php:18
static redirect($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ questionsTabGatewayObject()

ilObjTestGUI::questionsTabGatewayObject ( )
private

Definition at line 1048 of file class.ilObjTestGUI.php.

References ilObjTest\QUESTION_SET_TYPE_DYNAMIC, ilObjTest\QUESTION_SET_TYPE_FIXED, and ilObjTest\QUESTION_SET_TYPE_RANDOM.

1049  {
1050  switch ($this->object->getQuestionSetType()) {
1052  $this->ctrl->redirectByClass('ilObjTestGUI', 'questions');
1053 
1054  // no break
1056  $this->ctrl->redirectByClass('ilTestRandomQuestionSetConfigGUI');
1057 
1058  // no break
1060  $this->ctrl->redirectByClass('ilObjTestDynamicQuestionSetConfigGUI');
1061  }
1062  }
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)

◆ randomselectObject()

ilObjTestGUI::randomselectObject ( )

Definition at line 1625 of file class.ilObjTestGUI.php.

References $_POST, ilNumberInputGUI\allowDecimals(), getTabsManager(), ilUtil\stripSlashes(), and ilTestTabsManager\SUBTAB_ID_QST_LIST_VIEW.

1626  {
1627  $this->getTabsManager()->getQuestionsSubTabs();
1629 
1630  $form = new ilPropertyFormGUI();
1631  $form->setTitle($this->lng->txt('random_selection'));
1632  $form->setFormAction($this->ctrl->getFormAction($this, 'cancelRandomSelect'));
1633 
1634  $form->addCommandButton('createRandomSelection', $this->lng->txt('submit'));
1635  $form->addCommandButton('cancelRandomSelect', $this->lng->txt('cancel'));
1636 
1637  $amount = new ilNumberInputGUI($this->lng->txt('tst_random_nr_of_questions'), 'nr_of_questions');
1638  $amount->allowDecimals(false);
1639  $amount->setSize(5);
1640  $amount->setMinValue(1);
1641  $amount->setValue(5);
1642  $form->addItem($amount);
1643 
1644  $poolSelection = new ilSelectInputGUI($this->lng->txt('tst_source_question_pool'), 'sel_qpl');
1645  $poolSelection->setInfo($this->lng->txt('tst_random_select_questionpool'));
1646  $poolSelection->setRequired(true);
1647  $poolOptions = [];
1648  $questionpools = $this->object->getAvailableQuestionpools(false, false, false, true);
1649  foreach ($questionpools as $key => $value) {
1650  $poolOptions[$key] = $value['title'];
1651  }
1652  $poolSelection->setOptions(
1653  ['0' => $this->lng->txt('all_available_question_pools')] + $poolOptions
1654  );
1655  $form->addItem($poolSelection);
1656 
1657  $questionType = new ilHiddenInputGUI('sel_question_types');
1658  $questionType->setValue(ilUtil::stripSlashes($_POST['sel_question_types']));
1659  $form->addItem($questionType);
1660 
1661  $this->tpl->setContent($form->getHTML());
1662  }
This class represents a property form user interface.
allowDecimals($a_value)
Toggle Decimals.
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ redirectAfterMissingRead()

ilObjTestGUI::redirectAfterMissingRead ( )
protected

Definition at line 988 of file class.ilObjTestGUI.php.

References ROOT_FOLDER_ID.

Referenced by executeCommand(), and redirectToInfoScreenObject().

988  : void
989  {
990  $this->tpl->setOnScreenMessage('failure', sprintf(
991  $this->lng->txt("msg_no_perm_read_item"),
992  $this->object->getTitle()
993  ), true);
994  $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
995  $this->ctrl->redirectByClass('ilrepositorygui');
996  }
const ROOT_FOLDER_ID
Definition: constants.php:30
+ Here is the caller graph for this function:

◆ redirectAfterMissingWrite()

ilObjTestGUI::redirectAfterMissingWrite ( )
protected

Definition at line 980 of file class.ilObjTestGUI.php.

References ilUtil\sendFailure().

Referenced by executeCommand().

981  {
982  ilUtil::sendFailure($this->lng->txt("no_permission"), true);
983  $target_class = get_class($this->object) . "GUI";
984  $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id);
985  $this->ctrl->redirectByClass($target_class);
986  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectTo_ilObjTestSettingsGeneralGUI_showForm_Object()

ilObjTestGUI::redirectTo_ilObjTestSettingsGeneralGUI_showForm_Object ( )
private

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

References ilObjTestSettingsGeneralGUI\CMD_SHOW_FORM.

1132  {
1133  require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
1134  $this->ctrl->redirectByClass('ilObjTestSettingsGeneralGUI', ilObjTestSettingsGeneralGUI::CMD_SHOW_FORM);
1135  }

◆ redirectToInfoScreenObject()

◆ removeImportFailsObject()

ilObjTestGUI::removeImportFailsObject ( )
protected

Definition at line 3070 of file class.ilObjTestGUI.php.

References ilAssQuestionSkillAssignmentImportFails\deleteRegisteredImportFails(), and ilTestSkillLevelThresholdImportFails\deleteRegisteredImportFails().

3071  {
3072  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
3073  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
3074  $qsaImportFails->deleteRegisteredImportFails();
3075 
3076  require_once 'Modules/Test/classes/class.ilTestSkillLevelThresholdImportFails.php';
3077  $sltImportFails = new ilTestSkillLevelThresholdImportFails($this->object->getId());
3078  $sltImportFails->deleteRegisteredImportFails();
3079 
3080  $this->ctrl->redirect($this, 'infoScreen');
3081  }
+ Here is the call graph for this function:

◆ removeQuestionsForm()

ilObjTestGUI::removeQuestionsForm (   $checked_questions)

Displays a form to confirm the removal of questions from the test.

Displays a form to confirm the removal of questions from the test

public

Definition at line 1976 of file class.ilObjTestGUI.php.

References ilObjectGUI\$data, $total, $txt, and assQuestion\_getQuestionTypeName().

Referenced by removeQuestionsObject().

1977  {
1978  $total = $this->object->evalTotalPersons();
1979  if ($total) {
1980  // the test was executed previously
1981  $question = sprintf($this->lng->txt("tst_remove_questions_and_results"), $total);
1982  } else {
1983  if (count($checked_questions) == 1) {
1984  $question = $this->lng->txt("tst_remove_question");
1985  } else {
1986  $question = $this->lng->txt("tst_remove_questions");
1987  }
1988  }
1989 
1990  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1991  $cgui = new ilConfirmationGUI();
1992  $cgui->setHeaderText($question);
1993 
1994  $this->ctrl->saveParameter($this, 'test_express_mode');
1995  $this->ctrl->saveParameter($this, 'q_id');
1996 
1997  $cgui->setFormAction($this->ctrl->getFormAction($this));
1998  $cgui->setCancel($this->lng->txt("cancel"), "cancelRemoveQuestions");
1999  $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
2000 
2001  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
2002  $removablequestions = &$this->object->getTestQuestions();
2003  if (count($removablequestions)) {
2004  foreach ($removablequestions as $data) {
2005  if (in_array($data["question_id"], $checked_questions)) {
2006  $txt = $data["title"] . " (" . assQuestion::_getQuestionTypeName($data["type_tag"]) . ")";
2007  $txt .= ' [' . $this->lng->txt('question_id_short') . ': ' . $data['question_id'] . ']';
2008 
2009  if ($data["description"]) {
2010  $txt .= "<div class=\"small\">" . $data["description"] . "</div>";
2011  }
2012 
2013  $cgui->addItem("q_id[]", $data["question_id"], $txt);
2014  }
2015  }
2016  }
2017 
2018  $this->tpl->setContent($cgui->getHTML());
2019  }
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
$total
Definition: Utf8Test.php:87
$txt
Definition: error.php:13
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionsObject()

ilObjTestGUI::removeQuestionsObject ( )

Called when a selection of questions should be removed from the test.

Definition at line 2024 of file class.ilObjTestGUI.php.

References getTabsManager(), removeQuestionsForm(), and ilUtil\sendFailure().

2025  {
2026  $this->getTabsManager()->getQuestionsSubTabs();
2027 
2028  $checked_questions = $_REQUEST["q_id"];
2029 
2030  if (!is_array($checked_questions) && $checked_questions) {
2031  $checked_questions = array($checked_questions);
2032  }
2033 
2034  if (!is_array($checked_questions)) {
2035  $checked_questions = [];
2036  }
2037 
2038  if (count($checked_questions) > 0) {
2039  $this->removeQuestionsForm($checked_questions);
2040  } elseif (0 === count($checked_questions)) {
2041  ilUtil::sendFailure($this->lng->txt("tst_no_question_selected_for_removal"), true);
2042  $this->ctrl->redirect($this, "questions");
2043  }
2044  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
removeQuestionsForm($checked_questions)
Displays a form to confirm the removal of questions from the test.
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjTestGUI::resetFilterObject ( )

Resets the filter for the question browser.

Resets the filter for the question browser

public

Definition at line 1581 of file class.ilObjTestGUI.php.

1582  {
1583  $this->questionBrowser();
1584  }

◆ reviewobject()

ilObjTestGUI::reviewobject ( )

Review tab to create a print of all questions without points and solutions.

Review tab to create a print of all questions without points and solutions

public

Definition at line 2630 of file class.ilObjTestGUI.php.

References $_GET, $DIC, ilObjectGUI\$tpl, ilDatePresentation\formatDate(), ilTestPDFGenerator\generatePDF(), ilUtil\getStyleSheetLocation(), getTabsManager(), IL_CAL_UNIX, ilTestPDFGenerator\PDF_OUTPUT_DOWNLOAD, PDF_PRINT_VIEW_QUESTIONS, ilUtil\prepareFormOutput(), ilPDFGeneratorUtils\prepareGenerationRequest(), assQuestionGUI\RENDER_PURPOSE_PREVIEW, ilUtil\sendInfo(), ilWACSignedPath\setTokenMaxLifetimeInSeconds(), ilDatePresentation\setUseRelativeDates(), ilTestTabsManager\TAB_ID_SETTINGS, and ilDatePresentation\useRelativeDates().

2631  {
2632  global $DIC;
2633  $ilAccess = $DIC['ilAccess'];
2634 
2635  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
2636  // allow only write access
2637  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2638  $this->ctrl->redirect($this, "infoScreen");
2639  }
2640  $this->getTabsManager()->getQuestionsSubTabs();
2641  $template = new ilTemplate("tpl.il_as_tst_print_test_confirm.html", true, true, "Modules/Test");
2642 
2643  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
2644 
2645  $isPdfDeliveryRequest = isset($_GET['pdf']) && $_GET['pdf'];
2646 
2647  $max_points = 0;
2648  $counter = 1;
2649 
2650  require_once 'Modules/Test/classes/class.ilTestQuestionHeaderBlockBuilder.php';
2651  $questionHeaderBlockBuilder = new ilTestQuestionHeaderBlockBuilder($this->lng);
2652  $questionHeaderBlockBuilder->setHeaderMode($this->object->getTitleOutput());
2653 
2654  if ($isPdfDeliveryRequest) {
2655  require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
2657 
2658  // prepare generation before contents are processed (for mathjax)
2660  }
2661 
2662  foreach ($this->object->questions as $question) {
2663  $template->setCurrentBlock("question");
2664  $question_gui = $this->object->createQuestionGUI("", $question);
2665  $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
2666 
2667  $questionHeaderBlockBuilder->setQuestionTitle($question_gui->object->getTitle());
2668  $questionHeaderBlockBuilder->setQuestionPoints($question_gui->object->getMaximumPoints());
2669  $questionHeaderBlockBuilder->setQuestionPosition($counter);
2670  $template->setVariable("QUESTION_HEADER", $questionHeaderBlockBuilder->getHTML());
2671 
2672  $template->setVariable("SOLUTION_OUTPUT", $question_gui->getPreview(false));
2673  $template->parseCurrentBlock("question");
2674  $counter++;
2675  $max_points += $question_gui->object->getMaximumPoints();
2676  }
2677 
2678  $template->setVariable("TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
2679  $template->setVariable("PRINT_TEST", ilUtil::prepareFormOutput($this->lng->txt("review_view")));
2680  $template->setVariable("TXT_PRINT_DATE", ilUtil::prepareFormOutput($this->lng->txt("date")));
2681  $usedRelativeDates = ilDatePresentation::useRelativeDates();
2683  $template->setVariable(
2684  "VALUE_PRINT_DATE",
2686  );
2687  ilDatePresentation::setUseRelativeDates($usedRelativeDates);
2688  $template->setVariable("TXT_MAXIMUM_POINTS", ilUtil::prepareFormOutput($this->lng->txt("tst_maximum_points")));
2689  $template->setVariable("VALUE_MAXIMUM_POINTS", ilUtil::prepareFormOutput($max_points));
2690 
2691  if ($isPdfDeliveryRequest) {
2692  ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitleFilenameCompliant(), PDF_PRINT_VIEW_QUESTIONS);
2693  } else {
2694  $this->ctrl->setParameter($this, "pdf", "1");
2695  $template->setCurrentBlock("pdf_export");
2696  $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "review"));
2697  $this->ctrl->setParameter($this, "pdf", "");
2698  $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
2699  $template->parseCurrentBlock();
2700 
2701  $template->setCurrentBlock("navigation_buttons");
2702  $template->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
2703  $template->parseCurrentBlock();
2704 
2705 
2706  $this->tpl->setVariable("PRINT_CONTENT", $template->get());
2707  }
2708  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
const PDF_PRINT_VIEW_QUESTIONS
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
static setUseRelativeDates($a_status)
set use relative dates
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static useRelativeDates()
check if relative dates are used
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
+ Here is the call graph for this function:

◆ runObject()

ilObjTestGUI::runObject ( )

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

1163  {
1164  $this->ctrl->redirect($this, "infoScreen");
1165  }

◆ saveOrderAndObligationsObject()

ilObjTestGUI::saveOrderAndObligationsObject ( )

Definition at line 3810 of file class.ilObjTestGUI.php.

References $DIC, ilObjTest\isQuestionObligationPossible(), and ilUtil\sendInfo().

3811  {
3812  global $DIC;
3813  $ilAccess = $DIC['ilAccess'];
3814  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
3815  // allow only write access
3816  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3817  $this->ctrl->redirect($this, "infoScreen");
3818  }
3819 
3820  global $DIC;
3821  $ilCtrl = $DIC['ilCtrl'];
3822 
3823  $orders = $obligations = array();
3824 
3825  foreach ((array) $_REQUEST['order'] as $qId => $order) {
3826  $id = (int) str_replace('q_', '', $qId);
3827 
3828  $orders[$id] = $order;
3829  }
3830 
3831  if ($this->object->areObligationsEnabled() && isset($_REQUEST['obligatory']) && is_array($_REQUEST['obligatory'])) {
3832  foreach ($_REQUEST['obligatory'] as $qId => $obligation) {
3833  $id = (int) str_replace('q_', '', $qId);
3834 
3836  $obligations[$id] = $obligation;
3837  }
3838  }
3839  }
3840 
3841  $this->object->setQuestionOrderAndObligations(
3842  $orders,
3843  $obligations
3844  );
3845 
3846  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
3847  $ilCtrl->redirect($this, 'questions');
3848  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
static isQuestionObligationPossible($questionId)
checks wether the obligation for question with given id is possible or not
+ Here is the call graph for this function:

◆ setTabsManager()

ilObjTestGUI::setTabsManager (   $tabsManager)
Parameters
ilTestTabsManager$tabsManager

Definition at line 1113 of file class.ilObjTestGUI.php.

References $tabsManager.

Referenced by __construct().

1114  {
1115  $this->tabsManager = $tabsManager;
1116  }
+ Here is the caller graph for this function:

◆ setTestAccess()

ilObjTestGUI::setTestAccess (   $testAccess)
Parameters
ilTestAccess$testAccess

Definition at line 1097 of file class.ilObjTestGUI.php.

References $testAccess.

Referenced by __construct().

1098  {
1099  $this->testAccess = $testAccess;
1100  }
+ Here is the caller graph for this function:

◆ showPageObject()

ilObjTestGUI::showPageObject ( )

Definition at line 3914 of file class.ilObjTestGUI.php.

References $DIC.

Referenced by movePageObject().

3915  {
3916  global $DIC;
3917  $ilCtrl = $DIC['ilCtrl'];
3918 
3919  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', $_REQUEST['q_id']);
3920  $ilCtrl->redirectByClass('iltestexpresspageobjectgui', 'showPage');
3921  }
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ statisticsObject()

ilObjTestGUI::statisticsObject ( )

Definition at line 3135 of file class.ilObjTestGUI.php.

3136  {
3137  }

◆ takenObject()

ilObjTestGUI::takenObject ( )

Definition at line 2447 of file class.ilObjTestGUI.php.

2448  {
2449  }

◆ testResultsGatewayObject()

ilObjTestGUI::testResultsGatewayObject ( )
private

Definition at line 1073 of file class.ilObjTestGUI.php.

1073  : void
1074  {
1075  $this->ctrl->redirectByClass(
1076  [
1077  ilRepositoryGUI::class,
1078  __CLASS__,
1079  ilTestResultsGUI::class,
1080  ilParticipantsTestResultsGUI::class
1081  ],
1082  'showParticipants'
1083  );
1084  }

◆ trackTestObjectReadEvent()

ilObjTestGUI::trackTestObjectReadEvent ( )
protected

Definition at line 998 of file class.ilObjTestGUI.php.

References $DIC, and ilChangeEvent\_recordReadEvent().

Referenced by executeCommand(), and redirectToInfoScreenObject().

999  {
1000  /* @var ILIAS\DI\Container $DIC */ global $DIC;
1001 
1002  require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
1003 
1005  $this->object->getType(),
1006  $this->object->getRefId(),
1007  $this->object->getId(),
1008  $DIC->user()->getId()
1009  );
1010  }
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadObject()

ilObjTestGUI::uploadObject (   $redirect = true)

display status information or report errors messages in case of error

public

Definition at line 1524 of file class.ilObjTestGUI.php.

References uploadTstObject().

1525  {
1526  $this->uploadTstObject();
1527  }
uploadTstObject()
imports test and question(s)
+ Here is the call graph for this function:

◆ uploadTstObject()

ilObjTestGUI::uploadTstObject ( )

imports test and question(s)

Definition at line 1260 of file class.ilObjTestGUI.php.

References $_POST, $_SESSION, $result, ilObjTest\_createImportDirectory(), ilObjTest\_getImportDirectory(), ilObjTest\_setImportDirectory(), CLOZE_TEST_IDENTIFIER, ilObjectGUI\createObject(), ilUtil\delDir(), ERROR_TEXT_IDENTIFIER, FILE_UPLOAD_IDENTIFIER, FLASHAPPLET_QUESTION_IDENTIFIER, FORMULA_QUESTION_IDENTIFIER, ilUtil\getImagePath(), IL_MO_VERIFY_QTI, IMAGEMAP_QUESTION_IDENTIFIER, importVerifiedFileObject(), JAVAAPPLET_QUESTION_IDENTIFIER, KPRIM_CHOICE_QUESTION_IDENTIFIER, LONG_MENU_QUESTION_IDENTIFIER, MATCHING_QUESTION_IDENTIFIER, ilUtil\moveUploadedFile(), MULTIPLE_CHOICE_QUESTION_IDENTIFIER, NUMERIC_QUESTION_IDENTIFIER, ORDERING_HORIZONTAL_IDENTIFIER, ORDERING_QUESTION_IDENTIFIER, QT_CLOZE, QT_ERRORTEXT, QT_FILEUPLOAD, QT_FLASHAPPLET, QT_FORMULA, QT_IMAGEMAP, QT_JAVAAPPLET, QT_KPRIM_CHOICE, QT_LONG_MENU, QT_MATCHING, QT_MULTIPLE_CHOICE_MR, QT_MULTIPLE_CHOICE_SR, QT_NUMERIC, QT_ORDERING, QT_ORDERING_HORIZONTAL, QT_TEXT, QT_TEXTSUBSET, ilObjTest\QUESTION_SET_TYPE_FIXED, ilUtil\sendInfo(), SINGLE_CHOICE_QUESTION_IDENTIFIER, TEXT_QUESTION_IDENTIFIER, TEXTSUBSET_QUESTION_IDENTIFIER, and ilUtil\unzip().

Referenced by importFileObject(), and uploadObject().

1261  {
1262  if ($_FILES["xmldoc"]["error"] > UPLOAD_ERR_OK) {
1263  $this->lng->loadLanguageModule('file');
1264  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('general_upload_error_occured'));
1265  $this->ctrl->redirect($this, 'create');
1266  return false;
1267  }
1268 
1269  $file = pathinfo($_FILES["xmldoc"]["name"]);
1270  $subdir = basename($file["basename"], "." . $file["extension"]);
1271 
1272  if (strpos($subdir, 'tst') === false) {
1273  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
1274  $this->ctrl->redirect($this, 'create');
1275  return false;
1276  }
1277 
1278  $basedir = ilObjTest::_createImportDirectory();
1279 
1280  $full_path = $basedir . "/" . $_FILES["xmldoc"]["name"];
1281 
1282  ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
1283  ilUtil::unzip($full_path);
1284 
1286  $xml_file = ilObjTest::_getImportDirectory() . '/' . $subdir . '/' . $subdir . ".xml";
1287  $qti_file = ilObjTest::_getImportDirectory() . '/' . $subdir . '/' . preg_replace("/test|tst/", "qti", $subdir) . ".xml";
1288  $results_file = ilObjTest::_getImportDirectory() . '/' . $subdir . '/' . preg_replace("/test|tst/", "results", $subdir) . ".xml";
1289 
1290  if (!is_file($qti_file)) {
1291  ilUtil::delDir($basedir);
1292  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("tst_import_non_ilias_zip"), true);
1293  $this->ctrl->redirect($this, 'create');
1294  return false;
1295  }
1296 
1297  // start verification of QTI files
1298  include_once "./Services/QTI/classes/class.ilQTIParser.php";
1299  $qtiParser = new ilQTIParser($qti_file, IL_MO_VERIFY_QTI, 0, "");
1300  $result = $qtiParser->startParsing();
1301  $founditems = &$qtiParser->getFoundItems();
1302 
1303  $complete = 0;
1304  $incomplete = 0;
1305  foreach ($founditems as $item) {
1306  if (strlen($item["type"])) {
1307  $complete++;
1308  } else {
1309  $incomplete++;
1310  }
1311  }
1312 
1313  if (count($founditems) && $complete == 0) {
1314  // delete import directory
1315  ilUtil::delDir($basedir);
1316 
1317  ilUtil::sendInfo($this->lng->txt("qpl_import_non_ilias_files"));
1318  $this->createObject();
1319  return;
1320  }
1321 
1322  $_SESSION["tst_import_results_file"] = $results_file;
1323  $_SESSION["tst_import_xml_file"] = $xml_file;
1324  $_SESSION["tst_import_qti_file"] = $qti_file;
1325  $_SESSION["tst_import_subdir"] = $subdir;
1326 
1327  if ($qtiParser->getQuestionSetType() != ilObjTest::QUESTION_SET_TYPE_FIXED) {
1328  $this->importVerifiedFileObject();
1329  return;
1330  }
1331 
1332  $importVerificationTpl = new ilTemplate('tpl.tst_import_verification.html', true, true, 'Modules/Test');
1333  // Keep this include because of global constants
1334  include_once "./Services/QTI/classes/class.ilQTIItem.php";
1335 
1336  // on import creation screen the pool was chosen (-1 for no pool)
1337  // BUT when no pool is available the input on creation screen is missing, so the field value -1 for no pool is not submitted.
1338  $QplOrTstID = isset($_POST["qpl"]) && (int) $_POST["qpl"] != 0 ? $_POST["qpl"] : -1;
1339 
1340  $importVerificationTpl->setVariable("TEXT_TYPE", $this->lng->txt("question_type"));
1341  $importVerificationTpl->setVariable("TEXT_TITLE", $this->lng->txt("question_title"));
1342  $importVerificationTpl->setVariable("FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt("tst_import_verify_found_questions"));
1343  $importVerificationTpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_tst"));
1344  $importVerificationTpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1345  $importVerificationTpl->setVariable("ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1346  $importVerificationTpl->setVariable("QUESTIONPOOL_ID", $QplOrTstID);
1347  $importVerificationTpl->setVariable("VALUE_IMPORT", $this->lng->txt("import"));
1348  $importVerificationTpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
1349 
1350  $row_class = ["tblrow1", "tblrow2"];
1351  $counter = 0;
1352  foreach ($founditems as $item) {
1353  $importVerificationTpl->setCurrentBlock("verification_row");
1354  $importVerificationTpl->setVariable("ROW_CLASS", $row_class[$counter++ % 2]);
1355  $importVerificationTpl->setVariable("QUESTION_TITLE", $item["title"]);
1356  $importVerificationTpl->setVariable("QUESTION_IDENT", $item["ident"]);
1357 
1358  switch ($item["type"]) {
1360  case QT_MULTIPLE_CHOICE_MR:
1361  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assMultipleChoice"));
1362  break;
1364  case QT_MULTIPLE_CHOICE_SR:
1365  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assSingleChoice"));
1366  break;
1368  case QT_KPRIM_CHOICE:
1369  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assKprimChoice"));
1370  break;
1372  case QT_LONG_MENU:
1373  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assLongMenu"));
1374  break;
1376  case QT_NUMERIC:
1377  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assNumeric"));
1378  break;
1380  case QT_FORMULA:
1381  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFormulaQuestion"));
1382  break;
1384  case QT_TEXTSUBSET:
1385  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assTextSubset"));
1386  break;
1387  case CLOZE_TEST_IDENTIFIER:
1388  case QT_CLOZE:
1389  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assClozeTest"));
1390  break;
1391  case ERROR_TEXT_IDENTIFIER:
1392  case QT_ERRORTEXT:
1393  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assErrorText"));
1394  break;
1396  case QT_IMAGEMAP:
1397  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assImagemapQuestion"));
1398  break;
1400  case QT_JAVAAPPLET:
1401  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assJavaApplet"));
1402  break;
1404  case QT_FLASHAPPLET:
1405  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFlashApplet"));
1406  break;
1408  case QT_MATCHING:
1409  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assMatchingQuestion"));
1410  break;
1412  case QT_ORDERING:
1413  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assOrderingQuestion"));
1414  break;
1417  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assOrderingHorizontal"));
1418  break;
1420  case QT_TEXT:
1421  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assTextQuestion"));
1422  break;
1424  case QT_FILEUPLOAD:
1425  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFileUpload"));
1426  break;
1427  }
1428  $importVerificationTpl->parseCurrentBlock();
1429  }
1430 
1431  $this->tpl->setContent($importVerificationTpl->get());
1432  }
const MATCHING_QUESTION_IDENTIFIER
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
const QT_MATCHING
const QT_FORMULA
const QT_FILEUPLOAD
const ERROR_TEXT_IDENTIFIER
$_SESSION["AccountId"]
$result
const QT_TEXT
const QT_ORDERING_HORIZONTAL
const KPRIM_CHOICE_QUESTION_IDENTIFIER
const LONG_MENU_QUESTION_IDENTIFIER
const TEXTSUBSET_QUESTION_IDENTIFIER
const QT_KPRIM_CHOICE
createObject()
create new object form
const QT_IMAGEMAP
const FILE_UPLOAD_IDENTIFIER
const QT_MULTIPLE_CHOICE_SR
const JAVAAPPLET_QUESTION_IDENTIFIER
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const QT_LONG_MENU
const NUMERIC_QUESTION_IDENTIFIER
const ORDERING_HORIZONTAL_IDENTIFIER
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
const ORDERING_QUESTION_IDENTIFIER
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
const TEXT_QUESTION_IDENTIFIER
const QT_JAVAAPPLET
const FLASHAPPLET_QUESTION_IDENTIFIER
static _createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
const QT_NUMERIC
importVerifiedFileObject()
imports question(s) into the questionpool (after verification)
const QT_TEXTSUBSET
const QT_FLASHAPPLET
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
const QT_CLOZE
const QT_MULTIPLE_CHOICE_MR
const IL_MO_VERIFY_QTI
const SINGLE_CHOICE_QUESTION_IDENTIFIER
const QT_ORDERING
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
$_POST["username"]
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
static _setImportDirectory($a_import_dir=null)
set import directory
static _getImportDirectory()
Get the import directory location of the test.
const IMAGEMAP_QUESTION_IDENTIFIER
const QT_ERRORTEXT
const FORMULA_QUESTION_IDENTIFIER
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userResultsGatewayObject()

ilObjTestGUI::userResultsGatewayObject ( )
private

Definition at line 1064 of file class.ilObjTestGUI.php.

References forwardToEvaluationGUI().

1065  {
1066  $this->ctrl->setCmdClass('ilTestEvaluationGUI');
1067  $this->ctrl->setCmd('outUserResultsOverview');
1068  $this->tabs_gui->clearTargets();
1069 
1070  $this->forwardToEvaluationGUI();
1071  }
+ Here is the call graph for this function:

Field Documentation

◆ $error

ilObjTestGUI::$error
private

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

◆ $infoScreenChildClasses

ilObjTestGUI::$infoScreenChildClasses
staticprivate
Initial value:
= array(
'ilpublicuserprofilegui', 'ilobjportfoliogui'
)

Definition at line 68 of file class.ilObjTestGUI.php.

◆ $object

ilObjTestGUI::$object = null

Definition at line 73 of file class.ilObjTestGUI.php.

Referenced by executeCommand().

◆ $objectiveOrientedContainer

ilObjTestGUI::$objectiveOrientedContainer
private

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

Referenced by getObjectiveOrientedContainer().

◆ $tabsManager

ilObjTestGUI::$tabsManager
protected

Definition at line 90 of file class.ilObjTestGUI.php.

Referenced by __construct(), getTabsManager(), and setTabsManager().

◆ $testAccess

ilObjTestGUI::$testAccess
protected

Definition at line 100 of file class.ilObjTestGUI.php.

Referenced by getTestAccess(), and setTestAccess().

◆ $testPlayerFactory

ilObjTestGUI::$testPlayerFactory = null
private

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

◆ $testQuestionSetConfigFactory

ilObjTestGUI::$testQuestionSetConfigFactory = null
private

Definition at line 76 of file class.ilObjTestGUI.php.

◆ $testSequenceFactory

ilObjTestGUI::$testSequenceFactory = null
private

Definition at line 85 of file class.ilObjTestGUI.php.

◆ $testSessionFactory

ilObjTestGUI::$testSessionFactory = null
private

Definition at line 82 of file class.ilObjTestGUI.php.


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