ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjQuestionPool Class Reference
+ Inheritance diagram for ilObjQuestionPool:
+ Collaboration diagram for ilObjQuestionPool:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor public. More...
 
 create ($a_upload=false)
 create questionpool object More...
 
 createReference ()
 Creates a database reference id for the object (saves the object to the database and creates a reference id in the database) More...
 
 update ()
 update object data More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 delete ()
 delete object and all related data More...
 
 deleteQuestionpool ()
 
 deleteQuestion (int $question_id)
 
 loadFromDb ()
 
 saveToDb ()
 
 getQuestiontype ($question_id)
 
 isInUse (int $question_id)
 
 createQuestion (string $question_type, int $question_id=-1)
 
 duplicateQuestion (int $question_id)
 
 copyQuestion (int $question_id, int $questionpool_to)
 
 getPrintviewQuestions ()
 
 objectToXmlWriter (ilXmlWriter &$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
 export pages of test to xml (see ilias_co.dtd) More...
 
 exportXMLMetaData (&$a_xml_writer)
 export content objects meta data to xml (see ilias_co.dtd) More...
 
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 
 exportXMLPageObjects (&$a_xml_writer, $a_inst, &$expLog, $questions)
 export page objects to xml (see ilias_co.dtd) More...
 
 exportXMLMediaObjects (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 
 exportFileItems ($target_dir, &$expLog)
 export files of file itmes More...
 
 createExportDirectory ()
 creates data directory for export files (data_dir/qpl_data/qpl_<id>/export, depending on data directory that is set in ILIAS setup/ini) More...
 
 getExportDirectory ($type='')
 get export directory of questionpool More...
 
 getImportDirectory ()
 
getAllQuestions ()
 Retrieve an array containing all question ids of the questionpool. More...
 
getAllQuestionIds ()
 
 checkQuestionParent (int $question_id)
 
 getImportMapping ()
 get array of (two) new created questions for import id More...
 
 questionsToXML ($questions)
 Returns a QTI xml representation of a list of questions. More...
 
 setShowTaxonomies ($show_taxonomies)
 
 getShowTaxonomies ()
 
 pasteFromClipboard ()
 Copies/Moves a question from the clipboard. More...
 
 copyToClipboard ($question_id)
 Copies a question to the clipboard. More...
 
 moveToClipboard ($question_id)
 Moves a question to the clipboard. More...
 
 cleanupClipboard ($deletedQuestionId)
 
 getQuestionDetails ($question_ids)
 Returns an array containing the qpl_question and qpl_qst_type fields for an array of question ids. More...
 
 getDeleteableQuestionDetails ($question_ids)
 Returns an array containing the qpl_question and qpl_qst_type fields of deleteable questions for an array of question ids. More...
 
 getQplQuestions ()
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 Creates a 1:1 copy of the object and places the copy in a given repository. More...
 
 getQuestionTypes ($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
 
 getQuestionList ()
 
 isPluginActive ($questionType)
 Checks wheather or not a question plugin with a given name is active. More...
 
 purgeQuestions ()
 
 getTaxonomyIds ()
 get ids of all taxonomies corresponding to current pool More...
 
 isSkillServiceEnabled ()
 
 setSkillServiceEnabled (bool $skill_service_enabled)
 
 fromXML ($xmlFile)
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _setImportDirectory ($a_import_dir=null)
 
static _getImportDirectory ()
 get import directory of lm More...
 
static _hasEqualPoints ($a_obj_id, $is_reference=false)
 Checks a question pool for questions with the same maximum points. More...
 
static _isWriteable ($object_id, $user_id)
 Returns true, if the question pool is writeable by a given user. More...
 
static _getAvailableQuestionpools ( $use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission='read', $usr_id='')
 Returns the available question pools for the active user. More...
 
static _getQuestionTypes ($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
 
static getQuestionTypeByTypeId ($type_id)
 
static getQuestionTypeTranslations ()
 
static & _getSelfAssessmentQuestionTypes ($all_tags=false)
 
static _updateQuestionCount (int $object_id)
 
static isSkillManagementGloballyActivated ()
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Protected Member Functions

 populateQuestionSkillAssignmentsXml (ilXmlWriter &$a_xml_writer, $questions)
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Static Protected Member Functions

static _getQuestionCount (int $pool_id)
 

Private Member Functions

 exportXMLSettings ($xmlWriter)
 

Private Attributes

ilComponentRepository $component_repository
 
ilBenchmark $benchmark
 
array $mob_ids
 
array $file_ids
 
bool $show_taxonomies = null
 
bool $skill_service_enabled
 
ILIAS TestQuestionPool QuestionInfoService $questioninfo
 

Static Private Attributes

static $isSkillManagementGloballyActivated = null
 

Additional Inherited Members

- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Detailed Description

Definition at line 30 of file class.ilObjQuestionPool.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjQuestionPool::__construct (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 47 of file class.ilObjQuestionPool.php.

References $DIC, and ILIAS\MetaData\Repository\Validation\Data\__construct().

48  {
49  global $DIC;
50  $this->component_repository = $DIC['component.repository'];
51  $this->benchmark = $DIC['ilBench'];
52  $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
53  $this->type = 'qpl';
54  parent::__construct($a_id, $a_call_by_reference);
55 
56  $this->skill_service_enabled = false;
57  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ _getAvailableQuestionpools()

static ilObjQuestionPool::_getAvailableQuestionpools (   $use_object_id = false,
  $equal_points = false,
  $could_be_offline = false,
  $showPath = false,
  $with_questioncount = false,
  $permission = 'read',
  $usr_id = '' 
)
static

Returns the available question pools for the active user.

Returns
array The available question pools public

Definition at line 962 of file class.ilObjQuestionPool.php.

References $DIC, $ilDB, ilObject\$lng, ilObject\$ref_id, ilObject\$title, ilUtil\_getObjectsByOperations(), _hasEqualPoints(), ilObject\_lookupObjId(), ilObject\_prepareCloneSelection(), and ilLanguage\txt().

Referenced by ilTestExpressPageObjectGUI\addQuestion(), ilObjTestGUI\addQuestionObject(), ilObjTestGUI\createQuestionObject(), ilObjTest\getAvailableQuestionpools(), ilObjTest\getAvailableQuestions(), and ilTestQuestionBrowserTableGUI\getQuestionParentObjIds().

970  : array {
971  global $DIC;
972  $ilUser = $DIC['ilUser'];
973  $ilDB = $DIC['ilDB'];
974  $lng = $DIC['lng'];
975 
976  $result_array = [];
977  $permission = (strlen($permission) == 0) ? 'read' : $permission;
978  $qpls = ilUtil::_getObjectsByOperations('qpl', $permission, (strlen($usr_id)) ? $usr_id : $ilUser->getId(), -1);
979  $obj_ids = [];
980  foreach ($qpls as $ref_id) {
981  $obj_id = ilObject::_lookupObjId($ref_id);
982  $obj_ids[$ref_id] = $obj_id;
983  }
984  $titles = ilObject::_prepareCloneSelection($qpls, 'qpl');
985  if (count($obj_ids)) {
986  $in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
987  if ($could_be_offline) {
988  $result = $ilDB->query(
989  'SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ' .
990  'qpl_questionpool.obj_fi = object_data.obj_id AND ' . $in . ' ORDER BY object_data.title'
991  );
992  } else {
993  $result = $ilDB->queryF(
994  'SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ' .
995  'qpl_questionpool.obj_fi = object_data.obj_id AND ' . $in . ' AND object_data.offline = %s ' .
996  'ORDER BY object_data.title',
997  ['text'],
998  [0]
999  );
1000  }
1001  while ($row = $ilDB->fetchAssoc($result)) {
1002  $add = true;
1003  if ($equal_points) {
1004  if (!ilObjQuestionPool::_hasEqualPoints($row['obj_fi'])) {
1005  $add = false;
1006  }
1007  }
1008  if ($add) {
1009  $ref_id = array_search($row['obj_fi'], $obj_ids);
1010  $title = (($showPath) ? $titles[$ref_id] : $row['title']);
1011  if ($with_questioncount) {
1012  $title .= ' [' . $row['questioncount'] . ' ' . ($row['questioncount'] == 1 ? $lng->txt(
1013  'ass_question'
1014  ) : $lng->txt('assQuestions')) . ']';
1015  }
1016 
1017  if ($use_object_id) {
1018  $result_array[$row['obj_fi']] = [
1019  'qpl_id' => $row['obj_fi'],
1020  'qpl_title' => $row['title'],
1021  'title' => $title,
1022  'count' => $row['questioncount']
1023  ];
1024  } else {
1025  $result_array[$ref_id] = [
1026  'qpl_id' => $row['obj_fi'],
1027  'qpl_title' => $row['title'],
1028  'title' => $title,
1029  'count' => $row['questioncount']
1030  ];
1031  }
1032  }
1033  }
1034  }
1035  return $result_array;
1036  }
string $title
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static _hasEqualPoints($a_obj_id, $is_reference=false)
Checks a question pool for questions with the same maximum points.
static _prepareCloneSelection(array $ref_ids, string $new_type, bool $show_path=true)
Prepare copy wizard object selection.
ilLanguage $lng
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getImportDirectory()

static ilObjQuestionPool::_getImportDirectory ( )
static

get import directory of lm

Definition at line 574 of file class.ilObjQuestionPool.php.

References ilSession\get().

Referenced by assFormulaQuestionImport\fromXML(), getImportDirectory(), assQuestionImport\getQplImportArchivDirectory(), ilObjQuestionPoolGUI\importVerifiedFileObject(), and ilObjQuestionPoolGUI\uploadQplObject().

574  : string
575  {
576  return ilSession::get('qpl_import_dir') ?? '';
577  }
static get(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getQuestionCount()

static ilObjQuestionPool::_getQuestionCount ( int  $pool_id)
staticprotected

Definition at line 675 of file class.ilObjQuestionPool.php.

References $DIC, and $ilDB.

Referenced by _updateQuestionCount().

675  : int
676  {
677  global $DIC;
678  $ilDB = $DIC['ilDB'];
679  $result = $ilDB->queryF(
680  'SELECT COUNT(question_id) question_count FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL AND complete = %s',
681  ['integer', 'text'],
682  [$pool_id, 1]
683  );
684  $row = $ilDB->fetchAssoc($result);
685  return $row['question_count'];
686  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _getQuestionTypes()

static ilObjQuestionPool::_getQuestionTypes (   $all_tags = false,
  $fixOrder = false,
  $withDeprecatedTypes = true 
)
static

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

References $DIC, $ilDB, ilObject\$lng, ilObjAssessmentFolder\_getForbiddenQuestionTypes(), ilLanguage\loadLanguageModule(), ilAssQuestionTypeOrderer\ORDER_MODE_ALPHA, ilAssQuestionTypeOrderer\ORDER_MODE_FIX, and ilLanguage\txt().

Referenced by _getSelfAssessmentQuestionTypes(), ilTestRandomQuestionSetPoolDefinitionFormGUI\build(), ilObjAssessmentFolderGUI\buildSettingsForm(), QuestionTable\getFilter(), ilTestRandomQuestionSetSourcePoolDefinition\getTypeFilterAsTypeTags(), ilQuestionBrowserTableGUI\initFilter(), ilTestQuestionBrowserTableGUI\initFilter(), ilTestQuestionFilterLabelTranslater\loadTypeLabels(), ilObjAssessmentFolderGUI\saveSettingsObject(), and ilTestRandomQuestionSetSourcePoolDefinition\setTypeFilterFromTypeTags().

1097  : array
1098  {
1099  global $DIC;
1100  $ilDB = $DIC['ilDB'];
1101  $lng = $DIC['lng'];
1102  $component_factory = $DIC['component.factory'];
1103 
1105  $lng->loadLanguageModule('assessment');
1106  $result = $ilDB->query('SELECT * FROM qpl_qst_type');
1107  $types = [];
1108  while ($row = $ilDB->fetchAssoc($result)) {
1109  if ($all_tags || (!in_array($row['question_type_id'], $forbidden_types))) {
1110  if ($row['plugin'] == 0) {
1111  $types[$lng->txt($row['type_tag'])] = $row;
1112  } else {
1113  foreach ($component_factory->getActivePluginsInSlot('qst') as $pl) {
1114  if (strcmp($pl->getQuestionType(), $row['type_tag']) == 0) {
1115  $types[$pl->getQuestionTypeTranslation()] = $row;
1116  }
1117  }
1118  }
1119  }
1120  }
1121 
1123  $orderer = new ilAssQuestionTypeOrderer($types, $orderMode);
1124  $types = $orderer->getOrderedTypes($withDeprecatedTypes);
1125 
1126  return $types;
1127  }
const ORDER_MODE_FIX
order mode with fixed priority for ordering
const ORDER_MODE_ALPHA
order mode that orders by alphanumerical priority
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
ilLanguage $lng
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSelfAssessmentQuestionTypes()

static& ilObjQuestionPool::_getSelfAssessmentQuestionTypes (   $all_tags = false)
static
Todo:
Make it more flexible

Definition at line 1174 of file class.ilObjQuestionPool.php.

References _getQuestionTypes().

Referenced by ilCopySelfAssQuestionTableGUI\getQuestions(), and ilPCQuestionGUI\insert().

1174  : array
1175  {
1176  $allowed_types = [
1177  'assSingleChoice' => 1,
1178  'assMultipleChoice' => 2,
1179  'assKprimChoice' => 3,
1180  'assClozeTest' => 4,
1181  'assMatchingQuestion' => 5,
1182  'assOrderingQuestion' => 6,
1183  'assOrderingHorizontal' => 7,
1184  'assImagemapQuestion' => 8,
1185  'assTextSubset' => 9,
1186  'assErrorText' => 10,
1187  'assLongMenu' => 11
1188  ];
1189  $satypes = [];
1190  $qtypes = ilObjQuestionPool::_getQuestionTypes($all_tags);
1191  foreach ($qtypes as $k => $t) {
1192  if (isset($allowed_types[$t['type_tag']])) {
1193  $t['order'] = $allowed_types[$t['type_tag']];
1194  $satypes[$k] = $t;
1195  }
1196  }
1197  return $satypes;
1198  }
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _hasEqualPoints()

static ilObjQuestionPool::_hasEqualPoints (   $a_obj_id,
  $is_reference = false 
)
static

Checks a question pool for questions with the same maximum points.

Parameters
integer$a_obj_idObject id of the question pool private

Definition at line 704 of file class.ilObjQuestionPool.php.

References $DIC, and $ilDB.

Referenced by _getAvailableQuestionpools().

704  : int
705  {
706  global $DIC;
707  $ilDB = $DIC['ilDB'];
708 
709  if ($is_reference) {
710  $result = $ilDB->queryF(
711  'SELECT count(DISTINCT qpl_questions.points) equal_points FROM qpl_questions, object_reference WHERE object_reference.ref_id = %s AND qpl_questions.tstamp > 0 AND object_reference.obj_id = qpl_questions.obj_fi AND qpl_questions.original_id IS NULL',
712  ['integer'],
713  [$a_obj_id]
714  );
715  } else {
716  $result = $ilDB->queryF(
717  'SELECT count(DISTINCT points) equal_points FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND qpl_questions.original_id IS NULL',
718  ['integer'],
719  [$a_obj_id]
720  );
721  }
722  if ($result->numRows() == 1) {
723  $row = $ilDB->fetchAssoc($result);
724  if ($row['equal_points'] == 1) {
725  return 1;
726  } else {
727  return 0;
728  }
729  }
730  return 0;
731  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _isWriteable()

static ilObjQuestionPool::_isWriteable (   $object_id,
  $user_id 
)
static

Returns true, if the question pool is writeable by a given user.

Parameters
integer$object_idThe object id of the question pool object
integer$user_idThe database id of the user public

Definition at line 847 of file class.ilObjQuestionPool.php.

References $DIC, ilObject\$ref_id, ilObject\_getAllReferences(), and ilObject\_hasUntrashedReference().

Referenced by assQuestion\_isWriteable().

847  : bool
848  {
849  global $DIC;
850  $rbacsystem = $DIC['rbacsystem'];
851 
852  $refs = ilObject::_getAllReferences($object_id);
853  if (count($refs)) {
854  foreach ($refs as $ref_id) {
855  if ($rbacsystem->checkAccess('write', $ref_id) && (ilObject::_hasUntrashedReference($object_id))) {
856  return true;
857  }
858  }
859  }
860  return false;
861  }
static _getAllReferences(int $id)
get all reference ids for object ID
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _setImportDirectory()

static ilObjQuestionPool::_setImportDirectory (   $a_import_dir = null)
static

Definition at line 561 of file class.ilObjQuestionPool.php.

References ilSession\clear(), and ilSession\set().

Referenced by ilTestQuestionPoolImporter\importXmlRepresentation(), and ilObjQuestionPoolGUI\uploadQplObject().

561  : void
562  {
563  if ($a_import_dir !== null) {
564  ilSession::set('qpl_import_dir', $a_import_dir);
565  return;
566  }
567 
568  ilSession::clear('qpl_import_dir');
569  }
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _updateQuestionCount()

static ilObjQuestionPool::_updateQuestionCount ( int  $object_id)
static

Definition at line 1214 of file class.ilObjQuestionPool.php.

References $DIC, $ilDB, and _getQuestionCount().

Referenced by assQuestion\delete(), duplicateQuestion(), pasteFromClipboard(), and assQuestion\saveToDb().

1214  : void
1215  {
1216  global $DIC;
1217  $ilDB = $DIC['ilDB'];
1218  $ilDB->manipulateF(
1219  'UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s',
1220  ['integer', 'integer', 'integer'],
1221  [ilObjQuestionPool::_getQuestionCount($object_id), time(), $object_id]
1222  );
1223  }
global $DIC
Definition: feed.php:28
static _getQuestionCount(int $pool_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkQuestionParent()

ilObjQuestionPool::checkQuestionParent ( int  $question_id)

Definition at line 625 of file class.ilObjQuestionPool.php.

625  : bool
626  {
627  $row = $this->db->fetchAssoc(
628  $this->db->queryF(
629  'SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s',
630  ['integer', 'integer'],
631  [$question_id, $this->getId()]
632  )
633  );
634 
635  return (bool) $row['cnt'];
636  }

◆ cleanupClipboard()

ilObjQuestionPool::cleanupClipboard (   $deletedQuestionId)

Definition at line 820 of file class.ilObjQuestionPool.php.

References ilSession\clear(), ilSession\get(), and ilSession\set().

820  : void
821  {
822  if (ilSession::get('qpl_clipboard') == null) {
823  return;
824  }
825 
826  $clip = ilSession::get('qpl_clipboard');
827  if (!isset($clip[$deletedQuestionId])) {
828  return;
829  }
830 
831  unset($clip[$deletedQuestionId]);
832 
833  if (!count($clip)) {
834  ilSession::clear('qpl_clipboard');
835  } else {
836  ilSession::set('qpl_clipboard', $clip);
837  }
838  }
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ cloneObject()

ilObjQuestionPool::cloneObject ( int  $target_id,
int  $copy_id = 0,
bool  $omit_tree = false 
)

Creates a 1:1 copy of the object and places the copy in a given repository.

public

Definition at line 1057 of file class.ilObjQuestionPool.php.

References ilObject\getId(), getQplQuestions(), getShowTaxonomies(), ilObject\getType(), and isSkillServiceEnabled().

1057  : ?ilObject
1058  {
1059  $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
1060 
1061  $new_obj->update();
1062 
1063  $new_obj->setSkillServiceEnabled($this->isSkillServiceEnabled());
1064  $new_obj->setShowTaxonomies($this->getShowTaxonomies());
1065  $new_obj->saveToDb();
1066 
1067  // clone the questions in the question pool
1068  $questions = $this->getQplQuestions();
1069  $questionIdsMap = [];
1070  foreach ($questions as $question_id) {
1071  $newQuestionId = $new_obj->copyQuestion($question_id, $new_obj->getId());
1072  $questionIdsMap[$question_id] = $newQuestionId;
1073  }
1074 
1075  $md = new ilMD($this->getId(), 0, $this->getType());
1076  $md->cloneMD($new_obj->getId(), 0, $new_obj->getType());
1077  $new_obj->updateMetaData();
1078 
1079  $duplicator = new ilQuestionPoolTaxonomiesDuplicator();
1080  $duplicator->setSourceObjId($this->getId());
1081  $duplicator->setSourceObjType($this->getType());
1082  $duplicator->setTargetObjId($new_obj->getId());
1083  $duplicator->setTargetObjType($new_obj->getType());
1084  $duplicator->setQuestionIdMapping($questionIdsMap);
1085  $duplicator->duplicate($duplicator->getAllTaxonomiesForSourceObject());
1086 
1087  $new_obj->saveToDb();
1088 
1089  return $new_obj;
1090  }
+ Here is the call graph for this function:

◆ copyQuestion()

ilObjQuestionPool::copyQuestion ( int  $question_id,
int  $questionpool_to 
)

Definition at line 270 of file class.ilObjQuestionPool.php.

References createQuestion(), duplicateQuestion(), and ilObject\getId().

Referenced by pasteFromClipboard().

270  : int
271  {
272  $question_gui = $this->createQuestion('', $question_id);
273  if ($question_gui->object->getObjId() == $questionpool_to) {
274  // the question is copied into the same question pool
275  return $this->duplicateQuestion($question_id);
276  } else {
277  // the question is copied into another question pool
278  $newtitle = $question_gui->object->getTitle();
279  if ($this->questioninfo->questionTitleExistsInPool($this->getId(), $question_gui->object->getTitle())) {
280  $counter = 2;
281  while ($this->questioninfo->questionTitleExistsInPool(
282  $this->getId(),
283  $question_gui->object->getTitle() . ' (' . $counter . ')'
284  )) {
285  $counter++;
286  }
287  $newtitle = $question_gui->object->getTitle() . ' (' . $counter . ')';
288  }
289  return $question_gui->object->copyObject($this->getId(), $newtitle);
290  }
291  }
createQuestion(string $question_type, int $question_id=-1)
duplicateQuestion(int $question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyToClipboard()

ilObjQuestionPool::copyToClipboard (   $question_id)

Copies a question to the clipboard.

Parameters
integer$question_idObject id of the question private

Definition at line 794 of file class.ilObjQuestionPool.php.

References ilSession\get(), and ilSession\set().

794  : void
795  {
796  if (ilSession::get('qpl_clipboard') == null) {
797  ilSession::set('qpl_clipboard', []);
798  }
799  $clip = ilSession::get('qpl_clipboard');
800  $clip[$question_id] = ['question_id' => $question_id, 'action' => 'copy'];
801  ilSession::set('qpl_clipboard', $clip);
802  }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ create()

ilObjQuestionPool::create (   $a_upload = false)

create questionpool object

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

References $id, and ilObject\createMetaData().

62  : int
63  {
64  $id = parent::create();
65 
66  // meta data will be created by
67  // import parser
68  if (!$a_upload) {
69  $this->createMetaData();
70  }
71  return $id;
72  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjQuestionPool::createExportDirectory ( )

creates data directory for export files (data_dir/qpl_data/qpl_<id>/export, depending on data directory that is set in ILIAS setup/ini)

Definition at line 512 of file class.ilObjQuestionPool.php.

References ilFileUtils\getDataDir(), getExportDirectory(), ilObject\getId(), and ilFileUtils\makeDir().

512  : void
513  {
514  $qpl_data_dir = ilFileUtils::getDataDir() . '/qpl_data';
515  ilFileUtils::makeDir($qpl_data_dir);
516  if (!is_writable($qpl_data_dir)) {
517  $this->error->raiseError(
518  'Questionpool Data Directory (' . $qpl_data_dir
519  . ') not writeable.',
520  $this->error->FATAL
521  );
522  }
523 
524  // create learning module directory (data_dir/lm_data/lm_<id>)
525  $qpl_dir = $qpl_data_dir . '/qpl_' . $this->getId();
526  ilFileUtils::makeDir($qpl_dir);
527  if (!@is_dir($qpl_dir)) {
528  $this->error->raiseError('Creation of Questionpool Directory failed.', $this->error->FATAL);
529  }
530  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
532  if (!@is_dir($this->getExportDirectory('xlsx'))) {
533  $this->error->raiseError('Creation of Export Directory failed.', $this->error->FATAL);
534  }
536  if (!@is_dir($this->getExportDirectory('zip'))) {
537  $this->error->raiseError('Creation of Export Directory failed.', $this->error->FATAL);
538  }
539  }
getExportDirectory($type='')
get export directory of questionpool
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ createQuestion()

ilObjQuestionPool::createQuestion ( string  $question_type,
int  $question_id = -1 
)

Definition at line 241 of file class.ilObjQuestionPool.php.

References assQuestion\instantiateQuestionGUI().

Referenced by copyQuestion(), duplicateQuestion(), getDeleteableQuestionDetails(), and questionsToXML().

242  {
243  if ($question_id > 0) {
244  return assQuestion::instantiateQuestionGUI($question_id);
245  }
246  $question_type_gui = $question_type . 'GUI';
247  $question_gui = new $question_type_gui();
248  return $question_gui;
249  }
static instantiateQuestionGUI(int $a_question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createReference()

ilObjQuestionPool::createReference ( )

Creates a database reference id for the object (saves the object to the database and creates a reference id in the database)

public

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

References saveToDb().

80  : int
81  {
82  $result = parent::createReference();
83  $this->saveToDb();
84  return $result;
85  }
+ Here is the call graph for this function:

◆ delete()

ilObjQuestionPool::delete ( )

delete object and all related data

public

Returns
boolean true if all object data were removed; false if only a references were removed

Definition at line 122 of file class.ilObjQuestionPool.php.

References ilObject\deleteMetaData(), deleteQuestionpool(), and ilObject\getId().

122  : bool
123  {
124  // always call parent delete function first!!
125  if (!parent::delete()) {
126  return false;
127  }
128 
129  // delete meta data
130  $this->deleteMetaData();
131 
132  //put here your module specific stuff
133  $this->deleteQuestionpool();
134 
135  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->getId());
136  $qsaImportFails->deleteRegisteredImportFails();
137 
138  return true;
139  }
+ Here is the call graph for this function:

◆ deleteQuestion()

ilObjQuestionPool::deleteQuestion ( int  $question_id)

Definition at line 158 of file class.ilObjQuestionPool.php.

References assQuestion\instantiateQuestion().

Referenced by deleteQuestionpool().

158  : void
159  {
160  $question = assQuestion::instantiateQuestion($question_id);
161  $question->delete($question_id);
162  }
static instantiateQuestion(int $question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteQuestionpool()

ilObjQuestionPool::deleteQuestionpool ( )

Definition at line 141 of file class.ilObjQuestionPool.php.

References ilFileUtils\delDir(), deleteQuestion(), getAllQuestions(), ilFileUtils\getDataDir(), and ilObject\getId().

Referenced by delete().

141  : void
142  {
143  $questions = &$this->getAllQuestions();
144 
145  if (count($questions)) {
146  foreach ($questions as $question_id) {
147  $this->deleteQuestion($question_id);
148  }
149  }
150 
151  $qpl_data_dir = ilFileUtils::getDataDir() . '/qpl_data';
152  $directory = $qpl_data_dir . '/qpl_' . $this->getId();
153  if (is_dir($directory)) {
154  ilFileUtils::delDir($directory);
155  }
156  }
deleteQuestion(int $question_id)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDataDir()
get data directory (outside webspace)
& getAllQuestions()
Retrieve an array containing all question ids of the questionpool.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateQuestion()

ilObjQuestionPool::duplicateQuestion ( int  $question_id)

Definition at line 251 of file class.ilObjQuestionPool.php.

References _updateQuestionCount(), and createQuestion().

Referenced by copyQuestion().

251  : int
252  {
253  $question = $this->createQuestion('', $question_id);
254  $newtitle = $question->object->getTitle();
255  if ($this->questioninfo->questionTitleExistsInPool($this->getId(), $question->object->getTitle())) {
256  $counter = 2;
257  while ($this->questioninfo->questionTitleExistsInPool(
258  $this->getId(),
259  $question->object->getTitle() . ' (' . $counter . ')'
260  )) {
261  $counter++;
262  }
263  $newtitle = $question->object->getTitle() . ' (' . $counter . ')';
264  }
265  $new_id = $question->object->duplicate(false, $newtitle);
267  return $new_id;
268  }
createQuestion(string $question_type, int $question_id=-1)
static _updateQuestionCount(int $object_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportFileItems()

ilObjQuestionPool::exportFileItems (   $target_dir,
$expLog 
)

export files of file itmes

Definition at line 489 of file class.ilObjQuestionPool.php.

References IL_INST_ID, and ilFileUtils\makeDir().

Referenced by objectToXmlWriter().

489  : void
490  {
491  foreach ($this->file_ids as $file_id) {
492  $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
493  $file_dir = $target_dir . '/objects/il_' . IL_INST_ID . '_file_' . $file_id;
494  ilFileUtils::makeDir($file_dir);
495  $file_obj = new ilObjFile($file_id, false);
496  $source_file = $file_obj->getFile($file_obj->getVersion());
497  if (!is_file($source_file)) {
498  $source_file = $file_obj->getFile();
499  }
500  if (is_file($source_file)) {
501  copy($source_file, $file_dir . '/' . $file_obj->getFileName());
502  }
503  unset($file_obj);
504  }
505  }
const IL_INST_ID
Definition: constants.php:40
Class ilObjFile.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLMediaObjects()

ilObjQuestionPool::exportXMLMediaObjects ( $a_xml_writer,
  $a_inst,
  $a_target_dir,
$expLog 
)

Definition at line 472 of file class.ilObjQuestionPool.php.

References ilObjMediaObject\_exists().

Referenced by objectToXmlWriter().

472  : void
473  {
474  foreach ($this->mob_ids as $mob_id) {
475  $expLog->write(date('[y-m-d H:i:s] ') . 'Media Object ' . $mob_id);
476  if (ilObjMediaObject::_exists($mob_id)) {
477  $media_obj = new ilObjMediaObject($mob_id);
478  $media_obj->exportXML($a_xml_writer, $a_inst);
479  $media_obj->exportFiles($a_target_dir);
480  unset($media_obj);
481  }
482  }
483  }
static _exists(int $id, bool $reference=false, ?string $type=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLMetaData()

ilObjQuestionPool::exportXMLMetaData ( $a_xml_writer)

export content objects meta data to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 404 of file class.ilObjQuestionPool.php.

References ilObject\getId(), and ilObject\getType().

Referenced by objectToXmlWriter().

404  : void
405  {
406  $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
407  $md2xml->setExportMode(true);
408  $md2xml->startExport();
409  $a_xml_writer->appendXML($md2xml->getXML());
410  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLPageObjects()

ilObjQuestionPool::exportXMLPageObjects ( $a_xml_writer,
  $a_inst,
$expLog,
  $questions 
)

export page objects to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 427 of file class.ilObjQuestionPool.php.

References $benchmark, ilPCFileList\collectFileItems(), and ilBenchmark\start().

Referenced by objectToXmlWriter().

427  : void
428  {
429  $ilBench = $this->benchmark;
430 
431  foreach ($questions as $question_id) {
432  $ilBench->start('ContentObjectExport', 'exportPageObject');
433  $expLog->write(date('[y-m-d H:i:s] ') . 'Page Object ' . $question_id);
434 
435  $attrs = [];
436  $a_xml_writer->xmlStartTag('PageObject', $attrs);
437 
438  // export xml to writer object
439  $ilBench->start('ContentObjectExport', 'exportPageObject_XML');
440  $page_object = new ilAssQuestionPage($question_id);
441  $page_object->buildDom();
442  $page_object->insertInstIntoIDs($a_inst);
443  $mob_ids = $page_object->collectMediaObjects(false);
444  $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
445  $xml = $page_object->getXMLFromDom(false, false, false, '', true);
446  $xml = str_replace('&', '&amp;', $xml);
447  $a_xml_writer->appendXML($xml);
448  $page_object->freeDom();
449  unset($page_object);
450  $ilBench->stop('ContentObjectExport', 'exportPageObject_XML');
451 
452  $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
453  foreach ($mob_ids as $mob_id) {
454  $this->mob_ids[$mob_id] = $mob_id;
455  }
456  $ilBench->stop('ContentObjectExport', 'exportPageObject_CollectMedia');
457 
458  // collect all file items
459  $ilBench->start('ContentObjectExport', 'exportPageObject_CollectFileItems');
460  //$file_ids = $page_obj->getFileItemIds();
461  foreach ($file_ids as $file_id) {
462  $this->file_ids[$file_id] = $file_id;
463  }
464  $ilBench->stop('ContentObjectExport', 'exportPageObject_CollectFileItems');
465 
466  $a_xml_writer->xmlEndTag("PageObject");
467 
468  $ilBench->stop('ContentObjectExport', 'exportPageObject');
469  }
470  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
start(string $a_module, string $a_bench)
start measurement
static collectFileItems(ilPageObject $a_page, DOMDocument $a_domdoc)
Get all file items that are used within the page.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLSettings()

ilObjQuestionPool::exportXMLSettings (   $xmlWriter)
private
Parameters
ilXmlWriter$xmlWriter

Definition at line 320 of file class.ilObjQuestionPool.php.

References getShowTaxonomies(), and isSkillServiceEnabled().

Referenced by objectToXmlWriter().

320  : void
321  {
322  $xmlWriter->xmlStartTag('Settings');
323 
324  $xmlWriter->xmlElement('ShowTaxonomies', null, (int) $this->getShowTaxonomies());
325  $xmlWriter->xmlElement('SkillService', null, (int) $this->isSkillServiceEnabled());
326 
327  $xmlWriter->xmlEndTag('Settings');
328  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromXML()

ilObjQuestionPool::fromXML (   $xmlFile)

Definition at line 1293 of file class.ilObjQuestionPool.php.

1293  : void
1294  {
1295  $parser = new ilObjQuestionPoolXMLParser($this, $xmlFile);
1296  $parser->startParsing();
1297  }

◆ getAllQuestionIds()

& ilObjQuestionPool::getAllQuestionIds ( )

Definition at line 603 of file class.ilObjQuestionPool.php.

References ilObject\getId(), and isPluginActive().

603  : array
604  {
605  $query_result = $this->db->queryF(
606  'SELECT question_id, qpl_qst_type.type_tag, qpl_qst_type.plugin FROM qpl_questions, qpl_qst_type WHERE original_id IS NULL AND qpl_questions.tstamp > 0 AND obj_fi = %s AND complete = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id',
607  ['integer', 'text'],
608  [$this->getId(), 1]
609  );
610  $questions = [];
611  if ($query_result->numRows()) {
612  while ($row = $this->db->fetchAssoc($query_result)) {
613  if ($row['plugin']) {
614  if ($this->isPluginActive($row['type_tag'])) {
615  array_push($questions, $row['question_id']);
616  }
617  } else {
618  array_push($questions, $row['question_id']);
619  }
620  }
621  }
622  return $questions;
623  }
isPluginActive($questionType)
Checks wheather or not a question plugin with a given name is active.
+ Here is the call graph for this function:

◆ getAllQuestions()

& ilObjQuestionPool::getAllQuestions ( )

Retrieve an array containing all question ids of the questionpool.

Returns
array An array containing all question ids of the questionpool

Definition at line 589 of file class.ilObjQuestionPool.php.

References ilObject\getId().

Referenced by deleteQuestionpool().

589  : array
590  {
591  $result = $this->db->queryF(
592  'SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL',
593  ['integer'],
594  [$this->getId()]
595  );
596  $questions = [];
597  while ($row = $this->db->fetchAssoc($result)) {
598  array_push($questions, $row['question_id']);
599  }
600  return $questions;
601  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeleteableQuestionDetails()

ilObjQuestionPool::getDeleteableQuestionDetails (   $question_ids)

Returns an array containing the qpl_question and qpl_qst_type fields of deleteable questions for an array of question ids.

Parameters
array$question_idsAn array containing the question ids
Returns
array An array containing the details of the requested questions public

Definition at line 897 of file class.ilObjQuestionPool.php.

References createQuestion().

897  : array
898  {
899  $result = [];
900  $query_result = $this->db->query(
901  'SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND '
902  . $this->db->in('qpl_questions.question_id', $question_ids, false, 'integer')
903  . ' ORDER BY qpl_questions.title'
904  );
905  if ($query_result->numRows()) {
906  while ($row = $this->db->fetchAssoc($query_result)) {
907  if (!$this->questioninfo->isUsedInRandomTest($row['question_id'])) {
908  array_push($result, $row);
909  } else {
910  // the question was used in a random test prior to ILIAS 3.7 so it was inserted
911  // as a reference to the original question pool object and not as a copy. To allow
912  // the deletion of the question pool object, a copy must be created and all database references
913  // of the original question must changed with the reference of the copy
914 
915  // 1. Create a copy of the original question
916  $question = $this->createQuestion('', $row['question_id']);
917  $duplicate_id = $question->object->duplicate(true);
918  if ($duplicate_id > 0) {
919  // 2. replace the question id in the solutions
920  $affectedRows = $this->db->manipulateF(
921  'UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s',
922  ['integer', 'integer'],
923  [$duplicate_id, $row['question_id']]
924  );
925 
926  // 3. replace the question id in the question list of random tests
927  $affectedRows = $this->db->manipulateF(
928  'UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s',
929  ['integer', 'integer'],
930  [$duplicate_id, $row['question_id']]
931  );
932 
933  // 4. replace the question id in the test results
934  $affectedRows = $this->db->manipulateF(
935  'UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s',
936  ['integer', 'integer'],
937  [$duplicate_id, $row['question_id']]
938  );
939 
940  // 5. replace the question id in the test&assessment log
941  $affectedRows = $this->db->manipulateF(
942  'UPDATE ass_log SET question_fi = %s WHERE question_fi = %s',
943  ['integer', 'integer'],
944  [$duplicate_id, $row['question_id']]
945  );
946 
947  // 6. The original question can be deleted, so add it to the list of questions
948  array_push($result, $row);
949  }
950  }
951  }
952  }
953  return $result;
954  }
createQuestion(string $question_type, int $question_id=-1)
+ Here is the call graph for this function:

◆ getExportDirectory()

ilObjQuestionPool::getExportDirectory (   $type = '')

get export directory of questionpool

Definition at line 544 of file class.ilObjQuestionPool.php.

References ilObject\$type, ilExport\_getExportDirectory(), ilFileUtils\getDataDir(), ilObject\getId(), and ilObject\getType().

Referenced by createExportDirectory().

544  : string
545  {
546  switch ($type) {
547  case 'xml':
548  $export_dir = ilExport::_getExportDirectory($this->getId(), $type, $this->getType());
549  break;
550  case 'xlsx':
551  case 'zip':
552  $export_dir = ilFileUtils::getDataDir() . "/qpl_data/qpl_{$this->getId()}/export_{$type}";
553  break;
554  default:
555  $export_dir = ilFileUtils::getDataDir() . '/qpl_data' . '/qpl_' . $this->getId() . '/export';
556  break;
557  }
558  return $export_dir;
559  }
string $type
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object.
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImportDirectory()

ilObjQuestionPool::getImportDirectory ( )

Definition at line 579 of file class.ilObjQuestionPool.php.

References _getImportDirectory().

580  {
582  }
static _getImportDirectory()
get import directory of lm
+ Here is the call graph for this function:

◆ getImportMapping()

ilObjQuestionPool::getImportMapping ( )

get array of (two) new created questions for import id

Definition at line 642 of file class.ilObjQuestionPool.php.

642  : array
643  {
644  return [];
645  }

◆ getPrintviewQuestions()

ilObjQuestionPool::getPrintviewQuestions ( )

Definition at line 293 of file class.ilObjQuestionPool.php.

References ilObject\getId(), getQuestionTypeTranslations(), and isPluginActive().

293  : array
294  {
295  $query_result = $this->db->queryF(
296  'SELECT qpl_questions.*, qpl_qst_type.type_tag, qpl_qst_type.plugin, qpl_questions.tstamp updated FROM qpl_questions, qpl_qst_type WHERE qpl_questions.original_id IS NULL AND qpl_questions.tstamp > 0 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND qpl_questions.obj_fi = %s',
297  ['integer'],
298  [$this->getId()]
299  );
300  $rows = [];
301  $types = $this->getQuestionTypeTranslations();
302  if ($query_result->numRows()) {
303  while ($row = $this->db->fetchAssoc($query_result)) {
304  $row['ttype'] = $types[$row['type_tag']];
305  if ($row['plugin']) {
306  if ($this->isPluginActive($row['type_tag'])) {
307  array_push($rows, $row);
308  }
309  } else {
310  array_push($rows, $row);
311  }
312  }
313  }
314  return $rows;
315  }
isPluginActive($questionType)
Checks wheather or not a question plugin with a given name is active.
+ Here is the call graph for this function:

◆ getQplQuestions()

ilObjQuestionPool::getQplQuestions ( )

Definition at line 1038 of file class.ilObjQuestionPool.php.

References ilObject\getId().

Referenced by cloneObject().

1038  : array
1039  {
1040  $questions = [];
1041  $result = $this->db->queryF(
1042  'SELECT qpl_questions.question_id FROM qpl_questions WHERE qpl_questions.original_id IS NULL AND qpl_questions.tstamp > 0 AND qpl_questions.obj_fi = %s',
1043  ['integer'],
1044  [$this->getId()]
1045  );
1046  while ($row = $this->db->fetchAssoc($result)) {
1047  array_push($questions, $row['question_id']);
1048  }
1049  return $questions;
1050  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionDetails()

ilObjQuestionPool::getQuestionDetails (   $question_ids)

Returns an array containing the qpl_question and qpl_qst_type fields for an array of question ids.

Parameters
array$question_idsAn array containing the question ids
Returns
array An array containing the details of the requested questions public

Definition at line 870 of file class.ilObjQuestionPool.php.

References $ilDB.

870  : array
871  {
872  $result = [];
873  $query_result = $this->db->query(
874  'SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND ' . $ilDB->in(
875  'qpl_questions.question_id',
876  $question_ids,
877  false,
878  'integer'
879  ) . ' ORDER BY qpl_questions.title'
880  );
881  if ($query_result->numRows()) {
882  while ($row = $this->db->fetchAssoc($query_result)) {
883  array_push($result, $row);
884  }
885  }
886  return $result;
887  }

◆ getQuestionList()

ilObjQuestionPool::getQuestionList ( )

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

References ilObject\getId().

1200  : array
1201  {
1202  $questions = [];
1203  $result = $this->db->queryF(
1204  'SELECT qpl_questions.*, qpl_qst_type.* FROM qpl_questions, qpl_qst_type WHERE qpl_questions.original_id IS NULL AND qpl_questions.obj_fi = %s AND qpl_questions.tstamp > 0 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id',
1205  ['integer'],
1206  [$this->getId()]
1207  );
1208  while ($row = $this->db->fetchAssoc($result)) {
1209  array_push($questions, $row);
1210  }
1211  return $questions;
1212  }
+ Here is the call graph for this function:

◆ getQuestiontype()

ilObjQuestionPool::getQuestiontype (   $question_id)

Definition at line 211 of file class.ilObjQuestionPool.php.

References $data.

212  {
213  if ($question_id < 1) {
214  return null;
215  }
216 
217  $result = $this->db->queryF(
218  'SELECT qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND qpl_questions.question_id = %s',
219  ['integer'],
220  [$question_id]
221  );
222 
223  if ($result->numRows() == 1) {
224  $data = $this->db->fetchAssoc($result);
225  return $data['type_tag'];
226  }
227  return null;
228  }

◆ getQuestionTypeByTypeId()

static ilObjQuestionPool::getQuestionTypeByTypeId (   $type_id)
static

Definition at line 1129 of file class.ilObjQuestionPool.php.

References $DIC, and $ilDB.

Referenced by ilTestExpressPageObjectGUI\addPageOfQuestions(), ilTestCorrectionsGUI\allowedInAdjustment(), ilObjTestGUI\createQuestionObject(), ilTestExpressPageObjectGUI\executeCommand(), ilObjTestGUI\executeCreateQuestionObject(), and ilTestExpressPageObjectGUI\handleToolbarCommand().

1130  {
1131  global $DIC;
1132  $ilDB = $DIC['ilDB'];
1133 
1134  $query = 'SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s';
1135  $types = ['integer'];
1136  $values = [$type_id];
1137  $result = $ilDB->queryF($query, $types, $values);
1138 
1139  if ($row = $ilDB->fetchAssoc($result)) {
1140  return $row['type_tag'];
1141  }
1142  return null;
1143  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getQuestionTypes()

ilObjQuestionPool::getQuestionTypes (   $all_tags = false,
  $fixOrder = false,
  $withDeprecatedTypes = true 
)

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

1092  : array
1093  {
1094  return self::_getQuestionTypes($all_tags, $fixOrder, $withDeprecatedTypes);
1095  }

◆ getQuestionTypeTranslations()

static ilObjQuestionPool::getQuestionTypeTranslations ( )
static

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

References $DIC, $ilDB, ilObject\$lng, ilLanguage\loadLanguageModule(), and ilLanguage\txt().

Referenced by getPrintviewQuestions().

1145  : array
1146  {
1147  global $DIC;
1148  $ilDB = $DIC['ilDB'];
1149  $lng = $DIC['lng'];
1150  $ilLog = $DIC['ilLog'];
1151  $component_factory = $DIC['component.factory'];
1152 
1153  $lng->loadLanguageModule('assessment');
1154  $result = $ilDB->query('SELECT * FROM qpl_qst_type');
1155  $types = [];
1156  while ($row = $ilDB->fetchAssoc($result)) {
1157  if ($row['plugin'] == 0) {
1158  $types[$row['type_tag']] = $lng->txt($row['type_tag']);
1159  } else {
1160  foreach ($component_factory->getActivePluginsInSlot('qst') as $pl) {
1161  if (strcmp($pl->getQuestionType(), $row['type_tag']) == 0) {
1162  $types[$row['type_tag']] = $pl->getQuestionTypeTranslation();
1163  }
1164  }
1165  }
1166  }
1167  ksort($types);
1168  return $types;
1169  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
ilLanguage $lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShowTaxonomies()

ilObjQuestionPool::getShowTaxonomies ( )

Definition at line 693 of file class.ilObjQuestionPool.php.

References $show_taxonomies.

Referenced by cloneObject(), exportXMLSettings(), and saveToDb().

693  : ?bool
694  {
695  return $this->show_taxonomies;
696  }
+ Here is the caller graph for this function:

◆ getTaxonomyIds()

ilObjQuestionPool::getTaxonomyIds ( )

get ids of all taxonomies corresponding to current pool

Returns
array

Definition at line 1265 of file class.ilObjQuestionPool.php.

References ilObject\getId(), and ilObjTaxonomy\getUsageOfObject().

1265  : array
1266  {
1267  return ilObjTaxonomy::getUsageOfObject($this->getId());
1268  }
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
+ Here is the call graph for this function:

◆ isInUse()

ilObjQuestionPool::isInUse ( int  $question_id)

Definition at line 230 of file class.ilObjQuestionPool.php.

230  : bool
231  {
232  $result = $this->db->queryF(
233  'SELECT COUNT(solution_id) solution_count FROM tst_solutions WHERE question_fi = %s',
234  ['integer'],
235  [$question_id]
236  );
237  $row = $this->db->fetchAssoc($result);
238  return $row['solution_count'];
239  }

◆ isPluginActive()

ilObjQuestionPool::isPluginActive (   $questionType)

Checks wheather or not a question plugin with a given name is active.

Parameters
string$a_pnameThe plugin name public

Definition at line 1231 of file class.ilObjQuestionPool.php.

References ilComponentInfo\TYPE_MODULES.

Referenced by getAllQuestionIds(), and getPrintviewQuestions().

1231  : bool
1232  {
1233  if (!$this->component_repository->getComponentByTypeAndName(
1235  'TestQuestionPool'
1236  )->getPluginSlotById('qst')->hasPluginName($questionType)) {
1237  return false;
1238  }
1239 
1240  return $this->component_repository
1241  ->getComponentByTypeAndName(
1243  'TestQuestionPool'
1244  )
1245  ->getPluginSlotById(
1246  'qst'
1247  )
1248  ->getPluginByName(
1249  $questionType
1250  )->isActive();
1251  }
+ Here is the caller graph for this function:

◆ isSkillManagementGloballyActivated()

static ilObjQuestionPool::isSkillManagementGloballyActivated ( )
static

Definition at line 1282 of file class.ilObjQuestionPool.php.

Referenced by ilObjQuestionPoolSettingsGeneralGUI\buildForm(), ilQuestionPoolSkillAdministrationGUI\isAccessDenied(), and ilObjQuestionPoolGUI\isSkillsTabRequired().

1282  : ?bool
1283  {
1284  if (self::$isSkillManagementGloballyActivated === null) {
1285  $skmgSet = new ilSkillManagementSettings();
1286 
1287  self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
1288  }
1289 
1290  return self::$isSkillManagementGloballyActivated;
1291  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ isSkillServiceEnabled()

ilObjQuestionPool::isSkillServiceEnabled ( )

Definition at line 1270 of file class.ilObjQuestionPool.php.

References $skill_service_enabled.

Referenced by cloneObject(), exportXMLSettings(), and saveToDb().

1270  : bool
1271  {
1273  }
+ Here is the caller graph for this function:

◆ loadFromDb()

ilObjQuestionPool::loadFromDb ( )

Definition at line 164 of file class.ilObjQuestionPool.php.

References ilObject\getId(), setShowTaxonomies(), and setSkillServiceEnabled().

Referenced by read().

164  : void
165  {
166  $result = $this->db->queryF(
167  'SELECT * FROM qpl_questionpool WHERE obj_fi = %s',
168  ['integer'],
169  [$this->getId()]
170  );
171  if ($result->numRows() == 1) {
172  $row = $this->db->fetchAssoc($result);
173  $this->setShowTaxonomies($row['show_taxonomies']);
174  $this->setSkillServiceEnabled($row['skill_service']);
175  }
176  }
setSkillServiceEnabled(bool $skill_service_enabled)
setShowTaxonomies($show_taxonomies)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modifyExportIdentifier()

ilObjQuestionPool::modifyExportIdentifier (   $a_tag,
  $a_param,
  $a_value 
)

Definition at line 412 of file class.ilObjQuestionPool.php.

References ilUtil\insertInstIntoID().

413  {
414  if ($a_tag == 'Identifier' && $a_param == 'Entry') {
415  $a_value = ilUtil::insertInstIntoID($a_value);
416  }
417 
418  return $a_value;
419  }
static insertInstIntoID(string $a_value)
inserts installation id into ILIAS id
+ Here is the call graph for this function:

◆ moveToClipboard()

ilObjQuestionPool::moveToClipboard (   $question_id)

Moves a question to the clipboard.

Parameters
integer$question_idObject id of the question private

Definition at line 810 of file class.ilObjQuestionPool.php.

References ilSession\get(), and ilSession\set().

810  : void
811  {
812  if (ilSession::get('qpl_clipboard') == null) {
813  ilSession::set('qpl_clipboard', []);
814  }
815  $clip = ilSession::get('qpl_clipboard');
816  $clip[$question_id] = ['question_id' => $question_id, 'action' => 'move'];
817  ilSession::set('qpl_clipboard', $clip);
818  }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ objectToXmlWriter()

ilObjQuestionPool::objectToXmlWriter ( ilXmlWriter $a_xml_writer,
  $a_inst,
  $a_target_dir,
$expLog,
  $questions 
)

export pages of test to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 336 of file class.ilObjQuestionPool.php.

References $benchmark, exportFileItems(), exportXMLMediaObjects(), exportXMLMetaData(), exportXMLPageObjects(), exportXMLSettings(), populateQuestionSkillAssignmentsXml(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

336  : void
337  {
338  $ilBench = $this->benchmark;
339 
340  $this->mob_ids = [];
341  $this->file_ids = [];
342 
343  $attrs = [];
344  $attrs['Type'] = 'Questionpool_Test';
345  $a_xml_writer->xmlStartTag('ContentObject', $attrs);
346 
347  // MetaData
348  $this->exportXMLMetaData($a_xml_writer);
349 
350  // Settings
351  $this->exportXMLSettings($a_xml_writer);
352 
353  // PageObjects
354  $expLog->write(date('[y-m-d H:i:s] ') . 'Start Export Page Objects');
355  $ilBench->start('ContentObjectExport', 'exportPageObjects');
356  $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog, $questions);
357  $ilBench->stop('ContentObjectExport', 'exportPageObjects');
358  $expLog->write(date('[y-m-d H:i:s] ') . 'Finished Export Page Objects');
359 
360  // MediaObjects
361  $expLog->write(date('[y-m-d H:i:s] ') . 'Start Export Media Objects');
362  $ilBench->start('ContentObjectExport', 'exportMediaObjects');
363  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
364  $ilBench->stop('ContentObjectExport', 'exportMediaObjects');
365  $expLog->write(date('[y-m-d H:i:s] ') . 'Finished Export Media Objects');
366 
367  // FileItems
368  $expLog->write(date('[y-m-d H:i:s] ') . 'Start Export File Items');
369  $ilBench->start('ContentObjectExport', 'exportFileItems');
370  $this->exportFileItems($a_target_dir, $expLog);
371  $ilBench->stop('ContentObjectExport', 'exportFileItems');
372  $expLog->write(date('[y-m-d H:i:s] ') . 'Finished Export File Items');
373 
374  // skill assignments
375  $this->populateQuestionSkillAssignmentsXml($a_xml_writer, $questions);
376 
377  $a_xml_writer->xmlEndTag('ContentObject');
378  }
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
export page objects to xml (see ilias_co.dtd)
populateQuestionSkillAssignmentsXml(ilXmlWriter &$a_xml_writer, $questions)
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
exportFileItems($target_dir, &$expLog)
export files of file itmes
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:

◆ pasteFromClipboard()

ilObjQuestionPool::pasteFromClipboard ( )

Copies/Moves a question from the clipboard.

private

Definition at line 738 of file class.ilObjQuestionPool.php.

References _updateQuestionCount(), ilSession\clear(), CLIENT_WEB_DIR, copyQuestion(), ilSession\get(), ilObject\getId(), and ilFileUtils\makeDirParents().

738  : bool
739  {
740  $success = false;
741  if (ilSession::get('qpl_clipboard') != null) {
742  $success = true;
743  foreach (ilSession::get('qpl_clipboard') as $question_object) {
744  if (strcmp($question_object['action'], 'move') == 0) {
745  $result = $this->db->queryF(
746  'SELECT obj_fi FROM qpl_questions WHERE question_id = %s',
747  ['integer'],
748  [$question_object['question_id']]
749  );
750  if ($result->numRows() == 1) {
751  $row = $this->db->fetchAssoc($result);
752  $source_questionpool = $row['obj_fi'];
753  $affectedRows = $this->db->manipulateF(
754  'UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s',
755  ['integer', 'integer'],
756  [$this->getId(), $question_object['question_id']]
757  );
758  if (!$affectedRows) {
759  $success = false;
760  }
761 
762  $source_path = CLIENT_WEB_DIR . '/assessment/' . $source_questionpool . '/' . $question_object['question_id'] . '/';
763  if (@is_dir($source_path)) {
764  $target_path = CLIENT_WEB_DIR . '/assessment/' . $this->getId() . '/';
765  if (!@is_dir($target_path)) {
766  ilFileUtils::makeDirParents($target_path);
767  }
768  rename($source_path, $target_path . $question_object['question_id']);
769  }
770 
771  ilObjQuestionPool::_updateQuestionCount($source_questionpool);
772  }
773  } else {
774  $new_question_id = $this->copyQuestion($question_object['question_id'], $this->getId());
775  if (!$new_question_id) {
776  $success = false;
777  }
778  }
779  }
780  }
781  // update question count of question pool
783  ilSession::clear('qpl_clipboard');
784 
785  return $success;
786  }
static get(string $a_var)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
copyQuestion(int $question_id, int $questionpool_to)
const CLIENT_WEB_DIR
Definition: constants.php:47
static _updateQuestionCount(int $object_id)
static clear(string $a_var)
+ Here is the call graph for this function:

◆ populateQuestionSkillAssignmentsXml()

ilObjQuestionPool::populateQuestionSkillAssignmentsXml ( ilXmlWriter $a_xml_writer,
  $questions 
)
protected
Parameters
ilXmlWriter$a_xml_writer
$questions

Definition at line 384 of file class.ilObjQuestionPool.php.

References ilObject\getId().

Referenced by objectToXmlWriter().

384  : void
385  {
386  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
387  $assignmentList->setParentObjId($this->getId());
388  $assignmentList->loadFromDb();
389  $assignmentList->loadAdditionalSkillData();
390 
391  $skillQuestionAssignmentExporter = new ilAssQuestionSkillAssignmentExporter();
392  $skillQuestionAssignmentExporter->setXmlWriter($a_xml_writer);
393  $skillQuestionAssignmentExporter->setQuestionIds($questions);
394  $skillQuestionAssignmentExporter->setAssignmentList($assignmentList);
395  $skillQuestionAssignmentExporter->export();
396  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ purgeQuestions()

ilObjQuestionPool::purgeQuestions ( )

Definition at line 1253 of file class.ilObjQuestionPool.php.

References ILIAS\Repository\user().

1253  : void
1254  {
1255  $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($this->db);
1256  $incompleteQuestionPurger->setOwnerId($this->user->getId());
1257  $incompleteQuestionPurger->purge();
1258  }
+ Here is the call graph for this function:

◆ questionsToXML()

ilObjQuestionPool::questionsToXML (   $questions)

Returns a QTI xml representation of a list of questions.

Parameters
array$questionsAn array containing the question ids of the questions
Returns
string The QTI xml representation of the questions public

Definition at line 654 of file class.ilObjQuestionPool.php.

References ILIAS\LTI\ToolProvider\$key, and createQuestion().

654  : string
655  {
656  $xml = '';
657  // export button was pressed
658  if (count($questions) > 0) {
659  foreach ($questions as $key => $value) {
660  $question = $this->createQuestion('', $value);
661  $xml .= $question->object->toXML();
662  }
663  if (count($questions) > 1) {
664  $xml = preg_replace('/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/', '', $xml);
665  }
666  }
667  $xml = preg_replace(
668  '/(<\?xml[^>]*?>)/',
669  '\\1' . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv1p2p1.dtd">',
670  $xml
671  );
672  return $xml;
673  }
createQuestion(string $question_type, int $question_id=-1)
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

◆ read()

ilObjQuestionPool::read (   $a_force_db = false)

read object data from db into object

Parameters
booleanpublic

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

References loadFromDb().

110  : void
111  {
112  parent::read($a_force_db);
113  $this->loadFromDb();
114  }
+ Here is the call graph for this function:

◆ saveToDb()

ilObjQuestionPool::saveToDb ( )

Definition at line 178 of file class.ilObjQuestionPool.php.

References ilObject\getId(), getShowTaxonomies(), and isSkillServiceEnabled().

Referenced by createReference().

178  : void
179  {
180  $result = $this->db->queryF(
181  'SELECT id_questionpool FROM qpl_questionpool WHERE obj_fi = %s',
182  ['integer'],
183  [$this->getId()]
184  );
185 
186  if ($result->numRows() == 1) {
187  $result = $this->db->update(
188  'qpl_questionpool',
189  [
190  'show_taxonomies' => ['integer', (int) $this->getShowTaxonomies()],
191  'skill_service' => ['integer', (int) $this->isSkillServiceEnabled()],
192  'tstamp' => ['integer', time()]
193  ],
194  [
195  'obj_fi' => ['integer', $this->getId()]
196  ]
197  );
198  } else {
199  $next_id = $this->db->nextId('qpl_questionpool');
200 
201  $result = $this->db->insert('qpl_questionpool', [
202  'id_questionpool' => ['integer', $next_id],
203  'show_taxonomies' => ['integer', (int) $this->getShowTaxonomies()],
204  'skill_service' => ['integer', (int) $this->isSkillServiceEnabled()],
205  'tstamp' => ['integer', time()],
206  'obj_fi' => ['integer', $this->getId()]
207  ]);
208  }
209  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShowTaxonomies()

ilObjQuestionPool::setShowTaxonomies (   $show_taxonomies)

Definition at line 688 of file class.ilObjQuestionPool.php.

References $show_taxonomies.

Referenced by loadFromDb().

688  : void
689  {
690  $this->show_taxonomies = $show_taxonomies;
691  }
+ Here is the caller graph for this function:

◆ setSkillServiceEnabled()

ilObjQuestionPool::setSkillServiceEnabled ( bool  $skill_service_enabled)

Definition at line 1275 of file class.ilObjQuestionPool.php.

References $skill_service_enabled.

Referenced by loadFromDb().

1275  : void
1276  {
1277  $this->skill_service_enabled = $skill_service_enabled;
1278  }
+ Here is the caller graph for this function:

◆ update()

ilObjQuestionPool::update ( )

update object data

public

Returns
boolean

Definition at line 93 of file class.ilObjQuestionPool.php.

References ilObject\updateMetaData().

93  : bool
94  {
95  $this->updateMetaData();
96  if (!parent::update()) {
97  return false;
98  }
99 
100  // put here object specific stuff
101 
102  return true;
103  }
+ Here is the call graph for this function:

Field Documentation

◆ $benchmark

ilBenchmark ilObjQuestionPool::$benchmark
private

Definition at line 33 of file class.ilObjQuestionPool.php.

Referenced by exportXMLPageObjects(), and objectToXmlWriter().

◆ $component_repository

ilComponentRepository ilObjQuestionPool::$component_repository
private

Definition at line 32 of file class.ilObjQuestionPool.php.

◆ $file_ids

array ilObjQuestionPool::$file_ids
private

Definition at line 36 of file class.ilObjQuestionPool.php.

◆ $isSkillManagementGloballyActivated

ilObjQuestionPool::$isSkillManagementGloballyActivated = null
staticprivate

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

◆ $mob_ids

array ilObjQuestionPool::$mob_ids
private

Definition at line 35 of file class.ilObjQuestionPool.php.

◆ $questioninfo

ILIAS TestQuestionPool QuestionInfoService ilObjQuestionPool::$questioninfo
private

Definition at line 39 of file class.ilObjQuestionPool.php.

◆ $show_taxonomies

bool ilObjQuestionPool::$show_taxonomies = null
private

Definition at line 37 of file class.ilObjQuestionPool.php.

Referenced by getShowTaxonomies(), and setShowTaxonomies().

◆ $skill_service_enabled

bool ilObjQuestionPool::$skill_service_enabled
private

Definition at line 38 of file class.ilObjQuestionPool.php.

Referenced by isSkillServiceEnabled(), and setSkillServiceEnabled().


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