ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjQuestionPool Class Reference
+ Inheritance diagram for ilObjQuestionPool:
+ Collaboration diagram for ilObjQuestionPool:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 Constructor @access 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 ()
 update meta data entry More...
 
 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 @access 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 @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access 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 @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 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...
 
 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 If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 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 @global 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@access public 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
 
 $ilias
 
 $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
 

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 @access public.

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

Reimplemented from ilObject.

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

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.

References setOnline().

+ 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 759 of file class.ilObjQuestionPool.php.

760 {
761 global $ilias;
762
763 include_once "./Services/Utilities/classes/class.ilUtil.php";
764 $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
765 ilUtil::makeDir($qpl_data_dir);
766
767 if(!is_writable($qpl_data_dir))
768 {
769 $ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
770 .") not writeable.",$ilias->error_obj->FATAL);
771 }
772
773 // create questionpool directory (data_dir/qpl_data/qpl_import)
774 $qpl_dir = $qpl_data_dir."/qpl_import";
775 ilUtil::makeDir($qpl_dir);
776 if(!@is_dir($qpl_dir))
777 {
778 $ilias->raiseError("Creation of Questionpool Directory failed.",$ilias->error_obj->FATAL);
779 }
780 return $qpl_dir;
781 }
static getDataDir()
get data directory (outside webspace)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

References ilObject\$ilias, ilUtil\getDataDir(), and ilUtil\makeDir().

Referenced by ilObjQuestionPoolGUI\uploadQplObject().

+ 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 @access public

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

1337 {
1338 global $ilUser, $ilDB, $lng;
1339
1340 $result_array = array();
1341 $permission = (strlen($permission) == 0) ? "read" : $permission;
1342 $qpls = ilUtil::_getObjectsByOperations("qpl", $permission, (strlen($usr_id)) ? $usr_id : $ilUser->getId(), -1);
1343 $obj_ids = array();
1344 foreach ($qpls as $ref_id)
1345 {
1347 $obj_ids[$ref_id] = $obj_id;
1348 }
1349 $titles = ilObject::_prepareCloneSelection($qpls, "qpl");
1350 if (count($obj_ids))
1351 {
1352 $in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
1353 if ($could_be_offline)
1354 {
1355 $result = $ilDB->query("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
1356 "qpl_questionpool.obj_fi = object_data.obj_id AND $in ORDER BY object_data.title");
1357 }
1358 else
1359 {
1360 $result = $ilDB->queryF("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
1361 "qpl_questionpool.obj_fi = object_data.obj_id AND $in AND qpl_questionpool.isonline = %s ".
1362 "ORDER BY object_data.title",
1363 array('text'),
1364 array(1)
1365 );
1366 }
1367 while ($row = $ilDB->fetchAssoc($result))
1368 {
1369 $add = TRUE;
1370 if ($equal_points)
1371 {
1373 {
1374 $add = FALSE;
1375 }
1376 }
1377 if ($add)
1378 {
1379 $ref_id = array_search($row["obj_fi"], $obj_ids);
1380 $title = (($showPath) ? $titles[$ref_id] : $row["title"]);
1381 if ($with_questioncount)
1382 {
1383 $title .= " [" . $row["questioncount"] . " " . ($row["questioncount"] == 1 ? $lng->txt("ass_question") : $lng->txt("assQuestions")) . "]";
1384 }
1385
1386 if ($use_object_id)
1387 {
1388 $result_array[$row["obj_fi"]] = array(
1389 'qpl_id' => $row['obj_fi'],
1390 'qpl_title' => $row['title'],
1391 "title" => $title,
1392 "count" => $row["questioncount"]
1393 );
1394 }
1395 else
1396 {
1397 $result_array[$ref_id] = array(
1398 'qpl_id' => $row['obj_fi'],
1399 'qpl_title' => $row['title'],
1400 "title" => $title,
1401 "count" => $row["questioncount"]
1402 );
1403 }
1404 }
1405 }
1406 }
1407 return $result_array;
1408 }
$result
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
static _hasEqualPoints($a_obj_id, $is_reference=FALSE)
Checks a question pool for questions with the same maximum points.
static _lookupObjId($a_id)
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
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,...
global $ilDB
$ilUser
Definition: imgupload.php:18

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

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

+ 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 @access public

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

1308 {
1309 global $tree;
1310 $path = $tree->getPathFull($ref_id);
1311 $items = array();
1312 $counter = 0;
1313 foreach ($path as $item)
1314 {
1315 if (($counter > 0) && ($counter < count($path)-1))
1316 {
1317 array_push($items, $item["title"]);
1318 }
1319 $counter++;
1320 }
1321 $fullpath = join(" > ", $items);
1322 include_once "./Services/Utilities/classes/class.ilStr.php";
1323 if (strlen($fullpath) > 60)
1324 {
1325 $fullpath = ilStr::subStr($fullpath, 0, 30) . "..." . ilStr::subStr($fullpath, ilStr::strLen($fullpath)-30, 30);
1326 }
1327 return $fullpath;
1328 }
$path
Definition: aliased.php:25
static strLen($a_string)
Definition: class.ilStr.php:91
static subStr($a_str, $a_start, $a_length=NULL)
Definition: class.ilStr.php:15
$counter

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

+ Here is the call graph for this function:

◆ _getImportDirectory()

static ilObjQuestionPool::_getImportDirectory ( )
static

get import directory of lm

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

802 {
803 if (strlen($_SESSION["qpl_import_dir"]))
804 {
805 return $_SESSION["qpl_import_dir"];
806 }
807 return null;
808 }
$_SESSION["AccountId"]

References $_SESSION.

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

+ 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 @access public

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

929 {
930 global $ilDB;
931 if ($complete_questions_only)
932 {
933 $result = $ilDB->queryF("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",
934 array('integer', 'text'),
935 array($questionpool_id, 1)
936 );
937 }
938 else
939 {
940 $result = $ilDB->queryF("SELECT COUNT(question_id) question_count FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
941 array('integer'),
942 array($questionpool_id)
943 );
944 }
945 $row = $ilDB->fetchAssoc($result);
946 return $row["question_count"];
947 }

References $ilDB, $result, and $row.

Referenced by _updateQuestionCount().

+ Here is the caller graph for this function:

◆ _getQuestionTypes()

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

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

