ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 create ($a_upload=false)
 create questionpool object
 createReference ()
 Creates a database reference id for the object (saves the object to the database and creates a reference id in the database)
 update ()
 update object data
 updateMetaData ()
 update meta data entry
 read ($a_force_db=false)
 read object data from db into object
 delete ()
 delete object and all related data
 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.
 deleteQuestion ($question_id)
 Deletes a question from the question pool.
 addQuestionChangeListeners (assQuestion $question)
 loadFromDb ()
 Loads a ilObjQuestionpool object from a database.
 saveToDb ()
 Saves a ilObjQuestionpool object to a database.
 getQuestiontype ($question_id)
 Returns the question type of a question with a given id.
 getDescription ()
 get description of content object
 setDescription ($a_description)
 set description of content object
 getTitle ()
 get title of glossary object
 setTitle ($a_title)
 set title of glossary object
 isInUse ($question_id)
 Checks whether the question is in use or not.
createQuestion ($question_type, $question_id=-1)
 duplicateQuestion ($question_id)
 Duplicates a question for a questionpool.
 copyQuestion ($question_id, $questionpool_to)
 Copies a question into another question pool.
 getPrintviewQuestions ()
 Calculates the data for the print view of the questionpool.
 exportPagesXML (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog, $questions)
 export pages of test to xml (see ilias_co.dtd)
 exportXMLMetaData (&$a_xml_writer)
 export content objects meta data to xml (see ilias_co.dtd)
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 exportXMLPageObjects (&$a_xml_writer, $a_inst, &$expLog, $questions)
 export page objects to xml (see ilias_co.dtd)
 exportXMLMediaObjects (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 export media objects to xml (see ilias_co.dtd)
 exportFileItems ($a_target_dir, &$expLog)
 export files of file itmes
 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)
 getExportDirectory ($type="")
 get export directory of questionpool
 _setImportDirectory ($a_import_dir=null)
 set import directory
 _getImportDirectory ()
 get import directory of lm
 getImportDirectory ()
getAllQuestions ()
 Retrieve an array containing all question ids of the questionpool.
getAllQuestionIds ()
 getImportMapping ()
 get array of (two) new created questions for import id
 toXML ($questions)
 Returns a QTI xml representation of a list of questions.
 _getQuestionCount ($questionpool_id, $complete_questions_only=FALSE)
 Returns the number of questions in a question pool.
 setOnline ($a_online_status)
 Sets the questionpool online status.
 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.
 pasteFromClipboard ()
 Copies/Moves a question from the clipboard.
 copyToClipboard ($question_id)
 Copies a question to the clipboard.
 moveToClipboard ($question_id)
 Moves a question to the clipboard.
 cleanupClipboard ($deletedQuestionId)
 _isWriteable ($object_id, $user_id)
 Returns true, if the question pool is writeable by a given user.
getQuestionDetails ($question_ids)
 Returns an array containing the qpl_question and qpl_qst_type fields for an array of question ids.
getDeleteableQuestionDetails ($question_ids)
 Returns an array containing the qpl_question and qpl_qst_type fields of deleteable questions for an array of question ids.
 _getFullPathToQpl ($ref_id)
 Retrieves the full path to a question pool with a given reference id.
_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.
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.
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.
 purgeQuestions ()
 getTaxonomyIds ()
 get ids of all taxonomies corresponding to current pool
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getUntranslatedTitle ()
 get untranslated object title public
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 create ()
 create
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 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.
 countReferences ()
 count references of object
 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
 applyDidacticTemplate ($a_tpl_id)
 Apply template.
 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 ...
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
 cloneMetaData ($target_obj)
 Copy meta data.
 _lookupCreationDate ($a_id)
 Lookup creation date.

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)
static getQuestionTypeByTypeId ($type_id)
static getQuestionTypeTranslations ()
static & _getSelfAssessmentQuestionTypes ($all_tags=FALSE)
 Get all self assessment question types.
static _updateQuestionCount ($object_id)
 Updates the number of available questions for a question pool in the database.
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupDescription ($a_id)
 lookup object description
static _lookupObjId ($a_id)
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB.
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
static getLongDescriptions (array $a_obj_ids)
 Get long description data.
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns.
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course.

Data Fields

 $online
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title
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

Private Attributes

 $showTaxonomies = null
 $navTaxonomyId = null
 $import_dir

Detailed Description

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

Member Function Documentation

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

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

Referenced by ilObjQuestionPoolGUI\uploadQplObject().

{
global $ilias;
include_once "./Services/Utilities/classes/class.ilUtil.php";
$qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
ilUtil::makeDir($qpl_data_dir);
if(!is_writable($qpl_data_dir))
{
$ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
.") not writeable.",$ilias->error_obj->FATAL);
}
// create questionpool directory (data_dir/qpl_data/qpl_import)
$qpl_dir = $qpl_data_dir."/qpl_import";
ilUtil::makeDir($qpl_dir);
if(!@is_dir($qpl_dir))
{
$ilias->raiseError("Creation of Questionpool Directory failed.",$ilias->error_obj->FATAL);
}
return $qpl_dir;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& 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 1331 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(), and ilObjTest\randomSelectQuestions().

{
global $ilUser, $ilDB, $lng;
$result_array = array();
$permission = (strlen($permission) == 0) ? "read" : $permission;
$qpls = ilUtil::_getObjectsByOperations("qpl", $permission, (strlen($usr_id)) ? $usr_id : $ilUser->getId(), -1);
$obj_ids = array();
foreach ($qpls as $ref_id)
{
$obj_id = ilObject::_lookupObjId($ref_id);
$obj_ids[$ref_id] = $obj_id;
}
$titles = ilObject::_prepareCloneSelection($qpls, "qpl");
if (count($obj_ids))
{
$in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
if ($could_be_offline)
{
$result = $ilDB->query("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
"qpl_questionpool.obj_fi = object_data.obj_id AND $in ORDER BY object_data.title");
}
else
{
$result = $ilDB->queryF("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE ".
"qpl_questionpool.obj_fi = object_data.obj_id AND $in AND qpl_questionpool.isonline = %s ".
"ORDER BY object_data.title",
array('text'),
array(1)
);
}
while ($row = $ilDB->fetchAssoc($result))
{
$add = TRUE;
if ($equal_points)
{
{
$add = FALSE;
}
}
if ($add)
{
$ref_id = array_search($row["obj_fi"], $obj_ids);
$title = (($showPath) ? $titles[$ref_id] : $row["title"]);
if ($with_questioncount)
{
$title .= " [" . $row["questioncount"] . " " . ($row["questioncount"] == 1 ? $lng->txt("ass_question") : $lng->txt("assQuestions")) . "]";
}
if ($use_object_id)
{
$result_array[$row["obj_fi"]] = array(
'qpl_id' => $row['obj_fi'],
'qpl_title' => $row['title'],
"title" => $title,
"count" => $row["questioncount"]
);
}
else
{
$result_array[$ref_id] = array(
'qpl_id' => $row['obj_fi'],
'qpl_title' => $row['title'],
"title" => $title,
"count" => $row["questioncount"]
);
}
}
}
}
return $result_array;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

{
global $tree;
$path = $tree->getPathFull($ref_id);
$items = array();
$counter = 0;
foreach ($path as $item)
{
if (($counter > 0) && ($counter < count($path)-1))
{
array_push($items, $item["title"]);
}
$counter++;
}
$fullpath = join(" > ", $items);
include_once "./Services/Utilities/classes/class.ilStr.php";
if (strlen($fullpath) > 60)
{
$fullpath = ilStr::subStr($fullpath, 0, 30) . "..." . ilStr::subStr($fullpath, ilStr::strLen($fullpath)-30, 30);
}
return $fullpath;
}

+ Here is the call graph for this function:

ilObjQuestionPool::_getImportDirectory ( )

get import directory of lm

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

References $_SESSION.

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

{
if (strlen($_SESSION["qpl_import_dir"]))
{
return $_SESSION["qpl_import_dir"];
}
return null;
}

+ Here is the caller graph for this function:

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

References $ilDB, $result, and $row.

Referenced by _updateQuestionCount().

{
global $ilDB;
if ($complete_questions_only)
{
$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",
array('integer', 'text'),
array($questionpool_id, 1)
);
}
else
{
$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",
array('integer'),
array($questionpool_id)
);
}
$row = $ilDB->fetchAssoc($result);
return $row["question_count"];
}

+ Here is the caller graph for this function:

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

Definition at line 1481 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(), ilTestQuestionBrowserTableGUI\initFilter(), ilQuestionBrowserTableGUI\initFilter(), and ilObjAssessmentFolderGUI\saveSettingsObject().

{
global $ilDB;
global $lng;
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
$lng->loadLanguageModule("assessment");
$result = $ilDB->query("SELECT * FROM qpl_qst_type");
$types = array();
while ($row = $ilDB->fetchAssoc($result))
{
if ($all_tags || (!in_array($row["question_type_id"], $forbidden_types)))
{
global $ilLog;
if ($row["plugin"] == 0)
{
$types[$lng->txt($row["type_tag"])] = $row;
}
else
{
global $ilPluginAdmin;
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
foreach ($pl_names as $pl_name)
{
$pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
{
$types[$pl->getQuestionTypeTranslation()] = $row;
}
}
}
}
}
require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionTypeOrderer.php';
$orderer = new ilAssQuestionTypeOrderer($types, $orderMode);
$types = $orderer->getOrderedTypes();
return $types;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Get all self assessment question types.

Todo:
Make it more flexible

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

References $t, and _getQuestionTypes().

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

{
/* $allowed_types = array(
"assSingleChoice" => 1,
"assMultipleChoice" => 2,
"assClozeTest" => 3,
"assMatchingQuestion" => 4,
"assOrderingQuestion" => 5,
"assOrderingHorizontal" => 6,
"assImagemapQuestion" => 7,
"assTextQuestion" => 8,
"assTextSubset" => 9,
"assErrorText" => 10
);*/
$allowed_types = array(
"assSingleChoice" => 1,
"assMultipleChoice" => 2,
"assKprimChoice" => 3,
"assClozeTest" => 4,
"assMatchingQuestion" => 5,
"assOrderingQuestion" => 6,
"assOrderingHorizontal" => 7,
"assImagemapQuestion" => 8,
"assTextSubset" => 9,
"assErrorText" => 10
);
$satypes = array();
foreach($qtypes as $k => $t)
{
//if (in_array($t["type_tag"], $allowed_types))
if (isset($allowed_types[$t["type_tag"]]))
{
$t["order"] = $allowed_types[$t["type_tag"]];
$satypes[$k] = $t;
}
}
return $satypes;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References $ilDB, $result, and $row.

Referenced by _getAvailableQuestionpools().

{
global $ilDB;
if ($is_reference)
{
$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",
array('integer'),
array($a_obj_id)
);
}
else
{
$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",
array('integer'),
array($a_obj_id)
);
}
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
if ($row["equal_points"] == 1)
{
return 1;
}
else
{
return 0;
}
}
return 0;
}

+ Here is the caller graph for this function:

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

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

{
global $rbacsystem;
include_once "./Services/Object/classes/class.ilObject.php";
$refs = ilObject::_getAllReferences($object_id);
if (count($refs))
{
foreach ($refs as $ref_id)
{
if ($rbacsystem->checkAccess("write", $ref_id) && (ilObject::_hasUntrashedReference($object_id)))
{
return true;
}
}
}
return false;
}

+ Here is the call graph for this function:

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

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

References $ilDB, $result, and $row.

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

{
global $ilDB;
if ($is_reference)
{
$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",
array('integer'),
array($a_obj_id)
);
}
else
{
$result = $ilDB->queryF("SELECT isonline FROM qpl_questionpool WHERE obj_fi = %s",
array('integer'),
array($a_obj_id)
);
}
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return $row["isonline"];
}
return 0;
}

+ Here is the caller graph for this function:

ilObjQuestionPool::_setImportDirectory (   $a_import_dir = null)

set import directory

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

References $_SESSION.

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

{
if (strlen($a_import_dir))
{
$_SESSION["qpl_import_dir"] = $a_import_dir;
}
else
{
unset($_SESSION["qpl_import_dir"]);
}
}

+ Here is the caller graph for this function:

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

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

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

{
global $ilDB;
$result = $ilDB->manipulateF("UPDATE qpl_questionpool SET questioncount = %s, tstamp = %s WHERE obj_fi = %s",
array('integer','integer','integer'),
array(ilObjQuestionPool::_getQuestionCount($object_id, TRUE), time(), $object_id)
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Referenced by deleteQuestion().

{
global $ilDB;
foreach(ilObjTest::getPoolQuestionChangeListeners($ilDB, $this->getId()) as $listener)
{
$question->addQuestionChangeListener($listener);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::cleanupClipboard (   $deletedQuestionId)

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

References $_SESSION.

{
if( !isset($_SESSION['qpl_clipboard']) )
{
return;
}
if( !isset($_SESSION['qpl_clipboard'][$deletedQuestionId]) )
{
return;
}
unset($_SESSION['qpl_clipboard'][$deletedQuestionId]);
if( !count($_SESSION['qpl_clipboard']) )
{
unset($_SESSION['qpl_clipboard']);
}
}
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 1426 of file class.ilObjQuestionPool.php.

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

{
global $ilLog;
$newObj = parent::cloneObject($a_target_id,$a_copy_id);
//copy online status if object is not the root copy object
$cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
if(!$cp_options->isRootNode($this->getRefId()))
{
$newObj->setOnline($this->getOnline());
}
$newObj->setShowTaxonomies($this->getShowTaxonomies());
$newObj->saveToDb();
// clone the questions in the question pool
$questions =& $this->getQplQuestions();
$questionIdsMap = array();
foreach ($questions as $question_id)
{
$newQuestionId = $newObj->copyQuestion($question_id, $newObj->getId());
$questionIdsMap[$question_id] = $newQuestionId;
}
// clone meta data
include_once "./Services/MetaData/classes/class.ilMD.php";
$md = new ilMD($this->getId(),0,$this->getType());
$new_md =& $md->cloneMD($newObj->getId(),0,$newObj->getType());
// update the metadata with the new title of the question pool
$newObj->updateMetaData();
require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
$duplicator->setSourceObjId($this->getId());
$duplicator->setSourceObjType($this->getType());
$duplicator->setTargetObjId($newObj->getId());
$duplicator->setTargetObjType($newObj->getType());
$duplicator->setQuestionIdMapping($questionIdsMap);
$duplicator->duplicate();
$duplicatedTaxKeyMap = $duplicator->getDuplicatedTaxonomiesKeysMap();
$newObj->setNavTaxonomyId($duplicatedTaxKeyMap->getMappedTaxonomyId($this->getNavTaxonomyId()));
$newObj->saveToDb();
return $newObj;
}

+ Here is the call graph for this function:

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

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

Referenced by pasteFromClipboard().

{
$question_gui =& $this->createQuestion("", $question_id);
if ($question_gui->object->getObjId() == $questionpool_to)
{
// the question is copied into the same question pool
return $this->duplicateQuestion($question_id);
}
else
{
// the question is copied into another question pool
$newtitle = $question_gui->object->getTitle();
if ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle()))
{
$counter = 2;
while ($question_gui->object->questionTitleExists($this->getId(), $question_gui->object->getTitle() . " ($counter)"))
{
$counter++;
}
$newtitle = $question_gui->object->getTitle() . " ($counter)";
}
return $question_gui->object->copyObject($this->getId(), $newtitle);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::copyToClipboard (   $question_id)

Copies a question to the clipboard.

Parameters
integer$question_idObject id of the question private

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

References $_SESSION.

{
if (!array_key_exists("qpl_clipboard", $_SESSION))
{
$_SESSION["qpl_clipboard"] = array();
}
$_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "copy");
}
ilObjQuestionPool::create (   $a_upload = false)

create questionpool object

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

References ilObject\create(), and ilObject\createMetaData().

{
// meta data will be created by
// import parser
if (!$a_upload)
{
$this->createMetaData();
}
}

+ Here is the call graph for this function:

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

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

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
ilUtil::makeDir($qpl_data_dir);
if(!is_writable($qpl_data_dir))
{
$this->ilias->raiseError("Questionpool Data Directory (".$qpl_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
// create learning module directory (data_dir/lm_data/lm_<id>)
$qpl_dir = $qpl_data_dir."/qpl_".$this->getId();
ilUtil::makeDir($qpl_dir);
if(!@is_dir($qpl_dir))
{
$this->ilias->raiseError("Creation of Questionpool Directory failed.",$this->ilias->error_obj->FATAL);
}
// create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
if(!@is_dir($this->getExportDirectory('xls')))
{
$this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
}
if(!@is_dir($this->getExportDirectory('zip')))
{
$this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
}
}

+ Here is the call graph for this function:

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

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

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

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

{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
if ($question_id > 0) return assQuestion::_instanciateQuestionGUI($question_id);
assQuestion::_includeClass($question_type, 1);
$question_type_gui = $question_type . "GUI";
$question_gui =& new $question_type_gui();
return $question_gui;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from ilObject.

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

References $result, and saveToDb().

{
$this->saveToDb();
return $result;
}

+ Here is the call graph for this function:

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

Reimplemented from ilObject.

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

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

{
// always call parent delete function first!!
if (!parent::delete())
{
return false;
}
// delete meta data
$this->deleteMetaData();
//put here your module specific stuff
return true;
}

+ Here is the call graph for this function:

ilObjQuestionPool::deleteQuestion (   $question_id)

Deletes a question from the question pool.

Parameters
integer$question_idThe database id of the question private

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

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

Referenced by deleteQuestionpool().

{
include_once "./Modules/Test/classes/class.ilObjTest.php";
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$question = assQuestion::_instanciateQuestion($question_id);
$this->addQuestionChangeListeners($question);
$question->delete($question_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::deleteQuestionpool ( )

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

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

Referenced by delete().

{
$questions =& $this->getAllQuestions();
if (count($questions))
{
foreach ($questions as $question_id)
{
$this->deleteQuestion($question_id);
}
}
// delete export files
include_once "./Services/Utilities/classes/class.ilUtil.php";
$qpl_data_dir = ilUtil::getDataDir()."/qpl_data";
$directory = $qpl_data_dir."/qpl_".$this->getId();
if (is_dir($directory))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::delDir($directory);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::duplicateQuestion (   $question_id)

Duplicates a question for a questionpool.

Parameters
integer$question_idThe database id of the question public

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

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

Referenced by copyQuestion().

{
$question =& $this->createQuestion("", $question_id);
$newtitle = $question->object->getTitle();
if ($question->object->questionTitleExists($this->getId(), $question->object->getTitle()))
{
$counter = 2;
while ($question->object->questionTitleExists($this->getId(), $question->object->getTitle() . " ($counter)"))
{
$counter++;
}
$newtitle = $question->object->getTitle() . " ($counter)";
}
$new_id = $question->object->duplicate(false, $newtitle);
// update question count of question pool
return $new_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

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

Referenced by exportPagesXML().

{
include_once("./Modules/File/classes/class.ilObjFile.php");
foreach ($this->file_ids as $file_id)
{
$expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
$file_obj = new ilObjFile($file_id, false);
$file_obj->export($a_target_dir);
unset($file_obj);
}
}

+ Here is the caller graph for this function:

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

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

{
global $ilBench;
$this->mob_ids = array();
$this->file_ids = array();
$attrs = array();
$attrs["Type"] = "Questionpool_Test";
$a_xml_writer->xmlStartTag("ContentObject", $attrs);
// MetaData
$this->exportXMLMetaData($a_xml_writer);
// PageObjects
$expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
$ilBench->start("ContentObjectExport", "exportPageObjects");
$this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog, $questions);
$ilBench->stop("ContentObjectExport", "exportPageObjects");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");
// MediaObjects
$expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
$ilBench->start("ContentObjectExport", "exportMediaObjects");
$this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
$ilBench->stop("ContentObjectExport", "exportMediaObjects");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
// FileItems
$expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
$ilBench->start("ContentObjectExport", "exportFileItems");
$this->exportFileItems($a_target_dir, $expLog);
$ilBench->stop("ContentObjectExport", "exportFileItems");
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
$a_xml_writer->xmlEndTag("ContentObject");
}

+ Here is the call graph for this function:

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

References ilObjMediaObject\_exists().

Referenced by exportPagesXML().

{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
foreach ($this->mob_ids as $mob_id)
{
$expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
{
$media_obj = new ilObjMediaObject($mob_id);
$media_obj->exportXML($a_xml_writer, $a_inst);
$media_obj->exportFiles($a_target_dir);
unset($media_obj);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Referenced by exportPagesXML().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References $ilBench, and ilPCFileList\collectFileItems().

Referenced by exportPagesXML().

{
global $ilBench;
include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
foreach ($questions as $question_id)
{
$ilBench->start("ContentObjectExport", "exportPageObject");
$expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$question_id);
$attrs = array();
$a_xml_writer->xmlStartTag("PageObject", $attrs);
// export xml to writer object
$ilBench->start("ContentObjectExport", "exportPageObject_XML");
include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
$page_object = new ilAssQuestionPage($question_id);
$page_object->buildDom();
$page_object->insertInstIntoIDs($a_inst);
$mob_ids = $page_object->collectMediaObjects(false);
require_once 'Services/COPage/classes/class.ilPCFileList.php';
$file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
$xml = $page_object->getXMLFromDom(false, false, false, "", true);
$xml = str_replace("&","&amp;", $xml);
$a_xml_writer->appendXML($xml);
$page_object->freeDom();
unset ($page_object);
$ilBench->stop("ContentObjectExport", "exportPageObject_XML");
// collect media objects
$ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
//$mob_ids = $page_obj->getMediaObjectIDs();
foreach($mob_ids as $mob_id)
{
$this->mob_ids[$mob_id] = $mob_id;
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
// collect all file items
$ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
//$file_ids = $page_obj->getFileItemIds();
foreach($file_ids as $file_id)
{
$this->file_ids[$file_id] = $file_id;
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
$a_xml_writer->xmlEndTag("PageObject");
//unset($page_obj);
$ilBench->stop("ContentObjectExport", "exportPageObject");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjQuestionPool::getAllQuestionIds ( )

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

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

{
global $ilDB;
$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",
array('integer','text'),
array($this->getId(), 1)
);
$questions = array();
if ($query_result->numRows())
{
while ($row = $ilDB->fetchAssoc($query_result))
{
if ($row["plugin"])
{
if ($this->isPluginActive($row["type_tag"]))
{
array_push($questions, $row["question_id"]);
}
}
else
{
array_push($questions, $row["question_id"]);
}
}
}
return $questions;
}

+ Here is the call graph for this function:

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

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

Referenced by deleteQuestionpool().

{
global $ilDB;
$result = $ilDB->queryF("SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND qpl_questions.tstamp > 0 AND original_id IS NULL",
array('integer'),
array($this->getId())
);
$questions = array();
while ($row = $ilDB->fetchAssoc($result))
{
array_push($questions, $row["question_id"]);
}
return $questions;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

{
global $ilDB, $ilLog;
$result = array();
$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");
if ($query_result->numRows())
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
while ($row = $ilDB->fetchAssoc($query_result))
{
if (!assQuestion::_isUsedInRandomTest($row["question_id"]))
{
array_push($result, $row);
}
else
{
// the question was used in a random test prior to ILIAS 3.7 so it was inserted
// as a reference to the original question pool object and not as a copy. To allow
// the deletion of the question pool object, a copy must be created and all database references
// of the original question must changed with the reference of the copy
// 1. Create a copy of the original question
$question =& $this->createQuestion("", $row["question_id"]);
$duplicate_id = $question->object->duplicate(true);
if ($duplicate_id > 0)
{
// 2. replace the question id in the solutions
$affectedRows = $ilDB->manipulateF("UPDATE tst_solutions SET question_fi = %s WHERE question_fi = %s",
array('integer','integer'),
array($duplicate_id, $row["question_id"])
);
// 3. replace the question id in the question list of random tests
$affectedRows = $ilDB->manipulateF("UPDATE tst_test_rnd_qst SET question_fi = %s WHERE question_fi = %s",
array('integer','integer'),
array($duplicate_id, $row["question_id"])
);
// 4. replace the question id in the test results
$affectedRows = $ilDB->manipulateF("UPDATE tst_test_result SET question_fi = %s WHERE question_fi = %s",
array('integer','integer'),
array($duplicate_id, $row["question_id"])
);
// 5. replace the question id in the test&assessment log
$affectedRows = $ilDB->manipulateF("UPDATE ass_log SET question_fi = %s WHERE question_fi = %s",
array('integer','integer'),
array($duplicate_id, $row["question_id"])
);
// 6. The original question can be deleted, so add it to the list of questions
array_push($result, $row);
}
}
}
}
return $result;
}

+ Here is the call graph for this function:

ilObjQuestionPool::getDescription ( )

get description of content object

Returns
string description

Reimplemented from ilObject.

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

{
}
ilObjQuestionPool::getExportDirectory (   $type = "")

get export directory of questionpool

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

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

Referenced by createExportDirectory().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
switch ($type)
{
case 'xls':
case 'zip':
$export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export_$type";
break;
default:
$export_dir = ilUtil::getDataDir()."/qpl_data"."/qpl_".$this->getId()."/export";
break;
}
return $export_dir;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::getImportDirectory ( )

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

References _getImportDirectory().

+ Here is the call graph for this function:

ilObjQuestionPool::getImportMapping ( )

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

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

{
if (!is_array($this->import_mapping))
{
return array();
}
else
{
return $this->import_mapping;
}
}
ilObjQuestionPool::getNavTaxonomyId ( )

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

References $navTaxonomyId.

Referenced by isNavTaxonomyActive(), and saveToDb().

{
}

+ Here is the caller graph for this function:

ilObjQuestionPool::getOnline ( )

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

References $online.

Referenced by cloneObject(), and saveToDb().

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

+ Here is the caller graph for this function:

ilObjQuestionPool::getPrintviewQuestions ( )

Calculates the data for the print view of the questionpool.

public

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

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

{
global $ilDB;
$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",
array('integer'),
array($this->getId())
);
$rows = array();
$types = $this->getQuestionTypeTranslations();
if ($query_result->numRows())
{
while ($row = $ilDB->fetchAssoc($query_result))
{
$row['ttype'] = $types[$row['type_tag']];
if ($row["plugin"])
{
if ($this->isPluginActive($row["type_tag"]))
{
array_push($rows, $row);
}
}
else
{
array_push($rows, $row);
}
}
}
return $rows;
}

+ Here is the call graph for this function:

& ilObjQuestionPool::getQplQuestions ( )

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

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

Referenced by cloneObject().

{
global $ilDB;
$questions = array();
$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",
array('integer'),
array($this->getId())
);
while ($row = $ilDB->fetchAssoc($result))
{
array_push($questions, $row["question_id"]);
}
return $questions;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References $ilDB, $result, and $row.

{
global $ilDB;
$result = array();
$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");
if ($query_result->numRows())
{
while ($row = $ilDB->fetchAssoc($query_result))
{
array_push($result, $row);
}
}
return $result;
}
& ilObjQuestionPool::getQuestionList ( )

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

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

{
global $ilDB;
$questions = array();
$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",
array('integer'),
array($this->getId())
);
while ($row = $ilDB->fetchAssoc($result))
{
array_push($questions, $row);
}
return $questions;
}

+ Here is the call graph for this function:

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

References $ilDB, and $result.

{
global $ilDB;
if ($question_id < 1)
{
return;
}
$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",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
return $data["type_tag"];
}
else
{
return;
}
}
static ilObjQuestionPool::getQuestionTypeByTypeId (   $type_id)
static

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

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

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

{
global $ilDB;
$query = "SELECT type_tag FROM qpl_qst_type WHERE question_type_id = %s";
$types = array('integer');
$values = array($type_id);
$result = $ilDB->queryF($query, $types, $values);
if ($row = $ilDB->fetchAssoc($result)) {
return $row['type_tag'];
}
}

+ Here is the caller graph for this function:

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

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

References _getQuestionTypes().

{
return $this->_getQuestionTypes($all_tags, $fixOrder);
}

+ Here is the call graph for this function:

static ilObjQuestionPool::getQuestionTypeTranslations ( )
static

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

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

Referenced by getPrintviewQuestions().

{
global $ilDB;
global $lng;
global $ilLog;
global $ilPluginAdmin;
$lng->loadLanguageModule("assessment");
$result = $ilDB->query("SELECT * FROM qpl_qst_type");
$types = array();
while ($row = $ilDB->fetchAssoc($result))
{
if ($row["plugin"] == 0)
{
$types[$row['type_tag']] = $lng->txt($row["type_tag"]);
}
else
{
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
foreach ($pl_names as $pl_name)
{
$pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
if (strcmp($pl->getQuestionType(), $row["type_tag"]) == 0)
{
$types[$row['type_tag']] = $pl->getQuestionTypeTranslation();
}
}
}
}
ksort($types);
return $types;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::getShowTaxonomies ( )

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

References $showTaxonomies.

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

{
}

+ Here is the caller graph for this function:

ilObjQuestionPool::getTaxonomyIds ( )

get ids of all taxonomies corresponding to current pool

Returns
array

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

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

{
require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
}

+ Here is the call graph for this function:

ilObjQuestionPool::getTitle ( )

get title of glossary object

Returns
string title

Reimplemented from ilObject.

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

Referenced by updateMetaData().

{
return parent::getTitle();
}

+ Here is the caller graph for this function:

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

{
$this->type = "qpl";
$this->ilObject($a_id,$a_call_by_reference);
$this->setOnline(0);
}

+ Here is the call graph for this function:

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

References $ilDB, $result, and $row.

{
global $ilDB;
$result = $ilDB->queryF("SELECT COUNT(solution_id) solution_count FROM tst_solutions WHERE question_fi = %s",
array('integer'),
array($question_id)
);
$row = $ilDB->fetchAssoc($result);
return $row["solution_count"];
}
ilObjQuestionPool::isNavTaxonomyActive ( )

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

References getNavTaxonomyId(), and getShowTaxonomies().

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

+ Here is the call graph for this function:

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

References IL_COMP_MODULE.

Referenced by getAllQuestionIds(), and getPrintviewQuestions().

{
global $ilPluginAdmin;
if ($ilPluginAdmin->isActive(IL_COMP_MODULE, "TestQuestionPool", "qst", $a_pname))
{
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the caller graph for this function:

ilObjQuestionPool::loadFromDb ( )

Loads a ilObjQuestionpool object from a database.

public

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

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

Referenced by read().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM qpl_questionpool WHERE obj_fi = %s",
array('integer'),
array($this->getId())
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$this->setOnline($row['isonline']);
$this->setShowTaxonomies($row['show_taxonomies']);
$this->setNavTaxonomyId($row['nav_taxonomy']);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::modifyExportIdentifier (   $a_tag,
  $a_param,
  $a_value 
)

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

References ilUtil\insertInstIntoID().

{
if ($a_tag == "Identifier" && $a_param == "Entry")
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$a_value = ilUtil::insertInstIntoID($a_value);
}
return $a_value;
}

+ Here is the call graph for this function:

ilObjQuestionPool::moveToClipboard (   $question_id)

Moves a question to the clipboard.

Parameters
integer$question_idObject id of the question private

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

References $_SESSION.

{
if (!array_key_exists("qpl_clipboard", $_SESSION))
{
$_SESSION["qpl_clipboard"] = array();
}
$_SESSION["qpl_clipboard"][$question_id] = array("question_id" => $question_id, "action" => "move");
}
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

Reimplemented from ilObject.

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

References $_GET, and ilObject\getType().

{
global $tree;
switch ($a_event)
{
case "link":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
//exit;
break;
case "cut":
//echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
//exit;
break;
case "copy":
//var_dump("<pre>",$a_params,"</pre>");
//echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
//exit;
break;
case "paste":
//echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
//exit;
break;
case "new":
//echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
//exit;
break;
}
// At the beginning of the recursive process it avoids second call of the notify function with the same parameter
if ($a_node_id==$_GET["ref_id"])
{
$parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
$parent_type = $parent_obj->getType();
if($parent_type == $this->getType())
{
$a_node_id = (int) $tree->getParentId($a_node_id);
}
}
parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
}

+ Here is the call graph for this function:

ilObjQuestionPool::pasteFromClipboard ( )

Copies/Moves a question from the clipboard.

private

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

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

{
global $ilDB;
$success = false;
if (array_key_exists("qpl_clipboard", $_SESSION))
{
$success = true;
foreach ($_SESSION["qpl_clipboard"] as $question_object)
{
if (strcmp($question_object["action"], "move") == 0)
{
$result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
array('integer'),
array($question_object["question_id"])
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$source_questionpool = $row["obj_fi"];
// change the questionpool id in the qpl_questions table
$affectedRows = $ilDB->manipulateF("UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s",
array('integer','integer'),
array($this->getId(), $question_object["question_id"])
);
if(!$affectedRows)
{
$success = false;
}
// move question data to the new target directory
$source_path = CLIENT_WEB_DIR . "/assessment/" . $source_questionpool . "/" . $question_object["question_id"] . "/";
if (@is_dir($source_path))
{
$target_path = CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/";
if (!@is_dir($target_path))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::makeDirParents($target_path);
}
@rename($source_path, $target_path . $question_object["question_id"]);
}
// update question count of source question pool
}
}
else
{
$new_question_id = $this->copyQuestion($question_object["question_id"], $this->getId());
if(!$new_question_id)
{
$success = false;
}
}
}
}
// update question count of question pool
unset($_SESSION["qpl_clipboard"]);
return (bool)$success;
}

+ Here is the call graph for this function:

ilObjQuestionPool::purgeQuestions ( )

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

References $ilDB, and $ilUser.

{
global $ilDB, $ilUser;
require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
$incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
$incompleteQuestionPurger->setOwnerId($ilUser->getId());
$incompleteQuestionPurger->purge();
}
ilObjQuestionPool::read (   $a_force_db = false)

read object data from db into object

Parameters
booleanpublic

Reimplemented from ilObject.

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

References loadFromDb().

{
parent::read($a_force_db);
$this->loadFromDb();
}

+ Here is the call graph for this function:

ilObjQuestionPool::saveToDb ( )

Saves a ilObjQuestionpool object to a database.

public

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

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

Referenced by createReference().

{
global $ilDB;
$result = $ilDB->queryF("SELECT id_questionpool FROM qpl_questionpool WHERE obj_fi = %s",
array('integer'),
array($this->getId())
);
if ($result->numRows() == 1)
{
$result = $ilDB->update('qpl_questionpool',
array(
'isonline' => array('text', $this->getOnline()),
'show_taxonomies' => array('integer', (int)$this->getShowTaxonomies()),
'nav_taxonomy' => array('integer', (int)$this->getNavTaxonomyId()),
'tstamp' => array('integer', time())
),
array(
'obj_fi' => array('integer', $this->getId())
)
);
}
else
{
$next_id = $ilDB->nextId('qpl_questionpool');
$result = $ilDB->insert('qpl_questionpool', array(
'id_questionpool' => array('integer', $next_id),
'isonline' => array('text', $this->getOnline()),
'show_taxonomies' => array('integer', (int)$this->getShowTaxonomies()),
'nav_taxonomy' => array('integer', (int)$this->getNavTaxonomyId()),
'tstamp' => array('integer', time()),
'obj_fi' => array('integer', $this->getId())
));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjQuestionPool::setDescription (   $a_description)

set description of content object

Reimplemented from ilObject.

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

{
parent::setDescription($a_description);
}
ilObjQuestionPool::setNavTaxonomyId (   $navTaxonomyId)

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

References $navTaxonomyId.

Referenced by loadFromDb().

{
$this->navTaxonomyId = $navTaxonomyId;
}

+ Here is the caller graph for this function:

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

Referenced by ilObjQuestionPool(), and loadFromDb().

{
switch ($a_online_status)
{
case 0:
case 1:
$this->online = $a_online_status;
break;
default:
$this->online = 0;
break;
}
}

+ Here is the caller graph for this function:

ilObjQuestionPool::setShowTaxonomies (   $showTaxonomies)

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

References $showTaxonomies.

Referenced by loadFromDb().

{
$this->showTaxonomies = $showTaxonomies;
}

+ Here is the caller graph for this function:

ilObjQuestionPool::setTitle (   $a_title)

set title of glossary object

Reimplemented from ilObject.

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

{
parent::setTitle($a_title);
}
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 895 of file class.ilObjQuestionPool.php.

References createQuestion().

{
$xml = "";
// export button was pressed
if (count($questions) > 0)
{
foreach ($questions as $key => $value)
{
$question =& $this->createQuestion("", $value);
$xml .= $question->object->toXML();
}
if (count($questions) > 1)
{
$xml = preg_replace("/<\/questestinterop>\s*<.xml.*?>\s*<questestinterop>/", "", $xml);
}
}
$xml = preg_replace("/(<\?xml[^>]*?>)/", "\\1" . "<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">", $xml);
return $xml;
}

+ Here is the call graph for this function:

ilObjQuestionPool::update ( )

update object data

public

Returns
boolean

Reimplemented from ilObject.

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

References updateMetaData().

{
$this->updateMetaData();
if (!parent::update())
{
return false;
}
// put here object specific stuff
return true;
}

+ Here is the call graph for this function:

ilObjQuestionPool::updateMetaData ( )

update meta data entry

Reimplemented from ilObject.

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

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

Referenced by update().

{
global $ilUser;
include_once "./Services/MetaData/classes/class.ilMD.php";
$md =& new ilMD($this->getId(), 0, $this->getType());
$md_gen =& $md->getGeneral();
if ($md_gen == false)
{
include_once "./Services/MetaData/classes/class.ilMDCreator.php";
$md_creator = new ilMDCreator($this->getId(),0,$this->getType());
$md_creator->setTitle($this->getTitle());
$md_creator->setTitleLanguage($ilUser->getPref('language'));
$md_creator->create();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilObjQuestionPool::$import_dir
private

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

ilObjQuestionPool::$navTaxonomyId = null
private

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

Referenced by getNavTaxonomyId(), and setNavTaxonomyId().

ilObjQuestionPool::$online

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

Referenced by getOnline().

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: