ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjTestGUI Class Reference

Class ilObjTestGUI. 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 ()
 

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

 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
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 

Private Member Functions

 questionsTabGatewayObject ()
 
 userResultsGatewayObject ()
 
 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

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 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 52 of file class.ilObjTestGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjTestGUI::__construct (   $refId = null)

Constructor public.

Parameters
mixed | null$refId

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

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

97  {
98  global $DIC;
99  $lng = $DIC['lng'];
100  $ilCtrl = $DIC['ilCtrl'];
101  $ilDB = $DIC['ilDB'];
102  $ilPluginAdmin = $DIC['ilPluginAdmin'];
103  $tree = $DIC['tree'];
104  $lng->loadLanguageModule("assessment");
105  $this->type = "tst";
106  $this->error = $DIC['ilErr'];
107  $this->ctrl = $ilCtrl;
108  $this->ctrl->saveParameter($this, array("ref_id", "test_ref_id", "calling_test", "test_express_mode", "q_id"));
109  if (isset($_GET['ref_id']) && is_numeric($_GET['ref_id'])) {
110  $refId = (int) $_GET['ref_id'];
111  }
112  parent::__construct("", (int) $refId, true, false);
113 
114  if ($this->object instanceof ilObjTest) {
115  require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
116  $this->testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $this->object);
117 
118  require_once 'Modules/Test/classes/class.ilTestPlayerFactory.php';
119  $this->testPlayerFactory = new ilTestPlayerFactory($this->object);
120 
121  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
122  $this->testSessionFactory = new ilTestSessionFactory($this->object);
123 
124  require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
125  $this->testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
126 
127  require_once 'Modules/Test/classes/class.ilTestAccess.php';
128  $this->setTestAccess(new ilTestAccess($this->ref_id, $this->object->getTestId()));
129  }
130 
131  require_once 'Modules/Test/classes/class.ilTestObjectiveOrientedContainer.php';
132  $this->objectiveOrientedContainer = new ilTestObjectiveOrientedContainer();
133 
134  if ($this->object instanceof ilObjTest) {
135  require_once 'Modules/Test/classes/class.ilTestTabsManager.php';
136  $tabsManager = new ilTestTabsManager($this->testAccess, $this->objectiveOrientedContainer);
137  $tabsManager->setTestOBJ($this->object);
138  $tabsManager->setTestSession($this->testSessionFactory->getSession());
139  $tabsManager->setTestQuestionSetConfig($this->testQuestionSetConfigFactory->getQuestionSetConfig());
140  $tabsManager->initSettingsTemplate();
142  }
143  }
$_GET["client_id"]
setTestAccess($testAccess)
$refId
Definition: xapitoken.php:42
global $ilCtrl
Definition: ilias.php:18
setTabsManager($tabsManager)
__construct(Container $dic, ilPlugin $plugin)
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 3053 of file class.ilObjTestGUI.php.

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

3054  {
3055  global $DIC;
3056  $ilAccess = $DIC['ilAccess'];
3057  $ilErr = $DIC['ilErr'];
3058  $lng = $DIC['lng'];
3059 
3060  if ($ilAccess->checkAccess("read", "", $a_target) || $ilAccess->checkAccess("visible", "", $a_target)) {
3061  //include_once "./Services/Utilities/classes/class.ilUtil.php";
3062  $_GET["baseClass"] = "ilObjTestGUI";
3063  $_GET["cmd"] = "infoScreen";
3064  $_GET["ref_id"] = $a_target;
3065  include_once("ilias.php");
3066  exit;
3067  //ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=$a_target");
3068  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
3069  ilUtil::sendInfo(sprintf(
3070  $lng->txt("msg_no_perm_read_item"),
3072  ), true);
3074  }
3075 
3076  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
3077  }
exit
Definition: login.php:29
$_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)
$DIC
Definition: xapitoken.php:46
+ 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 2726 of file class.ilObjTestGUI.php.

References $_POST, and ilUtil\sendInfo().

2727  {
2728  if (strlen($_POST["name"]) > 0) {
2729  $this->object->addDefaults($_POST['name']);
2730  } else {
2731  ilUtil::sendInfo($this->lng->txt("tst_defaults_enter_name"));
2732  }
2733  $this->defaultsObject();
2734  }
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 1071 of file class.ilObjTestGUI.php.

References ilSettingsTemplate\getAllSettingsTemplates().

1072  {
1073  include_once("./Modules/Test/classes/class.ilObjTest.php");
1074  $tst = new ilObjTest();
1075  $defaults = $tst->getAvailableDefaults();
1076  if (count($defaults)) {
1077  foreach ($defaults as $row) {
1078  $a_options["tstdef_" . $row["test_defaults_id"]] = array($row["name"],
1079  $this->lng->txt("tst_default_settings"));
1080  }
1081  }
1082 
1083  // using template?
1084  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
1085  $templates = ilSettingsTemplate::getAllSettingsTemplates("tst");
1086  if ($templates) {
1087  foreach ($templates as $item) {
1088  $a_options["tsttpl_" . $item["id"]] = array($item["title"],
1089  nl2br(trim($item["description"])));
1090  }
1091  }
1092  }
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 2945 of file class.ilObjTestGUI.php.

References $_GET, and $DIC.

2946  {
2947  global $DIC;
2948  $ilLocator = $DIC['ilLocator'];
2949  switch ($this->ctrl->getCmd()) {
2950  case "run":
2951  case "infoScreen":
2952  case "redirectToInfoScreen":
2953  case "start":
2954  case "resume":
2955  case "previous":
2956  case "next":
2957  case "summary":
2958  case "finishTest":
2959  case "outCorrectSolution":
2960  case "passDetails":
2961  case "showAnswersOfUser":
2962  case "outUserResultsOverview":
2963  case "backFromSummary":
2964  case "show_answers":
2965  case "setsolved":
2966  case "resetsolved":
2967  case "outTestSummary":
2968  case "outQuestionSummary":
2969  case "gotoQuestion":
2970  case "selectImagemapRegion":
2971  case "confirmSubmitAnswers":
2972  case "finalSubmission":
2973  case "postpone":
2974  case "outUserPassDetails":
2975  case "checkPassword":
2976  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
2977  break;
2978  case "eval_stat":
2979  case "evalAllUsers":
2980  case "evalUserDetail":
2981  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "eval_stat"), "", $_GET["ref_id"]);
2982  break;
2983  case "create":
2984  case "save":
2985  case "cancel":
2986  case "importFile":
2987  case "cloneAll":
2988  case "importVerifiedFile":
2989  case "cancelImport":
2990  break;
2991  default:
2992  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
2993  break;
2994  }
2995  }
$_GET["client_id"]
$DIC
Definition: xapitoken.php:46

◆ addQuestionObject()

ilObjTestGUI::addQuestionObject ( )

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

References ilObjectGUI\$data, $DIC, $ilCtrl, ilObjectGUI\$lng, $name, $si, ilObjectGUI\$tpl, ilObjQuestionPool\_getAvailableQuestionpools(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT, ilRadioGroupInputGUI\addOption(), getTabsManager(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), ilFormPropertyGUI\setRequired(), ilRadioOption\setValue(), and ilTestTabsManager\SUBTAB_ID_QST_LIST_VIEW.

2011  {
2012  global $DIC;
2013  $lng = $DIC['lng'];
2014  $ilCtrl = $DIC['ilCtrl'];
2015  $tpl = $DIC['tpl'];
2016  global $DIC; /* @var \ILIAS\DI\Container $DIC */
2017  $ilHelp = $DIC['ilHelp']; /* @var ilHelpGUI $ilHelp */
2018 
2019  $this->getTabsManager()->getQuestionsSubTabs();
2021 
2022  $subScreenId = array('createQuestion');
2023 
2024  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
2025 
2026  $ilCtrl->setParameter($this, 'qtype', $_REQUEST['qtype']);
2027 
2028  $form = new ilPropertyFormGUI();
2029 
2030  $form->setFormAction($ilCtrl->getFormAction($this, "executeCreateQuestion"));
2031  $form->setTitle($lng->txt("ass_create_question"));
2032  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
2033 
2034  $pool = new ilObjQuestionPool();
2035  $questionTypes = $pool->getQuestionTypes(false, true, false);
2036  $options = array();
2037 
2038  // question type
2039  foreach ($questionTypes as $label => $data) {
2040  $options[$data['question_type_id']] = $label;
2041  }
2042 
2043  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
2044  $si = new ilSelectInputGUI($lng->txt("question_type"), "qtype");
2045  $si->setOptions($options);
2046  $form->addItem($si, true);
2047 
2048  // position
2049  $questions = $this->object->getQuestionTitlesAndIndexes();
2050  if ($questions) {
2051  $si = new ilSelectInputGUI($lng->txt("position"), "position");
2052  $options = array('0' => $lng->txt('first'));
2053  foreach ($questions as $key => $title) {
2054  $options[$key] = $lng->txt('behind') . ' ' . $title . ' [' . $this->lng->txt('question_id_short') . ': ' . $key . ']';
2055  }
2056  $si->setOptions($options);
2057  $si->setValue($_REQUEST['q_id']);
2058  $form->addItem($si, true);
2059  }
2060 
2061  // content editing mode
2063  $subScreenId[] = 'editMode';
2064 
2065  $ri = new ilRadioGroupInputGUI($lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
2066 
2067  $ri->addOption(new ilRadioOption(
2068  $lng->txt('tst_add_quest_cont_edit_mode_page_object'),
2070  ));
2071 
2072  $ri->addOption(new ilRadioOption(
2073  $lng->txt('tst_add_quest_cont_edit_mode_default'),
2075  ));
2076 
2078 
2079  $form->addItem($ri, true);
2080  } else {
2081  $hi = new ilHiddenInputGUI("question_content_editing_type");
2083  $form->addItem($hi, true);
2084  }
2085 
2086  if ($this->object->getPoolUsage()) {
2087  $subScreenId[] = 'poolSelect';
2088 
2089  // use pool
2090  $usage = new ilRadioGroupInputGUI($this->lng->txt("assessment_pool_selection"), "usage");
2091  $usage->setRequired(true);
2092  $no_pool = new ilRadioOption($this->lng->txt("assessment_no_pool"), 1);
2093  $usage->addOption($no_pool);
2094  $existing_pool = new ilRadioOption($this->lng->txt("assessment_existing_pool"), 3);
2095  $usage->addOption($existing_pool);
2096  $new_pool = new ilRadioOption($this->lng->txt("assessment_new_pool"), 2);
2097  $usage->addOption($new_pool);
2098  $form->addItem($usage);
2099 
2100  $usage->setValue(1);
2101 
2102  $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, true, false, false, "write");
2103  $pools_data = array();
2104  foreach ($questionpools as $key => $p) {
2105  $pools_data[$key] = $p['title'];
2106  }
2107  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_qpl");
2108  $pools->setOptions($pools_data);
2109  $existing_pool->addSubItem($pools);
2110 
2111  $name = new ilTextInputGUI($this->lng->txt("name"), "txt_qpl");
2112  $name->setSize(50);
2113  $name->setMaxLength(50);
2114  $new_pool->addSubItem($name);
2115  }
2116 
2117  $form->addCommandButton("executeCreateQuestion", $lng->txt("create"));
2118  $form->addCommandButton("questions", $lng->txt("cancel"));
2119 
2120  $DIC->tabs()->activateTab('assQuestions');
2121  $ilHelp->setScreenId('assQuestions');
2122  $ilHelp->setSubScreenId(implode('_', $subScreenId));
2123 
2124  return $tpl->setContent($form->getHTML());
2125  }
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.
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
global $ilCtrl
Definition: ilias.php:18
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.
addOption($a_option)
Add Option.
setValue($a_value)
Set Value.
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
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 ...
$DIC
Definition: xapitoken.php:46
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 1098 of file class.ilObjTestGUI.php.

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

1099  {
1100  $tstdef = $this->getDidacticTemplateVar("tstdef");
1101  if ($tstdef) {
1102  $testDefaultsId = $tstdef;
1103  $testDefaults = ilObjTest::_getTestDefaults($testDefaultsId);
1104  $a_new_object->applyDefaults($testDefaults);
1105  }
1106 
1107  $template_id = $this->getDidacticTemplateVar("tsttpl");
1108  if ($template_id) {
1109  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
1111 
1112  $template_settings = $template->getSettings();
1113  if ($template_settings) {
1114  $this->applyTemplate($template_settings, $a_new_object);
1115  }
1116 
1117  $a_new_object->setTemplate($template_id);
1118  }
1119 
1120  $a_new_object->saveToDb();
1121 
1122  // always send a message
1123  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
1124  $this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId());
1125  $this->ctrl->redirectByClass('ilObjTestSettingsGeneralGUI');
1126  }
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 2638 of file class.ilObjTestGUI.php.

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

Referenced by confirmedApplyDefaultsObject().

