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))
362 $materialspath.$materials_filename))
364 print
"image not uploaded!!!! ";
368 $this->
addMaterials($materials_filename, $materials_name);
382 foreach ($this->materials as $key => $value)
384 if (strcmp($key, $materials_name)==0)
390 unset($this->materials[$key]);
403 $this->materials = array();
417 $author = $this->ilias->account->fullname;
482 $result = $ilDB->queryF(
"SELECT * FROM svy_qst_oblig WHERE survey_fi = %s AND question_fi = %s",
483 array(
'integer',
'integer'),
489 return (
$row[
"obligatory"]) ? 1 : 0;
493 return ($this->obligatory) ? 1 : 0;
498 return ($this->obligatory) ? 1 : 0;
523 switch ($this->orientation)
530 $this->orientation = 0;
546 return (strlen($this->description)) ? $this->description : NULL;
558 return (strlen($this->author)) ? $this->author : NULL;
582 return (strlen($this->questiontext)) ? $this->questiontext : NULL;
615 if ($this->
getId() <= 0)
622 $original_id = $this->
getId();
638 $clone->saveToDb($original_id);
645 $clone->duplicateMaterials($original_id);
647 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
648 return $clone->getId();
658 if ($this->
getId() <= 0)
666 $source_questionpool = $this->
getObjId();
667 $clone->setObjId($target_questionpool);
676 $clone->duplicateMaterials($original_id);
678 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
679 return $clone->getId();
690 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
692 foreach (
$mobs as $mob)
708 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
710 array($this->
getId())
712 $this->material = array();
715 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
719 $mat->type =
$row[
'material_type'];
720 $mat->internal_link =
$row[
'internal_link'];
721 $mat->title =
$row[
'material_title'];
722 $mat->import_id =
$row[
'import_id'];
723 $mat->text_material =
$row[
'text_material'];
724 $mat->external_link =
$row[
'external_link'];
725 $mat->file_material =
$row[
'file_material'];
726 array_push($this->material, $mat);
741 $result = $ilDB->queryF(
"SELECT complete FROM svy_question WHERE question_id = %s",
748 if (
$row[
"complete"] == 1)
765 $question_id = $this->
getId();
766 if (strlen($original_id))
768 $question_id = $original_id;
771 if ($this->
getId() > 0)
774 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_question SET complete = %s, tstamp = %s WHERE question_id = %s",
775 array(
'text',
'integer',
'integer'),
776 array($this->
isComplete(), time(), $question_id)
792 include_once(
"./Services/RTE/classes/class.ilRTE.php");
795 if ($this->
getId() == -1)
798 $next_id = $ilDB->nextId(
'svy_question');
799 $affectedRows = $ilDB->insert(
"svy_question", array(
800 "question_id" => array(
"integer", $next_id),
802 "obj_fi" => array(
"integer", $this->
getObjId()),
803 "owner_fi" => array(
"integer", $this->
getOwner()),
804 "title" => array(
"text", $this->
getTitle()),
805 "label" => array(
"text", (strlen($this->label)) ? $this->label : null),
807 "author" => array(
"text", $this->
getAuthor()),
810 "complete" => array(
"text", $this->
isComplete()),
811 "created" => array(
"integer", time()),
812 "original_id" => array(
"integer", ($original_id) ? $original_id : NULL),
813 "tstamp" => array(
"integer", time())
815 $this->
setId($next_id);
820 $affectedRows = $ilDB->update(
"svy_question", array(
821 "title" => array(
"text", $this->
getTitle()),
822 "label" => array(
"text", (strlen($this->label)) ? $this->label : null),
824 "author" => array(
"text", $this->
getAuthor()),
827 "complete" => array(
"text", $this->
isComplete()),
828 "tstamp" => array(
"integer", time())
830 "question_id" => array(
"integer", $this->
getId())
835 $set = $ilDB->query(
"SELECT survey_id FROM svy_svy".
836 " WHERE obj_fi = ".$ilDB->quote($this->getObjId(),
"integer"));
837 $survey_fi = $ilDB->fetchAssoc($set);
838 $survey_fi = $survey_fi[
"survey_id"];
843 $set = $ilDB->query(
"SELECT obligatory FROM svy_qst_oblig".
844 " WHERE survey_fi = ".$ilDB->quote($survey_fi,
"integer").
845 " AND question_fi = ".$ilDB->quote($this->
getId(),
"integer"));
846 $has_obligatory_states_entry = (bool)$ilDB->numRows($set);
847 $is_obligatory = $ilDB->fetchAssoc($set);
848 $is_obligatory = (bool)$is_obligatory[
"obligatory"];
852 if($has_obligatory_states_entry)
854 $ilDB->manipulate(
"DELETE FROM svy_qst_oblig".
855 " WHERE survey_fi = ".$ilDB->quote($survey_fi,
"integer").
856 " AND question_fi = ".$ilDB->quote($this->
getId(),
"integer"));
861 if(!$has_obligatory_states_entry)
864 $next_id = $ilDB->nextId(
'svy_qst_oblig');
865 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qst_oblig (question_obligatory_id, survey_fi, question_fi, " .
866 "obligatory, tstamp) VALUES (%s, %s, %s, %s, %s)",
867 array(
'integer',
'integer',
'integer',
'text',
'integer'),
868 array($next_id, $survey_fi, $this->
getId(), 1, time())
871 else if(!$is_obligatory)
873 $ilDB->manipulate(
"UPDATE svy_qst_oblig".
874 " SET obligatory = ".$ilDB->quote(1,
"integer").
875 " WHERE survey_fi = ".$ilDB->quote($survey_fi,
"integer").
876 " AND question_fi = ".$ilDB->quote($this->
getId(),
"integer"));
881 return $affectedRows;
891 include_once
"./Services/Link/classes/class.ilInternalLink.php";
892 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
894 array($this->
getId())
900 $next_id = $ilDB->nextId(
'svy_material');
901 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_material " .
902 "(material_id, question_fi, internal_link, import_id, material_title, tstamp," .
903 "text_material, external_link, file_material, material_type) ".
904 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
905 array(
'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
'integer'),
907 $next_id, $this->
getId(), $material->internal_link, $material->import_id,
908 $material->title, time(), $material->text_material, $material->external_link,
909 $material->file_material, $material->type)
911 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $material->internal_link, $matches))
931 $next_id = $ilDB->nextId(
'svy_question');
932 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_question (question_id, questiontype_fi, " .
933 "obj_fi, owner_fi, title, description, author, questiontext, obligatory, complete, " .
934 "created, original_id, tstamp) VALUES " .
935 "(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
936 array(
'integer',
'integer',
'integer',
'integer',
'text',
'text',
'text',
'text',
937 'text',
'text',
'integer',
'integer',
'integer'),
954 $this->
setId($next_id);
956 return $this->
getId();
977 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/images/";
988 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/materials/";
999 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1012 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1029 $result = $ilDB->queryF(
"SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
1030 array(
'text',
'text',
'integer'),
1031 array($categorytext, $neutral, $ilUser->getId())
1040 if (strcmp(
$row[
"title"], $categorytext) == 0)
1042 $returnvalue =
$row[
"category_id"];
1053 $next_id = $ilDB->nextId(
'svy_category');
1054 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, neutral, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
1055 array(
'integer',
'text',
'text',
'integer',
'integer'),
1056 array($next_id, $categorytext, $neutral, $ilUser->getId(), time())
1058 $returnvalue = $next_id;
1060 return $returnvalue;
1072 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->getAdditionalTableName() .
" WHERE question_fi = %s",
1084 function delete($question_id)
1088 if ($question_id < 1)
return;
1090 $result = $ilDB->queryF(
"SELECT obj_fi FROM svy_question WHERE question_id = %s",
1104 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE question_fi = %s",
1109 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE question_fi = %s",
1114 $result = $ilDB->queryF(
"SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s",
1120 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE constraint_id = %s",
1122 array(
$row->constraint_fi)
1126 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_constraint WHERE question_fi = %s",
1131 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE question_fi = %s",
1135 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_oblig WHERE question_fi = %s",
1139 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_svy_qst WHERE question_fi = %s",
1143 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_variable WHERE question_fi = %s",
1147 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_question WHERE question_id = %s",
1154 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
1158 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1161 $directory = CLIENT_WEB_DIR .
"/survey/" .
$obj_id .
"/$question_id";
1162 if (preg_match(
"/\d+/",
$obj_id) and preg_match(
"/\d+/", $question_id) and is_dir($directory))
1164 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1168 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1174 foreach(
$mobs as $mob)
1181 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
1185 $ilDB->manipulate(
"UPDATE svy_question".
1186 " SET original_id = NULL".
1187 " WHERE original_id = ".$ilDB->quote($question_id,
"integer"));
1201 if ($question_id < 1)
return "";
1203 $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",
1209 $data = $ilDB->fetchAssoc(
$result);
1210 return $data[
"type_tag"];
1229 if ($question_id < 1)
return "";
1231 $result = $ilDB->queryF(
"SELECT title FROM svy_question WHERE svy_question.question_id = %s",
1237 $data = $ilDB->fetchAssoc(
$result);
1238 return $data[
"title"];
1256 $result = $ilDB->queryF(
"SELECT * FROM svy_question WHERE question_id = %s",
1263 if (
$row[
"original_id"] > 0)
1265 return $row[
"original_id"];
1267 else if((
bool)$a_return_question_id_if_no_original)
1269 return $row[
"question_id"];
1294 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1295 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
1300 if (strlen($this->material[
"internal_link"]))
1302 $next_id = $ilDB->nextId(
'svy_material');
1303 $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)",
1304 array(
'integer',
'integer',
'text',
'text',
'text',
'integer'),
1305 array($next_id, $this->
getOriginalId(), $this->material[
"internal_link"], $this->material[
"import_id"], $this->material[
"title"], time())
1307 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches))
1325 $result = $ilDB->queryF(
"SELECT title FROM svy_phrase WHERE phrase_id = %s",
1331 return $row[
"title"];
1347 $result = $ilDB->queryF(
"SELECT phrase_id FROM svy_phrase WHERE title = %s AND owner_fi = %s",
1348 array(
'text',
'integer'),
1349 array(
$title, $ilUser->getId())
1351 return (
$result->numRows() == 0) ?
false :
true;
1365 if ($question_id < 1)
1370 $result = $ilDB->queryF(
"SELECT question_id FROM svy_question WHERE question_id = %s",
1374 return (
$result->numRows() == 1) ?
true :
false;
1379 if (strlen($material_id))
1381 if (strcmp($material_title,
"") == 0)
1383 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches))
1385 $type = $matches[1];
1387 $material_title = $this->lng->txt(
"obj_$type") .
": ";
1391 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1393 $cont_obj = $cont_obj_gui->object;
1394 $material_title .= $cont_obj->getTitle();
1397 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
1398 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1400 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1402 $cont_obj = $cont_obj_gui->object;
1404 $material_title .= $pg_obj->getTitle();
1407 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
1408 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1410 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1412 $cont_obj = $cont_obj_gui->object;
1414 $material_title .= $st_obj->getTitle();
1417 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1425 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
1428 $mat->internal_link = $material_id;
1429 $mat->title = $material_title;
1442 foreach ($a_array as $idx)
1444 unset($this->material[$idx]);
1446 $this->material = array_values($this->material);
1461 $materialspath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $materialspath);
1462 if (!file_exists($materialspath))
1464 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1467 if (!copy($materialspath_original . $filename, $materialspath . $filename))
1469 print
"material could not be duplicated!!!! ";
1476 array_push($this->material, $obj_material);
1486 function setMaterial($material_id =
"", $is_import =
false, $material_title =
"")
1488 if (strcmp($material_id,
"") != 0)
1493 $import_id = $material_id;
1496 if (strcmp($material_title,
"") == 0)
1498 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches))
1500 $type = $matches[1];
1502 $material_title = $this->lng->txt(
"obj_$type") .
": ";
1506 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1508 $cont_obj = $cont_obj_gui->object;
1509 $material_title .= $cont_obj->getTitle();
1512 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
1513 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1515 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1517 $cont_obj = $cont_obj_gui->object;
1519 $material_title .= $pg_obj->getTitle();
1522 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
1523 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1525 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1527 $cont_obj = $cont_obj_gui->object;
1529 $material_title .= $st_obj->getTitle();
1532 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1540 $this->material = array(
1541 "internal_link" => $material_id,
1542 "import_id" => $import_id,
1543 "title" => $material_title
1551 if (preg_match(
"/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches))
1553 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1554 include_once
"./Modules/LearningModule/classes/class.ilLMObject.php";
1555 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1556 switch ($matches[2])
1574 if (strcmp($resolved_link,
"") == 0)
1576 $resolved_link = $internal_link;
1581 $resolved_link = $internal_link;
1583 return $resolved_link;
1590 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
1598 $internal_link =
$row[
"internal_link"];
1599 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1601 if (strcmp($internal_link, $resolved_link) != 0)
1604 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_material SET internal_link = %s, tstamp = %s WHERE material_id = %s",
1605 array(
'text',
'integer',
'integer'),
1606 array($resolved_link, time(),
$row[
"material_id"])
1617 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1620 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
1628 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/",
$row[
"internal_link"], $matches))
1641 "lm" =>
"LearningModule",
1642 "pg" =>
"PageObject",
1643 "st" =>
"StructureObject",
1644 "git" =>
"GlossaryItem",
1645 "mob" =>
"MediaObject"
1648 if (preg_match(
"/il__(\w+)_(\d+)/", $target, $matches))
1650 $type = $matches[1];
1652 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1653 switch($linktypes[$matches[1]])
1655 case "LearningModule":
1659 case "StructureObject":
1662 case "GlossaryItem":
1685 if (($question_id < 1) || ($user_id < 1))
1690 $result = $ilDB->queryF(
"SELECT obj_fi FROM svy_question WHERE question_id = %s",
1697 $qpl_object_id =
$row[
"obj_fi"];
1698 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1716 $result = $ilDB->queryF(
"SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
1723 return $row[
"questiontype_id"];
1751 $type = $question_type;
1752 if ($gui) $type .=
"GUI";
1753 if (file_exists(
"./Modules/SurveyQuestionPool/classes/class.".$type.
".php"))
1755 include_once
"./Modules/SurveyQuestionPool/classes/class.".$type.
".php";
1760 global $ilPluginAdmin;
1761 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq");
1762 foreach ($pl_names as $pl_name)
1765 if (strcmp($pl->getQuestionType(), $question_type) == 0)
1767 $pl->includeClass(
"class.".$type.
".php");
1783 if (file_exists(
"./Modules/SurveyQuestionPool/classes/class.".$type_tag.
".php"))
1786 return $lng->txt($type_tag);
1790 global $ilPluginAdmin;
1791 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq");
1792 foreach ($pl_names as $pl_name)
1795 if (strcmp($pl->getQuestionType(), $type_tag) == 0)
1797 return $pl->getQuestionTypeTranslation();
1818 $question =
new $question_type();
1819 $question->loadFromDb($question_id);
1837 $guitype = $question_type .
"GUI";
1838 $question =
new $guitype($question_id);
1853 if (preg_match(
"/<[^>]*?>/", $a_text))
1873 for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
1875 $material = $a_material->getMaterial($i);
1876 if (strcmp(
$material[
"type"],
"mattext") == 0)
1880 if (strcmp(
$material[
"type"],
"matimage") == 0)
1883 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
1886 if (!is_array(
$_SESSION[
"import_mob_xhtml"]))
$_SESSION[
"import_mob_xhtml"] = array();
1887 array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(),
"uri" => $matimage->getUri()));
1902 function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag = TRUE, $add_mobs = TRUE, $a_attrs = null)
1904 include_once
"./Services/RTE/classes/class.ilRTE.php";
1905 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1907 $a_xml_writer->xmlStartTag(
"material");
1909 "type" =>
"text/plain"
1911 if ($this->
isHTML($a_material))
1913 $attrs[
"type"] =
"text/xhtml";
1915 if (is_array($a_attrs))
1917 $attrs = array_merge($attrs, $a_attrs);
1924 foreach (
$mobs as $mob)
1928 "label" =>
"il_" . IL_INST_ID .
"_mob_" . $mob,
1929 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
1930 "type" =>
"spl:html",
1931 "id" => $this->
getId()
1933 $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
1936 if ($close_material_tag) $a_xml_writer->xmlEndTag(
"material");
1947 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1987 array_push($a_array,
$title);
2088 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
2090 switch ($export_label)
2109 $worksheet->write(
$row, $column, $eval_data[
"USERS_ANSWERED"]);
2111 $worksheet->write(
$row, $column, $eval_data[
"USERS_SKIPPED"]);
2117 $worksheet->write(
$row, $column, $eval_data[
"MODE_NR_OF_SELECTIONS"]);
2121 $worksheet->write(
$row, $column, $eval_data[
"ARITHMETIC_MEAN"]);
2139 switch ($export_label)
2142 array_push($csvrow, $this->label);
2145 array_push($csvrow, $this->
getTitle());
2148 array_push($csvrow, $this->
getTitle());
2149 array_push($csvrow, $this->label);
2153 array_push($csvrow, $this->lng->txt($eval_data[
"QUESTION_TYPE"]));
2154 array_push($csvrow, $eval_data[
"USERS_ANSWERED"]);
2155 array_push($csvrow, $eval_data[
"USERS_SKIPPED"]);
2156 array_push($csvrow, $eval_data[
"MODE"]);
2157 array_push($csvrow, $eval_data[
"MODE_NR_OF_SELECTIONS"]);
2158 array_push($csvrow, $eval_data[
"MEDIAN"]);
2159 array_push($csvrow, $eval_data[
"ARITHMETIC_MEAN"]);
2253 $this->original_id = $original_id;
2258 return $this->original_id;
2289 if (count($this->cumulated) == 0)
2293 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
2298 $nr_of_users =
sizeof($finished_ids);
2302 $this->cumulated =& $this->getCumulatedResults(
$survey_id, $nr_of_users, $finished_ids);
2319 include_once
"./Services/Utilities/classes/class.ilStr.php";
2326 'counter' => $counter,
2327 'title' => $counter.
'. '.$this->getTitle(),
2329 'users_answered' =>
$cumulated[
'USERS_ANSWERED'],
2330 'users_skipped' =>
$cumulated[
'USERS_SKIPPED'],
2331 'question_type' => $this->lng->txt(
$cumulated[
"QUESTION_TYPE"]),
2333 'mode_nr_of_selections' =>
$cumulated[
"MODE_NR_OF_SELECTIONS"],
2335 'arithmetic_mean' =>
$cumulated[
"ARITHMETIC_MEAN"]
2348 if (array_key_exists($value, $this->arrData))
2350 return $this->arrData[$value];
2368 $this->arrData[$key] = $value;
2384 $ilDB->manipulate(
"UPDATE svy_question".
2385 " SET original_id = ".$ilDB->quote($a_original_id,
"integer").
",".
2386 " obj_fi = ".$ilDB->quote($a_object_id,
"integer").
2387 " WHERE question_id = ".$ilDB->quote($a_question_id,
"integer"));
2394 $set = $ilDB->query(
"SELECT q.question_id,s.obj_fi".
2395 " FROM svy_question q".
2396 " JOIN svy_svy_qst sq ON (sq.question_fi = q.question_id)".
2397 " JOIN svy_svy s ON (s.survey_id = sq.survey_fi)".
2398 " WHERE original_id = ".$ilDB->quote($this->getId(),
"integer"));
2400 while(
$row = $ilDB->fetchAssoc($set))
2402 if(!$a_group_by_survey)
2408 $res[
$row[
"obj_fi"]][] = $row[
"question_id"];
2421 include_once
"Modules/Survey/classes/class.ilObjSurvey.php";
2429 $set = $ilDB->query(
"SELECT svy_svy.obj_fi FROM svy_svy_qst".
2430 " JOIN svy_svy ON (svy_svy.survey_id = svy_svy_qst.survey_fi)".
2431 " WHERE svy_svy_qst.question_fi = ".$ilDB->quote($a_question_id,
"integer"));
2432 $row = $ilDB->fetchAssoc($set);
2433 if($ilDB->numRows($set))
2435 return $row[
"obj_fi"];
2449 $set = $ilDB->query(
"SELECT obj_fi FROM svy_question ".
2450 " WHERE question_id = ".$ilDB->quote($a_qid,
"integer")
2452 $rec = $ilDB->fetchAssoc($set);
2453 return $rec[
"obj_fi"];