40         $this->db = $DIC->database();
    49         $result = 
$ilDB->queryF(
    54         if ($result->numRows() === 1) {
    55             return $ilDB->fetchAssoc($result);
    65         $result = 
$ilDB->queryF(
    70         if ($result->numRows() === 1) {
    73             $this->
setTitle((
string) $data[
"title"]);
    74             $this->label = (string) $data[
'label'];
    76             $this->
setObjId((
int) $data[
"obj_fi"]);
    77             $this->
setAuthor((
string) $data[
"author"]);
    78             $this->
setOwner((
int) $data[
"owner_fi"]);
    86         parent::loadFromDb($question_id);
   117         if ($affectedRows === 1) {
   121                 array($this->
getId())
   125                 array(
'integer', 
'integer'),
   129         return $affectedRows;
   133         bool $a_include_header = 
true,
   134         bool $obligatory_state = 
false   137         $a_xml_writer->xmlHeader();
   138         $this->
insertXML($a_xml_writer, $a_include_header);
   139         $xml = $a_xml_writer->xmlDumpMem(
false);
   140         if (!$a_include_header) {
   141             $pos = strpos($xml, 
"?>");
   142             $xml = substr($xml, $pos + 2);
   149         $a_include_header = 
true   152             "id" => $this->
getId(),
   161         if (strlen($this->label ?? 
"")) {
   163                 "label" => $this->label,
   168         $a_xml_writer->
xmlStartTag(
"questiontext", $attrs);
   170         $a_xml_writer->
xmlEndTag(
"questiontext");
   179         $a_xml_writer->
xmlElement(
"response_text", $attrs);
   182         if (count($this->material)) {
   183             if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches)) {
   185                     "label" => $this->material[
"title"]
   188                 $intlink = 
"il_" . 
IL_INST_ID . 
"_" . $matches[2] . 
"_" . $matches[3];
   189                 if (strcmp($matches[1], 
"") != 0) {
   190                     $intlink = $this->material[
"internal_link"];
   192                 $a_xml_writer->
xmlElement(
"mattext", null, $intlink);
   202         return "SurveyTextQuestion";
   207         return "svy_qst_text";
   213         $entered_value = $post_data[$this->
getId() . 
"_text_question"] ?? 
"";
   215         if (strlen($entered_value ?? 
"")) {
   216             $data[] = array(
"textanswer" => $entered_value);
   229         $entered_value = $post_data[$this->
getId() . 
"_text_question"];
   231         if ((!$this->
getObligatory()) && (strlen($entered_value ?? 
"") == 0)) {
   235         if (strlen($entered_value ?? 
"") == 0) {
   236             return $this->
lng->txt(
"text_question_not_filled_out");
   241             return str_replace(
"%s", 
ilStr::strLen($entered_value), $this->
lng->txt(
"svy_answer_too_long"));
   250         bool $a_return = 
false   258             $entered_value = 
ilStr::subStr($entered_value, 0, $maxchars);
   262             return array(array(
"value" => null, 
"textanswer" => $entered_value));
   264         if (strlen($entered_value ?? 
"") == 0) {
   268         $next_id = 
$ilDB->nextId(
'svy_answer');
   271         $fields[
'answer_id'] = array(
"integer", $next_id);
   272         $fields[
'question_fi'] = array(
"integer", $this->
getId());
   273         $fields[
'active_fi'] = array(
"integer", $active_id);
   274         $fields[
'value'] = array(
"float", null);
   275         $fields[
'textanswer'] = array(
"clob", (strlen($entered_value ?? 
"")) ? $entered_value : null);
   276         $fields[
'tstamp'] = array(
"integer", time());
   278         $ilDB->insert(
"svy_answer", $fields);
   286             if (
$data[
"maxlength"] > 0) {
 static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
 
setQuestiontext(string $questiontext="")
 
loadFromDb(int $question_id)
 
__construct(string $title="", string $description="", string $author="", string $questiontext="", int $owner=-1)
 
setObligatory(bool $obligatory=true)
 
setOriginalId(?int $original_id)
 
setComplete(bool $a_complete)
 
importResponses(array $a_data)
 
static subStr(string $a_str, int $a_start, ?int $a_length=null)
 
toXML(bool $a_include_header=true, bool $obligatory_state=false)
 
stripSlashesAddSpaceFallback(string $a_str)
Strip slashes with add space fallback, see https://mantis.ilias.de/view.php?id=19727 and https://mant...
 
xmlEndTag(string $tag)
Writes an endtag. 
 
static strLen(string $a_string)
 
getQuestionDataArray(int $id)
 
setAuthor(string $author="")
 
addMaterialTag(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true, ?array $a_attrs=null)
Creates an XML material tag from a plain text or xhtml text. 
 
checkUserInput(array $post_data, int $survey_id)
Checks the input of the active user for obligatory status and entered values. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
setMaxChars(int $maxchars=0)
 
insertXML(ilXmlWriter $a_xml_writer, $a_include_header=true)
 
setTitle(string $title="")
 
saveUserInput(array $post_data, int $active_id, bool $a_return=false)
 
saveToDb(int $original_id=0)
 
__construct(Container $dic, ilPlugin $plugin)
 
getWorkingDataFromUserInput(array $post_data)
 
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content) 
 
setDescription(string $description="")
 
setObjId(int $obj_id=0)
Set the reference(?) id of the container object.