ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjQuestionPool Class Reference
+ Inheritance diagram for ilObjQuestionPool:
+ Collaboration diagram for ilObjQuestionPool:

Public Member Functions

 ilObjQuestionPool ($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 ()
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event happend, each object may decide how it reacts. More...
 
 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...
 
 exportPagesXML (&$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...
 
 _setImportDirectory ($a_import_dir=null)
 set import directory More...
 
 _getImportDirectory ()
 get import directory of lm More...
 
 getImportDirectory ()
 
getAllQuestions ()
 Retrieve an array containing all question ids of the questionpool. More...
 
getAllQuestionIds ()
 
 getImportMapping ()
 get array of (two) new created questions for import id More...
 
 toXML ($questions)
 Returns a QTI xml representation of a list of questions. More...
 
 _getQuestionCount ($questionpool_id, $complete_questions_only=FALSE)
 Returns the number of questions in a question pool. More...
 
 setOnline ($a_online_status)
 Sets the questionpool online status. More...
 
 getOnline ()
 
 setShowTaxonomies ($showTaxonomies)
 
 getShowTaxonomies ()
 
 setNavTaxonomyId ($navTaxonomyId)
 
 getNavTaxonomyId ()
 
 isNavTaxonomyActive ()
 
 _lookupOnline ($a_obj_id, $is_reference=FALSE)
 
 _hasEqualPoints ($a_obj_id, $is_reference=FALSE)
 Checks a question pool for questions with the same maximum points. More...
 
 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)
 
 _isWriteable ($object_id, $user_id)
 Returns true, if the question pool is writeable by a given user. More...
 
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...
 
_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...
 
getQplQuestions ()
 
 cloneObject ($a_target_id, $a_copy_id=0)
 Creates a 1:1 copy of the object and places the copy in a given repository. More...
 
getQuestionTypes ($all_tags=FALSE, $fixOrder=false)
 
_getQuestionTypes ($all_tags=FALSE, $fixOrder=false)
 
getQuestionList ()
 
 isPluginActive ($a_pname)
 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
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 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 ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 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...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) 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...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type 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) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. 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...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. 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 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 _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id 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 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
 
 $obj_data_record
 object_data record More...
 

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.

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

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

Referenced by ilObjQuestionPoolGUI\uploadQplObject().

798  {
799  global $ilias;
800 
801  include_once "./Services/Utilities/classes/class.ilUtil.php";
802  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
803  ilUtil::makeDir($qpl_data_dir);
804 
805  if(!is_writable($qpl_data_dir))
806  {
807  $ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
808  .") not writeable.",$ilias->error_obj->FATAL);
809  }
810 
811  // create questionpool directory (data_dir/qpl_data/qpl_import)
812  $qpl_dir = $qpl_data_dir."/qpl_import";
813  ilUtil::makeDir($qpl_dir);
814  if(!@is_dir($qpl_dir))
815  {
816  $ilias->raiseError("Creation of Questionpool Directory failed.",$ilias->error_obj->FATAL);
817  }
818  return $qpl_dir;
819  }
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()

& ilObjQuestionPool::_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.

Returns
array The available question pools public

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

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().

1363  {
1364  global $ilUser, $ilDB, $lng;
1365 
1366  $result_array = array();
1367  $permission = (strlen($permission) == 0) ? "read" : $permission;
1368  $qpls = ilUtil::_getObjectsByOperations("qpl", $permission, (strlen($usr_id)) ? $usr_id : $ilUser->getId(), -1);
1369  $obj_ids = array();
1370  foreach ($qpls as $ref_id)
1371  {
1372  $obj_id = ilObject::_lookupObjId($ref_id);
1373  $obj_ids[$ref_id] = $obj_id;
1374  }
1375  $titles = ilObject::_prepareCloneSelection($qpls, "qpl");
1376  if (count($obj_ids))
1377  {
1378  $in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
1379  if ($could_be_offline)
1380  {
1381  $result = $ilDB->query("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
1382  "qpl_questionpool.obj_fi = object_data.obj_id AND $in ORDER BY object_data.title");
1383  }
1384  else
1385  {
1386  $result = $ilDB->queryF("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
1387  "qpl_questionpool.obj_fi = object_data.obj_id AND $in AND qpl_questionpool.isonline = %s ".
1388  "ORDER BY object_data.title",
1389  array('text'),
1390  array(1)
1391  );
1392  }
1393  while ($row = $ilDB->fetchAssoc($result))
1394  {
1395  $add = TRUE;
1396  if ($equal_points)
1397  {
1398  if (!ilObjQuestionPool::_hasEqualPoints($row["obj_fi"]))
1399  {
1400  $add = FALSE;
1401  }
1402  }
1403  if ($add)
1404  {
1405  $ref_id = array_search($row["obj_fi"], $obj_ids);
1406  $title = (($showPath) ? $titles[$ref_id] : $row["title"]);
1407  if ($with_questioncount)
1408  {
1409  $title .= " [" . $row["questioncount"] . " " . ($row["questioncount"] == 1 ? $lng->txt("ass_question") : $lng->txt("assQuestions")) . "]";
1410  }
1411 
1412  if ($use_object_id)
1413  {
1414  $result_array[$row["obj_fi"]] = array(
1415  'qpl_id' => $row['obj_fi'],
1416  'qpl_title' => $row['title'],
1417  "title" => $title,
1418  "count" => $row["questioncount"]
1419  );
1420  }
1421  else
1422  {
1423  $result_array[$ref_id] = array(
1424  'qpl_id' => $row['obj_fi'],
1425  'qpl_title' => $row['title'],
1426  "title" => $title,
1427  "count" => $row["questioncount"]
1428  );
1429  }
1430  }
1431  }
1432  }
1433  return $result_array;
1434  }
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.
_hasEqualPoints($a_obj_id, $is_reference=FALSE)
Checks a question pool for questions with the same maximum points.
static _lookupObjId($a_id)
global $ilUser
Definition: imgupload.php:15
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 1333 of file class.ilObjQuestionPool.php.

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

1334  {
1335  global $tree;
1336  $path = $tree->getPathFull($ref_id);
1337  $items = array();
1338  $counter = 0;
1339  foreach ($path as $item)
1340  {
1341  if (($counter > 0) && ($counter < count($path)-1))
1342  {
1343  array_push($items, $item["title"]);
1344  }
1345  $counter++;
1346  }
1347  $fullpath = join(" > ", $items);
1348  include_once "./Services/Utilities/classes/class.ilStr.php";
1349  if (strlen($fullpath) > 60)
1350  {
1351  $fullpath = ilStr::subStr($fullpath, 0, 30) . "..." . ilStr::subStr($fullpath, ilStr::strLen($fullpath)-30, 30);
1352  }
1353  return $fullpath;
1354  }
static strLen($a_string)
Definition: class.ilStr.php:79
$path
Definition: index.php:22
static subStr($a_str, $a_start, $a_length=NULL)
Definition: class.ilStr.php:15
+ Here is the call graph for this function:

◆ _getImportDirectory()

ilObjQuestionPool::_getImportDirectory ( )

get import directory of lm

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

References $_SESSION.

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

840  {
841  if (strlen($_SESSION["qpl_import_dir"]))
842  {
843  return $_SESSION["qpl_import_dir"];
844  }
845  return null;
846  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ _getQuestionCount()

ilObjQuestionPool::_getQuestionCount (   $questionpool_id,
  $complete_questions_only = FALSE 
)

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

References $ilDB, $result, and $row.

Referenced by _updateQuestionCount().

955  {
956  global $ilDB;
957  if ($complete_questions_only)
958  {
959  $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",
960  array('integer', 'text'),
961  array($questionpool_id, 1)
962  );
963  }
964  else
965  {
966  $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",
967  array('integer'),
968  array($questionpool_id)
969  );
970  }
971  $row = $ilDB->fetchAssoc($result);
972  return $row["question_count"];
973  }
$result
global $ilDB
+ Here is the caller graph for this function:

◆ _getQuestionTypes()

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

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

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(), ilQuestionBrowserTableGUI\initFilter(), ilTestQuestionBrowserTableGUI\initFilter(), ilObjAssessmentFolderGUI\saveSettingsObject(), and ilObjAssessmentFolderGUI\settingsObject().

1514  {
1515  global $ilDB;
1516  global $lng;
1517 
1518  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1520  $lng->loadLanguageModule("assessment");
1521  $result = $ilDB->query("SELECT * FROM qpl_qst_type");
1522  $types = array();
1523  while ($row = $ilDB->fetchAssoc($result))
1524  {
1525  if ($all_tags || (!in_array($row["question_type_id"], $forbidden_types)))
1526  {
1527  global $ilLog;
1528 
1529  if ($row["plugin"] == 0)
1530  {
1531  $types[$lng->txt($row["type_tag"])] = $row;
1532  }
1533  else
1534  {
1535  global $ilPluginAdmin;
1536  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1537  foreach ($pl_names as $pl_name)
1538  {
1539  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1540  if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
1541  {
1542  $types[$pl->getQuestionTypeTranslation()] = $row;
1543  }
1544  }
1545  }
1546  }
1547  }
1548 
1549  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionTypeOrderer.php';
1551  $orderer = new ilAssQuestionTypeOrderer($types, $orderMode);
1552  $types = $orderer->getOrderedTypes();
1553 
1554  return $types;
1555  }
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
_getForbiddenQuestionTypes()
Returns the forbidden questiontypes for ILIAS.
const IL_COMP_MODULE
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 1606 of file class.ilObjQuestionPool.php.

References $t, and _getQuestionTypes().

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

1607  {
1608 /* $allowed_types = array(
1609  "assSingleChoice" => 1,
1610  "assMultipleChoice" => 2,
1611  "assClozeTest" => 3,
1612  "assMatchingQuestion" => 4,
1613  "assOrderingQuestion" => 5,
1614  "assOrderingHorizontal" => 6,
1615  "assImagemapQuestion" => 7,
1616  "assTextQuestion" => 8,
1617  "assTextSubset" => 9,
1618  "assErrorText" => 10
1619  );*/
1620  $allowed_types = array(
1621  "assSingleChoice" => 1,
1622  "assMultipleChoice" => 2,
1623  "assKprimChoice" => 3,
1624  "assClozeTest" => 4,
1625  "assMatchingQuestion" => 5,
1626  "assOrderingQuestion" => 6,
1627  "assOrderingHorizontal" => 7,
1628  "assImagemapQuestion" => 8,
1629  "assTextSubset" => 9,
1630  "assErrorText" => 10,
1631  "assLongMenu" => 11
1632  );
1633  $satypes = array();
1634  $qtypes = ilObjQuestionPool::_getQuestionTypes($all_tags);
1635  foreach($qtypes as $k => $t)
1636  {
1637  //if (in_array($t["type_tag"], $allowed_types))
1638  if (isset($allowed_types[$t["type_tag"]]))
1639  {
1640  $t["order"] = $allowed_types[$t["type_tag"]];
1641  $satypes[$k] = $t;
1642  }
1643  }
1644  return $satypes;
1645  }
& _getQuestionTypes($all_tags=FALSE, $fixOrder=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _hasEqualPoints()

ilObjQuestionPool::_hasEqualPoints (   $a_obj_id,
  $is_reference = FALSE 
)

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

References $ilDB, $result, and $row.

Referenced by _getAvailableQuestionpools().

1060  {
1061  global $ilDB;
1062 
1063  if ($is_reference)
1064  {
1065  $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",
1066  array('integer'),
1067  array($a_obj_id)
1068  );
1069  }
1070  else
1071  {
1072  $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",
1073  array('integer'),
1074  array($a_obj_id)
1075  );
1076  }
1077  if ($result->numRows() == 1)
1078  {
1079  $row = $ilDB->fetchAssoc($result);
1080  if ($row["equal_points"] == 1)
1081  {
1082  return 1;
1083  }
1084  else
1085  {
1086  return 0;
1087  }
1088  }
1089  return 0;
1090  }
$result
global $ilDB
+ Here is the caller graph for this function:

◆ _isWriteable()

ilObjQuestionPool::_isWriteable (   $object_id,
  $user_id 
)

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

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

Referenced by assQuestion\_isWriteable().

1218  {
1219  global $rbacsystem;
1220 
1221  include_once "./Services/Object/classes/class.ilObject.php";
1222  $refs = ilObject::_getAllReferences($object_id);
1223  if (count($refs))
1224  {
1225  foreach ($refs as $ref_id)
1226  {
1227  if ($rbacsystem->checkAccess("write", $ref_id) && (ilObject::_hasUntrashedReference($object_id)))
1228  {
1229  return true;
1230  }
1231  }
1232  }
1233  return false;
1234  }
static _getAllReferences($a_id)
get all reference ids of object
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupOnline()

ilObjQuestionPool::_lookupOnline (   $a_obj_id,
  $is_reference = FALSE 
)

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

References $ilDB, $result, and $row.

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

1028  {
1029  global $ilDB;
1030 
1031  if ($is_reference)
1032  {
1033  $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",
1034  array('integer'),
1035  array($a_obj_id)
1036  );
1037  }
1038  else
1039  {
1040  $result = $ilDB->queryF("SELECT isonline FROM qpl_questionpool WHERE obj_fi = %s",
1041  array('integer'),
1042  array($a_obj_id)
1043  );
1044  }
1045  if ($result->numRows() == 1)
1046  {
1047  $row = $ilDB->fetchAssoc($result);
1048  return $row["isonline"];
1049  }
1050  return 0;
1051  }
$result
global $ilDB
+ Here is the caller graph for this function:

◆ _setImportDirectory()

ilObjQuestionPool::_setImportDirectory (   $a_import_dir = null)

set import directory

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

References $_SESSION.

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

825  {
826  if (strlen($a_import_dir))
827  {
828  $_SESSION["qpl_import_dir"] = $a_import_dir;
829  }
830  else
831  {
832  unset($_SESSION["qpl_import_dir"]);
833  }
834  }
$_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 1670 of file class.ilObjQuestionPool.php.

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

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

1671  {
1672  global $ilDB;
1673  $result = $ilDB->manipulateF("UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s",
1674  array('integer','integer','integer'),
1675  array(ilObjQuestionPool::_getQuestionCount($object_id, TRUE), time(), $object_id)
1676  );
1677  }
$result
global $ilDB
_getQuestionCount($questionpool_id, $complete_questions_only=FALSE)
Returns the number of questions in a question pool.
+ 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 273 of file class.ilObjQuestionPool.php.

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

Referenced by deleteQuestion().

274  {
275  global $ilDB;
276 
277  foreach(ilObjTest::getPoolQuestionChangeListeners($ilDB, $this->getId()) as $listener)
278  {
279  $question->addQuestionChangeListener($listener);
280  }
281  }
getId()
get object id public
static getPoolQuestionChangeListeners(ilDB $db, $poolObjId)
global $ilDB
addQuestionChangeListener(ilQuestionChangeListener $listener)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanupClipboard()

ilObjQuestionPool::cleanupClipboard (   $deletedQuestionId)

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

References $_SESSION.

1191  {
1192  if( !isset($_SESSION['qpl_clipboard']) )
1193  {
1194  return;
1195  }
1196 
1197  if( !isset($_SESSION['qpl_clipboard'][$deletedQuestionId]) )
1198  {
1199  return;
1200  }
1201 
1202  unset($_SESSION['qpl_clipboard'][$deletedQuestionId]);
1203 
1204  if( !count($_SESSION['qpl_clipboard']) )
1205  {
1206  unset($_SESSION['qpl_clipboard']);
1207  }
1208  }
$_SESSION["AccountId"]

◆ cloneObject()

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

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

public

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

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

1458  {
1459  global $ilLog;
1460 
1461  $newObj = parent::cloneObject($a_target_id,$a_copy_id);
1462 
1463  //copy online status if object is not the root copy object
1464  $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
1465 
1466  if(!$cp_options->isRootNode($this->getRefId()))
1467  {
1468  $newObj->setOnline($this->getOnline());
1469  }
1470 
1471  $newObj->setSkillServiceEnabled($this->isSkillServiceEnabled());
1472  $newObj->setShowTaxonomies($this->getShowTaxonomies());
1473  $newObj->saveToDb();
1474 
1475  // clone the questions in the question pool
1476  $questions =& $this->getQplQuestions();
1477  $questionIdsMap = array();
1478  foreach ($questions as $question_id)
1479  {
1480  $newQuestionId = $newObj->copyQuestion($question_id, $newObj->getId());
1481  $questionIdsMap[$question_id] = $newQuestionId;
1482  }
1483 
1484  // clone meta data
1485  include_once "./Services/MetaData/classes/class.ilMD.php";
1486  $md = new ilMD($this->getId(),0,$this->getType());
1487  $new_md =& $md->cloneMD($newObj->getId(),0,$newObj->getType());
1488 
1489  // update the metadata with the new title of the question pool
1490  $newObj->updateMetaData();
1491 
1492  require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
1493  $duplicator = new ilQuestionPoolTaxonomiesDuplicator();
1494  $duplicator->setSourceObjId($this->getId());
1495  $duplicator->setSourceObjType($this->getType());
1496  $duplicator->setTargetObjId($newObj->getId());
1497  $duplicator->setTargetObjType($newObj->getType());
1498  $duplicator->setQuestionIdMapping($questionIdsMap);
1499  $duplicator->duplicate();
1500 
1501  $duplicatedTaxKeyMap = $duplicator->getDuplicatedTaxonomiesKeysMap();
1502  $newObj->setNavTaxonomyId($duplicatedTaxKeyMap->getMappedTaxonomyId($this->getNavTaxonomyId()));
1503  $newObj->saveToDb();
1504 
1505  return $newObj;
1506  }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getId()
get object id public
getType()
get object type public
+ 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 479 of file class.ilObjQuestionPool.php.

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

Referenced by pasteFromClipboard().

480  {
481  $question_gui =& $this->createQuestion("", $question_id);
482  if ($question_gui->object->getObjId() == $questionpool_to)
483  {
484  // the question is copied into the same question pool
485  return $this->duplicateQuestion($question_id);
486  }
487  else
488  {
489  // the question is copied into another question pool
490  $newtitle = $question_gui->object->getTitle();
491  if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle()))
492  {
493  $counter = 2;
494  while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() . " ($counter)"))
495  {
496  $counter++;
497  }
498  $newtitle = $question_gui->object->getTitle() . " ($counter)";
499  }
500  return $question_gui->object->copyObject($this->getId(), $newtitle);
501  }
502  }
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 1166 of file class.ilObjQuestionPool.php.

References $_SESSION.

1167  {
1168  if (!array_key_exists("qpl_clipboard", $_SESSION))
1169  {
1170  $_SESSION["qpl_clipboard"] = array();
1171  }
1172  $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "copy");
1173  }
$_SESSION["AccountId"]

◆ 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  {
76  $this->createMetaData();
77  }
78  }
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 738 of file class.ilObjQuestionPool.php.

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

739  {
740  include_once "./Services/Utilities/classes/class.ilUtil.php";
741  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
742  ilUtil::makeDir($qpl_data_dir);
743  if(!is_writable($qpl_data_dir))
744  {
745  $this->ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
746  .") not writeable.",$this->ilias->error_obj->FATAL);
747  }
748 
749  // create learning module directory (data_dir/lm_data/lm_<id>)
750  $qpl_dir = $qpl_data_dir."/qpl_".$this->getId();
751  ilUtil::makeDir($qpl_dir);
752  if(!@is_dir($qpl_dir))
753  {
754  $this->ilias->raiseError("Creation of Questionpool Directory failed.",$this->ilias->error_obj->FATAL);
755  }
756  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
757  ilUtil::makeDir($this->getExportDirectory('xls'));
758  if(!@is_dir($this->getExportDirectory('xls')))
759  {
760  $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
761  }
762  ilUtil::makeDir($this->getExportDirectory('zip'));
763  if(!@is_dir($this->getExportDirectory('zip')))
764  {
765  $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
766  }
767  }
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 437 of file class.ilObjQuestionPool.php.

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

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

438  {
439  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
440  if ($question_id > 0) return assQuestion::_instanciateQuestionGUI($question_id);
441  assQuestion::_includeClass($question_type, 1);
442  $question_type_gui = $question_type . "GUI";
443  $question_gui =& new $question_type_gui();
444  return $question_gui;
445  }
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 86 of file class.ilObjQuestionPool.php.

References $result, and saveToDb().

87  {
88  $result = parent::createReference();
89  $this->saveToDb();
90  return $result;
91  }
$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 147 of file class.ilObjQuestionPool.php.

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

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  return true;
162  }
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 260 of file class.ilObjQuestionPool.php.

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

Referenced by deleteQuestionpool().

261  {
262  include_once "./Modules/Test/classes/class.ilObjTest.php";
263  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
264 
265  $question = assQuestion::_instanciateQuestion($question_id);
266  $this->addQuestionChangeListeners($question);
267  $question->delete($question_id);
268  }
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  {
170  foreach ($questions as $question_id)
171  {
172  $this->deleteQuestion($question_id);
173  }
174  }
175 
176  // delete export files
177  include_once "./Services/Utilities/classes/class.ilUtil.php";
178  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
179  $directory = $qpl_data_dir."/qpl_".$this->getId();
180  if (is_dir($directory))
181  {
182  include_once "./Services/Utilities/classes/class.ilUtil.php";
183  ilUtil::delDir($directory);
184  }
185  }
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 453 of file class.ilObjQuestionPool.php.

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

Referenced by copyQuestion().

454  {
455  $question =& $this->createQuestion("", $question_id);
456  $newtitle = $question->object->getTitle();
457  if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle()))
458  {
459  $counter = 2;
460  while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() . " ($counter)"))
461  {
462  $counter++;
463  }
464  $newtitle = $question->object->getTitle() . " ($counter)";
465  }
466  $new_id = $question->object->duplicate(false, $newtitle);
467  // update question count of question pool
469  return $new_id;
470  }
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 720 of file class.ilObjQuestionPool.php.

Referenced by exportPagesXML().

721  {
722  include_once("./Modules/File/classes/class.ilObjFile.php");
723 
724  foreach ($this->file_ids as $file_id)
725  {
726  $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
727  $file_obj = new ilObjFile($file_id, false);
728  $file_obj->export($a_target_dir);
729  unset($file_obj);
730  }
731  }
Class ilObjFile.
+ Here is the caller graph for this function:

◆ exportPagesXML()

ilObjQuestionPool::exportPagesXML ( $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 560 of file class.ilObjQuestionPool.php.

References $ilBench, exportFileItems(), exportXMLMediaObjects(), exportXMLMetaData(), exportXMLPageObjects(), and exportXMLSettings().

561  {
562  global $ilBench;
563 
564  $this->mob_ids = array();
565  $this->file_ids = array();
566 
567  $attrs = array();
568  $attrs["Type"] = "Questionpool_Test";
569  $a_xml_writer->xmlStartTag("ContentObject", $attrs);
570 
571  // MetaData
572  $this->exportXMLMetaData($a_xml_writer);
573 
574  // Settings
575  $this->exportXMLSettings($a_xml_writer);
576 
577  // PageObjects
578  $expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
579  $ilBench->start("ContentObjectExport", "exportPageObjects");
580  $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog, $questions);
581  $ilBench->stop("ContentObjectExport", "exportPageObjects");
582  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");
583 
584  // MediaObjects
585  $expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
586  $ilBench->start("ContentObjectExport", "exportMediaObjects");
587  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
588  $ilBench->stop("ContentObjectExport", "exportMediaObjects");
589  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
590 
591  // FileItems
592  $expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
593  $ilBench->start("ContentObjectExport", "exportFileItems");
594  $this->exportFileItems($a_target_dir, $expLog);
595  $ilBench->stop("ContentObjectExport", "exportFileItems");
596  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
597 
598  $a_xml_writer->xmlEndTag("ContentObject");
599  }
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
export page objects to xml (see ilias_co.dtd)
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)
global $ilBench
Definition: ilias.php:18
+ Here is the call 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 699 of file class.ilObjQuestionPool.php.

References ilObjMediaObject\_exists().

Referenced by exportPagesXML().

700  {
701  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
702 
703  foreach ($this->mob_ids as $mob_id)
704  {
705  $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
706  if (ilObjMediaObject::_exists($mob_id))
707  {
708  $media_obj = new ilObjMediaObject($mob_id);
709  $media_obj->exportXML($a_xml_writer, $a_inst);
710  $media_obj->exportFiles($a_target_dir);
711  unset($media_obj);
712  }
713  }
714  }
static _exists($a_id)
checks wether a lm content object with specified id exists or not
Class ilObjMediaObject.
+ 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 607 of file class.ilObjQuestionPool.php.

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

Referenced by exportPagesXML().

608  {
609  include_once("Services/MetaData/classes/class.ilMD2XML.php");
610  $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
611  $md2xml->setExportMode(true);
612  $md2xml->startExport();
613  $a_xml_writer->appendXML($md2xml->getXML());
614  }
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 634 of file class.ilObjQuestionPool.php.

References $ilBench, and ilPCFileList\collectFileItems().

Referenced by exportPagesXML().

635  {
636  global $ilBench;
637 
638  include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
639 
640  foreach ($questions as $question_id)
641  {
642  $ilBench->start("ContentObjectExport", "exportPageObject");
643  $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$question_id);
644 
645  $attrs = array();
646  $a_xml_writer->xmlStartTag("PageObject", $attrs);
647 
648 
649  // export xml to writer object
650  $ilBench->start("ContentObjectExport", "exportPageObject_XML");
651  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
652  $page_object = new ilAssQuestionPage($question_id);
653  $page_object->buildDom();
654  $page_object->insertInstIntoIDs($a_inst);
655  $mob_ids = $page_object->collectMediaObjects(false);
656  require_once 'Services/COPage/classes/class.ilPCFileList.php';
657  $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
658  $xml = $page_object->getXMLFromDom(false, false, false, "", true);
659  $xml = str_replace("&","&amp;", $xml);
660  $a_xml_writer->appendXML($xml);
661  $page_object->freeDom();
662  unset ($page_object);
663 
664  $ilBench->stop("ContentObjectExport", "exportPageObject_XML");
665 
666  // collect media objects
667  $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
668  //$mob_ids = $page_obj->getMediaObjectIDs();
669  foreach($mob_ids as $mob_id)
670  {
671  $this->mob_ids[$mob_id] = $mob_id;
672  }
673  $ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
674 
675  // collect all file items
676  $ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
677  //$file_ids = $page_obj->getFileItemIds();
678  foreach($file_ids as $file_id)
679  {
680  $this->file_ids[$file_id] = $file_id;
681  }
682  $ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
683 
684  $a_xml_writer->xmlEndTag("PageObject");
685  //unset($page_obj);
686 
687  $ilBench->stop("ContentObjectExport", "exportPageObject");
688 
689 
690  }
691  }
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
+ 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 543 of file class.ilObjQuestionPool.php.

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

Referenced by exportPagesXML().

544  {
545  $xmlWriter->xmlStartTag('Settings');
546 
547  $xmlWriter->xmlElement('ShowTaxonomies', null, (int)$this->getShowTaxonomies());
548  $xmlWriter->xmlElement('NavTaxonomy', null, (int)$this->getNavTaxonomyId());
549  $xmlWriter->xmlElement('SkillService', null, (int)$this->isSkillServiceEnabled());
550 
551  $xmlWriter->xmlEndTag('Settings');
552  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromXML()

ilObjQuestionPool::fromXML (   $xmlFile)

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

1754  {
1755  require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php';
1756  $parser = new ilObjQuestionPoolXMLParser($this, $xmlFile);
1757  $parser->startParsing();
1758  }

◆ getAllQuestionIds()

& ilObjQuestionPool::getAllQuestionIds ( )

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

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

875  {
876  global $ilDB;
877 
878  $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",
879  array('integer','text'),
880  array($this->getId(), 1)
881  );
882  $questions = array();
883  if ($query_result->numRows())
884  {
885  while ($row = $ilDB->fetchAssoc($query_result))
886  {
887  if ($row["plugin"])
888  {
889  if ($this->isPluginActive($row["type_tag"]))
890  {
891  array_push($questions, $row["question_id"]);
892  }
893  }
894  else
895  {
896  array_push($questions, $row["question_id"]);
897  }
898  }
899  }
900  return $questions;
901  }
getId()
get object id public
isPluginActive($a_pname)
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 858 of file class.ilObjQuestionPool.php.

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

Referenced by deleteQuestionpool().

859  {
860  global $ilDB;
861 
862  $result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
863  array('integer'),
864  array($this->getId())
865  );
866  $questions = array();
867  while ($row = $ilDB->fetchAssoc($result))
868  {
869  array_push($questions, $row["question_id"]);
870  }
871  return $questions;
872  }
$result
getId()
get object id public
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 1267 of file class.ilObjQuestionPool.php.

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

1268  {
1269  global $ilDB, $ilLog;
1270 
1271  $result = array();
1272  $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");
1273  if ($query_result->numRows())
1274  {
1275  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1276  while ($row = $ilDB->fetchAssoc($query_result))
1277  {
1278  if (!assQuestion::_isUsedInRandomTest($row["question_id"]))
1279  {
1280  array_push($result, $row);
1281  }
1282  else
1283  {
1284  // the question was used in a random test prior to ILIAS 3.7 so it was inserted
1285  // as a reference to the original question pool object and not as a copy. To allow
1286  // the deletion of the question pool object, a copy must be created and all database references
1287  // of the original question must changed with the reference of the copy
1288 
1289  // 1. Create a copy of the original question
1290  $question =& $this->createQuestion("", $row["question_id"]);
1291  $duplicate_id = $question->object->duplicate(true);
1292  if ($duplicate_id > 0)
1293  {
1294  // 2. replace the question id in the solutions
1295  $affectedRows = $ilDB->manipulateF("UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
1296  array('integer','integer'),
1297  array($duplicate_id, $row["question_id"])
1298  );
1299 
1300  // 3. replace the question id in the question list of random tests
1301  $affectedRows = $ilDB->manipulateF("UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s",
1302  array('integer','integer'),
1303  array($duplicate_id, $row["question_id"])
1304  );
1305 
1306  // 4. replace the question id in the test results
1307  $affectedRows = $ilDB->manipulateF("UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
1308  array('integer','integer'),
1309  array($duplicate_id, $row["question_id"])
1310  );
1311 
1312  // 5. replace the question id in the test&assessment log
1313  $affectedRows = $ilDB->manipulateF("UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
1314  array('integer','integer'),
1315  array($duplicate_id, $row["question_id"])
1316  );
1317 
1318  // 6. The original question can be deleted, so add it to the list of questions
1319  array_push($result, $row);
1320  }
1321  }
1322  }
1323  }
1324  return $result;
1325  }
$result
& createQuestion($question_type, $question_id=-1)
_isUsedInRandomTest($question_id="")
Checks whether the question is used in a random test or not.
global $ilDB
+ Here is the call graph for this function:

◆ getDescription()

ilObjQuestionPool::getDescription ( )

get description of content object

Returns
string description

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

388  {
389  return parent::getDescription();
390  }

◆ getExportDirectory()

ilObjQuestionPool::getExportDirectory (   $type = "")

get export directory of questionpool

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

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

Referenced by createExportDirectory().

773  {
774  include_once "./Services/Utilities/classes/class.ilUtil.php";
775  switch ($type)
776  {
777  case 'xml':
778  include_once("./Services/Export/classes/class.ilExport.php");
779  $export_dir = ilExport::_getExportDirectory($this->getId(), $type, $this->getType());
780  break;
781  case 'xls':
782  case 'zip':
783  $export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export_$type";
784  break;
785  default:
786  $export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export";
787  break;
788  }
789  return $export_dir;
790  }
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 848 of file class.ilObjQuestionPool.php.

References _getImportDirectory().

849  {
851  }
_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 907 of file class.ilObjQuestionPool.php.

908  {
909  if (!is_array($this->import_mapping))
910  {
911  return array();
912  }
913  else
914  {
915  return $this->import_mapping;
916  }
917  }

◆ getNavTaxonomyId()

ilObjQuestionPool::getNavTaxonomyId ( )

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

References $navTaxonomyId.

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

1018  {
1019  return $this->navTaxonomyId;
1020  }
+ Here is the caller graph for this function:

◆ getOnline()

ilObjQuestionPool::getOnline ( )

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

References $online.

Referenced by cloneObject(), and saveToDb().

997  {
998  if (strcmp($this->online, "") == 0) $this->online = "0";
999  return $this->online;
1000  }
+ 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 509 of file class.ilObjQuestionPool.php.

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

510  {
511  global $ilDB;
512 
513  $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",
514  array('integer'),
515  array($this->getId())
516  );
517  $rows = array();
518  $types = $this->getQuestionTypeTranslations();
519  if ($query_result->numRows())
520  {
521  while ($row = $ilDB->fetchAssoc($query_result))
522  {
523  $row['ttype'] = $types[$row['type_tag']];
524  if ($row["plugin"])
525  {
526  if ($this->isPluginActive($row["type_tag"]))
527  {
528  array_push($rows, $row);
529  }
530  }
531  else
532  {
533  array_push($rows, $row);
534  }
535  }
536  }
537  return $rows;
538  }
getId()
get object id public
isPluginActive($a_pname)
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 1436 of file class.ilObjQuestionPool.php.

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

Referenced by cloneObject().

1437  {
1438  global $ilDB;
1439 
1440  $questions = array();
1441  $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",
1442  array('integer'),
1443  array($this->getId())
1444  );
1445  while ($row = $ilDB->fetchAssoc($result))
1446  {
1447  array_push($questions, $row["question_id"]);
1448  }
1449  return $questions;
1450  }
$result
getId()
get object id public
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 1243 of file class.ilObjQuestionPool.php.

References $ilDB, $result, and $row.

1244  {
1245  global $ilDB;
1246 
1247  $result = array();
1248  $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");
1249  if ($query_result->numRows())
1250  {
1251  while ($row = $ilDB->fetchAssoc($query_result))
1252  {
1253  array_push($result, $row);
1254  }
1255  }
1256  return $result;
1257  }
$result
global $ilDB

◆ getQuestionList()

& ilObjQuestionPool::getQuestionList ( )

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

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

1649  {
1650  global $ilDB;
1651 
1652  $questions = array();
1653  $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",
1654  array('integer'),
1655  array($this->getId())
1656  );
1657  while ($row = $ilDB->fetchAssoc($result))
1658  {
1659  array_push($questions, $row);
1660  }
1661  return $questions;
1662  }
$result
getId()
get object id public
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 358 of file class.ilObjQuestionPool.php.

References $data, $ilDB, and $result.

359  {
360  global $ilDB;
361 
362  if ($question_id < 1)
363  {
364  return;
365  }
366 
367  $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",
368  array('integer'),
369  array($question_id)
370  );
371  if ($result->numRows() == 1)
372  {
373  $data = $ilDB->fetchAssoc($result);
374  return $data["type_tag"];
375  }
376  else
377  {
378  return;
379  }
380  }
$result
$data
global $ilDB

◆ getQuestionTypeByTypeId()

static ilObjQuestionPool::getQuestionTypeByTypeId (   $type_id)
static

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

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

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

1557  {
1558  global $ilDB;
1559  $query = "SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s";
1560  $types = array('integer');
1561  $values = array($type_id);
1562  $result = $ilDB->queryF($query, $types, $values);
1563  if ($row = $ilDB->fetchAssoc($result)) {
1564  return $row['type_tag'];
1565  }
1566  }
$result
global $ilDB
+ Here is the caller graph for this function:

◆ getQuestionTypes()

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

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

References _getQuestionTypes().

1509  {
1510  return $this->_getQuestionTypes($all_tags, $fixOrder);
1511  }
& _getQuestionTypes($all_tags=FALSE, $fixOrder=false)
+ Here is the call graph for this function:

◆ getQuestionTypeTranslations()

static ilObjQuestionPool::getQuestionTypeTranslations ( )
static

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

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

Referenced by getPrintviewQuestions().

1569  {
1570  global $ilDB;
1571  global $lng;
1572  global $ilLog;
1573  global $ilPluginAdmin;
1574 
1575  $lng->loadLanguageModule("assessment");
1576  $result = $ilDB->query("SELECT * FROM qpl_qst_type");
1577  $types = array();
1578  while ($row = $ilDB->fetchAssoc($result))
1579  {
1580  if ($row["plugin"] == 0)
1581  {
1582  $types[$row['type_tag']] = $lng->txt($row["type_tag"]);
1583  }
1584  else
1585  {
1586  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1587  foreach ($pl_names as $pl_name)
1588  {
1589  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1590  if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
1591  {
1592  $types[$row['type_tag']] = $pl->getQuestionTypeTranslation();
1593  }
1594  }
1595  }
1596  }
1597  ksort($types);
1598  return $types;
1599  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
$result
const IL_COMP_MODULE
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShowTaxonomies()

ilObjQuestionPool::getShowTaxonomies ( )

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

References $showTaxonomies.

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

1008  {
1009  return $this->showTaxonomies;
1010  }
+ 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 1716 of file class.ilObjQuestionPool.php.

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

1717  {
1718  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1719  return ilObjTaxonomy::getUsageOfObject( $this->getId() );
1720  }
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 405 of file class.ilObjQuestionPool.php.

Referenced by updateMetaData().

406  {
407  return parent::getTitle();
408  }
+ Here is the caller graph for this function:

◆ ilObjQuestionPool()

ilObjQuestionPool::ilObjQuestionPool (   $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 ilObject\ilObject(), and setOnline().

57  {
58  $this->type = "qpl";
59  $this->ilObject($a_id,$a_call_by_reference);
60  $this->setOnline(0);
61 
62  $this->skillServiceEnabled = false;
63  }
ilObject($a_id=0, $a_reference=true)
Constructor public.
setOnline($a_online_status)
Sets the questionpool online status.
+ Here is the call 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 425 of file class.ilObjQuestionPool.php.

References $ilDB, $result, and $row.

426  {
427  global $ilDB;
428 
429  $result = $ilDB->queryF("SELECT COUNT(solution_id) solution_count FROM tst_solutions WHERE question_fi = %s",
430  array('integer'),
431  array($question_id)
432  );
433  $row = $ilDB->fetchAssoc($result);
434  return $row["solution_count"];
435  }
$result
global $ilDB

◆ isNavTaxonomyActive()

ilObjQuestionPool::isNavTaxonomyActive ( )

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

References getNavTaxonomyId(), and getShowTaxonomies().

1023  {
1024  return $this->getShowTaxonomies() && (int)$this->getNavTaxonomyId();
1025  }
+ Here is the call graph for this function:

◆ isPluginActive()

ilObjQuestionPool::isPluginActive (   $a_pname)

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

Parameters
string$a_pnameThe plugin name public

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

References IL_COMP_MODULE.

Referenced by getAllQuestionIds(), and getPrintviewQuestions().

1686  {
1687  global $ilPluginAdmin;
1688  if ($ilPluginAdmin->isActive(IL_COMP_MODULE, "TestQuestionPool", "qst", $a_pname))
1689  {
1690  return TRUE;
1691  }
1692  else
1693  {
1694  return FALSE;
1695  }
1696  }
const IL_COMP_MODULE
+ Here is the caller graph for this function:

◆ isSkillManagementGloballyActivated()

static ilObjQuestionPool::isSkillManagementGloballyActivated ( )
static

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

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

1741  {
1742  if( self::$isSkillManagementGloballyActivated === null )
1743  {
1744  include_once 'Services/Skill/classes/class.ilSkillManagementSettings.php';
1745  $skmgSet = new ilSkillManagementSettings();
1746 
1747  self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
1748  }
1749 
1750  return self::$isSkillManagementGloballyActivated;
1751  }
+ Here is the caller graph for this function:

◆ isSkillServiceEnabled()

ilObjQuestionPool::isSkillServiceEnabled ( )
Returns
boolean

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

References $skillServiceEnabled.

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

1726  {
1728  }
+ Here is the caller graph for this function:

◆ loadFromDb()

ilObjQuestionPool::loadFromDb ( )

Loads a ilObjQuestionpool object from a database.

public

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

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

Referenced by read().

289  {
290  global $ilDB;
291 
292  $result = $ilDB->queryF("SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
293  array('integer'),
294  array($this->getId())
295  );
296  if ($result->numRows() == 1)
297  {
298  $row = $ilDB->fetchAssoc($result);
299  $this->setOnline($row['isonline']);
300  $this->setShowTaxonomies($row['show_taxonomies']);
301  $this->setNavTaxonomyId($row['nav_taxonomy']);
302  $this->setSkillServiceEnabled($row['skill_service']);
303  }
304  }
$result
setNavTaxonomyId($navTaxonomyId)
setOnline($a_online_status)
Sets the questionpool online status.
setSkillServiceEnabled($skillServiceEnabled)
setShowTaxonomies($showTaxonomies)
getId()
get object id public
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 616 of file class.ilObjQuestionPool.php.

References ilUtil\insertInstIntoID().

617  {
618  if ($a_tag == "Identifier" && $a_param == "Entry")
619  {
620  include_once "./Services/Utilities/classes/class.ilUtil.php";
621  $a_value = ilUtil::insertInstIntoID($a_value);
622  }
623 
624  return $a_value;
625  }
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 1181 of file class.ilObjQuestionPool.php.

References $_SESSION.

1182  {
1183  if (!array_key_exists("qpl_clipboard", $_SESSION))
1184  {
1185  $_SESSION["qpl_clipboard"] = array();
1186  }
1187  $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "move");
1188  }
$_SESSION["AccountId"]

◆ notify()

ilObjQuestionPool::notify (   $a_event,
  $a_ref_id,
  $a_parent_non_rbac_id,
  $a_node_id,
  $a_params = 0 
)

notifys an object about an event occured Based on the event happend, each object may decide how it reacts.

If you are not required to handle any events related to your module, just delete this method. (For an example how this method is used, look at ilObjGroup)

public

Parameters
stringevent
integerreference id of object where the event occured
arraypasses optional parameters if required
Returns
boolean

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

References $_GET, and ilObject\getType().

202  {
203  global $tree;
204 
205  switch ($a_event)
206  {
207  case "link":
208 
209  //var_dump("<pre>",$a_params,"</pre>");
210  //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
211  //exit;
212  break;
213 
214  case "cut":
215 
216  //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
217  //exit;
218  break;
219 
220  case "copy":
221 
222  //var_dump("<pre>",$a_params,"</pre>");
223  //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
224  //exit;
225  break;
226 
227  case "paste":
228 
229  //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
230  //exit;
231  break;
232 
233  case "new":
234 
235  //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
236  //exit;
237  break;
238  }
239 
240  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
241  if ($a_node_id==$_GET["ref_id"])
242  {
243  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
244  $parent_type = $parent_obj->getType();
245  if($parent_type == $this->getType())
246  {
247  $a_node_id = (int) $tree->getParentId($a_node_id);
248  }
249  }
250 
251  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
252  }
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
getType()
get object type public
+ Here is the call graph for this function:

◆ pasteFromClipboard()

ilObjQuestionPool::pasteFromClipboard ( )

Copies/Moves a question from the clipboard.

private

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

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

1098  {
1099  global $ilDB;
1100 
1101  $success = false;
1102  if (array_key_exists("qpl_clipboard", $_SESSION))
1103  {
1104  $success = true;
1105  foreach ($_SESSION["qpl_clipboard"] as $question_object)
1106  {
1107  if (strcmp($question_object["action"], "move") == 0)
1108  {
1109  $result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1110  array('integer'),
1111  array($question_object["question_id"])
1112  );
1113  if ($result->numRows() == 1)
1114  {
1115  $row = $ilDB->fetchAssoc($result);
1116  $source_questionpool = $row["obj_fi"];
1117  // change the questionpool id in the qpl_questions table
1118  $affectedRows = $ilDB->manipulateF("UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
1119  array('integer','integer'),
1120  array($this->getId(), $question_object["question_id"])
1121  );
1122  if(!$affectedRows)
1123  {
1124  $success = false;
1125  }
1126 
1127  // move question data to the new target directory
1128  $source_path = CLIENT_WEB_DIR . "/assessment/" . $source_questionpool . "/" . $question_object["question_id"] . "/";
1129  if (@is_dir($source_path))
1130  {
1131  $target_path = CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/";
1132  if (!@is_dir($target_path))
1133  {
1134  include_once "./Services/Utilities/classes/class.ilUtil.php";
1135  ilUtil::makeDirParents($target_path);
1136  }
1137  rename($source_path, $target_path . $question_object["question_id"]);
1138  }
1139  // update question count of source question pool
1140  ilObjQuestionPool::_updateQuestionCount($source_questionpool);
1141  }
1142  }
1143  else
1144  {
1145  $new_question_id = $this->copyQuestion($question_object["question_id"], $this->getId());
1146  if(!$new_question_id)
1147  {
1148  $success = false;
1149  }
1150  }
1151  }
1152  }
1153  // update question count of question pool
1155  unset($_SESSION["qpl_clipboard"]);
1156 
1157  return (bool)$success;
1158  }
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:87
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ purgeQuestions()

ilObjQuestionPool::purgeQuestions ( )

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

References $ilDB, and $ilUser.

1702  {
1703  global $ilDB, $ilUser;
1704 
1705  require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
1706  $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
1707  $incompleteQuestionPurger->setOwnerId($ilUser->getId());
1708  $incompleteQuestionPurger->purge();
1709  }
global $ilUser
Definition: imgupload.php:15
global $ilDB

◆ read()

ilObjQuestionPool::read (   $a_force_db = false)

read object data from db into object

Parameters
booleanpublic

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

References loadFromDb().

135  {
136  parent::read($a_force_db);
137  $this->loadFromDb();
138  }
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 311 of file class.ilObjQuestionPool.php.

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

Referenced by createReference().

312  {
313  global $ilDB;
314 
315  $result = $ilDB->queryF("SELECT id_questionpool FROM qpl_questionpool WHERE obj_fi = %s",
316  array('integer'),
317  array($this->getId())
318  );
319 
320  if ($result->numRows() == 1)
321  {
322  $result = $ilDB->update('qpl_questionpool',
323  array(
324  'isonline' => array('text', $this->getOnline()),
325  'show_taxonomies' => array('integer', (int)$this->getShowTaxonomies()),
326  'nav_taxonomy' => array('integer', (int)$this->getNavTaxonomyId()),
327  'skill_service' => array('integer', (int)$this->isSkillServiceEnabled()),
328  'tstamp' => array('integer', time())
329  ),
330  array(
331  'obj_fi' => array('integer', $this->getId())
332  )
333  );
334  }
335  else
336  {
337  $next_id = $ilDB->nextId('qpl_questionpool');
338 
339  $result = $ilDB->insert('qpl_questionpool', array(
340  'id_questionpool' => array('integer', $next_id),
341  'isonline' => array('text', $this->getOnline()),
342  'show_taxonomies' => array('integer', (int)$this->getShowTaxonomies()),
343  'nav_taxonomy' => array('integer', (int)$this->getNavTaxonomyId()),
344  'skill_service' => array('integer', (int)$this->isSkillServiceEnabled()),
345  'tstamp' => array('integer', time()),
346  'obj_fi' => array('integer', $this->getId())
347  ));
348  }
349  }
$result
getId()
get object id public
global $ilDB
+ 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 395 of file class.ilObjQuestionPool.php.

396  {
397  parent::setDescription($a_description);
398  }

◆ setNavTaxonomyId()

ilObjQuestionPool::setNavTaxonomyId (   $navTaxonomyId)

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

References $navTaxonomyId.

Referenced by loadFromDb().

1013  {
1014  $this->navTaxonomyId = $navTaxonomyId;
1015  }
+ 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 982 of file class.ilObjQuestionPool.php.

Referenced by ilObjQuestionPool(), and loadFromDb().

983  {
984  switch ($a_online_status)
985  {
986  case 0:
987  case 1:
988  $this->online = $a_online_status;
989  break;
990  default:
991  $this->online = 0;
992  break;
993  }
994  }
+ Here is the caller graph for this function:

◆ setShowTaxonomies()

ilObjQuestionPool::setShowTaxonomies (   $showTaxonomies)

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

References $showTaxonomies.

Referenced by loadFromDb().

1003  {
1004  $this->showTaxonomies = $showTaxonomies;
1005  }
+ Here is the caller graph for this function:

◆ setSkillServiceEnabled()

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

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

References $skillServiceEnabled.

Referenced by loadFromDb().

1734  {
1735  $this->skillServiceEnabled = $skillServiceEnabled;
1736  }
+ Here is the caller graph for this function:

◆ setTitle()

ilObjQuestionPool::setTitle (   $a_title)

set title of glossary object

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

414  {
415  parent::setTitle($a_title);
416  }

◆ toXML()

ilObjQuestionPool::toXML (   $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 926 of file class.ilObjQuestionPool.php.

References createQuestion().

927  {
928  $xml = "";
929  // export button was pressed
930  if (count($questions) > 0)
931  {
932  foreach ($questions as $key => $value)
933  {
934  $question =& $this->createQuestion("", $value);
935  $xml .= $question->object->toXML();
936  }
937  if (count($questions) > 1)
938  {
939  $xml = preg_replace("/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/", "", $xml);
940  }
941  }
942  $xml = preg_replace("/(<\?xml[^>]*?>)/", "\\1" . "<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", $xml);
943  return $xml;
944  }
& createQuestion($question_type, $question_id=-1)
+ Here is the call graph for this function:

◆ update()

ilObjQuestionPool::update ( )

update object data

public

Returns
boolean

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

References updateMetaData().

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  }
+ Here is the call graph for this function:

◆ updateMetaData()

ilObjQuestionPool::updateMetaData ( )

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

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

Referenced by update().

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  }
getId()
get object id public
getType()
get object type public
getTitle()
get title of glossary object
global $ilUser
Definition: imgupload.php:15
+ 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 1738 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: