ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjQuestionPoolGUI Class Reference

Class ilObjQuestionPoolGUI. More...

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

Public Member Functions

 downloadFileObject ()
 
 fullscreenObject ()
 show fullscreen view More...
 
 download_paragraphObject ()
 download source code paragraph More...
 
 uploadQplObject ($questions_only=false)
 imports question(s) into the questionpool More...
 
 importVerifiedFileObject ()
 
 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 ()
 
 createQuestionForTestObject ()
 
 afterSave (ilObject $new_object)
 
 questionObject ()
 
 confirmDeleteQuestions (array $ids)
 
 deleteQuestionsObject ()
 delete questions confirmation screen More...
 
 confirmDeleteQuestionsObject ()
 delete questions after confirmation More...
 
 cancelDeleteQuestionsObject ()
 
 exportQuestions (array $ids)
 
 questionsObject ()
 list questions of question pool More...
 
 printObject ()
 
 updateObject ()
 
 pasteObject ()
 
 copyQuestions (array $ids)
 
 moveQuestions (array $ids)
 
 createExportExcel ()
 
 editQuestionForTestObject ()
 
 addLocatorItems ()
 
 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 ()
 
- 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] does belong to the parent 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 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)
 
- 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...
 
 getTable ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 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...
 
 addAdoptContentLinkToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 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 ()
 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...
 
 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...
 

Protected Attributes

Service $taxonomy
 
ILIAS TestQuestionPool InternalRequestService $qplrequest
 
ilDBInterface $db
 
RBACServices $rbac
 
ilComponentLogger $log
 
ilHelpGUI $help
 
GlobalScreen $global_screen
 
ilComponentFactory $component_factory
 
ilComponentRepository $component_repository
 
ilNavigationHistory $navigation_history
 
ilUIService $ui_service
 
DataFactory $data_factory
 
URLBuilder $url_builder
 
URLBuilderToken $action_parameter_token
 
URLBuilderToken $row_id_token
 
- 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
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
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

 createImportDirectory ()
 
 createQuestionFormObject ()
 
 buildCreateQuestionForm ()
 
 isSkillsTabRequired ()
 
 addSettingsSubTabs (ilTabsGUI $tabs)
 

Private Attributes

HTTPServices $http
 
HttpRequest $http_request
 
QuestionInfoService $questioninfo
 
ILIAS Filesystem Util Archive LegacyArchives $archives
 

Detailed Description

Member Function Documentation

◆ _goto()

static ilObjQuestionPoolGUI::_goto (   $a_target)
static

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

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

Referenced by ILIAS\StaticURL\Handler\LegacyGotoHandler\handle().

1850  : void
1851  {
1852  global $DIC;
1853  $main_tpl = $DIC->ui()->mainTemplate();
1854  $ilAccess = $DIC['ilAccess'];
1855  $ilErr = $DIC['ilErr'];
1856  $lng = $DIC['lng'];
1857  $ctrl = $DIC['ilCtrl'];
1858 
1859  if ($ilAccess->checkAccess('write', '', (int) $a_target)
1860  || $ilAccess->checkAccess('read', '', (int) $a_target)
1861  ) {
1862  $target_class = ilObjQuestionPoolGUI::class;
1863  $target_cmd = 'questions';
1864  $ctrl->setParameterByClass($target_class, 'ref_id', $a_target);
1865  $ctrl->redirectByClass([ilRepositoryGUI::class, $target_class], $target_cmd);
1866  return;
1867  }
1868  if ($ilAccess->checkAccess('visible', "", $a_target)) {
1869  ilObjectGUI::_gotoRepositoryNode($a_target, 'infoScreen');
1870  return;
1871  }
1872  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1873  $main_tpl->setOnScreenMessage(
1874  'info',
1875  sprintf(
1876  $lng->txt("msg_no_perm_read_item"),
1878  ),
1879  true
1880  );
1882  return;
1883  }
1884  $ilErr->raiseError($lng->txt('msg_no_perm_read_lm'), $ilErr->FATAL);
1885  }
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
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...
const ROOT_FOLDER_ID
Definition: constants.php:32
static _gotoRepositoryNode(int $ref_id, string $cmd="")
setParameterByClass(string $a_class, string $a_parameter, $a_value)
$ilErr
Definition: raiseError.php:17
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
ilLanguage $lng
static _lookupTitle(int $obj_id)
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjQuestionPoolGUI::addLocatorItems ( )

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

References ilObjectGUI\$locator, assQuestionGUI\_getQuestionGUI(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

1510  : void
1511  {
1512  $ilLocator = $this->locator;
1513 
1514  switch ($this->ctrl->getCmd()) {
1515  case 'create':
1516  case 'importFile':
1517  case 'cancel':
1518  break;
1519  default:
1520  $this->ctrl->clearParameterByClass(self::class, 'q_id');
1521  $ilLocator->addItem(
1522  $this->object->getTitle(),
1523  $this->ctrl->getLinkTarget($this, ''),
1524  '',
1525  $this->qplrequest->getRefId()
1526  );
1527  $this->ctrl->setParameter($this, 'q_id', $this->qplrequest->getQuestionId());
1528  break;
1529  }
1530 
1531  if (!is_array($this->qplrequest->raw('q_id')) && $this->qplrequest->raw('q_id') > 0 && $this->qplrequest->raw(
1532  'cmd'
1533  ) !== 'questions') {
1534  $q_gui = assQuestionGUI::_getQuestionGUI('', $this->qplrequest->raw('q_id'));
1535  if ($q_gui !== null && $q_gui->object instanceof assQuestion) {
1536  $q_gui->object->setObjId($this->object->getId());
1537  $title = $q_gui->object->getTitleForHTMLOutput();
1538  if (!$title) {
1539  $title = $this->lng->txt('new') . ': ' . $this->questioninfo->getQuestionTypeName(
1540  $q_gui->object->getId()
1541  );
1542  }
1543  $ilLocator->addItem($title, $this->ctrl->getLinkTargetByClass(get_class($q_gui), 'editQuestion'));
1544  } else {
1545  // Workaround for context issues: If no object was found, redirect without q_id parameter
1546  $this->ctrl->setParameter($this, 'q_id', '');
1547  $this->ctrl->redirect($this);
1548  }
1549  }
1550  }
Abstract basic class which is to be extended by the concrete assessment question type classes...
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
ilLocatorGUI $locator
+ Here is the call graph for this function:

◆ addSettingsSubTabs()

ilObjQuestionPoolGUI::addSettingsSubTabs ( ilTabsGUI  $tabs)
private

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

References ilTabsGUI\addSubTab(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilObjQuestionPoolSettingsGeneralGUI\TAB_COMMON_SETTINGS.

Referenced by getTabs().

1808  : void
1809  {
1810  $tabs->addSubTab(
1812  $this->lng->txt('qpl_settings_subtab_general'),
1813  $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1814  );
1815  if ($this->object->getShowTaxonomies()) {
1816  $tabs->addSubTab(
1817  'tax_settings',
1818  $this->lng->txt('qpl_settings_subtab_taxonomies'),
1819  $this->ctrl->getLinkTargetByClass('ilTaxonomySettingsGUI', ''),
1820  );
1821  }
1822  }
addSubTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterSave()

ilObjQuestionPoolGUI::afterSave ( ilObject  $new_object)

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

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

1105  : void
1106  {
1107  // always send a message
1108  $this->tpl->setOnScreenMessage('success', $this->lng->txt('object_added'), true);
1109 
1111  'ilias.php?ref_id=' . $new_object->getRefId() .
1112  '&baseClass=ilObjQuestionPoolGUI'
1113  );
1114  }
static redirect(string $a_script)
+ Here is the call graph for this function:

◆ buildCreateQuestionForm()

ilObjQuestionPoolGUI::buildCreateQuestionForm ( )
private

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

References ilObjectGUI\$data, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_IPE, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, ILIAS\Repository\ctrl(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), and ilSelectInputGUI\setOptions().

Referenced by createQuestionFormObject().

1330  {
1331  $form = new ilPropertyFormGUI();
1332  $form->setTitle($this->lng->txt('ass_create_question'));
1333  $form->setFormAction($this->ctrl->getFormAction($this));
1334 
1335  $options = [];
1336  foreach ($this->object->getQuestionTypes(false, true, false) as $translation => $data) {
1337  $options[$data['type_tag']] = $translation;
1338  }
1339  $si = new ilSelectInputGUI($this->lng->txt('question_type'), 'sel_question_types');
1340  $si->setOptions($options);
1341 
1342  $form->addItem($si);
1343 
1345  $ri = new ilRadioGroupInputGUI($this->lng->txt('tst_add_quest_cont_edit_mode'), 'add_quest_cont_edit_mode');
1346 
1347  $option_ipe = new ilRadioOption(
1348  $this->lng->txt('tst_add_quest_cont_edit_mode_IPE'),
1350  );
1351  $option_ipe->setInfo($this->lng->txt('tst_add_quest_cont_edit_mode_IPE_info'));
1352  $ri->addOption($option_ipe);
1353 
1354  $option_rte = new ilRadioOption(
1355  $this->lng->txt('tst_add_quest_cont_edit_mode_RTE'),
1357  );
1358  $option_rte->setInfo($this->lng->txt('tst_add_quest_cont_edit_mode_RTE_info'));
1359  $ri->addOption($option_rte);
1360 
1362 
1363  $form->addItem($ri, true);
1364  } else {
1365  $hi = new ilHiddenInputGUI('question_content_editing_type');
1367  $form->addItem($hi, true);
1368  }
1369 
1370  // commands
1371 
1372  $form->addCommandButton('createQuestion', $this->lng->txt('create'));
1373  $form->addCommandButton('questions', $this->lng->txt('cancel'));
1374 
1375  return $form;
1376  }
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
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.
setInfo(string $a_info)
setOptions(array $a_options)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelDeleteQuestionsObject()

