Inheritance diagram for ilObjSurveyQuestionPool:
Collaboration diagram for ilObjSurveyQuestionPool:Public Member Functions | |
| ilObjSurveyQuestionPool ($a_id=0, $a_call_by_reference=true) | |
| Constructor public. | |
| create ($a_upload=false) | |
| create question pool object | |
| update () | |
| update object data | |
| read ($a_force_db=false) | |
| read object data from db into object | |
| cloneObject ($a_target_id, $a_copy_id=0) | |
| Creates a 1:1 copy of the object and places the copy in a given repository. | |
| & | createQuestion ($question_type, $question_id=-1) |
| copyQuestion ($question_id, $questionpool_to) | |
| Copies a question into another question pool. | |
| loadFromDb () | |
| Loads a ilObjQuestionpool object from a database. | |
| saveToDb () | |
| Saves a ilObjSurveyQuestionPool object to a database. | |
| delete () | |
| delete object and all related data | |
| deleteAllData () | |
| 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. | |
| getTitle () | |
| get title of survey question pool object | |
| setTitle ($a_title) | |
| set title of survey question pool object | |
| removeQuestion ($question_id) | |
| Removes a question from the question pool. | |
| getQuestiontype ($question_id) | |
| Returns the question type of a question with a given id. | |
| isInUse ($question_id) | |
| Checks if a question is in use by a survey. | |
| paste ($question_id) | |
| Pastes a question in the question pool. | |
| & | getQuestionsInfo ($question_array) |
| Retrieves the datase entries for questions from a given array. | |
| duplicateQuestion ($question_id, $obj_id="") | |
| Duplicates a question for a questionpool. | |
| getQuestionsTable ($sort, $sortorder, $filter_text, $sel_filter_type, $startrow=0) | |
| Calculates the data for the output of the questionpool. | |
| createExportDirectory () | |
| creates data directory for export files (data_dir/spl_data/spl_<id>/export, depending on data directory that is set in ILIAS setup/ini) | |
| getExportDirectory () | |
| get export directory of survey | |
| getExportFiles ($dir) | |
| get export files | |
| createImportDirectory () | |
| creates data directory for import files (data_dir/spl_data/spl_<id>/import, depending on data directory that is set in ILIAS setup/ini) | |
| getImportDirectory () | |
| get import directory of survey | |
| toXML ($questions) | |
| export questions to xml | |
| & | getQuestions () |
| importObject ($source, $spl_exists=FALSE) | |
| Imports survey questions into ILIAS. | |
| setOnline ($a_online_status) | |
| Sets the questionpool online status. | |
| getOnline () | |
| _lookupOnline ($a_obj_id) | |
| _isWriteable ($object_id, $user_id) | |
| Returns true, if the question pool is writeable by a given user. | |
| & | _getQuestiontypes () |
| Creates a list of all available question types. | |
| & | _getAvailableQuestionpools ($use_object_id=FALSE, $could_be_offline=FALSE, $showPath=FALSE, $permission="read") |
| Returns the available question pools for the active user. | |
Data Fields | |
| $online | |
Definition at line 37 of file class.ilObjSurveyQuestionPool.php.
| & ilObjSurveyQuestionPool::_getAvailableQuestionpools | ( | $ | use_object_id = FALSE, |
|
| $ | could_be_offline = FALSE, |
|||
| $ | showPath = FALSE, |
|||
| $ | permission = "read" | |||
| ) |
Returns the available question pools for the active user.
Returns the available question pools for the active user
Definition at line 978 of file class.ilObjSurveyQuestionPool.php.
References ilObject::$title, ilUtil::_getObjectsByOperations(), and ilObject::_prepareCloneSelection().
Referenced by ilObjSurvey::getAvailableQuestionpools(), and ilObjSurvey::getQuestionpoolTitles().
{
global $ilUser;
global $ilDB;
$result_array = array();
$qpls = ilUtil::_getObjectsByOperations("spl", $permission, $ilUser->getId(), -1);
$titles = ilObject::_prepareCloneSelection($qpls, "spl");
if (count($qpls))
{
$query = "";
if ($could_be_offline)
{
$query = sprintf("SELECT object_data.*, object_reference.ref_id FROM object_data, object_reference, survey_questionpool WHERE object_data.obj_id = object_reference.obj_id AND object_reference.ref_id IN ('%s') AND survey_questionpool.obj_fi = object_data.obj_id ORDER BY object_data.title",
implode("','", $qpls)
);
}
else
{
$query = sprintf("SELECT object_data.*, object_reference.ref_id FROM object_data, object_reference, survey_questionpool WHERE object_data.obj_id = object_reference.obj_id AND object_reference.ref_id IN ('%s') AND survey_questionpool.online = '1' AND survey_questionpool.obj_fi = object_data.obj_id ORDER BY object_data.title",
implode("','", $qpls)
);
}
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$title = (($showPath) ? $titles[$row["ref_id"]] : $row["title"]);
if ($use_object_id)
{
$result_array[$row["obj_id"]] = $title;
}
else
{
$result_array[$row["ref_id"]] = $title;
}
}
}
return $result_array;
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilObjSurveyQuestionPool::_getQuestiontypes | ( | ) |
Creates a list of all available question types.
Creates a list of all available question types
Definition at line 956 of file class.ilObjSurveyQuestionPool.php.
{
global $ilDB;
$questiontypes = array();
$query = "SELECT * FROM survey_questiontype ORDER BY type_tag";
$query_result = $ilDB->query($query);
while ($row = $query_result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($questiontypes, $row["type_tag"]);
}
return $questiontypes;
}
| ilObjSurveyQuestionPool::_isWriteable | ( | $ | object_id, | |
| $ | user_id | |||
| ) |
Returns true, if the question pool is writeable by a given user.
Returns true, if the question pool is writeable by a given user
| integer | $object_id The object id of the question pool | |
| integer | $user_id The database id of the user public |
Definition at line 927 of file class.ilObjSurveyQuestionPool.php.
References ilObject::_hasUntrashedReference().
{
global $rbacsystem;
global $ilDB;
$result_array = array();
$query = sprintf("SELECT object_data.*, object_data.obj_id, object_reference.ref_id FROM object_data, object_reference WHERE object_data.obj_id = object_reference.obj_id AND object_data.obj_id = %s",
$ilDB->quote($object_id . "")
);
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
include_once "./classes/class.ilObject.php";
if ($rbacsystem->checkAccess("write", $row["ref_id"]) && (ilObject::_hasUntrashedReference($row["obj_id"])))
{
return true;
}
}
return false;
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::_lookupOnline | ( | $ | a_obj_id | ) |
Definition at line 902 of file class.ilObjSurveyQuestionPool.php.
Referenced by ilObjSurveyQuestionPoolListGUI::getProperties().
{
global $ilDB;
$query = sprintf("SELECT online FROM survey_questionpool WHERE obj_fi = %s",
$ilDB->quote($a_obj_id . "")
);
$result = $ilDB->query($query);
if ($result->numRows() == 1)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $row["online"];
}
return 0;
}
Here is the caller graph for this function:| ilObjSurveyQuestionPool::cloneObject | ( | $ | a_target_id, | |
| $ | a_copy_id = 0 | |||
| ) |
Creates a 1:1 copy of the object and places the copy in a given repository.
Creates a 1:1 copy of the object and places the copy in a given repository
public
Reimplemented from ilObject.
Definition at line 107 of file class.ilObjSurveyQuestionPool.php.
References $ilLog, ilObject::getId(), getOnline(), getQuestions(), and ilObject::getType().
{
global $ilLog;
$newObj = parent::cloneObject($a_target_id,$a_copy_id);
$newObj->setOnline($this->getOnline());
$newObj->saveToDb();
// clone the questions in the question pool
$questions =& $this->getQuestions();
foreach ($questions as $question_id)
{
$newObj->copyQuestion($question_id, $newObj->getId());
}
// 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();
return $newObj;
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::copyQuestion | ( | $ | question_id, | |
| $ | questionpool_to | |||
| ) |
Copies a question into another question pool.
Copies a question into another question pool
| integer | $question_id Database id of the question | |
| integer | $questionpool_to Database id of the target questionpool public |
Definition at line 158 of file class.ilObjSurveyQuestionPool.php.
References createQuestion(), duplicateQuestion(), and ilObject::getId().
{
$question_gui =& $this->createQuestion("", $question_id);
if ($question_gui->object->getObjId() == $questionpool_to)
{
// the question is copied into the same question pool
$this->duplicateQuestion($question_id);
}
else
{
// the question is copied into another question pool
$newtitle = $question_gui->object->getTitle();
if ($question_gui->object->questionTitleExists($question_gui->object->getTitle(), $questionpool_to))
{
$counter = 2;
while ($question_gui->object->questionTitleExists($question_gui->object->getTitle() . " ($counter)", $questionpool_to))
{
$counter++;
}
$newtitle = $question_gui->object->getTitle() . " ($counter)";
}
$question_gui->object->copyObject($this->getId(), $newtitle);
}
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::create | ( | $ | a_upload = false |
) |
create question pool object
Definition at line 61 of file class.ilObjSurveyQuestionPool.php.
References ilObject::create(), and ilObject::createMetaData().
{
parent::create();
if(!$a_upload)
{
$this->createMetaData();
}
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::createExportDirectory | ( | ) |
creates data directory for export files (data_dir/spl_data/spl_<id>/export, depending on data directory that is set in ILIAS setup/ini)
Definition at line 632 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$spl_data_dir = ilUtil::getDataDir()."/spl_data";
ilUtil::makeDir($spl_data_dir);
if(!is_writable($spl_data_dir))
{
$this->ilias->raiseError("Survey Questionpool Data Directory (".$spl_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
// create learning module directory (data_dir/lm_data/lm_<id>)
$spl_dir = $spl_data_dir."/spl_".$this->getId();
ilUtil::makeDir($spl_dir);
if(!@is_dir($spl_dir))
{
$this->ilias->raiseError("Creation of Survey Questionpool Directory failed.",$this->ilias->error_obj->FATAL);
}
// create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
$export_dir = $spl_dir."/export";
ilUtil::makeDir($export_dir);
if(!@is_dir($export_dir))
{
$this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
}
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::createImportDirectory | ( | ) |
creates data directory for import files (data_dir/spl_data/spl_<id>/import, depending on data directory that is set in ILIAS setup/ini)
Definition at line 713 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$spl_data_dir = ilUtil::getDataDir()."/spl_data";
ilUtil::makeDir($spl_data_dir);
if(!is_writable($spl_data_dir))
{
$this->ilias->raiseError("Survey Questionpool Data Directory (".$spl_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
// create test directory (data_dir/spl_data/spl_<id>)
$spl_dir = $spl_data_dir."/spl_".$this->getId();
ilUtil::makeDir($spl_dir);
if(!@is_dir($spl_dir))
{
$this->ilias->raiseError("Creation of Survey Questionpool Directory failed.",$this->ilias->error_obj->FATAL);
}
// create import subdirectory (data_dir/spl_data/spl_<id>/import)
$import_dir = $spl_dir."/import";
ilUtil::makeDir($import_dir);
if(!@is_dir($import_dir))
{
$this->ilias->raiseError("Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
}
}
Here is the call graph for this function:| & ilObjSurveyQuestionPool::createQuestion | ( | $ | question_type, | |
| $ | question_id = -1 | |||
| ) |
Definition at line 130 of file class.ilObjSurveyQuestionPool.php.
References getQuestiontype().
Referenced by copyQuestion().
{
if ((!$question_type) and ($question_id > 0))
{
$question_type = $this->getQuestiontype($question_id);
}
include_once "./Modules/SurveyQuestionPool/classes/class.".$question_type."GUI.php";
$question_type_gui = $question_type . "GUI";
$question =& new $question_type_gui();
if ($question_id > 0)
{
$question->object->loadFromDb($question_id);
}
return $question;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjSurveyQuestionPool::delete | ( | ) |
delete object and all related data
public
Reimplemented from ilObject.
Definition at line 250 of file class.ilObjSurveyQuestionPool.php.
References deleteAllData(), and ilObject::deleteMetaData().
{
$remove = parent::delete();
// always call parent delete function first!!
if (!$remove)
{
return false;
}
// delete all related questions
$this->deleteAllData();
// delete meta data
$this->deleteMetaData();
return true;
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::deleteAllData | ( | ) |
Definition at line 268 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::delDir(), ilUtil::getDataDir(), ilObject::getId(), and removeQuestion().
Referenced by delete().
{
$query = sprintf("SELECT question_id FROM survey_question WHERE obj_fi = %s AND original_id IS NULL",
$this->ilias->db->quote($this->getId())
);
$result = $this->ilias->db->query($query);
$found_questions = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$this->removeQuestion($row["question_id"]);
}
// delete export files
include_once "./Services/Utilities/classes/class.ilUtil.php";
$spl_data_dir = ilUtil::getDataDir()."/spl_data";
$directory = $spl_data_dir."/spl_".$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:| ilObjSurveyQuestionPool::duplicateQuestion | ( | $ | question_id, | |
| $ | obj_id = "" | |||
| ) |
Duplicates a question for a questionpool.
Duplicates a question for a questionpool
| integer | $question_id The database id of the question public |
Definition at line 500 of file class.ilObjSurveyQuestionPool.php.
References getQuestiontype().
Referenced by copyQuestion(), and paste().
{
global $ilUser;
$questiontype = $this->getQuestiontype($question_id);
include_once "./Modules/SurveyQuestionPool/classes/class.$questiontype.php";
$question = new $questiontype();
$question->loadFromDb($question_id);
$suffix = "";
$counter = 1;
while ($question->questionTitleExists($question->getTitle().$suffix, $obj_id))
{
$counter++;
if ($counter > 1) $suffix = " ($counter)";
}
if ($obj_id)
{
$question->setObjId($obj_id);
}
$question->duplicate(false, $question->getTitle() . $suffix, $ilUser->fullname, $ilUser->id);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjSurveyQuestionPool::getExportDirectory | ( | ) |
get export directory of survey
Definition at line 662 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::getDataDir().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$export_dir = ilUtil::getDataDir()."/spl_data"."/spl_".$this->getId()."/export";
return $export_dir;
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::getExportFiles | ( | $ | dir | ) |
get export files
Definition at line 672 of file class.ilObjSurveyQuestionPool.php.
{
// quit if import dir not available
if (!@is_dir($dir) or
!is_writeable($dir))
{
return array();
}
// open directory
$dir = dir($dir);
// initialize array
$file = array();
// get files and save the in the array
while ($entry = $dir->read())
{
if ($entry != "." and
$entry != ".." and
substr($entry, -4) == ".xml" and
ereg("^[0-9]{10}_{2}[0-9]+_{2}(spl__)*[0-9]+\.xml\$", $entry))
{
$file[] = $entry;
}
}
// close import directory
$dir->close();
// sort files
sort ($file);
reset ($file);
return $file;
}
| ilObjSurveyQuestionPool::getImportDirectory | ( | ) |
get import directory of survey
Definition at line 745 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::getDataDir().
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$import_dir = ilUtil::getDataDir()."/spl_data".
"/spl_".$this->getId()."/import";
if(@is_dir($import_dir))
{
return $import_dir;
}
else
{
return false;
}
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::getOnline | ( | ) |
Definition at line 896 of file class.ilObjSurveyQuestionPool.php.
Referenced by cloneObject().
{
if (strcmp($this->online, "") == 0) $this->online = "0";
return $this->online;
}
Here is the caller graph for this function:| & ilObjSurveyQuestionPool::getQuestions | ( | ) |
Definition at line 822 of file class.ilObjSurveyQuestionPool.php.
Referenced by cloneObject(), and toXML().
{
$questions = array();
$query = sprintf("SELECT question_id FROM survey_question WHERE obj_fi = %s AND ISNULL(original_id)",
$this->ilias->db->quote($this->getId() . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($questions, $row["question_id"]);
}
}
return $questions;
}
Here is the caller graph for this function:| & ilObjSurveyQuestionPool::getQuestionsInfo | ( | $ | question_array | ) |
Retrieves the datase entries for questions from a given array.
Retrieves the datase entries for questions from a given array
| array | $question_array An array containing the id's of the questions |
Definition at line 478 of file class.ilObjSurveyQuestionPool.php.
{
$result_array = array();
$query = sprintf("SELECT survey_question.*, survey_questiontype.type_tag FROM survey_question, survey_questiontype WHERE survey_question.questiontype_fi = survey_questiontype.questiontype_id AND survey_question.question_id IN ('%s')",
join($question_array, "','")
);
$result = $this->ilias->db->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
array_push($result_array, $row);
}
return $result_array;
}
| ilObjSurveyQuestionPool::getQuestionsTable | ( | $ | sort, | |
| $ | sortorder, | |||
| $ | filter_text, | |||
| $ | sel_filter_type, | |||
| $ | startrow = 0 | |||
| ) |
Calculates the data for the output of the questionpool.
Calculates the data for the output of the questionpool
public
Definition at line 528 of file class.ilObjSurveyQuestionPool.php.
References ilObject::getId(), and ilUtil::getImagePath().
{
global $ilUser;
$where = "";
if (strlen($filter_text) > 0)
{
switch($sel_filter_type)
{
case "title":
$where = " AND survey_question.title LIKE " . $this->ilias->db->quote("%" . $filter_text . "%");
break;
case "description":
$where = " AND survey_question.description LIKE " . $this->ilias->db->quote("%" . $filter_text . "%");
break;
case "author":
$where = " AND survey_question.author LIKE " . $this->ilias->db->quote("%" . $filter_text . "%");
break;
}
}
// build sort order for sql query
$order = "";
$images = array();
include_once "./Services/Utilities/classes/class.ilUtil.php";
switch ($sort)
{
case "title":
$order = " ORDER BY title $sortorder";
$images["title"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . strtolower($sortorder) . "ending order\" />";
break;
case "description":
$order = " ORDER BY description $sortorder";
$images["description"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . strtolower($sortorder) . "ending order\" />";
break;
case "type":
$order = " ORDER BY questiontype_id $sortorder";
$images["type"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . strtolower($sortorder) . "ending order\" />";
break;
case "author":
$order = " ORDER BY author $sortorder";
$images["author"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . strtolower($sortorder) . "ending order\" />";
break;
case "created":
$order = " ORDER BY created $sortorder";
$images["created"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . strtolower($sortorder) . "ending order\" />";
break;
case "updated":
$order = " ORDER BY TIMESTAMP14 $sortorder";
$images["updated"] = " <img src=\"" . ilUtil::getImagePath(strtolower($sortorder) . "_order.gif") . "\" alt=\"" . strtolower($sortorder) . "ending order\" />";
break;
}
$maxentries = $ilUser->prefs["hits_per_page"];
if ($maxentries < 1)
{
$maxentries = 9999;
}
$query = "SELECT survey_question.question_id, survey_question.TIMESTAMP + 0 AS TIMESTAMP14 FROM survey_question, survey_questiontype WHERE survey_question.questiontype_fi = survey_questiontype.questiontype_id AND survey_question.obj_fi = " . $this->getId() . " AND ISNULL(survey_question.original_id) $where$order$limit";
$query_result = $this->ilias->db->query($query);
$max = $query_result->numRows();
if ($startrow > $max -1)
{
$startrow = $max - ($max % $maxentries);
}
else if ($startrow < 0)
{
$startrow = 0;
}
$limit = " LIMIT $startrow, $maxentries";
$query = "SELECT survey_question.*, survey_question.TIMESTAMP + 0 AS TIMESTAMP14, survey_questiontype.type_tag FROM survey_question, survey_questiontype WHERE survey_question.questiontype_fi = survey_questiontype.questiontype_id AND survey_question.obj_fi = " . $this->getId() . " AND ISNULL(survey_question.original_id) $where$order$limit";
$query_result = $this->ilias->db->query($query);
$rows = array();
if ($query_result->numRows())
{
while ($row = $query_result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($rows, $row);
}
}
$nextrow = $startrow + $maxentries;
if ($nextrow > $max - 1)
{
$nextrow = $startrow;
}
$prevrow = $startrow - $maxentries;
if ($prevrow < 0)
{
$prevrow = 0;
}
return array(
"rows" => $rows,
"images" => $images,
"startrow" => $startrow,
"nextrow" => $nextrow,
"prevrow" => $prevrow,
"step" => $maxentries,
"rowcount" => $max
);
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::getQuestiontype | ( | $ | question_id | ) |
Returns the question type of a question with a given id.
Returns the question type of a question with a given id
| integer | $question_id The database id of the question |
Definition at line 403 of file class.ilObjSurveyQuestionPool.php.
References $data.
Referenced by createQuestion(), duplicateQuestion(), and toXML().
{
if ($question_id < 1)
return;
$query = sprintf("SELECT survey_questiontype.type_tag FROM survey_question, survey_questiontype WHERE survey_question.questiontype_fi = survey_questiontype.questiontype_id AND survey_question.question_id = %s",
$this->ilias->db->quote($question_id)
);
$result = $this->ilias->db->query($query);
if ($result->numRows() == 1) {
$data = $result->fetchRow(DB_FETCHMODE_OBJECT);
return $data->type_tag;
} else {
return;
}
}
Here is the caller graph for this function:| ilObjSurveyQuestionPool::getTitle | ( | ) |
get title of survey question pool object
Reimplemented from ilObject.
Definition at line 362 of file class.ilObjSurveyQuestionPool.php.
Referenced by toXML().
{
//return $this->title;
return parent::getTitle();
}
Here is the caller graph for this function:| ilObjSurveyQuestionPool::ilObjSurveyQuestionPool | ( | $ | a_id = 0, |
|
| $ | a_call_by_reference = true | |||
| ) |
Constructor public.
| integer | reference_id or object_id | |
| boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 52 of file class.ilObjSurveyQuestionPool.php.
References ilObject::ilObject().
{
$this->type = "spl";
$this->ilObject($a_id,$a_call_by_reference);
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::importObject | ( | $ | source, | |
| $ | spl_exists = FALSE | |||
| ) |
Imports survey questions into ILIAS.
Imports survey questions into ILIAS
| string | $source The filename of an XML import file public |
Definition at line 847 of file class.ilObjSurveyQuestionPool.php.
{
if (is_file($source))
{
$fh = fopen($source, "r") or die("");
$xml = fread($fh, filesize($source));
fclose($fh) or die("");
if (strpos($xml, "questestinterop") > 0)
{
// survey questions for ILIAS < 3.8
include_once "./Services/Survey/classes/class.SurveyImportParserPre38.php";
$import = new SurveyImportParserPre38($this, "", $spl_exists);
$import->setXMLContent($xml);
$import->startParsing();
}
else
{
// survey questions for ILIAS >= 3.8
include_once "./Services/Survey/classes/class.SurveyImportParser.php";
$import = new SurveyImportParser($this, "", $spl_exists);
$import->setXMLContent($xml);
$import->startParsing();
}
}
}
| ilObjSurveyQuestionPool::isInUse | ( | $ | question_id | ) |
Checks if a question is in use by a survey.
Checks if a question is in use by a survey
| integer | $question_id The database id of the question |
Definition at line 429 of file class.ilObjSurveyQuestionPool.php.
{
// check out the already answered questions
$query = sprintf("SELECT answer_id FROM survey_answer WHERE question_fi = %s",
$this->ilias->db->quote($question_id)
);
$result = $this->ilias->db->query($query);
$answered = $result->numRows();
// check out the questions inserted in surveys
$query = sprintf("SELECT survey_survey.* FROM survey_survey, survey_survey_question WHERE survey_survey_question.survey_fi = survey_survey.survey_id AND survey_survey_question.question_fi = %s",
$this->ilias->db->quote($question_id)
);
$result = $this->ilias->db->query($query);
$inserted = $result->numRows();
if (($inserted + $answered) == 0)
{
return false;
}
$result_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
{
array_push($result_array, $row);
}
return $result_array;
}
| ilObjSurveyQuestionPool::loadFromDb | ( | ) |
Loads a ilObjQuestionpool object from a database.
Loads a ilObjQuestionpool object from a database
public
Definition at line 190 of file class.ilObjSurveyQuestionPool.php.
References setOnline().
Referenced by read().
{
global $ilDB;
$query = sprintf("SELECT * FROM survey_questionpool WHERE obj_fi = %s",
$ilDB->quote($this->getId() . "")
);
$result = $ilDB->query($query);
if ($result->numRows() == 1)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$this->setOnline($row["online"]);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjSurveyQuestionPool::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
| string | event | |
| integer | reference id of object where the event occured | |
| array | passes optional parameters if required |
Reimplemented from ilObject.
Definition at line 304 of file class.ilObjSurveyQuestionPool.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:| ilObjSurveyQuestionPool::paste | ( | $ | question_id | ) |
Pastes a question in the question pool.
Pastes a question in the question pool
| integer | $question_id The database id of the question public |
Definition at line 464 of file class.ilObjSurveyQuestionPool.php.
References duplicateQuestion(), and ilObject::getId().
{
$this->duplicateQuestion($question_id, $this->getId());
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::read | ( | $ | a_force_db = false |
) |
read object data from db into object
| boolean | public |
Reimplemented from ilObject.
Definition at line 94 of file class.ilObjSurveyQuestionPool.php.
References loadFromDb().
{
parent::read($a_force_db);
$this->loadFromDb();
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::removeQuestion | ( | $ | question_id | ) |
Removes a question from the question pool.
Removes a question from the question pool
| integer | $question_id The database id of the question private |
Definition at line 384 of file class.ilObjSurveyQuestionPool.php.
References SurveyQuestion::_instanciateQuestion().
Referenced by deleteAllData().
{
if ($question_id < 1)
return;
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$question =& SurveyQuestion::_instanciateQuestion($question_id);
$question->delete($question_id);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjSurveyQuestionPool::saveToDb | ( | ) |
Saves a ilObjSurveyQuestionPool object to a database.
Saves a ilObjSurveyQuestionPool object to a database
public
Definition at line 212 of file class.ilObjSurveyQuestionPool.php.
{
global $ilDB;
$query = sprintf("SELECT * FROM survey_questionpool WHERE obj_fi = %s",
$ilDB->quote($this->getId() . "")
);
$result = $ilDB->query($query);
if ($result->numRows() == 1)
{
$query = sprintf("UPDATE survey_questionpool SET online = %s WHERE obj_fi = %s",
$ilDB->quote($this->getOnline() . ""),
$ilDB->quote($this->getId() . "")
);
$result = $ilDB->query($query);
if ($result != DB_OK)
{
}
}
else
{
$query = sprintf("INSERT INTO survey_questionpool (online, obj_fi) VALUES (%s, %s)",
$ilDB->quote($this->getOnline() . ""),
$ilDB->quote($this->getId() . "")
);
$result = $ilDB->query($query);
if ($result != DB_OK)
{
}
}
}
| ilObjSurveyQuestionPool::setOnline | ( | $ | a_online_status | ) |
Sets the questionpool online status.
Sets the questionpool online status
| integer | $a_online_status Online status of the questionpool |
Definition at line 882 of file class.ilObjSurveyQuestionPool.php.
Referenced by 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:| ilObjSurveyQuestionPool::setTitle | ( | $ | a_title | ) |
set title of survey question pool object
Reimplemented from ilObject.
Definition at line 371 of file class.ilObjSurveyQuestionPool.php.
{
parent::setTitle($a_title);
}
| ilObjSurveyQuestionPool::toXML | ( | $ | questions | ) |
export questions to xml
Definition at line 763 of file class.ilObjSurveyQuestionPool.php.
References ilObject::getId(), getQuestions(), getQuestiontype(), getTitle(), and ilObject::getType().
{
if (!is_array($questions))
{
$questions =& $this->getQuestions();
}
if (count($questions) == 0)
{
$questions =& $this->getQuestions();
}
$xml = "";
include_once("./classes/class.ilXmlWriter.php");
$a_xml_writer = new ilXmlWriter;
// set xml header
$a_xml_writer->xmlHeader();
$attrs = array(
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xsi:noNamespaceSchemaLocation" => "http://www.ilias.de/download/xsd/ilias_survey_3_8.xsd"
);
$a_xml_writer->xmlStartTag("surveyobject", $attrs);
$attrs = array(
"id" => "qpl_" . $this->getId(),
"label" => $this->getTitle()
);
$a_xml_writer->xmlStartTag("surveyquestions", $attrs);
$a_xml_writer->xmlElement("dummy", NULL, "dummy");
// add ILIAS specific metadata
$a_xml_writer->xmlStartTag("metadata");
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "SCORM");
include_once "./Services/MetaData/classes/class.ilMD.php";
$md = new ilMD($this->getId(),0, $this->getType());
$writer = new ilXmlWriter();
$md->toXml($writer);
$metadata = $writer->xmlDumpMem();
$a_xml_writer->xmlElement("fieldentry", NULL, $metadata);
$a_xml_writer->xmlEndTag("metadatafield");
$a_xml_writer->xmlEndTag("metadata");
$a_xml_writer->xmlEndTag("surveyquestions");
$a_xml_writer->xmlEndTag("surveyobject");
$xml = $a_xml_writer->xmlDumpMem(FALSE);
$questionxml = "";
foreach ($questions as $key => $value)
{
$questiontype = $this->getQuestiontype($value);
include_once "./Modules/SurveyQuestionPool/classes/class.$questiontype.php";
$question = new $questiontype();
$question->loadFromDb($value);
$questionxml .= $question->toXML(false);
}
$xml = str_replace("<dummy>dummy</dummy>", $questionxml, $xml);
return $xml;
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::update | ( | ) |
update object data
public
Reimplemented from ilObject.
Definition at line 76 of file class.ilObjSurveyQuestionPool.php.
References ilObject::updateMetaData().
{
$this->updateMetaData();
if (!parent::update())
{
return false;
}
// put here object specific stuff
return true;
}
Here is the call graph for this function:| ilObjSurveyQuestionPool::$online |
Definition at line 44 of file class.ilObjSurveyQuestionPool.php.
1.7.1