ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 public. More...
 
 executeCommand ()
 execute command 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 $a_new_object)
 save object 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...
 
 updateObject ()
 
 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 ()
 
 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
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

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

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

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

Private Attributes

 $error
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

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$

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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjQuestionPoolGUI::__construct ( )

Constructor public.

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

References $_GET, $DIC, ilObjectGUI\$lng, ilObjectGUI\$rbacsystem, and ILIAS\GlobalScreen\Provider\__construct().

69  {
70  global $DIC;
71  $lng = $DIC['lng'];
72  $ilCtrl = $DIC['ilCtrl'];
73  $rbacsystem = $DIC['rbacsystem'];
74  $lng->loadLanguageModule("assessment");
75  $this->type = "qpl";
76  $this->error = $DIC['ilErr'];
77  $this->ctrl = &$ilCtrl;
78  $this->refinery = $DIC['refinery'];
79 
80  $this->ctrl->saveParameter($this, array(
81  "ref_id", "test_ref_id", "calling_test", "test_express_mode", "q_id", 'tax_node', 'calling_consumer', 'consumer_context'
82  ));
83  $this->ctrl->saveParameter($this, "calling_consumer");
84  $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'calling_consumer');
85  $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'consumer_context');
86  $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'calling_consumer');
87  $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'consumer_context');
88 
89  parent::__construct("", $_GET["ref_id"], true, false);
90  }
$_GET["client_id"]
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addLocatorItems()

ilObjQuestionPoolGUI::addLocatorItems ( )

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

References $_GET, $DIC, assQuestionGUI\_getQuestionGUI(), and assQuestion\_getQuestionTypeName().

1515  {
1516  global $DIC;
1517  $ilLocator = $DIC['ilLocator'];
1518  switch ($this->ctrl->getCmd()) {
1519  case "create":
1520  case "importFile":
1521  case "cancel":
1522  break;
1523  default:
1524  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
1525  break;
1526  }
1527  if ($_GET["q_id"] > 0) {
1528  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1529  $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
1530  if ($q_gui->object instanceof assQuestion) {
1531  $q_gui->object->setObjId($this->object->getId());
1532  $title = $q_gui->object->getTitle();
1533  if (!$title) {
1534  $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
1535  }
1536  $ilLocator->addItem($title, $this->ctrl->getLinkTargetByClass(get_class($q_gui), "editQuestion"));
1537  } else {
1538  // Workaround for context issues: If no object was found, redirect without q_id parameter
1539  $this->ctrl->setParameter($this, 'q_id', '');
1540  $this->ctrl->redirect($this);
1541  }
1542  }
1543  }
$_GET["client_id"]
Abstract basic class which is to be extended by the concrete assessment question type classes...
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ addSettingsSubTabs()

ilObjQuestionPoolGUI::addSettingsSubTabs ( ilTabsGUI  $tabs)
private

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

References ilTabsGUI\addSubTabTarget().

Referenced by getTabs().

1767  {
1768  $tabs->addSubTabTarget(
1769  'qpl_settings_subtab_general',
1770  $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1771  '',
1772  'ilObjQuestionPoolSettingsGeneralGUI'
1773  );
1774 
1775  $tabs->addSubTabTarget(
1776  'qpl_settings_subtab_taxonomies',
1777  $this->ctrl->getLinkTargetByClass('ilObjTaxonomyGUI', 'editAOTaxonomySettings'),
1778  '',
1779  'ilObjTaxonomyGUI'
1780  );
1781  }
addSubTabTarget( $a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterSave()

ilObjQuestionPoolGUI::afterSave ( ilObject  $a_new_object)

save object public

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

References ilObject\getRefId(), and ilUtil\redirect().

975  {
976  // always send a message
977  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
978 
979  ilUtil::redirect("ilias.php?ref_id=" . $a_new_object->getRefId() .
980  "&baseClass=ilObjQuestionPoolGUI");
981  }
getRefId()
get reference id public
static redirect($a_script)
+ Here is the call graph for this function:

◆ buildCreateQuestionForm()

ilObjQuestionPoolGUI::buildCreateQuestionForm ( )
private

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

References $_GET, $_POST, $d, ilObjectGUI\$data, $DIC, $ilUser, $si, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_IPE, assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), and ilUtil\stripSlashes().

Referenced by createQuestionFormObject().

1274  {
1275  global $DIC;
1276  $ilUser = $DIC['ilUser'];
1277 
1278  // form
1279 
1280  require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1281  $form = new ilPropertyFormGUI();
1282  $form->setTitle($this->lng->txt('ass_create_question'));
1283  $form->setFormAction($this->ctrl->getFormAction($this));
1284 
1285  // question type
1286 
1287  $options = array();
1288  foreach ($this->object->getQuestionTypes(false, true, false) as $translation => $data) {
1289  $options[$data['type_tag']] = $translation;
1290  }
1291 
1292  require_once("Services/Form/classes/class.ilSelectInputGUI.php");
1293  $si = new ilSelectInputGUI($this->lng->txt('question_type'), 'sel_question_types');
1294  $si->setOptions($options);
1295  //$si->setValue($ilUser->getPref("tst_lastquestiontype"));
1296 
1297  $form->addItem($si);
1298 
1299  // content editing mode
1300 
1302  $ri = new ilRadioGroupInputGUI($this->lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
1303 
1304  $option_ipe = new ilRadioOption(
1305  $this->lng->txt('tst_add_quest_cont_edit_mode_IPE'),
1307  );
1308  $option_ipe->setInfo($this->lng->txt('tst_add_quest_cont_edit_mode_IPE_info'));
1309  $ri->addOption($option_ipe);
1310 
1311  $option_rte = new ilRadioOption(
1312  $this->lng->txt('tst_add_quest_cont_edit_mode_RTE'),
1314  );
1315  $option_rte->setInfo($this->lng->txt('tst_add_quest_cont_edit_mode_RTE_info'));
1316  $ri->addOption($option_rte);
1317 
1319 
1320  $form->addItem($ri, true);
1321  } else {
1322  $hi = new ilHiddenInputGUI("question_content_editing_type");
1324  $form->addItem($hi, true);
1325  }
1326 
1327  // commands
1328 
1329  $form->addCommandButton('createQuestion', $this->lng->txt('create'));
1330  $form->addCommandButton('questions', $this->lng->txt('cancel'));
1331 
1332  return $form;
1333  }
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
constant for additional content editing mode "pageobject"
This class represents an option in a radio group.
This class represents a property form user interface.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
This class represents a hidden form property in a property form.
This class represents a property in a property form.
global $DIC
Definition: goto.php:24
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
constant for additional content editing mode "default"
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not ...
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionBrowserTableGUI()

ilObjQuestionPoolGUI::buildQuestionBrowserTableGUI (   $taxIds)
private
Parameters
array$taxIdsilRbacSystem $rbacsystem ilDBInterface $ilDB ilLanguage $lng ilPluginAdmin $ilPluginAdmin
Returns
ilQuestionBrowserTableGUI

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

References $_GET, ilObjectGUI\$data, $DIC, $ilDB, ilObjectGUI\$lng, checkWriteAccess(), isCommentingEnabled(), and ilTree\readRootId().

Referenced by executeCommand(), and questionsObject().

1870  {
1871  global $DIC;
1872  $ilDB = $DIC['ilDB'];
1873  $lng = $DIC['lng'];
1874  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1875 
1876  $writeAccess = $this->checkWriteAccess();
1877  include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
1878  $table_gui = new ilQuestionBrowserTableGUI(
1879  $this,
1880  'questions',
1881  $writeAccess,
1882  false,
1883  $taxIds,
1884  $this->isCommentingEnabled()
1885  );
1886  $table_gui->setEditable($writeAccess);
1887  $questionList = new ilAssQuestionList(
1888  $ilDB,
1889  $lng,
1890  $this->refinery,
1891  $ilPluginAdmin
1892  );
1893  $questionList->setParentObjId($this->object->getId());
1894 
1895  foreach ($table_gui->getFilterItems() as $item) {
1896  if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1897  $v = $item->getValue();
1898 
1899  if (is_array($v) && count($v) && !(int) $v[0]) {
1900  continue;
1901  }
1902 
1903  $taxId = substr($item->getPostVar(), strlen('tax_'));
1904 
1905  $questionList->addTaxonomyFilter(
1906  $taxId,
1907  $item->getValue(),
1908  $this->object->getId(),
1909  $this->object->getType()
1910  );
1911  } elseif ($item->getValue() !== false) {
1912  $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1913  }
1914  }
1915 
1916  if ($this->object->isNavTaxonomyActive() && (int) $_GET['tax_node']) {
1917  require_once 'Services/Taxonomy/classes/class.ilTaxonomyTree.php';
1918  $taxTree = new ilTaxonomyTree($this->object->getNavTaxonomyId());
1919  $rootNodeId = $taxTree->readRootId();
1920 
1921  if ((int) $_GET['tax_node'] != $rootNodeId) {
1922  $questionList->addTaxonomyFilter(
1923  $this->object->getNavTaxonomyId(),
1924  array((int) $_GET['tax_node']),
1925  $this->object->getId(),
1926  $this->object->getType()
1927  );
1928  }
1929  }
1930 
1931  $questionList->load();
1932  $data = $questionList->getQuestionDataArray();
1933 
1934  $table_gui->setQuestionData($data);
1935 
1936  return $table_gui;
1937  }
$_GET["client_id"]
global $DIC
Definition: goto.php:24
global $ilDB
readRootId()
read root id from database
+ 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 1041 of file class.ilObjQuestionPoolGUI.php.

