ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 updateMetaData ()
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 delete ()
 delete object and all related data More...
 
 deleteQuestionpool ()
 
 deleteQuestion ($question_id)
 Deletes a question from the question pool. More...
 
 addQuestionChangeListeners (assQuestion $question)
 
 loadFromDb ()
 Loads a ilObjQuestionpool object from a database. More...
 
 saveToDb ()
 Saves a ilObjQuestionpool object to a database. More...
 
 getQuestiontype ($question_id)
 Returns the question type of a question with a given id. More...
 
 getDescription ()
 get description of content object More...
 
 setDescription ($a_description)
 set description of content object More...
 
 getTitle ()
 get title of glossary object More...
 
 setTitle ($a_title)
 set title of glossary object More...
 
 isInUse ($question_id)
 Checks whether the question is in use or not. More...
 
createQuestion ($question_type, $question_id=-1)
 
 duplicateQuestion ($question_id)
 Duplicates a question for a questionpool. More...
 
 copyQuestion ($question_id, $questionpool_to)
 Copies a question into another question pool. More...
 
 getPrintviewQuestions ()
 Calculates the data for the print view of the questionpool. More...
 
 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)
 export media objects to xml (see ilias_co.dtd) More...
 
 exportFileItems ($a_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 ($questionId)
 
 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...
 
 setOnline ($a_online_status)
 Sets the questionpool online status. More...
 
 getOnline ()
 
 setShowTaxonomies ($showTaxonomies)
 
 getShowTaxonomies ()
 
 setNavTaxonomyId ($navTaxonomyId)
 
 getNavTaxonomyId ()
 
 isNavTaxonomyActive ()
 
 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...
 
 _getFullPathToQpl ($ref_id)
 Retrieves the full path to a question pool with a given reference id. More...
 
getQplQuestions ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_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)
 
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 ($skillServiceEnabled)
 
 fromXML ($xmlFile)
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object 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 If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _createImportDirectory ()
 creates data directory for import files (data_dir/qpl_data/qpl_<id>/import, depending on data directory that is set in ILIAS setup/ini) More...
 
static _setImportDirectory ($a_import_dir=null)
 set import directory More...
 
static _getImportDirectory ()
 get import directory of lm More...
 
static _getQuestionCount ($questionpool_id, $complete_questions_only=false)
 Returns the number of questions in a question pool. More...
 
static _lookupOnline ($a_obj_id, $is_reference=false)
 
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)
 
static getQuestionTypeByTypeId ($type_id)
 
static getQuestionTypeTranslations ()
 
static & _getSelfAssessmentQuestionTypes ($all_tags=false)
 Get all self assessment question types. More...
 
static _updateQuestionCount ($object_id)
 Updates the number of available questions for a question pool in the database. More...
 
static isSkillManagementGloballyActivated ()
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $online
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Protected Member Functions

 populateQuestionSkillAssignmentsXml (ilXmlWriter &$a_xml_writer, $questions)
 

Private Member Functions

 exportXMLSettings ($xmlWriter)
 

Private Attributes

 $showTaxonomies = null
 
 $navTaxonomyId = null
 
 $skillServiceEnabled
 
 $import_dir
 

Static Private Attributes

static $isSkillManagementGloballyActivated = null
 

Additional Inherited Members

- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

Definition at line 16 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 56 of file class.ilObjQuestionPool.php.

References setOnline().

57  {
58  $this->type = "qpl";
59  parent::__construct($a_id, $a_call_by_reference);
60  $this->setOnline(0);
61 
62  $this->skillServiceEnabled = false;
63  }
setOnline($a_online_status)
Sets the questionpool online status.
+ Here is the call graph for this function:

Member Function Documentation

◆ _createImportDirectory()

static ilObjQuestionPool::_createImportDirectory ( )
static

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

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

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

Referenced by ilObjQuestionPoolGUI\uploadQplObject().

725  {
726  global $ilias;
727 
728  include_once "./Services/Utilities/classes/class.ilUtil.php";
729  $qpl_data_dir = ilUtil::getDataDir() . "/qpl_data";
730  ilUtil::makeDir($qpl_data_dir);
731 
732  if (!is_writable($qpl_data_dir)) {
733  $ilias->raiseError("Questionpool Data Directory (" . $qpl_data_dir
734  . ") not writeable.", $ilias->error_obj->FATAL);
735  }
736 
737  // create questionpool directory (data_dir/qpl_data/qpl_import)
738  $qpl_dir = $qpl_data_dir . "/qpl_import";
739  ilUtil::makeDir($qpl_dir);
740  if (!@is_dir($qpl_dir)) {
741  $ilias->raiseError("Creation of Questionpool Directory failed.", $ilias->error_obj->FATAL);
742  }
743  return $qpl_dir;
744  }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

References $ilDB, $ilUser, $in, ilObject\$lng, ilObject\$ref_id, $result, $row, ilObject\$title, ilUtil\_getObjectsByOperations(), _hasEqualPoints(), ilObject\_lookupObjId(), ilObject\_prepareCloneSelection(), and array.

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

1256  {
1257  global $ilUser, $ilDB, $lng;
1258 
1259  $result_array = array();
1260  $permission = (strlen($permission) == 0) ? "read" : $permission;
1261  $qpls = ilUtil::_getObjectsByOperations("qpl", $permission, (strlen($usr_id)) ? $usr_id : $ilUser->getId(), -1);
1262  $obj_ids = array();
1263  foreach ($qpls as $ref_id) {
1264  $obj_id = ilObject::_lookupObjId($ref_id);
1265  $obj_ids[$ref_id] = $obj_id;
1266  }
1267  $titles = ilObject::_prepareCloneSelection($qpls, "qpl");
1268  if (count($obj_ids)) {
1269  $in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
1270  if ($could_be_offline) {
1271  $result = $ilDB->query("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " .
1272  "qpl_questionpool.obj_fi = object_data.obj_id AND $in ORDER BY object_data.title");
1273  } else {
1274  $result = $ilDB->queryF(
1275  "SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " .
1276  "qpl_questionpool.obj_fi = object_data.obj_id AND $in AND qpl_questionpool.isonline = %s " .
1277  "ORDER BY object_data.title",
1278  array('text'),
1279  array(1)
1280  );
1281  }
1282  while ($row = $ilDB->fetchAssoc($result)) {
1283  $add = true;
1284  if ($equal_points) {
1285  if (!ilObjQuestionPool::_hasEqualPoints($row["obj_fi"])) {
1286  $add = false;
1287  }
1288  }
1289  if ($add) {
1290  $ref_id = array_search($row["obj_fi"], $obj_ids);
1291  $title = (($showPath) ? $titles[$ref_id] : $row["title"]);
1292  if ($with_questioncount) {
1293  $title .= " [" . $row["questioncount"] . " " . ($row["questioncount"] == 1 ? $lng->txt("ass_question") : $lng->txt("assQuestions")) . "]";
1294  }
1295 
1296  if ($use_object_id) {
1297  $result_array[$row["obj_fi"]] = array(
1298  'qpl_id' => $row['obj_fi'],
1299  'qpl_title' => $row['title'],
1300  "title" => $title,
1301  "count" => $row["questioncount"]
1302  );
1303  } else {
1304  $result_array[$ref_id] = array(
1305  'qpl_id' => $row['obj_fi'],
1306  'qpl_title' => $row['title'],
1307  "title" => $title,
1308  "count" => $row["questioncount"]
1309  );
1310  }
1311  }
1312  }
1313  }
1314  return $result_array;
1315  }
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
$result
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $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.
static _hasEqualPoints($a_obj_id, $is_reference=false)
Checks a question pool for questions with the same maximum points.
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFullPathToQpl()

ilObjQuestionPool::_getFullPathToQpl (   $ref_id)

Retrieves the full path to a question pool with a given reference id.

Returns
string The full path to the question pool including the locator public

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

References $counter, $path, ilObject\$ref_id, ilObject\$tree, array, ilStr\strLen(), and ilStr\subStr().

1230  {
1231  global $tree;
1232  $path = $tree->getPathFull($ref_id);
1233  $items = array();
1234  $counter = 0;
1235  foreach ($path as $item) {
1236  if (($counter > 0) && ($counter < count($path)-1)) {
1237  array_push($items, $item["title"]);
1238  }
1239  $counter++;
1240  }
1241  $fullpath = join(" > ", $items);
1242  include_once "./Services/Utilities/classes/class.ilStr.php";
1243  if (strlen($fullpath) > 60) {
1244  $fullpath = ilStr::subStr($fullpath, 0, 30) . "..." . ilStr::subStr($fullpath, ilStr::strLen($fullpath)-30, 30);
1245  }
1246  return $fullpath;
1247  }
static strLen($a_string)
Definition: class.ilStr.php:78
static subStr($a_str, $a_start, $a_length=null)
Definition: class.ilStr.php:15
$counter
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ _getImportDirectory()

static ilObjQuestionPool::_getImportDirectory ( )
static

get import directory of lm

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

References $_SESSION.

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