ilObjQuestionPoolGUI::cancelDeleteQuestionsObject ( )

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

References ILIAS\Repository\ctrl().

1195  : void
1196  {
1197  $this->ctrl->redirect($this, 'questions');
1198  }
+ Here is the call graph for this function:

◆ cancelImportObject()

ilObjQuestionPoolGUI::cancelImportObject ( )

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

References ILIAS\Repository\ctrl().

1007  : void
1008  {
1009  if ($_POST['questions_only'] == 1) {
1010  $this->ctrl->redirect($this, 'questions');
1011  } else {
1012  $this->ctrl->redirect($this, 'cancel');
1013  }
1014  }
+ Here is the call graph for this function:

◆ confirmDeleteQuestions()

ilObjQuestionPoolGUI::confirmDeleteQuestions ( array  $ids)

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

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

Referenced by getQueryParamInt().

1125  : void
1126  {
1127  $rbacsystem = $this->rbac_system;
1128 
1129  $questionIdsToDelete = array_filter(array_map('intval', $ids));
1130  if (0 === count($questionIdsToDelete)) {
1131  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_delete_select_none'), true);
1132  $this->ctrl->redirect($this, 'questions');
1133  }
1134 
1135  $this->tpl->setOnScreenMessage('question', $this->lng->txt('qpl_confirm_delete_questions'));
1136  $deleteable_questions = $this->object->getDeleteableQuestionDetails($questionIdsToDelete);
1137  $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', (($rbacsystem->checkAccess('write', $this->qplrequest->getRefId()) ? true : false)), true);
1138  $table_gui->setShowRowsSelector(false);
1139  $table_gui->setLimit(PHP_INT_MAX);
1140  $table_gui->setEditable($rbacsystem->checkAccess('write', $this->qplrequest->getRefId()));
1141  $table_gui->setData($deleteable_questions);
1142  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
1143  }
ilRbacSystem $rbac_system
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteQuestionsObject()

ilObjQuestionPoolGUI::confirmDeleteQuestionsObject ( )

delete questions after confirmation

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

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

1181  : void
1182  {
1183  foreach ($_POST['q_id'] as $key => $value) {
1184  $this->object->deleteQuestion($value);
1185  $this->object->cleanupClipboard($value);
1186  }
1187  if (count($_POST['q_id'])) {
1188  $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_questions_deleted'), true);
1189  }
1190 
1191  $this->ctrl->setParameter($this, 'q_id', '');
1192  $this->ctrl->redirect($this, 'questions');
1193  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

◆ copyQuestions()

ilObjQuestionPoolGUI::copyQuestions ( array  $ids)

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

References ilObjectGUI\$id, and ILIAS\Repository\lng().

Referenced by getQueryParamInt().

1427  : void
1428  {
1429  if ($ids) {
1430  foreach ($ids as $id) {
1431  $this->object->copyToClipboard($id);
1432  }
1433  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_copy_insert_clipboard'), true);
1434  } else {
1435  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_copy_select_none'), true);
1436  }
1437  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExportExcel()

ilObjQuestionPoolGUI::createExportExcel ( )

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

References ilObjectGUI\$rbac_system, and ILIAS\Repository\ctrl().

1451  : void
1452  {
1453  $rbacsystem = $this->rbac_system;
1454  if ($rbacsystem->checkAccess('write', $this->qplrequest->getRefId())) {
1455  $question_ids = &$this->object->getAllQuestionIds();
1456  $qpl_exp = new ilQuestionpoolExport($this->object, 'xlsx', $question_ids);
1457  $qpl_exp->buildExportFile();
1458  $this->ctrl->redirectByClass('ilquestionpoolexportgui', '');
1459  }
1460  }
ilRbacSystem $rbac_system
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ createImportDirectory()

ilObjQuestionPoolGUI::createImportDirectory ( )
private

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

References ilFileUtils\getDataDir(), and ilFileUtils\makeDir().

Referenced by uploadQplObject().

900  : string
901  {
902  $qpl_data_dir = ilFileUtils::getDataDir() . '/qpl_data';
903  ilFileUtils::makeDir($qpl_data_dir);
904 
905  if (!is_writable($qpl_data_dir)) {
906  $this->error->raiseError(
907  'Questionpool Data Directory (' . $qpl_data_dir
908  . ') not writeable.',
909  $this->error->FATAL
910  );
911  }
912 
913  $qpl_dir = $qpl_data_dir . '/qpl_import';
914  ilFileUtils::makeDir($qpl_dir);
915  if (!@is_dir($qpl_dir)) {
916  $this->error->raiseError('Creation of Questionpool Directory failed.', $this->error->FATAL);
917  }
918  return $qpl_dir;
919  }
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createQuestionFormObject()

ilObjQuestionPoolGUI::createQuestionFormObject ( )
private

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

References $help, buildCreateQuestionForm(), ILIAS\Repository\ctrl(), ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), and ilHelpGUI\setScreenId().

1312  : void
1313  {
1314  $ilHelp = $this->help;
1315 
1316  $ilHelp->setScreenId('assQuestions');
1317 
1319  $ilHelp->setSubScreenId('createQuestion_editMode');
1320  } else {
1321  $ilHelp->setSubScreenId('createQuestion');
1322  }
1323 
1324  $form = $this->buildCreateQuestionForm();
1325 
1326  $this->tpl->setContent($this->ctrl->getHTML($form));
1327  }
setScreenId(string $a_id)
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
+ Here is the call graph for this function:

◆ createQuestionForTestObject()

ilObjQuestionPoolGUI::createQuestionForTestObject ( )

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

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