2639  {
2640  if (!is_array($_POST["chb_defaults"]) || 1 !== count($_POST["chb_defaults"])) {
2642  $this->lng->txt("tst_defaults_apply_select_one")
2643  );
2644 
2645  return $this->defaultsObject();
2646  }
2647 
2648  // do not apply if user datasets exist
2649  if ($this->object->evalTotalPersons() > 0) {
2651  $this->lng->txt("tst_defaults_apply_not_possible")
2652  );
2653 
2654  return $this->defaultsObject();
2655  }
2656 
2657  $defaults = &$this->object->getTestDefaults($_POST["chb_defaults"][0]);
2658  $defaultSettings = unserialize($defaults["defaults"]);
2659 
2660  if (isset($defaultSettings['isRandomTest'])) {
2661  if ($defaultSettings['isRandomTest']) {
2662  $newQuestionSetType = ilObjTest::QUESTION_SET_TYPE_RANDOM;
2663  $this->object->setQuestionSetType(ilObjTest::QUESTION_SET_TYPE_RANDOM);
2664  } else {
2665  $newQuestionSetType = ilObjTest::QUESTION_SET_TYPE_FIXED;
2666  $this->object->setQuestionSetType(ilObjTest::QUESTION_SET_TYPE_FIXED);
2667  }
2668  } elseif (isset($defaultSettings['questionSetType'])) {
2669  $newQuestionSetType = $defaultSettings['questionSetType'];
2670  }
2671  $oldQuestionSetType = $this->object->getQuestionSetType();
2672  $questionSetTypeSettingSwitched = ($oldQuestionSetType != $newQuestionSetType);
2673 
2674  $oldQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfigByType($oldQuestionSetType);
2675 
2676  switch (true) {
2677  case !$questionSetTypeSettingSwitched:
2678  case !$oldQuestionSetConfig->doesQuestionSetRelatedDataExist():
2679  case $confirmed:
2680 
2681  break;
2682 
2683  default:
2684 
2685  require_once 'Modules/Test/classes/confirmations/class.ilTestSettingsChangeConfirmationGUI.php';
2686  $confirmation = new ilTestSettingsChangeConfirmationGUI($this->lng, $this->object);
2687 
2688  $confirmation->setFormAction($this->ctrl->getFormAction($this));
2689  $confirmation->setCancel($this->lng->txt('cancel'), 'defaults');
2690  $confirmation->setConfirm($this->lng->txt('confirm'), 'confirmedApplyDefaults');
2691 
2692  $confirmation->setOldQuestionSetType($this->object->getQuestionSetType());
2693  $confirmation->setNewQuestionSetType($newQuestionSetType);
2694  $confirmation->setQuestionLossInfoEnabled(false);
2695  $confirmation->build();
2696 
2697  $confirmation->populateParametersFromPost();
2698 
2699  $this->tpl->setContent($this->ctrl->getHTML($confirmation));
2700 
2701  return;
2702  }
2703 
2704  if ($questionSetTypeSettingSwitched && !$this->object->getOfflineStatus()) {
2705  $this->object->setOfflineStatus(true);
2706 
2707  $info = $this->lng->txt("tst_set_offline_due_to_switched_question_set_type_setting");
2708 
2709  ilUtil::sendInfo($info, true);
2710  }
2711 
2712  $this->object->applyDefaults($defaults);
2713 
2714  ilUtil::sendSuccess($this->lng->txt("tst_defaults_applied"), true);
2715 
2716  if ($questionSetTypeSettingSwitched && $oldQuestionSetConfig->doesQuestionSetRelatedDataExist()) {
2717  $oldQuestionSetConfig->removeQuestionSetRelatedData();
2718  }
2719 
2720  $this->ctrl->redirect($this, 'defaults');
2721  }
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 3529 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().

3531  {
3532  // map formFieldName => setterName
3533  $simpleSetters = array(
3534 
3535  // general properties
3536  'use_pool' => 'setPoolUsage',
3537  'question_set_type' => 'setQuestionSetType',
3538 
3539  // test intro properties
3540  'intro_enabled' => 'setIntroductionEnabled',
3541  'showinfo' => 'setShowInfo',
3542 
3543  // test access properties
3544  'chb_starting_time' => 'setStartingTimeEnabled',
3545  'chb_ending_time' => 'setEndingTimeEnabled',
3546  'password_enabled' => 'setPasswordEnabled',
3547  'fixedparticipants' => 'setFixedParticipants',
3548  'limitUsers' => 'setLimitUsersEnabled',
3549 
3550  // test run properties
3551  'nr_of_tries' => 'setNrOfTries',
3552  'chb_processing_time' => 'setEnableProcessingTime',
3553  'kiosk' => 'setKiosk',
3554  'examid_in_test_pass' => 'setShowExamIdInTestPassEnabled',
3555 
3556  // question behavior properties
3557  'title_output' => 'setTitleOutput',
3558  'autosave' => null, // handled specially in loop below
3559  'chb_shuffle_questions' => 'setShuffleQuestions',
3560  'offer_hints' => 'setOfferingQuestionHintsEnabled',
3561  'instant_feedback_contents' => 'setInstantFeedbackOptionsByArray',
3562  'instant_feedback_trigger' => 'setForceInstantFeedbackEnabled',
3563  'answer_fixation_handling' => null, // handled specially in loop below
3564  'obligations_enabled' => 'setObligationsEnabled',
3565 
3566  // test sequence properties
3567  'chb_use_previous_answers' => 'setUsePreviousAnswers',
3568  'chb_show_cancel' => 'setShowCancel',
3569  'chb_postpone' => 'setPostponingEnabled',
3570  'list_of_questions' => 'setListOfQuestionsSettings',
3571  'chb_show_marker' => 'setShowMarker',
3572 
3573  // test finish properties
3574  'enable_examview' => 'setEnableExamview',
3575  'showfinalstatement' => 'setShowFinalStatement',
3576  'redirection_enabled' => null, // handled specially in loop below
3577  'sign_submission' => 'setSignSubmission',
3578  'mailnotification' => 'setMailNotification',
3579 
3580  // scoring options properties
3581  'count_system' => 'setCountSystem',
3582  'mc_scoring' => 'setMCScoring',
3583  'score_cutting' => 'setScoreCutting',
3584  'pass_scoring' => 'setPassScoring',
3585  'pass_deletion_allowed' => 'setPassDeletionAllowed',
3586 
3587  // result summary properties
3588  'results_access_enabled' => 'setScoreReporting',
3589  'grading_status' => 'setShowGradingStatusEnabled',
3590  'grading_mark' => 'setShowGradingMarkEnabled',
3591 
3592  // result details properties
3593  'solution_details' => 'setShowSolutionDetails',
3594  'solution_feedback' => 'setShowSolutionFeedback',
3595  'solution_suggested' => 'setShowSolutionSuggested',
3596  'solution_printview' => 'setShowSolutionPrintview',
3597  'highscore_enabled' => 'setHighscoreEnabled',
3598  'solution_signature' => 'setShowSolutionSignature',
3599  'examid_in_test_res' => 'setShowExamIdInTestResultsEnabled',
3600  'exp_sc_short' => 'setExportSettingsSingleChoiceShort',
3601 
3602  // misc scoring & result properties
3603  'anonymity' => 'setAnonymity',
3604  'enable_archiving' => 'setEnableArchiving'
3605  );
3606 
3607  if (!$templateData['results_presentation']['value']) {
3608  $templateData['results_presentation']['value'] = array();
3609  }
3610 
3611  foreach ($simpleSetters as $field => $setter) {
3612  if ($templateData[$field] && strlen($setter)) {
3613  $object->$setter($templateData[$field]['value']);
3614  continue;
3615  }
3616 
3617  switch ($field) {
3618  case 'autosave':
3619  if ($templateData[$field]['value'] > 0) {
3620  $object->setAutosave(true);
3621  $object->setAutosaveIval($templateData[$field]['value'] * 1000);
3622  } else {
3623  $object->setAutosave(false);
3624  }
3625  break;
3626 
3627  case 'redirection_enabled':
3628  /* if( $templateData[$field]['value'] > REDIRECT_NONE )
3629  {
3630  $object->setRedirectionMode($templateData[$field]['value']);
3631  }
3632  else
3633  {
3634  $object->setRedirectionMode(REDIRECT_NONE);
3635  } */
3636  if (strlen($templateData[$field]['value'])) {
3638  $object->setRedirectionUrl($templateData[$field]['value']);
3639  } else {
3641  $object->setRedirectionUrl('');
3642  }
3643  break;
3644 
3645  case 'answer_fixation_handling':
3646  switch ($templateData[$field]['value']) {
3650  break;
3651 
3655  break;
3656 
3660  break;
3661 
3665  break;
3666  }
3667  break;
3668  }
3669  }
3670  }
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 1468 of file class.ilObjTestGUI.php.

1469  {
1470  $this->ctrl->redirect($this, "questions");
1471  }

◆ backToRepositoryObject()

ilObjTestGUI::backToRepositoryObject ( )

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

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

1129  {
1130  include_once "./Services/Utilities/classes/class.ilUtil.php";
1131  $path = $this->tree->getPathFull($this->object->getRefID());
1132  ilUtil::redirect($this->getReturnLocation("cancel", "./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
1133  }
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 1588 of file class.ilObjTestGUI.php.

1589  {
1590  $this->questionBrowser();
1591  }

◆ buildPageViewToolbar()

ilObjTestGUI::buildPageViewToolbar (   $qid = 0)

Questions per page.

Parameters

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

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

Referenced by executeCommand().

3086  {
3087  if ($this->create_question_mode) {
3088  return;
3089  }
3090 
3091  global $DIC;
3092  $ilToolbar = $DIC['ilToolbar'];
3093  $ilCtrl = $DIC['ilCtrl'];
3094  $lng = $DIC['lng'];
3095 
3096  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
3097 
3098  $ilCtrl->saveParameter($this, 'q_mode');
3099 
3100  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'test_express_mode', 1);
3101  $ilCtrl->setParameter($this, 'test_express_mode', 1);
3102  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', $_REQUEST['q_id']);
3103  $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
3104  $ilToolbar->setFormAction($ilCtrl->getFormActionByClass('iltestexpresspageobjectgui', 'edit'));
3105 
3106  if ($this->object->evalTotalPersons() == 0) {
3107  /*
3108  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
3109  $pool = new ilObjQuestionPool();
3110  $questionTypes = $pool->getQuestionTypes();$options = array();
3111  foreach($questionTypes as $label => $data) {
3112  $options[$data['question_type_id']] = $label;
3113  }
3114 
3115  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3116  $si = new ilSelectInputGUI($lng->txt("test_add_new_question"), "qtype");
3117  $si->setOptions($options);
3118  $ilToolbar->addInputItem($si, true);
3119  /*
3120  // use pool
3121  if ($this->object->isExpressModeQuestionPoolAllowed()) {
3122  include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
3123  $cb = new ilCheckboxInputGUI($lng->txt("test_use_pool"), "use_pool");
3124  $ilToolbar->addInputItem($cb, true);
3125  }
3126  */
3127  $ilToolbar->addFormButton($lng->txt("ass_create_question"), "addQuestion");
3128 
3129  $ilToolbar->addSeparator();
3130 
3131  if ($this->object->getPoolUsage()) {
3132  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
3133 
3135 
3136  $show_separator = true;
3137  }
3138  }
3139 
3140  $questions = $this->object->getQuestionTitlesAndIndexes();
3141 
3142  // desc
3143  $options = array();
3144  foreach ($questions as $id => $label) {
3145  $options[$id] = $label . ' [' . $this->lng->txt('question_id_short') . ': ' . $id . ']';
3146  }
3147 
3148  $optionKeys = array_keys($options);
3149 
3150  if (!$options) {
3151  $options[] = $lng->txt('none');
3152  }
3153  //else if (count($options) > 1) {
3154 // $addSeparator = false;
3155 // if ($optionKeys[0] != $qid) {
3156 // //$ilToolbar->addFormButton($lng->txt("test_prev_question"), "prevQuestion");
3157 // $ilToolbar->addLink($lng->txt("test_prev_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
3158 // $addSeparator = true;
3159 // }
3160  // else {
3161  // $ilToolbar->addSpacer(45);
3162  // }
3163 //
3164 // if ($optionKeys[count($optionKeys)-1] != $qid) {
3165 // //$ilToolbar->addFormButton($lng->txt("test_next_question"), "nextQuestion");
3166 // $ilToolbar->addLink($lng->txt("test_next_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
3167  // $addSeparator = true;
3168 // }
3169  // else {
3170  // $ilToolbar->addSpacer(45);
3171  // }
3172 //
3173 // //if ($addSeparator) {
3174 // $ilToolbar->addSeparator();
3175 // //}
3176 
3177  if (count($questions)) {
3178  if (isset($show_separator) && $show_separator) {
3179  $ilToolbar->addSeparator();
3180  }
3181 
3182  $btn = ilLinkButton::getInstance();
3183  $btn->setCaption("test_prev_question");
3184  $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
3185  $ilToolbar->addButtonInstance($btn);
3186 
3187  if (count($options) <= 1 || $optionKeys[0] == $qid) {
3188  $btn->setDisabled(true);
3189  }
3190 
3191  $btn = ilLinkButton::getInstance();
3192  $btn->setCaption("test_next_question");
3193  $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
3194  $ilToolbar->addButtonInstance($btn);
3195 
3196  if (count($options) <= 1 || $optionKeys[count($optionKeys) - 1] == $qid) {
3197  $btn->setDisabled(true);
3198  }
3199  }
3200 
3201  if (count($questions) > 1) {
3202  $ilToolbar->addSeparator();
3203 
3204  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3205  $si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
3206  $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
3207  $si->setOptions($options);
3208 
3209  if ($qid) {
3210  $si->setValue($qid);
3211  }
3212 
3213  $ilToolbar->addInputItem($si, true);
3214  }
3215 
3216  $total = $this->object->evalTotalPersons();
3217 
3218  /*if (count($options)) {
3219  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3220  $si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
3221  $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
3222  $si->setOptions($options);
3223 
3224  if ($qid) {
3225  $si->setValue($qid);
3226  }
3227 
3228  $ilToolbar->addInputItem($si, true);
3229  }*/
3230 
3231  if (count($questions) && !$total) {
3232  $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
3233  $ilToolbar->addSeparator();
3234  $ilToolbar->addButton($lng->txt("test_delete_page"), $ilCtrl->getLinkTarget($this, "removeQuestions"));
3235  }
3236 
3237  if (count($questions) > 1 && !$total) {
3238  $ilToolbar->addSeparator();
3239  $ilToolbar->addButton($lng->txt("test_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
3240  }
3241 
3242  global $DIC;
3243  $ilAccess = $DIC['ilAccess'];
3244  $ilUser = $DIC['ilUser'];
3245 
3246  $online_access = false;
3247  if ($this->object->getFixedParticipants()) {
3248  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
3249  $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
3250  if ($online_access_result === true) {
3251  $online_access = true;
3252  }
3253  }
3254 
3255  if (!$this->object->getOfflineStatus() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
3256  if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) {
3257  $testSession = $this->testSessionFactory->getSession();
3258 
3259  $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = true);
3260 
3261  if ($executable["executable"]) {
3262  $player_factory = new ilTestPlayerFactory($this->object);
3263  $player_instance = $player_factory->getPlayerGUI();
3264 
3265  if ($testSession->getActiveId() > 0) {
3266  $ilToolbar->addSeparator();
3267  $ilToolbar->addButton($lng->txt('tst_resume_test'), $ilCtrl->getLinkTarget($player_instance, 'resumePlayer'));
3268  } else {
3269  $ilToolbar->addSeparator();
3270  $ilToolbar->addButton($lng->txt('tst_start_test'), $ilCtrl->getLinkTarget($player_instance, 'startTest'));
3271  }
3272  }
3273  }
3274  }
3275  }
$total
Definition: Utf8Test.php:87
global $ilCtrl
Definition: ilias.php:18
static _lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar, $context)
+ 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 1664 of file class.ilObjTestGUI.php.

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

◆ cancelRandomSelectObject()

ilObjTestGUI::cancelRandomSelectObject ( )

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

1540  {
1541  $this->ctrl->redirect($this, "questions");
1542  }

◆ cancelRemoveQuestionsObject()

ilObjTestGUI::cancelRemoveQuestionsObject ( )

Cancels the removal of questions from the test.

Cancels the removal of questions from the test

public

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

1832  {
1833  if ($_REQUEST['test_express_mode']) {
1834  $this->ctrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
1835  $this->ctrl->redirect($this, "showPage");
1836  } else {
1837  $this->ctrl->redirect($this, "questions");
1838  }
1839  }

◆ certificateObject()

ilObjTestGUI::certificateObject ( )

Shows the certificate editor.

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

References $DIC, and ilTestTabsManager\TAB_ID_SETTINGS.

3005  {
3006  global $DIC; /* @var ILIAS\DI\Container $DIC */
3007 
3008  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_SETTINGS);
3009 
3010  $guiFactory = new ilCertificateGUIFactory();
3011  $output_gui = $guiFactory->create($this->object);
3012 
3013  $output_gui->certificateEditor();
3014  }
$DIC
Definition: xapitoken.php:46

◆ confirmedApplyDefaultsObject()

ilObjTestGUI::confirmedApplyDefaultsObject ( )

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

References applyDefaultsObject().

2630  {
2631  $this->applyDefaultsObject(true);
2632  return;
2633  }
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 1773 of file class.ilObjTestGUI.php.

References $_POST.

1774  {
1775  $removeQuestionIds = (array) $_POST["q_id"];
1776 
1777  $questions = $this->object->getQuestionTitlesAndIndexes();
1778 
1779  $this->object->removeQuestions($removeQuestionIds);
1780 
1781  $this->object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
1782 
1783  ilUtil::sendSuccess($this->lng->txt("tst_questions_removed"));
1784 
1785  if ($_REQUEST['test_express_mode']) {
1786  $prev = null;
1787  $return_to = null;
1788  $deleted_tmp = $removeQuestionIds;
1789  $first = array_shift($deleted_tmp);
1790  foreach ((array) $questions as $key => $value) {
1791  if (!in_array($key, $removeQuestionIds)) {
1792  $prev = $key;
1793  if (!$first) {
1794  $return_to = $prev;
1795  break;
1796  } else {
1797  continue;
1798  }
1799  } elseif ($key == $first) {
1800  if ($prev) {
1801  $return_to = $prev;
1802  break;
1803  }
1804  $first = array_shift($deleted_tmp);
1805  }
1806  }
1807 
1808  if (
1809  count($questions) == count($removeQuestionIds) ||
1810  !$return_to
1811  ) {
1812  $this->ctrl->setParameter($this, 'q_id', '');
1813  $this->ctrl->redirect($this, 'showPage');
1814  }
1815 
1816  $this->ctrl->setParameter($this, 'q_id', $return_to);
1817  $this->ctrl->redirect($this, "showPage");
1818  } else {
1819  $this->ctrl->setParameter($this, 'q_id', '');
1820  $this->ctrl->redirect($this, 'questions');
1821  }
1822  }
$_POST["username"]

◆ copyAndLinkQuestionsToPoolObject()

ilObjTestGUI::copyAndLinkQuestionsToPoolObject ( )

ilObjectDataCache $ilObjDataCache

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

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

Referenced by createQuestionPoolAndCopyObject().

3319  {
3320  global $DIC;
3321  $ilObjDataCache = $DIC['ilObjDataCache'];
3322 
3323  if (!(int) $_REQUEST['sel_qpl']) {
3324  ilUtil::sendFailure($this->lng->txt("questionpool_not_selected"));
3325  return $this->copyAndLinkToQuestionpoolObject();
3326  }
3327 
3328  $qplId = $ilObjDataCache->lookupObjId($_REQUEST['sel_qpl']);
3329  $result = $this->copyQuestionsToPool($_REQUEST['q_id'], $qplId);
3330 
3331  foreach ($result->ids as $oldId => $newId) {
3332  $questionInstance = assQuestion::_instanciateQuestion($oldId);
3333 
3334  if (assQuestion::originalQuestionExists($questionInstance->getOriginalId())) {
3335  $oldOriginal = assQuestion::_instanciateQuestion($questionInstance->getOriginalId());
3336  $oldOriginal->delete($oldOriginal->getId());
3337  }
3338 
3339  $questionInstance->setNewOriginalId($newId);
3340  }
3341 
3342  ilUtil::sendSuccess($this->lng->txt('tst_qst_added_to_pool_' . (count($result->ids) > 1 ? 'p' : 's')), true);
3343  $this->ctrl->redirect($this, 'questions');
3344  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
$result
static originalQuestionExists($questionId)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
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 3378 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().

3379  {
3380  global $DIC;
3381  $lng = $DIC['lng'];
3382 
3383  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
3384 
3385  // #13761; All methods use for this request should be revised, thx japo ;-)
3386  if (
3387  'copyAndLinkToQuestionpool' == $this->ctrl->getCmd() &&
3388  (!isset($_REQUEST['q_id']) || !is_array($_REQUEST['q_id']))
3389  ) {
3390  ilUtil::sendFailure($this->lng->txt('tst_no_question_selected_for_moving_to_qpl'), true);
3391  $this->ctrl->redirect($this, 'questions');
3392  }
3393 
3394  if (isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id'])) {
3395  foreach ($_REQUEST['q_id'] as $q_id) {
3397  continue;
3398  }
3399 
3401 
3402  if ($type !== 'tst') {
3403  ilUtil::sendFailure($lng->txt('tst_link_only_unassigned'), true);
3404  $this->ctrl->redirect($this, 'questions');
3405  return;
3406  }
3407  }
3408  }
3409 
3410  $this->createQuestionpoolTargetObject('copyAndLinkQuestionsToPool');
3411  }
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
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyQuestionObject()

ilObjTestGUI::copyQuestionObject ( )

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

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

3786  {
3787  global $DIC;
3788  $ilAccess = $DIC['ilAccess'];
3789  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
3790  // allow only write access
3791  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3792  $this->ctrl->redirect($this, "infoScreen");
3793  }
3794 
3795  if ($_REQUEST['q_id'] && !is_array($_REQUEST['q_id'])) {
3796  $ids = array($_REQUEST['q_id']);
3797  } elseif ($_REQUEST['q_id']) {
3798  $ids = $_REQUEST['q_id'];
3799  } else {
3800  ilUtil::sendFailure($this->lng->txt('copy_no_questions_selected'), true);
3801  $this->ctrl->redirect($this, 'questions');
3802  }
3803 
3804  $copy_count = 0;
3805 
3806  $questionTitles = $this->object->getQuestionTitles();
3807 
3808  foreach ($ids as $id) {
3809  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
3810  $question = assQuestion::_instanciateQuestionGUI($id);
3811  if ($question) {
3812  $title = $question->object->getTitle();
3813  $i = 2;
3814  while (in_array($title . ' (' . $i . ')', $questionTitles)) {
3815  $i++;
3816  }
3817 
3818  $title .= ' (' . $i . ')';
3819 
3820  $questionTitles[] = $title;
3821 
3822  $new_id = $question->object->duplicate(false, $title);
3823 
3824  $clone = assQuestion::_instanciateQuestionGUI($new_id);
3825  $clone->object->setObjId($this->object->getId());
3826  $clone->object->saveToDb();
3827 
3828  $this->object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $new_id, true);
3829 
3830  $copy_count++;
3831  }
3832  }
3833 
3834  ilUtil::sendSuccess($this->lng->txt('copy_questions_success'), true);
3835 
3836  $this->ctrl->redirect($this, 'questions');
3837  }
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.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ copyQuestionsToPool()

ilObjTestGUI::copyQuestionsToPool (   $questionIds,
  $qplId 
)

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

References $result, and copyQuestionToPool().

Referenced by copyAndLinkQuestionsToPoolObject(), and copyQuestionsToPoolObject().

3284  {
3285  $newIds = array();
3286  foreach ($questionIds as $q_id) {
3287  $newId = $this->copyQuestionToPool($q_id, $qplId);
3288  $newIds[$q_id] = $newId;
3289  }
3290 
3291  $result = new stdClass();
3292  $result->ids = $newIds;
3293  $result->qpoolid = $qplId;
3294 
3295  return $result;
3296  }
$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 3277 of file class.ilObjTestGUI.php.

References copyQuestionsToPool().

3278  {
3279  $this->copyQuestionsToPool($_REQUEST['q_id'], $_REQUEST['sel_qpl']);
3280  $this->ctrl->redirect($this, 'questions');
3281  }
copyQuestionsToPool($questionIds, $qplId)
+ Here is the call graph for this function:

◆ copyQuestionToPool()

ilObjTestGUI::copyQuestionToPool (   $sourceQuestionId,
  $targetParentId 
)

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

References assQuestion\instantiateQuestionGUI().

Referenced by copyQuestionsToPool().

3299  {
3300  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
3301  $question_gui = assQuestion::instantiateQuestionGUI($sourceQuestionId);
3302 
3303  $newtitle = $question_gui->object->getTitle();
3304  if ($question_gui->object->questionTitleExists($targetParentId, $question_gui->object->getTitle())) {
3305  $counter = 2;
3306  while ($question_gui->object->questionTitleExists($targetParentId, $question_gui->object->getTitle() . " ($counter)")) {
3307  $counter++;
3308  }
3309  $newtitle = $question_gui->object->getTitle() . " ($counter)";
3310  }
3311 
3312  return $question_gui->object->createNewOriginalFromThisDuplicate($targetParentId, $newtitle);
3313  }
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 3373 of file class.ilObjTestGUI.php.

References createQuestionpoolTargetObject().

3374  {
3375  $this->createQuestionpoolTargetObject('copyQuestionsToPool');
3376  }
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 1676 of file class.ilObjTestGUI.php.

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

Referenced by executeCreateQuestionObject().

1677  {
1678  global $DIC;
1679  $ilUser = $DIC['ilUser'];
1680  $this->getTabsManager()->getQuestionsSubTabs();
1682  //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_qpl_select.html", "Modules/Test");
1683  $questionpools = &$this->object->getAvailableQuestionpools(false, false, false, true, false, "write");
1684 
1685  if ($this->object->getPoolUsage()) {
1686  global $DIC;
1687  $lng = $DIC['lng'];
1688  $ilCtrl = $DIC['ilCtrl'];
1689  $tpl = $DIC['tpl'];
1690 
1691  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1692 
1693  $form = new ilPropertyFormGUI();
1694  $form->setFormAction($ilCtrl->getFormAction($this, "executeCreateQuestion"));
1695  $form->setTitle($lng->txt("ass_create_question"));
1696  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
1697 
1698 
1699  $hidden = new ilHiddenInputGUI('sel_question_types');
1700  $hidden->setValue($_REQUEST["sel_question_types"]);
1701  $form->addItem($hidden);
1702 
1703  // content editing mode
1705  $ri = new ilRadioGroupInputGUI($lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
1706 
1707  $ri->addOption(new ilRadioOption(
1708  $lng->txt('tst_add_quest_cont_edit_mode_default'),
1710  ));
1711 
1712  $ri->addOption(new ilRadioOption(
1713  $lng->txt('tst_add_quest_cont_edit_mode_page_object'),
1715  ));
1716 
1718 
1719  $form->addItem($ri, true);
1720  } else {
1721  $hi = new ilHiddenInputGUI("question_content_editing_type");
1723  $form->addItem($hi, true);
1724  }
1725 
1726  // use pool
1727  $usage = new ilRadioGroupInputGUI($this->lng->txt("assessment_pool_selection"), "usage");
1728  $usage->setRequired(true);
1729  $no_pool = new ilRadioOption($this->lng->txt("assessment_no_pool"), 1);
1730  $usage->addOption($no_pool);
1731  $existing_pool = new ilRadioOption($this->lng->txt("assessment_existing_pool"), 3);
1732  $usage->addOption($existing_pool);
1733  $new_pool = new ilRadioOption($this->lng->txt("assessment_new_pool"), 2);
1734  $usage->addOption($new_pool);
1735  $form->addItem($usage);
1736 
1737  $usage->setValue(1);
1738 
1739  $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(false, false, true, false, false, "write");
1740  $pools_data = array();
1741  foreach ($questionpools as $key => $p) {
1742  $pools_data[$key] = $p['title'];
1743  }
1744  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_qpl");
1745  $pools->setOptions($pools_data);
1746  $existing_pool->addSubItem($pools);
1747 
1748 
1749  $this->lng->loadLanguageModule('rbac');
1750  $name = new ilTextInputGUI($this->lng->txt("rbac_create_qpl"), "txt_qpl");
1751  $name->setSize(50);
1752  $name->setMaxLength(50);
1753  $new_pool->addSubItem($name);
1754 
1755  $form->addCommandButton("executeCreateQuestion", $lng->txt("submit"));
1756  $form->addCommandButton("cancelCreateQuestion", $lng->txt("cancel"));
1757 
1758  return $this->tpl->setVariable('ADM_CONTENT', $form->getHTML());
1759  } else {
1760  global $DIC;
1761  $ilCtrl = $DIC['ilCtrl'];
1762 
1763  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'sel_question_types', $_REQUEST["sel_question_types"]);
1764  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'add_quest_cont_edit_mode', $_REQUEST["add_quest_cont_edit_mode"]);
1765  $link = $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'handleToolbarCommand', '', false, false);
1766  ilUtil::redirect($link);
1767  }
1768  }
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.
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
global $ilCtrl
Definition: ilias.php:18
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.
addOption($a_option)
Add Option.
setValue($a_value)
Set Value.
$ilUser
Definition: imgupload.php:18
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
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 ...
$DIC
Definition: xapitoken.php:46
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 1481 of file class.ilObjTestGUI.php.

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

Referenced by createQuestionPoolAndCopyObject(), and executeCreateQuestionObject().

1482  {
1483  global $DIC;
1484  $tree = $DIC['tree'];
1485  $parent_ref = $tree->getParentId($this->object->getRefId());
1486  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
1487  $qpl = new ilObjQuestionPool();
1488  $qpl->setType("qpl");
1489  $qpl->setTitle($name);
1490  $qpl->setDescription($description);
1491  $qpl->create();
1492  $qpl->createReference();
1493  $qpl->putInTree($parent_ref);
1494  $qpl->setPermissions($parent_ref);
1495  $qpl->setOnline(1); // must be online to be available
1496  $qpl->saveToDb();
1497  return $qpl->getRefId();
1498  }
if($format !==null) $name
Definition: metadata.php:230
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ createQuestionPoolAndCopyObject()

ilObjTestGUI::createQuestionPoolAndCopyObject ( )

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

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

3414  {
3415  if ($_REQUEST['title']) {
3416  $title = $_REQUEST['title'];
3417  } else {
3418  $title = $_REQUEST['txt_qpl'];
3419  }
3420 
3421  if (!$title) {
3422  ilUtil::sendFailure($this->lng->txt("questionpool_not_entered"));
3423  return $this->copyAndLinkToQuestionpoolObject();
3424  }
3425 
3426  $ref_id = $this->createQuestionPool($title, $_REQUEST['description']);
3427  $_REQUEST['sel_qpl'] = $ref_id;
3428 
3429  //if ($_REQUEST['link'])
3430  //{
3432  //}
3433  //else
3434  //{
3435  // $this->copyQuestionsToPoolObject();
3436  //}
3437  }
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 3445 of file class.ilObjTestGUI.php.

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

Referenced by copyAndLinkToQuestionpoolObject(), and copyToQuestionpoolObject().

3446  {
3447  global $DIC; /* @var \ILIAS\DI\Container $DIC */
3448 
3449  $this->getTabsManager()->getQuestionsSubTabs();
3451 
3452  $questionpools = $this->object->getAvailableQuestionpools(
3453  false,
3454  false,
3455  false,
3456  true,
3457  false,
3458  "write"
3459  );
3460 
3461  if (count($questionpools) == 0) {
3462  $form = $this->getTargetQuestionpoolForm($questionpools, 'createQuestionPoolAndCopy');
3463  } else {
3464  $form = $this->getTargetQuestionpoolForm($questionpools, $cmd);
3465 
3466  switch ($cmd) {
3467  case 'copyQuestionsToPool':
3468  break;
3469 
3470  case 'copyAndLinkQuestionsToPool':
3471  $hidden = new ilHiddenInputGUI('link');
3472  $hidden->setValue(1);
3473  $form->addItem($hidden);
3474  break;
3475  }
3476  }
3477 
3478  $DIC->ui()->mainTemplate()->setContent($form->getHTML());
3479  }
This class represents a hidden form property in a property form.
getTargetQuestionpoolForm($questionpools, $cmd)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createRandomSelectionObject()

ilObjTestGUI::createRandomSelectionObject ( )

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

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

1545  {
1546  $this->getTabsManager()->getQuestionsSubTabs();
1548 
1549  $randomQuestionSelectionTable = new ilTestRandomQuestionSelectionTableGUI($this, 'createRandomSelection', $this->object);
1550 
1551  $this->tpl->setContent(
1552  $randomQuestionSelectionTable
1553  ->build((int) $_POST['nr_of_questions'], (int) $_POST['sel_qpl'])
1554  ->getHtml()
1555  );
1556  }
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteDefaultsObject()

ilObjTestGUI::deleteDefaultsObject ( )

Deletes selected test defaults.

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

References $_POST, and ilUtil\sendInfo().

2615  {
2616  if (isset($_POST['chb_defaults']) && is_array($_POST['chb_defaults']) && count($_POST['chb_defaults'])) {
2617  foreach ($_POST['chb_defaults'] as $test_default_id) {
2618  $this->object->deleteDefaults($test_default_id);
2619  }
2620  } else {
2621  ilUtil::sendInfo($this->lng->txt('select_one'));
2622  }
2623  $this->defaultsObject();
2624  }
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 3839 of file class.ilObjTestGUI.php.

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

Referenced by executeCommand().

3840  {
3841  require_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php';
3842  $containerObjId = (int) ilLOSettings::isObjectiveTest($this->ref_id);
3843 
3844  $containerRefId = current(ilObject::_getAllReferences($containerObjId));
3845 
3846  $this->objectiveOrientedContainer->setObjId($containerObjId);
3847  $this->objectiveOrientedContainer->setRefId($containerRefId);
3848  }
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 1429 of file class.ilObjTestGUI.php.

References $_GET, and exit.

1430  {
1431  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1432  $pg_obj = new ilAssQuestionPage($_GET["pg_id"]);
1433  $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
1434  exit;
1435  }
exit
Definition: login.php:29
$_GET["client_id"]
Question page object.

◆ downloadFileObject()

ilObjTestGUI::downloadFileObject ( )

download file

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

References $_GET, and exit.

1408  {
1409  $file = explode("_", $_GET["file_id"]);
1410  include_once("./Modules/File/classes/class.ilObjFile.php");
1411  $fileObj = new ilObjFile($file[count($file) - 1], false);
1412  $fileObj->sendFile();
1413  exit;
1414  }
exit
Definition: login.php:29
$_GET["client_id"]

◆ executeCommand()

ilObjTestGUI::executeCommand ( )

execute command

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

References $_GET, $DIC, Vendor\Package\$e, $GLOBALS, $ilCtrl, $ilDB, ilObjectGUI\$ilErr, $ilUser, ilObjectGUI\$lng, $object, $ret, ilObjectGUI\$tpl, ilObjectGUI\$tree, assQuestionGUI\_getQuestionGUI(), ilObjectGUI\addHeaderAction(), buildPageViewToolbar(), determineObjectiveOrientedContainer(), assQuestionGUI\EDIT_CONTEXT_AUTHORING, fetchAuthoringQuestionIdParameter(), forwardToEvaluationGUI(), ilObjStyleSheet\getContentStylePath(), ilObjectGUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), getObjectiveOrientedContainer(), ilObjStyleSheet\getSyntaxStylePath(), getTabsManager(), getTestAccess(), ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ilObjectGUI\prepareOutput(), prepareSubGuiOutput(), questionsObject(), assQuestionGUI\RENDER_PURPOSE_PREVIEW, 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().

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

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

public

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

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

1601  {
1602  $qpl_ref_id = $_REQUEST["sel_qpl"];
1603 
1604  $qpl_mode = $_REQUEST['usage'];
1605 
1606  if (isset($_REQUEST['qtype'])) {
1607  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
1608  $sel_question_types = ilObjQuestionPool::getQuestionTypeByTypeId($_REQUEST["qtype"]);
1609  } elseif (isset($_REQUEST['sel_question_types'])) {
1610  $sel_question_types = $_REQUEST["sel_question_types"];
1611  }
1612 
1613  if (!$qpl_mode || ($qpl_mode == 2 && strcmp($_REQUEST["txt_qpl"], "") == 0) || ($qpl_mode == 3 && strcmp($qpl_ref_id, "") == 0)) {
1614  //if ((strcmp($_REQUEST["txt_qpl"], "") == 0) && (strcmp($qpl_ref_id, "") == 0))
1615  // Mantis #14890
1616  $_REQUEST['sel_question_types'] = $sel_question_types;
1617  ilUtil::sendInfo($this->lng->txt("questionpool_not_entered"));
1618  $this->createQuestionObject();
1619  return;
1620  } else {
1621  $_SESSION["test_id"] = $this->object->getRefId();
1622  if ($qpl_mode == 2 && strcmp($_REQUEST["txt_qpl"], "") != 0) {
1623  // create a new question pool and return the reference id
1624  $qpl_ref_id = $this->createQuestionPool($_REQUEST["txt_qpl"]);
1625  } elseif ($qpl_mode == 1) {
1626  $qpl_ref_id = $_GET["ref_id"];
1627  }
1628 
1629  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php";
1630  $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;
1631 
1632  if (isset($_REQUEST['prev_qid'])) {
1633  $baselink .= '&prev_qid=' . $_REQUEST['prev_qid'];
1634  } elseif (isset($_REQUEST['position'])) {
1635  $baselink .= '&prev_qid=' . $_REQUEST['position'];
1636  }
1637 
1638  if ($_REQUEST['test_express_mode']) {
1639  $baselink .= '&test_express_mode=1';
1640  }
1641 
1642  if (isset($_REQUEST['add_quest_cont_edit_mode'])) {
1644  $baselink,
1645  "add_quest_cont_edit_mode={$_REQUEST['add_quest_cont_edit_mode']}",
1646  false
1647  );
1648  }
1649 
1650  #var_dump($_REQUEST['prev_qid']);
1651  ilUtil::redirect($baselink);
1652 
1653  exit();
1654  }
1655  }
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 907 of file class.ilObjTestGUI.php.

References $DIC.

908  {
909  global $DIC; /* @var ILIAS\DI\Container $DIC */
910  $DIC->ctrl()->redirectByClass('ilTestExportGUI');
911  }
$DIC
Definition: xapitoken.php:46

◆ fetchAuthoringQuestionIdParameter()

ilObjTestGUI::fetchAuthoringQuestionIdParameter ( )
protected
Returns
int
Exceptions
ilTestException

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

References $_GET, $_POST, and $keys.

Referenced by executeCommand().

918  {
919  $qid = $_REQUEST['q_id'];
920 
921  if (!$qid || $qid == 'Array') {
922  $questions = $this->object->getQuestionTitlesAndIndexes();
923 
924  $keys = array_keys($questions);
925  $qid = (int) ($keys[0] ?? 0);
926 
927  $_REQUEST['q_id'] = $qid;
928  $_GET['q_id'] = $qid;
929  $_POST['q_id'] = $qid;
930  }
931 
932  if ($this->object->checkQuestionParent($qid)) {
933  return $qid;
934  }
935 
936  throw new ilTestException('question id does not relate to parent object!');
937  }
$_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 1444 of file class.ilObjTestGUI.php.

1445  {
1446  $this->questionBrowser();
1447  }

◆ forwardToEvaluationGUI()

ilObjTestGUI::forwardToEvaluationGUI ( )
private

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

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

Referenced by executeCommand(), and userResultsGatewayObject().

