ILIAS  release_4-4 Revision
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 ()
 
 initDefaultRoles ()
 If your module does not require any default roles, delete this method (For an example how this method is used, look at ilObjForum) 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 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...
 
- 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...
 
 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...
 
 createRoleFolder ()
 creates a local role folder 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...
 

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 Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_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 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 Attributes

 $showTaxonomies = null
 
 $navTaxonomyId = null
 
 $import_dir
 

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

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

Referenced by ilObjQuestionPoolGUI\uploadQplObject().

778  {
779  global $ilias;
780 
781  include_once "./Services/Utilities/classes/class.ilUtil.php";
782  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
783  ilUtil::makeDir($qpl_data_dir);
784 
785  if(!is_writable($qpl_data_dir))
786  {
787  $ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
788  .") not writeable.",$ilias->error_obj->FATAL);
789  }
790 
791  // create questionpool directory (data_dir/qpl_data/qpl_import)
792  $qpl_dir = $qpl_data_dir."/qpl_import";
793  ilUtil::makeDir($qpl_dir);
794  if(!@is_dir($qpl_dir))
795  {
796  $ilias->raiseError("Creation of Questionpool Directory failed.",$ilias->error_obj->FATAL);
797  }
798  return $qpl_dir;
799  }
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 1342 of file class.ilObjQuestionPool.php.

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

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

1343  {
1344  global $ilUser;
1345  global $ilDB;
1346 
1347  $result_array = array();
1348  $permission = (strlen($permission) == 0) ? "read" : $permission;
1349  $qpls = ilUtil::_getObjectsByOperations("qpl", $permission, (strlen($usr_id)) ? $usr_id : $ilUser->getId(), -1);
1350  $obj_ids = array();
1351  foreach ($qpls as $ref_id)
1352  {
1353  $obj_id = ilObject::_lookupObjId($ref_id);
1354  $obj_ids[$ref_id] = $obj_id;
1355  }
1356  $titles = ilObject::_prepareCloneSelection($qpls, "qpl");
1357  if (count($obj_ids))
1358  {
1359  $in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
1360  if ($could_be_offline)
1361  {
1362  $result = $ilDB->query("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
1363  "qpl_questionpool.obj_fi = object_data.obj_id AND $in ORDER BY object_data.title");
1364  }
1365  else
1366  {
1367  $result = $ilDB->queryF("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
1368  "qpl_questionpool.obj_fi = object_data.obj_id AND $in AND qpl_questionpool.isonline = %s ".
1369  "ORDER BY object_data.title",
1370  array('text'),
1371  array(1)
1372  );
1373  }
1374  while ($row = $ilDB->fetchAssoc($result))
1375  {
1376  $add = TRUE;
1377  if ($equal_points)
1378  {
1379  if (!ilObjQuestionPool::_hasEqualPoints($row["obj_fi"]))
1380  {
1381  $add = FALSE;
1382  }
1383  }
1384  if ($add)
1385  {
1386  $ref_id = array_search($row["obj_fi"], $obj_ids);
1387  $title = (($showPath) ? $titles[$ref_id] : $row["title"]);
1388  if ($with_questioncount)
1389  {
1390  $title .= " [" . $row["questioncount"] . " " . ($row["questioncount"] == 1 ? $this->lng->txt("ass_question") : $this->lng->txt("assQuestions")) . "]";
1391  }
1392 
1393  if ($use_object_id)
1394  {
1395  $result_array[$row["obj_fi"]] = array(
1396  'qpl_id' => $row['obj_fi'],
1397  'qpl_title' => $row['title'],
1398  "title" => $title,
1399  "count" => $row["questioncount"]
1400  );
1401  }
1402  else
1403  {
1404  $result_array[$ref_id] = array(
1405  'qpl_id' => $row['obj_fi'],
1406  'qpl_title' => $row['title'],
1407  "title" => $title,
1408  "count" => $row["questioncount"]
1409  );
1410  }
1411  }
1412  }
1413  }
1414  return $result_array;
1415  }
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
+ 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 1313 of file class.ilObjQuestionPool.php.

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

1314  {
1315  global $tree;
1316  $path = $tree->getPathFull($ref_id);
1317  $items = array();
1318  $counter = 0;
1319  foreach ($path as $item)
1320  {
1321  if (($counter > 0) && ($counter < count($path)-1))
1322  {
1323  array_push($items, $item["title"]);
1324  }
1325  $counter++;
1326  }
1327  $fullpath = join(" > ", $items);
1328  include_once "./Services/Utilities/classes/class.ilStr.php";
1329  if (strlen($fullpath) > 60)
1330  {
1331  $fullpath = ilStr::subStr($fullpath, 0, 30) . "..." . ilStr::subStr($fullpath, ilStr::strLen($fullpath)-30, 30);
1332  }
1333  return $fullpath;
1334  }
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:34
+ Here is the call graph for this function:

◆ _getImportDirectory()

ilObjQuestionPool::_getImportDirectory ( )

get import directory of lm

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

References $_SESSION.

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

820  {
821  if (strlen($_SESSION["qpl_import_dir"]))
822  {
823  return $_SESSION["qpl_import_dir"];
824  }
825  return null;
826  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ 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 934 of file class.ilObjQuestionPool.php.

References $result, and $row.

Referenced by _updateQuestionCount().

935  {
936  global $ilDB;
937  if ($complete_questions_only)
938  {
939  $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",
940  array('integer', 'text'),
941  array($questionpool_id, 1)
942  );
943  }
944  else
945  {
946  $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",
947  array('integer'),
948  array($questionpool_id)
949  );
950  }
951  $row = $ilDB->fetchAssoc($result);
952  return $row["question_count"];
953  }
$result
+ Here is the caller graph for this function:

◆ _getQuestionTypes()

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

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

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

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

1467  {
1468  global $ilDB;
1469  global $lng;
1470 
1471  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1473  $lng->loadLanguageModule("assessment");
1474  $result = $ilDB->query("SELECT * FROM qpl_qst_type");
1475  $types = array();
1476  while ($row = $ilDB->fetchAssoc($result))
1477  {
1478  if ($all_tags || (!in_array($row["question_type_id"], $forbidden_types)))
1479  {
1480  global $ilLog;
1481 
1482  if ($row["plugin"] == 0)
1483  {
1484  $types[$lng->txt($row["type_tag"])] = $row;
1485  }
1486  else
1487  {
1488  global $ilPluginAdmin;
1489  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1490  foreach ($pl_names as $pl_name)
1491  {
1492  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1493  if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
1494  {
1495  $types[$pl->getQuestionTypeTranslation()] = $row;
1496  }
1497  }
1498  }
1499  }
1500  }
1501 
1502  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionTypeOrderer.php';
1504  $orderer = new ilAssQuestionTypeOrderer($types, $orderMode);
1505  $types = $orderer->getOrderedTypes();
1506 
1507  return $types;
1508  }
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
+ 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 1559 of file class.ilObjQuestionPool.php.

References $t, and _getQuestionTypes().

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

1560  {
1561 /* $allowed_types = array(
1562  "assSingleChoice" => 1,
1563  "assMultipleChoice" => 2,
1564  "assClozeTest" => 3,
1565  "assMatchingQuestion" => 4,
1566  "assOrderingQuestion" => 5,
1567  "assOrderingHorizontal" => 6,
1568  "assImagemapQuestion" => 7,
1569  "assTextQuestion" => 8,
1570  "assTextSubset" => 9,
1571  "assErrorText" => 10
1572  );*/
1573  $allowed_types = array(
1574  "assSingleChoice" => 1,
1575  "assMultipleChoice" => 2,
1576  "assClozeTest" => 3,
1577  "assMatchingQuestion" => 4,
1578  "assOrderingQuestion" => 5,
1579  "assOrderingHorizontal" => 6,
1580  "assImagemapQuestion" => 7,
1581  "assTextSubset" => 9,
1582  "assErrorText" => 10
1583  );
1584  $satypes = array();
1585  $qtypes = ilObjQuestionPool::_getQuestionTypes($all_tags);
1586  foreach($qtypes as $k => $t)
1587  {
1588  //if (in_array($t["type_tag"], $allowed_types))
1589  if (isset($allowed_types[$t["type_tag"]]))
1590  {
1591  $t["order"] = $allowed_types[$t["type_tag"]];
1592  $satypes[$k] = $t;
1593  }
1594  }
1595  return $satypes;
1596  }
& _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 1039 of file class.ilObjQuestionPool.php.

References $result, and $row.

Referenced by _getAvailableQuestionpools().

1040  {
1041  global $ilDB;
1042 
1043  if ($is_reference)
1044  {
1045  $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",
1046  array('integer'),
1047  array($a_obj_id)
1048  );
1049  }
1050  else
1051  {
1052  $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",
1053  array('integer'),
1054  array($a_obj_id)
1055  );
1056  }
1057  if ($result->numRows() == 1)
1058  {
1059  $row = $ilDB->fetchAssoc($result);
1060  if ($row["equal_points"] == 1)
1061  {
1062  return 1;
1063  }
1064  else
1065  {
1066  return 0;
1067  }
1068  }
1069  return 0;
1070  }
$result
+ 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 1197 of file class.ilObjQuestionPool.php.

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

Referenced by assQuestion\_isWriteable().

1198  {
1199  global $rbacsystem;
1200 
1201  include_once "./Services/Object/classes/class.ilObject.php";
1202  $refs = ilObject::_getAllReferences($object_id);
1203  if (count($refs))
1204  {
1205  foreach ($refs as $ref_id)
1206  {
1207  if ($rbacsystem->checkAccess("write", $ref_id) && (ilObject::_hasUntrashedReference($object_id)))
1208  {
1209  return true;
1210  }
1211  }
1212  }
1213  return false;
1214  }
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 1007 of file class.ilObjQuestionPool.php.

References $result, and $row.

Referenced by ilObjQuestionPoolListGUI\getProperties().

1008  {
1009  global $ilDB;
1010 
1011  if ($is_reference)
1012  {
1013  $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",
1014  array('integer'),
1015  array($a_obj_id)
1016  );
1017  }
1018  else
1019  {
1020  $result = $ilDB->queryF("SELECT isonline FROM qpl_questionpool WHERE obj_fi = %s",
1021  array('integer'),
1022  array($a_obj_id)
1023  );
1024  }
1025  if ($result->numRows() == 1)
1026  {
1027  $row = $ilDB->fetchAssoc($result);
1028  return $row["isonline"];
1029  }
1030  return 0;
1031  }
$result
+ Here is the caller graph for this function:

◆ _setImportDirectory()

ilObjQuestionPool::_setImportDirectory (   $a_import_dir = null)

set import directory

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

References $_SESSION.

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

805  {
806  if (strlen($a_import_dir))
807  {
808  $_SESSION["qpl_import_dir"] = $a_import_dir;
809  }
810  else
811  {
812  unset($_SESSION["qpl_import_dir"]);
813  }
814  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ 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 1621 of file class.ilObjQuestionPool.php.

References $result, and _getQuestionCount().

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

1622  {
1623  global $ilDB;
1624  $result = $ilDB->manipulateF("UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s",
1625  array('integer','integer','integer'),
1626  array(ilObjQuestionPool::_getQuestionCount($object_id, TRUE), time(), $object_id)
1627  );
1628  }
$result
_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 277 of file class.ilObjQuestionPool.php.

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

Referenced by deleteQuestion().

278  {
279  global $ilDB;
280 
281  foreach(ilObjTest::getPoolQuestionChangeListeners($ilDB, $this->getId()) as $listener)
282  {
283  $question->addQuestionChangeListener($listener);
284  }
285  }
getId()
get object id public
static getPoolQuestionChangeListeners(ilDB $db, $poolObjId)
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 1170 of file class.ilObjQuestionPool.php.

References $_SESSION.

1171  {
1172  if( !isset($_SESSION['qpl_clipboard']) )
1173  {
1174  return;
1175  }
1176 
1177  if( !isset($_SESSION['qpl_clipboard'][$deletedQuestionId]) )
1178  {
1179  return;
1180  }
1181 
1182  unset($_SESSION['qpl_clipboard'][$deletedQuestionId]);
1183 
1184  if( !count($_SESSION['qpl_clipboard']) )
1185  {
1186  unset($_SESSION['qpl_clipboard']);
1187  }
1188  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

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

References $ilLog, ilObject\getId(), getOnline(), getQplQuestions(), and ilObject\getType().

1439  {
1440  global $ilLog;
1441  $newObj = parent::cloneObject($a_target_id,$a_copy_id);
1442  $newObj->setOnline($this->getOnline());
1443  $newObj->saveToDb();
1444  // clone the questions in the question pool
1445  $questions =& $this->getQplQuestions();
1446  foreach ($questions as $question_id)
1447  {
1448  $newObj->copyQuestion($question_id, $newObj->getId());
1449  }
1450 
1451  // clone meta data
1452  include_once "./Services/MetaData/classes/class.ilMD.php";
1453  $md = new ilMD($this->getId(),0,$this->getType());
1454  $new_md =& $md->cloneMD($newObj->getId(),0,$newObj->getType());
1455 
1456  // update the metadata with the new title of the question pool
1457  $newObj->updateMetaData();
1458  return $newObj;
1459  }
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 480 of file class.ilObjQuestionPool.php.

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

Referenced by pasteFromClipboard().

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

References $_SESSION.

1147  {
1148  if (!array_key_exists("qpl_clipboard", $_SESSION))
1149  {
1150  $_SESSION["qpl_clipboard"] = array();
1151  }
1152  $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "copy");
1153  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

◆ create()

ilObjQuestionPool::create (   $a_upload = false)

create questionpool object

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

References ilObject\createMetaData().

62  {
63  parent::create();
64 
65  // meta data will be created by
66  // import parser
67  if (!$a_upload)
68  {
69  $this->createMetaData();
70  }
71  }
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 722 of file class.ilObjQuestionPool.php.

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

723  {
724  include_once "./Services/Utilities/classes/class.ilUtil.php";
725  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
726  ilUtil::makeDir($qpl_data_dir);
727  if(!is_writable($qpl_data_dir))
728  {
729  $this->ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
730  .") not writeable.",$this->ilias->error_obj->FATAL);
731  }
732 
733  // create learning module directory (data_dir/lm_data/lm_<id>)
734  $qpl_dir = $qpl_data_dir."/qpl_".$this->getId();
735  ilUtil::makeDir($qpl_dir);
736  if(!@is_dir($qpl_dir))
737  {
738  $this->ilias->raiseError("Creation of Questionpool Directory failed.",$this->ilias->error_obj->FATAL);
739  }
740  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
741  ilUtil::makeDir($this->getExportDirectory('xls'));
742  if(!@is_dir($this->getExportDirectory('xls')))
743  {
744  $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
745  }
746  ilUtil::makeDir($this->getExportDirectory('zip'));
747  if(!@is_dir($this->getExportDirectory('zip')))
748  {
749  $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
750  }
751  }
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 438 of file class.ilObjQuestionPool.php.

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

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

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

References $result, and saveToDb().

80  {
81  $result = parent::createReference();
82  $this->saveToDb();
83  return $result;
84  }
$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 140 of file class.ilObjQuestionPool.php.

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

141  {
142  // always call parent delete function first!!
143  if (!parent::delete())
144  {
145  return false;
146  }
147 
148  // delete meta data
149  $this->deleteMetaData();
150 
151  //put here your module specific stuff
152  $this->deleteQuestionpool();
153 
154  return true;
155  }
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 264 of file class.ilObjQuestionPool.php.

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

Referenced by deleteQuestionpool().

265  {
266  include_once "./Modules/Test/classes/class.ilObjTest.php";
267  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
268 
269  $question = assQuestion::_instanciateQuestion($question_id);
270  $this->addQuestionChangeListeners($question);
271  $question->delete($question_id);
272  }
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 157 of file class.ilObjQuestionPool.php.

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

Referenced by delete().

158  {
159  $questions =& $this->getAllQuestions();
160 
161  if (count($questions))
162  {
163  foreach ($questions as $question_id)
164  {
165  $this->deleteQuestion($question_id);
166  }
167  }
168 
169  // delete export files
170  include_once "./Services/Utilities/classes/class.ilUtil.php";
171  $qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
172  $directory = $qpl_data_dir."/qpl_".$this->getId();
173  if (is_dir($directory))
174  {
175  include_once "./Services/Utilities/classes/class.ilUtil.php";
176  ilUtil::delDir($directory);
177  }
178  }
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 454 of file class.ilObjQuestionPool.php.

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

Referenced by copyQuestion().

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

Referenced by exportPagesXML().

705  {
706  include_once("./Modules/File/classes/class.ilObjFile.php");
707 
708  foreach ($this->file_ids as $file_id)
709  {
710  $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
711  $file_obj = new ilObjFile($file_id, false);
712  $file_obj->export($a_target_dir);
713  unset($file_obj);
714  }
715  }
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 547 of file class.ilObjQuestionPool.php.

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

548  {
549  global $ilBench;
550 
551  $this->mob_ids = array();
552  $this->file_ids = array();
553 
554  $attrs = array();
555  $attrs["Type"] = "Questionpool_Test";
556  $a_xml_writer->xmlStartTag("ContentObject", $attrs);
557 
558  // MetaData
559  $this->exportXMLMetaData($a_xml_writer);
560 
561  // PageObjects
562  $expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
563  $ilBench->start("ContentObjectExport", "exportPageObjects");
564  $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog, $questions);
565  $ilBench->stop("ContentObjectExport", "exportPageObjects");
566  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");
567 
568  // MediaObjects
569  $expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
570  $ilBench->start("ContentObjectExport", "exportMediaObjects");
571  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
572  $ilBench->stop("ContentObjectExport", "exportMediaObjects");
573  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
574 
575  // FileItems
576  $expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
577  $ilBench->start("ContentObjectExport", "exportFileItems");
578  $this->exportFileItems($a_target_dir, $expLog);
579  $ilBench->stop("ContentObjectExport", "exportFileItems");
580  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
581 
582  $a_xml_writer->xmlEndTag("ContentObject");
583  }
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 683 of file class.ilObjQuestionPool.php.

References ilObjMediaObject\_exists().

Referenced by exportPagesXML().

684  {
685  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
686 
687  foreach ($this->mob_ids as $mob_id)
688  {
689  $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
690  if (ilObjMediaObject::_exists($mob_id))
691  {
692  $media_obj = new ilObjMediaObject($mob_id);
693  $media_obj->exportXML($a_xml_writer, $a_inst);
694  $media_obj->exportFiles($a_target_dir);
695  unset($media_obj);
696  }
697  }
698  }
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 591 of file class.ilObjQuestionPool.php.

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

Referenced by exportPagesXML().

592  {
593  include_once("Services/MetaData/classes/class.ilMD2XML.php");
594  $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
595  $md2xml->setExportMode(true);
596  $md2xml->startExport();
597  $a_xml_writer->appendXML($md2xml->getXML());
598  }
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 618 of file class.ilObjQuestionPool.php.

References $ilBench, and ilPCFileList\collectFileItems().

Referenced by exportPagesXML().

619  {
620  global $ilBench;
621 
622  include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
623 
624  foreach ($questions as $question_id)
625  {
626  $ilBench->start("ContentObjectExport", "exportPageObject");
627  $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$question_id);
628 
629  $attrs = array();
630  $a_xml_writer->xmlStartTag("PageObject", $attrs);
631 
632 
633  // export xml to writer object
634  $ilBench->start("ContentObjectExport", "exportPageObject_XML");
635  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
636  $page_object = new ilAssQuestionPage($question_id);
637  $page_object->buildDom();
638  $page_object->insertInstIntoIDs($a_inst);
639  $mob_ids = $page_object->collectMediaObjects(false);
640  require_once 'Services/COPage/classes/class.ilPCFileList.php';
641  $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
642  $xml = $page_object->getXMLFromDom(false, false, false, "", true);
643  $xml = str_replace("&","&amp;", $xml);
644  $a_xml_writer->appendXML($xml);
645  $page_object->freeDom();
646  unset ($page_object);
647 
648  $ilBench->stop("ContentObjectExport", "exportPageObject_XML");
649 
650  // collect media objects
651  $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
652  //$mob_ids = $page_obj->getMediaObjectIDs();
653  foreach($mob_ids as $mob_id)
654  {
655  $this->mob_ids[$mob_id] = $mob_id;
656  }
657  $ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
658 
659  // collect all file items
660  $ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
661  //$file_ids = $page_obj->getFileItemIds();
662  foreach($file_ids as $file_id)
663  {
664  $this->file_ids[$file_id] = $file_id;
665  }
666  $ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
667 
668  $a_xml_writer->xmlEndTag("PageObject");
669  //unset($page_obj);
670 
671  $ilBench->stop("ContentObjectExport", "exportPageObject");
672 
673 
674  }
675  }
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:

◆ getAllQuestionIds()

& ilObjQuestionPool::getAllQuestionIds ( )

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

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

855  {
856  global $ilDB;
857 
858  $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",
859  array('integer','text'),
860  array($this->getId(), 1)
861  );
862  $questions = array();
863  if ($query_result->numRows())
864  {
865  while ($row = $ilDB->fetchAssoc($query_result))
866  {
867  if ($row["plugin"])
868  {
869  if ($this->isPluginActive($row["type_tag"]))
870  {
871  array_push($questions, $row["question_id"]);
872  }
873  }
874  else
875  {
876  array_push($questions, $row["question_id"]);
877  }
878  }
879  }
880  return $questions;
881  }
getId()
get object id public
isPluginActive($a_pname)
Checks wheather or not a question plugin with a given name is active.
+ Here is the call graph for this function:

◆ getAllQuestions()

& ilObjQuestionPool::getAllQuestions ( )

Retrieve an array containing all question ids of the questionpool.

Returns
array An array containing all question ids of the questionpool

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

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

Referenced by deleteQuestionpool().

839  {
840  global $ilDB;
841 
842  $result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
843  array('integer'),
844  array($this->getId())
845  );
846  $questions = array();
847  while ($row = $ilDB->fetchAssoc($result))
848  {
849  array_push($questions, $row["question_id"]);
850  }
851  return $questions;
852  }
$result
getId()
get object id public
+ 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 1247 of file class.ilObjQuestionPool.php.

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

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

◆ getDescription()

ilObjQuestionPool::getDescription ( )

get description of content object

Returns
string description

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

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

◆ getExportDirectory()

ilObjQuestionPool::getExportDirectory (   $type = "")

get export directory of questionpool

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

References ilObject\$type, and ilUtil\getDataDir().

Referenced by createExportDirectory().

757  {
758  include_once "./Services/Utilities/classes/class.ilUtil.php";
759  switch ($type)
760  {
761  case 'xls':
762  case 'zip':
763  $export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export_$type";
764  break;
765  default:
766  $export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export";
767  break;
768  }
769  return $export_dir;
770  }
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImportDirectory()

ilObjQuestionPool::getImportDirectory ( )

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

References _getImportDirectory().

829  {
831  }
_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 887 of file class.ilObjQuestionPool.php.

888  {
889  if (!is_array($this->import_mapping))
890  {
891  return array();
892  }
893  else
894  {
895  return $this->import_mapping;
896  }
897  }

◆ getNavTaxonomyId()

ilObjQuestionPool::getNavTaxonomyId ( )

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

References $navTaxonomyId.

Referenced by isNavTaxonomyActive(), and saveToDb().

998  {
999  return $this->navTaxonomyId;
1000  }
+ Here is the caller graph for this function:

◆ getOnline()

ilObjQuestionPool::getOnline ( )

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

References $online.

Referenced by cloneObject(), and saveToDb().

977  {
978  if (strcmp($this->online, "") == 0) $this->online = "0";
979  return $this->online;
980  }
+ 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 510 of file class.ilObjQuestionPool.php.

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

511  {
512  global $ilDB;
513 
514  $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",
515  array('integer'),
516  array($this->getId())
517  );
518  $rows = array();
519  $types = $this->getQuestionTypeTranslations();
520  if ($query_result->numRows())
521  {
522  while ($row = $ilDB->fetchAssoc($query_result))
523  {
524  $row['ttype'] = $types[$row['type_tag']];
525  if ($row["plugin"])
526  {
527  if ($this->isPluginActive($row["type_tag"]))
528  {
529  array_push($rows, $row);
530  }
531  }
532  else
533  {
534  array_push($rows, $row);
535  }
536  }
537  }
538  return $rows;
539  }
getId()
get object id public
isPluginActive($a_pname)
Checks wheather or not a question plugin with a given name is active.
+ Here is the call graph for this function:

◆ getQplQuestions()

& ilObjQuestionPool::getQplQuestions ( )

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

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

Referenced by cloneObject().

1418  {
1419  global $ilDB;
1420 
1421  $questions = array();
1422  $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",
1423  array('integer'),
1424  array($this->getId())
1425  );
1426  while ($row = $ilDB->fetchAssoc($result))
1427  {
1428  array_push($questions, $row["question_id"]);
1429  }
1430  return $questions;
1431  }
$result
getId()
get object id public
+ 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 1223 of file class.ilObjQuestionPool.php.

References $result, and $row.

1224  {
1225  global $ilDB;
1226 
1227  $result = array();
1228  $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");
1229  if ($query_result->numRows())
1230  {
1231  while ($row = $ilDB->fetchAssoc($query_result))
1232  {
1233  array_push($result, $row);
1234  }
1235  }
1236  return $result;
1237  }
$result

◆ getQuestionList()

& ilObjQuestionPool::getQuestionList ( )

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

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

1600  {
1601  global $ilDB;
1602 
1603  $questions = array();
1604  $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",
1605  array('integer'),
1606  array($this->getId())
1607  );
1608  while ($row = $ilDB->fetchAssoc($result))
1609  {
1610  array_push($questions, $row);
1611  }
1612  return $questions;
1613  }
$result
getId()
get object id public
+ 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 359 of file class.ilObjQuestionPool.php.

References $data, $result, and ilDB\fetchAssoc().

360  {
361  global $ilDB;
362 
363  if ($question_id < 1)
364  {
365  return;
366  }
367 
368  $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",
369  array('integer'),
370  array($question_id)
371  );
372  if ($result->numRows() == 1)
373  {
374  $data = $ilDB->fetchAssoc($result);
375  return $data["type_tag"];
376  }
377  else
378  {
379  return;
380  }
381  }
$result
fetchAssoc($a_set)
Fetch row as associative array from result set.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:

◆ getQuestionTypeByTypeId()

static ilObjQuestionPool::getQuestionTypeByTypeId (   $type_id)
static

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

References $query, $result, and $row.

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

1510  {
1511  global $ilDB;
1512  $query = "SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s";
1513  $types = array('integer');
1514  $values = array($type_id);
1515  $result = $ilDB->queryF($query, $types, $values);
1516  if ($row = $ilDB->fetchAssoc($result)) {
1517  return $row['type_tag'];
1518  }
1519  }
$result
+ Here is the caller graph for this function:

◆ getQuestionTypes()

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

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

References _getQuestionTypes().

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

◆ getQuestionTypeTranslations()

static ilObjQuestionPool::getQuestionTypeTranslations ( )
static

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

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

Referenced by getPrintviewQuestions().

1522  {
1523  global $ilDB;
1524  global $lng;
1525  global $ilLog;
1526  global $ilPluginAdmin;
1527 
1528  $lng->loadLanguageModule("assessment");
1529  $result = $ilDB->query("SELECT * FROM qpl_qst_type");
1530  $types = array();
1531  while ($row = $ilDB->fetchAssoc($result))
1532  {
1533  if ($row["plugin"] == 0)
1534  {
1535  $types[$row['type_tag']] = $lng->txt($row["type_tag"]);
1536  }
1537  else
1538  {
1539  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
1540  foreach ($pl_names as $pl_name)
1541  {
1542  $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
1543  if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
1544  {
1545  $types[$row['type_tag']] = $pl->getQuestionTypeTranslation();
1546  }
1547  }
1548  }
1549  }
1550  ksort($types);
1551  return $types;
1552  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
$result
const IL_COMP_MODULE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShowTaxonomies()

ilObjQuestionPool::getShowTaxonomies ( )

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

References $showTaxonomies.

Referenced by isNavTaxonomyActive(), and saveToDb().

988  {
989  return $this->showTaxonomies;
990  }
+ 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 1667 of file class.ilObjQuestionPool.php.

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

1668  {
1669  require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
1670  return ilObjTaxonomy::getUsageOfObject( $this->getId() );
1671  }
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 406 of file class.ilObjQuestionPool.php.

Referenced by updateMetaData().

407  {
408  return parent::getTitle();
409  }
+ 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 51 of file class.ilObjQuestionPool.php.

References ilObject\ilObject(), and setOnline().

52  {
53  $this->type = "qpl";
54  $this->ilObject($a_id,$a_call_by_reference);
55  $this->setOnline(0);
56  }
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:

◆ initDefaultRoles()

ilObjQuestionPool::initDefaultRoles ( )

If your module does not require any default roles, delete this method (For an example how this method is used, look at ilObjForum)

public

Returns
array object IDs of created local roles.

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

188  {
189  return array();
190  }

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

References $result, and $row.

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

◆ isNavTaxonomyActive()

ilObjQuestionPool::isNavTaxonomyActive ( )

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

References getNavTaxonomyId(), and getShowTaxonomies().

1003  {
1004  return $this->getShowTaxonomies() && (int)$this->getNavTaxonomyId();
1005  }
+ 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 1636 of file class.ilObjQuestionPool.php.

References IL_COMP_MODULE.

Referenced by getAllQuestionIds(), and getPrintviewQuestions().

1637  {
1638  global $ilPluginAdmin;
1639  if ($ilPluginAdmin->isActive(IL_COMP_MODULE, "TestQuestionPool", "qst", $a_pname))
1640  {
1641  return TRUE;
1642  }
1643  else
1644  {
1645  return FALSE;
1646  }
1647  }
const IL_COMP_MODULE
+ Here is the caller graph for this function:

◆ loadFromDb()

ilObjQuestionPool::loadFromDb ( )

Loads a ilObjQuestionpool object from a database.

public

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

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

Referenced by read().

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

References ilUtil\insertInstIntoID().

601  {
602  if ($a_tag == "Identifier" && $a_param == "Entry")
603  {
604  include_once "./Services/Utilities/classes/class.ilUtil.php";
605  $a_value = ilUtil::insertInstIntoID($a_value);
606  }
607 
608  return $a_value;
609  }
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 1161 of file class.ilObjQuestionPool.php.

References $_SESSION.

1162  {
1163  if (!array_key_exists("qpl_clipboard", $_SESSION))
1164  {
1165  $_SESSION["qpl_clipboard"] = array();
1166  }
1167  $_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "move");
1168  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

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

References $_GET, and ilObject\getType().

206  {
207  global $tree;
208 
209  switch ($a_event)
210  {
211  case "link":
212 
213  //var_dump("<pre>",$a_params,"</pre>");
214  //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
215  //exit;
216  break;
217 
218  case "cut":
219 
220  //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
221  //exit;
222  break;
223 
224  case "copy":
225 
226  //var_dump("<pre>",$a_params,"</pre>");
227  //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
228  //exit;
229  break;
230 
231  case "paste":
232 
233  //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
234  //exit;
235  break;
236 
237  case "new":
238 
239  //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
240  //exit;
241  break;
242  }
243 
244  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
245  if ($a_node_id==$_GET["ref_id"])
246  {
247  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
248  $parent_type = $parent_obj->getType();
249  if($parent_type == $this->getType())
250  {
251  $a_node_id = (int) $tree->getParentId($a_node_id);
252  }
253  }
254 
255  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
256  }
$_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 1077 of file class.ilObjQuestionPool.php.

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

1078  {
1079  global $ilDB;
1080 
1081  $success = false;
1082  if (array_key_exists("qpl_clipboard", $_SESSION))
1083  {
1084  $success = true;
1085  foreach ($_SESSION["qpl_clipboard"] as $question_object)
1086  {
1087  if (strcmp($question_object["action"], "move") == 0)
1088  {
1089  $result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1090  array('integer'),
1091  array($question_object["question_id"])
1092  );
1093  if ($result->numRows() == 1)
1094  {
1095  $row = $ilDB->fetchAssoc($result);
1096  $source_questionpool = $row["obj_fi"];
1097  // change the questionpool id in the qpl_questions table
1098  $affectedRows = $ilDB->manipulateF("UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
1099  array('integer','integer'),
1100  array($this->getId(), $question_object["question_id"])
1101  );
1102  if(!$affectedRows)
1103  {
1104  $success = false;
1105  }
1106 
1107  // move question data to the new target directory
1108  $source_path = CLIENT_WEB_DIR . "/assessment/" . $source_questionpool . "/" . $question_object["question_id"] . "/";
1109  if (@is_dir($source_path))
1110  {
1111  $target_path = CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/";
1112  if (!@is_dir($target_path))
1113  {
1114  include_once "./Services/Utilities/classes/class.ilUtil.php";
1115  ilUtil::makeDirParents($target_path);
1116  }
1117  @rename($source_path, $target_path . $question_object["question_id"]);
1118  }
1119  // update question count of source question pool
1120  ilObjQuestionPool::_updateQuestionCount($source_questionpool);
1121  }
1122  }
1123  else
1124  {
1125  $new_question_id = $this->copyQuestion($question_object["question_id"], $this->getId());
1126  if(!$new_question_id)
1127  {
1128  $success = false;
1129  }
1130  }
1131  }
1132  }
1133  // update question count of question pool
1135  unset($_SESSION["qpl_clipboard"]);
1136 
1137  return (bool)$success;
1138  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static makeDirParents($a_dir)
Create a new directory and all parent directories.
$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
+ Here is the call graph for this function:

◆ purgeQuestions()

ilObjQuestionPool::purgeQuestions ( )

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

References $ilUser.

1653  {
1654  global $ilDB, $ilUser;
1655 
1656  require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
1657  $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
1658  $incompleteQuestionPurger->setOwnerId($ilUser->getId());
1659  $incompleteQuestionPurger->purge();
1660  }
global $ilUser
Definition: imgupload.php:15

◆ read()

ilObjQuestionPool::read (   $a_force_db = false)

read object data from db into object

Parameters
booleanpublic

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

References loadFromDb().

128  {
129  parent::read($a_force_db);
130  $this->loadFromDb();
131  }
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 314 of file class.ilObjQuestionPool.php.

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

Referenced by createReference().

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

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

◆ setNavTaxonomyId()

ilObjQuestionPool::setNavTaxonomyId (   $navTaxonomyId)

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

References $navTaxonomyId.

Referenced by loadFromDb().

993  {
994  $this->navTaxonomyId = $navTaxonomyId;
995  }
+ 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 962 of file class.ilObjQuestionPool.php.

Referenced by ilObjQuestionPool(), and loadFromDb().

963  {
964  switch ($a_online_status)
965  {
966  case 0:
967  case 1:
968  $this->online = $a_online_status;
969  break;
970  default:
971  $this->online = 0;
972  break;
973  }
974  }
+ Here is the caller graph for this function:

◆ setShowTaxonomies()

ilObjQuestionPool::setShowTaxonomies (   $showTaxonomies)

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

References $showTaxonomies.

Referenced by loadFromDb().

983  {
984  $this->showTaxonomies = $showTaxonomies;
985  }
+ Here is the caller graph for this function:

◆ setTitle()

ilObjQuestionPool::setTitle (   $a_title)

set title of glossary object

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

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

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

References createQuestion().

907  {
908  $xml = "";
909  // export button was pressed
910  if (count($questions) > 0)
911  {
912  foreach ($questions as $key => $value)
913  {
914  $question =& $this->createQuestion("", $value);
915  $xml .= $question->object->toXML();
916  }
917  if (count($questions) > 1)
918  {
919  $xml = preg_replace("/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/", "", $xml);
920  }
921  }
922  $xml = preg_replace("/(<\?xml[^>]*?>)/", "\\1" . "<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", $xml);
923  return $xml;
924  }
& 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 92 of file class.ilObjQuestionPool.php.

References updateMetaData().

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

◆ updateMetaData()

ilObjQuestionPool::updateMetaData ( )

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

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

Referenced by update().

106  {
107  global $ilUser;
108  include_once "./Services/MetaData/classes/class.ilMD.php";
109  $md =& new ilMD($this->getId(), 0, $this->getType());
110  $md_gen =& $md->getGeneral();
111  if ($md_gen == false)
112  {
113  include_once "./Services/MetaData/classes/class.ilMDCreator.php";
114  $md_creator = new ilMDCreator($this->getId(),0,$this->getType());
115  $md_creator->setTitle($this->getTitle());
116  $md_creator->setTitleLanguage($ilUser->getPref('language'));
117  $md_creator->create();
118  }
119  parent::updateMetaData();
120  }
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 43 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().


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