1078  : void
1079  {
1080  if (!$this->qplrequest->raw('q_id')) {
1082  $add_cont_edit_mode = $this->qplrequest->raw('add_quest_cont_edit_mode');
1083  } else {
1085  }
1086  $q_gui = assQuestionGUI::_getQuestionGUI($this->qplrequest->raw('sel_question_types'));
1087  $q_gui->object->setObjId($this->object->getId());
1088  $q_gui->object->setAdditionalContentEditingMode($add_cont_edit_mode);
1089  $q_gui->object->createNewQuestion();
1090 
1091  $class = get_class($q_gui);
1092  $q_id = $q_gui->object->getId();
1093  } else {
1094  $class = $this->qplrequest->raw('sel_question_types') . 'gui';
1095  $q_id = $this->qplrequest->raw('q_id');
1096  }
1097 
1098  $this->ctrl->setParameterByClass($class, 'q_id', $q_id);
1099  $this->ctrl->setParameterByClass($class, 'sel_question_types', $this->qplrequest->raw('sel_question_types'));
1100  $this->ctrl->setParameterByClass($class, 'prev_qid', $this->qplrequest->raw('prev_qid'));
1101 
1102  $this->ctrl->redirectByClass($class, 'editQuestion');
1103  }
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
+ Here is the call graph for this function:

◆ createQuestionObject()

ilObjQuestionPoolGUI::createQuestionObject ( )

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

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

1062  : void
1063  {
1065  $addContEditMode = $_POST['add_quest_cont_edit_mode'];
1066  } else {
1068  }
1069  $q_gui = assQuestionGUI::_getQuestionGUI($_POST['sel_question_types']);
1070  $q_gui->object->setObjId($this->object->getId());
1071  $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
1072  $q_gui->object->createNewQuestion();
1073  $this->ctrl->setParameterByClass(get_class($q_gui), 'q_id', $q_gui->object->getId());
1074  $this->ctrl->setParameterByClass(get_class($q_gui), 'sel_question_types', $_POST['sel_question_types']);
1075  $this->ctrl->redirectByClass(get_class($q_gui), 'editQuestion');
1076  }
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
+ Here is the call graph for this function:

◆ deleteQuestionsObject()

ilObjQuestionPoolGUI::deleteQuestionsObject ( )

delete questions confirmation screen

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

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

1148  : void
1149  {
1150  $rbacsystem = $this->rbac_system;
1151 
1152  $questionIdsToDelete = $this->qplrequest->isset('q_id') ? (array) $this->qplrequest->raw('q_id') : [];
1153  if (0 === count($questionIdsToDelete) && $this->qplrequest->isset('q_id')) {
1154  $questionIdsToDelete = [$this->qplrequest->getQuestionId()];
1155  }
1156 
1157  $questionIdsToDelete = array_filter(array_map('intval', $questionIdsToDelete));
1158  if (0 === count($questionIdsToDelete)) {
1159  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_delete_select_none'), true);
1160  $this->ctrl->redirect($this, 'questions');
1161  }
1162 
1163  $this->tpl->setOnScreenMessage('question', $this->lng->txt('qpl_confirm_delete_questions'));
1164  $deleteable_questions = &$this->object->getDeleteableQuestionDetails($questionIdsToDelete);
1165  $table_gui = new ilQuestionBrowserTableGUI(
1166  $this,
1167  'questions',
1168  (($rbacsystem->checkAccess('write', $this->qplrequest->getRefId()) ? true : false)),
1169  true
1170  );
1171  $table_gui->setShowRowsSelector(false);
1172  $table_gui->setLimit(PHP_INT_MAX);
1173  $table_gui->setEditable($rbacsystem->checkAccess('write', $this->qplrequest->getRefId()));
1174  $table_gui->setData($deleteable_questions);
1175  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
1176  }
ilRbacSystem $rbac_system
+ Here is the call graph for this function:

◆ download_paragraphObject()

ilObjQuestionPoolGUI::download_paragraphObject ( )

download source code paragraph

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

References exit, and ilPageObject\sendParagraph().

681  : void
682  {
683  $pg_obj = new ilAssQuestionPage($this->qplrequest->raw('pg_id'));
684  $pg_obj->sendParagraph($this->qplrequest->raw('par_id'), $this->qplrequest->raw('downloadtitle'));
685  exit;
686  }
exit
Definition: login.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
sendParagraph(string $par_id, string $filename)
+ Here is the call graph for this function:

◆ downloadFileObject()

ilObjQuestionPoolGUI::downloadFileObject ( )

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

References exit.

661  : void
662  {
663  $file = explode('_', $this->qplrequest->raw('file_id'));
664  $fileObj = new ilObjFile($file[count($file) - 1], false);
665  $fileObj->sendFile();
666  exit;
667  }
exit
Definition: login.php:29
Class ilObjFile.

◆ editQuestionForTestObject()

ilObjQuestionPoolGUI::editQuestionForTestObject ( )

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

References ILIAS\Repository\ctrl().

1462  : void
1463  {
1464  $this->ctrl->redirectByClass(ilAssQuestionPreviewGUI::class, 'show');
1465  }
+ 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 656 of file class.ilObjQuestionPoolGUI.php.

References ILIAS\Repository\ctrl().

656  : void
657  {
658  $this->ctrl->redirectByClass('ilQuestionPoolExportGUI');
659  }
+ Here is the call graph for this function:

◆ exportQuestions()

ilObjQuestionPoolGUI::exportQuestions ( array  $ids)

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

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

Referenced by getQueryParamInt().

1200  : void
1201  {
1202  if ($ids !== []) {
1203  $qpl_exp = new ilQuestionpoolExport($this->object, 'xml', $ids);
1204  // @PHP8-CR: This seems to be a pointer to an issue with exports. I like to leave this open for now and
1205  // schedule a thorough examination / analysis for later, eventually involved T&A TechSquad
1206  $export_file = $qpl_exp->buildExportFile();
1207  $filename = $export_file;
1208  $filename = preg_replace('/.*\//', '', $filename);
1209  if ($export_file === '') {
1210  $export_file = 'StandIn';
1211  }
1213  exit();
1214  } else {
1215  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_export_select_none'), true);
1216  }
1217  }
exit
Definition: login.php:29
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchAuthoringQuestionIdParamater()

ilObjQuestionPoolGUI::fetchAuthoringQuestionIdParamater ( )
protected

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

References ILIAS\Repository\object().

Referenced by getQueryParamInt().

1301  : int
1302  {
1303  $q_id = $this->qplrequest->getQuestionId();
1304 
1305  if ($this->object->checkQuestionParent($q_id)) {
1306  return $q_id;
1307  }
1308 
1309  throw new ilTestQuestionPoolException('question id does not relate to parent object!');
1310  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fullscreenObject()

ilObjQuestionPoolGUI::fullscreenObject ( )

show fullscreen view

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

References ilPageObjectGUI\showMediaFullscreen().

672  : void
673  {
674  $page_gui = new ilAssQuestionPageGUI($this->qplrequest->raw('pg_id'));
675  $page_gui->showMediaFullscreen();
676  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
showMediaFullscreen(int $a_style_id=0)
show fullscreen view of media object
+ Here is the call graph for this function:

◆ getImportQuestionsForm()

ilObjQuestionPoolGUI::getImportQuestionsForm ( )
protected

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

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

Referenced by importQuestionsObject(), and uploadObject().

1047  {
1048  $form = new ilPropertyFormGUI();
1049  $form->setTitle($this->lng->txt('import_question'));
1050  $form->setFormAction($this->ctrl->getFormAction($this, 'upload'));
1051 
1052  $file = new ilFileInputGUI($this->lng->txt('select_file'), 'xmldoc');
1053  $file->setRequired(true);
1054  $form->addItem($file);
1055 
1056  $form->addCommandButton('upload', $this->lng->txt('upload'));
1057  $form->addCommandButton('questions', $this->lng->txt('cancel'));
1058 
1059  return $form;
1060  }
This class represents a file property in a property form.
setRequired(bool $a_required)
+ 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 142 of file class.ilObjQuestionPoolGUI.php.

References ilObjectGUI\$access, $component_repository, ilObjectGUI\$ctrl, $db, ilObjectGUI\$error, $help, $ilDB, $ilErr, ilObjectGUI\$ilias, ilObjectGUI\$lng, $navigation_history, $object, ilObjectGUI\$ref_id, ilObjectGUI\$tabs_gui, ilObjectGUI\$tpl, $url, ilObjectGUI\$user, assQuestionGUI\_getGUIClassNameForId(), assQuestionGUI\_getQuestionGUI(), ILIAS\Repository\access(), ilCommonActionDispatcherGUI\buildAjaxHash(), ilAssQuestionFeedbackEditingGUI\CMD_SHOW, ilAssQuestionPreviewGUI\CMD_SHOW, ilAssQuestionHintsGUI\CMD_SHOW_LIST, ilAssQuestionPreviewGUI\CMD_STATISTICS, confirmDeleteQuestions(), copyQuestions(), ILIAS\Repository\ctrl(), assQuestionGUI\EDIT_CONTEXT_AUTHORING, ilObjectGUI\executeCommand(), exit, exportQuestions(), fetchAuthoringQuestionIdParamater(), ilObjStyleSheet\getContentStylePath(), ilObjectGUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ilNoteGUI\getListCommentsJSCall(), getQueryParamString(), ilUtil\getStyleSheetLocation(), ilObjStyleSheet\getSyntaxStylePath(), ILIAS\FileDelivery\http(), infoScreenForward(), ILIAS\Repository\lng(), moveQuestions(), ILIAS\Repository\object(), ilObjectGUI\prepareOutput(), ILIAS\raiseError(), redirectAfterMissingWrite(), ILIAS\Repository\refinery(), assQuestionGUI\RENDER_PURPOSE_PREVIEW, ilGlobalTemplateInterface\setContent(), ilPageObjectGUI\setEditPreview(), ilHelpGUI\setScreenIdComponent(), and ilCommonActionDispatcherGUI\TYPE_REPOSITORY.

142  : ?int
143  {
144  if (!$this->request_wrapper->has($param)) {
145  return null;
146  }
147  $trafo = $this->refinery->byTrying([
148  $this->refinery->kindlyTo()->null(),
149  $this->refinery->kindlyTo()->int()
150  ]);
151  return $this->request_wrapper->retrieve($param, $trafo);
152  }
$param
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ getQueryParamString()

ilObjQuestionPoolGUI::getQueryParamString ( string  $param)
protected

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

References ILIAS\Repository\refinery().

Referenced by getQueryParamInt(), and getTabs().

130  : ?string
131  {
132  if (!$this->request_wrapper->has($param)) {
133  return null;
134  }
135  $trafo = $this->refinery->byTrying([
136  $this->refinery->kindlyTo()->null(),
137  $this->refinery->kindlyTo()->string()
138  ]);
139  return $this->request_wrapper->retrieve($param, $trafo);
140  }
$param
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTable()

ilObjQuestionPoolGUI::getTable ( )
protected

Filters should be part of the Table; for now, since they are not fully integrated, they are rendered and applied seperately

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

References Vendor\Package\$f, ilObjectGUI\$notes_service, $r, ilObjectGUI\$ui_factory, ilObjectGUI\$ui_renderer, ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\refinery().

Referenced by questionsObject().

1887  : string
1888  {
1891 
1892  $table = new QuestionTable(
1893  $f,
1894  $r,
1895  $this->data_factory,
1896  $this->refinery,
1897  $this->url_builder,
1898  $this->action_parameter_token,
1899  $this->row_id_token,
1900  $this->db,
1901  $this->lng,
1902  $this->component_repository,
1903  $this->rbac_system,
1904  $this->object->getShowTaxonomies() ? $this->taxonomy->domain() : null,
1906  $this->object->getId(),
1907  (int) $this->qplrequest->getRefId()
1908  );
1909 
1914  $filter_action = $this->ctrl->getLinkTarget($this, 'questions');
1915  $filter = $table->getFilter($this->ui_service, $filter_action);
1916 
1917  $filter_params = $this->ui_service->filter()->getData($filter);
1918 
1919  if ($filter_params) {
1920  foreach (array_filter($filter_params) as $item => $value) {
1921 
1922  switch ($item) {
1923  case 'taxonomies':
1924  foreach ($value as $tax_value) {
1925  if ($tax_value === 'null') {
1926  $table->addTaxonomyFilterNoTaxonomySet(true);
1927  } else {
1928  $tax_nodes = explode('-', $tax_value);
1929  $tax_id = array_shift($tax_nodes);
1930  $table->addTaxonomyFilter(
1931  $tax_id,
1932  $tax_nodes,
1933  $this->object->getId(),
1934  $this->object->getType()
1935  );
1936  }
1937  }
1938  break;
1939  case 'commented':
1940  $table->setCommentFilter($value);
1941  break;
1942  default:
1943  $table->addFieldFilter($item, $value);
1944  }
1945  }
1946  }
1947 
1948  return $r->render([
1949  $filter,
1950  $table->getTable()
1951  ->withRequest($this->request)
1952  ]);
1953  }
UIFactory $ui_factory
ILIAS Notes Service $notes_service
UIRenderer $ui_renderer
$r
+ 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

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

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

1608  : void
1609  {
1610  $ilHelp = $this->help;
1611 
1612  $currentUserHasWriteAccess = $this->access->checkAccess('write', '', $this->object->getRefId());
1613  $currentUserHasReadAccess = $this->access->checkAccess('read', '', $this->object->getRefId());
1614 
1615  $ilHelp->setScreenIdComponent('qpl');
1616 
1617  $next_class = strtolower($this->ctrl->getNextClass());
1618  switch ($next_class) {
1619  case '':
1620  case 'ilpermissiongui':
1621  case 'ilobjectmetadatagui':
1622  case 'ilquestionpoolexportgui':
1623  case 'ilquestionpoolskilladministrationgui':
1624  break;
1625 
1626  case strtolower(ilTaxonomySettingsGUI::class):
1627  case 'ilobjquestionpoolsettingsgeneralgui':
1628 
1629  if ($currentUserHasWriteAccess) {
1630  $this->addSettingsSubTabs($this->tabs_gui);
1631  }
1632 
1633  break;
1634 
1635  default:
1636  return;
1637  break;
1638  }
1639  // questions
1640  $force_active = false;
1641  $commands = $this->getQueryParamString('cmd');
1642  if (is_array($commands)) {
1643  foreach ($commands as $key => $value) {
1644  if (preg_match('/^delete_.*/', $key, $matches) ||
1645  preg_match('/^addSelectGap_.*/', $key, $matches) ||
1646  preg_match('/^addTextGap_.*/', $key, $matches) ||
1647  preg_match('/^deleteImage_.*/', $key, $matches) ||
1648  preg_match('/^upload_.*/', $key, $matches) ||
1649  preg_match('/^addSuggestedSolution_.*/', $key, $matches)
1650  ) {
1651  $force_active = true;
1652  }
1653  }
1654  }
1655  if (isset($_POST['imagemap_x'])) {
1656  $force_active = true;
1657  }
1658  if (!$force_active) {
1659  $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen(
1660  $this->ctrl->getCmdClass()
1661  ) == 0) &&
1662  $this->ctrl->getCmd() == '')
1663  ? true
1664  : false;
1665  }
1666  if ($currentUserHasReadAccess) {
1667  $this->tabs_gui->addTarget(
1668  'assQuestions',
1669  $this->ctrl->getLinkTarget($this, 'questions'),
1670  [
1671  'questions',
1672  'filter',
1673  'resetFilter',
1674  'createQuestion',
1675  'importQuestions',
1676  'deleteQuestions',
1677  'filterQuestionBrowser',
1678  'view',
1679  'preview',
1680  'editQuestion',
1681  'exec_pg',
1682  'addItem',
1683  'upload',
1684  'save',
1685  'cancel',
1686  'addSuggestedSolution',
1687  'cancelExplorer',
1688  'linkChilds',
1689  'removeSuggestedSolution',
1690  'add',
1691  'addYesNo',
1692  'addTrueFalse',
1693  'createGaps',
1694  'saveEdit',
1695  'setMediaMode',
1696  'uploadingImage',
1697  'uploadingImagemap',
1698  'addArea',
1699  'deletearea',
1700  'saveShape',
1701  'back',
1702  'addPair',
1703  'uploadingJavaapplet',
1704  'addParameter',
1705  'assessment',
1706  'addGIT',
1707  'addST',
1708  'addPG',
1709  'delete',
1710  'toggleGraphicalAnswers',
1711  'deleteAnswer',
1712  'deleteImage',
1713  'removeJavaapplet'
1714  ],
1715  '',
1716  '',
1717  $force_active
1718  );
1719  }
1720  if ($currentUserHasReadAccess) {
1721  $this->tabs_gui->addTarget(
1722  'info_short',
1723  $this->ctrl->getLinkTarget($this, 'infoScreen'),
1724  ['infoScreen', 'showSummary']
1725  );
1726  }
1727 
1728  if ($currentUserHasWriteAccess) {
1729  // properties
1730  $this->tabs_gui->addTarget(
1731  'settings',
1732  $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1733  [],
1734  ['ilObjQuestionPoolSettingsGeneralGUI', 'ilObjTaxonomyGUI']
1735  );
1736 
1737  // skill service
1738  if ($this->isSkillsTabRequired()) {
1739  $link = $this->ctrl->getLinkTargetByClass(
1740  ['ilQuestionPoolSkillAdministrationGUI', 'ilAssQuestionSkillAssignmentsGUI'],
1742  );
1743 
1744  $this->tabs_gui->addTarget('qpl_tab_competences', $link, [], []);
1745  }
1746  }
1747 
1748  if ($currentUserHasReadAccess) {
1749  // print view
1750  $this->tabs_gui->addTarget(
1751  'print_view',
1752  $this->ctrl->getLinkTarget($this, 'print'),
1753  ['print'],
1754  '',
1755  ''
1756  );
1757  }
1758 
1759  if ($currentUserHasWriteAccess) {
1760  $mdgui = new ilObjectMetaDataGUI($this->object);
1761  $mdtab = $mdgui->getTab();
1762  if ($mdtab) {
1763  $this->tabs_gui->addTarget(
1764  'meta_data',
1765  $mdtab,
1766  '',
1767  'ilmdeditorgui'
1768  );
1769  }
1770  }
1771 
1772  if ($currentUserHasWriteAccess) {
1773  $this->tabs_gui->addTarget(
1774  'export',
1775  $this->ctrl->getLinkTargetByClass('ilquestionpoolexportgui', ''),
1776  '',
1777  'ilquestionpoolexportgui'
1778  );
1779  }
1780 
1781  if ($this->access->checkAccess('edit_permission', '', $this->object->getRefId())) {
1782  $this->tabs_gui->addTarget(
1783  'perm_settings',
1784  $this->ctrl->getLinkTargetByClass([get_class($this), 'ilpermissiongui'], 'perm'),
1785  ['perm', 'info', 'owner'],
1786  'ilpermissiongui'
1787  );
1788  }
1789  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists(getcwd() . '/ilias.ini.php'))
Definition: confirmReg.php:21
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