1042  {
1043  $this->ctrl->redirect($this, "questions");
1044  }

◆ cancelImportObject()

ilObjQuestionPoolGUI::cancelImportObject ( )

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

References $_POST.

857  {
858  if ($_POST["questions_only"] == 1) {
859  $this->ctrl->redirect($this, "questions");
860  } else {
861  $this->ctrl->redirect($this, "cancel");
862  }
863  }
$_POST["username"]

◆ checkWriteAccess()

ilObjQuestionPoolGUI::checkWriteAccess ( )
protected

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

Referenced by buildQuestionBrowserTableGUI(), deleteQuestionsObject(), and isCommentingEnabled().

1086  : bool
1087  {
1088  return $this->rbacsystem->checkAccess('write', $this->id);
1089  }
+ Here is the caller graph for this function:

◆ confirmDeleteQuestionsObject()

ilObjQuestionPoolGUI::confirmDeleteQuestionsObject ( )

delete questions

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

References $_POST.

1023  {
1024  // delete questions after confirmation
1025  foreach ($_POST["q_id"] as $key => $value) {
1026  $this->object->deleteQuestion($value);
1027  $this->object->cleanupClipboard($value);
1028  }
1029  if (count($_POST["q_id"])) {
1030  ilUtil::sendSuccess($this->lng->txt("qpl_questions_deleted"), true);
1031  }
1032 
1033  $this->ctrl->setParameter($this, 'q_id', '');
1034 
1035  $this->ctrl->redirect($this, "questions");
1036  }
$_POST["username"]

◆ copyObject()

ilObjQuestionPoolGUI::copyObject ( )

copy one or more question objects to the clipboard

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

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

1403  {
1404  if (isset($_POST["q_id"]) && is_array($_POST["q_id"]) && count($_POST["q_id"]) > 0) {
1405  foreach ($_POST["q_id"] as $key => $value) {
1406  $this->object->copyToClipboard($value);
1407  }
1408  ilUtil::sendInfo($this->lng->txt("qpl_copy_insert_clipboard"), true);
1409  } elseif (isset($_GET['q_id']) && $_GET['q_id'] > 0) {
1410  $this->object->copyToClipboard((int) $_GET['q_id']);
1411  ilUtil::sendInfo($this->lng->txt("qpl_copy_insert_clipboard"), true);
1412  } else {
1413  ilUtil::sendInfo($this->lng->txt("qpl_copy_select_none"), true);
1414  }
1415  $this->ctrl->redirect($this, "questions");
1416  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ createExportExcel()

ilObjQuestionPoolGUI::createExportExcel ( )

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

References $_GET, $DIC, and ilObjectGUI\$rbacsystem.

1438  {
1439  global $DIC;
1440  $rbacsystem = $DIC['rbacsystem'];
1441  if ($rbacsystem->checkAccess("write", $_GET['ref_id'])) {
1442  include_once("./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1443  $question_ids = &$this->object->getAllQuestionIds();
1444  $qpl_exp = new ilQuestionpoolExport($this->object, 'xls', $question_ids);
1445  $qpl_exp->buildExportFile();
1446  $this->ctrl->redirectByClass("ilquestionpoolexportgui", "");
1447  }
1448  }
$_GET["client_id"]
Export class for questionpools.
global $DIC
Definition: goto.php:24

◆ createQuestionFormObject()

ilObjQuestionPoolGUI::createQuestionFormObject ( )
private

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

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

1256  {
1257  global $DIC; /* @var \ILIAS\DI\Container $DIC */
1258  $ilHelp = $DIC['ilHelp']; /* @var ilHelpGUI $ilHelp */
1259 
1260  $ilHelp->setScreenId('assQuestions');
1261 
1263  $ilHelp->setSubScreenId('createQuestion_editMode');
1264  } else {
1265  $ilHelp->setSubScreenId('createQuestion');
1266  }
1267 
1268  $form = $this->buildCreateQuestionForm();
1269 
1270  $this->tpl->setContent($this->ctrl->getHTML($form));
1271  }
global $DIC
Definition: goto.php:24
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 ( )

create new question

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

References $_GET, assQuestionGUI\_getQuestionGUI(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, and ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled().

941  {
942  if (!$_REQUEST['q_id']) {
943  require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
945  $addContEditMode = $_REQUEST['add_quest_cont_edit_mode'];
946  } else {
948  }
949 
950  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
951  $q_gui = &assQuestionGUI::_getQuestionGUI($_GET["sel_question_types"]);
952  $q_gui->object->setObjId($this->object->getId());
953  $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
954  $q_gui->object->createNewQuestion();
955 
956  $class = get_class($q_gui);
957  $qId = $q_gui->object->getId();
958  } else {
959  $class = $_GET["sel_question_types"] . 'gui';
960  $qId = $_REQUEST['q_id'];
961  }
962 
963  $this->ctrl->setParameterByClass($class, "q_id", $qId);
964  $this->ctrl->setParameterByClass($class, "sel_question_types", $_REQUEST["sel_question_types"]);
965  $this->ctrl->setParameterByClass($class, "prev_qid", $_REQUEST["prev_qid"]);
966 
967  $this->ctrl->redirectByClass($class, "editQuestion");
968  }
$_GET["client_id"]
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
constant for additional content editing mode "default"
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not ...
+ Here is the call graph for this function:

◆ createQuestionObject()

& ilObjQuestionPoolGUI::createQuestionObject ( )

create new question

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

References $_POST, assQuestionGUI\_getQuestionGUI(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_RTE, and ilObjAssessmentFolder\isAdditionalQuestionContentEditingModePageObjectEnabled().

919  {
921  $addContEditMode = $_POST['add_quest_cont_edit_mode'];
922  } else {
924  }
925 
926  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
927  $q_gui = &assQuestionGUI::_getQuestionGUI($_POST["sel_question_types"]);
928  $this->object->addQuestionChangeListeners($q_gui->object);
929  $q_gui->object->setObjId($this->object->getId());
930  $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
931  $q_gui->object->createNewQuestion();
932  $this->ctrl->setParameterByClass(get_class($q_gui), "q_id", $q_gui->object->getId());
933  $this->ctrl->setParameterByClass(get_class($q_gui), "sel_question_types", $_POST["sel_question_types"]);
934  $this->ctrl->redirectByClass(get_class($q_gui), "editQuestion");
935  }
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
constant for additional content editing mode "default"
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not ...
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteQuestionsObject()

ilObjQuestionPoolGUI::deleteQuestionsObject ( )

delete questions confirmation screen

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

References $_GET, $_POST, checkWriteAccess(), ilUtil\sendInfo(), and ilUtil\sendQuestion().

994  {
995  $questionIdsToDelete = isset($_POST['q_id']) ? (array) $_POST['q_id'] : array();
996  if (0 === count($questionIdsToDelete) && isset($_GET['q_id'])) {
997  $questionIdsToDelete = array($_GET['q_id']);
998  }
999 
1000  $questionIdsToDelete = array_filter(array_map('intval', $questionIdsToDelete));
1001  if (0 === count($questionIdsToDelete)) {
1002  ilUtil::sendInfo($this->lng->txt("qpl_delete_select_none"), true);
1003  $this->ctrl->redirect($this, "questions");
1004  }
1005 
1006  ilUtil::sendQuestion($this->lng->txt("qpl_confirm_delete_questions"));
1007  $deleteable_questions = &$this->object->getDeleteableQuestionDetails($questionIdsToDelete);
1008  include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
1009 
1010  $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', $this->checkWriteAccess(), true);
1011  $table_gui->setShowRowsSelector(false);
1012  $table_gui->setLimit(PHP_INT_MAX);
1013  $table_gui->setEditable($this->checkWriteAccess());
1014  $table_gui->setData($deleteable_questions);
1015  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
1016  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ download_paragraphObject()

ilObjQuestionPoolGUI::download_paragraphObject ( )

download source code paragraph

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

References $_GET, and exit.

561  {
562  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
563  $pg_obj = new ilAssQuestionPage($_GET["pg_id"]);
564  $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
565  exit;
566  }
exit
Definition: login.php:29
$_GET["client_id"]
Question page object.

◆ downloadFileObject()

ilObjQuestionPoolGUI::downloadFileObject ( )

download file

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

References $_GET, and exit.

520  {
521  $file = explode("_", $_GET["file_id"]);
522  include_once("./Modules/File/classes/class.ilObjFile.php");
523  $fileObj = new ilObjFile($file[count($file) - 1], false);
524  $fileObj->sendFile();
525  exit;
526  }
exit
Definition: login.php:29
$_GET["client_id"]

◆ editQuestionForTestObject()

& ilObjQuestionPoolGUI::editQuestionForTestObject ( )

edit question

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

References $DIC.

1454  {
1455  global $DIC;
1456 
1457  $p_gui = new ilAssQuestionPreviewGUI(
1458  $this->ctrl,
1459  $this->tabs_gui,
1460  $this->tpl,
1461  $this->lng,
1462  $DIC->database(),
1463  $DIC->user(),
1464  $DIC->rbac()
1465  );
1466  $this->ctrl->redirectByClass(get_class($p_gui), "show");
1467  }
global $DIC
Definition: goto.php:24

◆ executeCommand()

ilObjQuestionPoolGUI::executeCommand ( )

execute command

ilLocatorGUI $ilLocator ilAccessHandler $ilAccess ilNavigationHistory $ilNavigationHistory ilTemplate $tpl ilCtrl $ilCtrl ilTabsGUI $ilTabs ilLanguage $lng ILIAS $ilias

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

References $_GET, $_POST, $DIC, $ilDB, ilObjectGUI\$ilErr, $ilUser, ilObjectGUI\$lng, ilObjectGUI\$ref_id, $ret, ilObjectGUI\$tpl, assQuestionGUI\_getQuestionGUI(), buildQuestionBrowserTableGUI(), ilAssQuestionPreviewGUI\CMD_SHOW, assQuestionGUI\EDIT_CONTEXT_AUTHORING, fetchAuthoringQuestionIdParamater(), ilObjStyleSheet\getContentStylePath(), ilObjectGUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ilUtil\getStyleSheetLocation(), ilObjStyleSheet\getSyntaxStylePath(), infoScreenForward(), ilAssQuestionPreviewGUI\initQuestion(), ilObjectGUI\prepareOutput(), redirectAfterMissingWrite(), assQuestionGUI\RENDER_PURPOSE_PREVIEW, and ilUtil\sendFailure().

105  {
106  global $DIC;
107  $ilUser = $DIC['ilUser'];
108  $ilLocator = $DIC['ilLocator'];
109  $ilAccess = $DIC['ilAccess'];
110  $ilNavigationHistory = $DIC['ilNavigationHistory'];
111  $tpl = $DIC['tpl'];
112  $ilCtrl = $DIC['ilCtrl'];
113  $ilErr = $DIC['ilErr'];
114  $ilTabs = $DIC['ilTabs'];
115  $lng = $DIC['lng'];
116  $ilDB = $DIC['ilDB'];
117  $ilPluginAdmin = $DIC['ilPluginAdmin'];
118  $ilias = $DIC['ilias'];
119 
120  $writeAccess = $ilAccess->checkAccess("write", "", $_GET["ref_id"]);
121 
122  if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) && (!$ilAccess->checkAccess("visible", "", $_GET["ref_id"]))) {
123  global $DIC;
124  $ilias = $DIC['ilias'];
125  $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
126  }
127 
128  // add entry to navigation history
129  if (!$this->getCreationMode() &&
130  $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
131  if ('qpl' == $this->object->getType()) {
132  $ilNavigationHistory->addItem(
133  $_GET["ref_id"],
134  "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=" . $_GET["ref_id"],
135  "qpl"
136  );
137  }
138  }
139 
140  $cmd = $this->ctrl->getCmd("questions");
141  $next_class = $this->ctrl->getNextClass($this);
142 
143  if (in_array($next_class, array('', 'ilobjquestionpoolgui')) && $cmd == 'questions') {
144  $_GET['q_id'] = '';
145  }
146 
147  $this->prepareOutput();
148 
149  $this->ctrl->setReturn($this, "questions");
150 
151  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
152 
153  if ($_GET["q_id"] < 1) {
154  $q_type = ($_POST["sel_question_types"] != "")
155  ? $_POST["sel_question_types"]
156  : $_GET["sel_question_types"];
157  }
158  if ($cmd != "createQuestion" && $cmd != "createQuestionForTest"
159  && $next_class != "ilassquestionpagegui") {
160  if (($_GET["test_ref_id"] != "") or ($_GET["calling_test"])) {
161  $ref_id = $_GET["test_ref_id"];
162  if (!$ref_id) {
163  $ref_id = $_GET["calling_test"];
164  }
165  }
166  }
167  switch ($next_class) {
168  case "ilcommonactiondispatchergui":
169  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
171  $this->ctrl->forwardCommand($gui);
172  break;
173 
174  case 'ilobjectmetadatagui':
175  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
176  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
177  }
178  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
179  $md_gui = new ilObjectMetaDataGUI($this->object);
180  $this->ctrl->forwardCommand($md_gui);
181  break;
182 
183  case 'ilassquestionpreviewgui':
184  if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
185  $this->redirectAfterMissingWrite();
186  }
187 
188  $this->ctrl->saveParameter($this, "q_id");
189 
190  $gui = new ilAssQuestionPreviewGUI(
191  $this->ctrl,
192  $this->tabs_gui,
193  $this->tpl,
194  $this->lng,
195  $ilDB,
196  $ilUser,
197  $DIC->rbac()
198  );
199 
200  $gui->initQuestion((int) $_GET['q_id'], $this->object->getId());
201  $gui->initPreviewSettings($this->object->getRefId());
202  $gui->initPreviewSession($ilUser->getId(), $this->fetchAuthoringQuestionIdParamater());
203  $gui->initHintTracking();
204 
205  global $DIC;
206  $ilHelp = $DIC['ilHelp'];
207  $ilHelp->setScreenIdComponent("qpl");
208 
209  $this->ctrl->forwardCommand($gui);
210  break;
211 
212  case "ilassquestionpagegui":
213  if ($cmd == 'finishEditing') {
214  $this->ctrl->redirectByClass('ilassquestionpreviewgui', 'show');
215  break;
216  }
217  if ($cmd === 'edit' && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
218  $this->redirectAfterMissingWrite();
219  }
220 
221  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
222  $this->tpl->setCurrentBlock("ContentStyle");
223  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
224  $this->tpl->parseCurrentBlock();
225 
226  // syntax style
227  $this->tpl->setCurrentBlock("SyntaxStyle");
228  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
229  $this->tpl->parseCurrentBlock();
230 
231  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
233  $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
234  $q_gui->setQuestionTabs();
235  $q_gui->outAdditionalOutput();
236  $q_gui->object->setObjId($this->object->getId());
237 
238  $q_gui->setTargetGuiClass(null);
239  $q_gui->setQuestionActionCmd(null);
240 
241  if ($this->object->getType() == 'qpl') {
242  $q_gui->addHeaderAction();
243  }
244 
245  $question = $q_gui->object;
246 
247  if ($question->isInActiveTest()) {
248  ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true);
249  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
250  }
251 
252  $this->ctrl->saveParameter($this, "q_id");
253  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
254  $this->lng->loadLanguageModule("content");
255  $this->ctrl->setReturnByClass("ilAssQuestionPageGUI", "view");
256  $this->ctrl->setReturn($this, "questions");
257  $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]);
258  $page_gui->obj->addUpdateListener(
259  $question,
260  'updateTimestamp'
261  );
262  $page_gui->setEditPreview(true);
263  $page_gui->setEnabledTabs(false);
264  if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST["editImagemapForward_x"])) { // workaround for page edit imagemaps, keep in mind
265  $this->ctrl->setCmdClass(get_class($page_gui));
266  $this->ctrl->setCmd("preview");
267  }
268  $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(true)));
269  $page_gui->setTemplateTargetVar("ADM_CONTENT");
270  $page_gui->setOutputMode("edit");
271  $page_gui->setHeader($question->getTitle());
272  $page_gui->setPresentationTitle($question->getTitle());
273  $ret = $this->ctrl->forwardCommand($page_gui);
274  if ($ret != "") {
275  $tpl->setContent($ret);
276  }
277  break;
278 
279  case 'ilpermissiongui':
280  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
281  $perm_gui = new ilPermissionGUI($this);
282  $ret = $this->ctrl->forwardCommand($perm_gui);
283  break;
284 
285  case 'ilobjectcopygui':
286  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
287  $cp = new ilObjectCopyGUI($this);
288  $cp->setType('qpl');
289  $this->ctrl->forwardCommand($cp);
290  break;
291 
292  case "ilquestionpoolexportgui":
293  require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolExportGUI.php';
294  $exp_gui = new ilQuestionPoolExportGUI($this);
295  $exp_gui->addFormat('xml', $this->lng->txt('qpl_export_xml'));
296  $exp_gui->addFormat('xls', $this->lng->txt('qpl_export_excel'), $this, 'createExportExcel');
297  $ret = $this->ctrl->forwardCommand($exp_gui);
298  break;
299 
300  case "ilinfoscreengui":
301  $this->infoScreenForward();
302  break;
303 
304  case 'ilassquestionhintsgui':
305  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
306  $this->redirectAfterMissingWrite();
307  }
308  // set return target
309  $this->ctrl->setReturn($this, "questions");
310 
311  // set context tabs
312  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
313  $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater());
314  $questionGUI->object->setObjId($this->object->getId());
315  $questionGUI->setQuestionTabs();
316 
317  if ($questionGUI->object->isInActiveTest()) {
318  ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true);
319  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
320  }
321 
322  $ilHelp = $DIC['ilHelp'];
323  $ilHelp->setScreenIdComponent("qpl");
324 
325  if ($this->object->getType() == 'qpl' && $writeAccess) {
326  $questionGUI->addHeaderAction();
327  }
328 
329  // forward to ilAssQuestionHintsGUI
330  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
331  $gui = new ilAssQuestionHintsGUI($questionGUI);
332 
333  $gui->setEditingEnabled(
334  $DIC->access()->checkAccess('write', '', $this->object->getRefId())
335  );
336 
337  $ilCtrl->forwardCommand($gui);
338 
339  break;
340 
341  case 'illocalunitconfigurationgui':
342  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
343  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
344  }
345 
346  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
347  $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater());
348  $questionGUI->object->setObjId($this->object->getId());
349  $questionGUI->setQuestionTabs();
350 
351  $this->ctrl->setReturn($this, 'questions');
352 
353  require_once 'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
354  require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
355  $gui = new ilLocalUnitConfigurationGUI(
356  new ilUnitConfigurationRepository((int) $_GET['q_id'])
357  );
358  $ilCtrl->forwardCommand($gui);
359  break;
360 
361  case 'ilassquestionfeedbackeditinggui':
362  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
363  $this->redirectAfterMissingWrite();
364  }
365 
366  // set return target
367  $this->ctrl->setReturn($this, "questions");
368 
369  // set context tabs
370  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
371  $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater());
372  $questionGUI->object->setObjId($this->object->getId());
373  $questionGUI->setQuestionTabs();
374 
375  if ($questionGUI->object->isInActiveTest()) {
376  ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true);
377  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
378  }
379 
380  $ilHelp = $DIC['ilHelp'];
381  $ilHelp->setScreenIdComponent("qpl");
382 
383  if ($this->object->getType() == 'qpl' && $writeAccess) {
384  $questionGUI->addHeaderAction();
385  }
386 
387  // forward to ilAssQuestionFeedbackGUI
388  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
389  $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
390  $ilCtrl->forwardCommand($gui);
391 
392  break;
393 
394  case 'ilobjquestionpoolsettingsgeneralgui':
395  require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolSettingsGeneralGUI.php';
396  $gui = new ilObjQuestionPoolSettingsGeneralGUI($ilCtrl, $ilAccess, $lng, $tpl, $ilTabs, $this);
397  $this->ctrl->forwardCommand($gui);
398  break;
399 
400  case "ilobjtaxonomygui":
401  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
402  $this->redirectAfterMissingWrite();
403  }
405  $this->object,
406  $ilDB,
407  $this->refinery,
408  $ilPluginAdmin,
409  $ilCtrl,
410  $ilTabs,
411  $lng
412  );
413 
414  $forwarder->forward();
415 
416  break;
417 
418  case 'ilquestionpoolskilladministrationgui':
419 
420  require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolSkillAdministrationGUI.php';
422  $ilias,
423  $ilCtrl,
424  $ilAccess,
425  $ilTabs,
426  $tpl,
427  $lng,
428  $ilDB,
429  $ilPluginAdmin,
430  $this->object,
431  $this->ref_id
432  );
433 
434  $this->ctrl->forwardCommand($gui);
435 
436  break;
437 
438  case 'ilquestionbrowsertablegui':
439  $this->ctrl->forwardCommand($this->buildQuestionBrowserTableGUI($taxIds = array())); // no tax ids required
440  break;
441 
442  case "ilobjquestionpoolgui":
443  case "":
444 
445  if ($cmd == 'questions') {
446  $this->ctrl->setParameter($this, 'q_id', '');
447  }
448 
449  $cmd .= "Object";
450  $ret = $this->$cmd();
451  break;
452 
453  default:
454  if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
455  $this->redirectAfterMissingWrite();
456  }
457 
458  if ($cmd === 'assessment' &&
459  $this->object->getType() === 'tst' &&
460  !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
461  $this->redirectAfterMissingWrite();
462  }
463 
464  $this->ctrl->setReturn($this, "questions");
465  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
466  $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater());
467  $questionGUI->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING);
468  $questionGUI->object->setObjId($this->object->getId());
469 
470  if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && $questionGUI->object->isInActiveTest()) {
471  ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true);
472  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
473  }
474 
475  if ($this->object->getType() == 'qpl') {
476  $questionGUI->setTaxonomyIds($this->object->getTaxonomyIds());
477  $this->object->addQuestionChangeListeners($questionGUI->object);
478  if ($writeAccess) {
479  $questionGUI->addHeaderAction();
480  }
481  }
482  $questionGUI->setQuestionTabs();
483 
484  $ilHelp = $DIC['ilHelp'];
485  $ilHelp->setScreenIdComponent("qpl");
486  $ret = $this->ctrl->forwardCommand($questionGUI);
487  break;
488  }
489 
490  if (!(strtolower($_GET["baseClass"]) == "iladministrationgui"
491  || strtolower($_GET['baseClass']) == 'ilrepositorygui')
492  && $this->getCreationMode() != true) {
493  $this->tpl->printToStdout();
494  }
495  }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
Class ilObjectMetaDataGUI.
Export User Interface Class.
GUI class for the workflow of copying objects.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
Class ilUnitConfigurationRepository.
Question page GUI class.
prepareOutput($a_show_subobjects=true)
prepare output
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
global $DIC
Definition: goto.php:24
static getSyntaxStylePath()
get syntax style path
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilDB
$ret
Definition: parser.php:6
initQuestion($questionId, $parentObjId)
getCreationMode()
get creation mode
Class ilLocalUnitConfigurationGUI.
infoScreenForward()
show information screen
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ 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 510 of file class.ilObjQuestionPoolGUI.php.

References $DIC.

511  {
512  global $DIC; /* @var ILIAS\DI\Container $DIC */
513  $DIC->ctrl()->redirectByClass('ilQuestionPoolExportGUI');
514  }
global $DIC
Definition: goto.php:24

◆ exportQuestionObject()

ilObjQuestionPoolGUI::exportQuestionObject ( )

export question

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

References $_POST, $filename, ilUtil\deliverFile(), exit, and ilUtil\sendInfo().

1050  {
1051  // export button was pressed
1052  if (array_key_exists('q_id', $_POST) && is_array($_POST['q_id']) && count($_POST['q_id']) > 0) {
1053  include_once("./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
1054  $qpl_exp = new ilQuestionpoolExport($this->object, "xml", $_POST["q_id"]);
1055  $export_file = $qpl_exp->buildExportFile();
1056  $filename = $export_file;
1057  $filename = preg_replace("/.*\//", "", $filename);
1058  include_once "./Services/Utilities/classes/class.ilUtil.php";
1059  ilUtil::deliverFile($export_file, $filename);
1060  exit();
1061  } else {
1062  ilUtil::sendInfo($this->lng->txt("qpl_export_select_none"), true);
1063  }
1064  $this->ctrl->redirect($this, "questions");
1065  }
exit
Definition: login.php:29
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Export class for questionpools.
$filename
Definition: buildRTE.php:89
$_POST["username"]
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ fetchAuthoringQuestionIdParamater()

ilObjQuestionPoolGUI::fetchAuthoringQuestionIdParamater ( )
protected
Returns
mixed

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

References $_GET.

Referenced by executeCommand().

1245  {
1246  $qId = (int) $_GET['q_id'];
1247 
1248  if ($this->object->checkQuestionParent($qId)) {
1249  return $qId;
1250  }
1251 
1252  throw new ilTestQuestionPoolException('question id does not relate to parent object!');
1253  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ filterObject()

ilObjQuestionPoolGUI::filterObject ( )

set question list filter

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

References questionsObject().

543  {
544  $this->questionsObject();
545  }
questionsObject()
list questions of question pool
+ Here is the call graph for this function:

◆ filterQuestionBrowserObject()

ilObjQuestionPoolGUI::filterQuestionBrowserObject ( )

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

References ilObjTaxonomy\getUsageOfObject(), isCommentingEnabled(), and questionsObject().

1068  {
1069  $enableComments = $this->isCommentingEnabled();
1070 
1071  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1072  $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1073 
1074  include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
1075  $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', false, false, $taxIds, $enableComments);
1076  $table_gui->resetOffset();
1077  $table_gui->writeFilterToSession();
1078  $this->questionsObject();
1079  }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
questionsObject()
list questions of question pool
+ Here is the call graph for this function:

◆ fullscreenObject()

ilObjQuestionPoolGUI::fullscreenObject ( )

show fullscreen view

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

References $_GET.

532  {
533  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
534  $page_gui = new ilAssQuestionPageGUI($_GET["pg_id"]);
535  $page_gui->showMediaFullscreen();
536  }
$_GET["client_id"]
Question page GUI class.

◆ getImportQuestionsForm()

ilObjQuestionPoolGUI::getImportQuestionsForm ( )
protected
Returns
ilPropertyFormGUI

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

References ilFormPropertyGUI\setRequired().

Referenced by importQuestionsObject(), and uploadObject().

899  {
900  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
901  $form = new ilPropertyFormGUI();
902  $form->setTitle($this->lng->txt('import_question'));
903  $form->setFormAction($this->ctrl->getFormAction($this, 'upload'));
904 
905  $file = new ilFileInputGUI($this->lng->txt('select_file'), 'xmldoc');
906  $file->setRequired(true);
907  $form->addItem($file);
908 
909  $form->addCommandButton('upload', $this->lng->txt('upload'));
910  $form->addCommandButton('questions', $this->lng->txt('cancel'));
911 
912  return $form;
913  }
This class represents a property form user interface.
This class represents a file property in a property form.
setRequired($a_required)
Set Required.
+ 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 1597 of file class.ilObjQuestionPoolGUI.php.

References $_POST, $DIC, addSettingsSubTabs(), ilAssQuestionSkillAssignmentsGUI\CMD_SHOW_SKILL_QUEST_ASSIGNS, and isSkillsTabRequired().

1598  {
1599  global $DIC;
1600  $ilHelp = $DIC['ilHelp'];
1601 
1602  $currentUserHasWriteAccess = $this->access->checkAccess("write", "", $this->object->getRefId());
1603  $currentUserHasReadAccess = $this->access->checkAccess("read", "", $this->object->getRefId());
1604 
1605  $ilHelp->setScreenIdComponent("qpl");
1606 
1607  $next_class = strtolower($this->ctrl->getNextClass());
1608  switch ($next_class) {
1609  case "":
1610  case "ilpermissiongui":
1611  case "ilobjectmetadatagui":
1612  case "ilquestionpoolexportgui":
1613  case "ilquestionpoolskilladministrationgui":
1614  break;
1615 
1616  case 'ilobjtaxonomygui':
1617  case 'ilobjquestionpoolsettingsgeneralgui':
1618 
1619  if ($currentUserHasWriteAccess) {
1620  $this->addSettingsSubTabs($this->tabs_gui);
1621  }
1622 
1623  break;
1624 
1625  default:
1626  return;
1627  break;
1628  }
1629  // questions
1630  $force_active = false;
1631  $commands = $_POST["cmd"];
1632  if (is_array($commands)) {
1633  foreach ($commands as $key => $value) {
1634  if (preg_match("/^delete_.*/", $key, $matches) ||
1635  preg_match("/^addSelectGap_.*/", $key, $matches) ||
1636  preg_match("/^addTextGap_.*/", $key, $matches) ||
1637  preg_match("/^deleteImage_.*/", $key, $matches) ||
1638  preg_match("/^upload_.*/", $key, $matches) ||
1639  preg_match("/^addSuggestedSolution_.*/", $key, $matches)
1640  ) {
1641  $force_active = true;
1642  }
1643  }
1644  }
1645  if (array_key_exists("imagemap_x", $_POST)) {
1646  $force_active = true;
1647  }
1648  if (!$force_active) {
1649  $force_active = ((strtolower($this->ctrl->getCmdClass()) == strtolower(get_class($this)) || strlen($this->ctrl->getCmdClass()) == 0) &&
1650  $this->ctrl->getCmd() == "")
1651  ? true
1652  : false;
1653  }
1654 
1655  if ($currentUserHasReadAccess) {
1656  $this->tabs_gui->addTarget(
1657  "assQuestions",
1658  $this->ctrl->getLinkTarget($this, "questions"),
1659  array("questions", "filter", "resetFilter", "createQuestion",
1660  "importQuestions", "deleteQuestions", "filterQuestionBrowser",
1661  "view", "preview", "editQuestion", "exec_pg",
1662  "addItem", "upload", "save", "cancel", "addSuggestedSolution",
1663  "cancelExplorer", "linkChilds", "removeSuggestedSolution",
1664  "add", "addYesNo", "addTrueFalse", "createGaps", "saveEdit",
1665  "setMediaMode", "uploadingImage", "uploadingImagemap", "addArea",
1666  "deletearea", "saveShape", "back", "addPair", "uploadingJavaapplet",
1667  "addParameter", "assessment", "addGIT", "addST", "addPG", "delete",
1668  "toggleGraphicalAnswers", "deleteAnswer", "deleteImage", "removeJavaapplet"),
1669  "",
1670  "",
1671  $force_active
1672  );
1673  }
1674  if ($currentUserHasReadAccess || $this->access->checkAccess("visible", "", $this->ref_id)) {
1675  $this->tabs_gui->addTarget(
1676  "info_short",
1677  $this->ctrl->getLinkTarget($this, "infoScreen"),
1678  array("infoScreen", "showSummary")
1679  );
1680  }
1681 
1682  if ($currentUserHasWriteAccess) {
1683  // properties
1684  $this->tabs_gui->addTarget(
1685  'settings',
1686  $this->ctrl->getLinkTargetByClass('ilObjQuestionPoolSettingsGeneralGUI'),
1687  array(),
1688  array('ilObjQuestionPoolSettingsGeneralGUI', 'ilObjTaxonomyGUI')
1689  );
1690 
1691  // skill service
1692  if ($this->isSkillsTabRequired()) {
1693  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentsGUI.php';
1694 
1695  $link = $this->ctrl->getLinkTargetByClass(
1696  array('ilQuestionPoolSkillAdministrationGUI', 'ilAssQuestionSkillAssignmentsGUI'),
1698  );
1699 
1700  $this->tabs_gui->addTarget('qpl_tab_competences', $link, array(), array());
1701  }
1702  }
1703 
1704  if ($currentUserHasReadAccess) {
1705  // print view
1706  $this->tabs_gui->addTarget(
1707  "print_view",
1708  $this->ctrl->getLinkTarget($this, 'print'),
1709  array("print"),
1710  "",
1711  ""
1712  );
1713  }
1714 
1715  if ($currentUserHasWriteAccess) {
1716  // meta data
1717 
1718  $mdgui = new ilObjectMetaDataGUI($this->object);
1719  $mdtab = $mdgui->getTab();
1720  if ($mdtab) {
1721  $this->tabs_gui->addTarget(
1722  "meta_data",
1723  $mdtab,
1724  "",
1725  "ilmdeditorgui"
1726  );
1727  }
1728  }
1729 
1730  if ($currentUserHasWriteAccess) {
1731  $this->tabs_gui->addTarget(
1732  "export",
1733  $this->ctrl->getLinkTargetByClass("ilquestionpoolexportgui", ""),
1734  "",
1735  "ilquestionpoolexportgui"
1736  );
1737  }
1738 
1739  if ($this->access->checkAccess("edit_permission", "", $this->object->getRefId())) {
1740  $this->tabs_gui->addTarget(
1741  "perm_settings",
1742  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1743  array("perm","info","owner"),
1744  'ilpermissiongui'
1745  );
1746  }
1747  }
Class ilObjectMetaDataGUI.
global $DIC
Definition: goto.php:24
$_POST["username"]
+ Here is the call graph for this function:

◆ importFileObject()

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

form for new questionpool object import

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

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

1493  {
1494  if ($_REQUEST['new_type'] === null) {
1495  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_file_not_valid'), true);
1496  $this->ctrl->redirect($this, 'create');
1497  return;
1498  }
1499  if (!$this->checkPermissionBool("create", "", $_REQUEST["new_type"])) {
1500  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_create_permission"), true);
1501  $this->ctrl->redirect($this, 'create');
1502  return;
1503  }
1504 
1505  $form = $this->initImportForm($_REQUEST["new_type"]);
1506  if ($form->checkInput()) {
1507  $this->uploadQplObject();
1508  }
1509 
1510  // display form to correct errors
1511  $this->tpl->setContent($form->getHTML());
1512  }
uploadQplObject($questions_only=false)
imports question(s) into the questionpool
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
+ 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 886 of file class.ilObjQuestionPoolGUI.php.

References getImportQuestionsForm().

Referenced by uploadObject().

887  {
888  if (!$form instanceof ilPropertyFormGUI) {
889  $form = $this->getImportQuestionsForm();
890  }
891 
892  $this->tpl->setContent($form->getHtml());
893  }
This class represents a property form user interface.
+ 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 783 of file class.ilObjQuestionPoolGUI.php.

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

784  {
785  $title = '';
786  $description = null;
787  if ($_POST['questions_only'] == 1) {
788  $newObj = $this->object;
789  $title = $this->object->getTitle();
790  $description = $this->object->getDescription();
791  } else {
792  include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
793  $newObj = new ilObjQuestionPool(0, true);
794  $newObj->setType($_GET["new_type"]);
795  $newObj->setTitle("dummy");
796  $newObj->setDescription("questionpool import");
797  $newObj->create(true);
798  $newObj->createReference();
799  $newObj->putInTree($_GET["ref_id"]);
800  $newObj->setPermissions($_GET["ref_id"]);
801 
802  $title = $_POST['qpl_new'] ?? '';
803  }
804 
805  if (is_file($_SESSION["qpl_import_dir"] . '/' . $_SESSION["qpl_import_subdir"] . "/manifest.xml")) {
806  $_SESSION["qpl_import_idents"] = $_POST["ident"];
807 
808  $fileName = $_SESSION["qpl_import_subdir"] . '.zip';
809  $fullPath = $_SESSION["qpl_import_dir"] . '/' . $fileName;
810 
811  include_once("./Services/Export/classes/class.ilImport.php");
812  $imp = new ilImport((int) $_GET["ref_id"]);
813  $map = $imp->getMapping();
814  $map->addMapping("Modules/TestQuestionPool", "qpl", "new_id", $newObj->getId());
815  $imp->importObject($newObj, $fullPath, $fileName, "qpl", "Modules/TestQuestionPool", true);
816  } else {
817  // start parsing of QTI files
818  include_once "./Services/QTI/classes/class.ilQTIParser.php";
819  $qtiParser = new ilQTIParser($_SESSION["qpl_import_qti_file"], IL_MO_PARSE_QTI, $newObj->getId(), $_POST["ident"]);
820  $result = $qtiParser->startParsing();
821  // import page data
822  if (strlen($_SESSION["qpl_import_xml_file"])) {
823  $contParser = new ilQuestionPageParser($newObj, $_SESSION["qpl_import_xml_file"], $_SESSION["qpl_import_subdir"]);
824  $contParser->setQuestionMapping($qtiParser->getImportMapping());
825  $contParser->startParsing();
826  // #20494
827  $newObj->fromXML($_SESSION["qpl_import_xml_file"]);
828  }
829 
830  // set another question pool name (if possible)
831  if ($title !== '') {
832  $newObj->setTitle($title);
833  }
834 
835  if ($description !== null) {
836  $newObj->setDescription($description);
837  }
838 
839  $newObj->update();
840  $newObj->saveToDb();
841  }
842 
843  // delete import directory
844  include_once "./Services/Utilities/classes/class.ilUtil.php";
846 
847  if ($_POST["questions_only"] == 1) {
848  $this->ctrl->redirect($this, "questions");
849  } else {
850  ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
851  ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
852  "&baseClass=ilObjQuestionPoolGUI");
853  }
854  }
$_SESSION["AccountId"]
$result
$_GET["client_id"]
Import class.
const IL_MO_PARSE_QTI
Legacy Content Object Parser.
static _getImportDirectory()
get import directory of lm
static redirect($a_script)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
$_POST["username"]
+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjQuestionPoolGUI::infoScreenForward ( )

show information screen

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

References ilObjectGUI\$ctrl, $DIC, ilObjectGUI\$ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ROOT_FOLDER_ID.

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

1799  {
1800  if (!$this->access->checkAccess("visible", "", $this->ref_id)) {
1801  $this->error->raiseError($this->lng->txt("msg_no_perm_read"));
1802  }
1803 
1804  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1805  $info = new ilInfoScreenGUI($this);
1806  $info->enablePrivateNotes();
1807 
1808  // standard meta data
1809  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1810 
1811  $this->ctrl->forwardCommand($info);
1812  }
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 1788 of file class.ilObjQuestionPoolGUI.php.

References infoScreenForward().

1789  {
1790  $this->ctrl->setCmd("showSummary");
1791  $this->ctrl->setCmdClass("ilinfoscreengui");
1792  $this->infoScreenForward();
1793  }
infoScreenForward()
show information screen
+ Here is the call graph for this function:

◆ initImportForm()

ilObjQuestionPoolGUI::initImportForm (   $a_new_type)
protected

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

References ilFileInputGUI\setSuffixes().

Referenced by importFileObject().

1470  {
1471  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1472  $form = new ilPropertyFormGUI();
1473  $form->setTarget("_top");
1474  $form->setFormAction($this->ctrl->getFormAction($this));
1475  $form->setTitle($this->lng->txt("import_qpl"));
1476 
1477  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
1478  $fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc");
1479  $fi->setSuffixes(array("zip"));
1480  $fi->setRequired(true);
1481  $form->addItem($fi);
1482 
1483  $form->addCommandButton("importFile", $this->lng->txt("import"));
1484  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
1485 
1486  return $form;
1487  }
This class represents a property form user interface.
This class represents a file property in a property form.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCommentingEnabled()

ilObjQuestionPoolGUI::isCommentingEnabled ( )
protected

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

References checkWriteAccess().

Referenced by buildQuestionBrowserTableGUI(), filterQuestionBrowserObject(), and resetQuestionBrowserObject().

1081  : bool
1082  {
1083  return $this->checkWriteAccess();
1084  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSkillsTabRequired()

ilObjQuestionPoolGUI::isSkillsTabRequired ( )
private

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

References ilObjQuestionPool\isSkillManagementGloballyActivated().

Referenced by getTabs().

1750  {
1751  if (!($this->object instanceof ilObjQuestionPool)) {
1752  return false;
1753  }
1754 
1755  if (!$this->object->isSkillServiceEnabled()) {
1756  return false;
1757  }
1758 
1760  return false;
1761  }
1762 
1763  return true;
1764  }
+ 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 1421 of file class.ilObjQuestionPoolGUI.php.

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

1422  {
1423  if (isset($_POST["q_id"]) && is_array($_POST["q_id"]) && count($_POST["q_id"]) > 0) {
1424  foreach ($_POST["q_id"] as $key => $value) {
1425  $this->object->moveToClipboard($value);
1426  }
1427  ilUtil::sendInfo($this->lng->txt("qpl_move_insert_clipboard"), true);
1428  } elseif (isset($_GET['q_id']) && $_GET['q_id'] > 0) {
1429  $this->object->moveToClipboard((int) $_GET['q_id']);
1430  ilUtil::sendInfo($this->lng->txt("qpl_copy_insert_clipboard"), true);
1431  } else {
1432  ilUtil::sendInfo($this->lng->txt("qpl_move_select_none"), true);
1433  }
1434  $this->ctrl->redirect($this, "questions");
1435  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ pasteObject()

ilObjQuestionPoolGUI::pasteObject ( )

paste questios from the clipboard into the question pool

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

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

1386  {
1387  if (array_key_exists("qpl_clipboard", $_SESSION)) {
1388  if ($this->object->pasteFromClipboard()) {
1389  ilUtil::sendSuccess($this->lng->txt("qpl_paste_success"), true);
1390  } else {
1391  ilUtil::sendFailure($this->lng->txt("qpl_paste_error"), true);
1392  }
1393  } else {
1394  ilUtil::sendInfo($this->lng->txt("qpl_paste_no_objects"), true);
1395  }
1396  $this->ctrl->redirect($this, "questions");
1397  }
$_SESSION["AccountId"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ questionObject()

ilObjQuestionPoolGUI::questionObject ( )

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

References $_GET, and $type.

984  {
985  //echo "<br>ilObjQuestionPoolGUI->questionObject()";
986  $type = $_GET["sel_question_types"];
987  $this->editQuestionForm($type);
988  }
$type
$_GET["client_id"]

◆ questionsObject()

ilObjQuestionPoolGUI::questionsObject ( )

list questions of question pool

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

References $_GET, $_SESSION, $DIC, $ilDB, $ilUser, ilObjectGUI\$lng, ilObjectGUI\$rbacsystem, ilObjectGUI\$ref_id, ilObjectGUI\$toolbar, ilLink\_getLink(), buildQuestionBrowserTableGUI(), ilLinkButton\getInstance(), ilObjectFactory\getInstanceByRefId(), ilObjTaxonomy\getUsageOfObject(), infoScreenForward(), ilUtil\redirect(), and ilUtil\sendFailure().

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

1123  {
1124  global $DIC;
1125  $rbacsystem = $DIC['rbacsystem'];
1126  $ilAccess = $DIC['ilAccess'];
1127  $ilUser = $DIC['ilUser'];
1128  $ilCtrl = $DIC['ilCtrl'];
1129  $ilDB = $DIC['ilDB'];
1130  $lng = $DIC['lng'];
1131  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1132 
1133  if (!$ilAccess->checkAccess("read", "", $_GET['ref_id'])) {
1134  $this->infoScreenForward();
1135  return;
1136  }
1137 
1138  if (get_class($this->object) == "ilObjTest") {
1139  if ($_GET["calling_test"] > 0) {
1140  $ref_id = $_GET["calling_test"];
1141  $q_id = $_GET["q_id"];
1142 
1143  if ($_REQUEST['test_express_mode']) {
1144  if ($q_id) {
1145  ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&q_id=" . $q_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
1146  } else {
1147  ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI");
1148  }
1149  } else {
1150  ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=" . $ref_id . "&cmd=questions");
1151  }
1152  }
1153  } elseif (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) {
1154  $ref_id = (int) $_GET['calling_consumer'];
1156  if ($consumer instanceof ilQuestionEditingFormConsumer) {
1157  ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET['consumer_context']));
1158  }
1159  require_once 'Services/Link/classes/class.ilLink.php';
1161  }
1162 
1163  $this->object->purgeQuestions();
1164  // reset test_id SESSION variable
1165  $_SESSION["test_id"] = "";
1166 
1167  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
1168  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
1169  if ($qsaImportFails->failedImportsRegistered()) {
1170  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
1171  $button = ilLinkButton::getInstance();
1172  $button->setUrl($this->ctrl->getLinkTarget($this, 'renoveImportFails'));
1173  $button->setCaption('ass_skl_import_fails_remove_btn');
1174 
1175  ilUtil::sendFailure($qsaImportFails->getFailedImportsMessage($this->lng) . '<br />' . $button->render());
1176  }
1177 
1178  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1179  $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1180 
1181  $table_gui = $this->buildQuestionBrowserTableGUI($taxIds);
1182  $table_gui->setPreventDoubleSubmission(false);
1183 
1184  if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) {
1185  $toolbar = new ilToolbarGUI();
1186 
1187  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
1188  $btn = ilLinkButton::getInstance();
1189  $btn->setCaption('ass_create_question');
1190  $btn->setUrl($this->ctrl->getLinkTarget($this, 'createQuestionForm'));
1191  $btn->setPrimary(true);
1192  $toolbar->addButtonInstance($btn);
1193 
1194 
1195  $btnImport = ilLinkButton::getInstance();
1196  $btnImport->setCaption('import');
1197  $btnImport->setUrl($this->ctrl->getLinkTarget($this, 'importQuestions'));
1198  $toolbar->addButtonInstance($btnImport);
1199 
1200  if (array_key_exists("qpl_clipboard", $_SESSION) && count($_SESSION['qpl_clipboard'])) {
1201  $btnPaste = ilLinkButton::getInstance();
1202  $btnPaste->setCaption('paste');
1203  $btnPaste->setUrl($this->ctrl->getLinkTarget($this, 'paste'));
1204  $toolbar->addButtonInstance($btnPaste);
1205  }
1206 
1207  $this->tpl->setContent(
1208  $this->ctrl->getHTML($toolbar) . $this->ctrl->getHTML($table_gui)
1209  );
1210  } else {
1211  $this->tpl->setContent($this->ctrl->getHTML($table_gui));
1212  }
1213 
1214  if ($this->object->getShowTaxonomies()) {
1215  $this->lng->loadLanguageModule('tax');
1216 
1217  require_once 'Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php';
1218 
1219  foreach ($taxIds as $taxId) {
1220  if ($taxId != $this->object->getNavTaxonomyId()) {
1221  continue;
1222  }
1223 
1224  $taxExp = new ilTaxonomyExplorerGUI(
1225  $this,
1226  'showNavTaxonomy',
1227  $taxId,
1228  'ilobjquestionpoolgui',
1229  'questions'
1230  );
1231 
1232  if (!$taxExp->handleCommand()) {
1233  $this->tpl->setLeftContent($taxExp->getHTML() . "&nbsp;");
1234  }
1235 
1236  break;
1237  }
1238  }
1239  }
$_SESSION["AccountId"]
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
$_GET["client_id"]
Taxonomy explorer GUI class.
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilDB
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
infoScreenForward()
show information screen
$ilUser
Definition: imgupload.php:18
static redirect($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectAfterMissingWrite()

ilObjQuestionPoolGUI::redirectAfterMissingWrite ( )
protected

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

References ilUtil\sendFailure().

Referenced by executeCommand().

499  {
500  ilUtil::sendFailure($this->lng->txt("no_permission"), true);
501  $target_class = get_class($this->object) . "GUI";
502  $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id);
503  $this->ctrl->redirectByClass($target_class);
504  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renoveImportFailsObject()

ilObjQuestionPoolGUI::renoveImportFailsObject ( )
protected

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

References ilAssQuestionSkillAssignmentImportFails\deleteRegisteredImportFails().

1111  {
1112  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
1113  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->object->getId());
1114  $qsaImportFails->deleteRegisteredImportFails();
1115 
1116  $this->ctrl->redirect($this, 'infoScreen');
1117  }
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjQuestionPoolGUI::resetFilterObject ( )

resets filter

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

References $_POST, and questionsObject().

551  {
552  $_POST["filter_text"] = "";
553  $_POST["sel_filter_type"] = "";
554  $this->questionsObject();
555  }
questionsObject()
list questions of question pool
$_POST["username"]
+ Here is the call graph for this function:

◆ resetQuestionBrowserObject()

ilObjQuestionPoolGUI::resetQuestionBrowserObject ( )

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

References ilObjTaxonomy\getUsageOfObject(), isCommentingEnabled(), and questionsObject().

1092  {
1093  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1094  $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1095 
1096  include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
1097  $table_gui = new ilQuestionBrowserTableGUI(
1098  $this,
1099  'questions',
1100  false,
1101  false,
1102  $taxIds,
1103  $this->isCommentingEnabled()
1104  );
1105  $table_gui->resetOffset();
1106  $table_gui->resetFilter();
1107  $this->questionsObject();
1108  }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
questionsObject()
list questions of question pool
+ Here is the call graph for this function:

◆ setTitleAndDescription()

ilObjQuestionPoolGUI::setTitleAndDescription ( )

called by prepare output

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

References $_GET, ilObject2\_getIcon(), assQuestionGUI\_getQuestionGUI(), and assQuestion\_getQuestionTypeName().

1549  {
1550  parent::setTitleAndDescription();
1551  if ($_GET["q_id"] > 0) {
1552  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
1553  $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
1554  if ($q_gui->object instanceof assQuestion) {
1555  $q_gui->object->setObjId($this->object->getId());
1556  $title = $q_gui->object->getTitle();
1557  if (!$title) {
1558  $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
1559  }
1560  $this->tpl->setTitle(
1561  strip_tags(
1562  $title,
1563  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1564  )
1565  );
1566  $this->tpl->setDescription(
1567  $q_gui->object->getDescriptionForHTMLOutput()
1568  );
1569  $this->tpl->setTitleIcon(ilObject2::_getIcon("", "big", $this->object->getType()));
1570  } else {
1571  // Workaround for context issues: If no object was found, redirect without q_id parameter
1572  $this->ctrl->setParameter($this, 'q_id', '');
1573  $this->ctrl->redirect($this);
1574  }
1575  } else {
1576  $this->tpl->setTitle(
1577  strip_tags(
1578  $this->object->getTitle(),
1579  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1580  )
1581  );
1582  $this->tpl->setDescription(
1583  strip_tags(
1584  $this->object->getLongDescription(),
1585  self::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
1586  )
1587  );
1588  $this->tpl->setTitleIcon(ilObject2::_getIcon("", "big", $this->object->getType()));
1589  }
1590  }
$_GET["client_id"]
Abstract basic class which is to be extended by the concrete assessment question type classes...
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
+ Here is the call graph for this function:

