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 | |
ilClone ($a_parent_ref) | |
copy all entries of your object. | |
delete () | |
delete object and all related data | |
deleteAllData () | |
initDefaultRoles () | |
init default roles settings | |
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 | |
assignMetaData (&$a_meta_data) | |
assign a meta data object to survey question pool object | |
& | getMetaData () |
get meta data object of survey question pool object | |
initMeta () | |
init meta data object if needed | |
updateMetaData () | |
update meta data only | |
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. | |
deletePhrases ($phrase_array) | |
Delete phrases from the database. | |
getQuestionsTable ($sortoptions, $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 | |
to_xml ($questions) | |
export questions to xml | |
& | getQuestions () |
importObject ($source) |
Definition at line 43 of file class.ilObjSurveyQuestionPool.php.
ilObjSurveyQuestionPool::assignMetaData | ( | &$ | a_meta_data | ) |
assign a meta data object to survey question pool object
object | $a_meta_data meta data object |
Definition at line 299 of file class.ilObjSurveyQuestionPool.php.
Referenced by ilObjSurveyQuestionPool(), and initMeta().
{ $this->meta_data =& $a_meta_data; }
ilObjSurveyQuestionPool::create | ( | $ | a_upload = false |
) |
create question pool object
Definition at line 65 of file class.ilObjSurveyQuestionPool.php.
References ilObject::create(), ilObject::getDescription(), ilObject::getId(), getTitle(), and ilObject::getType().
{ parent::create(); if (!$a_upload) { $this->meta_data->setId($this->getId()); $this->meta_data->setType($this->getType()); $this->meta_data->setTitle($this->getTitle()); $this->meta_data->setDescription($this->getDescription()); $this->meta_data->setObject($this); $this->meta_data->create(); } }
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 636 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{ $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); } }
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 716 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::getDataDir(), ilObject::getId(), and ilUtil::makeDir().
{ $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); } }
ilObjSurveyQuestionPool::delete | ( | ) |
delete object and all related data
public
Reimplemented from ilObject.
Definition at line 144 of file class.ilObjSurveyQuestionPool.php.
References deleteAllData().
{ $remove = parent::delete(); // always call parent delete function first!! if (!$remove) { return false; } // delete all related questions $this->deleteAllData(); return true; }
ilObjSurveyQuestionPool::deleteAllData | ( | ) |
Definition at line 159 of file class.ilObjSurveyQuestionPool.php.
References $query, $result, $row, ilUtil::getDataDir(), ilObject::getId(), and removeQuestion().
Referenced by delete().
{ $query = sprintf("SELECT question_id FROM survey_question WHERE obj_fi = %s", $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 $spl_data_dir = ilUtil::getDataDir()."/spl_data"; $directory = $spl_data_dir."/spl_".$this->getId(); if (is_dir($directory)) { $directory = escapeshellarg($directory); exec("rm -rf $directory"); } }
ilObjSurveyQuestionPool::deletePhrases | ( | $ | phrase_array | ) |
Delete phrases from the database.
Delete phrases from the database
array | $phrase_array An array containing phrase id's to delete public |
Definition at line 517 of file class.ilObjSurveyQuestionPool.php.
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 478 of file class.ilObjSurveyQuestionPool.php.
References $counter, $ilUser, $obj_id, and getQuestiontype().
Referenced by paste().
{ global $ilUser; $questiontype = $this->getQuestiontype($question_id); switch ($questiontype) { case "qt_nominal": $question = new SurveyNominalQuestion(); break; case "qt_ordinal": $question = new SurveyOrdinalQuestion(); break; case "qt_metric": $question = new SurveyMetricQuestion(); break; case "qt_text": $question = new SurveyTextQuestion(); break; } $question->loadFromDb($question_id); $counter = 2; while ($question->questionTitleExists($question->getTitle() . " ($counter)")) { $counter++; } if ($obj_id) { $question->setObjId($obj_id); } $question->duplicate(false, $question->getTitle() . " ($counter)", $ilUser->fullname, $ilUser->id); }
ilObjSurveyQuestionPool::getExportDirectory | ( | ) |
get export directory of survey
Definition at line 665 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::getDataDir().
{ $export_dir = ilUtil::getDataDir()."/spl_data"."/spl_".$this->getId()."/export"; return $export_dir; }
ilObjSurveyQuestionPool::getExportFiles | ( | $ | dir | ) |
get export files
Definition at line 675 of file class.ilObjSurveyQuestionPool.php.
References $file.
{ // 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 747 of file class.ilObjSurveyQuestionPool.php.
References ilUtil::getDataDir().
{ $import_dir = ilUtil::getDataDir()."/spl_data". "/spl_".$this->getId()."/import"; if(@is_dir($import_dir)) { return $import_dir; } else { return false; } }
& ilObjSurveyQuestionPool::getMetaData | ( | ) |
get meta data object of survey question pool object
Definition at line 309 of file class.ilObjSurveyQuestionPool.php.
{
return $this->meta_data;
}
& ilObjSurveyQuestionPool::getQuestions | ( | ) |
Definition at line 838 of file class.ilObjSurveyQuestionPool.php.
References $query, $result, and $row.
Referenced by to_xml().
{ $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; }
& 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 456 of file class.ilObjSurveyQuestionPool.php.
References $query, $result, and $row.
{ $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 | ( | $ | sortoptions, | |
$ | 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 532 of file class.ilObjSurveyQuestionPool.php.
References $ilUser, $query, $row, 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(); if (count($sortoptions)) { foreach ($sortoptions as $key => $value) { switch($key) { case "title": $order = " ORDER BY title $value"; $images["title"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />"; break; case "description": $order = " ORDER BY description $value"; $images["description"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />"; break; case "type": $order = " ORDER BY questiontype_id $value"; $images["type"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />"; break; case "author": $order = " ORDER BY author $value"; $images["author"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />"; break; case "created": $order = " ORDER BY created $value"; $images["created"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "ending order\" />"; break; case "updated": $order = " ORDER BY TIMESTAMP14 $value"; $images["updated"] = " <img src=\"" . ilUtil::getImagePath(strtolower($value) . "_order.png", true) . "\" alt=\"" . strtolower($value) . "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 ); }
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 381 of file class.ilObjSurveyQuestionPool.php.
References $data, $query, and $result.
Referenced by duplicateQuestion(), and to_xml().
{ 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; } }
ilObjSurveyQuestionPool::getTitle | ( | ) |
get title of survey question pool object
Reimplemented from ilObject.
Definition at line 278 of file class.ilObjSurveyQuestionPool.php.
Referenced by create(), and to_xml().
{ //return $this->title; return parent::getTitle(); //return $this->meta_data->getTitle(); }
ilObjSurveyQuestionPool::ilClone | ( | $ | a_parent_ref | ) |
copy all entries of your object.
public
integer | ref_id of parent object |
Reimplemented from ilObject.
Definition at line 115 of file class.ilObjSurveyQuestionPool.php.
References $rbacadmin.
{ global $rbacadmin; // always call parent ilClone function first!! $new_ref_id = parent::ilClone($a_parent_ref); // get object instance of ilCloned object //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id); // create a local role folder & default roles //$roles = $newObj->initDefaultRoles(); // ...finally assign role to creator of object //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n"); // always destroy objects in ilClone method because ilClone() is recursive and creates instances for each object in subtree! //unset($newObj); // ... and finally always return new reference ID!! return $new_ref_id; }
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 51 of file class.ilObjSurveyQuestionPool.php.
References assignMetaData(), and ilObject::ilObject().
{ $this->type = "spl"; $this->ilObject($a_id,$a_call_by_reference); if ($a_id == 0) { $new_meta =& new ilMetaData(); $this->assignMetaData($new_meta); } }
ilObjSurveyQuestionPool::importObject | ( | $ | source | ) |
Definition at line 855 of file class.ilObjSurveyQuestionPool.php.
References $xml, domxml_open_mem(), ilObject::getId(), ilObject::getType(), ilObject::setDescription(), and setTitle().
{ $metadata = ""; if (is_file($source)) { $fh = fopen($source, "r") or die(""); $xml = fread($fh, filesize($source)); fclose($fh) or die(""); // read questionpool metadata from xml file $xml = preg_replace("/>\s*?</", "><", $xml); $domxml = domxml_open_mem($xml); if (!empty($domxml)) { $nodeList = $domxml->get_elements_by_tagname("fieldlabel"); foreach ($nodeList as $node) { switch ($node->get_content()) { case "SCORM": $metanode = $node->next_sibling(); if (strcmp($metanode->node_name(), "fieldentry") == 0) { $metadata = $metanode->get_content(); } } } $domxml->free(); } // import file into questionpool if (preg_match_all("/(<item[^>]*>.*?<\/item>)/si", $xml, $matches)) { foreach ($matches[1] as $index => $item) { // get identifier if (preg_match("/(<item[^>]*>)/is", $item, $start_tag)) { if (preg_match("/(ident=\"([^\"]*)\")/is", $start_tag[1], $ident)) { $ident = $ident[2]; } } $question = ""; if (preg_match("/<qticomment>Questiontype\=(.*?)<\/qticomment>/is", $item, $questiontype)) { switch ($questiontype[1]) { case NOMINAL_QUESTION_IDENTIFIER: $question = new SurveyNominalQuestion(); break; case ORDINAL_QUESTION_IDENTIFIER: $question = new SurveyOrdinalQuestion(); break; case METRIC_QUESTION_IDENTIFIER: $question = new SurveyMetricQuestion(); break; case TEXT_QUESTION_IDENTIFIER: $question = new SurveyTextQuestion(); break; } if ($question) { $question->setObjId($this->getId()); if ($question->from_xml("<questestinterop>$item</questestinterop>")) { $question->saveToDb(); } else { $this->ilias->raiseError($this->lng->txt("error_importing_question"), $this->ilias->error_obj->MESSAGE); } } } } } if ($metadata) { include_once("./classes/class.ilNestedSetXML.php"); $nested = new ilNestedSetXML(); $nested->dom = domxml_open_mem($metadata); $nodes = $nested->getDomContent("//MetaData/General", "Identifier"); if (is_array($nodes)) { $nodes[0]["Entry"] = "il__" . $this->getType() . "_" . $this->getId(); $nested->updateDomContent("//MetaData/General", "Identifier", 0, $nodes[0]); } $nodes = $nested->getDomContent("//MetaData/General", "Title"); if (is_array($nodes)) { $this->setTitle($nodes[0]["value"]); } $nodes = $nested->getDomContent("//MetaData/General", "Description"); if (is_array($nodes)) { $this->setDescription($nodes[0]["value"]); } $xml = $nested->dom->dump_mem(0); $nested->import($xml, $this->getId(), $this->getType()); } } }
ilObjSurveyQuestionPool::initDefaultRoles | ( | ) |
init default roles settings
If your module does not require any default roles, delete this method (For an example how this method is used, look at ilObjForum)
public
Reimplemented from ilObject.
Definition at line 190 of file class.ilObjSurveyQuestionPool.php.
References $rbacadmin, and $roles.
{ global $rbacadmin; // create a local role folder //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId()); // create moderator role and assign role to rolefolder... //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId()); //$roles[] = $roleObj->getId(); //unset($rfoldObj); //unset($roleObj); return $roles ? $roles : array(); }
ilObjSurveyQuestionPool::initMeta | ( | ) |
init meta data object if needed
Definition at line 317 of file class.ilObjSurveyQuestionPool.php.
References assignMetaData(), ilObject::getId(), and ilObject::getType().
Referenced by to_xml(), and updateMetaData().
{ if (!is_object($this->meta_data)) { if ($this->getId()) { $new_meta =& new ilMetaData($this->getType(), $this->getId()); } else { $new_meta =& new ilMetaData(); } $this->assignMetaData($new_meta); } }
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 407 of file class.ilObjSurveyQuestionPool.php.
References $query, $result, and $row.
{ // 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::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 220 of file class.ilObjSurveyQuestionPool.php.
References $_GET, $tree, 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); }
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 442 of file class.ilObjSurveyQuestionPool.php.
References duplicateQuestion(), and ilObject::getId().
{ $this->duplicateQuestion($question_id, $this->getId()); }
ilObjSurveyQuestionPool::read | ( | $ | a_force_db = false |
) |
read object data from db into object
boolean | public |
Reimplemented from ilObject.
Definition at line 102 of file class.ilObjSurveyQuestionPool.php.
References ilObject::getId(), and ilObject::getType().
{ parent::read($a_force_db); $this->meta_data =& new ilMetaData($this->getType(), $this->getId()); }
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 363 of file class.ilObjSurveyQuestionPool.php.
Referenced by deleteAllData().
{ if ($question_id < 1) return; $question = new SurveyQuestion(); $question->delete($question_id); }
ilObjSurveyQuestionPool::setTitle | ( | $ | a_title | ) |
set title of survey question pool object
Reimplemented from ilObject.
Definition at line 288 of file class.ilObjSurveyQuestionPool.php.
Referenced by importObject(), and updateMetaData().
{ parent::setTitle($a_title); $this->meta_data->setTitle($a_title); }
ilObjSurveyQuestionPool::to_xml | ( | $ | questions | ) |
export questions to xml
Definition at line 764 of file class.ilObjSurveyQuestionPool.php.
References $xml, domxml_open_mem(), ilObject::getId(), getQuestions(), getQuestiontype(), getTitle(), and initMeta().
{ if (!is_array($questions)) { $questions =& $this->getQuestions(); } if (count($questions) == 0) { $questions =& $this->getQuestions(); } $xml = ""; foreach ($questions as $key => $value) { $questiontype = $this->getQuestiontype($value); switch ($questiontype) { case "qt_nominal": $question = new SurveyNominalQuestion(); break; case "qt_ordinal": $question = new SurveyOrdinalQuestion(); break; case "qt_metric": $question = new SurveyMetricQuestion(); break; case "qt_text": $question = new SurveyTextQuestion(); break; } $question->loadFromDb($value); $xml .= $question->to_xml(false); } if (count($questions) > 1) { $xml = preg_replace("/<\/questestinterop>\s*<questestinterop>/", "", $xml); } $xml = str_replace("<questestinterop>", "", $xml); $xml = str_replace("</questestinterop>", "", $xml); // export questionpool metadata $xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $xml_header .= "<questestinterop></questestinterop>\n"; $domxml = domxml_open_mem($xml_header); $root = $domxml->document_element(); // qti section $qtiSection = $domxml->create_element("section"); $qtiSection->set_attribute("ident", "qpl_" . $this->getId()); $qtiSection->set_attribute("title", $this->getTitle()); // qti metadata $qtiMetadata = $domxml->create_element("qtimetadata"); $qtiMetadatafield = $domxml->create_element("qtimetadatafield"); $qtiFieldlabel = $domxml->create_element("fieldlabel"); $qtiFieldlabelText = $domxml->create_text_node("SCORM"); $qtiFieldlabel->append_child($qtiFieldlabelText); $qtiFieldentry = $domxml->create_element("fieldentry"); $this->initMeta(); $metadata = $this->meta_data->nested_obj->dom->dump_mem(0); $qtiFieldentryText = $domxml->create_CDATA_Section($metadata); $qtiFieldentry->append_child($qtiFieldentryText); $qtiMetadatafield->append_child($qtiFieldlabel); $qtiMetadatafield->append_child($qtiFieldentry); $qtiMetadata->append_child($qtiMetadatafield); $qtiSection->append_child($qtiMetadata); $root->append_child($qtiSection); $qtixml = $domxml->dump_mem(true); $qtixml = str_replace("</section>", $xml . "\n</section>", $qtixml); $domxml->free(); return $qtixml; }
ilObjSurveyQuestionPool::update | ( | ) |
update object data
public
Reimplemented from ilObject.
Definition at line 85 of file class.ilObjSurveyQuestionPool.php.
Referenced by updateMetaData().
{ if (!parent::update()) { return false; } // put here object specific stuff return true; }
ilObjSurveyQuestionPool::updateMetaData | ( | ) |
update meta data only
Definition at line 336 of file class.ilObjSurveyQuestionPool.php.
References initMeta(), ilObject::setDescription(), setTitle(), and update().
{ $this->initMeta(); $this->meta_data->update(); if ($this->meta_data->section != "General") { $meta = $this->meta_data->getElement("Title", "General"); $this->meta_data->setTitle($meta[0]["value"]); $meta = $this->meta_data->getElement("Description", "General"); $this->meta_data->setDescription($meta[0]["value"]); } else { $this->setTitle($this->meta_data->getTitle()); $this->setDescription($this->meta_data->getDescription()); } parent::update(); }