997  {
998  $this->prepareOutput();
999  $this->addHeaderAction();
1000 
1001  require_once 'Modules/Test/classes/class.ilTestEvaluationGUI.php';
1002  $gui = new ilTestEvaluationGUI($this->object);
1003  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
1004  $gui->setTestAccess($this->getTestAccess());
1005 
1006  $this->ctrl->forwardCommand($gui);
1007  }
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 1419 of file class.ilObjTestGUI.php.

References $_GET.

1420  {
1421  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
1422  $page_gui = new ilAssQuestionPageGUI($_GET["pg_id"]);
1423  $page_gui->showMediaFullscreen();
1424  }
$_GET["client_id"]
Question page GUI class.

◆ getObjectiveOrientedContainer()

ilObjTestGUI::getObjectiveOrientedContainer ( )
protected

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

References $objectiveOrientedContainer.

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

3851  {
3853  }
+ Here is the caller graph for this function:

◆ getQuestionpoolCreationForm()

ilObjTestGUI::getQuestionpoolCreationForm ( )
private

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

References $DIC, and ilObjectGUI\$lng.

3347  {
3348  global $DIC;
3349  $lng = $DIC['lng'];
3350  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
3351  $form = new ilPropertyFormGUI();
3352 
3353  $title = new ilTextInputGUI($lng->txt('title'), 'title');
3354  $title->setRequired(true);
3355  $form->addItem($title);
3356 
3357  $description = new ilTextAreaInputGUI($lng->txt('description'), 'description');
3358  $form->addItem($description);
3359 
3360  $form->addCommandButton('createQuestionPoolAndCopy', $lng->txt('create'));
3361 
3362  if (isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id'])) {
3363  foreach ($_REQUEST['q_id'] as $id) {
3364  $hidden = new ilHiddenInputGUI('q_id[]');
3365  $hidden->setValue($id);
3366  $form->addItem($hidden);
3367  }
3368  }
3369 
3370  return $form;
3371  }
This class represents a property form user interface.
This class represents a hidden form property in a property form.
This class represents a text area property in a property form.
$DIC
Definition: xapitoken.php:46

◆ getTabs()

ilObjTestGUI::getTabs ( )

adds tabs to tab gui object

Parameters
ilTabsGUI$tabs_gui

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

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

3022  {
3023  global $DIC;
3024  $help = $DIC['ilHelp'];
3025  $help->setScreenIdComponent("tst");
3026 
3027  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
3028  require_once 'Services/Link/classes/class.ilLink.php';
3029  $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
3030  $this->getTabsManager()->setParentBackLabel($this->lng->txt('back_to_objective_container'));
3031  $this->getTabsManager()->setParentBackHref($courseLink);
3032  }
3033 
3034  $this->getTabsManager()->perform();
3035  }
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ getTabsManager()

ilObjTestGUI::getTabsManager ( )

◆ getTargetQuestionpoolForm()

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

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

References $DIC, and ilFormPropertyGUI\setTitle().

Referenced by createQuestionpoolTargetObject().

3482  {
3483  global $DIC; /* @var \ILIAS\DI\Container $DIC */
3484 
3485  $form = new ilPropertyFormGUI();
3486  $form->setFormAction($DIC->ctrl()->getFormAction($this));
3487  $form->addCommandButton($cmd, $DIC->language()->txt('submit'));
3488  $form->addCommandButton('cancelCreateQuestion', $DIC->language()->txt('cancel'));
3489 
3490  if (count($questionpools) == 0) {
3491  $form->setTitle($this->lng->txt("tst_enter_questionpool"));
3492 
3493  $title = new ilTextInputGUI($DIC->language()->txt('title'), 'title');
3494  $title->setRequired(true);
3495  $form->addItem($title);
3496 
3497  $description = new ilTextAreaInputGUI($DIC->language()->txt('description'), 'description');
3498  $form->addItem($description);
3499  } else {
3500  $form->setTitle($this->lng->txt("tst_select_questionpool"));
3501 
3502  $selectOptions = [
3503  '' => $DIC->language()->txt('please_select')
3504  ];
3505 
3506  foreach ($questionpools as $key => $value) {
3507  $selectOptions[$key] = $value["title"];
3508  }
3509 
3510  $select = new ilSelectInputGUI($DIC->language()->txt('tst_source_question_pool'), 'sel_qpl');
3511  $select->setRequired(true);
3512  $select->setOptions($selectOptions);
3513 
3514  $form->addItem($select);
3515  }
3516 
3517  if (isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id'])) {
3518  foreach ($_REQUEST['q_id'] as $id) {
3519  $hidden = new ilHiddenInputGUI('q_id[]');
3520  $hidden->setValue($id);
3521  $form->addItem($hidden);
3522  }
3523  }
3524 
3525  return $form;
3526  }
This class represents a property form user interface.
This class represents a hidden form property in a property form.
setTitle($a_title)
Set Title.
This class represents a text area property in a property form.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestAccess()

ilObjTestGUI::getTestAccess ( )
Returns
ilTestAccess

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

References $testAccess.

Referenced by executeCommand(), and forwardToEvaluationGUI().

968  {
969  return $this->testAccess;
970  }
+ 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 2323 of file class.ilObjTestGUI.php.

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

2324  {
2325  global $DIC; /* @var ILIAS\DI\Container $DIC */
2326 
2327  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_HISTORY);
2328 
2329  include_once "./Modules/Test/classes/tables/class.ilTestHistoryTableGUI.php";
2330  $table_gui = new ilTestHistoryTableGUI($this, 'history');
2331  $table_gui->setTestObject($this->object);
2332  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
2333  $log = &ilObjAssessmentFolder::_getLog(0, time(), $this->object->getId(), true);
2334  $table_gui->setData($log);
2335  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2336  }
$log
Definition: result.php:15
static _getLog($ts_from, $ts_to, $test_id, $test_only=false)
Retrieve assessment log datasets from the database.
$DIC
Definition: xapitoken.php:46
+ 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 1053 of file class.ilObjTestGUI.php.

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

1054  {
1055  if (!$this->checkPermissionBool("create", "", $_REQUEST["new_type"])) {
1056  $this->error->raiseError($this->lng->txt("no_create_permission"));
1057  }
1058 
1059  $form = $this->initImportForm($_REQUEST["new_type"]);
1060  if ($form->checkInput()) {
1061  $this->ctrl->setParameter($this, "new_type", $this->type);
1062  $this->uploadTstObject();
1063  return;
1064  }
1065 
1066  // display form to correct errors
1067  $form->setValuesByPost();
1068  $this->tpl->setContent($form->getHTML());
1069  }
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 1311 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().

1312  {
1313  include_once "./Modules/Test/classes/class.ilObjTest.php";
1314  // create new questionpool object
1315  $newObj = new ilObjTest(0, true);
1316  // set type of questionpool object
1317  $newObj->setType($_GET["new_type"]);
1318  // set title of questionpool object to "dummy"
1319  $newObj->setTitle("dummy");
1320  // set description of questionpool object
1321  $newObj->setDescription("test import");
1322  // create the questionpool class in the ILIAS database (object_data table)
1323  $newObj->create(true);
1324  // create a reference for the questionpool object in the ILIAS database (object_reference table)
1325  $newObj->createReference();
1326  // put the questionpool object in the administration tree
1327  $newObj->putInTree($_GET["ref_id"]);
1328  // get default permissions and set the permissions for the questionpool object
1329  $newObj->setPermissions($_GET["ref_id"]);
1330  // empty mark schema
1331  $newObj->mark_schema->flush();
1332 
1333  // start parsing of QTI files
1334  include_once "./Services/QTI/classes/class.ilQTIParser.php";
1335 
1336  // Handle selection of "no questionpool" as qpl_id = -1 -> use test object id instead.
1337  // possible hint: chek if empty strings in $_POST["qpl_id"] relates to a bug or not
1338  if (!isset($_POST["qpl"]) || "-1" === (string) $_POST["qpl"]) {
1339  $questionParentObjId = $newObj->getId();
1340  } else {
1341  $questionParentObjId = $_POST["qpl"];
1342  }
1343 
1344  if (is_file($_SESSION["tst_import_dir"] . '/' . $_SESSION["tst_import_subdir"] . "/manifest.xml")) {
1345  $newObj->saveToDb();
1346 
1347  $_SESSION['tst_import_idents'] = $_POST['ident'];
1348  $_SESSION['tst_import_qst_parent'] = $questionParentObjId;
1349 
1350  $fileName = $_SESSION['tst_import_subdir'] . '.zip';
1351  $fullPath = $_SESSION['tst_import_dir'] . '/' . $fileName;
1352 
1353  include_once("./Services/Export/classes/class.ilImport.php");
1354  $imp = new ilImport((int) $_GET["ref_id"]);
1355  $map = $imp->getMapping();
1356  $map->addMapping('Modules/Test', 'tst', 'new_id', $newObj->getId());
1357  $imp->importObject($newObj, $fullPath, $fileName, 'tst', 'Modules/Test', true);
1358  } else {
1359  $qtiParser = new ilQTIParser($_SESSION["tst_import_qti_file"], IL_MO_PARSE_QTI, $questionParentObjId, $_POST["ident"]);
1360  if (!isset($_POST["ident"]) || !is_array($_POST["ident"]) || !count($_POST["ident"])) {
1361  $qtiParser->setIgnoreItemsEnabled(true);
1362  }
1363  $qtiParser->setTestObject($newObj);
1364  $result = $qtiParser->startParsing();
1365  $newObj->saveToDb();
1366 
1367  // import page data
1368  include_once("./Modules/LearningModule/classes/class.ilContObjParser.php");
1369  $contParser = new ilContObjParser($newObj, $_SESSION["tst_import_xml_file"], $_SESSION["tst_import_subdir"]);
1370  $contParser->setQuestionMapping($qtiParser->getImportMapping());
1371  $contParser->startParsing();
1372 
1373  if (isset($_POST["ident"]) && is_array($_POST["ident"]) && count($_POST["ident"]) == $qtiParser->getNumImportedItems()) {
1374  // import test results
1375  if (@file_exists($_SESSION["tst_import_results_file"])) {
1376  include_once("./Modules/Test/classes/class.ilTestResultsImportParser.php");
1377  $results = new ilTestResultsImportParser($_SESSION["tst_import_results_file"], $newObj);
1378  $results->setQuestionIdMapping($qtiParser->getQuestionIdMapping());
1379  $results->startParsing();
1380  }
1381  }
1382  $newObj->update();
1383  }
1384 
1385 
1386  // delete import directory
1388 
1389  ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
1390  ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilObjTestGUI");
1391  }
Content Object Parser.
$_SESSION["AccountId"]
$result
$_GET["client_id"]
Import class.
const IL_MO_PARSE_QTI
$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 2750 of file class.ilObjTestGUI.php.

2751  {
2752  #if( !include 'competenzenRocker.php' ) exit;
2753 
2754  $this->ctrl->setCmd("showSummary");
2755  $this->ctrl->setCmdClass("ilinfoscreengui");
2756  $this->infoScreen();
2757  }

◆ initImportForm()

ilObjTestGUI::initImportForm (   $a_new_type)

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

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

Referenced by importFileObject().

2339  {
2340  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2341  $form = new ilPropertyFormGUI();
2342  $form->setTarget("_top");
2343  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
2344  $this->ctrl->setParameter($this, "new_type", $new_type);
2345  $form->setFormAction($this->ctrl->getFormAction($this));
2346  $form->setTitle($this->lng->txt("import_tst"));
2347 
2348  // file
2349  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
2350  $fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc");
2351  $fi->setSuffixes(array("zip"));
2352  $fi->setRequired(true);
2353  $form->addItem($fi);
2354 
2355  // question pool
2356  include_once("./Modules/Test/classes/class.ilObjTest.php");
2357  $tst = new ilObjTest();
2358  $questionpools = $tst->getAvailableQuestionpools(true, false, true, true);
2359  if (count($questionpools)) {
2360  $options = array("-1" => $this->lng->txt("dont_use_questionpool"));
2361  foreach ($questionpools as $key => $value) {
2362  $options[$key] = $value["title"];
2363  }
2364 
2365  $pool = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "qpl");
2366  $pool->setInfo($this->lng->txt('select_question_pool_info'));
2367  $pool->setOptions($options);
2368  $form->addItem($pool);
2369  }
2370 
2371  $form->addCommandButton("importFile", $this->lng->txt("import"));
2372  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
2373 
2374  return $form;
2375  }
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 1960 of file class.ilObjTestGUI.php.

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

1961  {
1962  // get all questions to move
1963  $move_questions = $_SESSION['tst_qst_move_' . $this->object->getTestId()];
1964  if (!is_array($_POST['q_id']) || 0 === count($_POST['q_id'])) {
1965  ilUtil::sendFailure($this->lng->txt("no_target_selected_for_move"), true);
1966  $this->ctrl->redirect($this, 'questions');
1967  }
1968  if (count($_POST['q_id']) > 1) {
1969  ilUtil::sendFailure($this->lng->txt("too_many_targets_selected_for_move"), true);
1970  $this->ctrl->redirect($this, 'questions');
1971  }
1972  $insert_mode = 1;
1973  $this->object->moveQuestions($_SESSION['tst_qst_move_' . $this->object->getTestId()], $_POST['q_id'][0], $insert_mode);
1974  ilUtil::sendSuccess($this->lng->txt("msg_questions_moved"), true);
1975  unset($_SESSION['tst_qst_move_' . $this->object->getTestId()]);
1976  $this->ctrl->redirect($this, "questions");
1977  }
$_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 1937 of file class.ilObjTestGUI.php.

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