◆ updateObject()

ilObjQuestionPoolGUI::updateObject ( )

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

1376  {
1377  // $this->update = $this->object->updateMetaData();
1378  $this->update = $this->object->update();
1379  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1380  }

◆ uploadObject()

ilObjQuestionPoolGUI::uploadObject ( )

imports question(s) into the questionpool

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

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

869  {
870  $upload_valid = true;
871  $form = $this->getImportQuestionsForm();
872  if ($form->checkInput()) {
873  if (!$this->uploadQplObject(true)) {
874  $form->setValuesByPost();
875  $this->importQuestionsObject($form);
876  }
877  } else {
878  $form->setValuesByPost();
879  $this->importQuestionsObject($form);
880  }
881  }
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 571 of file class.ilObjQuestionPoolGUI.php.

References $_SESSION, $DIC, $result, $rows, $type, $xml, ilObjQuestionPool\_createImportDirectory(), ilObjQuestionPool\_getImportDirectory(), ilObjQuestionPool\_setImportDirectory(), ilObjTest\_setImportDirectory(), CLOZE_TEST_IDENTIFIER, ilUtil\delDir(), ilPlugin\getPluginObject(), IL_COMP_MODULE, IL_MO_VERIFY_QTI, IMAGEMAP_QUESTION_IDENTIFIER, JAVAAPPLET_QUESTION_IDENTIFIER, KPRIM_CHOICE_QUESTION_IDENTIFIER, LONG_MENU_QUESTION_IDENTIFIER, MATCHING_QUESTION_IDENTIFIER, ilUtil\moveUploadedFile(), MULTIPLE_CHOICE_QUESTION_IDENTIFIER, NUMERIC_QUESTION_IDENTIFIER, ORDERING_QUESTION_IDENTIFIER, ilUtil\sendFailure(), SINGLE_CHOICE_QUESTION_IDENTIFIER, TEXT_QUESTION_IDENTIFIER, TEXTSUBSET_QUESTION_IDENTIFIER, and ilUtil\unzip().

Referenced by importFileObject(), and uploadObject().

572  {
573  $this->ctrl->setParameter($this, 'new_type', $_REQUEST['new_type']);
574  if ($_FILES["xmldoc"]["error"] > UPLOAD_ERR_OK) {
575  ilUtil::sendFailure($this->lng->txt("error_upload"), true);
576  if (!$questions_only) {
577  $this->ctrl->redirect($this, 'create');
578  }
579  return false;
580  }
581  // create import directory
582  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
584 
585  global $DIC; /* @var ILIAS\DI\Container $DIC */
586  // copy uploaded file to import directory
587  $file = pathinfo($_FILES["xmldoc"]["name"]);
588 
589  $full_path = $basedir . "/" . $_FILES["xmldoc"]["name"];
590 
591  if (strpos($file['filename'], 'qpl') === false
592  && strpos($file['filename'], 'qti') === false) {
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 
599 
600  $DIC['ilLog']->write(__METHOD__ . ": full path " . $full_path);
601 
602  ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
603 
604  if (strcmp($_FILES["xmldoc"]["type"], "text/xml") == 0) {
605  $qti_file = $full_path;
607  } else {
608  // unzip file
609  ilUtil::unzip($full_path);
610 
611  // determine filenames of xml files
612  $subdir = basename($file["basename"], "." . $file["extension"]);
614  $xml_file = ilObjQuestionPool::_getImportDirectory() . '/' . $subdir . '/' . $subdir . ".xml";
615  $qti_file = ilObjQuestionPool::_getImportDirectory() . '/' . $subdir . '/' . str_replace("qpl", "qti", $subdir) . ".xml";
616  }
617 
618  if (!file_exists($qti_file)) {
619  ilUtil::delDir($basedir);
620  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cannot_find_xml'), true);
621  $cmd = $this->ctrl->getCmd() === 'upload' ? 'importQuestions' : 'create';
622  $this->ctrl->redirect($this, $cmd);
623  return false;
624  }
625 
626  $qtiParser = new ilQTIParser($qti_file, IL_MO_VERIFY_QTI, 0, "");
627  $result = $qtiParser->startParsing();
628  $founditems = &$qtiParser->getFoundItems();
629  if (count($founditems) == 0) {
630  // nothing found
631 
632  // delete import directory
633  ilUtil::delDir($basedir);
634 
635  ilUtil::sendFailure($this->lng->txt("qpl_import_no_items"), true);
636  if (!$questions_only) {
637  $this->ctrl->redirect($this, 'create');
638  }
639  return false;
640  }
641 
642  $complete = 0;
643  $incomplete = 0;
644  foreach ($founditems as $item) {
645  if (strlen($item["type"])) {
646  $complete++;
647  } else {
648  $incomplete++;
649  }
650  }
651 
652  if ($complete == 0) {
653  // delete import directory
654  ilUtil::delDir($basedir);
655 
656  ilUtil::sendFailure($this->lng->txt("qpl_import_non_ilias_files"), true);
657  if (!$questions_only) {
658  $this->ctrl->redirect($this, 'create');
659  }
660  return false;
661  }
662 
663  $_SESSION["qpl_import_xml_file"] = $xml_file;
664  $_SESSION["qpl_import_qti_file"] = $qti_file;
665  $_SESSION["qpl_import_subdir"] = $subdir;
666 
667  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.qpl_import_verification.html", "Modules/TestQuestionPool");
668 
669  require_once 'Modules/TestQuestionPool/classes/tables/class.ilQuestionPoolImportVerificationTableGUI.php';
670  $table = new ilQuestionPoolImportVerificationTableGUI($this, 'uploadQplObject');
671  $rows = array();
672 
673  foreach ($founditems as $item) {
674  $row = array(
675  'title' => $item['title'],
676  'ident' => $item['ident'],
677  );
678 
679  include_once "./Services/QTI/classes/class.ilQTIItem.php";
680  switch ($item["type"]) {
682  $type = $this->lng->txt("assClozeTest");
683  break;
685  $type = $this->lng->txt("assImagemapQuestion");
686  break;
688  $type = $this->lng->txt("assJavaApplet");
689  break;
691  $type = $this->lng->txt("assMatchingQuestion");
692  break;
694  $type = $this->lng->txt("assMultipleChoice");
695  break;
697  $type = $this->lng->txt("assKprimChoice");
698  break;
700  $type = $this->lng->txt("assLongMenu");
701  break;
703  $type = $this->lng->txt("assSingleChoice");
704  break;
706  $type = $this->lng->txt("assOrderingQuestion");
707  break;
709  $type = $this->lng->txt("assTextQuestion");
710  break;
712  $type = $this->lng->txt("assNumeric");
713  break;
715  $type = $this->lng->txt("assTextSubset");
716  break;
717  default:
718  $type = $this->lng->txt($item["type"]);
719  break;
720  }
721 
722  if (strcmp($type, "-" . $item["type"] . "-") == 0) {
723  global $DIC;
724  $ilPluginAdmin = $DIC['ilPluginAdmin'];
725  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
726  foreach ($pl_names as $pl_name) {
727  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
728  if (strcmp($pl->getQuestionType(), $item["type"]) == 0) {
729  $type = $pl->getQuestionTypeTranslation();
730  }
731  }
732  }
733 
734  $row['type'] = $type;
735 
736  $rows[] = $row;
737  }
738  $table->setData($rows);
739 
740  if (is_file($xml_file)
741  && !$questions_only) {
742  $this->tpl->setCurrentBlock("import_qpl");
743  // read file into a string
744  $fh = @fopen($xml_file, "r");
745  $xml = @fread($fh, filesize($xml_file));
746  @fclose($fh);
747  if (preg_match("/<ContentObject.*?MetaData.*?General.*?Title[^>]*?>([^<]*?)</", $xml, $matches)) {
748  $this->tpl->setVariable("VALUE_NEW_QUESTIONPOOL", $matches[1]);
749  }
750 
751  $this->tpl->setVariable("TEXT_CREATE_NEW_QUESTIONPOOL", $this->lng->txt("qpl_import_create_new_qpl"));
752  $this->tpl->parseCurrentBlock();
753  }
754 
755  $this->tpl->setCurrentBlock("adm_content");
756  $this->tpl->setVariable("FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt("qpl_import_verify_found_questions"));
757  if ($questions_only) {
758  $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_questions_into_qpl"));
759  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
760  } else {
761  $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_qpl"));
762 
763  $this->ctrl->setParameter($this, "new_type", $this->type);
764  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
765  }
766 
767  $value_questions_only = 0;
768  if ($questions_only) {
769  $value_questions_only = 1;
770  }
771  $this->tpl->setVariable("VALUE_QUESTIONS_ONLY", $value_questions_only);
772  $this->tpl->setVariable("VERIFICATION_TABLE", $table->getHtml());
773  $this->tpl->setVariable("VERIFICATION_FORM_NAME", $table->getFormName());
774 
775  $this->tpl->parseCurrentBlock();
776 
777  return true;
778  }
const MATCHING_QUESTION_IDENTIFIER
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
$_SESSION["AccountId"]
$result
$type
const KPRIM_CHOICE_QUESTION_IDENTIFIER
const LONG_MENU_QUESTION_IDENTIFIER
const TEXTSUBSET_QUESTION_IDENTIFIER
const JAVAAPPLET_QUESTION_IDENTIFIER
const NUMERIC_QUESTION_IDENTIFIER
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
const ORDERING_QUESTION_IDENTIFIER
global $DIC
Definition: goto.php:24
static _setImportDirectory($a_import_dir=null)
set import directory
const IL_COMP_MODULE
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
$xml
Definition: metadata.php:332
const TEXT_QUESTION_IDENTIFIER
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$rows
Definition: xhr_table.php:10
static _getImportDirectory()
get import directory of lm
const IL_MO_VERIFY_QTI
static _createImportDirectory()
creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directo...
const SINGLE_CHOICE_QUESTION_IDENTIFIER
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
static _setImportDirectory($a_import_dir=null)
set import directory
const IMAGEMAP_QUESTION_IDENTIFIER
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $error

ilObjQuestionPoolGUI::$error
private

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

◆ $object

ilObjQuestionPoolGUI::$object

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

Referenced by importVerifiedFileObject().

◆ $refinery

ilObjQuestionPoolGUI::$refinery
protected

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


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