ILIAS  release_8 Revision v8.24
ilObjQuestionPoolGUI Class Reference

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

+ Inheritance diagram for ilObjQuestionPoolGUI:
+ Collaboration diagram for ilObjQuestionPoolGUI:

Public Member Functions

 __construct ()
 Constructor @access public. More...
 
 downloadFileObject ()
 download file More...
 
 fullscreenObject ()
 show fullscreen view More...
 
 filterObject ()
 set question list filter More...
 
 resetFilterObject ()
 resets filter More...
 
 download_paragraphObject ()
 download source code paragraph More...
 
 uploadQplObject ($questions_only=false)
 imports question(s) into the questionpool More...
 
 importVerifiedFileObject ()
 imports question(s) into the questionpool (after verification) More...
 
 cancelImportObject ()
 
 uploadObject ()
 imports question(s) into the questionpool More...
 
 importQuestionsObject (ilPropertyFormGUI $form=null)
 display the import form to import questions into the questionpool More...
 
 createQuestionObject ()
 create new question More...
 
createQuestionForTestObject ()
 create new question More...
 
 afterSave (ilObject $new_object)
 save object @access public More...
 
 questionObject ()
 
 deleteQuestionsObject ()
 delete questions confirmation screen More...
 
 confirmDeleteQuestionsObject ()
 delete questions More...
 
 cancelDeleteQuestionsObject ()
 Cancel question deletion. More...
 
 exportQuestionObject ()
 export question More...
 
 filterQuestionBrowserObject ()
 
 resetQuestionBrowserObject ()
 
 questionsObject ()
 list questions of question pool More...
 
 printObject ()
 Creates a print view for a question pool. More...
 
 updateObject ()
 updates object entry in object_data More...
 
 pasteObject ()
 paste questios from the clipboard into the question pool More...
 
 copyObject ()
 copy one or more question objects to the clipboard More...
 
 moveObject ()
 mark one or more question objects for moving More...
 
 createExportExcel ()
 
editQuestionForTestObject ()
 edit question More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 getTabs ()
 adds tabs to tab gui object 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...
 
 infoScreenForward ()
 show information screen More...
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 if true, a creation screen is displayed the current [ref_id] don't belong to the current class! The mode is determined in ilRepositoryGUI More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 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 More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _goto ($a_target)
 Redirect script to call a test with the question pool reference id. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 

Data Fields

ilObject $object
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 getQueryParamString (string $param)
 
 getQueryParamInt (string $param)
 
 redirectAfterMissingWrite ()
 
 exportObject ()
 Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::export() More...
 
 getImportQuestionsForm ()
 
 renoveImportFailsObject ()
 
 fetchAuthoringQuestionIdParamater ()
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 form for new questionpool object import More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 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 More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $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 ["ref_id"] value of the request More...
 
 fillCloneTemplate (?string $tpl_name, string $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...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

Protected Attributes

ILIAS TestQuestionPool InternalRequestService $qplrequest
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Private Member Functions

 createQuestionFormObject ()
 
 buildCreateQuestionForm ()
 
 isSkillsTabRequired ()
 
 addSettingsSubTabs (ilTabsGUI $tabs)
 
 buildQuestionBrowserTableGUI ($taxIds)
 

Detailed Description

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

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

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

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

@ilCtrl_Calls ilObjQuestionPoolGUI: ilAssQuestionPageGUI, ilQuestionBrowserTableGUI, ilToolbarGUI @ilCtrl_Calls ilObjQuestionPoolGUI: assMultipleChoiceGUI, assClozeTestGUI, assMatchingQuestionGUI @ilCtrl_Calls ilObjQuestionPoolGUI: assOrderingQuestionGUI, assImagemapQuestionGUI @ilCtrl_Calls ilObjQuestionPoolGUI: assNumericGUI, assTextSubsetGUI, assSingleChoiceGUI, ilPropertyFormGUI @ilCtrl_Calls ilObjQuestionPoolGUI: assTextQuestionGUI, ilObjectMetaDataGUI, ilPermissionGUI, ilObjectCopyGUI @ilCtrl_Calls ilObjQuestionPoolGUI: ilQuestionPoolExportGUI, ilInfoScreenGUI, ilObjTaxonomyGUI, ilCommonActionDispatcherGUI @ilCtrl_Calls ilObjQuestionPoolGUI: ilAssQuestionHintsGUI, ilAssQuestionFeedbackEditingGUI, ilLocalUnitConfigurationGUI @ilCtrl_Calls ilObjQuestionPoolGUI: ilObjQuestionPoolSettingsGeneralGUI, assFormulaQuestionGUI @ilCtrl_Calls ilObjQuestionPoolGUI: ilAssQuestionPreviewGUI @ilCtrl_Calls ilObjQuestionPoolGUI: assKprimChoiceGUI, assLongMenuGUI @ilCtrl_Calls ilObjQuestionPoolGUI: ilQuestionPoolSkillAdministrationGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilObjQuestionPoolGUI::__construct ( )

Constructor @access public.

Definition at line 55 of file class.ilObjQuestionPoolGUI.php.

56 {
57 global $DIC;
58 $lng = $DIC['lng'];
59 $ilCtrl = $DIC['ilCtrl'];
60 $rbacsystem = $DIC['rbacsystem'];
61 $lng->loadLanguageModule("assessment");
62 $this->type = "qpl";
63 $this->error = $DIC['ilErr'];
64 $this->ctrl = &$ilCtrl;
65
66 $this->ctrl->saveParameter($this, array(
67 "ref_id", "test_ref_id", "calling_test", "test_express_mode", "q_id", 'tax_node', 'calling_consumer', 'consumer_context'
68 ));
69 $this->ctrl->saveParameter($this, "calling_consumer");
70 $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'calling_consumer');
71 $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'consumer_context');
72 $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'calling_consumer');
73 $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'consumer_context');
74 $this->qplrequest = $DIC->testQuestionPool()->internal()->request();
75
76 parent::__construct("", $this->qplrequest->raw("ref_id"), true, false);
77 }
error(string $a_errmsg)
loadLanguageModule(string $a_module)
Load language module.
ilLanguage $lng
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ilObjectGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), error(), and ilLanguage\loadLanguageModule().

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjQuestionPoolGUI::_goto (   $a_target)
static

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

Redirect script to call a test with the question pool reference id

Parameters
integer$a_targetThe reference id of the question pool @access public

Definition at line 1753 of file class.ilObjQuestionPoolGUI.php.

1753 : void
1754 {
1755 global $DIC;
1756 $main_tpl = $DIC->ui()->mainTemplate();
1757 $ilAccess = $DIC['ilAccess'];
1758 $ilErr = $DIC['ilErr'];
1759 $lng = $DIC['lng'];
1760 $ctrl = $DIC['ilCtrl'];
1761
1762 if ($ilAccess->checkAccess("write", "", (int) $a_target)
1763 || $ilAccess->checkAccess('read', '', (int) $a_target)
1764 ) {
1765 $target_class = ilObjQuestionPoolGUI::class;
1766 $target_cmd = 'questions';
1767 $ctrl->setParameterByClass($target_class, 'ref_id', $a_target);
1768 $ctrl->redirectByClass([ilRepositoryGUI::class, $target_class], $target_cmd);
1769 return;
1770 }
1771 if ($ilAccess->checkAccess('visible', "", $a_target)) {
1772 ilObjectGUI::_gotoRepositoryNode($a_target, 'infoScreen');
1773 return;
1774 }
1775 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1776 $main_tpl->setOnScreenMessage(
1777 'info',
1778 sprintf(
1779 $lng->txt("msg_no_perm_read_item"),
1781 ),
1782 true
1783 );
1785 return;
1786 }
1787 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1788 }
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
const ROOT_FOLDER_ID
Definition: constants.php:32
$ilErr
Definition: raiseError.php:17

References ilObjectGUI\$ctrl, $DIC, $ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilCtrl\redirectByClass(), ROOT_FOLDER_ID, ilCtrl\setParameterByClass(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjQuestionPoolGUI::addLocatorItems ( )

should be overwritten to add object specific items (repository items are preloaded)

Reimplemented from ilObjectGUI.

Definition at line 1448 of file class.ilObjQuestionPoolGUI.php.

1448 : void
1449 {
1450 global $DIC;
1451 $ilLocator = $DIC['ilLocator'];
1452
1453 switch ($this->ctrl->getCmd()) {
1454 case "create":
1455 case "importFile":
1456 case "cancel":
1457 break;
1458 default:
1459 $this->ctrl->clearParameterByClass(self::class, 'q_id');
1460 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->qplrequest->getRefId());
1461 $this->ctrl->setParameter($this, 'q_id', $this->qplrequest->getQuestionId());
1462 break;
1463 }
1464
1465 if (!is_array($this->qplrequest->raw("q_id")) && $this->qplrequest->raw("q_id") > 0 && $this->qplrequest->raw('cmd') !== 'questions') {
1466 $q_gui = assQuestionGUI::_getQuestionGUI("", $this->qplrequest->raw("q_id"));
1467 if ($q_gui !== null && $q_gui->object instanceof assQuestion) {
1468 $q_gui->object->setObjId($this->object->getId());
1469 $title = $q_gui->object->getTitle();
1470 if (!$title) {
1471 $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
1472 }
1473 $ilLocator->addItem($title, $this->ctrl->getLinkTargetByClass(get_class($q_gui), "editQuestion"));
1474 } else {
1475 // Workaround for context issues: If no object was found, redirect without q_id parameter
1476 $this->ctrl->setParameter($this, 'q_id', '');
1477 $this->ctrl->redirect($this);
1478 }
1479 }
1480 }
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
Abstract basic class which is to be extended by the concrete assessment question type classes.
static _getQuestionTypeName($type_tag)

References $DIC, assQuestionGUI\_getQuestionGUI(), assQuestion\_getQuestionTypeName(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ addSettingsSubTabs()

ilObjQuestionPoolGUI::addSettingsSubTabs ( ilTabsGUI  $tabs)
private

Definition at line 1699 of file class.ilObjQuestionPoolGUI.php.

1699 : void
1700 {
1701 $tabs->addSubTabTarget(
1702 'qpl_settings_subtab_general',
1703 $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1704 '',
1705 'ilObjQuestionPoolSettingsGeneralGUI'
1706 );
1707
1708 $tabs->addSubTabTarget(
1709 'qpl_settings_subtab_taxonomies',
1710 $this->ctrl->getLinkTargetByClass('ilObjTaxonomyGUI', 'editAOTaxonomySettings'),
1711 '',
1712 'ilObjTaxonomyGUI'
1713 );
1714 }
addSubTabTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)

References ilTabsGUI\addSubTabTarget(), and ILIAS\Repository\ctrl().

Referenced by getTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterSave()

ilObjQuestionPoolGUI::afterSave ( ilObject  $new_object)

save object @access public

Reimplemented from ilObjectGUI.

Definition at line 952 of file class.ilObjQuestionPoolGUI.php.

952 : void
953 {
954 // always send a message
955 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
956
957 ilUtil::redirect("ilias.php?ref_id=" . $new_object->getRefId() .
958 "&baseClass=ilObjQuestionPoolGUI");
959 }
static redirect(string $a_script)

References ilObject\getRefId(), ILIAS\Repository\lng(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ buildCreateQuestionForm()

ilObjQuestionPoolGUI::buildCreateQuestionForm ( )
private

Definition at line 1221 of file class.ilObjQuestionPoolGUI.php.

1222 {
1223 global $DIC;
1224 $ilUser = $DIC['ilUser'];
1225 $form = new ilPropertyFormGUI();
1226 $form->setTitle($this->lng->txt('ass_create_question'));
1227 $form->setFormAction($this->ctrl->getFormAction($this));
1228
1229 // question type
1230
1231 $options = array();
1232 foreach ($this->object->getQuestionTypes(false, true, false) as $translation => $data) {
1233 $options[$data['type_tag']] = $translation;
1234 }
1235 $si = new ilSelectInputGUI($this->lng->txt('question_type'), 'sel_question_types');
1236 $si->setOptions($options);
1237 //$si->setValue($ilUser->getPref("tst_lastquestiontype"));
1238
1239 $form->addItem($si);
1240
1241 // content editing mode
1242
1244 $ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
1245
1246 $option_ipe = new ilRadioOption(
1247 $this->lng->txt('tst_add_quest_cont_edit_mode_IPE'),
1249 );
1250 $option_ipe->setInfo($this->lng->txt('tst_add_quest_cont_edit_mode_IPE_info'));
1251 $ri->addOption($option_ipe);
1252
1253 $option_rte = new ilRadioOption(
1254 $this->lng->txt('tst_add_quest_cont_edit_mode_RTE'),
1256 );
1257 $option_rte->setInfo($this->lng->txt('tst_add_quest_cont_edit_mode_RTE_info'));
1258 $ri->addOption($option_rte);
1259
1261
1262 $form->addItem($ri, true);
1263 } else {
1264 $hi = new ilHiddenInputGUI("question_content_editing_type");
1266 $form->addItem($hi, true);
1267 }
1268
1269 // commands
1270
1271 $form->addCommandButton('createQuestion', $this->lng->txt('create'));
1272 $form->addCommandButton('questions', $this->lng->txt('cancel'));
1273
1274 return $form;
1275 }
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not.
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
$ilUser
Definition: imgupload.php:34

References ilObjectGUI\$data, $DIC, $ilUser, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_IPE, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, ILIAS\Repository\ctrl(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by createQuestionFormObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionBrowserTableGUI()

ilObjQuestionPoolGUI::buildQuestionBrowserTableGUI (   $taxIds)
private
Parameters
array$taxIds@global ilRbacSystem $rbacsystem @global ilDBInterface $ilDB @global ilLanguage $lng
Returns
ilQuestionBrowserTableGUI

Definition at line 1797 of file class.ilObjQuestionPoolGUI.php.

1798 {
1799 global $DIC;
1800 $rbacsystem = $DIC['rbacsystem'];
1801 $ilDB = $DIC['ilDB'];
1802 $lng = $DIC['lng'];
1803 /* @var ilComponentRepository $component_repository */
1804 $component_repository = $DIC['component.repository'];
1805
1806 $writeAccess = (bool) $rbacsystem->checkAccess('write', $this->qplrequest->getRefId());
1807 $enableCommenting = $writeAccess;
1808
1809 $table_gui = new ilQuestionBrowserTableGUI(
1810 $this,
1811 'questions',
1812 $writeAccess,
1813 false,
1814 $taxIds,
1815 $enableCommenting
1816 );
1817
1818 $table_gui->setEditable($writeAccess);
1819 $questionList = new ilAssQuestionList(
1820 $ilDB,
1821 $lng,
1822 $this->refinery,
1823 $component_repository
1824 );
1825 $questionList->setParentObjId($this->object->getId());
1826
1827 foreach ($table_gui->getFilterItems() as $item) {
1828 if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1829 $v = $item->getValue();
1830
1831 if (is_array($v) && count($v) && !(int) $v[0]) {
1832 continue;
1833 }
1834
1835 $taxId = substr($item->getPostVar(), strlen('tax_'));
1836
1837 $questionList->addTaxonomyFilter(
1838 $taxId,
1839 $item->getValue(),
1840 $this->object->getId(),
1841 $this->object->getType()
1842 );
1843 } elseif ($item->getValue() != false) {
1844 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1845 }
1846 }
1847
1848 if ($this->object->isNavTaxonomyActive() && (int) $this->qplrequest->raw('tax_node')) {
1849 $taxTree = new ilTaxonomyTree($this->object->getNavTaxonomyId());
1850 $rootNodeId = $taxTree->readRootId();
1851
1852 if ((int) $this->qplrequest->raw('tax_node') != $rootNodeId) {
1853 $questionList->addTaxonomyFilter(
1854 $this->object->getNavTaxonomyId(),
1855 array((int) $this->qplrequest->raw('tax_node')),
1856 $this->object->getId(),
1857 $this->object->getType()
1858 );
1859 }
1860 }
1861
1862 $questionList->load();
1863 $data = $questionList->getQuestionDataArray();
1864
1865 $table_gui->setQuestionData($data);
1866
1867 return $table_gui;
1868 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilObjectGUI\$data, $DIC, $ilDB, ilObjectGUI\$lng, ILIAS\Repository\object(), and ILIAS\Repository\refinery().

Referenced by questionsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelDeleteQuestionsObject()

ilObjQuestionPoolGUI::cancelDeleteQuestionsObject ( )

Cancel question deletion.

Definition at line 1023 of file class.ilObjQuestionPoolGUI.php.

1023 : void
1024 {
1025 $this->ctrl->redirect($this, "questions");
1026 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ cancelImportObject()

ilObjQuestionPoolGUI::cancelImportObject ( )

Definition at line 841 of file class.ilObjQuestionPoolGUI.php.

841 : void
842 {
843 if ($_POST["questions_only"] == 1) {
844 $this->ctrl->redirect($this, "questions");
845 } else {
846 $this->ctrl->redirect($this, "cancel");
847 }
848 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ confirmDeleteQuestionsObject()

ilObjQuestionPoolGUI::confirmDeleteQuestionsObject ( )

delete questions

Definition at line 1004 of file class.ilObjQuestionPoolGUI.php.

1004 : void
1005 {
1006 // delete questions after confirmation
1007 foreach ($_POST["q_id"] as $key => $value) {
1008 $this->object->deleteQuestion($value);
1009 $this->object->cleanupClipboard($value);
1010 }
1011 if (count($_POST["q_id"])) {
1012 $this->tpl->setOnScreenMessage('success', $this->lng->txt("qpl_questions_deleted"), true);
1013 }
1014
1015 $this->ctrl->setParameter($this, 'q_id', '');
1016
1017 $this->ctrl->redirect($this, "questions");
1018 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ copyObject()

ilObjQuestionPoolGUI::copyObject ( )

copy one or more question objects to the clipboard

Definition at line 1336 of file class.ilObjQuestionPoolGUI.php.

1336 : void
1337 {
1338 if (isset($_POST["q_id"]) && is_array($_POST["q_id"]) && count($_POST["q_id"]) > 0) {
1339 foreach ($_POST["q_id"] as $key => $value) {
1340 $this->object->copyToClipboard($value);
1341 }
1342 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_copy_insert_clipboard"), true);
1343 } elseif ($this->qplrequest->isset('q_id') && $this->qplrequest->getQuestionId() > 0) {
1344 $this->object->copyToClipboard($this->qplrequest->getQuestionId());
1345 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_copy_insert_clipboard"), true);
1346 } else {
1347 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_copy_select_none"), true);
1348 }
1349 $this->ctrl->redirect($this, "questions");
1350 }

References ILIAS\LTI\ToolProvider\$key, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ createExportExcel()

ilObjQuestionPoolGUI::createExportExcel ( )

Definition at line 1371 of file class.ilObjQuestionPoolGUI.php.

1371 : void
1372 {
1373 global $DIC;
1374 $rbacsystem = $DIC['rbacsystem'];
1375 if ($rbacsystem->checkAccess("write", $this->qplrequest->getRefId())) {
1376 $question_ids = &$this->object->getAllQuestionIds();
1377 $qpl_exp = new ilQuestionpoolExport($this->object, 'xls', $question_ids);
1378 $qpl_exp->buildExportFile();
1379 $this->ctrl->redirectByClass("ilquestionpoolexportgui", "");
1380 }
1381 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ createQuestionFormObject()

ilObjQuestionPoolGUI::createQuestionFormObject ( )
private

Definition at line 1203 of file class.ilObjQuestionPoolGUI.php.

1203 : void
1204 {
1205 global $DIC; /* @var \ILIAS\DI\Container $DIC */
1206 $ilHelp = $DIC['ilHelp']; /* @var ilHelpGUI $ilHelp */
1207
1208 $ilHelp->setScreenId('assQuestions');
1209
1211 $ilHelp->setSubScreenId('createQuestion_editMode');
1212 } else {
1213 $ilHelp->setSubScreenId('createQuestion');
1214 }
1215
1216 $form = $this->buildCreateQuestionForm();
1217
1218 $this->tpl->setContent($this->ctrl->getHTML($form));
1219 }

References $DIC, buildCreateQuestionForm(), ILIAS\Repository\ctrl(), and ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled().

+ Here is the call graph for this function:

◆ createQuestionForTestObject()

& ilObjQuestionPoolGUI::createQuestionForTestObject ( )

create new question

Definition at line 921 of file class.ilObjQuestionPoolGUI.php.

921 : void
922 {
923 if (!$this->qplrequest->raw('q_id')) {
925 $addContEditMode = $this->qplrequest->raw('add_quest_cont_edit_mode');
926 } else {
928 }
929 $q_gui = assQuestionGUI::_getQuestionGUI($this->qplrequest->raw("sel_question_types"));
930 $q_gui->object->setObjId($this->object->getId());
931 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
932 $q_gui->object->createNewQuestion();
933
934 $class = get_class($q_gui);
935 $qId = $q_gui->object->getId();
936 } else {
937 $class = $this->qplrequest->raw("sel_question_types") . 'gui';
938 $qId = $this->qplrequest->raw('q_id');
939 }
940
941 $this->ctrl->setParameterByClass($class, "q_id", $qId);
942 $this->ctrl->setParameterByClass($class, "sel_question_types", $this->qplrequest->raw("sel_question_types"));
943 $this->ctrl->setParameterByClass($class, "prev_qid", $this->qplrequest->raw("prev_qid"));
944
945 $this->ctrl->redirectByClass($class, "editQuestion");
946 }

References assQuestionGUI\_getQuestionGUI(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, ILIAS\Repository\ctrl(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ createQuestionObject()

ilObjQuestionPoolGUI::createQuestionObject ( )

create new question

Definition at line 902 of file class.ilObjQuestionPoolGUI.php.

902 : void
903 {
905 $addContEditMode = $_POST['add_quest_cont_edit_mode'];
906 } else {
908 }
909 $q_gui = assQuestionGUI::_getQuestionGUI($_POST["sel_question_types"]);
910 $q_gui->object->setObjId($this->object->getId());
911 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
912 $q_gui->object->createNewQuestion();
913 $this->ctrl->setParameterByClass(get_class($q_gui), "q_id", $q_gui->object->getId());
914 $this->ctrl->setParameterByClass(get_class($q_gui), "sel_question_types", $_POST["sel_question_types"]);
915 $this->ctrl->redirectByClass(get_class($q_gui), "editQuestion");
916 }

References assQuestionGUI\_getQuestionGUI(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, ILIAS\Repository\ctrl(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ deleteQuestionsObject()

ilObjQuestionPoolGUI::deleteQuestionsObject ( )

delete questions confirmation screen

Definition at line 974 of file class.ilObjQuestionPoolGUI.php.

974 : void
975 {
976 global $DIC;
977 $rbacsystem = $DIC['rbacsystem'];
978
979 $questionIdsToDelete = $this->qplrequest->isset('q_id') ? (array) $this->qplrequest->raw('q_id') : array();
980 if (0 === count($questionIdsToDelete) && $this->qplrequest->isset('q_id')) {
981 $questionIdsToDelete = array($this->qplrequest->getQuestionId());
982 }
983
984 $questionIdsToDelete = array_filter(array_map('intval', $questionIdsToDelete));
985 if (0 === count($questionIdsToDelete)) {
986 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_delete_select_none"), true);
987 $this->ctrl->redirect($this, "questions");
988 }
989
990 $this->tpl->setOnScreenMessage('question', $this->lng->txt("qpl_confirm_delete_questions"));
991 $deleteable_questions = &$this->object->getDeleteableQuestionDetails($questionIdsToDelete);
992 $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', (($rbacsystem->checkAccess('write', $this->qplrequest->getRefId()) ? true : false)), true);
993 $table_gui->setShowRowsSelector(false);
994 $table_gui->setLimit(PHP_INT_MAX);
995 $table_gui->setEditable($rbacsystem->checkAccess('write', $this->qplrequest->getRefId()));
996 $table_gui->setData($deleteable_questions);
997 $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
998 }

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ download_paragraphObject()

ilObjQuestionPoolGUI::download_paragraphObject ( )

download source code paragraph

Definition at line 548 of file class.ilObjQuestionPoolGUI.php.

548 : void
549 {
550 $pg_obj = new ilAssQuestionPage($this->qplrequest->raw("pg_id"));
551 $pg_obj->send_paragraph($this->qplrequest->raw("par_id"), $this->qplrequest->raw("downloadtitle"));
552 exit;
553 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exit
Definition: login.php:28

References exit.

◆ downloadFileObject()

ilObjQuestionPoolGUI::downloadFileObject ( )

download file

Definition at line 509 of file class.ilObjQuestionPoolGUI.php.

509 : void
510 {
511 $file = explode("_", $this->qplrequest->raw("file_id"));
512 $fileObj = new ilObjFile($file[count($file) - 1], false);
513 $fileObj->sendFile();
514 exit;
515 }
Class ilObjFile.

References exit.

◆ editQuestionForTestObject()

& ilObjQuestionPoolGUI::editQuestionForTestObject ( )

edit question

Definition at line 1386 of file class.ilObjQuestionPoolGUI.php.

1386 : void
1387 {
1388 global $DIC;
1389
1390 $p_gui = new ilAssQuestionPreviewGUI(
1391 $this->ctrl,
1392 $this->rbac_system,
1393 $this->tabs_gui,
1394 $this->tpl,
1395 $this->lng,
1396 $DIC->database(),
1397 $DIC->user(),
1398 new RandomGroup(),
1399 $this->ref_id,
1400 $DIC->rbac()
1401 );
1402 $this->ctrl->redirectByClass(get_class($p_gui), "show");
1403 }

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ exportObject()

ilObjQuestionPoolGUI::exportObject ( )
protected

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

Definition at line 500 of file class.ilObjQuestionPoolGUI.php.

500 : void
501 {
502 global $DIC; /* @var ILIAS\DI\Container $DIC */
503 $DIC->ctrl()->redirectByClass('ilQuestionPoolExportGUI');
504 }

References $DIC.

◆ exportQuestionObject()

ilObjQuestionPoolGUI::exportQuestionObject ( )

export question

Definition at line 1031 of file class.ilObjQuestionPoolGUI.php.

1031 : void
1032 {
1033 // export button was pressed
1034 $post = $this->qplrequest->getParsedBody();
1035 if (array_key_exists('q_id', $post) && is_array($post['q_id']) && count($post['q_id']) > 0) {
1036 $qpl_exp = new ilQuestionpoolExport($this->object, "xml", $post["q_id"]);
1037 // @PHP8-CR: This seems to be a pointer to an issue with exports. I like to leave this open for now and
1038 // schedule a thorough examination / analysis for later, eventually involved T&A TechSquad
1039 $export_file = $qpl_exp->buildExportFile();
1040 $filename = $export_file;
1041 $filename = preg_replace("/.*\//", "", $filename);
1042 if ($export_file === '') {
1043 $export_file = "StandIn";
1044 }
1046 exit();
1047 } else {
1048 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_export_select_none"), true);
1049 }
1050 $this->ctrl->redirect($this, "questions");
1051 }
$filename
Definition: buildRTE.php:78
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
$post
Definition: ltitoken.php:49

References $filename, $post, ILIAS\Repository\ctrl(), ilFileDelivery\deliverFileLegacy(), exit, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ fetchAuthoringQuestionIdParamater()

ilObjQuestionPoolGUI::fetchAuthoringQuestionIdParamater ( )
protected
Returns
mixed

Definition at line 1192 of file class.ilObjQuestionPoolGUI.php.

1193 {
1194 $qId = $this->qplrequest->getQuestionId();
1195
1196 if ($this->object->checkQuestionParent($qId)) {
1197 return $qId;
1198 }
1199
1200 throw new ilTestQuestionPoolException('question id does not relate to parent object!');
1201 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ filterObject()

ilObjQuestionPoolGUI::filterObject ( )

set question list filter

Definition at line 530 of file class.ilObjQuestionPoolGUI.php.

530 : void
531 {
532 $this->questionsObject();
533 }
questionsObject()
list questions of question pool

References questionsObject().

+ Here is the call graph for this function:

◆ filterQuestionBrowserObject()

ilObjQuestionPoolGUI::filterQuestionBrowserObject ( )

Definition at line 1053 of file class.ilObjQuestionPoolGUI.php.

1053 : void
1054 {
1055 global $DIC; /* @var ILIAS\DI\Container $DIC */
1056 $enableComments = $DIC->rbac()->system()->checkAccess('write', $this->qplrequest->getRefId());
1057 $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1058 $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', false, false, $taxIds, $enableComments);
1059 $table_gui->resetOffset();
1060 $table_gui->writeFilterToSession();
1061 $this->questionsObject();
1062 }
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)

References $DIC, ilObjTaxonomy\getUsageOfObject(), ILIAS\Repository\object(), and questionsObject().

+ Here is the call graph for this function:

◆ fullscreenObject()

ilObjQuestionPoolGUI::fullscreenObject ( )

show fullscreen view

Definition at line 520 of file class.ilObjQuestionPoolGUI.php.

520 : void
521 {
522 $page_gui = new ilAssQuestionPageGUI($this->qplrequest->raw("pg_id"));
523 $page_gui->showMediaFullscreen();
524 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getImportQuestionsForm()

ilObjQuestionPoolGUI::getImportQuestionsForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 883 of file class.ilObjQuestionPoolGUI.php.

884 {
885 $form = new ilPropertyFormGUI();
886 $form->setTitle($this->lng->txt('import_question'));
887 $form->setFormAction($this->ctrl->getFormAction($this, 'upload'));
888
889 $file = new ilFileInputGUI($this->lng->txt('select_file'), 'xmldoc');
890 $file->setRequired(true);
891 $form->addItem($file);
892
893 $form->addCommandButton('upload', $this->lng->txt('upload'));
894 $form->addCommandButton('questions', $this->lng->txt('cancel'));
895
896 return $form;
897 }
This class represents a file property in a property form.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by importQuestionsObject(), and uploadObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQueryParamInt()

ilObjQuestionPoolGUI::getQueryParamInt ( string  $param)
protected

Definition at line 92 of file class.ilObjQuestionPoolGUI.php.

92 : ?int
93 {
94 if (!$this->request_wrapper->has($param)) {
95 return null;
96 }
97 $trafo = $this->refinery->byTrying([
98 $this->refinery->kindlyTo()->null(),
99 $this->refinery->kindlyTo()->int()
100 ]);
101 return $this->request_wrapper->retrieve($param, $trafo);
102 }
$param
Definition: xapitoken.php:46

References $param, and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getQueryParamString()

ilObjQuestionPoolGUI::getQueryParamString ( string  $param)
protected

Definition at line 80 of file class.ilObjQuestionPoolGUI.php.

80 : ?string
81 {
82 if (!$this->request_wrapper->has($param)) {
83 return null;
84 }
85 $trafo = $this->refinery->byTrying([
86 $this->refinery->kindlyTo()->null(),
87 $this->refinery->kindlyTo()->string()
88 ]);
89 return $this->request_wrapper->retrieve($param, $trafo);
90 }

References $param, and ILIAS\Repository\refinery().

Referenced by getTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTabs()

ilObjQuestionPoolGUI::getTabs ( )

adds tabs to tab gui object

Parameters
object$tabs_guiilTabsGUI object

Reimplemented from ilObjectGUI.

Definition at line 1534 of file class.ilObjQuestionPoolGUI.php.

1534 : void
1535 {
1536 global $DIC;
1537 $ilHelp = $DIC['ilHelp'];
1538
1539 $currentUserHasWriteAccess = $this->access->checkAccess("write", "", $this->object->getRefId());
1540 $currentUserHasReadAccess = $this->access->checkAccess("read", "", $this->object->getRefId());
1541
1542 $ilHelp->setScreenIdComponent("qpl");
1543
1544 $next_class = strtolower($this->ctrl->getNextClass());
1545 switch ($next_class) {
1546 case "":
1547 case "ilpermissiongui":
1548 case "ilobjectmetadatagui":
1549 case "ilquestionpoolexportgui":
1550 case "ilquestionpoolskilladministrationgui":
1551 break;
1552
1553 case 'ilobjtaxonomygui':
1554 case 'ilobjquestionpoolsettingsgeneralgui':
1555
1556 if ($currentUserHasWriteAccess) {
1557 $this->addSettingsSubTabs($this->tabs_gui);
1558 }
1559
1560 break;
1561
1562 default:
1563 return;
1564 break;
1565 }
1566 // questions
1567 $force_active = false;
1568 //$commands = $_POST["cmd"];
1569 $commands = $this->getQueryParamString("cmd");
1570 if (is_array($commands)) {
1571 foreach ($commands as $key => $value) {
1572 if (preg_match("/^delete_.*/", $key, $matches) ||
1573 preg_match("/^addSelectGap_.*/", $key, $matches) ||
1574 preg_match("/^addTextGap_.*/", $key, $matches) ||
1575 preg_match("/^deleteImage_.*/", $key, $matches) ||
1576 preg_match("/^upload_.*/", $key, $matches) ||
1577 preg_match("/^addSuggestedSolution_.*/", $key, $matches)
1578 ) {
1579 $force_active = true;
1580 }
1581 }
1582 }
1583 if (isset($_POST['imagemap_x'])) {
1584 $force_active = true;
1585 }
1586 if (!$force_active) {
1587 $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1588 $this->ctrl->getCmd() == "")
1589 ? true
1590 : false;
1591 }
1592 if ($currentUserHasReadAccess) {
1593 $this->tabs_gui->addTarget(
1594 "assQuestions",
1595 $this->ctrl->getLinkTarget($this, "questions"),
1596 array("questions", "filter", "resetFilter", "createQuestion",
1597 "importQuestions", "deleteQuestions", "filterQuestionBrowser",
1598 "view", "preview", "editQuestion", "exec_pg",
1599 "addItem", "upload", "save", "cancel", "addSuggestedSolution",
1600 "cancelExplorer", "linkChilds", "removeSuggestedSolution",
1601 "add", "addYesNo", "addTrueFalse", "createGaps", "saveEdit",
1602 "setMediaMode", "uploadingImage", "uploadingImagemap", "addArea",
1603 "deletearea", "saveShape", "back", "addPair", "uploadingJavaapplet",
1604 "addParameter", "assessment", "addGIT", "addST", "addPG", "delete",
1605 "toggleGraphicalAnswers", "deleteAnswer", "deleteImage", "removeJavaapplet"),
1606 "",
1607 "",
1608 $force_active
1609 );
1610 }
1611 if ($currentUserHasReadAccess) {
1612 $this->tabs_gui->addTarget(
1613 "info_short",
1614 $this->ctrl->getLinkTarget($this, "infoScreen"),
1615 array("infoScreen", "showSummary")
1616 );
1617 }
1618
1619 if ($currentUserHasWriteAccess) {
1620 // properties
1621 $this->tabs_gui->addTarget(
1622 'settings',
1623 $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1624 array(),
1625 array('ilObjQuestionPoolSettingsGeneralGUI', 'ilObjTaxonomyGUI')
1626 );
1627
1628 // skill service
1629 if ($this->isSkillsTabRequired()) {
1630 $link = $this->ctrl->getLinkTargetByClass(
1631 array('ilQuestionPoolSkillAdministrationGUI', 'ilAssQuestionSkillAssignmentsGUI'),
1633 );
1634
1635 $this->tabs_gui->addTarget('qpl_tab_competences', $link, array(), array());
1636 }
1637 }
1638
1639 if ($currentUserHasReadAccess) {
1640 // print view
1641 $this->tabs_gui->addTarget(
1642 "print_view",
1643 $this->ctrl->getLinkTarget($this, 'print'),
1644 array("print"),
1645 "",
1646 ""
1647 );
1648 }
1649
1650 if ($currentUserHasWriteAccess) {
1651 $mdgui = new ilObjectMetaDataGUI($this->object);
1652 $mdtab = $mdgui->getTab();
1653 if ($mdtab) {
1654 $this->tabs_gui->addTarget(
1655 "meta_data",
1656 $mdtab,
1657 "",
1658 "ilmdeditorgui"
1659 );
1660 }
1661 }
1662
1663 if ($currentUserHasWriteAccess) {
1664 $this->tabs_gui->addTarget(
1665 "export",
1666 $this->ctrl->getLinkTargetByClass("ilquestionpoolexportgui", ""),
1667 "",
1668 "ilquestionpoolexportgui"
1669 );
1670 }
1671
1672 if ($this->access->checkAccess("edit_permission", "", $this->object->getRefId())) {
1673 $this->tabs_gui->addTarget(
1674 "perm_settings",
1675 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1676 array("perm","info","owner"),
1677 'ilpermissiongui'
1678 );
1679 }
1680 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, ILIAS\LTI\ToolProvider\$key, ILIAS\Repository\access(), addSettingsSubTabs(), ilAssQuestionSkillAssignmentsGUI\CMD_SHOW_SKILL_QUEST_ASSIGNS, ILIAS\Repository\ctrl(), getQueryParamString(), isSkillsTabRequired(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ importFileObject()

ilObjQuestionPoolGUI::importFileObject ( int  $parent_id = null)
protected

form for new questionpool object import

Reimplemented from ilObjectGUI.

Definition at line 1426 of file class.ilObjQuestionPoolGUI.php.

1426 : void
1427 {
1428 if ($_REQUEST['new_type'] === null) {
1429 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
1430 $this->ctrl->redirect($this, 'create');
1431 return;
1432 }
1433 if (!$this->checkPermissionBool("create", "", $_REQUEST["new_type"])) {
1434 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
1435 $this->ctrl->redirect($this, 'create');
1436 return;
1437 }
1438
1439 $form = $this->initImportForm($this->qplrequest->raw("new_type"));
1440 if ($form->checkInput()) {
1441 $this->uploadQplObject();
1442 }
1443
1444 // display form to correct errors
1445 $this->tpl->setContent($form->getHTML());
1446 }
uploadQplObject($questions_only=false)
imports question(s) into the questionpool
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)

References ilObjectGUI\checkPermissionBool(), ILIAS\Repository\ctrl(), initImportForm(), ILIAS\Repository\lng(), and uploadQplObject().

+ Here is the call graph for this function:

◆ importQuestionsObject()

ilObjQuestionPoolGUI::importQuestionsObject ( ilPropertyFormGUI  $form = null)

display the import form to import questions into the questionpool

Definition at line 871 of file class.ilObjQuestionPoolGUI.php.

871 : void
872 {
873 if (!$form instanceof ilPropertyFormGUI) {
874 $form = $this->getImportQuestionsForm();
875 }
876
877 $this->tpl->setContent($form->getHtml());
878 }

References getImportQuestionsForm().

Referenced by uploadObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importVerifiedFileObject()

ilObjQuestionPoolGUI::importVerifiedFileObject ( )

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

Definition at line 769 of file class.ilObjQuestionPoolGUI.php.

769 : void
770 {
771 if (!$this->checkPermissionBool('create', '', $this->qplrequest->raw('new_type'))) {
772 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
773 $this->ctrl->redirect($this, 'create');
774 return;
775 }
776 $title = '';
777 $description = null;
778 if ($this->qplrequest->int('questions_only') === 1) {
779 $newObj = $this->object;
780 $title = $this->object->getTitle();
781 $description = $this->object->getDescription();
782 } else {
783 $newObj = new ilObjQuestionPool(0, true);
784 $newObj->setType($this->qplrequest->raw("new_type"));
785 $newObj->setTitle("dummy");
786 $newObj->setDescription("questionpool import");
787 $newObj->create(true);
788 $newObj->createReference();
789 $newObj->putInTree($this->qplrequest->getRefId());
790 $newObj->setPermissions($this->qplrequest->getRefId());
791
792 $title = $this->qplrequest->raw('qpl_new');
793 }
794
795 if (is_string(ilSession::get("qpl_import_dir")) && is_string(ilSession::get("qpl_import_subdir")) && is_file(
796 ilSession::get("qpl_import_dir") . '/' . ilSession::get("qpl_import_subdir") . "/manifest.xml"
797 )) {
798 ilSession::set("qpl_import_idents", $this->qplrequest->raw("ident"));
799
800 $fileName = ilSession::get("qpl_import_subdir") . '.zip';
801 $fullPath = ilSession::get("qpl_import_dir") . '/' . $fileName;
802 $imp = new ilImport($this->qplrequest->getRefId());
803 $map = $imp->getMapping();
804 $map->addMapping("Modules/TestQuestionPool", "qpl", "new_id", $newObj->getId());
805 $imp->importObject($newObj, $fullPath, $fileName, "qpl", "Modules/TestQuestionPool", true);
806 } else {
807 $qtiParser = new ilQTIParser(ilSession::get("qpl_import_qti_file"), ilQTIParser::IL_MO_PARSE_QTI, $newObj->getId(), $this->qplrequest->raw("ident"));
808 $qtiParser->startParsing();
809 // import page data
810 if (strlen(ilSession::get("qpl_import_xml_file"))) {
811 $contParser = new ilQuestionPageParser($newObj, ilSession::get("qpl_import_xml_file"), ilSession::get("qpl_import_subdir"));
812 $contParser->setQuestionMapping($qtiParser->getImportMapping());
813 $contParser->startParsing();
814 // #20494
815 $newObj->fromXML(ilSession::get("qpl_import_xml_file"));
816 }
817
818 // set another question pool name (if possible)
819 if ($title !== '') {
820 $newObj->setTitle($title);
821 }
822
823 if ($description !== null) {
824 $newObj->setDescription($description);
825 }
826
827 $newObj->update();
828 $newObj->saveToDb();
829 }
831
832 if ($_POST["questions_only"] == 1) {
833 $this->ctrl->redirect($this, "questions");
834 } else {
835 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_imported"), true);
836 ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
837 "&baseClass=ilObjQuestionPoolGUI");
838 }
839 }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getImportDirectory()
get import directory of lm
Legacy Content Object Parser.
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.

References $object, ilObjQuestionPool\_getImportDirectory(), ilObjectGUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ilFileUtils\delDir(), ilSession\get(), ilObject\getTitle(), ilQTIParser\IL_MO_PARSE_QTI, ILIAS\Repository\lng(), ilUtil\redirect(), and ilSession\set().

+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjQuestionPoolGUI::infoScreenForward ( )

show information screen

Definition at line 1731 of file class.ilObjQuestionPoolGUI.php.

1731 : void
1732 {
1733 if (!$this->access->checkAccess("visible", "", $this->ref_id)) {
1734 $this->error->raiseError($this->lng->txt("msg_no_perm_read"));
1735 }
1736 $info = new ilInfoScreenGUI($this);
1737 $info->enablePrivateNotes();
1738
1739 // standard meta data
1740 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1741
1742 $this->ctrl->forwardCommand($info);
1743 }
Class ilInfoScreenGUI.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), error(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by infoScreenObject(), and questionsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjQuestionPoolGUI::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 1721 of file class.ilObjQuestionPoolGUI.php.

1721 : void
1722 {
1723 $this->ctrl->setCmd("showSummary");
1724 $this->ctrl->setCmdClass("ilinfoscreengui");
1725 $this->infoScreenForward();
1726 }
infoScreenForward()
show information screen

References ILIAS\Repository\ctrl(), and infoScreenForward().

+ Here is the call graph for this function:

◆ initImportForm()

ilObjQuestionPoolGUI::initImportForm ( string  $new_type)
protected

Reimplemented from ilObjectGUI.

Definition at line 1405 of file class.ilObjQuestionPoolGUI.php.

1406 {
1407 $form = new ilPropertyFormGUI();
1408 $form->setTarget("_top");
1409 $form->setFormAction($this->ctrl->getFormAction($this));
1410 $form->setTitle($this->lng->txt("import_qpl"));
1411
1412 $fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc");
1413 $fi->setSuffixes(array("zip"));
1414 $fi->setRequired(true);
1415 $form->addItem($fi);
1416
1417 $form->addCommandButton("importFile", $this->lng->txt("import"));
1418 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
1419
1420 return $form;
1421 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by importFileObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSkillsTabRequired()

ilObjQuestionPoolGUI::isSkillsTabRequired ( )
private

Definition at line 1682 of file class.ilObjQuestionPoolGUI.php.

1682 : bool
1683 {
1684 if (!($this->object instanceof ilObjQuestionPool)) {
1685 return false;
1686 }
1687
1688 if (!$this->object->isSkillServiceEnabled()) {
1689 return false;
1690 }
1691
1693 return false;
1694 }
1695
1696 return true;
1697 }

References ilObjQuestionPool\isSkillManagementGloballyActivated(), and ILIAS\Repository\object().

Referenced by getTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveObject()

ilObjQuestionPoolGUI::moveObject ( )

mark one or more question objects for moving

Definition at line 1355 of file class.ilObjQuestionPoolGUI.php.

1355 : void
1356 {
1357 if (isset($_POST["q_id"]) && is_array($_POST["q_id"]) && count($_POST["q_id"]) > 0) {
1358 foreach ($_POST["q_id"] as $key => $value) {
1359 $this->object->moveToClipboard($value);
1360 }
1361 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_move_insert_clipboard"), true);
1362 } elseif ($this->qplrequest->isset('q_id') && $this->qplrequest->getQuestionId() > 0) {
1363 $this->object->moveToClipboard($this->qplrequest->getQuestionId());
1364 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_copy_insert_clipboard"), true);
1365 } else {
1366 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_move_select_none"), true);
1367 }
1368 $this->ctrl->redirect($this, "questions");
1369 }

References ILIAS\LTI\ToolProvider\$key, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ pasteObject()

ilObjQuestionPoolGUI::pasteObject ( )

paste questios from the clipboard into the question pool

Definition at line 1319 of file class.ilObjQuestionPoolGUI.php.

1319 : void
1320 {
1321 if (ilSession::get("qpl_clipboard") != null) {
1322 if ($this->object->pasteFromClipboard()) {
1323 $this->tpl->setOnScreenMessage('success', $this->lng->txt("qpl_paste_success"), true);
1324 } else {
1325 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("qpl_paste_error"), true);
1326 }
1327 } else {
1328 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_paste_no_objects"), true);
1329 }
1330 $this->ctrl->redirect($this, "questions");
1331 }

References ILIAS\Repository\ctrl(), ilSession\get(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ printObject()

ilObjQuestionPoolGUI::printObject ( )

Creates a print view for a question pool.

Definition at line 1280 of file class.ilObjQuestionPoolGUI.php.

1280 : void
1281 {
1282 $this->toolbar->setFormAction($this->ctrl->getFormAction($this, 'print'));
1283
1284 $mode = new ilSelectInputGUI($this->lng->txt('output_mode'), 'output');
1285 $mode->setOptions(array(
1286 'overview' => $this->lng->txt('overview'),
1287 'detailed' => $this->lng->txt('detailed_output_solutions'),
1288 'detailed_printview' => $this->lng->txt('detailed_output_printview')
1289 ));
1290
1291 $output = $this->qplrequest->raw('output') ?? '';
1292
1293 $mode->setValue(ilUtil::stripSlashes($output));
1294
1295 $this->toolbar->setFormName('printviewOptions');
1296 $this->toolbar->addInputItem($mode, true);
1297 $this->toolbar->addFormButton($this->lng->txt('submit'), 'print');
1298 $table_gui = new ilQuestionPoolPrintViewTableGUI($this, 'print', $output);
1299 $data = $this->object->getPrintviewQuestions();
1300 $totalPoints = 0;
1301 foreach ($data as $d) {
1302 $totalPoints += $d['points'];
1303 }
1304 $table_gui->setTotalPoints($totalPoints);
1305 $table_gui->initColumns();
1306 $table_gui->setData($data);
1307 $this->tpl->setContent($table_gui->getHTML());
1308 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

References $d, ilObjectGUI\$data, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilUtil\stripSlashes(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ questionObject()

ilObjQuestionPoolGUI::questionObject ( )

Definition at line 961 of file class.ilObjQuestionPoolGUI.php.

961 : void
962 {
963 // @PHP8-CR: With this probably never working and no detectable usages, it would be a candidate for removal...
964 // but it is one of the magic command-methods ($cmd.'Object' - pattern) so I live to leave this in here for now
965 // until it can be further investigated.
966 //echo "<br>ilObjQuestionPoolGUI->questionObject()";
967 $type = $this->qplrequest->raw("sel_question_types");
968 $this->editQuestionForm($type);
969 }

References ilObjectGUI\$type.

◆ questionsObject()

ilObjQuestionPoolGUI::questionsObject ( )

list questions of question pool

Definition at line 1092 of file class.ilObjQuestionPoolGUI.php.

1092 : void
1093 {
1094 if (!$this->access->checkAccess("read", "", $this->qplrequest->getRefId())) {
1095 $this->infoScreenForward();
1096 return;
1097 }
1098
1099 if (get_class($this->object) == "ilObjTest") {
1100 if ($this->qplrequest->raw("calling_test") > 0) {
1101 $ref_id = $this->qplrequest->raw("calling_test");
1102 $q_id = $this->qplrequest->raw("q_id");
1103
1104 if ($this->qplrequest->raw('test_express_mode')) {
1105 if ($q_id) {
1106 ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&q_id=" . $q_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
1107 } else {
1108 ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
1109 }
1110 } else {
1111 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=" . $ref_id . "&cmd=questions");
1112 }
1113 }
1114 } elseif ($this->qplrequest->isset('calling_consumer') && (int) $this->qplrequest->raw('calling_consumer')) {
1115 $ref_id = (int) $this->qplrequest->raw('calling_consumer');
1117 if ($consumer instanceof ilQuestionEditingFormConsumer) {
1118 ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($this->qplrequest->raw('consumer_context')));
1119 }
1121 }
1122
1123 $this->object->purgeQuestions();
1124 // reset test_id SESSION variable
1125 ilSession::set("test_id", "");
1126 $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
1127 if ($qsaImportFails->failedImportsRegistered()) {
1128 $button = ilLinkButton::getInstance();
1129 $button->setUrl($this->ctrl->getLinkTarget($this, 'renoveImportFails'));
1130 $button->setCaption('ass_skl_import_fails_remove_btn');
1131
1132 $this->tpl->setOnScreenMessage('failure', $qsaImportFails->getFailedImportsMessage($this->lng) . '<br />' . $button->render());
1133 }
1134 $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1135
1136 $table_gui = $this->buildQuestionBrowserTableGUI($taxIds);
1137 $table_gui->setPreventDoubleSubmission(false);
1138
1139 if ($this->rbac_system->checkAccess('write', $this->qplrequest->getRefId())) {
1141 $btn->setCaption('ass_create_question');
1142 $btn->setUrl($this->ctrl->getLinkTarget($this, 'createQuestionForm'));
1143 $btn->setPrimary(true);
1144 $this->toolbar->addButtonInstance($btn);
1145
1146
1147 $btnImport = ilLinkButton::getInstance();
1148 $btnImport->setCaption('import');
1149 $btnImport->setUrl($this->ctrl->getLinkTarget($this, 'importQuestions'));
1150 $this->toolbar->addButtonInstance($btnImport);
1151
1152 if (ilSession::get("qpl_clipboard") != null && count(ilSession::get('qpl_clipboard'))) {
1153 $btnPaste = ilLinkButton::getInstance();
1154 $btnPaste->setCaption('paste');
1155 $btnPaste->setUrl($this->ctrl->getLinkTarget($this, 'paste'));
1156 $this->toolbar->addButtonInstance($btnPaste);
1157 }
1158 }
1159
1160 $this->tpl->setContent($this->ctrl->getHTML($table_gui));
1161
1162 if ($this->object->getShowTaxonomies()) {
1163 $this->lng->loadLanguageModule('tax');
1164
1165 foreach ($taxIds as $taxId) {
1166 if ($taxId != $this->object->getNavTaxonomyId()) {
1167 continue;
1168 }
1169
1170 $taxExp = new ilTaxonomyExplorerGUI(
1171 $this,
1172 'showNavTaxonomy',
1173 $taxId,
1174 'ilobjquestionpoolgui',
1175 'questions'
1176 );
1177
1178 if (!$taxExp->handleCommand()) {
1179 $this->tpl->setLeftContent($taxExp->getHTML() . "&nbsp;");
1180 }
1181
1182 break;
1183 }
1184 }
1185
1186 $this->tpl->setPermanentLink($this->object->getType(), $this->object->getRefId());
1187 }
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilObjectGUI\$ref_id, ilLink\_getLink(), ILIAS\Repository\access(), buildQuestionBrowserTableGUI(), ILIAS\Repository\ctrl(), ilSession\get(), ilLinkButton\getInstance(), ilObjectFactory\getInstanceByRefId(), ilObjTaxonomy\getUsageOfObject(), infoScreenForward(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilUtil\redirect(), ilSession\set(), and ILIAS\Repository\toolbar().

Referenced by filterObject(), filterQuestionBrowserObject(), resetFilterObject(), and resetQuestionBrowserObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectAfterMissingWrite()

ilObjQuestionPoolGUI::redirectAfterMissingWrite ( )
protected

Definition at line 488 of file class.ilObjQuestionPoolGUI.php.

489 {
490 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
491 $target_class = get_class($this->object) . "GUI";
492 $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id);
493 $this->ctrl->redirectByClass([ilRepositoryGUI::class, $target_class]);
494 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ renoveImportFailsObject()

ilObjQuestionPoolGUI::renoveImportFailsObject ( )
protected

Definition at line 1081 of file class.ilObjQuestionPoolGUI.php.

1081 : void
1082 {
1083 $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
1084 $qsaImportFails->deleteRegisteredImportFails();
1085
1086 $this->ctrl->redirect($this, 'infoScreen');
1087 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjQuestionPoolGUI::resetFilterObject ( )

resets filter

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

538 : void
539 {
540 $_POST["filter_text"] = "";
541 $_POST["sel_filter_type"] = "";
542 $this->questionsObject();
543 }

References questionsObject().

+ Here is the call graph for this function:

◆ resetQuestionBrowserObject()

ilObjQuestionPoolGUI::resetQuestionBrowserObject ( )

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

1064 : void
1065 {
1066 $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1067
1068 $table_gui = new ilQuestionBrowserTableGUI(
1069 $this,
1070 'questions',
1071 false,
1072 false,
1073 $taxIds
1074 );
1075
1076 $table_gui->resetOffset();
1077 $table_gui->resetFilter();
1078 $this->questionsObject();
1079 }

References ilObjTaxonomy\getUsageOfObject(), ILIAS\Repository\object(), and questionsObject().

+ Here is the call graph for this function:

◆ setTitleAndDescription()

ilObjQuestionPoolGUI::setTitleAndDescription ( )

called by prepare output

Reimplemented from ilObjectGUI.

Definition at line 1485 of file class.ilObjQuestionPoolGUI.php.

1485 : void
1486 {
1487 parent::setTitleAndDescription();
1488
1489 if (!is_array($this->qplrequest->raw("q_id")) && $this->qplrequest->raw("q_id") > 0 && $this->qplrequest->raw('cmd') !== 'questions') {
1490 $q_gui = assQuestionGUI::_getQuestionGUI("", $this->qplrequest->getQuestionId());
1491 if ($q_gui->object instanceof assQuestion) {
1492 $q_gui->object->setObjId($this->object->getId());
1493 $title = $this->object->getTitle() . ': ' . $q_gui->object->getTitle();
1494 if (!$title) {
1495 $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
1496 }
1497 $this->tpl->setTitle(
1498 strip_tags(
1499 $title,
1500 self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1501 )
1502 );
1503 $this->tpl->setDescription(
1504 $q_gui->object->getDescriptionForHTMLOutput()
1505 );
1506 $this->tpl->setTitleIcon(ilObject2::_getIcon($this->object->getId(), "big", $this->object->getType()));
1507 } else {
1508 // Workaround for context issues: If no object was found, redirect without q_id parameter
1509 $this->ctrl->setParameter($this, 'q_id', '');
1510 $this->ctrl->redirect($this);
1511 }
1512 } else {
1513 $this->tpl->setTitle(
1514 strip_tags(
1515 $this->object->getTitle(),
1516 self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1517 )
1518 );
1519 $this->tpl->setDescription(
1520 strip_tags(
1521 $this->object->getLongDescription(),
1522 self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1523 )
1524 );
1525 $this->tpl->setTitleIcon(ilObject2::_getIcon($this->object->getId(), "big", $this->object->getType()));
1526 }
1527 }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.

References ilObject\_getIcon(), assQuestionGUI\_getQuestionGUI(), assQuestion\_getQuestionTypeName(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ updateObject()

ilObjQuestionPoolGUI::updateObject ( )

updates object entry in object_data

Reimplemented from ilObjectGUI.

Definition at line 1310 of file class.ilObjQuestionPoolGUI.php.

1310 : void
1311 {
1312 $this->object->update();
1313 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1314 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ uploadObject()

ilObjQuestionPoolGUI::uploadObject ( )

imports question(s) into the questionpool

Definition at line 853 of file class.ilObjQuestionPoolGUI.php.

853 : void
854 {
855 $upload_valid = true;
856 $form = $this->getImportQuestionsForm();
857 if ($form->checkInput()) {
858 if (!$this->uploadQplObject(true)) {
859 $form->setValuesByPost();
860 $this->importQuestionsObject($form);
861 }
862 } else {
863 $form->setValuesByPost();
864 $this->importQuestionsObject($form);
865 }
866 }
importQuestionsObject(ilPropertyFormGUI $form=null)
display the import form to import questions into the questionpool

References getImportQuestionsForm(), importQuestionsObject(), and uploadQplObject().

+ Here is the call graph for this function:

◆ uploadQplObject()

ilObjQuestionPoolGUI::uploadQplObject (   $questions_only = false)

imports question(s) into the questionpool

Definition at line 558 of file class.ilObjQuestionPoolGUI.php.

559 {
560
561 $this->ctrl->setParameter($this, 'new_type', $this->qplrequest->raw('new_type'));
562 if (!isset($_FILES['xmldoc']) || !isset($_FILES['xmldoc']['error']) || $_FILES['xmldoc']['error'] > UPLOAD_ERR_OK) {
563 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("error_upload"), true);
564 if (!$questions_only) {
565 $this->ctrl->redirect($this, 'create');
566 }
567 return false;
568 }
570
571 $xml_file = '';
572 $qti_file = '';
573 $subdir = '';
574
575 global $DIC; /* @var ILIAS\DI\Container $DIC */
576 // copy uploaded file to import directory
577 $file = pathinfo($_FILES["xmldoc"]["name"]);
578 $full_path = $basedir . "/" . $_FILES["xmldoc"]["name"];
579
580 if (strpos($file['filename'], 'qpl') === false
581 && strpos($file['filename'], 'qti') === false) {
582 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
583 $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
584 $this->ctrl->redirect($this, $cmd);
585 return;
586 }
587
588
589 $DIC['ilLog']->write(__METHOD__ . ": full path " . $full_path);
590 try {
591 ilFileUtils::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
592 } catch (Error $e) {
593 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
594 $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
595 $this->ctrl->redirect($this, $cmd);
596 return;
597 }
598 $DIC['ilLog']->write(__METHOD__ . ": full path " . $full_path);
599 if (strcmp($_FILES["xmldoc"]["type"], "text/xml") == 0) {
600 $qti_file = $full_path;
602 } else {
603 // unzip file
604 ilFileUtils::unzip($full_path);
605
606 // determine filenames of xml files
607 $subdir = basename($file["basename"], "." . $file["extension"]);
609 $xml_file = ilObjQuestionPool::_getImportDirectory() . '/' . $subdir . '/' . $subdir . ".xml";
610 $qti_file = ilObjQuestionPool::_getImportDirectory() . '/' . $subdir . '/' . str_replace("qpl", "qti", $subdir) . ".xml";
611 }
612 if (!file_exists($qti_file)) {
613 ilFileUtils::delDir($basedir);
614 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cannot_find_xml'), true);
615 $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
616 $this->ctrl->redirect($this, $cmd);
617 return false;
618 }
619 $qtiParser = new ilQTIParser($qti_file, ilQTIParser::IL_MO_VERIFY_QTI, 0, "");
620 $qtiParser->startParsing();
621 $founditems = &$qtiParser->getFoundItems();
622 if (count($founditems) == 0) {
623 // nothing found
624
625 // delete import directory
626 ilFileUtils::delDir($basedir);
627
628 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("qpl_import_no_items"), true);
629 if (!$questions_only) {
630 $this->ctrl->redirect($this, 'create');
631 }
632 return false;
633 }
634
635 $complete = 0;
636 $incomplete = 0;
637 foreach ($founditems as $item) {
638 if (strlen($item["type"])) {
639 $complete++;
640 } else {
641 $incomplete++;
642 }
643 }
644
645 if ($complete == 0) {
646 // delete import directory
647 ilFileUtils::delDir($basedir);
648
649 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("qpl_import_non_ilias_files"), true);
650 if (!$questions_only) {
651 $this->ctrl->redirect($this, 'create');
652 }
653 return false;
654 }
655
656 ilSession::set("qpl_import_xml_file", $xml_file);
657 ilSession::set("qpl_import_qti_file", $qti_file);
658 ilSession::set("qpl_import_subdir", $subdir);
659
660 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.qpl_import_verification.html", "Modules/TestQuestionPool");
661 $table = new ilQuestionPoolImportVerificationTableGUI($this, 'uploadQpl');
662 $rows = array();
663
664 foreach ($founditems as $item) {
665 $row = array(
666 'title' => $item['title'],
667 'ident' => $item['ident'],
668 );
669 switch ($item["type"]) {
671 $type = $this->lng->txt("assClozeTest");
672 break;
674 $type = $this->lng->txt("assImagemapQuestion");
675 break;
677 $type = $this->lng->txt("assMatchingQuestion");
678 break;
680 $type = $this->lng->txt("assMultipleChoice");
681 break;
683 $type = $this->lng->txt("assKprimChoice");
684 break;
686 $type = $this->lng->txt("assLongMenu");
687 break;
689 $type = $this->lng->txt("assSingleChoice");
690 break;
692 $type = $this->lng->txt("assOrderingQuestion");
693 break;
695 $type = $this->lng->txt("assTextQuestion");
696 break;
698 $type = $this->lng->txt("assNumeric");
699 break;
701 $type = $this->lng->txt("assTextSubset");
702 break;
703 default:
704 $type = $this->lng->txt($item["type"]);
705 break;
706 }
707
708 if (strcmp($type, "-" . $item["type"] . "-") == 0) {
709 global $DIC;
710 $component_factory = $DIC['component.factory'];
711 $component_repository = $DIC["component.repository"];
712 $plugins = $component_repository->getPluginSlotById("qst")->getActivePlugins();
713 foreach ($component_factory->getActivePluginsInSlot("qst") as $pl) {
714 if (strcmp($pl->getQuestionType(), $item["type"]) == 0) {
715 $type = $pl->getQuestionTypeTranslation();
716 }
717 }
718 }
719
720 $row['type'] = $type;
721
722 $rows[] = $row;
723 }
724 $table->setData($rows);
725
726 if (is_file($xml_file)
727 && !$questions_only) {
728 $this->tpl->setCurrentBlock("import_qpl");
729 // read file into a string
730 $fh = @fopen($xml_file, "r");
731 $xml = @fread($fh, filesize($xml_file));
732 @fclose($fh);
733 if (preg_match("/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches)) {
734 $this->tpl->setVariable("VALUE_NEW_QUESTIONPOOL", $matches[1]);
735 }
736
737 $this->tpl->setVariable("TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt("qpl_import_create_new_qpl"));
738 $this->tpl->parseCurrentBlock();
739 }
740
741 $this->tpl->setCurrentBlock("adm_content");
742 $this->tpl->setVariable("FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt("qpl_import_verify_found_questions"));
743 if ($questions_only) {
744 $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_questions_into_qpl"));
745 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
746 } else {
747 $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_qpl"));
748
749 $this->ctrl->setParameter($this, "new_type", $this->type);
750 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
751 }
752
753 $value_questions_only = 0;
754 if ($questions_only) {
755 $value_questions_only = 1;
756 }
757 $this->tpl->setVariable("VALUE_QUESTIONS_ONLY", $value_questions_only);
758 $this->tpl->setVariable("VERIFICATION_TABLE", $table->getHtml());
759 $this->tpl->setVariable("VERIFICATION_FORM_NAME", $table->getFormName());
760
761 $this->tpl->parseCurrentBlock();
762
763 return true;
764 }
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static _createImportDirectory()
creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directo...
static _setImportDirectory($a_import_dir=null)
set import directory
static _setImportDirectory($a_import_dir=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
const IMAGEMAP_QUESTION_IDENTIFIER
const SINGLE_CHOICE_QUESTION_IDENTIFIER
const TEXTSUBSET_QUESTION_IDENTIFIER
const NUMERIC_QUESTION_IDENTIFIER
const TEXT_QUESTION_IDENTIFIER
const LONG_MENU_QUESTION_IDENTIFIER
const KPRIM_CHOICE_QUESTION_IDENTIFIER
const MATCHING_QUESTION_IDENTIFIER
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
const ORDERING_QUESTION_IDENTIFIER
$xml
Definition: metadata.php:351
$rows
Definition: xhr_table.php:10

References $DIC, Vendor\Package\$e, $rows, ilObjectGUI\$type, $xml, ilObjQuestionPool\_createImportDirectory(), ilObjQuestionPool\_getImportDirectory(), ilObjTest\_setImportDirectory(), ilObjQuestionPool\_setImportDirectory(), CLOZE_TEST_IDENTIFIER, ILIAS\Repository\ctrl(), ilFileUtils\delDir(), ilQTIParser\IL_MO_VERIFY_QTI, IMAGEMAP_QUESTION_IDENTIFIER, KPRIM_CHOICE_QUESTION_IDENTIFIER, ILIAS\Repository\lng(), LONG_MENU_QUESTION_IDENTIFIER, MATCHING_QUESTION_IDENTIFIER, ilFileUtils\moveUploadedFile(), MULTIPLE_CHOICE_QUESTION_IDENTIFIER, NUMERIC_QUESTION_IDENTIFIER, ORDERING_QUESTION_IDENTIFIER, ilSession\set(), SINGLE_CHOICE_QUESTION_IDENTIFIER, TEXT_QUESTION_IDENTIFIER, TEXTSUBSET_QUESTION_IDENTIFIER, and ilFileUtils\unzip().

Referenced by importFileObject(), and uploadObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $object

ilObject ilObjQuestionPoolGUI::$object

Definition at line 48 of file class.ilObjQuestionPoolGUI.php.

Referenced by importVerifiedFileObject().

◆ $qplrequest

ILIAS TestQuestionPool InternalRequestService ilObjQuestionPoolGUI::$qplrequest
protected

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


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