1938  {
1939  // get all questions to move
1940  $move_questions = $_SESSION['tst_qst_move_' . $this->object->getTestId()];
1941 
1942  if (!is_array($_POST['q_id']) || 0 === count($_POST['q_id'])) {
1943  ilUtil::sendFailure($this->lng->txt("no_target_selected_for_move"), true);
1944  $this->ctrl->redirect($this, 'questions');
1945  }
1946  if (count($_POST['q_id']) > 1) {
1947  ilUtil::sendFailure($this->lng->txt("too_many_targets_selected_for_move"), true);
1948  $this->ctrl->redirect($this, 'questions');
1949  }
1950  $insert_mode = 0;
1951  $this->object->moveQuestions($_SESSION['tst_qst_move_' . $this->object->getTestId()], $_POST['q_id'][0], $insert_mode);
1952  ilUtil::sendSuccess($this->lng->txt("msg_questions_moved"), true);
1953  unset($_SESSION['tst_qst_move_' . $this->object->getTestId()]);
1954  $this->ctrl->redirect($this, "questions");
1955  }
$_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 1984 of file class.ilObjTestGUI.php.

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

1985  {
1986  $selected_array = (is_array($_POST['q_id'])) ? $_POST['q_id'] : array();
1987  if (!count($selected_array)) {
1988  ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"), true);
1989  $this->ctrl->redirect($this, "browseForQuestions");
1990  } else {
1991  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1992  $manscoring = false;
1993  foreach ($selected_array as $key => $value) {
1994  $this->object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value);
1995  if (!$manscoring) {
1996  $manscoring = $manscoring | assQuestion::_needsManualScoring($value);
1997  }
1998  }
1999  $this->object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
2000  if ($manscoring) {
2001  ilUtil::sendInfo($this->lng->txt("manscoring_hint"), true);
2002  } else {
2003  ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), true);
2004  }
2005  $this->ctrl->redirect($this, "questions");
2006  return;
2007  }
2008  }
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 1565 of file class.ilObjTestGUI.php.

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

1566  {
1567  $selected_array = explode(",", $_POST["chosen_questions"]);
1568  if (!count($selected_array)) {
1569  ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"));
1570  } else {
1571  $total = $this->object->evalTotalPersons();
1572  if ($total) {
1573  // the test was executed previously
1574  ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
1575  } else {
1576  ilUtil::sendInfo($this->lng->txt("tst_insert_questions"));
1577  }
1578  foreach ($selected_array as $key => $value) {
1579  $this->object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value);
1580  }
1581  $this->object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
1582  ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), true);
1583  $this->ctrl->redirect($this, "questions");
1584  return;
1585  }
1586  }
$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 2736 of file class.ilObjTestGUI.php.

Referenced by redirectToInfoScreenObject().

2737  {
2738  if (in_array($this->ctrl->getCmdClass(), self::$infoScreenChildClasses)) {
2739  return true;
2740  }
2741 
2742  return false;
2743  }
+ Here is the caller graph for this function:

◆ movePageFormObject()

ilObjTestGUI::movePageFormObject ( )
protected

Move current page.

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

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

3716  {
3717  global $DIC;
3718  $lng = $DIC['lng'];
3719  $ilCtrl = $DIC['ilCtrl'];
3720  $tpl = $DIC['tpl'];
3721 
3722  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
3723  $form = new ilPropertyFormGUI();
3724  $form->setFormAction($ilCtrl->getFormAction($this, "movePage"));
3725  $form->setTitle($lng->txt("test_move_page"));
3726 
3727  $old_pos = new ilHiddenInputGUI("q_id");
3728  $old_pos->setValue($_REQUEST['q_id']);
3729  $form->addItem($old_pos);
3730 
3731  $questions = $this->object->getQuestionTitlesAndIndexes();
3732  if (!is_array($questions)) {
3733  $questions = array();
3734  }
3735 
3736  foreach ($questions as $k => $q) {
3737  if ($k == $_REQUEST['q_id']) {
3738  unset($questions[$k]);
3739  continue;
3740  }
3741  $questions[$k] = $lng->txt('behind') . ' ' . $q;
3742  }
3743  #$questions['0'] = $lng->txt('first');
3744 
3745  $options = array(
3746  0 => $lng->txt('first')
3747  );
3748  foreach ($questions as $k => $q) {
3749  $options[$k] = $q . ' [' . $this->lng->txt('question_id_short') . ': ' . $k . ']';
3750  }
3751 
3752  $pos = new ilSelectInputGUI($lng->txt("position"), "position_after");
3753  $pos->setOptions($options);
3754  $form->addItem($pos);
3755 
3756  $form->addCommandButton("movePage", $lng->txt("submit"));
3757  $form->addCommandButton("showPage", $lng->txt("cancel"));
3758 
3759  return $tpl->setContent($form->getHTML());
3760  }
This class represents a property form user interface.
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
$DIC
Definition: xapitoken.php:46

◆ movePageObject()

ilObjTestGUI::movePageObject ( )

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

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

3763  {
3764  global $DIC;
3765  $ilAccess = $DIC['ilAccess'];
3766  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
3767  // allow only write access
3768  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3769  $this->ctrl->redirect($this, "infoScreen");
3770  }
3771 
3772  $this->object->moveQuestionAfter($_REQUEST['q_id'], $_REQUEST['position_after']);
3773  $this->showPageObject();
3774  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ moveQuestionsObject()

ilObjTestGUI::moveQuestionsObject ( )

Marks selected questions for moving.

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

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

1922  {
1923  $selected_questions = null;
1924  $selected_questions = $_POST['q_id'];
1925  if (is_array($selected_questions)) {
1926  $_SESSION['tst_qst_move_' . $this->object->getTestId()] = $_POST['q_id'];
1927  ilUtil::sendSuccess($this->lng->txt("msg_selected_for_move"), true);
1928  } else {
1929  ilUtil::sendFailure($this->lng->txt('no_selection_for_move'), true);
1930  }
1931  $this->ctrl->redirect($this, 'questions');
1932  }
$_SESSION["AccountId"]
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 1045 of file class.ilObjTestGUI.php.

1046  {
1047  $this->ctrl->redirectByClass("iltestevaluationgui", "outEvaluation");
1048  }

◆ participantsActionObject()

ilObjTestGUI::participantsActionObject ( )

Evaluates the actions on the participants page.

public

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

References $_POST.

2383  {
2384  $command = $_POST["command"];
2385  if (strlen($command)) {
2386  $method = $command . "Object";
2387  if (method_exists($this, $method)) {
2388  $this->$method();
2389  return;
2390  }
2391  }
2392  $this->ctrl->redirect($this, "participants");
2393  }
$_POST["username"]

◆ populateQuestionBrowserToolbarButtons()

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

Definition at line 2297 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().

2298  {
2299  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
2300 
2301  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CONTEXT_PARAMETER, $context);
2302 
2303  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::MODE_PARAMETER, ilTestQuestionBrowserTableGUI::MODE_BROWSE_POOLS);
2304 
2305  $toolbar->addButton($this->lng->txt("tst_browse_for_qpl_questions"), $this->ctrl->getLinkTargetByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CMD_BROWSE_QUESTIONS));
2306 
2307  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::MODE_PARAMETER, ilTestQuestionBrowserTableGUI::MODE_BROWSE_TESTS);
2308 
2309  $toolbar->addButton($this->lng->txt("tst_browse_for_tst_questions"), $this->ctrl->getLinkTargetByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CMD_BROWSE_QUESTIONS));
2310  }
$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 1023 of file class.ilObjTestGUI.php.

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

Referenced by executeCommand().

1024  {
1025  global $DIC;
1026  $ilUser = $DIC['ilUser'];
1027 
1028  $this->tpl->loadStandardTemplate();
1029 
1030  // set locator
1031  $this->setLocator();
1032 
1033  // catch feedback message
1035 
1036  // set title and description and title icon
1037  $this->setTitleAndDescription();
1038  }
static infoPanel($a_keep=true)
$ilUser
Definition: imgupload.php:18
setTitleAndDescription()
called by prepare output
$DIC
Definition: xapitoken.php:46
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 2402 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().

2403  {
2404  global $DIC;
2405  $ilAccess = $DIC['ilAccess'];
2406  $ilias = $DIC['ilias'];
2407  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
2408  // allow only write access
2409  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2410  $this->ctrl->redirect($this, "infoScreen");
2411  }
2412 
2413  $isPdfDeliveryRequest = isset($_GET['pdf']) && $_GET['pdf'];
2414 
2415  $this->getTabsManager()->getQuestionsSubTabs();
2416  $template = new ilTemplate("tpl.il_as_tst_print_test_confirm.html", true, true, "Modules/Test");
2417 
2418  if (!$isPdfDeliveryRequest) { // #15243
2419  $this->ctrl->setParameter($this, "pdf", "1");
2420  $template->setCurrentBlock("pdf_export");
2421  $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "print"));
2422  $this->ctrl->setParameter($this, "pdf", "");
2423  $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
2424  $template->parseCurrentBlock();
2425 
2426  $template->setCurrentBlock("navigation_buttons");
2427  $template->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
2428  $template->parseCurrentBlock();
2429  }
2430  // prepare generation before contents are processed (for mathjax)
2431  else {
2433  }
2434 
2435  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
2436 
2437  global $DIC;
2438  $ilUser = $DIC['ilUser'];
2439  $print_date = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
2440  $max_points = 0;
2441  $counter = 1;
2442 
2443  require_once 'Modules/Test/classes/class.ilTestQuestionHeaderBlockBuilder.php';
2444  $questionHeaderBlockBuilder = new ilTestQuestionHeaderBlockBuilder($this->lng);
2445  $questionHeaderBlockBuilder->setHeaderMode($this->object->getTitleOutput());
2446 
2447  if ($isPdfDeliveryRequest) {
2448  require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
2450  }
2451 
2452  foreach ($this->object->questions as $question) {
2453  $template->setCurrentBlock("question");
2454  $question_gui = $this->object->createQuestionGUI("", $question);
2455 
2456  if ($isPdfDeliveryRequest) {
2457  $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
2458  }
2459 
2460  $questionHeaderBlockBuilder->setQuestionTitle($question_gui->object->getTitle());
2461  $questionHeaderBlockBuilder->setQuestionPoints($question_gui->object->getMaximumPoints());
2462  $questionHeaderBlockBuilder->setQuestionPosition($counter);
2463  $template->setVariable("QUESTION_HEADER", $questionHeaderBlockBuilder->getHTML());
2464 
2465  $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
2466  $template->setVariable("QUESTION_ID", $question_gui->object->getId());
2467  $result_output = $question_gui->getSolutionOutput("", null, false, true, false, $this->object->getShowSolutionFeedback());
2468  $template->setVariable("SOLUTION_OUTPUT", $result_output);
2469  $template->parseCurrentBlock("question");
2470  $counter++;
2471  $max_points += $question_gui->object->getMaximumPoints();
2472  }
2473 
2474  $template->setVariable("TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
2475  $template->setVariable("PRINT_TEST", ilUtil::prepareFormOutput($this->lng->txt("tst_print")));
2476  $template->setVariable("TXT_PRINT_DATE", ilUtil::prepareFormOutput($this->lng->txt("date")));
2477  $template->setVariable("VALUE_PRINT_DATE", ilUtil::prepareFormOutput(strftime("%c", $print_date)));
2478  $template->setVariable("TXT_MAXIMUM_POINTS", ilUtil::prepareFormOutput($this->lng->txt("tst_maximum_points")));
2479  $template->setVariable("VALUE_MAXIMUM_POINTS", ilUtil::prepareFormOutput($max_points));
2480 
2481  if ($isPdfDeliveryRequest) {
2482  ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitleFilenameCompliant(), PDF_PRINT_VIEW_QUESTIONS);
2483  } else {
2484  $this->tpl->setVariable("PRINT_CONTENT", $template->get());
2485  }
2486  }
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.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
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:

◆ questionsObject()

ilObjTestGUI::questionsObject ( )

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

References $_GET, $_SESSION, $DIC, $ilCtrl, $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().

2128  {
2129  global $DIC; /* @var ILIAS\DI\Container $DIC */
2130  $ilAccess = $DIC['ilAccess'];
2131  $ilTabs = $DIC['ilTabs'];
2132 
2133  // #12590
2134  $this->ctrl->setParameter($this, 'test_express_mode', '');
2135 
2136  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
2137  // allow only write access
2138  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2139  $this->ctrl->redirect($this, "infoScreen");
2140  }
2141 
2142  if ($_GET['browse']) {
2143  return $this->questionbrowser();
2144  }
2145 
2146  $this->getTabsManager()->getQuestionsSubTabs();
2148 
2149  // #11631, #12994
2150  $this->ctrl->setParameter($this, 'q_id', '');
2151 
2152  if ($_GET["eqid"] && $_GET["eqpl"]) {
2153  ilUtil::redirect("ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $_GET["eqpl"] . "&cmd=editQuestionForTest&calling_test=" . $_GET["ref_id"] . "&q_id=" . $_GET["eqid"]);
2154  }
2155 
2156  if ($_GET["up"] > 0) {
2157  $this->object->questionMoveUp($_GET["up"]);
2158  }
2159  if ($_GET["down"] > 0) {
2160  $this->object->questionMoveDown($_GET["down"]);
2161  }
2162 
2163  if ($_GET["add"]) {
2164  $selected_array = array();
2165  array_push($selected_array, $_GET["add"]);
2166  $total = $this->object->evalTotalPersons();
2167  if ($total) {
2168  // the test was executed previously
2169  ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
2170  } else {
2171  ilUtil::sendInfo($this->lng->txt("tst_insert_questions"));
2172  }
2173  $this->insertQuestions($selected_array);
2174  return;
2175  }
2176 
2177  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test");
2178 
2179  $total = $this->object->evalTotalPersons();
2180  if ($ilAccess->checkAccess("write", "", $this->ref_id)) {
2181  if ($total != 0) {
2182  $link = $DIC->ui()->factory()->link()->standard(
2183  $DIC->language()->txt("test_has_datasets_warning_page_view_link"),
2184  $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilParticipantsTestResultsGUI'))
2185  );
2186 
2187  $message = $DIC->language()->txt("test_has_datasets_warning_page_view");
2188 
2189  $msgBox = $DIC->ui()->factory()->messageBox()->info($message)->withLinks(array($link));
2190 
2191  $DIC->ui()->mainTemplate()->setCurrentBlock('mess');
2192  $DIC->ui()->mainTemplate()->setVariable(
2193  'MESSAGE',
2194  $DIC->ui()->renderer()->render($msgBox)
2195  );
2196  $DIC->ui()->mainTemplate()->parseCurrentBlock();
2197  } else {
2198  global $DIC;
2199  $ilToolbar = $DIC['ilToolbar'];
2200 
2201  $ilToolbar->addButton($this->lng->txt("ass_create_question"), $this->ctrl->getLinkTarget($this, "addQuestion"));
2202 
2203  if ($this->object->getPoolUsage()) {
2204  $ilToolbar->addSeparator();
2205 
2206  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
2207 
2209  }
2210 
2211  $ilToolbar->addSeparator();
2212  $ilToolbar->addButton($this->lng->txt("random_selection"), $this->ctrl->getLinkTarget($this, "randomselect"));
2213 
2214 
2215  global $DIC;
2216  $ilAccess = $DIC['ilAccess'];
2217  $ilUser = $DIC['ilUser'];
2218  $lng = $DIC['lng'];
2219  $ilCtrl = $DIC['ilCtrl'];
2220  $online_access = false;
2221  if ($this->object->getFixedParticipants()) {
2222  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
2223  $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
2224  if ($online_access_result === true) {
2225  $online_access = true;
2226  }
2227  }
2228 
2229  if (!$this->object->getOfflineStatus() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
2230  if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) {
2231  $testSession = $this->testSessionFactory->getSession();
2232  $testSequence = $this->testSequenceFactory->getSequenceByTestSession($testSession);
2233 
2234  $testPlayerGUI = $this->testPlayerFactory->getPlayerGUI();
2235 
2236  $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = true);
2237 
2238  if ($executable["executable"]) {
2239  if ($testSession->getActiveId() > 0) {
2240  // resume test
2241 
2242  if ($testSequence->hasStarted($testSession)) {
2243  $execTestLabel = $this->lng->txt("tst_resume_test");
2244  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'resumePlayer');
2245  } else {
2246  $execTestLabel = $this->object->getStartTestLabel($testSession->getActiveId());
2247  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'startPlayer');
2248  }
2249  } else {
2250  // start new test
2251 
2252  $execTestLabel = $this->object->getStartTestLabel($testSession->getActiveId());
2253  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'startPlayer');
2254  }
2255 
2256  $ilToolbar->addSeparator();
2257  $ilToolbar->addButton($execTestLabel, $execTestLink);
2258  }
2259  }
2260  }
2261  }
2262  }
2263 
2264  $table_gui = new ilTestQuestionsTableGUI(
2265  $this,
2266  'questions',
2267  $this->object->getRefId()
2268  );
2269 
2271  is_array($_SESSION['tst_qst_move_' . $this->object->getTestId()])
2272  && count($_SESSION['tst_qst_move_' . $this->object->getTestId()])
2273  );
2274 
2275  $table_gui->setQuestionTitleLinksEnabled(!$total);
2276  $table_gui->setQuestionPositioningEnabled(!$total);
2277  $table_gui->setQuestionManagingEnabled(!$total);
2278  $table_gui->setObligatoryQuestionsHandlingEnabled($this->object->areObligationsEnabled());
2279 
2280  $table_gui->setTotalPoints($this->object->getFixedQuestionSetTotalPoints());
2281  $table_gui->setTotalWorkingTime($this->object->getFixedQuestionSetTotalWorkingTime());
2282 
2283  $table_gui->init();
2284 
2285  $table_gui->setData($this->object->getTestQuestions());
2286 
2287  $this->tpl->setCurrentBlock("adm_content");
2288  $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
2289  $this->tpl->setVariable('QUESTIONBROWSER', $table_gui->getHTML());
2290  $this->tpl->parseCurrentBlock();
2291  }
$_SESSION["AccountId"]
$_GET["client_id"]
$total
Definition: Utf8Test.php:87
global $ilCtrl
Definition: ilias.php:18
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)
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
$message
Definition: xapiexit.php:14
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar, $context)
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 939 of file class.ilObjTestGUI.php.

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

940  {
941  switch ($this->object->getQuestionSetType()) {
943  $this->ctrl->redirectByClass('ilTestExpressPageObjectGUI', 'showPage');
944 
945  // no break
947  $this->ctrl->redirectByClass('ilTestRandomQuestionSetConfigGUI');
948 
949  // no break
951  $this->ctrl->redirectByClass('ilObjTestDynamicQuestionSetConfigGUI');
952  }
953  }
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 1500 of file class.ilObjTestGUI.php.

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

1501  {
1502  $this->getTabsManager()->getQuestionsSubTabs();
1504 
1505  $form = new ilPropertyFormGUI();
1506  $form->setTitle($this->lng->txt('random_selection'));
1507  $form->setFormAction($this->ctrl->getFormAction($this, 'cancelRandomSelect'));
1508 
1509  $form->addCommandButton('createRandomSelection', $this->lng->txt('submit'));
1510  $form->addCommandButton('cancelRandomSelect', $this->lng->txt('cancel'));
1511 
1512  $amount = new ilNumberInputGUI($this->lng->txt('tst_random_nr_of_questions'), 'nr_of_questions');
1513  $amount->allowDecimals(false);
1514  $amount->setSize(5);
1515  $amount->setMinValue(1);
1516  $amount->setValue(5);
1517  $form->addItem($amount);
1518 
1519  $poolSelection = new ilSelectInputGUI($this->lng->txt('tst_source_question_pool'), 'sel_qpl');
1520  $poolSelection->setInfo($this->lng->txt('tst_random_select_questionpool'));
1521  $poolSelection->setRequired(true);
1522  $poolOptions = [];
1523  $questionpools = $this->object->getAvailableQuestionpools(false, false, false, true);
1524  foreach ($questionpools as $key => $value) {
1525  $poolOptions[$key] = $value['title'];
1526  }
1527  $poolSelection->setOptions(
1528  ['0' => $this->lng->txt('all_available_question_pools')] + $poolOptions
1529  );
1530  $form->addItem($poolSelection);
1531 
1532  $questionType = new ilHiddenInputGUI('sel_question_types');
1533  $questionType->setValue(ilUtil::stripSlashes($_POST['sel_question_types']));
1534  $form->addItem($questionType);
1535 
1536  $this->tpl->setContent($form->getHTML());
1537  }
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:

◆ redirectTo_ilObjTestSettingsGeneralGUI_showForm_Object()

ilObjTestGUI::redirectTo_ilObjTestSettingsGeneralGUI_showForm_Object ( )
private

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

References ilObjTestSettingsGeneralGUI\CMD_SHOW_FORM.

1010  {
1011  require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
1012  $this->ctrl->redirectByClass('ilObjTestSettingsGeneralGUI', ilObjTestSettingsGeneralGUI::CMD_SHOW_FORM);
1013  }

◆ redirectToInfoScreenObject()

ilObjTestGUI::redirectToInfoScreenObject ( )

◆ removeImportFailsObject()

ilObjTestGUI::removeImportFailsObject ( )
protected

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

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

2933  {
2934  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
2935  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
2936  $qsaImportFails->deleteRegisteredImportFails();
2937 
2938  require_once 'Modules/Test/classes/class.ilTestSkillLevelThresholdImportFails.php';
2939  $sltImportFails = new ilTestSkillLevelThresholdImportFails($this->object->getId());
2940  $sltImportFails->deleteRegisteredImportFails();
2941 
2942  $this->ctrl->redirect($this, 'infoScreen');
2943  }
+ 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 1848 of file class.ilObjTestGUI.php.

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

Referenced by removeQuestionsObject().

1849  {
1850  $total = $this->object->evalTotalPersons();
1851  if ($total) {
1852  // the test was executed previously
1853  $question = sprintf($this->lng->txt("tst_remove_questions_and_results"), $total);
1854  } else {
1855  if (count($checked_questions) == 1) {
1856  $question = $this->lng->txt("tst_remove_question");
1857  } else {
1858  $question = $this->lng->txt("tst_remove_questions");
1859  }
1860  }
1861 
1862  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1863  $cgui = new ilConfirmationGUI();
1864  $cgui->setHeaderText($question);
1865 
1866  $this->ctrl->saveParameter($this, 'test_express_mode');
1867  $this->ctrl->saveParameter($this, 'q_id');
1868 
1869  $cgui->setFormAction($this->ctrl->getFormAction($this));
1870  $cgui->setCancel($this->lng->txt("cancel"), "cancelRemoveQuestions");
1871  $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
1872 
1873  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1874  $removablequestions = &$this->object->getTestQuestions();
1875  if (count($removablequestions)) {
1876  foreach ($removablequestions as $data) {
1877  if (in_array($data["question_id"], $checked_questions)) {
1878  $txt = $data["title"] . " (" . assQuestion::_getQuestionTypeName($data["type_tag"]) . ")";
1879  $txt .= ' [' . $this->lng->txt('question_id_short') . ': ' . $data['question_id'] . ']';
1880 
1881  if ($data["description"]) {
1882  $txt .= "<div class=\"small\">" . $data["description"] . "</div>";
1883  }
1884 
1885  $cgui->addItem("q_id[]", $data["question_id"], $txt);
1886  }
1887  }
1888  }
1889 
1890  $this->tpl->setContent($cgui->getHTML());
1891  }
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 1896 of file class.ilObjTestGUI.php.

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

1897  {
1898  $this->getTabsManager()->getQuestionsSubTabs();
1899 
1900  $checked_questions = $_REQUEST["q_id"];
1901 
1902  if (!is_array($checked_questions) && $checked_questions) {
1903  $checked_questions = array($checked_questions);
1904  }
1905 
1906  if (!is_array($checked_questions)) {
1907  $checked_questions = [];
1908  }
1909 
1910  if (count($checked_questions) > 0) {
1911  $this->removeQuestionsForm($checked_questions);
1912  } elseif (0 === count($checked_questions)) {
1913  ilUtil::sendFailure($this->lng->txt("tst_no_question_selected_for_removal"), true);
1914  $this->ctrl->redirect($this, "questions");
1915  }
1916  }
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 1456 of file class.ilObjTestGUI.php.

1457  {
1458  $this->questionBrowser();
1459  }

◆ 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 2495 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().

2496  {
2497  global $DIC;
2498  $ilAccess = $DIC['ilAccess'];
2499 
2500  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
2501  // allow only write access
2502  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2503  $this->ctrl->redirect($this, "infoScreen");
2504  }
2505  $this->getTabsManager()->getQuestionsSubTabs();
2506  $template = new ilTemplate("tpl.il_as_tst_print_test_confirm.html", true, true, "Modules/Test");
2507 
2508  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
2509 
2510  $isPdfDeliveryRequest = isset($_GET['pdf']) && $_GET['pdf'];
2511 
2512  $max_points = 0;
2513  $counter = 1;
2514 
2515  require_once 'Modules/Test/classes/class.ilTestQuestionHeaderBlockBuilder.php';
2516  $questionHeaderBlockBuilder = new ilTestQuestionHeaderBlockBuilder($this->lng);
2517  $questionHeaderBlockBuilder->setHeaderMode($this->object->getTitleOutput());
2518 
2519  if ($isPdfDeliveryRequest) {
2520  require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
2522 
2523  // prepare generation before contents are processed (for mathjax)
2525  }
2526 
2527  foreach ($this->object->questions as $question) {
2528  $template->setCurrentBlock("question");
2529  $question_gui = $this->object->createQuestionGUI("", $question);
2530  $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
2531 
2532  $questionHeaderBlockBuilder->setQuestionTitle($question_gui->object->getTitle());
2533  $questionHeaderBlockBuilder->setQuestionPoints($question_gui->object->getMaximumPoints());
2534  $questionHeaderBlockBuilder->setQuestionPosition($counter);
2535  $template->setVariable("QUESTION_HEADER", $questionHeaderBlockBuilder->getHTML());
2536 
2537  $template->setVariable("SOLUTION_OUTPUT", $question_gui->getPreview(false));
2538  $template->parseCurrentBlock("question");
2539  $counter++;
2540  $max_points += $question_gui->object->getMaximumPoints();
2541  }
2542 
2543  $template->setVariable("TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
2544  $template->setVariable("PRINT_TEST", ilUtil::prepareFormOutput($this->lng->txt("review_view")));
2545  $template->setVariable("TXT_PRINT_DATE", ilUtil::prepareFormOutput($this->lng->txt("date")));
2546  $usedRelativeDates = ilDatePresentation::useRelativeDates();
2548  $template->setVariable(
2549  "VALUE_PRINT_DATE",
2551  );
2552  ilDatePresentation::setUseRelativeDates($usedRelativeDates);
2553  $template->setVariable("TXT_MAXIMUM_POINTS", ilUtil::prepareFormOutput($this->lng->txt("tst_maximum_points")));
2554  $template->setVariable("VALUE_MAXIMUM_POINTS", ilUtil::prepareFormOutput($max_points));
2555 
2556  if ($isPdfDeliveryRequest) {
2557  ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitleFilenameCompliant(), PDF_PRINT_VIEW_QUESTIONS);
2558  } else {
2559  $this->ctrl->setParameter($this, "pdf", "1");
2560  $template->setCurrentBlock("pdf_export");
2561  $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "review"));
2562  $this->ctrl->setParameter($this, "pdf", "");
2563  $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
2564  $template->parseCurrentBlock();
2565 
2566  $template->setCurrentBlock("navigation_buttons");
2567  $template->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
2568  $template->parseCurrentBlock();
2569 
2570 
2571  $this->tpl->setVariable("PRINT_CONTENT", $template->get());
2572  }
2573  }
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.
$DIC
Definition: xapitoken.php:46
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 1040 of file class.ilObjTestGUI.php.

1041  {
1042  $this->ctrl->redirect($this, "infoScreen");
1043  }

◆ saveOrderAndObligationsObject()

ilObjTestGUI::saveOrderAndObligationsObject ( )

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

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

3673  {
3674  global $DIC;
3675  $ilAccess = $DIC['ilAccess'];
3676  if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
3677  // allow only write access
3678  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3679  $this->ctrl->redirect($this, "infoScreen");
3680  }
3681 
3682  global $DIC;
3683  $ilCtrl = $DIC['ilCtrl'];
3684 
3685  $orders = $obligations = array();
3686 
3687  foreach ((array) $_REQUEST['order'] as $qId => $order) {
3688  $id = (int) str_replace('q_', '', $qId);
3689 
3690  $orders[$id] = $order;
3691  }
3692 
3693  if ($this->object->areObligationsEnabled() && isset($_REQUEST['obligatory']) && is_array($_REQUEST['obligatory'])) {
3694  foreach ($_REQUEST['obligatory'] as $qId => $obligation) {
3695  $id = (int) str_replace('q_', '', $qId);
3696 
3698  $obligations[$id] = $obligation;
3699  }
3700  }
3701  }
3702 
3703  $this->object->setQuestionOrderAndObligations(
3704  $orders,
3705  $obligations
3706  );
3707 
3708  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
3709  $ilCtrl->redirect($this, 'questions');
3710  }
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static isQuestionObligationPossible($questionId)
checks wether the obligation for question with given id is possible or not
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ setTabsManager()

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

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

References $tabsManager.

Referenced by __construct().

992  {
993  $this->tabsManager = $tabsManager;
994  }
+ Here is the caller graph for this function:

◆ setTestAccess()

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

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

References $testAccess.

Referenced by __construct().

976  {
977  $this->testAccess = $testAccess;
978  }
+ Here is the caller graph for this function:

◆ showPageObject()

ilObjTestGUI::showPageObject ( )

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

References $DIC, and $ilCtrl.

Referenced by movePageObject().

3777  {
3778  global $DIC;
3779  $ilCtrl = $DIC['ilCtrl'];
3780 
3781  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', $_REQUEST['q_id']);
3782  $ilCtrl->redirectByClass('iltestexpresspageobjectgui', 'showPage');
3783  }
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ statisticsObject()

ilObjTestGUI::statisticsObject ( )

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

2998  {
2999  }

◆ takenObject()

ilObjTestGUI::takenObject ( )

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

2313  {
2314  }

◆ trackTestObjectReadEvent()

ilObjTestGUI::trackTestObjectReadEvent ( )
protected

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

References $DIC, and ilChangeEvent\_recordReadEvent().

Referenced by executeCommand(), and redirectToInfoScreenObject().

890  {
891  /* @var ILIAS\DI\Container $DIC */ global $DIC;
892 
893  require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
894 
896  $this->object->getType(),
897  $this->object->getRefId(),
898  $this->object->getId(),
899  $DIC->user()->getId()
900  );
901  }
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.
$DIC
Definition: xapitoken.php:46
+ 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 1399 of file class.ilObjTestGUI.php.

References uploadTstObject().

1400  {
1401  $this->uploadTstObject();
1402  }
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 1138 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\sendFailure(), ilUtil\sendInfo(), SINGLE_CHOICE_QUESTION_IDENTIFIER, TEXT_QUESTION_IDENTIFIER, TEXTSUBSET_QUESTION_IDENTIFIER, and ilUtil\unzip().

Referenced by importFileObject(), and uploadObject().

1139  {
1140  if ($_FILES["xmldoc"]["error"] > UPLOAD_ERR_OK) {
1141  ilUtil::sendFailure($this->lng->txt("error_upload"));
1142  $this->createObject();
1143  return;
1144  }
1145  include_once("./Modules/Test/classes/class.ilObjTest.php");
1146  // create import directory
1147  $basedir = ilObjTest::_createImportDirectory();
1148 
1149  // copy uploaded file to import directory
1150  $file = pathinfo($_FILES["xmldoc"]["name"]);
1151  $full_path = $basedir . "/" . $_FILES["xmldoc"]["name"];
1152  ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
1153 
1154  // unzip file
1155  ilUtil::unzip($full_path);
1156 
1157  // determine filenames of xml files
1158  $subdir = basename($file["basename"], "." . $file["extension"]);
1160  $xml_file = ilObjTest::_getImportDirectory() . '/' . $subdir . '/' . $subdir . ".xml";
1161  $qti_file = ilObjTest::_getImportDirectory() . '/' . $subdir . '/' . preg_replace("/test|tst/", "qti", $subdir) . ".xml";
1162  $results_file = ilObjTest::_getImportDirectory() . '/' . $subdir . '/' . preg_replace("/test|tst/", "results", $subdir) . ".xml";
1163 
1164  if (!is_file($qti_file)) {
1165  ilUtil::delDir($basedir);
1166  ilUtil::sendFailure($this->lng->txt("tst_import_non_ilias_zip"));
1167  $this->createObject();
1168  return;
1169  }
1170 
1171  // start verification of QTI files
1172  include_once "./Services/QTI/classes/class.ilQTIParser.php";
1173  $qtiParser = new ilQTIParser($qti_file, IL_MO_VERIFY_QTI, 0, "");
1174  $result = $qtiParser->startParsing();
1175  $founditems = &$qtiParser->getFoundItems();
1176 
1177  $complete = 0;
1178  $incomplete = 0;
1179  foreach ($founditems as $item) {
1180  if (strlen($item["type"])) {
1181  $complete++;
1182  } else {
1183  $incomplete++;
1184  }
1185  }
1186 
1187  if (count($founditems) && $complete == 0) {
1188  // delete import directory
1189  ilUtil::delDir($basedir);
1190 
1191  ilUtil::sendInfo($this->lng->txt("qpl_import_non_ilias_files"));
1192  $this->createObject();
1193  return;
1194  }
1195 
1196  $_SESSION["tst_import_results_file"] = $results_file;
1197  $_SESSION["tst_import_xml_file"] = $xml_file;
1198  $_SESSION["tst_import_qti_file"] = $qti_file;
1199  $_SESSION["tst_import_subdir"] = $subdir;
1200 
1201  if ($qtiParser->getQuestionSetType() != ilObjTest::QUESTION_SET_TYPE_FIXED) {
1202  $this->importVerifiedFileObject();
1203  return;
1204  }
1205 
1206  $importVerificationTpl = new ilTemplate('tpl.tst_import_verification.html', true, true, 'Modules/Test');
1207  // Keep this include because of global constants
1208  include_once "./Services/QTI/classes/class.ilQTIItem.php";
1209 
1210  // on import creation screen the pool was chosen (-1 for no pool)
1211  // BUT when no pool is available the input on creation screen is missing, so the field value -1 for no pool is not submitted.
1212  $QplOrTstID = isset($_POST["qpl"]) && (int) $_POST["qpl"] != 0 ? $_POST["qpl"] : -1;
1213 
1214  $importVerificationTpl->setVariable("TEXT_TYPE", $this->lng->txt("question_type"));
1215  $importVerificationTpl->setVariable("TEXT_TITLE", $this->lng->txt("question_title"));
1216  $importVerificationTpl->setVariable("FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt("tst_import_verify_found_questions"));
1217  $importVerificationTpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_tst"));
1218  $importVerificationTpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1219  $importVerificationTpl->setVariable("ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1220  $importVerificationTpl->setVariable("QUESTIONPOOL_ID", $QplOrTstID);
1221  $importVerificationTpl->setVariable("VALUE_IMPORT", $this->lng->txt("import"));
1222  $importVerificationTpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
1223 
1224  $row_class = ["tblrow1", "tblrow2"];
1225  $counter = 0;
1226  foreach ($founditems as $item) {
1227  $importVerificationTpl->setCurrentBlock("verification_row");
1228  $importVerificationTpl->setVariable("ROW_CLASS", $row_class[$counter++ % 2]);
1229  $importVerificationTpl->setVariable("QUESTION_TITLE", $item["title"]);
1230  $importVerificationTpl->setVariable("QUESTION_IDENT", $item["ident"]);
1231 
1232  switch ($item["type"]) {
1234  case QT_MULTIPLE_CHOICE_MR:
1235  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assMultipleChoice"));
1236  break;
1238  case QT_MULTIPLE_CHOICE_SR:
1239  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assSingleChoice"));
1240  break;
1242  case QT_KPRIM_CHOICE:
1243  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assKprimChoice"));
1244  break;
1246  case QT_LONG_MENU:
1247  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assLongMenu"));
1248  break;
1250  case QT_NUMERIC:
1251  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assNumeric"));
1252  break;
1254  case QT_FORMULA:
1255  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFormulaQuestion"));
1256  break;
1258  case QT_TEXTSUBSET:
1259  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assTextSubset"));
1260  break;
1261  case CLOZE_TEST_IDENTIFIER:
1262  case QT_CLOZE:
1263  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assClozeTest"));
1264  break;
1265  case ERROR_TEXT_IDENTIFIER:
1266  case QT_ERRORTEXT:
1267  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assErrorText"));
1268  break;
1270  case QT_IMAGEMAP:
1271  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assImagemapQuestion"));
1272  break;
1274  case QT_JAVAAPPLET:
1275  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assJavaApplet"));
1276  break;
1278  case QT_FLASHAPPLET:
1279  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFlashApplet"));
1280  break;
1282  case QT_MATCHING:
1283  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assMatchingQuestion"));
1284  break;
1286  case QT_ORDERING:
1287  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assOrderingQuestion"));
1288  break;
1291  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assOrderingHorizontal"));
1292  break;
1294  case QT_TEXT:
1295  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assTextQuestion"));
1296  break;
1298  case QT_FILEUPLOAD:
1299  $importVerificationTpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFileUpload"));
1300  break;
1301  }
1302  $importVerificationTpl->parseCurrentBlock();
1303  }
1304 
1305  $this->tpl->setContent($importVerificationTpl->get());
1306  }
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
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
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
const TEXT_QUESTION_IDENTIFIER
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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 955 of file class.ilObjTestGUI.php.

References forwardToEvaluationGUI().

956  {
957  $this->ctrl->setCmdClass('ilTestEvaluationGUI');
958  $this->ctrl->setCmd('outUserResultsOverview');
959  $this->tabs_gui->clearTargets();
960 
961  $this->forwardToEvaluationGUI();
962  }
+ Here is the call graph for this function:

Field Documentation

◆ $error

ilObjTestGUI::$error
private

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

◆ $infoScreenChildClasses

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

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

◆ $object

ilObjTestGUI::$object = null

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

Referenced by executeCommand().

◆ $objectiveOrientedContainer

ilObjTestGUI::$objectiveOrientedContainer
private

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

Referenced by getObjectiveOrientedContainer().

◆ $tabsManager

ilObjTestGUI::$tabsManager
protected

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

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

◆ $testAccess

ilObjTestGUI::$testAccess
protected

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

Referenced by getTestAccess(), and setTestAccess().

◆ $testPlayerFactory

ilObjTestGUI::$testPlayerFactory = null
private

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

◆ $testQuestionSetConfigFactory

ilObjTestGUI::$testQuestionSetConfigFactory = null
private

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

◆ $testSequenceFactory

ilObjTestGUI::$testSequenceFactory = null
private

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

◆ $testSessionFactory

ilObjTestGUI::$testSessionFactory = null
private

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


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