762  {
763  if (strlen($_SESSION["qpl_import_dir"])) {
764  return $_SESSION["qpl_import_dir"];
765  }
766  return null;
767  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ _getQuestionCount()

static ilObjQuestionPool::_getQuestionCount (   $questionpool_id,
  $complete_questions_only = false 
)
static

Returns the number of questions in a question pool.

Parameters
integer$questonpool_idObject id of the questionpool to examine
boolean$complete_questions_onlyIf set to TRUE, returns only the number of complete questions in the questionpool. Default is FALSE
Returns
integer The number of questions in the questionpool object public

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

References $ilDB, $result, $row, and array.

Referenced by _updateQuestionCount().

878  {
879  global $ilDB;
880  if ($complete_questions_only) {
881  $result = $ilDB->queryF(
882  "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",
883  array('integer', 'text'),
884  array($questionpool_id, 1)
885  );
886  } else {
887  $result = $ilDB->queryF(
888  "SELECT COUNT(question_id) question_count FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
889  array('integer'),
890  array($questionpool_id)
891  );
892  }
893  $row = $ilDB->fetchAssoc($result);
894  return $row["question_count"];
895  }
$result
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getQuestionTypes()

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

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

References $ilDB, $ilLog, ilObject\$lng, $result, $row, ilObjAssessmentFolder\_getForbiddenQuestionTypes(), array, ilPlugin\getPluginObject(), IL_COMP_MODULE, ilAssQuestionTypeOrderer\ORDER_MODE_ALPHA, and ilAssQuestionTypeOrderer\ORDER_MODE_FIX.

Referenced by _getSelfAssessmentQuestionTypes(), ilTestRandomQuestionSetPoolDefinitionFormGUI\build(), ilQuestionBrowserTableGUI\initFilter(), ilTestQuestionBrowserTableGUI\initFilter(), ilTestTaxonomyFilterLabelTranslater\loadTypeLabels(), ilObjAssessmentFolderGUI\saveSettingsObject(), and ilObjAssessmentFolderGUI\settingsObject().

1393  {
1394  global $ilDB;
1395  global $lng;
1396 
1397  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1399  $lng->loadLanguageModule("assessment");
1400  $result = $ilDB->query("SELECT * FROM qpl_qst_type");
1401  $types = array();
1402  while ($row = $ilDB->fetchAssoc($result)) {
1403  if ($all_tags || (!in_array($row["question_type_id"], $forbidden_types))) {
1404  global $ilLog;
1405 
1406  if ($row["plugin"] == 0) {
1407  $types[$lng->txt($row["type_tag"])] = $row;
1408  } else {
1409  global $ilPluginAdmin;
1410  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1411  foreach ($pl_names as $pl_name) {
1412  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1413  if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0) {
1414  $types[$pl->getQuestionTypeTranslation()] = $row;
1415  }
1416  }
1417  }
1418  }
1419  }
1420 
1421  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionTypeOrderer.php';
1423  $orderer = new ilAssQuestionTypeOrderer($types, $orderMode);
1424  $types = $orderer->getOrderedTypes();
1425 
1426  return $types;
1427  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
const ORDER_MODE_FIX
order mode with fixed priority for ordering
const ORDER_MODE_ALPHA
order mode that orders by alphanumerical priority
$result
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
const IL_COMP_MODULE
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSelfAssessmentQuestionTypes()

static& ilObjQuestionPool::_getSelfAssessmentQuestionTypes (   $all_tags = false)
static

Get all self assessment question types.

Todo:
Make it more flexible

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

References $t, _getQuestionTypes(), and array.

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

1476  {
1477  /* $allowed_types = array(
1478  "assSingleChoice" => 1,
1479  "assMultipleChoice" => 2,
1480  "assClozeTest" => 3,
1481  "assMatchingQuestion" => 4,
1482  "assOrderingQuestion" => 5,
1483  "assOrderingHorizontal" => 6,
1484  "assImagemapQuestion" => 7,
1485  "assTextQuestion" => 8,
1486  "assTextSubset" => 9,
1487  "assErrorText" => 10
1488  );*/
1489  $allowed_types = array(
1490  "assSingleChoice" => 1,
1491  "assMultipleChoice" => 2,
1492  "assKprimChoice" => 3,
1493  "assClozeTest" => 4,
1494  "assMatchingQuestion" => 5,
1495  "assOrderingQuestion" => 6,
1496  "assOrderingHorizontal" => 7,
1497  "assImagemapQuestion" => 8,
1498  "assTextSubset" => 9,
1499  "assErrorText" => 10,
1500  "assLongMenu" => 11
1501  );
1502  $satypes = array();
1503  $qtypes = ilObjQuestionPool::_getQuestionTypes($all_tags);
1504  foreach ($qtypes as $k => $t) {
1505  //if (in_array($t["type_tag"], $allowed_types))
1506  if (isset($allowed_types[$t["type_tag"]])) {
1507  $t["order"] = $allowed_types[$t["type_tag"]];
1508  $satypes[$k] = $t;
1509  }
1510  }
1511  return $satypes;
1512  }
static _getQuestionTypes($all_tags=false, $fixOrder=false)
Create styles array
The data for the language used.
+ 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 980 of file class.ilObjQuestionPool.php.

References $ilDB, $result, $row, and array.

Referenced by _getAvailableQuestionpools().

981  {
982  global $ilDB;
983 
984  if ($is_reference) {
985  $result = $ilDB->queryF(
986  "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",
987  array('integer'),
988  array($a_obj_id)
989  );
990  } else {
991  $result = $ilDB->queryF(
992  "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",
993  array('integer'),
994  array($a_obj_id)
995  );
996  }
997  if ($result->numRows() == 1) {
998  $row = $ilDB->fetchAssoc($result);
999  if ($row["equal_points"] == 1) {
1000  return 1;
1001  } else {
1002  return 0;
1003  }
1004  }
1005  return 0;
1006  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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 1120 of file class.ilObjQuestionPool.php.

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

Referenced by assQuestion\_isWriteable().

1121  {
1122  global $rbacsystem;
1123 
1124  include_once "./Services/Object/classes/class.ilObject.php";
1125  $refs = ilObject::_getAllReferences($object_id);
1126  if (count($refs)) {
1127  foreach ($refs as $ref_id) {
1128  if ($rbacsystem->checkAccess("write", $ref_id) && (ilObject::_hasUntrashedReference($object_id))) {
1129  return true;
1130  }
1131  }
1132  }
1133  return false;
1134  }
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupOnline()

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

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

References $ilDB, $result, $row, and array.

Referenced by ilObjQuestionPoolListGUI\getProperties(), and ilPoolSelectorGUI\isNodeVisible().

951  {
952  global $ilDB;
953 
954  if ($is_reference) {
955  $result = $ilDB->queryF(
956  "SELECT qpl_questionpool.isonline FROM qpl_questionpool,object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questionpool.obj_fi",
957  array('integer'),
958  array($a_obj_id)
959  );
960  } else {
961  $result = $ilDB->queryF(
962  "SELECT isonline FROM qpl_questionpool WHERE obj_fi = %s",
963  array('integer'),
964  array($a_obj_id)
965  );
966  }
967  if ($result->numRows() == 1) {
968  $row = $ilDB->fetchAssoc($result);
969  return $row["isonline"];
970  }
971  return 0;
972  }
$result
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _setImportDirectory()

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

set import directory

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

References $_SESSION.

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

750  {
751  if (strlen($a_import_dir)) {
752  $_SESSION["qpl_import_dir"] = $a_import_dir;
753  } else {
754  unset($_SESSION["qpl_import_dir"]);
755  }
756  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ _updateQuestionCount()

static ilObjQuestionPool::_updateQuestionCount (   $object_id)
static

Updates the number of available questions for a question pool in the database.

Parameters
integer$object_idObject id of the questionpool to examine public

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

References $ilDB, $result, _getQuestionCount(), array, and time.

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

1538  {
1539  global $ilDB;
1540  $result = $ilDB->manipulateF(
1541  "UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s",
1542  array('integer','integer','integer'),
1543  array(ilObjQuestionPool::_getQuestionCount($object_id, true), time(), $object_id)
1544  );
1545  }
$result
Create styles array
The data for the language used.
static _getQuestionCount($questionpool_id, $complete_questions_only=false)
Returns the number of questions in a question pool.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addQuestionChangeListeners()

ilObjQuestionPool::addQuestionChangeListeners ( assQuestion  $question)
Parameters
assQuestion$question

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

References $ilDB, assQuestion\addQuestionChangeListener(), ilObject\getId(), and ilObjTest\getPoolQuestionChangeListeners().

Referenced by deleteQuestion().

204  {
205  global $ilDB;
206 
207  foreach (ilObjTest::getPoolQuestionChangeListeners($ilDB, $this->getId()) as $listener) {
208  $question->addQuestionChangeListener($listener);
209  }
210  }
static getPoolQuestionChangeListeners(ilDBInterface $db, $poolObjId)
getId()
get object id public
global $ilDB
addQuestionChangeListener(ilQuestionChangeListener $listener)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkQuestionParent()

ilObjQuestionPool::checkQuestionParent (   $questionId)

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

References $DIC, $row, array, and ilObject\getId().

820  {
821  global $DIC; /* @var ILIAS\DI\Container $DIC */
822 
823  $row = $DIC->database()->fetchAssoc($DIC->database()->queryF(
824  "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
825  array('integer', 'integer'),
826  array($questionId, $this->getId())
827  ));
828 
829  return (bool) $row['cnt'];
830  }
global $DIC
Definition: saml.php:7
getId()
get object id public
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ cleanupClipboard()

ilObjQuestionPool::cleanupClipboard (   $deletedQuestionId)

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

References $_SESSION.

1097  {
1098  if (!isset($_SESSION['qpl_clipboard'])) {
1099  return;
1100  }
1101 
1102  if (!isset($_SESSION['qpl_clipboard'][$deletedQuestionId])) {
1103  return;
1104  }
1105 
1106  unset($_SESSION['qpl_clipboard'][$deletedQuestionId]);
1107 
1108  if (!count($_SESSION['qpl_clipboard'])) {
1109  unset($_SESSION['qpl_clipboard']);
1110  }
1111  }
$_SESSION["AccountId"]

◆ cloneObject()

ilObjQuestionPool::cloneObject (   $a_target_id,
  $a_copy_id = 0,
  $a_omit_tree = false 
)

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

public

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

References $ilLog, ilCopyWizardOptions\_getInstance(), array, ilObject\getId(), getOnline(), getQplQuestions(), getShowTaxonomies(), ilObject\getType(), and isSkillServiceEnabled().

1339  {
1340  global $ilLog;
1341 
1342  $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
1343 
1344  //copy online status if object is not the root copy object
1345  $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
1346 
1347  if (!$cp_options->isRootNode($this->getRefId())) {
1348  $newObj->setOnline($this->getOnline());
1349  }
1350 
1351  $newObj->setSkillServiceEnabled($this->isSkillServiceEnabled());
1352  $newObj->setShowTaxonomies($this->getShowTaxonomies());
1353  $newObj->saveToDb();
1354 
1355  // clone the questions in the question pool
1356  $questions =&$this->getQplQuestions();
1357  $questionIdsMap = array();
1358  foreach ($questions as $question_id) {
1359  $newQuestionId = $newObj->copyQuestion($question_id, $newObj->getId());
1360  $questionIdsMap[$question_id] = $newQuestionId;
1361  }
1362 
1363  // clone meta data
1364  include_once "./Services/MetaData/classes/class.ilMD.php";
1365  $md = new ilMD($this->getId(), 0, $this->getType());
1366  $new_md =&$md->cloneMD($newObj->getId(), 0, $newObj->getType());
1367 
1368  // update the metadata with the new title of the question pool
1369  $newObj->updateMetaData();
1370 
1371  require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
1372  $duplicator = new ilQuestionPoolTaxonomiesDuplicator();
1373  $duplicator->setSourceObjId($this->getId());
1374  $duplicator->setSourceObjType($this->getType());
1375  $duplicator->setTargetObjId($newObj->getId());
1376  $duplicator->setTargetObjType($newObj->getType());
1377  $duplicator->setQuestionIdMapping($questionIdsMap);
1378  $duplicator->duplicate($duplicator->getAllTaxonomiesForSourceObject());
1379 
1380  $duplicatedTaxKeyMap = $duplicator->getDuplicatedTaxonomiesKeysMap();
1381  $newObj->setNavTaxonomyId($duplicatedTaxKeyMap->getMappedTaxonomyId($this->getNavTaxonomyId()));
1382  $newObj->saveToDb();
1383 
1384  return $newObj;
1385  }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getId()
get object id public
getType()
get object type public
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ copyQuestion()

ilObjQuestionPool::copyQuestion (   $question_id,
  $questionpool_to 
)

Copies a question into another question pool.

Parameters
integer$question_idDatabase id of the question
integer$questionpool_toDatabase id of the target questionpool public

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

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

Referenced by pasteFromClipboard().

406  {
407  $question_gui =&$this->createQuestion("", $question_id);
408  if ($question_gui->object->getObjId() == $questionpool_to) {
409  // the question is copied into the same question pool
410  return $this->duplicateQuestion($question_id);
411  } else {
412  // the question is copied into another question pool
413  $newtitle = $question_gui->object->getTitle();
414  if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle())) {
415  $counter = 2;
416  while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() . " ($counter)")) {
417  $counter++;
418  }
419  $newtitle = $question_gui->object->getTitle() . " ($counter)";
420  }
421  return $question_gui->object->copyObject($this->getId(), $newtitle);
422  }
423  }
$counter
duplicateQuestion($question_id)
Duplicates a question for a questionpool.
getId()
get object id public
& createQuestion($question_type, $question_id=-1)
+ 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 1074 of file class.ilObjQuestionPool.php.

References $_SESSION, and array.

1075  {
1076  if (!array_key_exists("qpl_clipboard", $_SESSION)) {
1077  $_SESSION["qpl_clipboard"] = array();
1078  }
1079  $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "copy");
1080  }
$_SESSION["AccountId"]
Create styles array
The data for the language used.

◆ create()

ilObjQuestionPool::create (   $a_upload = false)

create questionpool object

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

References ilObject\createMetaData().

69  {
70  parent::create();
71 
72  // meta data will be created by
73  // import parser
74  if (!$a_upload) {
75  $this->createMetaData();
76  }
77  }
createMetaData()
create meta data entry
+ 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 670 of file class.ilObjQuestionPool.php.

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

671  {
672  include_once "./Services/Utilities/classes/class.ilUtil.php";
673  $qpl_data_dir = ilUtil::getDataDir() . "/qpl_data";
674  ilUtil::makeDir($qpl_data_dir);
675  if (!is_writable($qpl_data_dir)) {
676  $this->ilias->raiseError("Questionpool Data Directory (" . $qpl_data_dir
677  . ") not writeable.", $this->ilias->error_obj->FATAL);
678  }
679 
680  // create learning module directory (data_dir/lm_data/lm_<id>)
681  $qpl_dir = $qpl_data_dir . "/qpl_" . $this->getId();
682  ilUtil::makeDir($qpl_dir);
683  if (!@is_dir($qpl_dir)) {
684  $this->ilias->raiseError("Creation of Questionpool Directory failed.", $this->ilias->error_obj->FATAL);
685  }
686  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
687  ilUtil::makeDir($this->getExportDirectory('xls'));
688  if (!@is_dir($this->getExportDirectory('xls'))) {
689  $this->ilias->raiseError("Creation of Export Directory failed.", $this->ilias->error_obj->FATAL);
690  }
691  ilUtil::makeDir($this->getExportDirectory('zip'));
692  if (!@is_dir($this->getExportDirectory('zip'))) {
693  $this->ilias->raiseError("Creation of Export Directory failed.", $this->ilias->error_obj->FATAL);
694  }
695  }
getExportDirectory($type="")
get export directory of questionpool
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:

◆ createQuestion()

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

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

References assQuestion\_includeClass(), and assQuestion\_instanciateQuestionGUI().

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

364  {
365  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
366  if ($question_id > 0) {
367  return assQuestion::_instanciateQuestionGUI($question_id);
368  }
369  assQuestion::_includeClass($question_type, 1);
370  $question_type_gui = $question_type . "GUI";
371  $question_gui = new $question_type_gui();
372  return $question_gui;
373  }
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static & _instanciateQuestionGUI($question_id)
Creates an instance of a question gui with a given 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 85 of file class.ilObjQuestionPool.php.

References $result, and saveToDb().

86  {
87  $result = parent::createReference();
88  $this->saveToDb();
89  return $result;
90  }
$result
saveToDb()
Saves a ilObjQuestionpool object to a database.
+ 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 144 of file class.ilObjQuestionPool.php.

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

145  {
146  // always call parent delete function first!!
147  if (!parent::delete()) {
148  return false;
149  }
150 
151  // delete meta data
152  $this->deleteMetaData();
153 
154  //put here your module specific stuff
155  $this->deleteQuestionpool();
156 
157  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
158  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->getId());
159  $qsaImportFails->deleteRegisteredImportFails();
160 
161  return true;
162  }
getId()
get object id public
deleteMetaData()
delete meta data entry
+ Here is the call graph for this function:

◆ deleteQuestion()

ilObjQuestionPool::deleteQuestion (   $question_id)

Deletes a question from the question pool.

Parameters
integer$question_idThe database id of the question private

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

References assQuestion\_instanciateQuestion(), and addQuestionChangeListeners().

Referenced by deleteQuestionpool().

191  {
192  include_once "./Modules/Test/classes/class.ilObjTest.php";
193  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
194 
195  $question = assQuestion::_instanciateQuestion($question_id);
196  $this->addQuestionChangeListeners($question);
197  $question->delete($question_id);
198  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
addQuestionChangeListeners(assQuestion $question)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteQuestionpool()

ilObjQuestionPool::deleteQuestionpool ( )

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

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

Referenced by delete().

165  {
166  $questions =&$this->getAllQuestions();
167 
168  if (count($questions)) {
169  foreach ($questions as $question_id) {
170  $this->deleteQuestion($question_id);
171  }
172  }
173 
174  // delete export files
175  include_once "./Services/Utilities/classes/class.ilUtil.php";
176  $qpl_data_dir = ilUtil::getDataDir() . "/qpl_data";
177  $directory = $qpl_data_dir . "/qpl_" . $this->getId();
178  if (is_dir($directory)) {
179  include_once "./Services/Utilities/classes/class.ilUtil.php";
180  ilUtil::delDir($directory);
181  }
182  }
deleteQuestion($question_id)
Deletes a question from the question pool.
getId()
get object id public
& getAllQuestions()
Retrieve an array containing all question ids of the questionpool.
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateQuestion()

ilObjQuestionPool::duplicateQuestion (   $question_id)

Duplicates a question for a questionpool.

Parameters
integer$question_idThe database id of the question public

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

References $counter, _updateQuestionCount(), createQuestion(), and ilObject\getId().

Referenced by copyQuestion().

382  {
383  $question =&$this->createQuestion("", $question_id);
384  $newtitle = $question->object->getTitle();
385  if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle())) {
386  $counter = 2;
387  while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() . " ($counter)")) {
388  $counter++;
389  }
390  $newtitle = $question->object->getTitle() . " ($counter)";
391  }
392  $new_id = $question->object->duplicate(false, $newtitle);
393  // update question count of question pool
395  return $new_id;
396  }
$counter
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
getId()
get object id public
& createQuestion($question_type, $question_id=-1)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportFileItems()

ilObjQuestionPool::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

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

References date.

Referenced by objectToXmlWriter().

