162        $this->
user = $DIC->user();
 
  163        $this->db = 
$DIC->database();
 
  173        $this->cumulated = array();
 
  174        if (!$this->author) {
 
  175            $this->author = 
$ilUser->fullname;
 
  178        if ($this->owner == -1) {
 
  179            $this->owner = 
$ilUser->getId();
 
  182        $this->survey_id = -1;
 
  183        $this->obligatory = 1;
 
  184        $this->orientation = 0;
 
  185        $this->materials = array();
 
  186        $this->material = array();
 
  187        $this->arrData = array();
 
  200        $this->complete = ($a_complete) ? 1 : 0;
 
  227        if (strcmp($questionpool_object, 
"") != 0) {
 
  230                $ilDB->quote($questionpool_object, 
'integer')
 
  234            "SELECT question_id FROM svy_question WHERE title = %s$refwhere",
 
  298        $this->survey_id = 
$id;
 
  323        if (empty($materials_name)) {
 
  324            $materials_name = $materials_file;
 
  326        if ((!empty($materials_name)) && (!array_key_exists($materials_name, $this->materials))) {
 
  327            $this->materials[$materials_name] = $materials_file;
 
  338    public function setMaterialsfile($materials_filename, $materials_tempfilename = 
"", $materials_name = 
"")
 
  340        if (!empty($materials_filename)) {
 
  342            if (!file_exists($materialspath)) {
 
  346                $materials_tempfilename,
 
  348                $materialspath . $materials_filename
 
  350                print "image not uploaded!!!! ";
 
  352                $this->
addMaterials($materials_filename, $materials_name);
 
  366        foreach ($this->materials as $key => $value) {
 
  367            if (strcmp($key, $materials_name) == 0) {
 
  371                unset($this->materials[$key]);
 
  384        $this->materials = array();
 
  465        return ($this->obligatory) ? 1 : 0;
 
  489        switch ($this->orientation) {
 
  495                $this->orientation = 0;
 
  511        return (strlen($this->description)) ? $this->description : 
null;
 
  523        return (strlen($this->author)) ? $this->author : 
null;
 
  547        return (strlen($this->questiontext)) ? $this->questiontext : 
null;
 
  581        if ($this->
getId() <= 0) {
 
  587        $original_id = $this->
getId();
 
  589        if ($a_survey_id > 0) {
 
  590            $clone->setObjId($a_survey_id);
 
  602            $clone->saveToDb($original_id);
 
  607        $clone->duplicateMaterials($original_id);
 
  609        $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
 
  610        return $clone->getId();
 
  620        if ($this->
getId() <= 0) {
 
  627        $source_questionpool = $this->
getObjId();
 
  628        $clone->setObjId($target_questionpool);
 
  636        $clone->duplicateMaterials($original_id);
 
  638        $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
 
  639        return $clone->getId();
 
  651        foreach (
$mobs as $mob) {
 
  667            "SELECT * FROM svy_material WHERE question_fi = %s",
 
  669            array($this->
getId())
 
  671        $this->material = array();
 
  675                $mat->type = $row[
'material_type'];
 
  676                $mat->internal_link = $row[
'internal_link'];
 
  677                $mat->title = $row[
'material_title'];
 
  678                $mat->import_id = $row[
'import_id'];
 
  679                $mat->text_material = $row[
'text_material'];
 
  680                $mat->external_link = $row[
'external_link'];
 
  681                $mat->file_material = $row[
'file_material'];
 
  682                array_push($this->material, $mat);
 
  700            "SELECT complete FROM svy_question WHERE question_id = %s",
 
  706            if ($row[
"complete"] == 1) {
 
  722        $question_id = $this->
getId();
 
  723        if (strlen($original_id)) {
 
  724            $question_id = $original_id;
 
  727        if ($this->
getId() > 0) {
 
  728            $this->log->debug(
"UPDATE svy_question question_id=" . $question_id);
 
  731            $affectedRows = 
$ilDB->manipulateF(
 
  732                "UPDATE svy_question SET complete = %s, tstamp = %s WHERE question_id = %s",
 
  733                array(
'text', 
'integer', 
'integer'),
 
  734                array($this->
isComplete(), time(), $question_id)
 
  752        if ($this->
getId() == -1) {
 
  754            $next_id = 
$ilDB->nextId(
'svy_question');
 
  755            $affectedRows = 
$ilDB->insert(
"svy_question", array(
 
  756                "question_id" => array(
"integer", $next_id),
 
  758                "obj_fi" => array(
"integer", $this->
getObjId()),
 
  759                "owner_fi" => array(
"integer", $this->
getOwner()),
 
  760                "title" => array(
"text", $this->
getTitle()),
 
  761                "label" => array(
"text", (strlen($this->label)) ? $this->label : 
null),
 
  763                "author" => array(
"text", $this->
getAuthor()),
 
  766                "complete" => array(
"text", $this->
isComplete()),
 
  767                "created" => array(
"integer", time()),
 
  768                "original_id" => array(
"integer", ($original_id) ? $original_id : 
null),
 
  769                "tstamp" => array(
"integer", time())
 
  774            $this->
setId($next_id);
 
  777            $affectedRows = 
$ilDB->update(
"svy_question", array(
 
  778                "title" => array(
"text", $this->
getTitle()),
 
  779                "label" => array(
"text", (strlen($this->label)) ? $this->label : 
null),
 
  781                "author" => array(
"text", $this->
getAuthor()),
 
  784                "complete" => array(
"text", $this->
isComplete()),
 
  785                "tstamp" => array(
"integer", time())
 
  787            "question_id" => array(
"integer", $this->
getId())
 
  790            $this->log->debug(
"UPDATE svy_question id=" . $this->
getId() . 
" SET: title=" . $this->
getTitle() . 
" ...");
 
  793        return $affectedRows;
 
  803        $this->log->debug(
"DELETE: svy_material question_fi=" . $this->
getId());
 
  805        $affectedRows = 
$ilDB->manipulateF(
 
  806            "DELETE FROM svy_material WHERE question_fi = %s",
 
  808            array($this->
getId())
 
  813            $next_id = 
$ilDB->nextId(
'svy_material');
 
  815            $this->log->debug(
"INSERT: svy_material question_fi=" . $this->
getId());
 
  817            $affectedRows = 
$ilDB->manipulateF(
 
  818                "INSERT INTO svy_material " .
 
  819                "(material_id, question_fi, internal_link, import_id, material_title, tstamp," .
 
  820                "text_material, external_link, file_material, material_type) " .
 
  821                "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
 
  822                array(
'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
'integer'),
 
  824                    $next_id, $this->
getId(), $material->internal_link, 
$material->import_id,
 
  828            if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", 
$material->internal_link, $matches)) {
 
  846            $next_id = 
$ilDB->nextId(
'svy_question');
 
  847            $affectedRows = 
$ilDB->manipulateF(
 
  848                "INSERT INTO svy_question (question_id, questiontype_fi, " .
 
  849                "obj_fi, owner_fi, title, description, author, questiontext, obligatory, complete, " .
 
  850                "created, original_id, tstamp) VALUES " .
 
  851                "(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
 
  852                array(
'integer', 
'integer', 
'integer', 
'integer', 
'text', 
'text', 
'text', 
'text',
 
  853                    'text', 
'text', 
'integer', 
'integer', 
'integer'),
 
  870            $this->log->debug(
"INSERT INTO svy_question question_id= " . $next_id . 
" questiontype_fi= " . $this->
getQuestionTypeID());
 
  872            $this->
setId($next_id);
 
  874        return $this->
getId();
 
  895        return CLIENT_WEB_DIR . 
"/survey/$this->obj_id/$this->id/images/";
 
  906        return CLIENT_WEB_DIR . 
"/survey/$this->obj_id/$this->id/materials/";
 
  947            "SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
 
  948            array(
'text',
'text',
'integer'),
 
  949            array($categorytext, $neutral, 
$ilUser->getId())
 
  956                if (strcmp($row[
"title"], $categorytext) == 0) {
 
  957                    $returnvalue = $row[
"category_id"];
 
  965            $next_id = 
$ilDB->nextId(
'svy_category');
 
  966            $affectedRows = 
$ilDB->manipulateF(
 
  967                "INSERT INTO svy_category (category_id, title, neutral, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
 
  968                array(
'integer',
'text',
'text',
'integer',
'integer'),
 
  969                array($next_id, $categorytext, $neutral, 
$ilUser->getId(), time())
 
  972            $this->log->debug(
"INSERT INTO svy_category id=" . $next_id);
 
  974            $returnvalue = $next_id;
 
  989        $this->log->debug(
"DELETE FROM " . $this->getAdditionalTableName());
 
  991        $affectedRows = 
$ilDB->manipulateF(
 
  992            "DELETE FROM " . $this->getAdditionalTableName() . 
" WHERE question_fi = %s",
 
 1004    public function delete($question_id)
 
 1008        if ($question_id < 1) {
 
 1013            "SELECT obj_fi FROM svy_question WHERE question_id = %s",
 
 1017        if (
$result->numRows() == 1) {
 
 1024        $affectedRows = 
$ilDB->manipulateF(
 
 1025            "DELETE FROM svy_answer WHERE question_fi = %s",
 
 1030        $affectedRows = 
$ilDB->manipulateF(
 
 1031            "DELETE FROM svy_constraint WHERE question_fi = %s",
 
 1037            "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s",
 
 1042            $affectedRows = 
$ilDB->manipulateF(
 
 1043                "DELETE FROM svy_constraint WHERE constraint_id = %s",
 
 1045                array($row->constraint_fi)
 
 1049        $affectedRows = 
$ilDB->manipulateF(
 
 1050            "DELETE FROM svy_qst_constraint WHERE question_fi = %s",
 
 1054        $affectedRows = 
$ilDB->manipulateF(
 
 1055            "DELETE FROM svy_qblk_qst WHERE question_fi = %s",
 
 1059        $affectedRows = 
$ilDB->manipulateF(
 
 1060            "DELETE FROM svy_svy_qst WHERE question_fi = %s",
 
 1064        $affectedRows = 
$ilDB->manipulateF(
 
 1065            "DELETE FROM svy_variable WHERE question_fi = %s",
 
 1069        $affectedRows = 
$ilDB->manipulateF(
 
 1070            "DELETE FROM svy_question WHERE question_id = %s",
 
 1077        $affectedRows = 
$ilDB->manipulateF(
 
 1078            "DELETE FROM svy_material WHERE question_fi = %s",
 
 1083        $this->log->debug(
"SET OF DELETES svy_answer, svy_constraint, svy_qst_constraint, svy_qblk_qst, svy_qst_oblig, svy_svy_qst, svy_variable, svy_question, svy_material WHERE question_fi = " . $question_id);
 
 1088        if (preg_match(
"/\d+/", 
$obj_id) and preg_match(
"/\d+/", $question_id) and is_dir($directory)) {
 
 1097        foreach (
$mobs as $mob) {
 
 1105        $this->log->debug(
"UPDATE svy_question");
 
 1108        $ilDB->manipulate(
"UPDATE svy_question" .
 
 1109            " SET original_id = NULL" .
 
 1110            " WHERE original_id  = " . 
$ilDB->quote($question_id, 
"integer"));
 
 1126        if ($question_id < 1) {
 
 1131            "SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND svy_question.questiontype_fi = svy_qtype.questiontype_id",
 
 1135        if (
$result->numRows() == 1) {
 
 1137            return $data[
"type_tag"];
 
 1156        if ($question_id < 1) {
 
 1161            "SELECT title FROM svy_question WHERE svy_question.question_id = %s",
 
 1165        if (
$result->numRows() == 1) {
 
 1167            return $data[
"title"];
 
 1180    public static function _getOriginalId($question_id, $a_return_question_id_if_no_original = 
true)
 
 1186            "SELECT * FROM svy_question WHERE question_id = %s",
 
 1192            if ($row[
"original_id"] > 0) {
 
 1193                return $row[
"original_id"];
 
 1194            } elseif ((
bool) $a_return_question_id_if_no_original) { 
 
 1195                return $row[
"question_id"];
 
 1217            $this->log->debug(
"DELETE FROM svy_material WHERE question_fi = " . $this->
getOriginalId());
 
 1219            $affectedRows = 
$ilDB->manipulateF(
 
 1220                "DELETE FROM svy_material WHERE question_fi = %s",
 
 1225            if (strlen($this->material[
"internal_link"])) {
 
 1226                $next_id = 
$ilDB->nextId(
'svy_material');
 
 1227                $affectedRows = 
$ilDB->manipulateF(
 
 1228                    "INSERT INTO svy_material (material_id, question_fi, internal_link, import_id, material_title, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
 
 1229                    array(
'integer', 
'integer', 
'text', 
'text', 
'text', 
'integer'),
 
 1230                    array($next_id, $this->
getOriginalId(), $this->material[
"internal_link"], $this->material[
"import_id"], $this->material[
"title"], time())
 
 1233                $this->log->debug(
"INSERT svy_material material_id=" . $next_id . 
" question_fi=" . $this->
getOriginalId());
 
 1235                if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches)) {
 
 1253            "SELECT title FROM svy_phrase WHERE phrase_id = %s",
 
 1258            return $row[
"title"];
 
 1276            "SELECT phrase_id FROM svy_phrase WHERE title = %s AND owner_fi = %s",
 
 1277            array(
'text', 
'integer'),
 
 1280        return (
$result->numRows() == 0) ? false : 
true;
 
 1296        if ($question_id < 1) {
 
 1301            "SELECT question_id FROM svy_question WHERE question_id = %s",
 
 1310        if (strlen($material_id)) {
 
 1311            if (strcmp($material_title, 
"") == 0) {
 
 1312                if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches)) {
 
 1313                    $type = $matches[1];
 
 1315                    $material_title = $this->lng->txt(
"obj_$type") . 
": ";
 
 1319                            $cont_obj = $cont_obj_gui->object;
 
 1320                            $material_title .= $cont_obj->getTitle();
 
 1326                            $cont_obj = $cont_obj_gui->object;
 
 1328                            $material_title .= $pg_obj->getTitle();
 
 1334                            $cont_obj = $cont_obj_gui->object;
 
 1336                            $material_title .= $st_obj->getTitle();
 
 1350            $mat->internal_link = $material_id;
 
 1351            $mat->title = $material_title;
 
 1364        foreach ($a_array as $idx) {
 
 1365            unset($this->material[$idx]);
 
 1367        $this->material = array_values($this->material);
 
 1379        foreach ($this->materials as 
$filename) {
 
 1381            $materialspath_original = preg_replace(
"/([^\d])$this->id([^\d])/", 
"\${1}$question_id\${2}", $materialspath);
 
 1382            if (!file_exists($materialspath)) {
 
 1386                print "material could not be duplicated!!!! ";
 
 1393        array_push($this->material, $obj_material);
 
 1403    public function setMaterial($material_id = 
"", $is_import = 
false, $material_title = 
"")
 
 1405        if (strcmp($material_id, 
"") != 0) {
 
 1408                $import_id = $material_id;
 
 1411            if (strcmp($material_title, 
"") == 0) {
 
 1412                if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches)) {
 
 1413                    $type = $matches[1];
 
 1415                    $material_title = $this->lng->txt(
"obj_$type") . 
": ";
 
 1419                            $cont_obj = $cont_obj_gui->object;
 
 1420                            $material_title .= $cont_obj->getTitle();
 
 1426                            $cont_obj = $cont_obj_gui->object;
 
 1428                            $material_title .= $pg_obj->getTitle();
 
 1434                            $cont_obj = $cont_obj_gui->object;
 
 1436                            $material_title .= $st_obj->getTitle();
 
 1447            $this->material = array(
 
 1448                "internal_link" => $material_id,
 
 1449                "import_id" => $import_id,
 
 1450                "title" => $material_title
 
 1458        if (preg_match(
"/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches)) {
 
 1459            switch ($matches[2]) {
 
 1476            if (strcmp($resolved_link, 
"") == 0) {
 
 1477                $resolved_link = $internal_link;
 
 1480            $resolved_link = $internal_link;
 
 1482        return $resolved_link;
 
 1492            "SELECT * FROM svy_material WHERE question_fi = %s",
 
 1498                $internal_link = $row[
"internal_link"];
 
 1500                if (strcmp($internal_link, $resolved_link) != 0) {
 
 1502                    $affectedRows = 
$ilDB->manipulateF(
 
 1503                        "UPDATE svy_material SET internal_link = %s, tstamp = %s WHERE material_id = %s",
 
 1504                        array(
'text', 
'integer', 
'integer'),
 
 1505                        array($resolved_link, time(), $row[
"material_id"])
 
 1511        if ($resolvedlinks) {
 
 1518                "SELECT * FROM svy_material WHERE question_fi = %s",
 
 1524                    if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $row[
"internal_link"], $matches)) {
 
 1538            "lm" => 
"LearningModule",
 
 1539            "pg" => 
"PageObject",
 
 1540            "st" => 
"StructureObject",
 
 1541            "git" => 
"GlossaryItem",
 
 1542            "mob" => 
"MediaObject" 
 1545        if (preg_match(
"/il__(\w+)_(\d+)/", $target, $matches)) {
 
 1546            $type = $matches[1];
 
 1548            switch ($linktypes[$matches[1]]) {
 
 1549                case "LearningModule":
 
 1553                case "StructureObject":
 
 1556                case "GlossaryItem":
 
 1581        if (($question_id < 1) || ($user_id < 1)) {
 
 1586            "SELECT obj_fi FROM svy_question WHERE question_id = %s",
 
 1590        if (
$result->numRows() == 1) {
 
 1592            $qpl_object_id = $row[
"obj_fi"];
 
 1609            "SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
 
 1613        if (
$result->numRows() == 1) {
 
 1615            return $row[
"questiontype_id"];
 
 1641        $type = $question_type;
 
 1644        } elseif ($gui == 2) {
 
 1645            $type .= 
"Evaluation";
 
 1647        if (file_exists(
"./Modules/SurveyQuestionPool/Questions/class." . 
$type . 
".php")) {
 
 1652            $ilPluginAdmin = 
$DIC[
"ilPluginAdmin"];
 
 1653            $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"SurveyQuestionPool", 
"svyq");
 
 1654            foreach ($pl_names as $pl_name) {
 
 1656                if (strcmp($pl->getQuestionType(), $question_type) == 0) {
 
 1657                    $pl->includeClass(
"class." . 
$type . 
".php");
 
 1673        if (file_exists(
"./Modules/SurveyQuestionPool/Questions/class." . $type_tag . 
".php")) {
 
 1677            return $lng->txt($type_tag);
 
 1681            $ilPluginAdmin = 
$DIC[
"ilPluginAdmin"];
 
 1682            $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"SurveyQuestionPool", 
"svyq");
 
 1683            foreach ($pl_names as $pl_name) {
 
 1685                if (strcmp($pl->getQuestionType(), $type_tag) == 0) {
 
 1686                    return $pl->getQuestionTypeTranslation();
 
 1704        if ($question_type) {
 
 1706            $question = 
new $question_type();
 
 1707            $question->loadFromDb($question_id);
 
 1722        if ($question_type) {
 
 1724            $guitype = $question_type . 
"GUI";
 
 1725            $question = 
new $guitype($question_id);
 
 1743            $class = $question_type . 
"Evaluation";
 
 1744            $ev = 
new $class($question, $a_finished_ids);
 
 1759        if (preg_match(
"/<[^>]*?>/", $a_text)) {
 
 1776        $svy_log->debug(
"material count: " . $a_material->getMaterialCount());
 
 1779        for (
$i = 0; 
$i < $a_material->getMaterialCount(); 
$i++) {
 
 1781            if (strcmp(
$material[
"type"], 
"mattext") == 0) {
 
 1784            if (strcmp(
$material[
"type"], 
"matimage") == 0) {
 
 1786                if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
 
 1788                    if (!is_array(
$_SESSION[
"import_mob_xhtml"])) {
 
 1789                        $_SESSION[
"import_mob_xhtml"] = array();
 
 1791                    array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(), 
"uri" => $matimage->getUri()));
 
 1805    public function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag = 
true, $add_mobs = 
true, $a_attrs = 
null)
 
 1807        $a_xml_writer->xmlStartTag(
"material");
 
 1809            "type" => 
"text/plain" 
 1811        if ($this->
isHTML($a_material)) {
 
 1812            $attrs[
"type"] = 
"text/xhtml";
 
 1814        if (is_array($a_attrs)) {
 
 1815            $attrs = array_merge($attrs, $a_attrs);
 
 1821            foreach (
$mobs as $mob) {
 
 1824                    "label" => 
"il_" . 
IL_INST_ID . 
"_mob_" . $mob,
 
 1825                    "uri" => 
"objects/" . 
"il_" . 
IL_INST_ID . 
"_mob_" . $mob . 
"/" . $mob_obj->getTitle(),
 
 1826                    "type" => 
"spl:html",
 
 1827                    "id" => $this->getId()
 
 1829                $a_xml_writer->xmlElement(
"matimage", $imgattrs, 
null);
 
 1832        if ($close_material_tag) {
 
 1833            $a_xml_writer->xmlEndTag(
"material");
 
 1980        $this->original_id = $original_id;
 
 1985        return $this->original_id;
 
 2011                if (array_key_exists($value, $this->arrData)) {
 
 2012                    return $this->arrData[$value];
 
 2027                $this->arrData[$key] = $value;
 
 2045        $ilDB->manipulate(
"UPDATE svy_question" .
 
 2046            " SET original_id = " . 
$ilDB->quote($a_original_id, 
"integer") . 
"," .
 
 2047            " obj_fi = " . 
$ilDB->quote($a_object_id, 
"integer") .
 
 2048            " WHERE question_id = " . 
$ilDB->quote($a_question_id, 
"integer"));
 
 2055        $set = 
$ilDB->query(
"SELECT q.question_id,s.obj_fi" .
 
 2056            " FROM svy_question q" .
 
 2057            " JOIN svy_svy_qst sq ON (sq.question_fi = q.question_id)" .
 
 2058            " JOIN svy_svy s ON (s.survey_id = sq.survey_fi)" .
 
 2059            " WHERE original_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
 2061        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 2062            if (!$a_group_by_survey) {
 
 2063                $res[] = $row[
"question_id"];
 
 2065                $res[$row[
"obj_fi"]][] = $row[
"question_id"];
 
 2082        $set = 
$ilDB->query(
"SELECT svy_svy.obj_fi FROM svy_svy_qst" .
 
 2083            " JOIN svy_svy ON (svy_svy.survey_id = svy_svy_qst.survey_fi)" .
 
 2084            " WHERE svy_svy_qst.question_fi = " . 
$ilDB->quote($a_question_id, 
"integer"));
 
 2085        $row = 
$ilDB->fetchAssoc($set);
 
 2086        if (
$ilDB->numRows($set)) {
 
 2087            return $row[
"obj_fi"];
 
 2103        $set = 
$ilDB->query(
 
 2104            "SELECT obj_fi FROM svy_question " .
 
 2105            " WHERE question_id = " . 
$ilDB->quote($a_qid, 
"integer")
 
 2107        $rec = 
$ilDB->fetchAssoc($set);
 
 2108        return $rec[
"obj_fi"];
 
 2121        if ($str != $a_str) {
 
An exception for terminatinating execution or to throw for unit testing.
Basic class for all survey question types.
setQuestiontext($questiontext="")
Sets the questiontext of the SurveyQuestion object.
getPreconditionValueOutput($value)
Returns the output for a precondition value.
setId($id=-1)
Sets the id of the SurveyQuestion object.
static _getTitle($question_id)
Returns the question title of a question with a given id.
setAuthor($author="")
Sets the authors name of the SurveyQuestion object.
getOwner()
Gets the creator/owner ID of the SurveyQuestion object.
static getMaxSumScore(int $survey_id)
Get max sum score for specific survey (and this question type)
copyXHTMLMediaObjectsOfQuestion($a_q_id)
Increases the media object usage counter when a question is duplicated.
static _questionExists($question_id)
Returns true if the question already exists in the database.
getQuestionType()
Returns the question type of the question.
getObjId()
Get the reference id of the container object.
static _instanciateQuestionGUI($question_id)
Creates an instance of a question GUI with a given question id.
saveWorkingData($limit_to=LIMIT_NO_LIMIT)
Saves the learners input of the question to the database.
$arrData
data array containing the question data
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
stripSlashesAddSpaceFallback($a_str)
Strip slashes with add space fallback, see https://mantis.ilias.de/view.php?id=19727 and https://mant...
getDescription()
Gets the description string of the SurveyQuestion object.
getId()
Gets the id of the SurveyQuestion object.
getQuestionTypeID()
Returns the question type ID of the question.
setMaterialsfile($materials_filename, $materials_tempfilename="", $materials_name="")
Sets and uploads the materials uri.
static lookupObjFi($a_qid)
Lookip obj fi.
importResponses($a_data)
Import response data from the question import file.
static _getOriginalId($question_id, $a_return_question_id_if_no_original=true)
Returns the original id of a question.
addMaterials($materials_file, $materials_name="")
Sets the materials uri.
addMaterial($obj_material)
importAdjectives($a_data)
Import bipolar adjectives from the question import file.
__construct($title="", $description="", $author="", $questiontext="", $owner=-1)
SurveyQuestion constructor The constructor takes possible arguments an creates an instance of the Sur...
duplicateMaterials($question_id)
Duplicates the materials of a question.
createNewQuestion()
Creates a new question with a 0 timestamp when a new question is created This assures that an ID is g...
setDescription($description="")
Sets the description string of the SurveyQuestion object.
static _resolveInternalLink($internal_link)
setSurveyId($id=-1)
Sets the survey id of the SurveyQuestion object.
isHTML($a_text)
Checks if a given string contains HTML or not.
addInternalLink($material_id, $title="")
getMaterialsPath()
Returns the materials path for web accessable materials of a question.
phraseExists($title)
Returns true if the phrase title already exists for the current user.
setObjId($obj_id=0)
Set the reference id of the container object.
getAuthor()
Gets the authors name of the SurveyQuestion object.
setMaterial($material_id="", $is_import=false, $material_title="")
Sets a material link for the question.
isComplete()
Returns 1, if a question is complete for use.
getPhrase($phrase_id)
Returns a phrase for a given database id.
static _getInternalLinkHref($target="", $a_parent_ref_id=null)
setOriginalId($original_id)
& getWorkingDataFromUserInput($post_data)
Creates the user data of the svy_answer table from the POST data.
getQuestiontext()
Gets the questiontext of the SurveyQuestion object.
getMaterialsPathWeb()
Returns the web image path for web accessable images of a question.
static _isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
getObligatory($survey_id="")
Gets the obligatory state of the question.
getImagePath()
Returns the image path for web accessable images of a question.
deleteMaterial($materials_name="")
Deletes a materials uri with a given name.
setOrientation($orientation=0)
Sets the orientation of the question output.
loadFromDb($question_id)
Loads a SurveyQuestion object from the database.
saveCategoryToDb($categorytext, $neutral=0)
Saves a category to the database.
static _resolveIntLinks($question_id)
static _isComplete($question_id)
Checks whether the question is complete or not.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
getTitle()
Gets the title string of the SurveyQuestion object.
setComplete($a_complete)
Sets the complete state of the question.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=false)
Prepares a string for a text area output in surveys.
importAdditionalMetadata($a_meta)
Import additional meta data from the question import file.
questionTitleExists($title, $questionpool_object="")
Returns TRUE if the question title exists in the database.
duplicate($for_survey=true, $title="", $author="", $owner="", $a_survey_id=0)
Duplicates a survey question.
getPreconditionOptions()
Returns the options for preconditions.
saveMaterial()
save material to db
deleteMaterials($a_array)
Deletes materials.
setOwner($owner="")
Sets the creator/owner ID of the SurveyQuestion object.
setTitle($title="")
Sets the title string of the SurveyQuestion object.
static _lookupSurveyObjId($a_question_id)
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
static _changeOriginalId($a_question_id, $a_original_id, $a_object_id)
Change original id of existing question in db.
saveCompletionStatus($original_id="")
Saves the complete flag to the database.
getSurveyId()
Gets the survey id of the SurveyQuestion object.
saveToDb($original_id="")
Saves a SurveyQuestion object to a database.
getAvailableRelations()
Returns the available relations for the question.
getQuestionDataArray($id)
Returns the question data fields from the database.
$cumulated
An array containing the cumulated results of the question for a given survey.
getOrientation()
Gets the orientation of the question output.
getPreconditionSelectValue($default="", $title, $variable)
Creates a form property for the precondition value.
getCopyIds($a_group_by_survey=false)
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.
usableForPrecondition()
Returns if the question is usable for preconditions.
copyObject($target_questionpool, $title="")
Copies an assOrderingQuestion object.
flushMaterials()
Deletes all materials uris.
setObligatory($obligatory=1)
Sets the obligatory state of the question.
deleteAdditionalTableData($question_id)
Deletes datasets from the additional question table in the database.
static _instanciateQuestionEvaluation($question_id, array $a_finished_ids=null)
Creates an instance of a question evaluation with a given question id.
__set($key, $value)
Object setter.
importMatrix($a_data)
Import matrix rows from the question import file.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
getImagePathWeb()
Returns the web image path for web accessable images of a question.
__get($value)
Object getter.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
static _lookGlossaryTerm($term_id)
get glossary term
static _saveLink( $a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0, $a_source_lang="-")
save internal link information
static _deleteAllLinksOfSource($a_source_type, $a_source_id, $a_lang="-")
Delete all links of a given source.
static _getIdForImportId($a_type, $a_target)
Get current id for an import id.
static _getIdForImportId($a_import_id)
get current object id for import id (static)
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static getLogger($a_component_id)
Get component logger.
Class ilObjContentObjectGUI.
static _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
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...
static _cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
static handleQuestionDeletion($a_question_id, $a_obj_id)
Remove question skill assignment.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
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,...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static removeTrailingPathSeparators($path)
const LIMIT_NO_LIMIT
Assessment constants.
foreach($_POST as $key=> $value) $res