178 $this->cumulated = array();
181 $this->author = $this->
ilias->account->fullname;
184 if ($this->owner == -1)
186 $this->owner = $this->
ilias->account->id;
189 $this->survey_id = -1;
190 $this->obligatory = 1;
191 $this->orientation = 0;
192 $this->materials = array();
193 $this->material = array();
194 $this->arrData = array();
195 register_shutdown_function(array(&$this,
'_SurveyQuestion'));
210 $this->complete = ($a_complete) ? 1 : 0;
237 if (strcmp($questionpool_object,
"") != 0)
239 $refwhere = sprintf(
" AND obj_fi = %s",
240 $ilDB->quote($questionpool_object,
'integer')
243 $result = $ilDB->queryF(
"SELECT question_id FROM svy_question WHERE title = %s$refwhere",
247 return ($result->numRows() > 0) ?
true :
false;
307 $this->survey_id =
$id;
333 if (empty($materials_name))
335 $materials_name = $materials_file;
337 if ((!empty($materials_name))&&(!array_key_exists($materials_name, $this->materials)))
339 $this->materials[$materials_name] = $materials_file;
350 function setMaterialsfile($materials_filename, $materials_tempfilename=
"", $materials_name=
"")
352 if (!empty($materials_filename))
354 include_once
"./Services/Utilities/classes/class.ilUtil.php";
356 if (!file_exists($materialspath))
361 $materialspath.$materials_filename))
363 print
"image not uploaded!!!! ";
367 $this->
addMaterials($materials_filename, $materials_name);
381 foreach ($this->materials as $key => $value)
383 if (strcmp($key, $materials_name)==0)
389 unset($this->materials[$key]);
402 $this->materials = array();
416 $author = $this->
ilias->account->fullname;
486 $result = $ilDB->queryF(
"SELECT * FROM svy_qst_oblig WHERE survey_fi = %s AND question_fi = %s",
487 array(
'integer',
'integer'),
488 array($survey_id, $this->
getId())
493 return (
$row[
"obligatory"]) ? 1 : 0;
497 return ($this->obligatory) ? 1 : 0;
502 return ($this->obligatory) ? 1 : 0;
527 switch ($this->orientation)
534 $this->orientation = 0;
550 return (strlen($this->description)) ? $this->description : NULL;
562 return (strlen($this->author)) ? $this->author : NULL;
586 return (strlen($this->questiontext)) ? $this->questiontext : NULL;
617 function duplicate($for_survey =
true, $title =
"", $author =
"", $owner =
"")
619 if ($this->
getId() <= 0)
626 $original_id = $this->
getId();
630 $clone->setTitle($title);
634 $clone->setAuthor($author);
638 $clone->setOwner($owner);
642 $clone->saveToDb($original_id);
649 $clone->duplicateMaterials($original_id);
651 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
652 return $clone->getId();
662 if ($this->
getId() <= 0)
670 $source_questionpool = $this->
getObjId();
671 $clone->setObjId($target_questionpool);
674 $clone->setTitle($title);
680 $clone->duplicateMaterials($original_id);
682 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
683 return $clone->getId();
694 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
696 foreach (
$mobs as $mob)
712 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
714 array($this->
getId())
716 $this->material = array();
719 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
723 $mat->type =
$row[
'material_type'];
724 $mat->internal_link =
$row[
'internal_link'];
725 $mat->title =
$row[
'material_title'];
726 $mat->import_id =
$row[
'import_id'];
727 $mat->text_material =
$row[
'text_material'];
728 $mat->external_link =
$row[
'external_link'];
729 $mat->file_material =
$row[
'file_material'];
730 array_push($this->material, $mat);
745 $result = $ilDB->queryF(
"SELECT complete FROM svy_question WHERE question_id = %s",
752 if (
$row[
"complete"] == 1)
769 $question_id = $this->
getId();
770 if (strlen($original_id))
772 $question_id = $original_id;
775 if ($this->
getId() > 0)
778 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_question SET complete = %s, tstamp = %s WHERE question_id = %s",
779 array(
'text',
'integer',
'integer'),
780 array($this->
isComplete(), time(), $question_id)
796 include_once(
"./Services/RTE/classes/class.ilRTE.php");
799 if ($this->
getId() == -1)
802 $next_id = $ilDB->nextId(
'svy_question');
803 $affectedRows = $ilDB->insert(
"svy_question", array(
804 "question_id" => array(
"integer", $next_id),
806 "obj_fi" => array(
"integer", $this->
getObjId()),
807 "owner_fi" => array(
"integer", $this->
getOwner()),
808 "title" => array(
"text", $this->
getTitle()),
809 "label" => array(
"text", (strlen($this->label)) ? $this->label : null),
811 "author" => array(
"text", $this->
getAuthor()),
814 "complete" => array(
"text", $this->
isComplete()),
815 "created" => array(
"integer", time()),
816 "original_id" => array(
"integer", ($original_id) ? $original_id : NULL),
817 "tstamp" => array(
"integer", time())
819 $this->
setId($next_id);
824 $affectedRows = $ilDB->update(
"svy_question", array(
825 "title" => array(
"text", $this->
getTitle()),
826 "label" => array(
"text", (strlen($this->label)) ? $this->label : null),
828 "author" => array(
"text", $this->
getAuthor()),
831 "complete" => array(
"text", $this->
isComplete()),
832 "tstamp" => array(
"integer", time())
834 "question_id" => array(
"integer", $this->
getId())
838 $set = $ilDB->query(
"SELECT survey_fi FROM svy_svy_qst".
839 " WHERE question_fi = ".$ilDB->quote($this->getId(),
"integer"));
840 $survey_fi = $ilDB->fetchAssoc($set);
841 $survey_fi = $survey_fi[
"survey_fi"];
845 $set = $ilDB->query(
"SELECT obligatory FROM svy_qst_oblig".
846 " WHERE survey_fi = ".$ilDB->quote($survey_fi,
"integer").
847 " AND question_fi = ".$ilDB->quote($this->
getId(),
"integer"));
848 $has_obligatory_states_entry = (bool)$ilDB->numRows($set);
849 $is_obligatory = $ilDB->fetchAssoc($set);
850 $is_obligatory = (bool)$is_obligatory[
"obligatory"];
854 if($has_obligatory_states_entry)
856 $ilDB->manipulate(
"DELETE FROM svy_qst_oblig".
857 " WHERE survey_fi = ".$ilDB->quote($survey_fi,
"integer").
858 " AND question_fi = ".$ilDB->quote($this->
getId(),
"integer"));
863 if(!$has_obligatory_states_entry)
866 $next_id = $ilDB->nextId(
'svy_qst_oblig');
867 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qst_oblig (question_obligatory_id, survey_fi, question_fi, " .
868 "obligatory, tstamp) VALUES (%s, %s, %s, %s, %s)",
869 array(
'integer',
'integer',
'integer',
'text',
'integer'),
870 array($next_id, $survey_fi, $this->
getId(), 1, time())
873 else if(!$is_obligatory)
875 $ilDB->manipulate(
"UPDATE svy_qst_oblig".
876 " SET obligatory = ".$ilDB->quote(1,
"integer").
877 " WHERE survey_fi = ".$ilDB->quote($survey_fi,
"integer").
878 " AND question_fi = ".$ilDB->quote($this->
getId(),
"integer"));
883 return $affectedRows;
893 include_once
"./Services/Link/classes/class.ilInternalLink.php";
894 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
896 array($this->
getId())
900 foreach ($this->material as $material)
902 $next_id = $ilDB->nextId(
'svy_material');
903 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_material " .
904 "(material_id, question_fi, internal_link, import_id, material_title, tstamp," .
905 "text_material, external_link, file_material, material_type) ".
906 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
907 array(
'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
'integer'),
909 $next_id, $this->
getId(), $material->internal_link, $material->import_id,
910 $material->title, time(), $material->text_material, $material->external_link,
911 $material->file_material, $material->type)
913 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $material->internal_link, $matches))
933 $next_id = $ilDB->nextId(
'svy_question');
934 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_question (question_id, questiontype_fi, " .
935 "obj_fi, owner_fi, title, description, author, questiontext, obligatory, complete, " .
936 "created, original_id, tstamp) VALUES " .
937 "(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
938 array(
'integer',
'integer',
'integer',
'integer',
'text',
'text',
'text',
'text',
939 'text',
'text',
'integer',
'integer',
'integer'),
956 $this->
setId($next_id);
958 return $this->
getId();
979 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/images/";
990 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/materials/";
1001 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1014 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1031 $result = $ilDB->queryF(
"SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
1032 array(
'text',
'text',
'integer'),
1033 array($categorytext, $neutral, $ilUser->getId())
1042 if (strcmp(
$row[
"title"], $categorytext) == 0)
1044 $returnvalue =
$row[
"category_id"];
1055 $next_id = $ilDB->nextId(
'svy_category');
1056 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, neutral, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
1057 array(
'integer',
'text',
'text',
'integer',
'integer'),
1058 array($next_id, $categorytext, $neutral, $ilUser->getId(), time())
1060 $returnvalue = $next_id;
1062 return $returnvalue;
1074 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->getAdditionalTableName() .
" WHERE question_fi = %s",
1086 function delete($question_id)
1090 if ($question_id < 1)
return;
1092 $result = $ilDB->queryF(
"SELECT obj_fi FROM svy_question WHERE question_id = %s",
1099 $obj_id =
$row[
"obj_fi"];
1106 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE question_fi = %s",
1111 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE question_fi = %s",
1116 $result = $ilDB->queryF(
"SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s",
1122 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE constraint_id = %s",
1124 array(
$row->constraint_fi)
1128 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_constraint WHERE question_fi = %s",
1133 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE question_fi = %s",
1137 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_oblig WHERE question_fi = %s",
1141 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_svy_qst WHERE question_fi = %s",
1145 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_variable WHERE question_fi = %s",
1149 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_question WHERE question_id = %s",
1156 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
1160 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1163 $directory = CLIENT_WEB_DIR .
"/survey/" . $obj_id .
"/$question_id";
1164 if (preg_match(
"/\d+/", $obj_id) and preg_match(
"/\d+/", $question_id) and is_dir($directory))
1166 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1170 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1176 foreach(
$mobs as $mob)
1183 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
1187 $ilDB->manipulate(
"UPDATE svy_question".
1188 " SET original_id = NULL".
1189 " WHERE original_id = ".$ilDB->quote($question_id,
"integer"));
1203 if ($question_id < 1)
return "";
1205 $result = $ilDB->queryF(
"SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND svy_question.questiontype_fi = svy_qtype.questiontype_id",
1212 return $data[
"type_tag"];
1231 if ($question_id < 1)
return "";
1233 $result = $ilDB->queryF(
"SELECT title FROM svy_question WHERE svy_question.question_id = %s",
1240 return $data[
"title"];
1258 $result = $ilDB->queryF(
"SELECT * FROM svy_question WHERE question_id = %s",
1265 if (
$row[
"original_id"] > 0)
1267 return $row[
"original_id"];
1269 else if((
bool)$a_return_question_id_if_no_original)
1271 return $row[
"question_id"];
1286 $id = $this->
getId();
1296 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1297 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
1302 if (strlen($this->material[
"internal_link"]))
1304 $next_id = $ilDB->nextId(
'svy_material');
1305 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_material (material_id, question_fi, internal_link, import_id, material_title, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
1306 array(
'integer',
'integer',
'text',
'text',
'text',
'integer'),
1307 array($next_id, $this->
getOriginalId(), $this->material[
"internal_link"], $this->material[
"import_id"], $this->material[
"title"], time())
1309 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches))
1327 $result = $ilDB->queryF(
"SELECT title FROM svy_phrase WHERE phrase_id = %s",
1333 return $row[
"title"];
1349 $result = $ilDB->queryF(
"SELECT phrase_id FROM svy_phrase WHERE title = %s AND owner_fi = %s",
1350 array(
'text',
'integer'),
1351 array($title, $ilUser->getId())
1353 return (
$result->numRows() == 0) ?
false :
true;
1367 if ($question_id < 1)
1372 $result = $ilDB->queryF(
"SELECT question_id FROM svy_question WHERE question_id = %s",
1376 return (
$result->numRows() == 1) ?
true :
false;
1381 if (strlen($material_id))
1383 if (strcmp($material_title,
"") == 0)
1385 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches))
1387 $type = $matches[1];
1389 $material_title = $this->lng->txt(
"obj_$type") .
": ";
1393 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1395 $cont_obj = $cont_obj_gui->object;
1396 $material_title .= $cont_obj->getTitle();
1399 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
1400 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1402 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1404 $cont_obj = $cont_obj_gui->object;
1406 $material_title .= $pg_obj->getTitle();
1409 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
1410 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1412 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1414 $cont_obj = $cont_obj_gui->object;
1416 $material_title .= $st_obj->getTitle();
1419 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1427 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
1430 $mat->internal_link = $material_id;
1431 $mat->title = $material_title;
1444 foreach ($a_array as $idx)
1446 unset($this->material[$idx]);
1448 $this->material = array_values($this->material);
1463 $materialspath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $materialspath);
1464 if (!file_exists($materialspath))
1466 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1469 if (!copy($materialspath_original . $filename, $materialspath . $filename))
1471 print
"material could not be duplicated!!!! ";
1478 array_push($this->material, $obj_material);
1488 function setMaterial($material_id =
"", $is_import =
false, $material_title =
"")
1490 if (strcmp($material_id,
"") != 0)
1495 $import_id = $material_id;
1498 if (strcmp($material_title,
"") == 0)
1500 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches))
1502 $type = $matches[1];
1504 $material_title = $this->lng->txt(
"obj_$type") .
": ";
1508 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1510 $cont_obj = $cont_obj_gui->object;
1511 $material_title .= $cont_obj->getTitle();
1514 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
1515 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1517 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1519 $cont_obj = $cont_obj_gui->object;
1521 $material_title .= $pg_obj->getTitle();
1524 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
1525 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1527 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1529 $cont_obj = $cont_obj_gui->object;
1531 $material_title .= $st_obj->getTitle();
1534 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1542 $this->material = array(
1543 "internal_link" => $material_id,
1544 "import_id" => $import_id,
1545 "title" => $material_title
1553 if (preg_match(
"/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches))
1555 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1556 include_once
"./Modules/LearningModule/classes/class.ilLMObject.php";
1557 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1558 switch ($matches[2])
1576 if (strcmp($resolved_link,
"") == 0)
1578 $resolved_link = $internal_link;
1583 $resolved_link = $internal_link;
1585 return $resolved_link;
1592 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
1600 $internal_link =
$row[
"internal_link"];
1601 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1603 if (strcmp($internal_link, $resolved_link) != 0)
1606 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_material SET internal_link = %s, tstamp = %s WHERE material_id = %s",
1607 array(
'text',
'integer',
'integer'),
1608 array($resolved_link, time(),
$row[
"material_id"])
1619 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1622 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
1630 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/",
$row[
"internal_link"], $matches))
1643 "lm" =>
"LearningModule",
1644 "pg" =>
"PageObject",
1645 "st" =>
"StructureObject",
1646 "git" =>
"GlossaryItem",
1647 "mob" =>
"MediaObject" 1650 if (preg_match(
"/il__(\w+)_(\d+)/", $target, $matches))
1652 $type = $matches[1];
1654 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1655 switch($linktypes[$matches[1]])
1657 case "LearningModule":
1661 case "StructureObject":
1664 case "GlossaryItem":
1687 if (($question_id < 1) || ($user_id < 1))
1692 $result = $ilDB->queryF(
"SELECT obj_fi FROM svy_question WHERE question_id = %s",
1699 $qpl_object_id =
$row[
"obj_fi"];
1700 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1718 $result = $ilDB->queryF(
"SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
1725 return $row[
"questiontype_id"];
1753 $type = $question_type;
1754 if ($gui) $type .=
"GUI";
1755 if (file_exists(
"./Modules/SurveyQuestionPool/classes/class.".$type.
".php"))
1757 include_once
"./Modules/SurveyQuestionPool/classes/class.".$type.
".php";
1762 global $ilPluginAdmin;
1763 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq");
1764 foreach ($pl_names as $pl_name)
1767 if (strcmp($pl->getQuestionType(), $question_type) == 0)
1769 $pl->includeClass(
"class.".$type.
".php");
1785 if (file_exists(
"./Modules/SurveyQuestionPool/classes/class.".$type_tag.
".php"))
1788 return $lng->txt($type_tag);
1792 global $ilPluginAdmin;
1793 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq");
1794 foreach ($pl_names as $pl_name)
1797 if (strcmp($pl->getQuestionType(), $type_tag) == 0)
1799 return $pl->getQuestionTypeTranslation();
1820 $question =
new $question_type();
1821 $question->loadFromDb($question_id);
1839 $guitype = $question_type .
"GUI";
1840 $question =
new $guitype($question_id);
1855 if (preg_match(
"/<[^>]*?>/", $a_text))
1875 for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
1877 $material = $a_material->getMaterial($i);
1878 if (strcmp($material[
"type"],
"mattext") == 0)
1880 $result .= $material[
"material"]->getContent();
1882 if (strcmp($material[
"type"],
"matimage") == 0)
1884 $matimage = $material[
"material"];
1885 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
1888 if (!is_array(
$_SESSION[
"import_mob_xhtml"]))
$_SESSION[
"import_mob_xhtml"] = array();
1889 array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(),
"uri" => $matimage->getUri()));
1904 function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag = TRUE, $add_mobs = TRUE, $a_attrs = null)
1906 include_once
"./Services/RTE/classes/class.ilRTE.php";
1907 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1909 $a_xml_writer->xmlStartTag(
"material");
1911 "type" =>
"text/plain" 1913 if ($this->
isHTML($a_material))
1915 $attrs[
"type"] =
"text/xhtml";
1917 if (is_array($a_attrs))
1919 $attrs = array_merge($attrs, $a_attrs);
1926 foreach (
$mobs as $mob)
1930 "label" =>
"il_" . IL_INST_ID .
"_mob_" . $mob,
1931 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
1932 "type" =>
"spl:html",
1933 "id" => $this->
getId()
1935 $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
1938 if ($close_material_tag) $a_xml_writer->xmlEndTag(
"material");
1949 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1985 $title = $this->label;
1989 array_push($a_array, $title);
2090 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
2092 switch ($export_label)
2111 $worksheet->write(
$row, $column, $eval_data[
"USERS_ANSWERED"]);
2113 $worksheet->write(
$row, $column, $eval_data[
"USERS_SKIPPED"]);
2119 $worksheet->write(
$row, $column, $eval_data[
"MODE_NR_OF_SELECTIONS"]);
2123 $worksheet->write(
$row, $column, $eval_data[
"ARITHMETIC_MEAN"]);
2141 switch ($export_label)
2144 array_push($csvrow, $this->label);
2147 array_push($csvrow, $this->
getTitle());
2150 array_push($csvrow, $this->
getTitle());
2151 array_push($csvrow, $this->label);
2155 array_push($csvrow, $this->lng->txt($eval_data[
"QUESTION_TYPE"]));
2156 array_push($csvrow, $eval_data[
"USERS_ANSWERED"]);
2157 array_push($csvrow, $eval_data[
"USERS_SKIPPED"]);
2158 array_push($csvrow, $eval_data[
"MODE"]);
2159 array_push($csvrow, $eval_data[
"MODE_NR_OF_SELECTIONS"]);
2160 array_push($csvrow, str_replace(
"<br />",
" ", $eval_data[
"MEDIAN"]));
2161 array_push($csvrow, $eval_data[
"ARITHMETIC_MEAN"]);
2255 $this->original_id = $original_id;
2260 return $this->original_id;
2291 if (count($this->cumulated) == 0)
2295 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
2300 $nr_of_users =
sizeof($finished_ids);
2304 $this->cumulated =& $this->getCumulatedResults($survey_id, $nr_of_users, $finished_ids);
2318 $questiontext = preg_replace(
"/<[^>]+?>/ims",
"", $this->
getQuestiontext());
2321 include_once
"./Services/Utilities/classes/class.ilStr.php";
2322 if (ilStr::strlen($questiontext) > $maxlen + 3)
2324 $questiontext = ilStr::substr($questiontext, 0, $maxlen) .
"...";
2328 'counter' => $counter,
2329 'title' => $counter.
'. '.$this->getTitle(),
2331 'users_answered' =>
$cumulated[
'USERS_ANSWERED'],
2332 'users_skipped' =>
$cumulated[
'USERS_SKIPPED'],
2333 'question_type' => $this->lng->txt(
$cumulated[
"QUESTION_TYPE"]),
2335 'mode_nr_of_selections' =>
$cumulated[
"MODE_NR_OF_SELECTIONS"],
2337 'arithmetic_mean' =>
$cumulated[
"ARITHMETIC_MEAN"]
2350 if (array_key_exists($value, $this->arrData))
2352 return $this->arrData[$value];
2370 $this->arrData[$key] = $value;
2386 $ilDB->manipulate(
"UPDATE svy_question".
2387 " SET original_id = ".$ilDB->quote($a_original_id,
"integer").
",".
2388 " obj_fi = ".$ilDB->quote($a_object_id,
"integer").
2389 " WHERE question_id = ".$ilDB->quote($a_question_id,
"integer"));
2396 $set = $ilDB->query(
"SELECT q.question_id,s.obj_fi".
2397 " FROM svy_question q".
2398 " JOIN svy_svy_qst sq ON (sq.question_fi = q.question_id)".
2399 " JOIN svy_svy s ON (s.survey_id = sq.survey_fi)".
2400 " WHERE original_id = ".$ilDB->quote($this->getId(),
"integer"));
2402 while(
$row = $ilDB->fetchAssoc($set))
2404 if(!$a_group_by_survey)
2410 $res[
$row[
"obj_fi"]][] = $row[
"question_id"];
2423 include_once
"Modules/Survey/classes/class.ilObjSurvey.php";
2431 $set = $ilDB->query(
"SELECT svy_svy.obj_fi FROM svy_svy_qst".
2432 " JOIN svy_svy ON (svy_svy.survey_id = svy_svy_qst.survey_fi)".
2433 " WHERE svy_svy_qst.question_fi = ".$ilDB->quote($a_question_id,
"integer"));
2434 $row = $ilDB->fetchAssoc($set);
2435 if($ilDB->numRows($set))
2437 return $row[
"obj_fi"];
2451 $set = $ilDB->query(
"SELECT obj_fi FROM svy_question ".
2452 " WHERE question_id = ".$ilDB->quote($a_qid,
"integer")
2454 $rec = $ilDB->fetchAssoc($set);
2455 return $rec[
"obj_fi"];
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
_isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
saveCategoryToDb($categorytext, $neutral=0)
Saves a category to the database.
addMaterials($materials_file, $materials_name="")
Sets the materials uri.
saveCompletionStatus($original_id="")
Saves the complete flag to the database.
_questionExists($question_id)
Returns true if the question already exists in the database.
getAuthor()
Gets the authors name of the SurveyQuestion object.
$cumulated
An array containing the cumulated results of the question for a given survey.
getTitle()
Gets the title string of the SurveyQuestion object.
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
_deleteAllLinksOfSource($a_source_type, $a_source_id, $a_lang="-")
Delete all links of a given source.
phraseExists($title)
Returns true if the phrase title already exists for the current user.
saveToDb($original_id="")
Saves a SurveyQuestion object to a database.
static handleQuestionDeletion($a_question_id, $a_obj_id)
Remove question skill assignment.
outChart($survey_id, $type="")
Creates an image visualising the results of the question.
getObligatory($survey_id="")
Gets the obligatory state of the question.
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
static _lookupSurveyObjId($a_question_id)
_getTitle($question_id)
Returns the question title of a question with a given id.
setObligatory($obligatory=1)
Sets the obligatory state of the question.
getMaterialsPath()
Returns the materials path for web accessable materials of a question.
static getSurveySkippedValue()
setOrientation($orientation=0)
Sets the orientation of the question output.
__set($key, $value)
Object setter.
copyXHTMLMediaObjectsOfQuestion($a_q_id)
Increases the media object usage counter when a question is duplicated.
importResponses($a_data)
Import response data from the question import file.
_convert_text($a_text, $a_target="has been removed")
_resolveInternalLink($internal_link)
importMatrix($a_data)
Import matrix rows from the question import file.
_saveLink($a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0, $a_source_lang="-")
save internal link information
deleteMaterial($materials_name="")
Deletes a materials uri with a given name.
_getQuestionDataArray($id)
Returns the question data fields from the database.
importAdjectives($a_data)
Import bipolar adjectives from the question import file.
getMaterialsPathWeb()
Returns the web image path for web accessable images of a question.
setId($id=-1)
Sets the id of the SurveyQuestion object.
flushMaterials()
Deletes all materials uris.
duplicate($for_survey=true, $title="", $author="", $owner="")
Duplicates a survey question.
static _changeOriginalId($a_question_id, $a_original_id, $a_object_id)
Change original id of existing question in db.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
usableForPrecondition()
Returns if the question is usable for preconditions.
getQuestiontext()
Gets the questiontext of the SurveyQuestion object.
getOrientation()
Gets the orientation of the question output.
setExportDetailsXLS(&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label)
Creates an Excel worksheet for the detailed cumulated results of this question.
static lookupObjFi($a_qid)
Lookip obj fi.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
_cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
synchronises appearances of media objects in $a_text with media object usage table ...
_getIdForImportId($a_type, $a_target)
Get current id for an import id.
loadFromDb($question_id)
Loads a SurveyQuestion object from the database.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setOwner($owner="")
Sets the creator/owner ID of the SurveyQuestion object.
setComplete($a_complete)
Sets the complete state of the question.
getPreconditionOptions()
Returns the options for preconditions.
setMaterial($material_id="", $is_import=false, $material_title="")
Sets a material link for the question.
getQuestionTypeID()
Returns the question type ID of the question.
addMaterial($obj_material)
& getUserAnswers($survey_id)
Returns an array containing all answers to this question in a given survey.
setOriginalId($original_id)
getOwner()
Gets the creator/owner ID of the SurveyQuestion object.
SurveyQuestion( $title="", $description="", $author="", $questiontext="", $owner=-1)
SurveyQuestion constructor The constructor takes possible arguments an creates an instance of the Sur...
setQuestiontext($questiontext="")
Sets the questiontext of the SurveyQuestion object.
& _instanciateQuestionGUI($question_id)
Creates an instance of a question GUI with a given question id.
saveRandomData($active_id)
Saves random answers for a given active user in the database.
_resolveIntLinks($question_id)
& calculateCumulatedResults($survey_id, $finished_ids)
getId()
Gets the id of the SurveyQuestion object.
getImagePathWeb()
Returns the web image path for web accessable images of a question.
addUserSpecificResultsData(&$a_array, &$resultset)
Adds the values for the user specific results export for a given user.
const ILIAS_ABSOLUTE_PATH
getPhrase($phrase_id)
Returns a phrase for a given database id.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Basic class for all survey question types.
saveMaterial()
save material to db
_lookupContObjID($a_id)
get learning module / digibook id for lm object
getCumulatedResultData($survey_id, $counter, $finished_ids)
Creates a the cumulated results data for the question.
redirection script todo: (a better solution should control the processing via a xml file) ...
getAvailableRelations()
Returns the available relations for the question.
& getWorkingDataFromUserInput($post_data)
Creates the user data of the svy_answer table from the POST data.
static removeTrailingPathSeparators($path)
setSurveyId($id=-1)
Sets the survey id of the SurveyQuestion object.
addInternalLink($material_id, $title="")
isComplete()
Returns 1, if a question is complete for use.
_getIdForImportId($a_import_id)
get current object id for import id (static)
saveWorkingData($limit_to=LIMIT_NO_LIMIT)
Saves the learners input of the question to the database.
_getOriginalId($question_id, $a_return_question_id_if_no_original=true)
Returns the original id of a question.
getImagePath()
Returns the image path for web accessable images of a question.
setExportCumulatedXLS(&$worksheet, &$format_title, &$format_bold, &$eval_data, $row, $export_label)
Creates the Excel output for the cumulated results of this question.
setAuthor($author="")
Sets the authors name of the SurveyQuestion object.
const LIMIT_NO_LIMIT
Assessment constants.
deleteMaterials($a_array)
Deletes materials.
_getQuestionType($question_id)
Returns the question type of a question with a given id.
addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE, $a_attrs=null)
Creates an XML material tag from a plain text or xhtml text.
setDescription($description="")
Sets the description string of the SurveyQuestion object.
setMaterialsfile($materials_filename, $materials_tempfilename="", $materials_name="")
Sets and uploads the materials uri.
Class ilObjContentObjectGUI.
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
copyObject($target_questionpool, $title="")
Copies an assOrderingQuestion object.
importAdditionalMetadata($a_meta)
Import additional meta data from the question import file.
_getInternalLinkHref($target="", $a_parent_ref_id=null)
getDescription()
Gets the description string of the SurveyQuestion object.
getObjId()
Get the reference id of the container object.
getPreconditionSelectValue($default="", $title, $variable)
Creates a form property for the precondition value.
duplicateMaterials($question_id)
Duplicates the materials of a question.
setObjId($obj_id=0)
Set the reference id of the container object.
_getNrOfParticipants($survey_id)
Returns the number of participants for a survey.
isHTML($a_text)
Checks if a given string contains HTML or not.
__get($value)
Object getter.
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
_isComplete($question_id)
Checks whether the question is complete or not.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
$arrData
data array containing the question data
static _lookGlossaryTerm($term_id)
get glossary term
getQuestionType()
Returns the question type of the question.
getPreconditionValueOutput($value)
Returns the output for a precondition value.
createNewQuestion()
Creates a new question with a 0 timestamp when a new question is created This assures that an ID is g...
& setExportCumulatedCVS(&$eval_data, $export_label)
Creates the CSV output for the cumulated results of this question.
getCopyIds($a_group_by_survey=false)
deleteAdditionalTableData($question_id)
Deletes datasets from the additional question table in the database.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE)
Prepares a string for a text area output in surveys.
getSurveyId()
Gets the survey id of the SurveyQuestion object.
addUserSpecificResultsExportTitles(&$a_array, $a_use_label=false, $a_substitute=true)
Adds the entries for the title row of the user specific results.
setTitle($title="")
Sets the title string of the SurveyQuestion object.
questionTitleExists($title, $questionpool_object="")
Returns TRUE if the question title exists in the database.