Public Member Functions | Data Fields

SurveyQuestion Class Reference

Basic class for all survey question types. More...

Inheritance diagram for SurveyQuestion:

Public Member Functions

 SurveyQuestion ($title="", $description="", $author="", $questiontext="", $owner=-1)
 SurveyQuestion constructor.
 _SurveyQuestion ()
 isComplete ()
 Returns true, if a question is complete for use.
 getCallingScript ()
 Returns the calling script of the GUI class.
 questionTitleExists ($title, $questionpool_object="")
 Returns TRUE if the question title exists in the database.
 setTitle ($title="")
 Sets the title string.
 setObligatory ($obligatory=1)
 Sets the obligatory state of the question.
 setOrientation ($orientation=0)
 Sets the orientation of the question output.
 setId ($id=-1)
 Sets the id.
 setSurveyId ($id=-1)
 Sets the survey id.
 setDescription ($description="")
 Sets the description.
 addMaterials ($materials_file, $materials_name="")
 Sets the materials uri.
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array
 setMaterialsfile ($materials_filename, $materials_tempfilename="", $materials_name="")
 Sets and uploads the materials uri.
 deleteMaterial ($materials_name="")
 Deletes a materials uri.
 flushMaterials ()
 Deletes all materials uris.
 setAuthor ($author="")
 Sets the authors name.
 setQuestiontext ($questiontext="")
 Sets the questiontext.
 setOwner ($owner="")
 Sets the creator/owner.
 getTitle ()
 Gets the title string.
 getId ()
 Gets the id.
 getObligatory ()
 Gets the obligatory state of the question.
 getSurveyId ()
 Gets the survey id.
 getOrientation ()
 Gets the orientation of the question output.
 getDescription ()
 Gets the description.
 getAuthor ()
 Gets the authors name.
 getOwner ()
 Gets the creator/owner.
 getQuestiontext ()
 Gets the questiontext.
 getObjId ()
 Get the reference id of the container object.
 setObjId ($obj_id=0)
 Set the reference id of the container object.
 insertIntoSurvey ($survey_id)
 Insert the question into a survey.
 duplicate ($for_survey=true, $title="", $author="", $owner="")
 Duplicates a survey question.
 duplicateMaterials ($question_id)
 Duplicates the materials of a question.
 loadFromDb ($question_id)
 Loads a SurveyQuestion object from the database.
 saveToDb ($original_id="")
 Saves a SurveyQuestion object to a database.
 saveWorkingData ($limit_to=LIMIT_NO_LIMIT)
 Saves the learners input of the question to the database.
 getImagePath ()
 Returns the image path for web accessable images of a question.
 getMaterialsPath ()
 Returns the materials path for web accessable material of a question.
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question.
 getMaterialsPathWeb ()
 Returns the web image path for web accessable images of a question.
 saveMaterialsToDb ()
 Saves a materials to a database.
 loadMaterialFromDb ($question_id)
 Loads materials uris from a database.
 isInUse ()
 Checks whether the question is in use or not.
 removeAllQuestionReferences ()
 Removes all references to the question in executed surveys in case the question has been changed.
 saveCategoryToDb ($categorytext)
 Saves a category to the database.
 delete ($question_id)
 Deletes a question from the database.
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id.
 _getOriginalId ($question_id)
 Returns the original id of a question.
 _getRefIdFromObjId ($obj_id)
 syncWithOriginal ()
 getPhrase ($phrase_id)
 Returns a phrase for a given database id.
 phraseExists ($title)
 Returns true if the phrase title already exists for the current user.
 savePhrase ($phrases, $title)
 Saves a set of categories to a default phrase.
 addStandardNumbers ($lower_limit, $upper_limit)
 Adds standard numbers as categories.
 _questionExists ($question_id)
 Returns true if the question already exists in the database.
 setMaterial ($material_id="", $is_import=false, $material_title="")
 Sets a material link for the question.
 _resolveInternalLink ($internal_link)
 _resolveIntLinks ($question_id)
 _getInternalLinkHref ($target="")

Data Fields

 $id
 $title
 $description
 $owner
 $author
 $materials
 $survey_id
 $obj_id
 $questiontext
 $obligatory
 $ilias
 $tpl
 $lng
 $domxml
 $orientation
 $material

Detailed Description

Basic class for all survey question types.

The SurveyQuestion class defines and encapsulates basic methods and attributes for survey question types to be used for all parent classes.

Author:
Helmut Schottmüller <hschottm@tzi.de>
Version:
Id:
class.SurveyQuestion.php 11203 2006-06-21 22:22:02Z hschottm

class.SurveyQuestion.php Survey

Definition at line 35 of file class.SurveyQuestion.php.


Member Function Documentation

SurveyQuestion::_getInternalLinkHref ( target = ""  ) 

Definition at line 1531 of file class.SurveyQuestion.php.

References $target_id, $type, and ilUtil::removeTrailingPathSeparators().

Referenced by SurveyTextQuestionGUI::editQuestion(), SurveyOrdinalQuestionGUI::editQuestion(), SurveyNominalQuestionGUI::editQuestion(), SurveyMetricQuestionGUI::editQuestion(), SurveyTextQuestionGUI::outWorkingForm(), SurveyOrdinalQuestionGUI::outWorkingForm(), SurveyNominalQuestionGUI::outWorkingForm(), and SurveyMetricQuestionGUI::outWorkingForm().

        {
                global $ilDB;
                $linktypes = array(
                        "lm" => "LearningModule",
                        "pg" => "PageObject",
                        "st" => "StructureObject",
                        "git" => "GlossaryItem",
                        "mob" => "MediaObject"
                );
                $href = "";
                if (preg_match("/il__(\w+)_(\d+)/", $target, $matches))
                {
                        $type = $matches[1];
                        $target_id = $matches[2];
                        switch($linktypes[$matches[1]])
                        {
                                case "LearningModule":
                                        $href = ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) ."/goto.php?target=" . $type . "_" . $target_id;
                                        break;
                                case "PageObject":
                                case "StructureObject":
                                        $href = ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) ."/goto.php?target=" . $type . "_" . $target_id;
                                        break;
                                case "GlossaryItem":
                                        $href = ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) ."/goto.php?target=" . $type . "_" . $target_id;
                                        break;
                                case "MediaObject":
                                        $href = ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/content/lm_presentation.php?obj_type=" . $linktypes[$type] . "&cmd=media&ref_id=".$_GET["ref_id"]."&mob_id=".$target_id;
                                        break;
                        }
                }
                return $href;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

SurveyQuestion::_getOriginalId ( question_id  ) 

Returns the original id of a question.

Returns the original id of a question

Parameters:
integer $question_id The database id of the question
Returns:
integer The database id of the original question public

Definition at line 1171 of file class.SurveyQuestion.php.

References $query, $result, and $row.

Referenced by ilObjSurvey::_clone().

        {
                global $ilDB;
                $query = sprintf("SELECT * FROM survey_question WHERE question_id = %s",
                        $ilDB->quote($question_id . "")
                );
                $result = $ilDB->query($query);
                if ($result->numRows() > 0)
                {
                        $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
                        if ($row["original_id"] > 0)
                        {
                                return $row["original_id"];
                        }
                        else
                        {
                                return $row["question_id"];
                        }
                }
                else
                {
                        return "";
                }
        }

Here is the caller graph for this function:

SurveyQuestion::_getQuestionType ( question_id  ) 

Returns the question type of a question with a given id.

Returns the question type of a question with a given id

Parameters:
integer $question_id The database id of the question
Returns:
string The question type string private

Definition at line 1144 of file class.SurveyQuestion.php.

References $data, $query, and $result.

Referenced by ilObjSurvey::_instanciateQuestion().

                                          {
                global $ilDB;

    if ($question_id < 1)
      return "";

    $query = sprintf("SELECT type_tag FROM survey_question, survey_questiontype WHERE survey_question.question_id = %s AND survey_question.questiontype_fi = survey_questiontype.questiontype_id",
      $ilDB->quote($question_id)
    );
    $result = $ilDB->query($query);
    if ($result->numRows() == 1) {
      $data = $result->fetchRow(DB_FETCHMODE_OBJECT);
      return $data->type_tag;
    } else {
      return "";
    }
  }

Here is the caller graph for this function:

SurveyQuestion::_getRefIdFromObjId ( obj_id  ) 

Definition at line 1196 of file class.SurveyQuestion.php.

References $obj_id, $query, $result, and $row.

Referenced by ilObjSurveyGUI::questionsObject().

        {
                global $ilDB;
                
                $query = sprintf("SELECT ref_id FROM object_reference WHERE obj_id=%s",
                        $ilDB->quote($obj_id)
                        
                );
                $result = $ilDB->query($query);
                if ($result->numRows())
                {
                        $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
                        return $row["ref_id"];
                }
                return 0;
        }

Here is the caller graph for this function:

SurveyQuestion::_questionExists ( question_id  ) 

Returns true if the question already exists in the database.

Returns true if the question already exists in the database

Parameters:
integer $question_id The database id of the question
Returns:
boolean True, if the question exists, otherwise False public

Definition at line 1352 of file class.SurveyQuestion.php.

References $query, and $result.

        {
                global $ilDB;

                if ($question_id < 1)
                {
                        return false;
                }
                
                $query = sprintf("SELECT question_id FROM survey_question WHERE question_id = %s",
                        $ilDB->quote($question_id)
                );
    $result = $ilDB->query($query);
                if ($result->numRows() == 1)
                {
                        return true;
                }
                else
                {
                        return false;
                }
        }

SurveyQuestion::_resolveInternalLink ( internal_link  ) 

Definition at line 1443 of file class.SurveyQuestion.php.

References ilInternalLink::_getIdForImportId(), and ilLMObject::_getIdForImportId().

Referenced by _resolveIntLinks(), and setMaterial().

        {
                if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches))
                {
                        require_once "./content/classes/Pages/class.ilInternalLink.php";
                        require_once "./content/classes/class.ilLMObject.php";
                        require_once "./content/classes/class.ilGlossaryTerm.php";
                        switch ($matches[2])
                        {
                                case "lm":
                                        $resolved_link = ilLMObject::_getIdForImportId($internal_link);
                                        break;
                                case "pg":
                                        $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
                                        break;
                                case "st":
                                        $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
                                        break;
                                case "git":
                                        $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
                                        break;
                                case "mob":
                                        $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
                                        break;
                        }
                        if (strcmp($resolved_link, "") == 0)
                        {
                                $resolved_link = $internal_link;
                        }
                }
                else
                {
                        $resolved_link = $internal_link;
                }
                return $resolved_link;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

SurveyQuestion::_resolveIntLinks ( question_id  ) 

Definition at line 1480 of file class.SurveyQuestion.php.

References $query, $result, $row, ilInternalLink::_deleteAllLinksOfSource(), _resolveInternalLink(), and ilInternalLink::_saveLink().

        {
                global $ilDB;
                $resolvedlinks = 0;
                $query = sprintf("SELECT * FROM survey_material WHERE question_fi = %s",
                        $ilDB->quote($question_id . "")
                );
                $result = $ilDB->query($query);
                if ($result->numRows())
                {
                        while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                        {
                                $internal_link = $row["internal_link"];
                                $resolved_link = SurveyQuestion::_resolveInternalLink($internal_link);
                                if (strcmp($internal_link, $resolved_link) != 0)
                                {
                                        // internal link was resolved successfully
                                        $queryupdate = sprintf("UPDATE survey_material SET internal_link = %s WHERE material_id = %s",
                                                $ilDB->quote($resolved_link),
                                                $ilDB->quote($row["material_id"] . "")
                                        );
                                        $updateresult = $ilDB->query($queryupdate);
                                        $resolvedlinks++;
                                }
                        }
                }
                if ($resolvedlinks)
                {
                        // there are resolved links -> reenter theses links to the database

                        // delete all internal links from the database
                        require_once "./content/classes/Pages/class.ilInternalLink.php";
                        ilInternalLink::_deleteAllLinksOfSource("sqst", $question_id);

                        $query = sprintf("SELECT * FROM survey_material WHERE question_fi = %s",
                                $ilDB->quote($question_id . "")
                        );
                        $result = $ilDB->query($query);
                        if ($result->numRows())
                        {
                                while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                                {
                                        if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches))
                                        {
                                                ilInternalLink::_saveLink("sqst", $question_id, $matches[2], $matches[3], $matches[1]);
                                        }
                                }
                        }
                }
        }

Here is the call graph for this function:

SurveyQuestion::_SurveyQuestion (  ) 

Definition at line 221 of file class.SurveyQuestion.php.

        {
                if (!empty($this->domxml))
                {
                        $this->domxml->free();
                }
        }

SurveyQuestion::addMaterials ( materials_file,
materials_name = "" 
)

Sets the materials uri.

Sets the materials uri

Parameters:
string $materials_file An uri to additional materials
string $materials_name An uri name to additional materials public
See also:
$materials

Definition at line 379 of file class.SurveyQuestion.php.

References keyInArray().

Referenced by loadMaterialFromDb(), and setMaterialsfile().

                                                             {
        if(empty($materials_name)) {
        $materials_name = $materials_file;
    }
    if ((!empty($materials_name))&&(!$this->keyInArray($materials_name, $this->materials))) {
      $this->materials[$materials_name] = $materials_file;
    }

  }

Here is the call graph for this function:

Here is the caller graph for this function:

SurveyQuestion::addStandardNumbers ( lower_limit,
upper_limit 
)

Adds standard numbers as categories.

Adds standard numbers as categories

Parameters:
integer $lower_limit The lower limit
integer $upper_limit The upper limit public

Definition at line 1335 of file class.SurveyQuestion.php.

        {
                for ($i = $lower_limit; $i <= $upper_limit; $i++)
                {
                        array_push($this->categories, $i);
                }
        }

SurveyQuestion::delete ( question_id  ) 

Deletes a question from the database.

Deletes a question and all materials from the database

Parameters:
integer $question_id The database id of the question private

Definition at line 1033 of file class.SurveyQuestion.php.

References $obj_id, $query, $result, $row, and ilInternalLink::_deleteAllLinksOfSource().

  {
    if ($question_id < 1)
      return;
      
                $query = sprintf("SELECT obj_fi FROM survey_question WHERE question_id = %s",
                        $this->ilias->db->quote($question_id)
                );
    $result = $this->ilias->db->query($query);
                if ($result->numRows() == 1)
                {
                        $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
                        $obj_id = $row["obj_fi"];
                }
                else
                {
                        return;
                }
                
                $query = sprintf("DELETE FROM survey_answer WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("SELECT constraint_id FROM survey_constraint WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);
                while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $query = sprintf("DELETE FROM survey_question_constraint WHERE constraint_fi = %s",
                                $this->ilias->db->quote($row->constraint_id)
                        );
                        $delresult = $this->ilias->db->query($query);
                }
                
                $query = sprintf("DELETE FROM survey_constraint WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("SELECT constraint_fi FROM survey_question_constraint WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);
                while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $query = sprintf("DELETE FROM survey_constraint WHERE constraint_id = %s",
                                $this->ilias->db->quote($row->constraint_fi)
                        );
                        $delresult = $this->ilias->db->query($query);
                }
                $query = sprintf("DELETE FROM survey_question_constraint WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("DELETE FROM survey_question_material WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("DELETE FROM survey_questionblock_question WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("DELETE FROM survey_question_obligatory WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("DELETE FROM survey_survey_question WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("DELETE FROM survey_variable WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("DELETE FROM survey_question WHERE question_id = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);

                $query = sprintf("DELETE FROM survey_material WHERE question_fi = %s",
                        $this->ilias->db->quote($question_id)
                );
                $result = $this->ilias->db->query($query);
                require_once "./content/classes/Pages/class.ilInternalLink.php";
                ilInternalLink::_deleteAllLinksOfSource("sqst", $question_id);

                $directory = CLIENT_WEB_DIR . "/survey/" . $obj_id . "/$question_id";
                if (preg_match("/\d+/", $obj_id) and preg_match("/\d+/", $question_id) and is_dir($directory))
                {
                        $directory = escapeshellarg($directory);
                        exec("rm -rf $directory");
                }
        }

Here is the call graph for this function:

SurveyQuestion::deleteMaterial ( materials_name = ""  ) 

Deletes a materials uri.

Deletes a materials uri with a given name.

Parameters:
string $index A materials_name of the materials uri public
See also:
$materials

Definition at line 450 of file class.SurveyQuestion.php.

References getMaterialsPath().

                                                {
        foreach ($this->materials as $key => $value) {
                if (strcmp($key, $materials_name)==0) {
                        if (file_exists($this->getMaterialsPath().$value)) {
                                unlink($this->getMaterialsPath().$value);
                        }
                        unset($this->materials[$key]);
                }
        }
  }

Here is the call graph for this function:

SurveyQuestion::duplicate ( for_survey = true,
title = "",
author = "",
owner = "" 
)

Duplicates a survey question.

Duplicates a survey question

public

Definition at line 696 of file class.SurveyQuestion.php.

References $author, $owner, $title, and getId().

        {
                if ($this->getId() <= 0)
                {
                        // The question has not been saved. It cannot be duplicated
                        return;
                }
                // duplicate the question in database
                $clone = $this;
                $original_id = $this->getId();
                $clone->setId(-1);
                if ($title)
                {
                        $clone->setTitle($title);
                }
                if ($author)
                {
                        $clone->setAuthor($author);
                }
                if ($owner)
                {
                        $clone->setOwner($owner);
                }
                if ($for_survey)
                {
                        $clone->saveToDb($original_id);
                }
                else
                {
                        $clone->saveToDb();
                }
                // duplicate the materials
                $clone->duplicateMaterials($original_id);
                return $clone->getId();
        }

Here is the call graph for this function:

SurveyQuestion::duplicateMaterials ( question_id  ) 

Duplicates the materials of a question.

Duplicates the materials of a question

Parameters:
integer $question_id The database id of the original survey question public

Definition at line 740 of file class.SurveyQuestion.php.

References getMaterialsPath(), and ilUtil::makeDirParents().

        {
                foreach ($this->materials as $filename)
                {
                        $materialspath = $this->getMaterialsPath();
                        $materialspath_original = preg_replace("/([^\d])$this->id([^\d])/", "\${1}$question_id\${2}", $materialspath);
                        if (!file_exists($materialspath)) {
                                ilUtil::makeDirParents($materialspath);
                        }
                        if (!copy($materialspath_original . $filename, $materialspath . $filename)) {
                                print "material could not be duplicated!!!! ";
                        }
                }
        }

Here is the call graph for this function:

SurveyQuestion::flushMaterials (  ) 

Deletes all materials uris.

Deletes all materials uris

public

See also:
$materials

Definition at line 469 of file class.SurveyQuestion.php.

                            {
    $this->materials = array();
  }

SurveyQuestion::getAuthor (  ) 

Gets the authors name.

Gets the authors name of the SurveyQuestion object

Returns:
string The string containing the name of the questions author public
See also:
$author

Definition at line 603 of file class.SurveyQuestion.php.

Referenced by SurveyTextQuestion::to_xml(), SurveyOrdinalQuestion::to_xml(), SurveyNominalQuestion::to_xml(), and SurveyMetricQuestion::to_xml().

                       {
    return $this->author;
  }

Here is the caller graph for this function:

SurveyQuestion::getCallingScript (  ) 

Returns the calling script of the GUI class.

public

Definition at line 248 of file class.SurveyQuestion.php.

        {
                return "questionpool.php";
        }

SurveyQuestion::getDescription (  ) 

Gets the description.

Gets the description string of the SurveyQuestion object

Returns:
string The description string to describe the question public
See also:
$description

Definition at line 590 of file class.SurveyQuestion.php.

Referenced by SurveyTextQuestion::to_xml(), SurveyOrdinalQuestion::to_xml(), SurveyNominalQuestion::to_xml(), and SurveyMetricQuestion::to_xml().

                            {
    return $this->description;
  }

Here is the caller graph for this function:

SurveyQuestion::getId (  ) 

Gets the id.

Gets the id of the SurveyQuestion object

Returns:
integer The id of the SurveyQuestion object public
See also:
$id

Definition at line 537 of file class.SurveyQuestion.php.

Referenced by duplicate(), SurveyTextQuestion::from_xml(), SurveyOrdinalQuestion::from_xml(), SurveyNominalQuestion::from_xml(), SurveyMetricQuestion::from_xml(), saveToDb(), SurveyTextQuestion::to_xml(), SurveyOrdinalQuestion::to_xml(), SurveyNominalQuestion::to_xml(), and SurveyMetricQuestion::to_xml().

                   {
    return $this->id;
  }

Here is the caller graph for this function:

SurveyQuestion::getImagePath (  ) 

Returns the image path for web accessable images of a question.

Returns the image path for web accessable images of a question. The image path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/images

public

Definition at line 837 of file class.SurveyQuestion.php.

                                {
                return CLIENT_WEB_DIR . "/survey/$this->obj_id/$this->id/images/";
        }

SurveyQuestion::getImagePathWeb (  ) 

Returns the web image path for web accessable images of a question.

Returns the web image path for web accessable images of a question. The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/images

public

Definition at line 861 of file class.SurveyQuestion.php.

References ilUtil::removeTrailingPathSeparators().

                                   {
                $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/survey/$this->obj_id/$this->id/images/";
                return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
        }

Here is the call graph for this function:

SurveyQuestion::getMaterialsPath (  ) 

Returns the materials path for web accessable material of a question.

Returns the materials path for web accessable materials of a question. The materials path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/materials

public

Definition at line 849 of file class.SurveyQuestion.php.

Referenced by deleteMaterial(), duplicateMaterials(), and setMaterialsfile().

                                    {
                return CLIENT_WEB_DIR . "/survey/$this->obj_id/$this->id/materials/";
        }

Here is the caller graph for this function:

SurveyQuestion::getMaterialsPathWeb (  ) 

Returns the web image path for web accessable images of a question.

Returns the web image path for web accessable images of a question. The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/images

public

Definition at line 874 of file class.SurveyQuestion.php.

References ilUtil::removeTrailingPathSeparators().

                                       {
                $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/survey/$this->obj_id/$this->id/materials/";
                return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
        }

Here is the call graph for this function:

SurveyQuestion::getObjId (  ) 

Get the reference id of the container object.

Get the reference id of the container object

Returns:
integer The reference id of the container object public
See also:
$obj_id

Definition at line 642 of file class.SurveyQuestion.php.

                      {
    return $this->obj_id;
  }

SurveyQuestion::getObligatory (  ) 

Gets the obligatory state of the question.

Gets the obligatory state of the question

Returns:
boolean True, if the question is obligatory, otherwise false public
See also:
$obligatory

Definition at line 550 of file class.SurveyQuestion.php.

Referenced by SurveyTextQuestion::to_xml(), SurveyOrdinalQuestion::to_xml(), SurveyNominalQuestion::to_xml(), and SurveyMetricQuestion::to_xml().

                           {
    return $this->obligatory;
  }

Here is the caller graph for this function:

SurveyQuestion::getOrientation (  ) 

Gets the orientation of the question output.

Gets the orientation of the question output

Returns:
integer 0 = vertical, 1 = horizontal public
See also:
$orientation

Definition at line 576 of file class.SurveyQuestion.php.

                            {
    return $this->orientation;
  }

SurveyQuestion::getOwner (  ) 

Gets the creator/owner.

Gets the creator/owner ID of the SurveyQuestion object

Returns:
integer The numerical ID to identify the owner/creator public
See also:
$owner

Definition at line 616 of file class.SurveyQuestion.php.

                      {
    return $this->owner;
  }

SurveyQuestion::getPhrase ( phrase_id  ) 

Returns a phrase for a given database id.

Returns a phrase for a given database id

Returns:
String The title of the phrase public

Definition at line 1241 of file class.SurveyQuestion.php.

References $query, $result, and $row.

        {
                $query = sprintf("SELECT title FROM survey_phrase WHERE phrase_id = %s",
                        $this->ilias->db->quote($phrase_id)
                );
    $result = $this->ilias->db->query($query);
                if ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        return $row["title"];
                }
                return "";
        }

SurveyQuestion::getQuestiontext (  ) 

Gets the questiontext.

Gets the questiontext of the SurveyQuestion object

Returns:
string The questiontext of the question object public
See also:
$questiontext

Definition at line 629 of file class.SurveyQuestion.php.

Referenced by SurveyTextQuestion::to_xml(), SurveyOrdinalQuestion::to_xml(), SurveyNominalQuestion::to_xml(), and SurveyMetricQuestion::to_xml().

                             {
    return $this->questiontext;
  }

Here is the caller graph for this function:

SurveyQuestion::getSurveyId (  ) 

Gets the survey id.

Gets the survey id of the SurveyQuestion object

Returns:
integer The survey id of the SurveyQuestion object public
See also:
$survey_id

Definition at line 563 of file class.SurveyQuestion.php.

                         {
    return $this->survey_id;
  }

SurveyQuestion::getTitle (  ) 

Gets the title string.

Gets the title string of the SurveyQuestion object

Returns:
string The title string to describe the question public
See also:
$title

Definition at line 524 of file class.SurveyQuestion.php.

Referenced by SurveyTextQuestion::to_xml(), SurveyOrdinalQuestion::to_xml(), SurveyNominalQuestion::to_xml(), and SurveyMetricQuestion::to_xml().

                      {
    return $this->title;
  }

Here is the caller graph for this function:

SurveyQuestion::insertIntoSurvey ( survey_id  ) 

Insert the question into a survey.

Insert the question into a survey

Parameters:
integer $survey_id The database id of the survey private

Definition at line 667 of file class.SurveyQuestion.php.

                                        {
    // get maximum sequence index in survey
/*    $query = sprintf("SELECT MAX(sequence) AS seq FROM dum_survey_question WHERE survey_fi=%s",
      $this->ilias->db->quote($survey_id)
    );
    $result = $this->ilias->db->db->query($query);
    $sequence = 1;
    if ($result->numRows() == 1) {
      $data = $result->fetchRow(DB_FETCHMODE_OBJECT);
      $sequence = $data->seq + 1;
    }
    $query = sprintf("INSERT INTO dum_survey_question (survey_question_id, survey_fi, question_fi, sequence, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
      $this->ilias->db->quote($survey_id),
      $this->ilias->db->quote($this->get_id()),
      $this->ilias->db->quote($sequence)
    );
    $result = $this->ilias->db->db->query($query);
    if ($result != DB_OK) {
      // Fehlermeldung
    }
*/  }

SurveyQuestion::isComplete (  ) 

Returns true, if a question is complete for use.

Returns true, if a question is complete for use

Returns:
boolean True, if the question is complete for use, otherwise false public

Reimplemented in SurveyMetricQuestion, SurveyNominalQuestion, SurveyOrdinalQuestion, and SurveyTextQuestion.

Definition at line 238 of file class.SurveyQuestion.php.

        {
                return false;
        }

SurveyQuestion::isInUse (  ) 

Checks whether the question is in use or not.

Checks whether the question is in use or not

Returns:
boolean The number of datasets which are affected by the use of the query. public

Definition at line 939 of file class.SurveyQuestion.php.

                           {
/*              $query = sprintf("SELECT COUNT(solution_id) AS solution_count FROM tst_solutions WHERE question_fi = %s",
                        $this->ilias->db->quote("$this->id")
                );
                $result = $this->ilias->db->query($query);
                $row = $result->fetchRow(DB_FETCHMODE_OBJECT);
                return $row->solution_count;
*/      }

SurveyQuestion::keyInArray ( searchkey,
array 
)

returns TRUE if the key occurs in an array

returns TRUE if the key occurs in an array

Parameters:
string $arraykey A key to an element in array
array $array An array to be searched private
See also:
$materials

Definition at line 399 of file class.SurveyQuestion.php.

Referenced by addMaterials().

                                          {
          if ($searchKey) {
                   foreach ($array as $key => $value) {
                           if (strcmp($key, $searchkey)==0) {
                                   return true;
                           }
                   }
           }
           return false;
  }

Here is the caller graph for this function:

SurveyQuestion::loadFromDb ( question_id  ) 

Loads a SurveyQuestion object from the database.

Loads a SurveyQuestion object from the database

Parameters:
integer $question_id A unique key which defines the question in the database public

Reimplemented in SurveyMetricQuestion, SurveyNominalQuestion, SurveyOrdinalQuestion, and SurveyTextQuestion.

Definition at line 764 of file class.SurveyQuestion.php.

References $query, $result, and $row.

        {
                $query = sprintf("SELECT * FROM survey_material WHERE question_fi = %s",
                        $this->ilias->db->quote($this->getId() . "")
                );
                $result = $this->ilias->db->query($query);
                $this->material = array();
                if ($result->numRows())
                {
                        while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                        {
                                $this->material = array(
                                        "internal_link" => $row["internal_link"],
                                        "import_id" => $row["import_id"],
                                        "title" => $row["material_title"]
                                );
                        }
                }
        }

SurveyQuestion::loadMaterialFromDb ( question_id  ) 

Loads materials uris from a database.

Loads materials uris from a database

Parameters:
integer $question_id A unique key which defines the survey question in the database public

Definition at line 916 of file class.SurveyQuestion.php.

References $data, $query, $result, and addMaterials().

Referenced by SurveyTextQuestion::loadFromDb(), SurveyOrdinalQuestion::loadFromDb(), SurveyNominalQuestion::loadFromDb(), and SurveyMetricQuestion::loadFromDb().

  {
    $query = sprintf("SELECT * FROM survey_question_material WHERE question_fi = %s",
      $this->ilias->db->quote($question_id)
    );
    $result = $this->ilias->db->query($query);
    if (strcmp(strtolower(get_class($result)), db_result) == 0) {
        $this->materials = array();
        while ($data = $result->fetchRow(DB_FETCHMODE_OBJECT)) {
                                $this->addMaterials($data->materials_file, $data->materials);
                        }
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

SurveyQuestion::phraseExists ( title  ) 

Returns true if the phrase title already exists for the current user.

Returns true if the phrase title already exists for the current user

Parameters:
string $title The title of the phrase
Returns:
boolean True, if the title exists, otherwise False public

Definition at line 1263 of file class.SurveyQuestion.php.

References $ilUser, $query, $result, and $title.

        {
                global $ilUser;
                
                $query = sprintf("SELECT phrase_id FROM survey_phrase WHERE title = %s AND owner_fi = %s",
                        $this->ilias->db->quote($title),
                        $this->ilias->db->quote($ilUser->id)
                );
    $result = $this->ilias->db->query($query);
                if ($result->numRows() == 0)
                {
                        return false;
                }
                else
                {
                        return true;
                }
        }

SurveyQuestion::questionTitleExists ( title,
questionpool_object = "" 
)

Returns TRUE if the question title exists in the database.

Returns TRUE if the question title exists in the database

Parameters:
string $title The title of the question
string $questionpool_reference The reference id of a container question pool
Returns:
boolean The result of the title check public

Definition at line 263 of file class.SurveyQuestion.php.

References $query, $result, and $title.

                                                                  {
                $refwhere = "";
                if (strcmp($questionpool_reference, "") != 0)
                {
                        $refwhere = sprintf(" AND obj_fi = %s",
                                $this->ilias->db->quote($questionpool_object)
                        );
                }
    $query = sprintf("SELECT question_id FROM survey_question WHERE title = %s$refwhere",
      $this->ilias->db->quote($title)
    );
    $result = $this->ilias->db->query($query);
    if (strcmp(strtolower(get_class($result)), db_result) == 0) {
      if ($result->numRows() == 1) {
        return TRUE;
      }
    }
    return FALSE;
  }

SurveyQuestion::removeAllQuestionReferences (  ) 

Removes all references to the question in executed surveys in case the question has been changed.

Removes all references to the question in executed surveys in case the question has been changed. If a question was changed it cannot be guaranteed that the content and the meaning of the question is the same as before. So we have to delete all already started or completed surveys using that question. Therefore we have to delete all references to that question in tst_solutions and the tst_active entries which were created for the user and survey in the tst_solutions entry.

public

Definition at line 959 of file class.SurveyQuestion.php.

                                               {
/*              $query = sprintf("SELECT * FROM tst_solutions WHERE question_fi = %s", $this->ilias->db->quote("$this->id"));
                $result = $this->ilias->db->query($query);
                while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT)) {
                        // Mark all surveys containing this question as "not started"
                        $querychange = sprintf("DELETE FROM tst_active WHERE user_fi = %s AND survey_fi = %s",
                                $this->ilias->db->quote("$result->user_fi"),
                                $this->ilias->db->quote("$result->survey_fi")
                        );
                        $changeresult = $this->ilias->db->query($querychange);
                }
                // delete all resultsets for this question
                $querydelete = sprintf("DELETE FROM tst_solutions WHERE question_fi = %s", $this->ilias->db->quote("$this->id"));
                $deleteresult = $this->ilias->db->query($querydelete);
        }
*/}

SurveyQuestion::saveCategoryToDb ( categorytext  ) 

Saves a category to the database.

Saves a category to the database

Parameters:
string $categorytext The description of the category
Returns:
integer The database id of the category public
See also:
$categories

Definition at line 986 of file class.SurveyQuestion.php.

References $ilUser, $query, $result, and $row.

Referenced by SurveyOrdinalQuestion::saveToDb(), SurveyNominalQuestion::saveToDb(), SurveyOrdinalQuestion::syncWithOriginal(), and SurveyNominalQuestion::syncWithOriginal().

        {
                global $ilUser;
                
                $query = sprintf("SELECT title, category_id FROM survey_category WHERE title = %s AND owner_fi = %s",
                        $this->ilias->db->quote($categorytext),
                        $this->ilias->db->quote($ilUser->id)
                );
    $result = $this->ilias->db->query($query);
                $insert = FALSE;
                $returnvalue = "";
                if ($result->numRows()) 
                {
                        $insert = TRUE;
                        while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
                        {
                                if (strcmp($row->title, $categorytext) == 0)
                                {
                                        $returnvalue = $row->category_id;
                                        $insert = FALSE;
                                }
                        }
                }
                else
                {
                        $insert = TRUE;
                }
                if ($insert)
                {
                        $query = sprintf("INSERT INTO survey_category (category_id, title, owner_fi, TIMESTAMP) VALUES (NULL, %s, %s, NULL)",
                                $this->ilias->db->quote($categorytext),
                                $this->ilias->db->quote($ilUser->id)
                        );
                        $result = $this->ilias->db->query($query);
                        $returnvalue = $this->ilias->db->getLastInsertId();
                }
                return $returnvalue;
        }

Here is the caller graph for this function:

SurveyQuestion::saveMaterialsToDb (  ) 

Saves a materials to a database.

Saves a materials to a database

Parameters:
object $db A pear DB object public

Definition at line 887 of file class.SurveyQuestion.php.

References $query, and $result.

Referenced by SurveyTextQuestion::saveToDb(), SurveyOrdinalQuestion::saveToDb(), SurveyNominalQuestion::saveToDb(), and SurveyMetricQuestion::saveToDb().

  {
                if ($this->id > 0) 
                {
                        $query = sprintf("DELETE FROM survey_question_material WHERE question_fi = %s",
                                $this->ilias->db->quote($this->id)
                        );
                        $result = $this->ilias->db->query($query);
                        if (!empty($this->materials)) {
                                foreach ($this->materials as $key => $value) {
                                        $query = sprintf("INSERT INTO survey_question_material (question_fi, materials, materials_file) VALUES (%s, %s, %s)",
                                                $this->ilias->db->quote($this->id),
                                                $this->ilias->db->quote($key),
                                                $this->ilias->db->quote($value)
                                        );
                                        $result = $this->ilias->db->query($query);
                                }
                        }
                }
        }

Here is the caller graph for this function:

SurveyQuestion::savePhrase ( phrases,
title 
)

Saves a set of categories to a default phrase.

Saves a set of categories to a default phrase

Parameters:
array $phrases The database ids of the seleted phrases
string $title The title of the default phrase public

Definition at line 1291 of file class.SurveyQuestion.php.

References $counter, $ilUser, $query, $result, and $title.

        {
                global $ilUser;
                
                $query = sprintf("INSERT INTO survey_phrase (phrase_id, title, defaultvalue, owner_fi, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
                        $this->ilias->db->quote($title),
                        $this->ilias->db->quote("1"),
                        $this->ilias->db->quote($ilUser->id)
                );
    $result = $this->ilias->db->query($query);
                $phrase_id = $this->ilias->db->getLastInsertId();
                                
                $counter = 1;
          foreach ($this->categories as $key => $value) 
                {
                        if (in_array($key, $phrases))
                        {
                                $query = sprintf("INSERT INTO survey_category (category_id, title, defaultvalue, owner_fi, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
                                        $this->ilias->db->quote($value),
                                        $this->ilias->db->quote("1"),
                                        $this->ilias->db->quote($ilUser->id)
                                );
                    $result = $this->ilias->db->query($query);
                                $category_id = $this->ilias->db->getLastInsertId();
                                $query = sprintf("INSERT INTO survey_phrase_category (phrase_category_id, phrase_fi, category_fi, sequence) VALUES (NULL, %s, %s, %s)",
                                        $this->ilias->db->quote($phrase_id),
                                        $this->ilias->db->quote($category_id),
                                        $this->ilias->db->quote("$counter")
                                );
                    $result = $this->ilias->db->query($query);
                                $counter++;
                        }
                }
        }

SurveyQuestion::saveToDb ( original_id = ""  ) 

Saves a SurveyQuestion object to a database.

Saves a SurveyQuestion object to a database

Parameters:
integer $original_id public

Reimplemented in SurveyMetricQuestion, SurveyNominalQuestion, SurveyOrdinalQuestion, and SurveyTextQuestion.

Definition at line 792 of file class.SurveyQuestion.php.

References $query, $result, ilInternalLink::_deleteAllLinksOfSource(), ilInternalLink::_saveLink(), and getId().

        {
                require_once "./content/classes/Pages/class.ilInternalLink.php";
                $query = sprintf("DELETE FROM survey_material WHERE question_fi = %s",
                        $this->ilias->db->quote($this->getId() . "")
                );
                $result = $this->ilias->db->query($query);
                ilInternalLink::_deleteAllLinksOfSource("sqst", $this->getId());
                if (count($this->material))
                {
                        $query = sprintf("INSERT INTO survey_material (material_id, question_fi, internal_link, import_id, material_title, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, NULL)",
                                $this->ilias->db->quote($this->getId() . ""),
                                $this->ilias->db->quote($this->material["internal_link"] . ""),
                                $this->ilias->db->quote($this->material["import_id"] . ""),
                                $this->ilias->db->quote($this->material["title"] . "")
                        );
                        $this->ilias->db->query($query);
                        if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches))
                        {
                                ilInternalLink::_saveLink("sqst", $this->getId(), $matches[2], $matches[3], $matches[1]);
                        }
                }
        }

Here is the call graph for this function:

SurveyQuestion::saveWorkingData ( limit_to = LIMIT_NO_LIMIT  ) 

Saves the learners input of the question to the database.

Saves the learners input of the question to the database

public

See also:
$answers

Definition at line 825 of file class.SurveyQuestion.php.

        {
  }

SurveyQuestion::setAuthor ( author = ""  ) 

Sets the authors name.

Sets the authors name of the SurveyQuestion object

Parameters:
string $author A string containing the name of the questions author public
See also:
$author

Definition at line 482 of file class.SurveyQuestion.php.

References $author.

Referenced by SurveyTextQuestion::from_xml(), SurveyOrdinalQuestion::from_xml(), SurveyNominalQuestion::from_xml(), and SurveyMetricQuestion::from_xml().

                                   {
    if (!$author) {
      $author = $this->ilias->account->fullname;
    }
    $this->author = $author;
  }

Here is the caller graph for this function:

SurveyQuestion::setDescription ( description = ""  ) 

Sets the description.

Sets the description string of the SurveyQuestion object

Parameters:
string $description A description string to describe the question public
See also:
$description

Definition at line 364 of file class.SurveyQuestion.php.

References $description.

Referenced by SurveyTextQuestion::from_xml(), SurveyOrdinalQuestion::from_xml(), SurveyNominalQuestion::from_xml(), and SurveyMetricQuestion::from_xml().

                                             {
    $this->description = $description;
  }

Here is the caller graph for this function:

SurveyQuestion::setId ( id = -1  ) 

Sets the id.

Sets the id of the SurveyQuestion object

Parameters:
integer $id A unique integer value public
See also:
$id

Definition at line 338 of file class.SurveyQuestion.php.

References $id.

                           {
    $this->id = $id;
  }

SurveyQuestion::setMaterial ( material_id = "",
is_import = false,
material_title = "" 
)

Sets a material link for the question.

Sets a material link for the question

Parameters:
string $material_id An internal link pointing to the material
boolean $is_import A boolean indication that the internal link was imported from another ILIAS installation public

Definition at line 1384 of file class.SurveyQuestion.php.

References $lm_id, $target_id, $type, ilGlossaryTerm::_lookGlossaryTerm(), ilLMObject::_lookupContObjID(), and _resolveInternalLink().

Referenced by SurveyTextQuestion::from_xml(), SurveyOrdinalQuestion::from_xml(), SurveyNominalQuestion::from_xml(), and SurveyMetricQuestion::from_xml().

        {
                if (strcmp($material_id, "") != 0)
                {
                        $import_id = "";
                        if ($is_import)
                        {
                                $import_id = $material_id;
                                $material_id = $this->_resolveInternalLink($import_id);
                        }
                        if (strcmp($material_title, "") == 0)
                        {
                                if (preg_match("/il__(\w+)_(\d+)/", $material_id, $matches))
                                {
                                        $type = $matches[1];
                                        $target_id = $matches[2];
                                        $material_title = $this->lng->txt("obj_$type") . ": ";
                                        switch ($type)
                                        {
                                                case "lm":
                                                        require_once("./content/classes/class.ilObjContentObject.php");
                                                        $cont_obj =& new ilObjContentObject($target_id, true);
                                                        $material_title .= $cont_obj->getTitle();
                                                        break;
                                                case "pg":
                                                        require_once("./content/classes/class.ilLMPageObject.php");
                                                        require_once("./content/classes/class.ilLMObject.php");
                                                        require_once("./content/classes/class.ilObjContentObject.php");
                                                        $lm_id = ilLMObject::_lookupContObjID($target_id);
                                                        $cont_obj =& new ilObjContentObject($lm_id, false);
                                                        $pg_obj =& new ilLMPageObject($cont_obj, $target_id);
                                                        $material_title .= $pg_obj->getTitle();
                                                        break;
                                                case "st":
                                                        require_once("content/classes/class.ilStructureObject.php");
                                                        require_once("./content/classes/class.ilLMObject.php");
                                                        require_once("./content/classes/class.ilObjContentObject.php");
                                                        $lm_id = ilLMObject::_lookupContObjID($target_id);
                                                        $cont_obj =& new ilObjContentObject($lm_id, false);
                                                        $st_obj =& new ilStructureObject($cont_obj, $target_id);
                                                        $material_title .= $st_obj->getTitle();
                                                        break;
                                                case "git":
                                                        require_once "./content/classes/class.ilGlossaryTerm.php";
                                                        $material_title = $this->lng->txt("glossary_term") . ": " . ilGlossaryTerm::_lookGlossaryTerm($target_id);
                                                        break;
                                                case "mob":
                                                        break;
                                        }
                                }
                        }
                        $this->material = array(
                                "internal_link" => $material_id,
                                "import_id" => $import_id,
                                "title" => $material_title
                        );
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

SurveyQuestion::setMaterialsfile ( materials_filename,
materials_tempfilename = "",
materials_name = "" 
)

Sets and uploads the materials uri.

Sets and uploads the materials uri

Parameters:
string $materials_filename, string $materials_tempfilename, string $materials public
See also:
$materials

Definition at line 419 of file class.SurveyQuestion.php.

References addMaterials(), getMaterialsPath(), ilUtil::makeDirParents(), and ilUtil::moveUploadedFile().

        {
                if (!empty($materials_filename))
                {
                        $materialspath = $this->getMaterialsPath();
                        if (!file_exists($materialspath))
                        {
                                ilUtil::makeDirParents($materialspath);
                        }
                        //if (!move_uploaded_file($materials_tempfilename, $materialspath . $materials_filename))
                        if (ilUtil::moveUploadedFile($materials_tempfilename, $materials_filename,
                                $materialspath.$materials_filename))
                        {
                                print "image not uploaded!!!! ";
                        }
                        else
                        {
                                $this->addMaterials($materials_filename, $materials_name);
                        }
                }
        }

Here is the call graph for this function:

SurveyQuestion::setObjId ( obj_id = 0  ) 

Set the reference id of the container object.

Set the reference id of the container object

Parameters:
integer $obj_id The reference id of the container object public
See also:
$obj_id

Definition at line 655 of file class.SurveyQuestion.php.

References $obj_id.

                                 {
    $this->obj_id = $obj_id;
  }

SurveyQuestion::setObligatory ( obligatory = 1  ) 

Sets the obligatory state of the question.

Sets the obligatory state of the question

Parameters:
boolean $obligatory True, if the question is obligatory, otherwise false public
See also:
$obligatory

Definition at line 305 of file class.SurveyQuestion.php.

References $obligatory.

Referenced by SurveyTextQuestion::from_xml(), SurveyOrdinalQuestion::from_xml(), SurveyNominalQuestion::from_xml(), SurveyMetricQuestion::from_xml(), SurveyTextQuestion::to_xml(), SurveyOrdinalQuestion::to_xml(), SurveyNominalQuestion::to_xml(), and SurveyMetricQuestion::to_xml().

                                          {
                if ($obligatory)
                {
            $this->obligatory = 1;
                }
                else
                {
            $this->obligatory = 0;
                }
  }

Here is the caller graph for this function:

SurveyQuestion::setOrientation ( orientation = 0  ) 

Sets the orientation of the question output.

Sets the orientation of the question output

Parameters:
integer $orientation 0 = vertical, 1 = horizontal public
See also:
$orientation

Definition at line 325 of file class.SurveyQuestion.php.

References $orientation.

                                            {
    $this->orientation = $orientation;
  }

SurveyQuestion::setOwner ( owner = ""  ) 

Sets the creator/owner.

Sets the creator/owner ID of the SurveyQuestion object

Parameters:
integer $owner A numerical ID to identify the owner/creator public
See also:
$owner

Definition at line 511 of file class.SurveyQuestion.php.

References $owner.

                                 {
    $this->owner = $owner;
  }

SurveyQuestion::setQuestiontext ( questiontext = ""  ) 

Sets the questiontext.

Sets the questiontext of the SurveyQuestion object

Parameters:
string $questiontext A string containing the questiontext public
See also:
$questiontext

Definition at line 498 of file class.SurveyQuestion.php.

References $questiontext.

Referenced by SurveyTextQuestion::from_xml(), SurveyOrdinalQuestion::from_xml(), SurveyNominalQuestion::from_xml(), and SurveyMetricQuestion::from_xml().

                                               {
    $this->questiontext = $questiontext;
  }

Here is the caller graph for this function:

SurveyQuestion::setSurveyId ( id = -1  ) 

Sets the survey id.

Sets the survey id of the SurveyQuestion object

Parameters:
integer $id A unique integer value public
See also:
$survey_id

Definition at line 351 of file class.SurveyQuestion.php.

References $id.

                                 {
    $this->survey_id = $id;
  }

SurveyQuestion::setTitle ( title = ""  ) 

Sets the title string.

Sets the title string of the SurveyQuestion object

Parameters:
string $title A title string to describe the question public
See also:
$title

Definition at line 292 of file class.SurveyQuestion.php.

References $title.

Referenced by SurveyTextQuestion::from_xml(), SurveyOrdinalQuestion::from_xml(), SurveyNominalQuestion::from_xml(), and SurveyMetricQuestion::from_xml().

                                 {
    $this->title = $title;
  }

Here is the caller graph for this function:

SurveyQuestion::SurveyQuestion ( title = "",
description = "",
author = "",
questiontext = "",
owner = -1 
)

SurveyQuestion constructor.

The constructor takes possible arguments an creates an instance of the SurveyQuestion object.

Parameters:
string $title A title string to describe the question
string $description A description string to describe the question
string $author A string containing the name of the questions author
integer $owner A numerical ID to identify the owner/creator public

Definition at line 184 of file class.SurveyQuestion.php.

References $author, $description, $ilias, $lng, $owner, $questiontext, $title, and $tpl.

Referenced by SurveyMetricQuestion::SurveyMetricQuestion(), SurveyNominalQuestion::SurveyNominalQuestion(), SurveyOrdinalQuestion::SurveyOrdinalQuestion(), and SurveyTextQuestion::SurveyTextQuestion().

  {
                global $ilias;
    global $lng;
    global $tpl;

                $this->ilias =& $ilias;
    $this->lng =& $lng;
    $this->tpl =& $tpl;

    $this->title = $title;
    $this->description = $description;
                $this->questiontext = $questiontext;
    $this->author = $author;
    if (!$this->author) {
      $this->author = $this->ilias->account->fullname;
    }
    $this->owner = $owner;
    if ($this->owner == -1) {
      $this->owner = $this->ilias->account->id;
    }
    $this->id = -1;
    $this->survey_id = -1;
                $this->obligatory = 1;
                $this->orientation = 0;
                $this->materials = array();
                $this->material = array();
                register_shutdown_function(array(&$this, '_SurveyQuestion'));
        }

Here is the caller graph for this function:

SurveyQuestion::syncWithOriginal (  ) 

Reimplemented in SurveyMetricQuestion, SurveyNominalQuestion, SurveyOrdinalQuestion, and SurveyTextQuestion.

Definition at line 1213 of file class.SurveyQuestion.php.

References $query, $result, ilInternalLink::_deleteAllLinksOfSource(), and ilInternalLink::_saveLink().

        {
                require_once "./content/classes/Pages/class.ilInternalLink.php";
                $query = sprintf("DELETE FROM survey_material WHERE question_fi = %s",
                        $this->ilias->db->quote($this->original_id . "")
                );
                $result = $this->ilias->db->query($query);
                ilInternalLink::_deleteAllLinksOfSource("sqst", $this->original_id);
                $query = sprintf("INSERT INTO survey_material (material_id, question_fi, internal_link, import_id, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
                        $this->ilias->db->quote($this->original_id . ""),
                        $this->ilias->db->quote($this->material["internal_link"] . ""),
                        $this->ilias->db->quote($this->material["import_id"] . "")
                );
                $this->ilias->db->query($query);
                if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $this->material["internal_link"], $matches))
                {
                        ilInternalLink::_saveLink("sqst", $this->original_id, $matches[2], $matches[3], $matches[1]);
                }
        }

Here is the call graph for this function:


Field Documentation

SurveyQuestion::$author
SurveyQuestion::$description
SurveyQuestion::$domxml

Definition at line 160 of file class.SurveyQuestion.php.

SurveyQuestion::$id
SurveyQuestion::$ilias

Definition at line 133 of file class.SurveyQuestion.php.

Referenced by SurveyQuestion().

SurveyQuestion::$lng

Definition at line 151 of file class.SurveyQuestion.php.

Referenced by SurveyQuestion().

SurveyQuestion::$material
SurveyQuestion::$materials

Definition at line 88 of file class.SurveyQuestion.php.

SurveyQuestion::$obj_id

Definition at line 106 of file class.SurveyQuestion.php.

Referenced by _getRefIdFromObjId(), delete(), and setObjId().

SurveyQuestion::$obligatory

Definition at line 124 of file class.SurveyQuestion.php.

Referenced by setObligatory().

SurveyQuestion::$orientation

Definition at line 169 of file class.SurveyQuestion.php.

Referenced by setOrientation().

SurveyQuestion::$owner
SurveyQuestion::$questiontext
SurveyQuestion::$survey_id

Definition at line 97 of file class.SurveyQuestion.php.

SurveyQuestion::$title
SurveyQuestion::$tpl

Definition at line 142 of file class.SurveyQuestion.php.

Referenced by SurveyQuestion().


The documentation for this class was generated from the following file: