ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjQuestionPool Class Reference
+ Inheritance diagram for ilObjQuestionPool:
+ Collaboration diagram for ilObjQuestionPool:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 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)
 
 appendCounterToQuestionTitleIfNecessary (string $title)
 
 getPrintviewQuestions ()
 
 objectToXmlWriter (ilXmlWriter &$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
 export pages of test to xml (see ilias_co.dtd) More...
 
 exportTitleAndDescription (ilXmlWriter &$a_xml_writer)
 
 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...
 
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...
 
 pasteFromClipboard ()
 Copies/Moves a question from the clipboard. More...
 
 copyToClipboard ($question_id)
 Copies a question to the clipboard. More...
 
 moveToClipboard (int $question_id)
 Moves a question to the clipboard. More...
 
 cleanupClipboard (int $deleted_question_id)
 
 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 (?string $xml_file)
 
- 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 _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 (bool $use_object_id=false, bool $equal_points=false, bool $could_be_offline=false, bool $showPath=false, bool $with_questioncount=false, string $permission='read', int $usr_id=0)
 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 getIconForType (string $type)
 
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 $skill_service_enabled
 
GeneralQuestionPropertiesRepository $questionrepository
 

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
 
LOMServices $lom_services
 
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 33 of file class.ilObjQuestionPool.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

44  {
45  global $DIC;
46  $this->component_repository = $DIC['component.repository'];
47  $this->benchmark = $DIC['ilBench'];
48 
49  $local_dic = QuestionPoolDIC::dic();
50  $this->questionrepository = $local_dic['question.general_properties.repository'];
51 
52  $this->type = 'qpl';
53 
54  parent::__construct((int) $a_id, $a_call_by_reference);
55 
56  $this->skill_service_enabled = false;
57  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _getAvailableQuestionpools()

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

Returns the available question pools for the active user.

Returns
array The available question pools public

Definition at line 924 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 ilObjTestGUI\buildInputPoolSelection(), ilObjTest\getAvailableQuestionpools(), ilObjTest\getAvailableQuestions(), and ilTestQuestionBrowserTableGUI\getQuestionParentObjIds().

932  : array {
933  global $DIC;
934  $ilUser = $DIC['ilUser'];
935  $ilDB = $DIC['ilDB'];
936  $lng = $DIC['lng'];
937 
938  $result_array = [];
939  $qpls = ilUtil::_getObjectsByOperations('qpl', $permission, $usr_id > 0 ? $usr_id : $ilUser->getId(), -1);
940  $obj_ids = [];
941  foreach ($qpls as $ref_id) {
942  $obj_id = ilObject::_lookupObjId($ref_id);
943  $obj_ids[$ref_id] = $obj_id;
944  }
945  $titles = ilObject::_prepareCloneSelection($qpls, 'qpl');
946  if (count($obj_ids)) {
947  $in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
948  if ($could_be_offline) {
949  $result = $ilDB->query(
950  'SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ' .
951  'qpl_questionpool.obj_fi = object_data.obj_id AND ' . $in . ' ORDER BY object_data.title'
952  );
953  } else {
954  $result = $ilDB->queryF(
955  'SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ' .
956  'qpl_questionpool.obj_fi = object_data.obj_id AND ' . $in . ' AND object_data.offline = %s ' .
957  'ORDER BY object_data.title',
958  ['text'],
959  [0]
960  );
961  }
962  while ($row = $ilDB->fetchAssoc($result)) {
963  $add = true;
964  if ($equal_points !== false) {
965  if (!ilObjQuestionPool::_hasEqualPoints($row['obj_fi'])) {
966  $add = false;
967  }
968  }
969  if ($add) {
970  $ref_id = array_search($row['obj_fi'], $obj_ids);
971  $title = (($showPath) ? $titles[$ref_id] : $row['title']);
972  if ($with_questioncount) {
973  $title .= ' [' . $row['questioncount'] . ' ' . ($row['questioncount'] == 1 ? $lng->txt(
974  'ass_question'
975  ) : $lng->txt('assQuestions')) . ']';
976  }
977 
978  if ($use_object_id) {
979  $result_array[$row['obj_fi']] = [
980  'qpl_id' => $row['obj_fi'],
981  'qpl_title' => $row['title'],
982  'title' => $title,
983  'count' => $row['questioncount']
984  ];
985  } else {
986  $result_array[$ref_id] = [
987  'qpl_id' => $row['obj_fi'],
988  'qpl_title' => $row['title'],
989  'title' => $title,
990  'count' => $row['questioncount']
991  ];
992  }
993  }
994  }
995  }
996  return $result_array;
997  }
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)
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
global $DIC
Definition: shib_login.php:22
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:

◆ _getQuestionCount()

static ilObjQuestionPool::_getQuestionCount ( int  $pool_id)
staticprotected

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

References $DIC, and $ilDB.

Referenced by _updateQuestionCount().

644  : int
645  {
646  global $DIC;
647  $ilDB = $DIC['ilDB'];
648  $result = $ilDB->queryF(
649  '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',
650  ['integer', 'text'],
651  [$pool_id, 1]
652  );
653  $row = $ilDB->fetchAssoc($result);
654  return $row['question_count'];
655  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getQuestionTypes()

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

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

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

Referenced by _getSelfAssessmentQuestionTypes(), ilTestRandomQuestionSetPoolDefinitionFormGUI\build(), ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getFilter(), ilTestRandomQuestionSetSourcePoolDefinition\getTypeFilterAsTypeTags(), ilQuestionBrowserTableGUI\initFilter(), ilTestQuestionFilterLabelTranslator\loadTypeLabels(), ILIAS\Test\Questions\Presentation\QuestionsBrowserFilter\resolveQuestionTypeFilterOptions(), ilTestRandomQuestionSetSourcePoolDefinition\setTypeFilterFromTypeTags(), and ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings\toForm().

1056  : array
1057  {
1058  global $DIC;
1059  $ilDB = $DIC['ilDB'];
1060  $lng = $DIC['lng'];
1061  $component_factory = $DIC['component.factory'];
1062  $disabled_question_types = QuestionPoolDIC::dic()['global_test_settings']->getDisabledQuestionTypes();
1063 
1064  $lng->loadLanguageModule('assessment');
1065  $result = $ilDB->query('SELECT * FROM qpl_qst_type');
1066  $types = [];
1067  while ($row = $ilDB->fetchAssoc($result)) {
1068  if ($all_tags || (!in_array($row['question_type_id'], $disabled_question_types))) {
1069  if ($row['plugin'] == 0) {
1070  $types[$lng->txt($row['type_tag'])] = $row;
1071  } else {
1072  foreach ($component_factory->getActivePluginsInSlot('qst') as $pl) {
1073  if (strcmp($pl->getQuestionType(), $row['type_tag']) == 0) {
1074  $types[$pl->getQuestionTypeTranslation()] = $row;
1075  }
1076  }
1077  }
1078  }
1079  }
1080 
1082  $orderer = new ilAssQuestionTypeOrderer($types, $orderMode);
1083  $types = $orderer->getOrderedTypes($withDeprecatedTypes);
1084 
1085  return $types;
1086  }
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.
ilLanguage $lng
global $DIC
Definition: shib_login.php:22
+ 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 1132 of file class.ilObjQuestionPool.php.

References _getQuestionTypes().

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

1132  : array
1133  {
1134  $allowed_types = [
1135  'assSingleChoice' => 1,
1136  'assMultipleChoice' => 2,
1137  'assKprimChoice' => 3,
1138  'assClozeTest' => 4,
1139  'assMatchingQuestion' => 5,
1140  'assOrderingQuestion' => 6,
1141  'assOrderingHorizontal' => 7,
1142  'assImagemapQuestion' => 8,
1143  'assTextSubset' => 9,
1144  'assErrorText' => 10,
1145  'assLongMenu' => 11
1146  ];
1147  $satypes = [];
1148  $qtypes = ilObjQuestionPool::_getQuestionTypes($all_tags);
1149  foreach ($qtypes as $k => $t) {
1150  if (isset($allowed_types[$t['type_tag']])) {
1151  $t['order'] = $allowed_types[$t['type_tag']];
1152  $satypes[$k] = $t;
1153  }
1154  }
1155  return $satypes;
1156  }
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 663 of file class.ilObjQuestionPool.php.

References $DIC, and $ilDB.

Referenced by _getAvailableQuestionpools().

663  : int
664  {
665  global $DIC;
666  $ilDB = $DIC['ilDB'];
667 
668  if ($is_reference) {
669  $result = $ilDB->queryF(
670  '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',
671  ['integer'],
672  [$a_obj_id]
673  );
674  } else {
675  $result = $ilDB->queryF(
676  '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',
677  ['integer'],
678  [$a_obj_id]
679  );
680  }
681  if ($result->numRows() == 1) {
682  $row = $ilDB->fetchAssoc($result);
683  if ($row['equal_points'] == 1) {
684  return 1;
685  } else {
686  return 0;
687  }
688  }
689  return 0;
690  }
global $DIC
Definition: shib_login.php:22
+ 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 806 of file class.ilObjQuestionPool.php.

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

Referenced by assQuestion\isWriteable().

806  : bool
807  {
808  global $DIC;
809  $rbacsystem = $DIC['rbacsystem'];
810 
811  $refs = ilObject::_getAllReferences($object_id);
812  if (count($refs)) {
813  foreach ($refs as $ref_id) {
814  if ($rbacsystem->checkAccess('write', $ref_id) && (ilObject::_hasUntrashedReference($object_id))) {
815  return true;
816  }
817  }
818  }
819  return false;
820  }
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: shib_login.php:22
+ 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 1172 of file class.ilObjQuestionPool.php.

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

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

1172  : void
1173  {
1174  global $DIC;
1175  $ilDB = $DIC['ilDB'];
1176  $ilDB->manipulateF(
1177  'UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s',
1178  ['integer', 'integer', 'integer'],
1179  [ilObjQuestionPool::_getQuestionCount($object_id), time(), $object_id]
1180  );
1181  }
global $DIC
Definition: shib_login.php:22
static _getQuestionCount(int $pool_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendCounterToQuestionTitleIfNecessary()

ilObjQuestionPool::appendCounterToQuestionTitleIfNecessary ( string  $title)

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

References ilObject\$title, and ilObject\getId().

Referenced by copyQuestion(), ilObjTestGUI\copyQuestionToPool(), and duplicateQuestion().

275  : string
276  {
277  $result = $this->db->queryF(
278  "SELECT COUNT(question_id) AS cnt FROM qpl_questions WHERE obj_fi = %s AND title like %s",
279  ['integer','text'],
280  [$this->getId(), "{$title}%"]
281  );
282  $counter_object = $this->db->fetchObject($result);
283  if ($counter_object->cnt === 0) {
284  return $title;
285  }
286  return "{$title} ({$counter_object->cnt})";
287  }
string $title
+ 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 594 of file class.ilObjQuestionPool.php.

594  : bool
595  {
596  $row = $this->db->fetchAssoc(
597  $this->db->queryF(
598  'SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s',
599  ['integer', 'integer'],
600  [$question_id, $this->getId()]
601  )
602  );
603 
604  return (bool) $row['cnt'];
605  }

◆ cleanupClipboard()

ilObjQuestionPool::cleanupClipboard ( int  $deleted_question_id)

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

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

779  : void
780  {
781  if (ilSession::get('qpl_clipboard') == null) {
782  return;
783  }
784 
785  $clip = ilSession::get('qpl_clipboard');
786  if (!isset($clip[$deleted_question_id])) {
787  return;
788  }
789 
790  unset($clip[$deleted_question_id]);
791 
792  if (!count($clip)) {
793  ilSession::clear('qpl_clipboard');
794  } else {
795  ilSession::set('qpl_clipboard', $clip);
796  }
797  }
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 1018 of file class.ilObjQuestionPool.php.

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

1018  : ?ilObject
1019  {
1020  $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
1021 
1022  $new_obj->update();
1023 
1024  $new_obj->setSkillServiceEnabled($this->isSkillServiceEnabled());
1025  $new_obj->saveToDb();
1026 
1027  // clone the questions in the question pool
1028  $questions = $this->getQplQuestions();
1029  $questionIdsMap = [];
1030  foreach ($questions as $question_id) {
1031  $newQuestionId = $new_obj->copyQuestion($question_id, $new_obj->getId());
1032  $questionIdsMap[$question_id] = $newQuestionId;
1033  }
1034 
1035  $this->cloneMetaData($new_obj);
1036  $new_obj->updateMetaData();
1037 
1038  $duplicator = new ilQuestionPoolTaxonomiesDuplicator();
1039  $duplicator->setSourceObjId($this->getId());
1040  $duplicator->setSourceObjType($this->getType());
1041  $duplicator->setTargetObjId($new_obj->getId());
1042  $duplicator->setTargetObjType($new_obj->getType());
1043  $duplicator->setQuestionIdMapping($questionIdsMap);
1044  $duplicator->duplicate($duplicator->getAllTaxonomiesForSourceObject());
1045 
1046  $new_obj->saveToDb();
1047 
1048  return $new_obj;
1049  }
cloneMetaData(ilObject $target_obj)
Copy meta data.
+ Here is the call graph for this function:

◆ copyQuestion()

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

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

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

Referenced by pasteFromClipboard().

259  : int
260  {
261  $question_gui = $this->createQuestion('', $question_id);
262  if ($question_gui->getObject()->getObjId() == $questionpool_to) {
263  // the question is copied into the same question pool
264  return $this->duplicateQuestion($question_id);
265  } else {
266  // the question is copied into another question pool
267  $newtitle = $this->appendCounterToQuestionTitleIfNecessary(
268  $question_gui->getObject()->getTitle()
269  );
270 
271  return $question_gui->getObject()->copyObject($this->getId(), $newtitle);
272  }
273  }
createQuestion(string $question_type, int $question_id=-1)
appendCounterToQuestionTitleIfNecessary(string $title)
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 753 of file class.ilObjQuestionPool.php.

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

753  : void
754  {
755  if (ilSession::get('qpl_clipboard') == null) {
756  ilSession::set('qpl_clipboard', []);
757  }
758  $clip = ilSession::get('qpl_clipboard');
759  $clip[$question_id] = ['question_id' => $question_id, 'action' => 'copy'];
760  ilSession::set('qpl_clipboard', $clip);
761  }
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 504 of file class.ilObjQuestionPool.php.

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

504  : void
505  {
506  $qpl_data_dir = ilFileUtils::getDataDir() . '/qpl_data';
507  ilFileUtils::makeDir($qpl_data_dir);
508  if (!is_writable($qpl_data_dir)) {
509  $this->error->raiseError(
510  'Questionpool Data Directory (' . $qpl_data_dir
511  . ') not writeable.',
512  $this->error->FATAL
513  );
514  }
515 
516  // create learning module directory (data_dir/lm_data/lm_<id>)
517  $qpl_dir = $qpl_data_dir . '/qpl_' . $this->getId();
518  ilFileUtils::makeDir($qpl_dir);
519  if (!@is_dir($qpl_dir)) {
520  $this->error->raiseError('Creation of Questionpool Directory failed.', $this->error->FATAL);
521  }
522  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
524  if (!@is_dir($this->getExportDirectory('xlsx'))) {
525  $this->error->raiseError('Creation of Export Directory failed.', $this->error->FATAL);
526  }
528  if (!@is_dir($this->getExportDirectory('zip'))) {
529  $this->error->raiseError('Creation of Export Directory failed.', $this->error->FATAL);
530  }
531  }
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 238 of file class.ilObjQuestionPool.php.

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

239  {
240  if ($question_id > 0) {
241  return assQuestion::instantiateQuestionGUI($question_id);
242  }
243  $question_type_gui = $question_type . 'GUI';
244  $question_gui = new $question_type_gui();
245  return $question_gui;
246  }
+ 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 248 of file class.ilObjQuestionPool.php.

References _updateQuestionCount(), appendCounterToQuestionTitleIfNecessary(), and createQuestion().

Referenced by copyQuestion().

248  : int
249  {
250  $question = $this->createQuestion('', $question_id);
251  $newtitle = $this->appendCounterToQuestionTitleIfNecessary(
252  $question->getObject()->getTitle()
253  );
254  $new_id = $question->getObject()->duplicate(false, $newtitle);
256  return $new_id;
257  }
createQuestion(string $question_type, int $question_id=-1)
static _updateQuestionCount(int $object_id)
appendCounterToQuestionTitleIfNecessary(string $title)
+ 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 481 of file class.ilObjQuestionPool.php.

References IL_INST_ID, and ilFileUtils\makeDir().

Referenced by objectToXmlWriter().

481  : void
482  {
483  foreach ($this->file_ids as $file_id) {
484  $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
485  $file_dir = $target_dir . '/objects/il_' . IL_INST_ID . '_file_' . $file_id;
486  ilFileUtils::makeDir($file_dir);
487  $file_obj = new ilObjFile($file_id, false);
488  $source_file = $file_obj->getFile($file_obj->getVersion());
489  if (!is_file($source_file)) {
490  $source_file = $file_obj->getFile();
491  }
492  if (is_file($source_file)) {
493  copy($source_file, $file_dir . '/' . $file_obj->getFileName());
494  }
495  unset($file_obj);
496  }
497  }
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:

◆ exportTitleAndDescription()

ilObjQuestionPool::exportTitleAndDescription ( ilXmlWriter $a_xml_writer)

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

References ilObject\getDescription(), ilObject\getTitle(), null, and ilXmlWriter\xmlElement().

Referenced by objectToXmlWriter().

391  : void
392  {
393  $a_xml_writer->xmlElement('Title', null, $this->getTitle());
394  $a_xml_writer->xmlElement('Description', null, $this->getDescription());
395  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ 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 457 of file class.ilObjQuestionPool.php.

References ilObjMediaObject\_exists(), ilFileUtils\createDirectory(), and IL_INST_ID.

Referenced by objectToXmlWriter().

457  : void
458  {
459  foreach ($this->mob_ids as $mob_id) {
460  $expLog->write(date('[y-m-d H:i:s] ') . 'Media Object ' . $mob_id);
461  if (ilObjMediaObject::_exists($mob_id)) {
462  $target_dir = $a_target_dir . DIRECTORY_SEPARATOR . 'objects'
463  . DIRECTORY_SEPARATOR . 'il_' . IL_INST_ID . '_mob_' . $mob_id;
464  ilFileUtils::createDirectory($target_dir);
465  $media_obj = new ilObjMediaObject($mob_id);
466  $media_obj->exportXML($a_xml_writer, $a_inst);
467  foreach ($media_obj->getMediaItems() as $item) {
468  $stream = $item->getLocationStream();
469  file_put_contents($target_dir . DIRECTORY_SEPARATOR . $item->getLocation(), $stream);
470  $stream->close();
471  }
472  unset($media_obj);
473  }
474  }
475  }
const IL_INST_ID
Definition: constants.php:40
static createDirectory(string $a_dir, int $a_mod=0755)
create directory
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:

◆ 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 412 of file class.ilObjQuestionPool.php.

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

Referenced by objectToXmlWriter().

412  : void
413  {
414  $ilBench = $this->benchmark;
415 
416  foreach ($questions as $question_id) {
417  $ilBench->start('ContentObjectExport', 'exportPageObject');
418  $expLog->write(date('[y-m-d H:i:s] ') . 'Page Object ' . $question_id);
419 
420  $attrs = [];
421  $a_xml_writer->xmlStartTag('PageObject', $attrs);
422 
423  // export xml to writer object
424  $ilBench->start('ContentObjectExport', 'exportPageObject_XML');
425  $page_object = new ilAssQuestionPage($question_id);
426  $page_object->buildDom();
427  $page_object->insertInstIntoIDs($a_inst);
428  $mob_ids = $page_object->collectMediaObjects(false);
429  $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
430  $xml = $page_object->getXMLFromDom(false, false, false, '', true);
431  $xml = str_replace('&', '&amp;', $xml);
432  $a_xml_writer->appendXML($xml);
433  $page_object->freeDom();
434  unset($page_object);
435  $ilBench->stop('ContentObjectExport', 'exportPageObject_XML');
436 
437  $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
438  foreach ($mob_ids as $mob_id) {
439  $this->mob_ids[$mob_id] = $mob_id;
440  }
441  $ilBench->stop('ContentObjectExport', 'exportPageObject_CollectMedia');
442 
443  // collect all file items
444  $ilBench->start('ContentObjectExport', 'exportPageObject_CollectFileItems');
445  //$file_ids = $page_obj->getFileItemIds();
446  foreach ($file_ids as $file_id) {
447  $this->file_ids[$file_id] = $file_id;
448  }
449  $ilBench->stop('ContentObjectExport', 'exportPageObject_CollectFileItems');
450 
451  $a_xml_writer->xmlEndTag("PageObject");
452 
453  $ilBench->stop('ContentObjectExport', 'exportPageObject');
454  }
455  }
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 316 of file class.ilObjQuestionPool.php.

References isSkillServiceEnabled(), and null.

Referenced by objectToXmlWriter().

316  : void
317  {
318  $xmlWriter->xmlStartTag('Settings');
319  $xmlWriter->xmlElement('SkillService', null, (int) $this->isSkillServiceEnabled());
320  $xmlWriter->xmlEndTag('Settings');
321  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromXML()

ilObjQuestionPool::fromXML ( ?string  $xml_file)

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

1251  : void
1252  {
1253  $parser = new ilObjQuestionPoolXMLParser($this, $xml_file);
1254  $parser->startParsing();
1255  }

◆ getAllQuestionIds()

& ilObjQuestionPool::getAllQuestionIds ( )

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

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

572  : array
573  {
574  $query_result = $this->db->queryF(
575  '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',
576  ['integer', 'text'],
577  [$this->getId(), 1]
578  );
579  $questions = [];
580  if ($query_result->numRows()) {
581  while ($row = $this->db->fetchAssoc($query_result)) {
582  if ($row['plugin']) {
583  if ($this->isPluginActive($row['type_tag'])) {
584  array_push($questions, $row['question_id']);
585  }
586  } else {
587  array_push($questions, $row['question_id']);
588  }
589  }
590  }
591  return $questions;
592  }
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 558 of file class.ilObjQuestionPool.php.

References ilObject\getId().

Referenced by deleteQuestionpool().

558  : array
559  {
560  $result = $this->db->queryF(
561  'SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL',
562  ['integer'],
563  [$this->getId()]
564  );
565  $questions = [];
566  while ($row = $this->db->fetchAssoc($result)) {
567  array_push($questions, $row['question_id']);
568  }
569  return $questions;
570  }
+ 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 859 of file class.ilObjQuestionPool.php.

References createQuestion().

859  : array
860  {
861  $result = [];
862  $query_result = $this->db->query(
863  '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 '
864  . $this->db->in('qpl_questions.question_id', $question_ids, false, 'integer')
865  . ' ORDER BY qpl_questions.title'
866  );
867  if ($query_result->numRows()) {
868  while ($row = $this->db->fetchAssoc($query_result)) {
869  if (!$this->questionrepository->isUsedInRandomTest($row['question_id'])) {
870  array_push($result, $row);
871  } else {
872  // the question was used in a random test prior to ILIAS 3.7 so it was inserted
873  // as a reference to the original question pool object and not as a copy. To allow
874  // the deletion of the question pool object, a copy must be created and all database references
875  // of the original question must changed with the reference of the copy
876 
877  // 1. Create a copy of the original question
878  $question = $this->createQuestion('', $row['question_id']);
879  $duplicate_id = $question->getObject()->duplicate(true);
880  if ($duplicate_id > 0) {
881  // 2. replace the question id in the solutions
882  $affectedRows = $this->db->manipulateF(
883  'UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s',
884  ['integer', 'integer'],
885  [$duplicate_id, $row['question_id']]
886  );
887 
888  // 3. replace the question id in the question list of random tests
889  $affectedRows = $this->db->manipulateF(
890  'UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s',
891  ['integer', 'integer'],
892  [$duplicate_id, $row['question_id']]
893  );
894 
895  // 4. replace the question id in the test results
896  $affectedRows = $this->db->manipulateF(
897  'UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s',
898  ['integer', 'integer'],
899  [$duplicate_id, $row['question_id']]
900  );
901 
902  // 5. replace the question id in the test&assessment log
903  $affectedRows = $this->db->manipulateF(
904  'UPDATE ass_log SET question_fi = %s WHERE question_fi = %s',
905  ['integer', 'integer'],
906  [$duplicate_id, $row['question_id']]
907  );
908 
909  // 6. The original question can be deleted, so add it to the list of questions
910  array_push($result, $row);
911  }
912  }
913  }
914  }
915  return $result;
916  }
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 536 of file class.ilObjQuestionPool.php.

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

Referenced by createExportDirectory().

536  : string
537  {
538  switch ($type) {
539  case 'xml':
540  $export_dir = ilExport::_getExportDirectory($this->getId(), $type, $this->getType());
541  break;
542  case 'xlsx':
543  case 'zip':
544  $export_dir = ilFileUtils::getDataDir() . "/qpl_data/qpl_{$this->getId()}/export_{$type}";
545  break;
546  default:
547  $export_dir = ilFileUtils::getDataDir() . '/qpl_data' . '/qpl_' . $this->getId() . '/export';
548  break;
549  }
550  return $export_dir;
551  }
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:

◆ getImportMapping()

ilObjQuestionPool::getImportMapping ( )

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

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

611  : array
612  {
613  return [];
614  }

◆ getPrintviewQuestions()

ilObjQuestionPool::getPrintviewQuestions ( )

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

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

289  : array
290  {
291  $query_result = $this->db->queryF(
292  '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',
293  ['integer'],
294  [$this->getId()]
295  );
296  $rows = [];
297  $types = $this->getQuestionTypeTranslations();
298  if ($query_result->numRows()) {
299  while ($row = $this->db->fetchAssoc($query_result)) {
300  $row['ttype'] = $types[$row['type_tag']];
301  if ($row['plugin']) {
302  if ($this->isPluginActive($row['type_tag'])) {
303  array_push($rows, $row);
304  }
305  } else {
306  array_push($rows, $row);
307  }
308  }
309  }
310  return $rows;
311  }
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 999 of file class.ilObjQuestionPool.php.

References ilObject\getId().

Referenced by cloneObject().

999  : array
1000  {
1001  $questions = [];
1002  $result = $this->db->queryF(
1003  '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',
1004  ['integer'],
1005  [$this->getId()]
1006  );
1007  while ($row = $this->db->fetchAssoc($result)) {
1008  array_push($questions, $row['question_id']);
1009  }
1010  return $questions;
1011  }
+ 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 829 of file class.ilObjQuestionPool.php.

829  : array
830  {
831  $result = [];
832  $query_result = $this->db->query(
833  'SELECT qpl_questions.*, qpl_qst_type.type_tag '
834  . 'FROM qpl_questions, qpl_qst_type '
835  . 'WHERE qpl_questions.question_type_fi = qpl_qst_type.question_type_id '
836  . 'AND ' . $this->db->in(
837  'qpl_questions.question_id',
838  $question_ids,
839  false,
840  'integer'
841  ) . ' ORDER BY qpl_questions.title'
842  );
843  if ($query_result->numRows()) {
844  while ($row = $this->db->fetchAssoc($query_result)) {
845  array_push($result, $row);
846  }
847  }
848  return $result;
849  }

◆ getQuestionList()

ilObjQuestionPool::getQuestionList ( )

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

References ilObject\getId().

1158  : array
1159  {
1160  $questions = [];
1161  $result = $this->db->queryF(
1162  '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',
1163  ['integer'],
1164  [$this->getId()]
1165  );
1166  while ($row = $this->db->fetchAssoc($result)) {
1167  array_push($questions, $row);
1168  }
1169  return $questions;
1170  }
+ Here is the call graph for this function:

◆ getQuestiontype()

ilObjQuestionPool::getQuestiontype (   $question_id)

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

References $data, and null.

209  {
210  if ($question_id < 1) {
211  return null;
212  }
213 
214  $result = $this->db->queryF(
215  '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',
216  ['integer'],
217  [$question_id]
218  );
219 
220  if ($result->numRows() == 1) {
221  $data = $this->db->fetchAssoc($result);
222  return $data['type_tag'];
223  }
224  return null;
225  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getQuestionTypeByTypeId()

static ilObjQuestionPool::getQuestionTypeByTypeId (   $type_id)
static

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

References $DIC, $ilDB, and null.

Referenced by ilObjQuestionPoolGUI\cleanupAfterImport(), and ilObjTestGUI\createQuestionPool().

1089  {
1090  global $DIC;
1091  $ilDB = $DIC['ilDB'];
1092 
1093  $query = 'SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s';
1094  $types = ['integer'];
1095  $values = [$type_id];
1096  $result = $ilDB->queryF($query, $types, $values);
1097 
1098  if ($row = $ilDB->fetchAssoc($result)) {
1099  return $row['type_tag'];
1100  }
1101  return null;
1102  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getQuestionTypes()

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

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

1051  : array
1052  {
1053  return self::_getQuestionTypes($all_tags, $fixOrder, $withDeprecatedTypes);
1054  }

◆ getQuestionTypeTranslations()

static ilObjQuestionPool::getQuestionTypeTranslations ( )
static

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

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

Referenced by getPrintviewQuestions().

1104  : array
1105  {
1106  global $DIC;
1107  $ilDB = $DIC['ilDB'];
1108  $lng = $DIC['lng'];
1109  $component_factory = $DIC['component.factory'];
1110 
1111  $lng->loadLanguageModule('assessment');
1112  $result = $ilDB->query('SELECT * FROM qpl_qst_type');
1113  $types = [];
1114  while ($row = $ilDB->fetchAssoc($result)) {
1115  if ($row['plugin'] == 0) {
1116  $types[$row['type_tag']] = $lng->txt($row['type_tag']);
1117  } else {
1118  foreach ($component_factory->getActivePluginsInSlot('qst') as $pl) {
1119  if (strcmp($pl->getQuestionType(), $row['type_tag']) == 0) {
1120  $types[$row['type_tag']] = $pl->getQuestionTypeTranslation();
1121  }
1122  }
1123  }
1124  }
1125  ksort($types);
1126  return $types;
1127  }
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.
ilLanguage $lng
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ 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 1223 of file class.ilObjQuestionPool.php.

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

1223  : array
1224  {
1225  return ilObjTaxonomy::getUsageOfObject($this->getId());
1226  }
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 227 of file class.ilObjQuestionPool.php.

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

◆ 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 1189 of file class.ilObjQuestionPool.php.

References ilComponentInfo\TYPE_MODULES.

Referenced by getAllQuestionIds(), and getPrintviewQuestions().

1189  : bool
1190  {
1191  if (!$this->component_repository->getComponentByTypeAndName(
1193  'TestQuestionPool'
1194  )->getPluginSlotById('qst')->hasPluginName($questionType)) {
1195  return false;
1196  }
1197 
1198  return $this->component_repository
1199  ->getComponentByTypeAndName(
1201  'TestQuestionPool'
1202  )
1203  ->getPluginSlotById(
1204  'qst'
1205  )
1206  ->getPluginByName(
1207  $questionType
1208  )->isActive();
1209  }
+ Here is the caller graph for this function:

◆ isSkillManagementGloballyActivated()

static ilObjQuestionPool::isSkillManagementGloballyActivated ( )
static

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

References null.

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

1240  : ?bool
1241  {
1242  if (self::$isSkillManagementGloballyActivated === null) {
1243  $skmgSet = new ilSkillManagementSettings();
1244 
1245  self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
1246  }
1247 
1248  return self::$isSkillManagementGloballyActivated;
1249  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ isSkillServiceEnabled()

ilObjQuestionPool::isSkillServiceEnabled ( )

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

References $skill_service_enabled.

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

1228  : bool
1229  {
1231  }
+ Here is the caller graph for this function:

◆ loadFromDb()

ilObjQuestionPool::loadFromDb ( )

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

References ilObject\getId(), 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->setSkillServiceEnabled((bool) $row['skill_service']);
174  }
175  }
setSkillServiceEnabled(bool $skill_service_enabled)
+ 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 397 of file class.ilObjQuestionPool.php.

References ilUtil\insertInstIntoID().

398  {
399  if ($a_tag == 'Identifier' && $a_param == 'Entry') {
400  $a_value = ilUtil::insertInstIntoID($a_value);
401  }
402 
403  return $a_value;
404  }
static insertInstIntoID(string $a_value)
inserts installation id into ILIAS id
+ Here is the call graph for this function:

◆ moveToClipboard()

ilObjQuestionPool::moveToClipboard ( int  $question_id)

Moves a question to the clipboard.

Parameters
integer$question_idObject id of the question private

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

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

769  : void
770  {
771  if (ilSession::get('qpl_clipboard') == null) {
772  ilSession::set('qpl_clipboard', []);
773  }
774  $clip = ilSession::get('qpl_clipboard');
775  $clip[$question_id] = ['question_id' => $question_id, 'action' => 'move'];
776  ilSession::set('qpl_clipboard', $clip);
777  }
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 329 of file class.ilObjQuestionPool.php.

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

329  : void
330  {
331  $ilBench = $this->benchmark;
332 
333  $this->mob_ids = [];
334  $this->file_ids = [];
335 
336  $attrs = [];
337  $attrs['Type'] = 'Questionpool_Test';
338  $a_xml_writer->xmlStartTag('ContentObject', $attrs);
339 
340  // MetaData
341  $this->exportTitleAndDescription($a_xml_writer);
342 
343  // Settings
344  $this->exportXMLSettings($a_xml_writer);
345 
346  // PageObjects
347  $expLog->write(date('[y-m-d H:i:s] ') . 'Start Export Page Objects');
348  $ilBench->start('ContentObjectExport', 'exportPageObjects');
349  $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog, $questions);
350  $ilBench->stop('ContentObjectExport', 'exportPageObjects');
351  $expLog->write(date('[y-m-d H:i:s] ') . 'Finished Export Page Objects');
352 
353  // MediaObjects
354  $expLog->write(date('[y-m-d H:i:s] ') . 'Start Export Media Objects');
355  $ilBench->start('ContentObjectExport', 'exportMediaObjects');
356  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
357  $ilBench->stop('ContentObjectExport', 'exportMediaObjects');
358  $expLog->write(date('[y-m-d H:i:s] ') . 'Finished Export Media Objects');
359 
360  // FileItems
361  $expLog->write(date('[y-m-d H:i:s] ') . 'Start Export File Items');
362  $ilBench->start('ContentObjectExport', 'exportFileItems');
363  $this->exportFileItems($a_target_dir, $expLog);
364  $ilBench->stop('ContentObjectExport', 'exportFileItems');
365  $expLog->write(date('[y-m-d H:i:s] ') . 'Finished Export File Items');
366 
367  // skill assignments
368  $this->populateQuestionSkillAssignmentsXml($a_xml_writer, $questions);
369 
370  $a_xml_writer->xmlEndTag('ContentObject');
371  }
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.
exportTitleAndDescription(ilXmlWriter &$a_xml_writer)
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 697 of file class.ilObjQuestionPool.php.

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

697  : bool
698  {
699  $success = false;
700  if (ilSession::get('qpl_clipboard') != null) {
701  $success = true;
702  foreach (ilSession::get('qpl_clipboard') as $question_object) {
703  if (strcmp($question_object['action'], 'move') == 0) {
704  $result = $this->db->queryF(
705  'SELECT obj_fi FROM qpl_questions WHERE question_id = %s',
706  ['integer'],
707  [$question_object['question_id']]
708  );
709  if ($result->numRows() == 1) {
710  $row = $this->db->fetchAssoc($result);
711  $source_questionpool = $row['obj_fi'];
712  $affectedRows = $this->db->manipulateF(
713  'UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s',
714  ['integer', 'integer'],
715  [$this->getId(), $question_object['question_id']]
716  );
717  if (!$affectedRows) {
718  $success = false;
719  }
720 
721  $source_path = CLIENT_WEB_DIR . '/assessment/' . $source_questionpool . '/' . $question_object['question_id'] . '/';
722  if (@is_dir($source_path)) {
723  $target_path = CLIENT_WEB_DIR . '/assessment/' . $this->getId() . '/';
724  if (!@is_dir($target_path)) {
725  ilFileUtils::makeDirParents($target_path);
726  }
727  rename($source_path, $target_path . $question_object['question_id']);
728  }
729 
730  ilObjQuestionPool::_updateQuestionCount($source_questionpool);
731  }
732  } else {
733  $new_question_id = $this->copyQuestion($question_object['question_id'], $this->getId());
734  if (!$new_question_id) {
735  $success = false;
736  }
737  }
738  }
739  }
740  // update question count of question pool
742  ilSession::clear('qpl_clipboard');
743 
744  return $success;
745  }
static get(string $a_var)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 377 of file class.ilObjQuestionPool.php.

References ilObject\getId().

Referenced by objectToXmlWriter().

377  : void
378  {
379  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
380  $assignmentList->setParentObjId($this->getId());
381  $assignmentList->loadFromDb();
382  $assignmentList->loadAdditionalSkillData();
383 
384  $skillQuestionAssignmentExporter = new ilAssQuestionSkillAssignmentExporter();
385  $skillQuestionAssignmentExporter->setXmlWriter($a_xml_writer);
386  $skillQuestionAssignmentExporter->setQuestionIds($questions);
387  $skillQuestionAssignmentExporter->setAssignmentList($assignmentList);
388  $skillQuestionAssignmentExporter->export();
389  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ purgeQuestions()

ilObjQuestionPool::purgeQuestions ( )

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

References ILIAS\Repository\user().

1211  : void
1212  {
1213  $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($this->db);
1214  $incompleteQuestionPurger->setOwnerId($this->user->getId());
1215  $incompleteQuestionPurger->purge();
1216  }
+ 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 623 of file class.ilObjQuestionPool.php.

References createQuestion().

623  : string
624  {
625  $xml = '';
626  // export button was pressed
627  if (count($questions) > 0) {
628  foreach ($questions as $key => $value) {
629  $question = $this->createQuestion('', $value);
630  $xml .= $question->getObject()->toXML();
631  }
632  if (count($questions) > 1) {
633  $xml = preg_replace('/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/', '', $xml);
634  }
635  }
636  $xml = preg_replace(
637  '/(<\?xml[^>]*?>)/',
638  '\\1' . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv1p2p1.dtd">',
639  $xml
640  );
641  return $xml;
642  }
createQuestion(string $question_type, int $question_id=-1)
+ 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 177 of file class.ilObjQuestionPool.php.

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

Referenced by createReference().

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

◆ setSkillServiceEnabled()

ilObjQuestionPool::setSkillServiceEnabled ( bool  $skill_service_enabled)

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

References $skill_service_enabled.

Referenced by loadFromDb().

1233  : void
1234  {
1235  $this->skill_service_enabled = $skill_service_enabled;
1236  }
+ 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 36 of file class.ilObjQuestionPool.php.

Referenced by exportXMLPageObjects(), and objectToXmlWriter().

◆ $component_repository

ilComponentRepository ilObjQuestionPool::$component_repository
private

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

◆ $file_ids

array ilObjQuestionPool::$file_ids
private

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

◆ $isSkillManagementGloballyActivated

ilObjQuestionPool::$isSkillManagementGloballyActivated = null
staticprivate

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

◆ $mob_ids

array ilObjQuestionPool::$mob_ids
private

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

◆ $questionrepository

GeneralQuestionPropertiesRepository ilObjQuestionPool::$questionrepository
private

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

◆ $skill_service_enabled

bool ilObjQuestionPool::$skill_service_enabled
private

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

Referenced by isSkillServiceEnabled(), and setSkillServiceEnabled().


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