654  {
655  include_once("./Modules/File/classes/class.ilObjFile.php");
656 
657  foreach ($this->file_ids as $file_id) {
658  $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
659  $file_obj = new ilObjFile($file_id, false);
660  $file_obj->export($a_target_dir);
661  unset($file_obj);
662  }
663  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
+ Here is the caller graph for this function:

◆ exportXMLMediaObjects()

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

export media objects to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

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

References ilObjMediaObject\_exists(), and date.

Referenced by objectToXmlWriter().

635  {
636  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
637 
638  foreach ($this->mob_ids as $mob_id) {
639  $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
640  if (ilObjMediaObject::_exists($mob_id)) {
641  $media_obj = new ilObjMediaObject($mob_id);
642  $media_obj->exportXML($a_xml_writer, $a_inst);
643  $media_obj->exportFiles($a_target_dir);
644  unset($media_obj);
645  }
646  }
647  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Class ilObjMediaObject.
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
+ 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 548 of file class.ilObjQuestionPool.php.

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

Referenced by objectToXmlWriter().

549  {
550  include_once("Services/MetaData/classes/class.ilMD2XML.php");
551  $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
552  $md2xml->setExportMode(true);
553  $md2xml->startExport();
554  $a_xml_writer->appendXML($md2xml->getXML());
555  }
getId()
get object id public
getType()
get object type public
+ 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 574 of file class.ilObjQuestionPool.php.

References $ilBench, $xml, array, ilPCFileList\collectFileItems(), and date.

Referenced by objectToXmlWriter().

575  {
576  global $ilBench;
577 
578  include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
579 
580  foreach ($questions as $question_id) {
581  $ilBench->start("ContentObjectExport", "exportPageObject");
582  $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $question_id);
583 
584  $attrs = array();
585  $a_xml_writer->xmlStartTag("PageObject", $attrs);
586 
587 
588  // export xml to writer object
589  $ilBench->start("ContentObjectExport", "exportPageObject_XML");
590  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
591  $page_object = new ilAssQuestionPage($question_id);
592  $page_object->buildDom();
593  $page_object->insertInstIntoIDs($a_inst);
594  $mob_ids = $page_object->collectMediaObjects(false);
595  require_once 'Services/COPage/classes/class.ilPCFileList.php';
596  $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
597  $xml = $page_object->getXMLFromDom(false, false, false, "", true);
598  $xml = str_replace("&", "&amp;", $xml);
599  $a_xml_writer->appendXML($xml);
600  $page_object->freeDom();
601  unset($page_object);
602 
603  $ilBench->stop("ContentObjectExport", "exportPageObject_XML");
604 
605  // collect media objects
606  $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
607  //$mob_ids = $page_obj->getMediaObjectIDs();
608  foreach ($mob_ids as $mob_id) {
609  $this->mob_ids[$mob_id] = $mob_id;
610  }
611  $ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
612 
613  // collect all file items
614  $ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
615  //$file_ids = $page_obj->getFileItemIds();
616  foreach ($file_ids as $file_id) {
617  $this->file_ids[$file_id] = $file_id;
618  }
619  $ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
620 
621  $a_xml_writer->xmlEndTag("PageObject");
622  //unset($page_obj);
623 
624  $ilBench->stop("ContentObjectExport", "exportPageObject");
625  }
626  }
Question page object.
$xml
Definition: metadata.php:240
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
Create styles array
The data for the language used.
global $ilBench
Definition: ilias.php:18
+ 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 459 of file class.ilObjQuestionPool.php.

References getNavTaxonomyId(), getShowTaxonomies(), and isSkillServiceEnabled().

Referenced by objectToXmlWriter().

460  {
461  $xmlWriter->xmlStartTag('Settings');
462 
463  $xmlWriter->xmlElement('ShowTaxonomies', null, (int) $this->getShowTaxonomies());
464  $xmlWriter->xmlElement('NavTaxonomy', null, (int) $this->getNavTaxonomyId());
465  $xmlWriter->xmlElement('SkillService', null, (int) $this->isSkillServiceEnabled());
466 
467  $xmlWriter->xmlEndTag('Settings');
468  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromXML()

ilObjQuestionPool::fromXML (   $xmlFile)

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

References $parser.

1630  {
1631  require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php';
1632  $parser = new ilObjQuestionPoolXMLParser($this, $xmlFile);
1633  $parser->startParsing();
1634  }
$parser
Definition: BPMN2Parser.php:23

◆ getAllQuestionIds()

& ilObjQuestionPool::getAllQuestionIds ( )

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

References $ilDB, $row, array, ilObject\getId(), and isPluginActive().

796  {
797  global $ilDB;
798 
799  $query_result = $ilDB->queryF(
800  "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",
801  array('integer','text'),
802  array($this->getId(), 1)
803  );
804  $questions = array();
805  if ($query_result->numRows()) {
806  while ($row = $ilDB->fetchAssoc($query_result)) {
807  if ($row["plugin"]) {
808  if ($this->isPluginActive($row["type_tag"])) {
809  array_push($questions, $row["question_id"]);
810  }
811  } else {
812  array_push($questions, $row["question_id"]);
813  }
814  }
815  }
816  return $questions;
817  }
getId()
get object id public
Create styles array
The data for the language used.
isPluginActive($questionType)
Checks wheather or not a question plugin with a given name is active.
global $ilDB
+ 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 779 of file class.ilObjQuestionPool.php.

References $ilDB, $result, $row, array, and ilObject\getId().

Referenced by deleteQuestionpool().

780  {
781  global $ilDB;
782 
783  $result = $ilDB->queryF(
784  "SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
785  array('integer'),
786  array($this->getId())
787  );
788  $questions = array();
789  while ($row = $ilDB->fetchAssoc($result)) {
790  array_push($questions, $row["question_id"]);
791  }
792  return $questions;
793  }
$result
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
+ 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 1165 of file class.ilObjQuestionPool.php.

References $ilDB, $ilLog, $result, $row, assQuestion\_isUsedInRandomTest(), array, and createQuestion().

1166  {
1167  global $ilDB, $ilLog;
1168 
1169  $result = array();
1170  $query_result = $ilDB->query("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('qpl_questions.question_id', $question_ids, false, 'integer') . " ORDER BY qpl_questions.title");
1171  if ($query_result->numRows()) {
1172  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1173  while ($row = $ilDB->fetchAssoc($query_result)) {
1174  if (!assQuestion::_isUsedInRandomTest($row["question_id"])) {
1175  array_push($result, $row);
1176  } else {
1177  // the question was used in a random test prior to ILIAS 3.7 so it was inserted
1178  // as a reference to the original question pool object and not as a copy. To allow
1179  // the deletion of the question pool object, a copy must be created and all database references
1180  // of the original question must changed with the reference of the copy
1181 
1182  // 1. Create a copy of the original question
1183  $question =&$this->createQuestion("", $row["question_id"]);
1184  $duplicate_id = $question->object->duplicate(true);
1185  if ($duplicate_id > 0) {
1186  // 2. replace the question id in the solutions
1187  $affectedRows = $ilDB->manipulateF(
1188  "UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
1189  array('integer','integer'),
1190  array($duplicate_id, $row["question_id"])
1191  );
1192 
1193  // 3. replace the question id in the question list of random tests
1194  $affectedRows = $ilDB->manipulateF(
1195  "UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s",
1196  array('integer','integer'),
1197  array($duplicate_id, $row["question_id"])
1198  );
1199 
1200  // 4. replace the question id in the test results
1201  $affectedRows = $ilDB->manipulateF(
1202  "UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
1203  array('integer','integer'),
1204  array($duplicate_id, $row["question_id"])
1205  );
1206 
1207  // 5. replace the question id in the test&assessment log
1208  $affectedRows = $ilDB->manipulateF(
1209  "UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
1210  array('integer','integer'),
1211  array($duplicate_id, $row["question_id"])
1212  );
1213 
1214  // 6. The original question can be deleted, so add it to the list of questions
1215  array_push($result, $row);
1216  }
1217  }
1218  }
1219  }
1220  return $result;
1221  }
$result
static _isUsedInRandomTest($question_id="")
Checks whether the question is used in a random test or not.
& createQuestion($question_type, $question_id=-1)
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getDescription()

ilObjQuestionPool::getDescription ( )

get description of content object

Returns
string description

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

313  {
314  return parent::getDescription();
315  }

◆ getExportDirectory()

ilObjQuestionPool::getExportDirectory (   $type = "")

get export directory of questionpool

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

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

Referenced by createExportDirectory().

701  {
702  include_once "./Services/Utilities/classes/class.ilUtil.php";
703  switch ($type) {
704  case 'xml':
705  include_once("./Services/Export/classes/class.ilExport.php");
706  $export_dir = ilExport::_getExportDirectory($this->getId(), $type, $this->getType());
707  break;
708  case 'xls':
709  case 'zip':
710  $export_dir = ilUtil::getDataDir() . "/qpl_data" . "/qpl_" . $this->getId() . "/export_$type";
711  break;
712  default:
713  $export_dir = ilUtil::getDataDir() . "/qpl_data" . "/qpl_" . $this->getId() . "/export";
714  break;
715  }
716  return $export_dir;
717  }
getId()
get object id public
getType()
get object type public
static getDataDir()
get data directory (outside webspace)
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImportDirectory()

ilObjQuestionPool::getImportDirectory ( )

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

References _getImportDirectory().

770  {
772  }
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 836 of file class.ilObjQuestionPool.php.

References array.

837  {
838  if (!is_array($this->import_mapping)) {
839  return array();
840  } else {
841  return $this->import_mapping;
842  }
843  }
Create styles array
The data for the language used.

◆ getNavTaxonomyId()

ilObjQuestionPool::getNavTaxonomyId ( )

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

References $navTaxonomyId.

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

941  {
942  return $this->navTaxonomyId;
943  }
+ Here is the caller graph for this function:

◆ getOnline()

ilObjQuestionPool::getOnline ( )

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

References $online.

Referenced by cloneObject(), and saveToDb().

918  {
919  if (strcmp($this->online, "") == 0) {
920  $this->online = "0";
921  }
922  return $this->online;
923  }
+ Here is the caller graph for this function:

◆ getPrintviewQuestions()

ilObjQuestionPool::getPrintviewQuestions ( )

Calculates the data for the print view of the questionpool.

public

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

References $ilDB, $row, $rows, array, ilObject\getId(), getQuestionTypeTranslations(), and isPluginActive().

431  {
432  global $ilDB;
433 
434  $query_result = $ilDB->queryF(
435  "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",
436  array('integer'),
437  array($this->getId())
438  );
439  $rows = array();
440  $types = $this->getQuestionTypeTranslations();
441  if ($query_result->numRows()) {
442  while ($row = $ilDB->fetchAssoc($query_result)) {
443  $row['ttype'] = $types[$row['type_tag']];
444  if ($row["plugin"]) {
445  if ($this->isPluginActive($row["type_tag"])) {
446  array_push($rows, $row);
447  }
448  } else {
449  array_push($rows, $row);
450  }
451  }
452  }
453  return $rows;
454  }
getId()
get object id public
Create styles array
The data for the language used.
$rows
Definition: xhr_table.php:10
isPluginActive($questionType)
Checks wheather or not a question plugin with a given name is active.
global $ilDB
+ Here is the call graph for this function:

◆ getQplQuestions()

& ilObjQuestionPool::getQplQuestions ( )

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

References $ilDB, $result, $row, array, and ilObject\getId().

Referenced by cloneObject().

1318  {
1319  global $ilDB;
1320 
1321  $questions = array();
1322  $result = $ilDB->queryF(
1323  "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",
1324  array('integer'),
1325  array($this->getId())
1326  );
1327  while ($row = $ilDB->fetchAssoc($result)) {
1328  array_push($questions, $row["question_id"]);
1329  }
1330  return $questions;
1331  }
$result
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
+ 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 1143 of file class.ilObjQuestionPool.php.

References $ilDB, $result, $row, and array.

1144  {
1145  global $ilDB;
1146 
1147  $result = array();
1148  $query_result = $ilDB->query("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('qpl_questions.question_id', $question_ids, false, 'integer') . " ORDER BY qpl_questions.title");
1149  if ($query_result->numRows()) {
1150  while ($row = $ilDB->fetchAssoc($query_result)) {
1151  array_push($result, $row);
1152  }
1153  }
1154  return $result;
1155  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ getQuestionList()

& ilObjQuestionPool::getQuestionList ( )

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

References $ilDB, $result, $row, array, and ilObject\getId().

1516  {
1517  global $ilDB;
1518 
1519  $questions = array();
1520  $result = $ilDB->queryF(
1521  "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",
1522  array('integer'),
1523  array($this->getId())
1524  );
1525  while ($row = $ilDB->fetchAssoc($result)) {
1526  array_push($questions, $row);
1527  }
1528  return $questions;
1529  }
$result
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getQuestiontype()

ilObjQuestionPool::getQuestiontype (   $question_id)

Returns the question type of a question with a given id.

Parameters
integer$question_idThe database id of the question
Returns
string The question type string private

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

References $data, $ilDB, $result, and array.

287  {
288  global $ilDB;
289 
290  if ($question_id < 1) {
291  return;
292  }
293 
294  $result = $ilDB->queryF(
295  "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",
296  array('integer'),
297  array($question_id)
298  );
299  if ($result->numRows() == 1) {
300  $data = $ilDB->fetchAssoc($result);
301  return $data["type_tag"];
302  } else {
303  return;
304  }
305  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ getQuestionTypeByTypeId()

static ilObjQuestionPool::getQuestionTypeByTypeId (   $type_id)
static

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

References $ilDB, $query, $result, $row, and array.

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

1430  {
1431  global $ilDB;
1432 
1433  $query = "SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s";
1434  $types = array('integer');
1435  $values = array($type_id);
1436  $result = $ilDB->queryF($query, $types, $values);
1437 
1438  if ($row = $ilDB->fetchAssoc($result)) {
1439  return $row['type_tag'];
1440  }
1441  }
$result
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getQuestionTypes()

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

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

1388  {
1389  return self::_getQuestionTypes($all_tags, $fixOrder);
1390  }

◆ getQuestionTypeTranslations()

static ilObjQuestionPool::getQuestionTypeTranslations ( )
static

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

References $ilDB, $ilLog, ilObject\$lng, $result, $row, array, ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by getPrintviewQuestions().

1444  {
1445  global $ilDB;
1446  global $lng;
1447  global $ilLog;
1448  global $ilPluginAdmin;
1449 
1450  $lng->loadLanguageModule("assessment");
1451  $result = $ilDB->query("SELECT * FROM qpl_qst_type");
1452  $types = array();
1453  while ($row = $ilDB->fetchAssoc($result)) {
1454  if ($row["plugin"] == 0) {
1455  $types[$row['type_tag']] = $lng->txt($row["type_tag"]);
1456  } else {
1457  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1458  foreach ($pl_names as $pl_name) {
1459  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1460  if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0) {
1461  $types[$row['type_tag']] = $pl->getQuestionTypeTranslation();
1462  }
1463  }
1464  }
1465  }
1466  ksort($types);
1467  return $types;
1468  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
$result
const IL_COMP_MODULE
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShowTaxonomies()

ilObjQuestionPool::getShowTaxonomies ( )

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

References $showTaxonomies.

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

931  {
932  return $this->showTaxonomies;
933  }
+ 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 1593 of file class.ilObjQuestionPool.php.

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

1594  {
1595  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1596  return ilObjTaxonomy::getUsageOfObject($this->getId());
1597  }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
getId()
get object id public
+ Here is the call graph for this function:

◆ getTitle()

ilObjQuestionPool::getTitle ( )

get title of glossary object

Returns
string title

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

Referenced by updateMetaData().

331  {
332  return parent::getTitle();
333  }
+ Here is the caller graph for this function:

◆ isInUse()

ilObjQuestionPool::isInUse (   $question_id)

Checks whether the question is in use or not.

Parameters
integer$question_idThe question id of the question to be checked
Returns
boolean The number of datasets which are affected by the use of the query. public

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

References $ilDB, $result, $row, and array.

351  {
352  global $ilDB;
353 
354  $result = $ilDB->queryF(
355  "SELECT COUNT(solution_id) solution_count FROM tst_solutions WHERE question_fi = %s",
356  array('integer'),
357  array($question_id)
358  );
359  $row = $ilDB->fetchAssoc($result);
360  return $row["solution_count"];
361  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ isNavTaxonomyActive()

ilObjQuestionPool::isNavTaxonomyActive ( )

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

References getNavTaxonomyId(), and getShowTaxonomies().

946  {
947  return $this->getShowTaxonomies() && (int) $this->getNavTaxonomyId();
948  }
+ Here is the call graph for this function:

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

References ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by getAllQuestionIds(), and getPrintviewQuestions().

1554  {
1555  /* @var ilPluginAdmin $ilPluginAdmin */
1556  global $ilPluginAdmin;
1557 
1558  $plugins = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1559  foreach ($plugins as $pluginName) {
1560  if ($pluginName == $questionType) { // plugins having pname == qtype
1561  return true;
1562  }
1563 
1564  /* @var ilQuestionsPlugin $plugin */
1565  $plugin = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pluginName);
1566 
1567  if ($plugin->getQuestionType() == $questionType) { // plugins havin an independent name
1568  return true;
1569  }
1570  }
1571 
1572  return false;
1573  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
const IL_COMP_MODULE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSkillManagementGloballyActivated()

static ilObjQuestionPool::isSkillManagementGloballyActivated ( )
static

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

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

1618  {
1619  if (self::$isSkillManagementGloballyActivated === null) {
1620  include_once 'Services/Skill/classes/class.ilSkillManagementSettings.php';
1621  $skmgSet = new ilSkillManagementSettings();
1622 
1623  self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
1624  }
1625 
1626  return self::$isSkillManagementGloballyActivated;
1627  }
+ Here is the caller graph for this function:

◆ isSkillServiceEnabled()

ilObjQuestionPool::isSkillServiceEnabled ( )
Returns
boolean

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

References $skillServiceEnabled.

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

1603  {
1605  }
+ Here is the caller graph for this function:

◆ loadFromDb()

ilObjQuestionPool::loadFromDb ( )

Loads a ilObjQuestionpool object from a database.

public

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

References $ilDB, $result, $row, array, ilObject\getId(), setNavTaxonomyId(), setOnline(), setShowTaxonomies(), and setSkillServiceEnabled().

Referenced by read().

218  {
219  global $ilDB;
220 
221  $result = $ilDB->queryF(
222  "SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
223  array('integer'),
224  array($this->getId())
225  );
226  if ($result->numRows() == 1) {
227  $row = $ilDB->fetchAssoc($result);
228  $this->setOnline($row['isonline']);
229  $this->setShowTaxonomies($row['show_taxonomies']);
230  $this->setNavTaxonomyId($row['nav_taxonomy']);
231  $this->setSkillServiceEnabled($row['skill_service']);
232  }
233  }
$result
setNavTaxonomyId($navTaxonomyId)
setOnline($a_online_status)
Sets the questionpool online status.
setSkillServiceEnabled($skillServiceEnabled)
setShowTaxonomies($showTaxonomies)
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
+ 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 557 of file class.ilObjQuestionPool.php.

References ilUtil\insertInstIntoID().

558  {
559  if ($a_tag == "Identifier" && $a_param == "Entry") {
560  include_once "./Services/Utilities/classes/class.ilUtil.php";
561  $a_value = ilUtil::insertInstIntoID($a_value);
562  }
563 
564  return $a_value;
565  }
static insertInstIntoID($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 1088 of file class.ilObjQuestionPool.php.

References $_SESSION, and array.

1089  {
1090  if (!array_key_exists("qpl_clipboard", $_SESSION)) {
1091  $_SESSION["qpl_clipboard"] = array();
1092  }
1093  $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "move");
1094  }
$_SESSION["AccountId"]
Create styles array
The data for the language used.

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

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

477  {
478  global $ilBench;
479 
480  $this->mob_ids = array();
481  $this->file_ids = array();
482 
483  $attrs = array();
484  $attrs["Type"] = "Questionpool_Test";
485  $a_xml_writer->xmlStartTag("ContentObject", $attrs);
486 
487  // MetaData
488  $this->exportXMLMetaData($a_xml_writer);
489 
490  // Settings
491  $this->exportXMLSettings($a_xml_writer);
492 
493  // PageObjects
494  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Page Objects");
495  $ilBench->start("ContentObjectExport", "exportPageObjects");
496  $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog, $questions);
497  $ilBench->stop("ContentObjectExport", "exportPageObjects");
498  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Page Objects");
499 
500  // MediaObjects
501  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Media Objects");
502  $ilBench->start("ContentObjectExport", "exportMediaObjects");
503  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
504  $ilBench->stop("ContentObjectExport", "exportMediaObjects");
505  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Media Objects");
506 
507  // FileItems
508  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export File Items");
509  $ilBench->start("ContentObjectExport", "exportFileItems");
510  $this->exportFileItems($a_target_dir, $expLog);
511  $ilBench->stop("ContentObjectExport", "exportFileItems");
512  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export File Items");
513 
514  // skill assignments
515  $this->populateQuestionSkillAssignmentsXml($a_xml_writer, $questions);
516 
517  $a_xml_writer->xmlEndTag("ContentObject");
518  }
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
export page objects to xml (see ilias_co.dtd)
populateQuestionSkillAssignmentsXml(ilXmlWriter &$a_xml_writer, $questions)
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
xmlEndTag($tag)
Writes an endtag.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ pasteFromClipboard()

ilObjQuestionPool::pasteFromClipboard ( )

Copies/Moves a question from the clipboard.

private

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

References $_SESSION, $ilDB, $result, $row, $success, _updateQuestionCount(), array, copyQuestion(), ilObject\getId(), and ilUtil\makeDirParents().

1014  {
1015  global $ilDB;
1016 
1017  $success = false;
1018  if (array_key_exists("qpl_clipboard", $_SESSION)) {
1019  $success = true;
1020  foreach ($_SESSION["qpl_clipboard"] as $question_object) {
1021  if (strcmp($question_object["action"], "move") == 0) {
1022  $result = $ilDB->queryF(
1023  "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1024  array('integer'),
1025  array($question_object["question_id"])
1026  );
1027  if ($result->numRows() == 1) {
1028  $row = $ilDB->fetchAssoc($result);
1029  $source_questionpool = $row["obj_fi"];
1030  // change the questionpool id in the qpl_questions table
1031  $affectedRows = $ilDB->manipulateF(
1032  "UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
1033  array('integer','integer'),
1034  array($this->getId(), $question_object["question_id"])
1035  );
1036  if (!$affectedRows) {
1037  $success = false;
1038  }
1039 
1040  // move question data to the new target directory
1041  $source_path = CLIENT_WEB_DIR . "/assessment/" . $source_questionpool . "/" . $question_object["question_id"] . "/";
1042  if (@is_dir($source_path)) {
1043  $target_path = CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/";
1044  if (!@is_dir($target_path)) {
1045  include_once "./Services/Utilities/classes/class.ilUtil.php";
1046  ilUtil::makeDirParents($target_path);
1047  }
1048  rename($source_path, $target_path . $question_object["question_id"]);
1049  }
1050  // update question count of source question pool
1051  ilObjQuestionPool::_updateQuestionCount($source_questionpool);
1052  }
1053  } else {
1054  $new_question_id = $this->copyQuestion($question_object["question_id"], $this->getId());
1055  if (!$new_question_id) {
1056  $success = false;
1057  }
1058  }
1059  }
1060  }
1061  // update question count of question pool
1063  unset($_SESSION["qpl_clipboard"]);
1064 
1065  return (bool) $success;
1066  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
$_SESSION["AccountId"]
$result
copyQuestion($question_id, $questionpool_to)
Copies a question into another question pool.
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
$success
Definition: Utf8Test.php:86
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
+ 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 524 of file class.ilObjQuestionPool.php.

References $ilDB, and ilObject\getId().

Referenced by objectToXmlWriter().

525  {
526  global $ilDB;
527 
528  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
529  $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
530  $assignmentList->setParentObjId($this->getId());
531  $assignmentList->loadFromDb();
532  $assignmentList->loadAdditionalSkillData();
533 
534  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentExporter.php';
535  $skillQuestionAssignmentExporter = new ilAssQuestionSkillAssignmentExporter();
536  $skillQuestionAssignmentExporter->setXmlWriter($a_xml_writer);
537  $skillQuestionAssignmentExporter->setQuestionIds($questions);
538  $skillQuestionAssignmentExporter->setAssignmentList($assignmentList);
539  $skillQuestionAssignmentExporter->export();
540  }
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ purgeQuestions()

ilObjQuestionPool::purgeQuestions ( )

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

References $ilDB, and $ilUser.

1579  {
1580  global $ilDB, $ilUser;
1581 
1582  require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
1583  $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
1584  $incompleteQuestionPurger->setOwnerId($ilUser->getId());
1585  $incompleteQuestionPurger->purge();
1586  }
$ilUser
Definition: imgupload.php:18
global $ilDB

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

References $key, $xml, and createQuestion().

853  {
854  $xml = "";
855  // export button was pressed
856  if (count($questions) > 0) {
857  foreach ($questions as $key => $value) {
858  $question =&$this->createQuestion("", $value);
859  $xml .= $question->object->toXML();
860  }
861  if (count($questions) > 1) {
862  $xml = preg_replace("/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/", "", $xml);
863  }
864  }
865  $xml = preg_replace("/(<\?xml[^>]*?>)/", "\\1" . "<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", $xml);
866  return $xml;
867  }
$xml
Definition: metadata.php:240
& createQuestion($question_type, $question_id=-1)
$key
Definition: croninfo.php:18
+ 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 131 of file class.ilObjQuestionPool.php.

References loadFromDb().

132  {
133  parent::read($a_force_db);
134  $this->loadFromDb();
135  }
loadFromDb()
Loads a ilObjQuestionpool object from a database.
+ Here is the call graph for this function:

◆ saveToDb()

ilObjQuestionPool::saveToDb ( )

Saves a ilObjQuestionpool object to a database.

public

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

References $ilDB, $result, array, ilObject\getId(), getNavTaxonomyId(), getOnline(), getShowTaxonomies(), isSkillServiceEnabled(), and time.

Referenced by createReference().

241  {
242  global $ilDB;
243 
244  $result = $ilDB->queryF(
245  "SELECT id_questionpool FROM qpl_questionpool WHERE obj_fi = %s",
246  array('integer'),
247  array($this->getId())
248  );
249 
250  if ($result->numRows() == 1) {
251  $result = $ilDB->update(
252  'qpl_questionpool',
253  array(
254  'isonline' => array('text', $this->getOnline()),
255  'show_taxonomies' => array('integer', (int) $this->getShowTaxonomies()),
256  'nav_taxonomy' => array('integer', (int) $this->getNavTaxonomyId()),
257  'skill_service' => array('integer', (int) $this->isSkillServiceEnabled()),
258  'tstamp' => array('integer', time())
259  ),
260  array(
261  'obj_fi' => array('integer', $this->getId())
262  )
263  );
264  } else {
265  $next_id = $ilDB->nextId('qpl_questionpool');
266 
267  $result = $ilDB->insert('qpl_questionpool', array(
268  'id_questionpool' => array('integer', $next_id),
269  'isonline' => array('text', $this->getOnline()),
270  'show_taxonomies' => array('integer', (int) $this->getShowTaxonomies()),
271  'nav_taxonomy' => array('integer', (int) $this->getNavTaxonomyId()),
272  'skill_service' => array('integer', (int) $this->isSkillServiceEnabled()),
273  'tstamp' => array('integer', time()),
274  'obj_fi' => array('integer', $this->getId())
275  ));
276  }
277  }
$result
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

ilObjQuestionPool::setDescription (   $a_description)

set description of content object

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

321  {
322  parent::setDescription($a_description);
323  }

◆ setNavTaxonomyId()

ilObjQuestionPool::setNavTaxonomyId (   $navTaxonomyId)

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

References $navTaxonomyId.

Referenced by loadFromDb().

936  {
937  $this->navTaxonomyId = $navTaxonomyId;
938  }
+ Here is the caller graph for this function:

◆ setOnline()

ilObjQuestionPool::setOnline (   $a_online_status)

Sets the questionpool online status.

Parameters
integer$a_online_statusOnline status of the questionpool
See also
online User interface

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

Referenced by __construct(), and loadFromDb().

905  {
906  switch ($a_online_status) {
907  case 0:
908  case 1:
909  $this->online = $a_online_status;
910  break;
911  default:
912  $this->online = 0;
913  break;
914  }
915  }
+ Here is the caller graph for this function:

◆ setShowTaxonomies()

ilObjQuestionPool::setShowTaxonomies (   $showTaxonomies)

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

References $showTaxonomies.

Referenced by loadFromDb().

926  {
927  $this->showTaxonomies = $showTaxonomies;
928  }
+ Here is the caller graph for this function:

◆ setSkillServiceEnabled()

ilObjQuestionPool::setSkillServiceEnabled (   $skillServiceEnabled)
Parameters
boolean$skillServiceEnabled

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

References $skillServiceEnabled.

Referenced by loadFromDb().

1611  {
1612  $this->skillServiceEnabled = $skillServiceEnabled;
1613  }
+ Here is the caller graph for this function:

◆ setTitle()

ilObjQuestionPool::setTitle (   $a_title)

set title of glossary object

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

339  {
340  parent::setTitle($a_title);
341  }

◆ update()

ilObjQuestionPool::update ( )

update object data

public

Returns
boolean

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

References League\Flysystem\Adapter\Polyfill\update(), and updateMetaData().

99  {
100  $this->updateMetaData();
101  if (!parent::update()) {
102  return false;
103  }
104 
105  // put here object specific stuff
106 
107  return true;
108  }
update($pash, $contents, Config $config)
+ Here is the call graph for this function:

◆ updateMetaData()

ilObjQuestionPool::updateMetaData ( )

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

References $ilUser, ilObject\getId(), getTitle(), and ilObject\getType().

Referenced by update().

111  {
112  global $ilUser;
113  include_once "./Services/MetaData/classes/class.ilMD.php";
114  $md = new ilMD($this->getId(), 0, $this->getType());
115  $md_gen =&$md->getGeneral();
116  if ($md_gen == false) {
117  include_once "./Services/MetaData/classes/class.ilMDCreator.php";
118  $md_creator = new ilMDCreator($this->getId(), 0, $this->getType());
119  $md_creator->setTitle($this->getTitle());
120  $md_creator->setTitleLanguage($ilUser->getPref('language'));
121  $md_creator->create();
122  }
123  parent::updateMetaData();
124  }
getId()
get object id public
$ilUser
Definition: imgupload.php:18
getType()
get object type public
getTitle()
get title of glossary object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $import_dir

ilObjQuestionPool::$import_dir
private

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

◆ $isSkillManagementGloballyActivated

ilObjQuestionPool::$isSkillManagementGloballyActivated = null
staticprivate

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

◆ $navTaxonomyId

ilObjQuestionPool::$navTaxonomyId = null
private

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

Referenced by getNavTaxonomyId(), and setNavTaxonomyId().

◆ $online

ilObjQuestionPool::$online

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

Referenced by getOnline().

◆ $showTaxonomies

ilObjQuestionPool::$showTaxonomies = null
private

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

Referenced by getShowTaxonomies(), and setShowTaxonomies().

◆ $skillServiceEnabled

ilObjQuestionPool::$skillServiceEnabled
private

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

Referenced by isSkillServiceEnabled(), and setSkillServiceEnabled().


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