1488 {
1489 global $ilDB;
1490 global $lng;
1491
1492 include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1494 $lng->loadLanguageModule("assessment");
1495 $result = $ilDB->query("SELECT * FROM qpl_qst_type");
1496 $types = array();
1497 while ($row = $ilDB->fetchAssoc($result))
1498 {
1499 if ($all_tags || (!in_array($row["question_type_id"], $forbidden_types)))
1500 {
1501 global $ilLog;
1502
1503 if ($row["plugin"] == 0)
1504 {
1505 $types[$lng->txt($row["type_tag"])] = $row;
1506 }
1507 else
1508 {
1509 global $ilPluginAdmin;
1510 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1511 foreach ($pl_names as $pl_name)
1512 {
1513 $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1514 if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
1515 {
1516 $types[$pl->getQuestionTypeTranslation()] = $row;
1517 }
1518 }
1519 }
1520 }
1521 }
1522
1523 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionTypeOrderer.php';
1525 $orderer = new ilAssQuestionTypeOrderer($types, $orderMode);
1526 $types = $orderer->getOrderedTypes();
1527
1528 return $types;
1529 }
const IL_COMP_MODULE
const ORDER_MODE_FIX
order mode with fixed priority for ordering
const ORDER_MODE_ALPHA
order mode that orders by alphanumerical priority
static _getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.

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

Referenced by _getSelfAssessmentQuestionTypes(), getQuestionTypes(), ilTestQuestionBrowserTableGUI\initFilter(), ilQuestionBrowserTableGUI\initFilter(), and ilObjAssessmentFolderGUI\saveSettingsObject().

+ 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 1584 of file class.ilObjQuestionPool.php.

1585 {
1586/* $allowed_types = array(
1587 "assSingleChoice" => 1,
1588 "assMultipleChoice" => 2,
1589 "assClozeTest" => 3,
1590 "assMatchingQuestion" => 4,
1591 "assOrderingQuestion" => 5,
1592 "assOrderingHorizontal" => 6,
1593 "assImagemapQuestion" => 7,
1594 "assTextQuestion" => 8,
1595 "assTextSubset" => 9,
1596 "assErrorText" => 10
1597 );*/
1598 $allowed_types = array(
1599 "assSingleChoice" => 1,
1600 "assMultipleChoice" => 2,
1601 "assKprimChoice" => 3,
1602 "assClozeTest" => 4,
1603 "assMatchingQuestion" => 5,
1604 "assOrderingQuestion" => 6,
1605 "assOrderingHorizontal" => 7,
1606 "assImagemapQuestion" => 8,
1607 "assTextSubset" => 9,
1608 "assErrorText" => 10,
1609 "assLongMenu" => 11
1610 );
1611 $satypes = array();
1612 $qtypes = ilObjQuestionPool::_getQuestionTypes($all_tags);
1613 foreach($qtypes as $k => $t)
1614 {
1615 //if (in_array($t["type_tag"], $allowed_types))
1616 if (isset($allowed_types[$t["type_tag"]]))
1617 {
1618 $t["order"] = $allowed_types[$t["type_tag"]];
1619 $satypes[$k] = $t;
1620 }
1621 }
1622 return $satypes;
1623 }
static _getQuestionTypes($all_tags=FALSE, $fixOrder=false)

References $t, and _getQuestionTypes().

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

+ 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 @access private

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

1034 {
1035 global $ilDB;
1036
1037 if ($is_reference)
1038 {
1039 $result = $ilDB->queryF("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",
1040 array('integer'),
1041 array($a_obj_id)
1042 );
1043 }
1044 else
1045 {
1046 $result = $ilDB->queryF("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",
1047 array('integer'),
1048 array($a_obj_id)
1049 );
1050 }
1051 if ($result->numRows() == 1)
1052 {
1053 $row = $ilDB->fetchAssoc($result);
1054 if ($row["equal_points"] == 1)
1055 {
1056 return 1;
1057 }
1058 else
1059 {
1060 return 0;
1061 }
1062 }
1063 return 0;
1064 }

References $ilDB, $result, and $row.

Referenced by _getAvailableQuestionpools().

+ 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 @access public

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

1192 {
1193 global $rbacsystem;
1194
1195 include_once "./Services/Object/classes/class.ilObject.php";
1196 $refs = ilObject::_getAllReferences($object_id);
1197 if (count($refs))
1198 {
1199 foreach ($refs as $ref_id)
1200 {
1201 if ($rbacsystem->checkAccess("write", $ref_id) && (ilObject::_hasUntrashedReference($object_id)))
1202 {
1203 return true;
1204 }
1205 }
1206 }
1207 return false;
1208 }
static _getAllReferences($a_id)
get all reference ids of object
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash

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

Referenced by assQuestion\_isWriteable().

+ 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 1001 of file class.ilObjQuestionPool.php.

1002 {
1003 global $ilDB;
1004
1005 if ($is_reference)
1006 {
1007 $result = $ilDB->queryF("SELECT qpl_questionpool.isonline FROM qpl_questionpool,object_reference WHERE object_reference.ref_id = %s AND object_reference.obj_id = qpl_questionpool.obj_fi",
1008 array('integer'),
1009 array($a_obj_id)
1010 );
1011 }
1012 else
1013 {
1014 $result = $ilDB->queryF("SELECT isonline FROM qpl_questionpool WHERE obj_fi = %s",
1015 array('integer'),
1016 array($a_obj_id)
1017 );
1018 }
1019 if ($result->numRows() == 1)
1020 {
1021 $row = $ilDB->fetchAssoc($result);
1022 return $row["isonline"];
1023 }
1024 return 0;
1025 }

References $ilDB, $result, and $row.

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

+ Here is the caller graph for this function:

◆ _setImportDirectory()

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

set import directory

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

787 {
788 if (strlen($a_import_dir))
789 {
790 $_SESSION["qpl_import_dir"] = $a_import_dir;
791 }
792 else
793 {
794 unset($_SESSION["qpl_import_dir"]);
795 }
796 }

References $_SESSION.

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

+ 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 @access public

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

1649 {
1650 global $ilDB;
1651 $result = $ilDB->manipulateF("UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s",
1652 array('integer','integer','integer'),
1653 array(ilObjQuestionPool::_getQuestionCount($object_id, TRUE), time(), $object_id)
1654 );
1655 }
static _getQuestionCount($questionpool_id, $complete_questions_only=FALSE)
Returns the number of questions in a question pool.

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

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