◆ importFileObject()

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

form for new questionpool object import

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

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

1488  : void
1489  {
1490  if ($_REQUEST['new_type'] === null) {
1491  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
1492  $this->ctrl->redirect($this, 'create');
1493  return;
1494  }
1495  if (!$this->checkPermissionBool('create', '', $_REQUEST['new_type'])) {
1496  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
1497  $this->ctrl->redirect($this, 'create');
1498  return;
1499  }
1500 
1501  $form = $this->initImportForm($this->qplrequest->raw('new_type'));
1502  if ($form->checkInput()) {
1503  $this->uploadQplObject();
1504  }
1505 
1506  // display form to correct errors
1507  $this->tpl->setContent($form->getHTML());
1508  }
uploadQplObject($questions_only=false)
imports question(s) into the questionpool
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ 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 1037 of file class.ilObjQuestionPoolGUI.php.

References getImportQuestionsForm().

Referenced by uploadObject().

1037  : void
1038  {
1039  if (!$form instanceof ilPropertyFormGUI) {
1040  $form = $this->getImportQuestionsForm();
1041  }
1042 
1043  $this->tpl->setContent($form->getHtml());
1044  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importVerifiedFileObject()

ilObjQuestionPoolGUI::importVerifiedFileObject ( )

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

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

921  : void
922  {
923 
924  if ($this->creation_mode
925  && !$this->checkPermissionBool('create', '', $this->qplrequest->string('new_type'))
926  || !$this->creation_mode
927  && !$this->checkPermissionBool('read', '', $this->object->getType())) {
928  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
929  $this->ctrl->redirect($this, 'create');
930  return;
931  }
932  $title = '';
933  $description = null;
934  if ($this->qplrequest->int('questions_only') === 1) {
935  $newObj = $this->object;
936  $title = $this->object->getTitle();
937  $description = $this->object->getDescription();
938  } else {
939  $newObj = new ilObjQuestionPool(0, true);
940  $newObj->setType($this->qplrequest->raw('new_type'));
941  $newObj->setTitle('dummy');
942  $newObj->setDescription('questionpool import');
943  $newObj->create(true);
944  $newObj->createReference();
945  $newObj->putInTree($this->qplrequest->getRefId());
946  $newObj->setPermissions($this->qplrequest->getRefId());
947 
948  $title = $this->qplrequest->raw('qpl_new');
949  }
950 
951  if (is_string(ilSession::get("qpl_import_dir")) && is_string(ilSession::get("qpl_import_subdir")) && is_file(
952  ilSession::get("qpl_import_dir") . '/' . ilSession::get("qpl_import_subdir") . "/manifest.xml"
953  )) {
954  ilSession::set("qpl_import_idents", $this->qplrequest->raw("ident"));
955 
956  $fileName = ilSession::get('qpl_import_subdir') . '.zip';
957  $fullPath = ilSession::get('qpl_import_dir') . '/' . $fileName;
958  $imp = new ilImport($this->qplrequest->getRefId());
959  $map = $imp->getMapping();
960  $map->addMapping('Modules/TestQuestionPool', 'qpl', 'new_id', $newObj->getId());
961  $imp->importObject($newObj, $fullPath, $fileName, 'qpl', 'Modules/TestQuestionPool', true);
962  } else {
963  $qtiParser = new ilQTIParser(
964  ilSession::get('qpl_import_qti_file'),
966  $newObj->getId(),
967  $this->qplrequest->raw('ident')
968  );
969  $qtiParser->startParsing();
970  // import page data
971  if (strlen(ilSession::get('qpl_import_xml_file'))) {
972  $contParser = new ilQuestionPageParser(
973  $newObj,
974  ilSession::get('qpl_import_xml_file'),
975  ilSession::get('qpl_import_subdir')
976  );
977  $contParser->setQuestionMapping($qtiParser->getImportMapping());
978  $contParser->startParsing();
979  // #20494
980  $newObj->fromXML(ilSession::get('qpl_import_xml_file'));
981  }
982 
983  if ($title !== '') {
984  $newObj->setTitle($title);
985  }
986 
987  if ($description !== null) {
988  $newObj->setDescription($description);
989  }
990 
991  $newObj->update();
992  $newObj->saveToDb();
993  }
995 
996  if ($_POST['questions_only'] == 1) {
997  $this->ctrl->redirect($this, 'questions');
998  } else {
999  $this->tpl->setOnScreenMessage('success', $this->lng->txt('object_imported'), true);
1001  'ilias.php?ref_id=' . $newObj->getRefId() .
1002  '&baseClass=ilObjQuestionPoolGUI'
1003  );
1004  }
1005  }
static get(string $a_var)
Import class.
importObject(?object $a_new_obj, string $a_tmp_file, string $a_filename, string $a_type, string $a_comp="", bool $a_copy_file=false)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
Legacy Content Object Parser.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static redirect(string $a_script)
static _getImportDirectory()
get import directory of lm
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjQuestionPoolGUI::infoScreenForward ( )

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

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

Referenced by getQueryParamInt(), infoScreenObject(), and questionsObject().

1836  : void
1837  {
1838  if (!$this->access->checkAccess('visible', '', $this->ref_id)) {
1839  $this->error->raiseError($this->lng->txt('msg_no_perm_read'));
1840  }
1841  $info = new ilInfoScreenGUI($this);
1842  $info->enablePrivateNotes();
1843 
1844  // standard meta data
1845  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1846 
1847  $this->ctrl->forwardCommand($info);
1848  }
Class ilInfoScreenGUI.
+ 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 1829 of file class.ilObjQuestionPoolGUI.php.

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

1829  : void
1830  {
1831  $this->ctrl->setCmd('showSummary');
1832  $this->ctrl->setCmdClass('ilinfoscreengui');
1833  $this->infoScreenForward();
1834  }
+ Here is the call graph for this function:

◆ initImportForm()

ilObjQuestionPoolGUI::initImportForm ( string  $new_type)
protected

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

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

Referenced by importFileObject().

1468  {
1469  $form = new ilPropertyFormGUI();
1470  $form->setTarget('_top');
1471  $form->setFormAction($this->ctrl->getFormAction($this));
1472  $form->setTitle($this->lng->txt('import_qpl'));
1473 
1474  $fi = new ilFileInputGUI($this->lng->txt('import_file'), 'xmldoc');
1475  $fi->setSuffixes(['zip']);
1476  $fi->setRequired(true);
1477  $form->addItem($fi);
1478 
1479  $form->addCommandButton('importFile', $this->lng->txt('import'));
1480  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1481 
1482  return $form;
1483  }
This class represents a file property in a property form.
setSuffixes(array $a_suffixes)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSkillsTabRequired()

ilObjQuestionPoolGUI::isSkillsTabRequired ( )
private

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

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

Referenced by getTabs().

1791  : bool
1792  {
1793  if (!($this->object instanceof ilObjQuestionPool)) {
1794  return false;
1795  }
1796 
1797  if (!$this->object->isSkillServiceEnabled()) {
1798  return false;
1799  }
1800 
1802  return false;
1803  }
1804 
1805  return true;
1806  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveQuestions()

ilObjQuestionPoolGUI::moveQuestions ( array  $ids)

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

References ilObjectGUI\$id, and ILIAS\Repository\lng().

Referenced by getQueryParamInt().

1439  : void
1440  {
1441  if ($ids) {
1442  foreach ($ids as $id) {
1443  $this->object->moveToClipboard($id);
1444  }
1445  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_move_insert_clipboard'), true);
1446  } else {
1447  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_move_select_none'), true);
1448  }
1449  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pasteObject()

ilObjQuestionPoolGUI::pasteObject ( )

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

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

1413  : void
1414  {
1415  if (ilSession::get('qpl_clipboard') != null) {
1416  if ($this->object->pasteFromClipboard()) {
1417  $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_paste_success'), true);
1418  } else {
1419  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('qpl_paste_error'), true);
1420  }
1421  } else {
1422  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qpl_paste_no_objects'), true);
1423  }
1424  $this->ctrl->redirect($this, 'questions');
1425  }
static get(string $a_var)
+ Here is the call graph for this function:

◆ printObject()

ilObjQuestionPoolGUI::printObject ( )

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

References Vendor\Package\$d, ilObjectGUI\$data, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

1378  : void
1379  {
1380  $this->ctrl->setParameter($this, 'output', 'overview');
1381  $output_link = $this->ctrl->getLinkTarget($this, 'print');
1382  $this->ctrl->setParameter($this, 'output', 'detailed_output_solutions');
1383  $output_link_detailed = $this->ctrl->getLinkTarget($this, 'print');
1384  $this->ctrl->setParameter($this, 'output', 'detailed_output_printview');
1385  $output_link_printview = $this->ctrl->getLinkTarget($this, 'print');
1386 
1387  $mode = $this->ui_factory->dropdown()->standard([
1388  $this->ui_factory->button()->shy($this->lng->txt('overview'), $output_link),
1389  $this->ui_factory->button()->shy($this->lng->txt('detailed_output_solutions'), $output_link_detailed),
1390  $this->ui_factory->button()->shy($this->lng->txt('detailed_output_printview'), $output_link_printview)
1391  ])->withLabel($this->lng->txt('output_mode'));
1392 
1393  $output = $this->qplrequest->raw('output') ?? '';
1394 
1395  $table_gui = new ilQuestionPoolPrintViewTableGUI($this, 'print', $output);
1396  $data = $this->object->getPrintviewQuestions();
1397  $totalPoints = 0;
1398  foreach ($data as $d) {
1399  $totalPoints += $d['points'];
1400  }
1401  $table_gui->setTotalPoints($totalPoints);
1402  $table_gui->initColumns();
1403  $table_gui->setData($data);
1404  $this->tpl->setContent($this->ui_renderer->render($mode) . $table_gui->getHTML());
1405  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ questionObject()

ilObjQuestionPoolGUI::questionObject ( )

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

References ilObjectGUI\$type.

1116  : void
1117  {
1118  // @PHP8-CR: With this probably never working and no detectable usages, it would be a candidate for removal...
1119  // but it is one of the magic command-methods ($cmd.'Object' - pattern) so I live to leave this in here for now
1120  // until it can be further investigated.
1121  $type = $this->qplrequest->raw('sel_question_types');
1122  $this->editQuestionForm($type);
1123  }

◆ questionsObject()

ilObjQuestionPoolGUI::questionsObject ( )

list questions of question pool

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

References ilObjectGUI\$ref_id, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilSession\get(), getTable(), infoScreenForward(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilUtil\redirect(), ilSession\set(), and ILIAS\Repository\toolbar().

1230  : void
1231  {
1232  if (!$this->access->checkAccess("read", "", $this->qplrequest->getRefId())) {
1233  $this->infoScreenForward();
1234  return;
1235  }
1236 
1237  if (get_class($this->object) == 'ilObjTest') {
1238  if ($this->qplrequest->raw('calling_test') > 0) {
1239  $ref_id = $this->qplrequest->raw('calling_test');
1240  $q_id = $this->qplrequest->raw('q_id');
1241 
1242  if ($this->qplrequest->raw('test_express_mode')) {
1243  if ($q_id) {
1245  'ilias.php?ref_id=' . $ref_id . '&q_id=' . $q_id . '&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI'
1246  );
1247  } else {
1249  'ilias.php?ref_id=' . $ref_id . '&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI'
1250  );
1251  }
1252  } else {
1253  ilUtil::redirect('ilias.php?baseClass=ilObjTestGUI&ref_id=' . $ref_id . '&cmd=questions');
1254  }
1255  }
1256  }
1257 
1258  $this->object->purgeQuestions();
1259  // reset test_id SESSION variable
1260  ilSession::set('test_id', '');
1261  $qsa_import_fails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
1262  if ($qsa_import_fails->failedImportsRegistered()) {
1263  $button = $this->ui_factory->button()->standard(
1264  $this->lng->txt('ass_skl_import_fails_remove_btn'),
1265  $this->ctrl->getLinkTarget($this, 'renoveImportFails')
1266  );
1267  $this->tpl->setOnScreenMessage(
1268  'failure',
1269  $qsa_import_fails->getFailedImportsMessage($this->lng) . '<br />' . $this->ui_renderer->render(
1270  $button
1271  )
1272  );
1273  }
1274 
1275  if ($this->rbac_system->checkAccess('write', $this->qplrequest->getRefId())) {
1276  $btn = $this->ui_factory->button()->primary(
1277  $this->lng->txt('ass_create_question'),
1278  $this->ctrl->getLinkTarget($this, 'createQuestionForm')
1279  );
1280  $this->toolbar->addComponent($btn);
1281 
1282  $btn_import = $this->ui_factory->button()->standard(
1283  $this->lng->txt('import'),
1284  $this->ctrl->getLinkTarget($this, 'importQuestions')
1285  );
1286  $this->toolbar->addComponent($btn_import);
1287 
1288  if (ilSession::get('qpl_clipboard') != null && count(ilSession::get('qpl_clipboard'))) {
1289  $btn_paste = $this->ui_factory->button()->standard(
1290  $this->lng->txt('paste'),
1291  $this->ctrl->getLinkTarget($this, 'paste')
1292  );
1293  $this->toolbar->addComponent($btn_paste);
1294  }
1295  }
1296 
1297  $this->tpl->setPermanentLink($this->object->getType(), $this->object->getRefId());
1298  $this->tpl->setContent($this->getTable());
1299  }
static get(string $a_var)
static redirect(string $a_script)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ redirectAfterMissingWrite()

ilObjQuestionPoolGUI::redirectAfterMissingWrite ( )
protected

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

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

Referenced by getQueryParamInt().

645  {
646  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('no_permission'), true);
647  $target_class = get_class($this->object) . 'GUI';
648  $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id);
649  $this->ctrl->redirectByClass($target_class);
650  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renoveImportFailsObject()

ilObjQuestionPoolGUI::renoveImportFailsObject ( )
protected

◆ setTitleAndDescription()

ilObjQuestionPoolGUI::setTitleAndDescription ( )

called by prepare output

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

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

1555  : void
1556  {
1557  parent::setTitleAndDescription();
1558 
1559  if (!is_array($this->qplrequest->raw('q_id')) && $this->qplrequest->raw('q_id') > 0 && $this->qplrequest->raw(
1560  'cmd'
1561  ) !== 'questions') {
1562  $q_gui = assQuestionGUI::_getQuestionGUI('', $this->qplrequest->getQuestionId());
1563  if ($q_gui->object instanceof assQuestion) {
1564  $q_gui->object->setObjId($this->object->getId());
1565  $title = $this->object->getTitle() . ': ' . $q_gui->object->getTitle();
1566  if (!$title) {
1567  $title = $this->lng->txt('new') . ': ' . $this->questioninfo->getQuestionTypeName(
1568  $q_gui->object->getId()
1569  );
1570  }
1571  $this->tpl->setTitle(
1572  strip_tags(
1573  $title,
1574  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1575  )
1576  );
1577  $this->tpl->setDescription(
1578  $q_gui->object->getDescriptionForHTMLOutput()
1579  );
1580  $this->tpl->setTitleIcon(ilObject2::_getIcon($this->object->getId(), 'big', $this->object->getType()));
1581  } else {
1582  // Workaround for context issues: If no object was found, redirect without q_id parameter
1583  $this->ctrl->setParameter($this, 'q_id', '');
1584  $this->ctrl->redirect($this);
1585  }
1586  } else {
1587  $this->tpl->setTitle(
1588  strip_tags(
1589  $this->object->getTitle(),
1590  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1591  )
1592  );
1593  $this->tpl->setDescription(
1594  strip_tags(
1595  $this->object->getLongDescription(),
1596  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1597  )
1598  );
1599  $this->tpl->setTitleIcon(ilObject2::_getIcon($this->object->getId(), 'big', $this->object->getType()));
1600  }
1601  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
Abstract basic class which is to be extended by the concrete assessment question type classes...
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
+ Here is the call graph for this function:

◆ updateObject()

ilObjQuestionPoolGUI::updateObject ( )

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

References ILIAS\Repository\lng().

1407  : void
1408  {
1409  $this->object->update();
1410  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
1411  }
+ Here is the call graph for this function:

◆ uploadObject()

ilObjQuestionPoolGUI::uploadObject ( )

imports question(s) into the questionpool

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

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

1019  : void
1020  {
1021  $upload_valid = true;
1022  $form = $this->getImportQuestionsForm();
1023  if ($form->checkInput()) {
1024  if (!$this->uploadQplObject(true)) {
1025  $form->setValuesByPost();
1026  $this->importQuestionsObject($form);
1027  }
1028  } else {
1029  $form->setValuesByPost();
1030  $this->importQuestionsObject($form);
1031  }
1032  }
importQuestionsObject(ilPropertyFormGUI $form=null)
display the import form to import questions into the questionpool
uploadQplObject($questions_only=false)
imports question(s) into the questionpool
+ Here is the call graph for this function:

◆ uploadQplObject()

ilObjQuestionPoolGUI::uploadQplObject (   $questions_only = false)

imports question(s) into the questionpool

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

References $component_factory, $component_repository, Vendor\Package\$e, ilObjectGUI\$type, ilObjQuestionPool\_getImportDirectory(), ilObjTest\_setImportDirectory(), ilObjQuestionPool\_setImportDirectory(), CLOZE_TEST_IDENTIFIER, createImportDirectory(), ILIAS\Repository\ctrl(), ilFileUtils\delDir(), ilComponentFactory\getActivePluginsInSlot(), 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, and TEXTSUBSET_QUESTION_IDENTIFIER.

Referenced by importFileObject(), and uploadObject().

692  {
693  $this->ctrl->setParameter($this, 'new_type', $this->qplrequest->raw('new_type'));
694  if (!isset($_FILES['xmldoc']) || !isset($_FILES['xmldoc']['error']) || $_FILES['xmldoc']['error'] > UPLOAD_ERR_OK) {
695  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('error_upload'), true);
696  if (!$questions_only) {
697  $this->ctrl->redirect($this, 'create');
698  }
699  return false;
700  }
701 
702  $basedir = $this->createImportDirectory();
703 
704  $xml_file = '';
705  $qti_file = '';
706  $subdir = '';
707 
708  $file = pathinfo($_FILES['xmldoc']['name']);
709  $full_path = $basedir . '/' . $_FILES['xmldoc']['name'];
710 
711  if (strpos($file['filename'], 'qpl') === false
712  && strpos($file['filename'], 'qti') === false) {
713  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
714  $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
715  $this->ctrl->redirect($this, $cmd);
716  return;
717  }
718 
719  $this->log->write(__METHOD__ . ': full path ' . $full_path);
720  try {
721  ilFileUtils::moveUploadedFile($_FILES['xmldoc']['tmp_name'], $_FILES['xmldoc']['name'], $full_path);
722  } catch (Error $e) {
723  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
724  $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
725  $this->ctrl->redirect($this, $cmd);
726  return;
727  }
728  $this->log->write(__METHOD__ . ': full path ' . $full_path);
729  if (strcmp($_FILES['xmldoc']['type'], 'text/xml') == 0) {
730  $qti_file = $full_path;
732  } else {
733  $this->archives->unzip($full_path);
734 
735  $subdir = basename($file['basename'], '.' . $file['extension']);
737  $xml_file = ilObjQuestionPool::_getImportDirectory() . '/' . $subdir . '/' . $subdir . '.xml';
738  $qti_file = ilObjQuestionPool::_getImportDirectory() . '/' . $subdir . '/' . str_replace(
739  'qpl',
740  'qti',
741  $subdir
742  ) . '.xml';
743  }
744  if (!file_exists($qti_file)) {
745  ilFileUtils::delDir($basedir);
746  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cannot_find_xml'), true);
747  $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
748  $this->ctrl->redirect($this, $cmd);
749  return false;
750  }
751  $qtiParser = new ilQTIParser($qti_file, ilQTIParser::IL_MO_VERIFY_QTI, 0, '');
752  $qtiParser->startParsing();
753  $founditems = &$qtiParser->getFoundItems();
754  if (count($founditems) == 0) {
755  ilFileUtils::delDir($basedir);
756 
757  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('qpl_import_no_items'), true);
758  if (!$questions_only) {
759  $this->ctrl->redirect($this, 'create');
760  }
761  return false;
762  }
763 
764  $complete = 0;
765  $incomplete = 0;
766  foreach ($founditems as $item) {
767  if (strlen($item['type'])) {
768  $complete++;
769  } else {
770  $incomplete++;
771  }
772  }
773 
774  if ($complete == 0) {
775  ilFileUtils::delDir($basedir);
776 
777  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('qpl_import_non_ilias_files'), true);
778  if (!$questions_only) {
779  $this->ctrl->redirect($this, 'create');
780  }
781  return false;
782  }
783 
784  ilSession::set('qpl_import_xml_file', $xml_file);
785  ilSession::set('qpl_import_qti_file', $qti_file);
786  ilSession::set('qpl_import_subdir', $subdir);
787 
788  $this->tpl->addBlockFile(
789  'ADM_CONTENT',
790  'adm_content',
791  'tpl.qpl_import_verification.html',
792  'Modules/TestQuestionPool'
793  );
794  $table = new ilQuestionPoolImportVerificationTableGUI($this, 'uploadQpl');
795  $rows = [];
796 
797  foreach ($founditems as $item) {
798  $row = [
799  'title' => $item['title'],
800  'ident' => $item['ident'],
801  ];
802  switch ($item['type']) {
804  $type = $this->lng->txt('assClozeTest');
805  break;
807  $type = $this->lng->txt('assImagemapQuestion');
808  break;
810  $type = $this->lng->txt('assMatchingQuestion');
811  break;
813  $type = $this->lng->txt('assMultipleChoice');
814  break;
816  $type = $this->lng->txt('assKprimChoice');
817  break;
819  $type = $this->lng->txt('assLongMenu');
820  break;
822  $type = $this->lng->txt('assSingleChoice');
823  break;
825  $type = $this->lng->txt('assOrderingQuestion');
826  break;
828  $type = $this->lng->txt('assTextQuestion');
829  break;
831  $type = $this->lng->txt('assNumeric');
832  break;
834  $type = $this->lng->txt('assTextSubset');
835  break;
836  default:
837  $type = $this->lng->txt($item['type']);
838  break;
839  }
840 
841  if (strcmp($type, '-' . $item['type'] . '-') == 0) {
844  foreach ($component_factory->getActivePluginsInSlot('qst') as $pl) {
845  if (strcmp($pl->getQuestionType(), $item['type']) == 0) {
846  $type = $pl->getQuestionTypeTranslation();
847  }
848  }
849  }
850 
851  $row['type'] = $type;
852 
853  $rows[] = $row;
854  }
855  $table->setData($rows);
856 
857  if (is_file($xml_file)
858  && !$questions_only) {
859  $this->tpl->setCurrentBlock("import_qpl");
860  try {
861  $fh = fopen($xml_file, 'r');
862  $xml = fread($fh, filesize($xml_file));
863  fclose($fh);
864  } catch (Exception $e) {
865  return false;
866  }
867  if (preg_match('/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</', $xml, $matches)) {
868  $this->tpl->setVariable('VALUE_NEW_QUESTIONPOOL', $matches[1]);
869  }
870 
871  $this->tpl->setVariable("TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt("qpl_import_create_new_qpl"));
872  $this->tpl->parseCurrentBlock();
873  }
874 
875  $this->tpl->setCurrentBlock('adm_content');
876  $this->tpl->setVariable('FOUND_QUESTIONS_INTRODUCTION', $this->lng->txt('qpl_import_verify_found_questions'));
877  if ($questions_only) {
878  $this->tpl->setVariable('VERIFICATION_HEADING', $this->lng->txt('import_questions_into_qpl'));
879  $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this));
880  } else {
881  $this->tpl->setVariable('VERIFICATION_HEADING', $this->lng->txt('import_qpl'));
882 
883  $this->ctrl->setParameter($this, 'new_type', $this->type);
884  $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this));
885  }
886 
887  $value_questions_only = 0;
888  if ($questions_only) {
889  $value_questions_only = 1;
890  }
891  $this->tpl->setVariable('VALUE_QUESTIONS_ONLY', $value_questions_only);
892  $this->tpl->setVariable('VERIFICATION_TABLE', $table->getHtml());
893  $this->tpl->setVariable('VERIFICATION_FORM_NAME', $table->getFormName());
894 
895  $this->tpl->parseCurrentBlock();
896 
897  return true;
898  }
const MATCHING_QUESTION_IDENTIFIER
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
const KPRIM_CHOICE_QUESTION_IDENTIFIER
const LONG_MENU_QUESTION_IDENTIFIER
const TEXTSUBSET_QUESTION_IDENTIFIER
ilComponentRepository $component_repository
getActivePluginsInSlot(string $slot_id)
Get the active plugins for the given slot.
ilComponentFactory $component_factory
const NUMERIC_QUESTION_IDENTIFIER
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
const ORDERING_QUESTION_IDENTIFIER
static _setImportDirectory($a_import_dir=null)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
const TEXT_QUESTION_IDENTIFIER
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
const SINGLE_CHOICE_QUESTION_IDENTIFIER
static set(string $a_var, $a_val)
Set a value.
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
static _setImportDirectory($a_import_dir=null)
const IMAGEMAP_QUESTION_IDENTIFIER
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $action_parameter_token