+ 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 210 of file class.ilObjQuestionPool.php.

211 {
212 global $ilDB;
213
214 foreach(ilObjTest::getPoolQuestionChangeListeners($ilDB, $this->getId()) as $listener)
215 {
216 $question->addQuestionChangeListener($listener);
217 }
218 }
addQuestionChangeListener(ilQuestionChangeListener $listener)
static getPoolQuestionChangeListeners(ilDBInterface $db, $poolObjId)
getId()
get object id @access public

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

Referenced by deleteQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkQuestionParent()

ilObjQuestionPool::checkQuestionParent (   $questionId)

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

866 {
867 global $DIC; /* @var ILIAS\DI\Container $DIC */
868
869 $row = $DIC->database()->fetchAssoc($DIC->database()->queryF(
870 "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
871 array('integer', 'integer'), array($questionId, $this->getId())
872 ));
873
874 return (bool)$row['cnt'];
875 }
global $DIC

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

+ Here is the call graph for this function:

◆ cleanupClipboard()

ilObjQuestionPool::cleanupClipboard (   $deletedQuestionId)

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

1165 {
1166 if( !isset($_SESSION['qpl_clipboard']) )
1167 {
1168 return;
1169 }
1170
1171 if( !isset($_SESSION['qpl_clipboard'][$deletedQuestionId]) )
1172 {
1173 return;
1174 }
1175
1176 unset($_SESSION['qpl_clipboard'][$deletedQuestionId]);
1177
1178 if( !count($_SESSION['qpl_clipboard']) )
1179 {
1180 unset($_SESSION['qpl_clipboard']);
1181 }
1182 }

References $_SESSION.

◆ 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.

@access public

Reimplemented from ilObject.

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

1432 {
1433 global $ilLog;
1434
1435 $newObj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
1436
1437 //copy online status if object is not the root copy object
1438 $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
1439
1440 if(!$cp_options->isRootNode($this->getRefId()))
1441 {
1442 $newObj->setOnline($this->getOnline());
1443 }
1444
1445 $newObj->setSkillServiceEnabled($this->isSkillServiceEnabled());
1446 $newObj->setShowTaxonomies($this->getShowTaxonomies());
1447 $newObj->saveToDb();
1448
1449 // clone the questions in the question pool
1450 $questions =& $this->getQplQuestions();
1451 $questionIdsMap = array();
1452 foreach ($questions as $question_id)
1453 {
1454 $newQuestionId = $newObj->copyQuestion($question_id, $newObj->getId());
1455 $questionIdsMap[$question_id] = $newQuestionId;
1456 }
1457
1458 // clone meta data
1459 include_once "./Services/MetaData/classes/class.ilMD.php";
1460 $md = new ilMD($this->getId(),0,$this->getType());
1461 $new_md =& $md->cloneMD($newObj->getId(),0,$newObj->getType());
1462
1463 // update the metadata with the new title of the question pool
1464 $newObj->updateMetaData();
1465
1466 require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
1467 $duplicator = new ilQuestionPoolTaxonomiesDuplicator();
1468 $duplicator->setSourceObjId($this->getId());
1469 $duplicator->setSourceObjType($this->getType());
1470 $duplicator->setTargetObjId($newObj->getId());
1471 $duplicator->setTargetObjType($newObj->getType());
1472 $duplicator->setQuestionIdMapping($questionIdsMap);
1473 $duplicator->duplicate($duplicator->getAllTaxonomiesForSourceObject());
1474
1475 $duplicatedTaxKeyMap = $duplicator->getDuplicatedTaxonomiesKeysMap();
1476 $newObj->setNavTaxonomyId($duplicatedTaxKeyMap->getMappedTaxonomyId($this->getNavTaxonomyId()));
1477 $newObj->saveToDb();
1478
1479 return $newObj;
1480 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getType()
get object type @access public

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

+ 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 @access public

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

417 {
418 $question_gui =& $this->createQuestion("", $question_id);
419 if ($question_gui->object->getObjId() == $questionpool_to)
420 {
421 // the question is copied into the same question pool
422 return $this->duplicateQuestion($question_id);
423 }
424 else
425 {
426 // the question is copied into another question pool
427 $newtitle = $question_gui->object->getTitle();
428 if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle()))
429 {
430 $counter = 2;
431 while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() . " ($counter)"))
432 {
433 $counter++;
434 }
435 $newtitle = $question_gui->object->getTitle() . " ($counter)";
436 }
437 return $question_gui->object->copyObject($this->getId(), $newtitle);
438 }
439 }
duplicateQuestion($question_id)
Duplicates a question for a questionpool.
& createQuestion($question_type, $question_id=-1)

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

Referenced by pasteFromClipboard().

+ 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 @access private

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

1141 {
1142 if (!array_key_exists("qpl_clipboard", $_SESSION))
1143 {
1144 $_SESSION["qpl_clipboard"] = array();
1145 }
1146 $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "copy");
1147 }

References $_SESSION.

◆ create()

ilObjQuestionPool::create (   $a_upload = false)

create questionpool object

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

69 {
70 parent::create();
71
72 // meta data will be created by
73 // import parser
74 if (!$a_upload)
75 {
76 $this->createMetaData();
77 }
78 }
createMetaData()
create meta data entry

References ilObject\createMetaData().

+ 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 700 of file class.ilObjQuestionPool.php.

701 {
702 include_once "./Services/Utilities/classes/class.ilUtil.php";
703 $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
704 ilUtil::makeDir($qpl_data_dir);
705 if(!is_writable($qpl_data_dir))
706 {
707 $this->ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
708 .") not writeable.",$this->ilias->error_obj->FATAL);
709 }
710
711 // create learning module directory (data_dir/lm_data/lm_<id>)
712 $qpl_dir = $qpl_data_dir."/qpl_".$this->getId();
713 ilUtil::makeDir($qpl_dir);
714 if(!@is_dir($qpl_dir))
715 {
716 $this->ilias->raiseError("Creation of Questionpool Directory failed.",$this->ilias->error_obj->FATAL);
717 }
718 // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
719 ilUtil::makeDir($this->getExportDirectory('xls'));
720 if(!@is_dir($this->getExportDirectory('xls')))
721 {
722 $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
723 }
724 ilUtil::makeDir($this->getExportDirectory('zip'));
725 if(!@is_dir($this->getExportDirectory('zip')))
726 {
727 $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
728 }
729 }
getExportDirectory($type="")
get export directory of questionpool
redirection script todo: (a better solution should control the processing via a xml file)

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

+ Here is the call graph for this function:

◆ createQuestion()

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

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

375 {
376 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
377 if ($question_id > 0) return assQuestion::_instanciateQuestionGUI($question_id);
378 assQuestion::_includeClass($question_type, 1);
379 $question_type_gui = $question_type . "GUI";
380 $question_gui = new $question_type_gui();
381 return $question_gui;
382 }
static & _instanciateQuestionGUI($question_id)
Creates an instance of a question gui with a given question id.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.

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

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

+ 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)

@access public

Reimplemented from ilObject.

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

87 {
88 $result = parent::createReference();
89 $this->saveToDb();
90 return $result;
91 }
saveToDb()
Saves a ilObjQuestionpool object to a database.

References $result, and saveToDb().

+ Here is the call graph for this function:

◆ delete()

ilObjQuestionPool::delete ( )

delete object and all related data

@access public

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

Reimplemented from ilObject.

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

148 {
149 // always call parent delete function first!!
150 if (!parent::delete())
151 {
152 return false;
153 }
154
155 // delete meta data
156 $this->deleteMetaData();
157
158 //put here your module specific stuff
159 $this->deleteQuestionpool();
160
161 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
162 $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->getId());
163 $qsaImportFails->deleteRegisteredImportFails();
164
165 return true;
166 }
deleteMetaData()
delete meta data entry

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

+ 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 @access private

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

198 {
199 include_once "./Modules/Test/classes/class.ilObjTest.php";
200 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
201
202 $question = assQuestion::_instanciateQuestion($question_id);
203 $this->addQuestionChangeListeners($question);
204 $question->delete($question_id);
205 }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
addQuestionChangeListeners(assQuestion $question)

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

Referenced by deleteQuestionpool().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteQuestionpool()

ilObjQuestionPool::deleteQuestionpool ( )

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

169 {
170 $questions =& $this->getAllQuestions();
171
172 if (count($questions))
173 {
174 foreach ($questions as $question_id)
175 {
176 $this->deleteQuestion($question_id);
177 }
178 }
179
180 // delete export files
181 include_once "./Services/Utilities/classes/class.ilUtil.php";
182 $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
183 $directory = $qpl_data_dir."/qpl_".$this->getId();
184 if (is_dir($directory))
185 {
186 include_once "./Services/Utilities/classes/class.ilUtil.php";
187 ilUtil::delDir($directory);
188 }
189 }
deleteQuestion($question_id)
Deletes a question from the question pool.
& getAllQuestions()
Retrieve an array containing all question ids of the questionpool.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

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

Referenced by delete().

+ 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 @access public

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

391 {
392 $question =& $this->createQuestion("", $question_id);
393 $newtitle = $question->object->getTitle();
394 if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle()))
395 {
396 $counter = 2;
397 while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() . " ($counter)"))
398 {
399 $counter++;
400 }
401 $newtitle = $question->object->getTitle() . " ($counter)";
402 }
403 $new_id = $question->object->duplicate(false, $newtitle);
404 // update question count of question pool
406 return $new_id;
407 }
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.

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

Referenced by copyQuestion().

+ 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 682 of file class.ilObjQuestionPool.php.

683 {
684 include_once("./Modules/File/classes/class.ilObjFile.php");
685
686 foreach ($this->file_ids as $file_id)
687 {
688 $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
689 $file_obj = new ilObjFile($file_id, false);
690 $file_obj->export($a_target_dir);
691 unset($file_obj);
692 }
693 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Class ilObjFile.

References date.

Referenced by objectToXmlWriter().

+ 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 661 of file class.ilObjQuestionPool.php.

662 {
663 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
664
665 foreach ($this->mob_ids as $mob_id)
666 {
667 $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
668 if (ilObjMediaObject::_exists($mob_id))
669 {
670 $media_obj = new ilObjMediaObject($mob_id);
671 $media_obj->exportXML($a_xml_writer, $a_inst);
672 $media_obj->exportFiles($a_target_dir);
673 unset($media_obj);
674 }
675 }
676 }
Class ilObjMediaObject.
static _exists($a_id, $a_reference=false, $a_type=NULL)
checks wether a lm content object with specified id exists or not

References ilObjMediaObject\_exists(), and date.

Referenced by objectToXmlWriter().

+ 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 569 of file class.ilObjQuestionPool.php.

570 {
571 include_once("Services/MetaData/classes/class.ilMD2XML.php");
572 $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
573 $md2xml->setExportMode(true);
574 $md2xml->startExport();
575 $a_xml_writer->appendXML($md2xml->getXML());
576 }

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

Referenced by objectToXmlWriter().

+ 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 596 of file class.ilObjQuestionPool.php.

597 {
598 global $ilBench;
599
600 include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
601
602 foreach ($questions as $question_id)
603 {
604 $ilBench->start("ContentObjectExport", "exportPageObject");
605 $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$question_id);
606
607 $attrs = array();
608 $a_xml_writer->xmlStartTag("PageObject", $attrs);
609
610
611 // export xml to writer object
612 $ilBench->start("ContentObjectExport", "exportPageObject_XML");
613 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
614 $page_object = new ilAssQuestionPage($question_id);
615 $page_object->buildDom();
616 $page_object->insertInstIntoIDs($a_inst);
617 $mob_ids = $page_object->collectMediaObjects(false);
618 require_once 'Services/COPage/classes/class.ilPCFileList.php';
619 $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
620 $xml = $page_object->getXMLFromDom(false, false, false, "", true);
621 $xml = str_replace("&","&amp;", $xml);
622 $a_xml_writer->appendXML($xml);
623 $page_object->freeDom();
624 unset ($page_object);
625
626 $ilBench->stop("ContentObjectExport", "exportPageObject_XML");
627
628 // collect media objects
629 $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
630 //$mob_ids = $page_obj->getMediaObjectIDs();
631 foreach($mob_ids as $mob_id)
632 {
633 $this->mob_ids[$mob_id] = $mob_id;
634 }
635 $ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
636
637 // collect all file items
638 $ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
639 //$file_ids = $page_obj->getFileItemIds();
640 foreach($file_ids as $file_id)
641 {
642 $this->file_ids[$file_id] = $file_id;
643 }
644 $ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
645
646 $a_xml_writer->xmlEndTag("PageObject");
647 //unset($page_obj);
648
649 $ilBench->stop("ContentObjectExport", "exportPageObject");
650
651
652 }
653 }
Question page object.
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
global $ilBench
Definition: ilias.php:18

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

Referenced by objectToXmlWriter().

+ 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 480 of file class.ilObjQuestionPool.php.

481 {
482 $xmlWriter->xmlStartTag('Settings');
483
484 $xmlWriter->xmlElement('ShowTaxonomies', null, (int)$this->getShowTaxonomies());
485 $xmlWriter->xmlElement('NavTaxonomy', null, (int)$this->getNavTaxonomyId());
486 $xmlWriter->xmlElement('SkillService', null, (int)$this->isSkillServiceEnabled());
487
488 $xmlWriter->xmlEndTag('Settings');
489 }

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

Referenced by objectToXmlWriter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromXML()

ilObjQuestionPool::fromXML (   $xmlFile)

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

1744 {
1745 require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php';
1746 $parser = new ilObjQuestionPoolXMLParser($this, $xmlFile);
1747 $parser->startParsing();
1748 }
$parser
Definition: BPMN2Parser.php:24

References $parser.

◆ getAllQuestionIds()

& ilObjQuestionPool::getAllQuestionIds ( )

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

837 {
838 global $ilDB;
839
840 $query_result = $ilDB->queryF("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",
841 array('integer','text'),
842 array($this->getId(), 1)
843 );
844 $questions = array();
845 if ($query_result->numRows())
846 {
847 while ($row = $ilDB->fetchAssoc($query_result))
848 {
849 if ($row["plugin"])
850 {
851 if ($this->isPluginActive($row["type_tag"]))
852 {
853 array_push($questions, $row["question_id"]);
854 }
855 }
856 else
857 {
858 array_push($questions, $row["question_id"]);
859 }
860 }
861 }
862 return $questions;
863 }
isPluginActive($questionType)
Checks wheather or not a question plugin with a given name is active.

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

+ 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 820 of file class.ilObjQuestionPool.php.

821 {
822 global $ilDB;
823
824 $result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
825 array('integer'),
826 array($this->getId())
827 );
828 $questions = array();
829 while ($row = $ilDB->fetchAssoc($result))
830 {
831 array_push($questions, $row["question_id"]);
832 }
833 return $questions;
834 }

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

Referenced by deleteQuestionpool().

+ 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 @access public

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

1242 {
1243 global $ilDB, $ilLog;
1244
1245 $result = array();
1246 $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");
1247 if ($query_result->numRows())
1248 {
1249 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1250 while ($row = $ilDB->fetchAssoc($query_result))
1251 {
1252 if (!assQuestion::_isUsedInRandomTest($row["question_id"]))
1253 {
1254 array_push($result, $row);
1255 }
1256 else
1257 {
1258 // the question was used in a random test prior to ILIAS 3.7 so it was inserted
1259 // as a reference to the original question pool object and not as a copy. To allow
1260 // the deletion of the question pool object, a copy must be created and all database references
1261 // of the original question must changed with the reference of the copy
1262
1263 // 1. Create a copy of the original question
1264 $question =& $this->createQuestion("", $row["question_id"]);
1265 $duplicate_id = $question->object->duplicate(true);
1266 if ($duplicate_id > 0)
1267 {
1268 // 2. replace the question id in the solutions
1269 $affectedRows = $ilDB->manipulateF("UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
1270 array('integer','integer'),
1271 array($duplicate_id, $row["question_id"])
1272 );
1273
1274 // 3. replace the question id in the question list of random tests
1275 $affectedRows = $ilDB->manipulateF("UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s",
1276 array('integer','integer'),
1277 array($duplicate_id, $row["question_id"])
1278 );
1279
1280 // 4. replace the question id in the test results
1281 $affectedRows = $ilDB->manipulateF("UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
1282 array('integer','integer'),
1283 array($duplicate_id, $row["question_id"])
1284 );
1285
1286 // 5. replace the question id in the test&assessment log
1287 $affectedRows = $ilDB->manipulateF("UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
1288 array('integer','integer'),
1289 array($duplicate_id, $row["question_id"])
1290 );
1291
1292 // 6. The original question can be deleted, so add it to the list of questions
1293 array_push($result, $row);
1294 }
1295 }
1296 }
1297 }
1298 return $result;
1299 }
static _isUsedInRandomTest($question_id="")
Checks whether the question is used in a random test or not.

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

+ Here is the call graph for this function:

◆ getDescription()

ilObjQuestionPool::getDescription ( )

get description of content object

Returns
string description

Reimplemented from ilObject.

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

325 {
326 return parent::getDescription();
327 }

◆ getExportDirectory()

ilObjQuestionPool::getExportDirectory (   $type = "")

get export directory of questionpool

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

735 {
736 include_once "./Services/Utilities/classes/class.ilUtil.php";
737 switch ($type)
738 {
739 case 'xml':
740 include_once("./Services/Export/classes/class.ilExport.php");
741 $export_dir = ilExport::_getExportDirectory($this->getId(), $type, $this->getType());
742 break;
743 case 'xls':
744 case 'zip':
745 $export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export_$type";
746 break;
747 default:
748 $export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export";
749 break;
750 }
751 return $export_dir;
752 }
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.

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

Referenced by createExportDirectory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImportDirectory()

ilObjQuestionPool::getImportDirectory ( )

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

811 {
813 }
static _getImportDirectory()
get import directory of lm

References _getImportDirectory().

+ Here is the call graph for this function:

◆ getImportMapping()

ilObjQuestionPool::getImportMapping ( )

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

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

882 {
883 if (!is_array($this->import_mapping))
884 {
885 return array();
886 }
887 else
888 {
889 return $this->import_mapping;
890 }
891 }

◆ getNavTaxonomyId()

ilObjQuestionPool::getNavTaxonomyId ( )

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

References $navTaxonomyId.

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

+ Here is the caller graph for this function:

◆ getOnline()

ilObjQuestionPool::getOnline ( )

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

971 {
972 if (strcmp($this->online, "") == 0) $this->online = "0";
973 return $this->online;
974 }

References $online.

Referenced by cloneObject(), and saveToDb().

+ Here is the caller graph for this function:

◆ getPrintviewQuestions()

ilObjQuestionPool::getPrintviewQuestions ( )

Calculates the data for the print view of the questionpool.

@access public

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

447 {
448 global $ilDB;
449
450 $query_result = $ilDB->queryF("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",
451 array('integer'),
452 array($this->getId())
453 );
454 $rows = array();
455 $types = $this->getQuestionTypeTranslations();
456 if ($query_result->numRows())
457 {
458 while ($row = $ilDB->fetchAssoc($query_result))
459 {
460 $row['ttype'] = $types[$row['type_tag']];
461 if ($row["plugin"])
462 {
463 if ($this->isPluginActive($row["type_tag"]))
464 {
465 array_push($rows, $row);
466 }
467 }
468 else
469 {
470 array_push($rows, $row);
471 }
472 }
473 }
474 return $rows;
475 }

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

+ Here is the call graph for this function:

◆ getQplQuestions()

& ilObjQuestionPool::getQplQuestions ( )

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

1411 {
1412 global $ilDB;
1413
1414 $questions = array();
1415 $result = $ilDB->queryF("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",
1416 array('integer'),
1417 array($this->getId())
1418 );
1419 while ($row = $ilDB->fetchAssoc($result))
1420 {
1421 array_push($questions, $row["question_id"]);
1422 }
1423 return $questions;
1424 }

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

Referenced by cloneObject().

+ 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 @access public

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

1218 {
1219 global $ilDB;
1220
1221 $result = array();
1222 $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");
1223 if ($query_result->numRows())
1224 {
1225 while ($row = $ilDB->fetchAssoc($query_result))
1226 {
1227 array_push($result, $row);
1228 }
1229 }
1230 return $result;
1231 }

References $ilDB, $result, and $row.

◆ getQuestionList()

& ilObjQuestionPool::getQuestionList ( )

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

1627 {
1628 global $ilDB;
1629
1630 $questions = array();
1631 $result = $ilDB->queryF("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",
1632 array('integer'),
1633 array($this->getId())
1634 );
1635 while ($row = $ilDB->fetchAssoc($result))
1636 {
1637 array_push($questions, $row);
1638 }
1639 return $questions;
1640 }

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

+ 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 @access private

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

296 {
297 global $ilDB;
298
299 if ($question_id < 1)
300 {
301 return;
302 }
303
304 $result = $ilDB->queryF("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",
305 array('integer'),
306 array($question_id)
307 );
308 if ($result->numRows() == 1)
309 {
310 $data = $ilDB->fetchAssoc($result);
311 return $data["type_tag"];
312 }
313 else
314 {
315 return;
316 }
317 }

References $data, $ilDB, and $result.

◆ getQuestionTypeByTypeId()

static ilObjQuestionPool::getQuestionTypeByTypeId (   $type_id)
static

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

1532 {
1533 global $ilDB;
1534
1535 $query = "SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s";
1536 $types = array('integer');
1537 $values = array($type_id);
1538 $result = $ilDB->queryF($query, $types, $values);
1539
1540 if($row = $ilDB->fetchAssoc($result))
1541 {
1542 return $row['type_tag'];
1543 }
1544 }

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

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

+ Here is the caller graph for this function:

◆ getQuestionTypes()

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

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

1483 {
1484 return self::_getQuestionTypes($all_tags, $fixOrder);
1485 }

References _getQuestionTypes().

+ Here is the call graph for this function:

◆ getQuestionTypeTranslations()

static ilObjQuestionPool::getQuestionTypeTranslations ( )
static

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

1547 {
1548 global $ilDB;
1549 global $lng;
1550 global $ilLog;
1551 global $ilPluginAdmin;
1552
1553 $lng->loadLanguageModule("assessment");
1554 $result = $ilDB->query("SELECT * FROM qpl_qst_type");
1555 $types = array();
1556 while ($row = $ilDB->fetchAssoc($result))
1557 {
1558 if ($row["plugin"] == 0)
1559 {
1560 $types[$row['type_tag']] = $lng->txt($row["type_tag"]);
1561 }
1562 else
1563 {
1564 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1565 foreach ($pl_names as $pl_name)
1566 {
1567 $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1568 if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
1569 {
1570 $types[$row['type_tag']] = $pl->getQuestionTypeTranslation();
1571 }
1572 }
1573 }
1574 }
1575 ksort($types);
1576 return $types;
1577 }

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

Referenced by getPrintviewQuestions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShowTaxonomies()

ilObjQuestionPool::getShowTaxonomies ( )

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

References $showTaxonomies.

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

+ 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 1706 of file class.ilObjQuestionPool.php.

1707 {
1708 require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1709 return ilObjTaxonomy::getUsageOfObject( $this->getId() );
1710 }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.

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

+ Here is the call graph for this function:

◆ getTitle()

ilObjQuestionPool::getTitle ( )

get title of glossary object

Returns
string title

Reimplemented from ilObject.

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

343 {
344 return parent::getTitle();
345 }

Referenced by updateMetaData().

+ 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. @access public

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

363 {
364 global $ilDB;
365
366 $result = $ilDB->queryF("SELECT COUNT(solution_id) solution_count FROM tst_solutions WHERE question_fi = %s",
367 array('integer'),
368 array($question_id)
369 );
370 $row = $ilDB->fetchAssoc($result);
371 return $row["solution_count"];
372 }

References $ilDB, $result, and $row.

◆ isNavTaxonomyActive()

ilObjQuestionPool::isNavTaxonomyActive ( )

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

997 {
998 return $this->getShowTaxonomies() && (int)$this->getNavTaxonomyId();
999 }

References getNavTaxonomyId(), and getShowTaxonomies().

+ 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 @access public

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

1664 {
1665 /* @var ilPluginAdmin $ilPluginAdmin */
1666 global $ilPluginAdmin;
1667
1668 $plugins = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1669 foreach($plugins as $pluginName)
1670 {
1671 if( $pluginName == $questionType ) // plugins having pname == qtype
1672 {
1673 return true;
1674 }
1675
1676 /* @var ilQuestionsPlugin $plugin */
1677 $plugin = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pluginName);
1678
1679 if($plugin->getQuestionType() == $questionType) // plugins havin an independent name
1680 {
1681 return true;
1682 }
1683 }
1684
1685 return false;
1686 }

References ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by getAllQuestionIds(), and getPrintviewQuestions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSkillManagementGloballyActivated()

static ilObjQuestionPool::isSkillManagementGloballyActivated ( )
static

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

1731 {
1732 if( self::$isSkillManagementGloballyActivated === null )
1733 {
1734 include_once 'Services/Skill/classes/class.ilSkillManagementSettings.php';
1735 $skmgSet = new ilSkillManagementSettings();
1736
1737 self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
1738 }
1739
1741 }

References $isSkillManagementGloballyActivated.

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

+ Here is the caller graph for this function:

◆ isSkillServiceEnabled()

ilObjQuestionPool::isSkillServiceEnabled ( )
Returns
boolean

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

References $skillServiceEnabled.

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

+ Here is the caller graph for this function:

◆ loadFromDb()

ilObjQuestionPool::loadFromDb ( )

Loads a ilObjQuestionpool object from a database.

@access public

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

226 {
227 global $ilDB;
228
229 $result = $ilDB->queryF("SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
230 array('integer'),
231 array($this->getId())
232 );
233 if ($result->numRows() == 1)
234 {
235 $row = $ilDB->fetchAssoc($result);
236 $this->setOnline($row['isonline']);
237 $this->setShowTaxonomies($row['show_taxonomies']);
238 $this->setNavTaxonomyId($row['nav_taxonomy']);
239 $this->setSkillServiceEnabled($row['skill_service']);
240 }
241 }
setShowTaxonomies($showTaxonomies)
setNavTaxonomyId($navTaxonomyId)
setSkillServiceEnabled($skillServiceEnabled)

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

Referenced by read().

+ 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 578 of file class.ilObjQuestionPool.php.

579 {
580 if ($a_tag == "Identifier" && $a_param == "Entry")
581 {
582 include_once "./Services/Utilities/classes/class.ilUtil.php";
583 $a_value = ilUtil::insertInstIntoID($a_value);
584 }
585
586 return $a_value;
587 }
static insertInstIntoID($a_value)
inserts installation id into ILIAS id

References ilUtil\insertInstIntoID().

+ 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 @access private

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

1156 {
1157 if (!array_key_exists("qpl_clipboard", $_SESSION))
1158 {
1159 $_SESSION["qpl_clipboard"] = array();
1160 }
1161 $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "move");
1162 }

References $_SESSION.

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

498 {
499 global $ilBench;
500
501 $this->mob_ids = array();
502 $this->file_ids = array();
503
504 $attrs = array();
505 $attrs["Type"] = "Questionpool_Test";
506 $a_xml_writer->xmlStartTag("ContentObject", $attrs);
507
508 // MetaData
509 $this->exportXMLMetaData($a_xml_writer);
510
511 // Settings
512 $this->exportXMLSettings($a_xml_writer);
513
514 // PageObjects
515 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
516 $ilBench->start("ContentObjectExport", "exportPageObjects");
517 $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog, $questions);
518 $ilBench->stop("ContentObjectExport", "exportPageObjects");
519 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");
520
521 // MediaObjects
522 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
523 $ilBench->start("ContentObjectExport", "exportMediaObjects");
524 $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
525 $ilBench->stop("ContentObjectExport", "exportMediaObjects");
526 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
527
528 // FileItems
529 $expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
530 $ilBench->start("ContentObjectExport", "exportFileItems");
531 $this->exportFileItems($a_target_dir, $expLog);
532 $ilBench->stop("ContentObjectExport", "exportFileItems");
533 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
534
535 // skill assignments
536 $this->populateQuestionSkillAssignmentsXml($a_xml_writer, $questions);
537
538 $a_xml_writer->xmlEndTag("ContentObject");
539 }
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
export page objects to xml (see ilias_co.dtd)
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
populateQuestionSkillAssignmentsXml(ilXmlWriter &$a_xml_writer, $questions)
xmlEndTag($tag)
Writes an endtag.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.

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

+ Here is the call graph for this function:

◆ pasteFromClipboard()

ilObjQuestionPool::pasteFromClipboard ( )

Copies/Moves a question from the clipboard.

@access private

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

1072 {
1073 global $ilDB;
1074
1075 $success = false;
1076 if (array_key_exists("qpl_clipboard", $_SESSION))
1077 {
1078 $success = true;
1079 foreach ($_SESSION["qpl_clipboard"] as $question_object)
1080 {
1081 if (strcmp($question_object["action"], "move") == 0)
1082 {
1083 $result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1084 array('integer'),
1085 array($question_object["question_id"])
1086 );
1087 if ($result->numRows() == 1)
1088 {
1089 $row = $ilDB->fetchAssoc($result);
1090 $source_questionpool = $row["obj_fi"];
1091 // change the questionpool id in the qpl_questions table
1092 $affectedRows = $ilDB->manipulateF("UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
1093 array('integer','integer'),
1094 array($this->getId(), $question_object["question_id"])
1095 );
1096 if(!$affectedRows)
1097 {
1098 $success = false;
1099 }
1100
1101 // move question data to the new target directory
1102 $source_path = CLIENT_WEB_DIR . "/assessment/" . $source_questionpool . "/" . $question_object["question_id"] . "/";
1103 if (@is_dir($source_path))
1104 {
1105 $target_path = CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/";
1106 if (!@is_dir($target_path))
1107 {
1108 include_once "./Services/Utilities/classes/class.ilUtil.php";
1109 ilUtil::makeDirParents($target_path);
1110 }
1111 rename($source_path, $target_path . $question_object["question_id"]);
1112 }
1113 // update question count of source question pool
1114 ilObjQuestionPool::_updateQuestionCount($source_questionpool);
1115 }
1116 }
1117 else
1118 {
1119 $new_question_id = $this->copyQuestion($question_object["question_id"], $this->getId());
1120 if(!$new_question_id)
1121 {
1122 $success = false;
1123 }
1124 }
1125 }
1126 }
1127 // update question count of question pool
1129 unset($_SESSION["qpl_clipboard"]);
1130
1131 return (bool)$success;
1132 }
$success
Definition: Utf8Test.php:86
copyQuestion($question_id, $questionpool_to)
Copies a question into another question pool.
static makeDirParents($a_dir)
Create a new directory and all parent directories.

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

+ 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 545 of file class.ilObjQuestionPool.php.