URLBuilderToken ilObjQuestionPoolGUI::$action_parameter_token
protected

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

◆ $archives

ILIAS Filesystem Util Archive LegacyArchives ilObjQuestionPoolGUI::$archives
private

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

◆ $component_factory

ilComponentFactory ilObjQuestionPoolGUI::$component_factory
protected

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

Referenced by uploadQplObject().

◆ $component_repository

ilComponentRepository ilObjQuestionPoolGUI::$component_repository
protected

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

Referenced by getQueryParamInt(), and uploadQplObject().

◆ $data_factory

DataFactory ilObjQuestionPoolGUI::$data_factory
protected

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

◆ $db

ilDBInterface ilObjQuestionPoolGUI::$db
protected

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

Referenced by getQueryParamInt().

◆ $global_screen

GlobalScreen ilObjQuestionPoolGUI::$global_screen
protected

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

◆ $help

ilHelpGUI ilObjQuestionPoolGUI::$help
protected

◆ $http

HTTPServices ilObjQuestionPoolGUI::$http
private

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

◆ $http_request

HttpRequest ilObjQuestionPoolGUI::$http_request
private

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

◆ $log

ilComponentLogger ilObjQuestionPoolGUI::$log
protected

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

◆ $navigation_history

ilNavigationHistory ilObjQuestionPoolGUI::$navigation_history
protected

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

Referenced by getQueryParamInt().

◆ $object

ilObject ilObjQuestionPoolGUI::$object

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

Referenced by getQueryParamInt(), and importVerifiedFileObject().

◆ $qplrequest

ILIAS TestQuestionPool InternalRequestService ilObjQuestionPoolGUI::$qplrequest
protected

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

◆ $questioninfo

QuestionInfoService ilObjQuestionPoolGUI::$questioninfo
private

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

◆ $rbac

RBACServices ilObjQuestionPoolGUI::$rbac
protected

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

◆ $row_id_token

URLBuilderToken ilObjQuestionPoolGUI::$row_id_token
protected

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

◆ $taxonomy

Service ilObjQuestionPoolGUI::$taxonomy
protected

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

◆ $ui_service

ilUIService ilObjQuestionPoolGUI::$ui_service
protected

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

◆ $url_builder

URLBuilder ilObjQuestionPoolGUI::$url_builder
protected

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


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