546 {
547 global $ilDB;
548
549 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
550 $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
551 $assignmentList->setParentObjId($this->getId());
552 $assignmentList->loadFromDb();
553 $assignmentList->loadAdditionalSkillData();
554
555 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentExporter.php';
556 $skillQuestionAssignmentExporter = new ilAssQuestionSkillAssignmentExporter();
557 $skillQuestionAssignmentExporter->setXmlWriter($a_xml_writer);
558 $skillQuestionAssignmentExporter->setQuestionIds($questions);
559 $skillQuestionAssignmentExporter->setAssignmentList($assignmentList);
560 $skillQuestionAssignmentExporter->export();
561 }

References $ilDB, and ilObject\getId().

Referenced by objectToXmlWriter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ purgeQuestions()

ilObjQuestionPool::purgeQuestions ( )

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

1692 {
1693 global $ilDB, $ilUser;
1694
1695 require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
1696 $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
1697 $incompleteQuestionPurger->setOwnerId($ilUser->getId());
1698 $incompleteQuestionPurger->purge();
1699 }

References $ilDB, and $ilUser.

◆ 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 @access public

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

901 {
902 $xml = "";
903 // export button was pressed
904 if (count($questions) > 0)
905 {
906 foreach ($questions as $key => $value)
907 {
908 $question =& $this->createQuestion("", $value);
909 $xml .= $question->object->toXML();
910 }
911 if (count($questions) > 1)
912 {
913 $xml = preg_replace("/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/", "", $xml);
914 }
915 }
916 $xml = preg_replace("/(<\?xml[^>]*?>)/", "\\1" . "<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", $xml);
917 return $xml;
918 }

References createQuestion().

+ Here is the call graph for this function:

◆ read()

ilObjQuestionPool::read (   $a_force_db = false)

read object data from db into object

Parameters
boolean@access public

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

135 {
136 parent::read($a_force_db);
137 $this->loadFromDb();
138 }
loadFromDb()
Loads a ilObjQuestionpool object from a database.

References loadFromDb().

+ Here is the call graph for this function:

◆ saveToDb()

ilObjQuestionPool::saveToDb ( )

Saves a ilObjQuestionpool object to a database.

@access public

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

249 {
250 global $ilDB;
251
252 $result = $ilDB->queryF("SELECT id_questionpool FROM qpl_questionpool WHERE obj_fi = %s",
253 array('integer'),
254 array($this->getId())
255 );
256
257 if ($result->numRows() == 1)
258 {
259 $result = $ilDB->update('qpl_questionpool',
260 array(
261 'isonline' => array('text', $this->getOnline()),
262 'show_taxonomies' => array('integer', (int)$this->getShowTaxonomies()),
263 'nav_taxonomy' => array('integer', (int)$this->getNavTaxonomyId()),
264 'skill_service' => array('integer', (int)$this->isSkillServiceEnabled()),
265 'tstamp' => array('integer', time())
266 ),
267 array(
268 'obj_fi' => array('integer', $this->getId())
269 )
270 );
271 }
272 else
273 {
274 $next_id = $ilDB->nextId('qpl_questionpool');
275
276 $result = $ilDB->insert('qpl_questionpool', array(
277 'id_questionpool' => array('integer', $next_id),
278 'isonline' => array('text', $this->getOnline()),
279 'show_taxonomies' => array('integer', (int)$this->getShowTaxonomies()),
280 'nav_taxonomy' => array('integer', (int)$this->getNavTaxonomyId()),
281 'skill_service' => array('integer', (int)$this->isSkillServiceEnabled()),
282 'tstamp' => array('integer', time()),
283 'obj_fi' => array('integer', $this->getId())
284 ));
285 }
286 }

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

Referenced by createReference().

+ 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

Reimplemented from ilObject.

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

333 {
334 parent::setDescription($a_description);
335 }

◆ setNavTaxonomyId()

ilObjQuestionPool::setNavTaxonomyId (   $navTaxonomyId)

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

987 {
988 $this->navTaxonomyId = $navTaxonomyId;
989 }

References $navTaxonomyId.

Referenced by loadFromDb().

+ 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 @access User interface

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

957 {
958 switch ($a_online_status)
959 {
960 case 0:
961 case 1:
962 $this->online = $a_online_status;
963 break;
964 default:
965 $this->online = 0;
966 break;
967 }
968 }

Referenced by __construct(), and loadFromDb().

+ Here is the caller graph for this function:

◆ setShowTaxonomies()

ilObjQuestionPool::setShowTaxonomies (   $showTaxonomies)

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

977 {
978 $this->showTaxonomies = $showTaxonomies;
979 }

References $showTaxonomies.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setSkillServiceEnabled()

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

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

1724 {
1725 $this->skillServiceEnabled = $skillServiceEnabled;
1726 }

References $skillServiceEnabled.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setTitle()

ilObjQuestionPool::setTitle (   $a_title)

set title of glossary object

Reimplemented from ilObject.

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

351 {
352 parent::setTitle($a_title);
353 }

◆ update()

ilObjQuestionPool::update ( )

update object data

@access public

Returns
boolean

Reimplemented from ilObject.

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

100 {
101 $this->updateMetaData();
102 if (!parent::update())
103 {
104 return false;
105 }
106
107 // put here object specific stuff
108
109 return true;
110 }
updateMetaData()
update meta data entry

References updateMetaData().

+ Here is the call graph for this function:

◆ updateMetaData()

ilObjQuestionPool::updateMetaData ( )

update meta data entry

Reimplemented from ilObject.

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

113 {
114 global $ilUser;
115 include_once "./Services/MetaData/classes/class.ilMD.php";
116 $md = new ilMD($this->getId(), 0, $this->getType());
117 $md_gen =& $md->getGeneral();
118 if ($md_gen == false)
119 {
120 include_once "./Services/MetaData/classes/class.ilMDCreator.php";
121 $md_creator = new ilMDCreator($this->getId(),0,$this->getType());
122 $md_creator->setTitle($this->getTitle());
123 $md_creator->setTitleLanguage($ilUser->getPref('language'));
124 $md_creator->create();
125 }
126 parent::updateMetaData();
127 }
getTitle()
get title of glossary object

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

Referenced by update().

+ 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 1728 of file class.ilObjQuestionPool.php.

Referenced by isSkillManagementGloballyActivated().

◆ $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: