ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
SurveyQuestion Class Reference

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

+ Inheritance diagram for SurveyQuestion:
+ Collaboration diagram for SurveyQuestion:

Public Member Functions

 SurveyQuestion ($title="", $description="", $author="", $questiontext="", $owner=-1)
 SurveyQuestion constructor The constructor takes possible arguments an creates an instance of the SurveyQuestion object.
 _SurveyQuestion ()
 setComplete ($a_complete)
 Sets the complete state of the question.
 isComplete ()
 Returns 1, if a question is complete for use.
 questionTitleExists ($title, $questionpool_object="")
 Returns TRUE if the question title exists in the database.
 setTitle ($title="")
 Sets the title string of the SurveyQuestion object.
 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 of the SurveyQuestion object.
 setSurveyId ($id=-1)
 Sets the survey id of the SurveyQuestion object.
 setDescription ($description="")
 Sets the description string of the SurveyQuestion object.
 addMaterials ($materials_file, $materials_name="")
 Sets the materials uri.
 setMaterialsfile ($materials_filename, $materials_tempfilename="", $materials_name="")
 Sets and uploads the materials uri.
 deleteMaterial ($materials_name="")
 Deletes a materials uri with a given name.
 flushMaterials ()
 Deletes all materials uris.
 setAuthor ($author="")
 Sets the authors name of the SurveyQuestion object.
 setQuestiontext ($questiontext="")
 Sets the questiontext of the SurveyQuestion object.
 setOwner ($owner="")
 Sets the creator/owner ID of the SurveyQuestion object.
 getTitle ()
 Gets the title string of the SurveyQuestion object.
 getId ()
 Gets the id of the SurveyQuestion object.
 getObligatory ($survey_id="")
 Gets the obligatory state of the question.
 getSurveyId ()
 Gets the survey id of the SurveyQuestion object.
 getOrientation ()
 Gets the orientation of the question output.
 getDescription ()
 Gets the description string of the SurveyQuestion object.
 getAuthor ()
 Gets the authors name of the SurveyQuestion object.
 getOwner ()
 Gets the creator/owner ID of the SurveyQuestion object.
 getQuestiontext ()
 Gets the questiontext of the SurveyQuestion object.
 getObjId ()
 Get the reference id of the container object.
 setObjId ($obj_id=0)
 Set the reference id of the container object.
 duplicate ($for_survey=true, $title="", $author="", $owner="")
 Duplicates a survey question.
 copyObject ($target_questionpool, $title="")
 Copies an assOrderingQuestion object.
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 Increases the media object usage counter when a question is duplicated.
 loadFromDb ($question_id)
 Loads a SurveyQuestion object from the database.
 _isComplete ($question_id)
 Checks whether the question is complete or not.
 saveCompletionStatus ($original_id="")
 Saves the complete flag to the database.
 saveToDb ($original_id="")
 Saves a SurveyQuestion object to a database.
 saveMaterial ()
 save material to db
 createNewQuestion ()
 Creates a new question with a 0 timestamp when a new question is created This assures that an ID is given to the question if a file upload or something else occurs.
 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 materials 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.
 saveCategoryToDb ($categorytext, $neutral=0)
 Saves a category to the database.
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database.
 delete ($question_id)
 Deletes a question and all materials from the database.
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id.
 _getTitle ($question_id)
 Returns the question title of a question with a given id.
 _getOriginalId ($question_id)
 Returns the original id of a question.
 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.
 _questionExists ($question_id)
 Returns true if the question already exists in the database.
 addInternalLink ($material_id, $title="")
 deleteMaterials ($a_array)
 Deletes materials.
 duplicateMaterials ($question_id)
 Duplicates the materials of a question.
 addMaterial ($obj_material)
 setMaterial ($material_id="", $is_import=false, $material_title="")
 Sets a material link for the question.
 _resolveInternalLink ($internal_link)
 _resolveIntLinks ($question_id)
 _getInternalLinkHref ($target="")
 _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user.
 getQuestionTypeID ()
 Returns the question type ID of the question.
 getQuestionType ()
 Returns the question type of the question.
_instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id.
_instanciateQuestionGUI ($question_id)
 Creates an instance of a question GUI with a given question id.
 isHTML ($a_text)
 Checks if a given string contains HTML or not.
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string.
 addMaterialTag (&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE)
 Creates an XML material tag from a plain text or xhtml text.
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=FALSE)
 Prepares a string for a text area output in surveys.
 _getQuestionDataArray ($id)
 Returns the question data fields from the database.
 addUserSpecificResultsExportTitles (&$a_array)
 Adds the entries for the title row of the user specific results.
 addUserSpecificResultsData (&$a_array, &$resultset)
 Adds the values for the user specific results export for a given user.
getUserAnswers ($survey_id)
 Returns an array containing all answers to this question in a given survey.
getWorkingDataFromUserInput ($post_data)
 Creates the user data of the svy_answer table from the POST data.
 importAdditionalMetadata ($a_meta)
 Import additional meta data from the question import file.
 importResponses ($a_data)
 Import response data from the question import file.
 importAdjectives ($a_data)
 Import bipolar adjectives from the question import file.
 importMatrix ($a_data)
 Import matrix rows from the question import file.
 setExportCumulatedXLS (&$worksheet, &$format_title, &$format_bold, &$eval_data, $row)
 Creates the Excel output for the cumulated results of this question.
setExportCumulatedCVS (&$eval_data)
 Creates the CSV output for the cumulated results of this question.
 setExportDetailsXLS (&$workbook, &$format_title, &$format_bold, &$eval_data)
 Creates an Excel worksheet for the detailed cumulated results of this question.
 usableForPrecondition ()
 Returns if the question is usable for preconditions.
 getAvailableRelations ()
 Returns the available relations for the question.
 getPreconditionSelectValue ($default="")
 Creates a value selection for preconditions.
 getPreconditionValueOutput ($value)
 Returns the output for a precondition value.
 outChart ($survey_id, $type="")
 Creates an image visualising the results of the question.
 setOriginalId ($original_id)
 getOriginalId ()
 saveRandomData ($active_id)
 Saves random answers for a given active user in the database.
 getMaterial ()
 setSubtype ($a_subtype)
 getSubtype ()
 getCumulatedResultData ($survey_id, $counter)
 Creates a the cumulated results data for the question.

Static Public Member Functions

static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type.
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag.

Data Fields

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

Protected Member Functions

calculateCumulatedResults ($survey_id)

Protected Attributes

 $cumulated
 An array containing the cumulated results of the question for a given survey.

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 helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
Id:
class.SurveyQuestion.php 25582 2010-09-08 09:27:33Z hschottm

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

Member Function Documentation

SurveyQuestion::_getInternalLinkHref (   $target = "")

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

References $ilDB, $target_id, $type, and ilUtil\removeTrailingPathSeparators().

Referenced by SurveyQuestionGUI\getMaterialOutput(), and SurveyQuestionGUI\material().

{
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];
include_once "./Services/Utilities/classes/class.ilUtil.php";
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) . "/ilias.php?baseClass=ilLMPresentationGUI&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.

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

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

References $ilDB, $result, and $row.

Referenced by ilObjSurvey\cloneObject(), and copyObject().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_question WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() > 0)
{
$row = $ilDB->fetchAssoc($result);
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::_getQuestionDataArray (   $id)

Returns the question data fields from the database.

Parameters
integer$idThe question ID from the database
Returns
array Array containing the question fields and data from the database public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

{
return array();
}
SurveyQuestion::_getQuestionType (   $question_id)

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

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

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

References $data, $ilDB, and $result.

Referenced by _instanciateQuestion(), ilObjSurvey\_instanciateQuestion(), _instanciateQuestionGUI(), ilObjSurveyQuestionPoolGUI\addLocatorItems(), ilObjSurvey\getConstraints(), and ilObjSurvey\getUserSpecificResults().

{
global $ilDB;
if ($question_id < 1) return "";
$result = $ilDB->queryF("SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND svy_question.questiontype_fi = svy_qtype.questiontype_id",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
return $data["type_tag"];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

static SurveyQuestion::_getQuestionTypeName (   $type_tag)
static

Return the translation for a given question type tag.

Parameters
string$type_tagThe type tag of the question type public

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

References $lng, ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by ilObjSurveyGUI\addConstraintForm(), ilObjSurveyQuestionPoolGUI\deleteQuestionsObject(), ilSurveyQuestionsTableGUI\fillRow(), and ilObjSurveyGUI\removeQuestionsForm().

{
if (file_exists("./Modules/SurveyQuestionPool/classes/class.".$type_tag.".php"))
{
global $lng;
return $lng->txt($type_tag);
}
else
{
global $ilPluginAdmin;
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "SurveyQuestionPool", "svyq");
foreach ($pl_names as $pl_name)
{
$pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "SurveyQuestionPool", "svyq", $pl_name);
if (strcmp($pl->getQuestionType(), $type_tag) == 0)
{
return $pl->getQuestionTypeTranslation();
}
}
}
return "";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::_getTitle (   $question_id)

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

Parameters
integer$question_idThe database id of the question
Returns
string The question title private

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

References $data, $ilDB, and $result.

Referenced by ilObjSurveyQuestionPoolGUI\addLocatorItems().

{
global $ilDB;
if ($question_id < 1) return "";
$result = $ilDB->queryF("SELECT title FROM svy_question WHERE svy_question.question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
return $data["title"];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

static SurveyQuestion::_includeClass (   $question_type,
  $gui = 0 
)
static

Include the php class file for a given question type.

Parameters
string$question_typeThe type tag of the question type
Returns
integer 0 if the class should be included, 1 if the GUI class should be included public

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

References $type, ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by SurveyQuestionGUI\_getQuestionGUI(), _instanciateQuestion(), ilObjSurvey\_instanciateQuestion(), _instanciateQuestionGUI(), ilObjSurveyGUI\addConstraintForm(), ilObjSurvey\getConstraints(), ilObjSurvey\getUserSpecificResults(), SurveyImportParser\handlerBeginTag(), and ilObjSurveyQuestionPool\toXML().

{
$type = $question_type;
if ($gui) $type .= "GUI";
if (file_exists("./Modules/SurveyQuestionPool/classes/class.".$type.".php"))
{
include_once "./Modules/SurveyQuestionPool/classes/class.".$type.".php";
return true;
}
else
{
global $ilPluginAdmin;
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "SurveyQuestionPool", "svyq");
foreach ($pl_names as $pl_name)
{
$pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "SurveyQuestionPool", "svyq", $pl_name);
if (strcmp($pl->getQuestionType(), $question_type) == 0)
{
$pl->includeClass("class.".$type.".php");
return true;
}
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& SurveyQuestion::_instanciateQuestion (   $question_id)

Creates an instance of a question with a given question id.

Parameters
integer$question_idThe question id
Returns
object The question instance public

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

References _getQuestionType(), and _includeClass().

Referenced by ilObjSurveyQuestionPool\duplicateQuestion(), ilSurveyEvaluationGUI\exportCumulatedResults(), ilSurveyEvaluationGUI\exportUserSpecificResults(), ilObjSurveyQuestionPool\removeQuestion(), and ilSurveyExecutionGUI\saveActiveQuestionData().

{
$question_type = SurveyQuestion::_getQuestionType($question_id);
$question = new $question_type();
$question->loadFromDb($question_id);
return $question;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& SurveyQuestion::_instanciateQuestionGUI (   $question_id)

Creates an instance of a question GUI with a given question id.

Parameters
integer$question_idThe question id
Returns
object The question GUI instance public

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

References _getQuestionType(), and _includeClass().

Referenced by ilSurveyEvaluationGUI\evaluation().

{
$question_type = SurveyQuestion::_getQuestionType($question_id);
SurveyQuestion::_includeClass($question_type, 1);
$guitype = $question_type . "GUI";
$question = new $guitype($question_id);
return $question;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::_isComplete (   $question_id)

Checks whether the question is complete or not.

Returns
boolean TRUE if the question is complete, FALSE otherwise public

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

References $ilDB, $result, and $row.

Referenced by ilObjSurvey\insertQuestion().

{
global $ilDB;
$result = $ilDB->queryF("SELECT complete FROM svy_question WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
if ($row["complete"] == 1)
{
return TRUE;
}
}
return FALSE;
}

+ Here is the caller graph for this function:

SurveyQuestion::_isWriteable (   $question_id,
  $user_id 
)

Returns true if the question is writeable by a certain user.

Parameters
integer$question_idThe database id of the question
integer$user_idThe database id of the user
Returns
boolean True, if the question exists, otherwise False public

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

References $ilDB, $result, and $row.

Referenced by SurveyQuestionGUI\save().

{
global $ilDB;
if (($question_id < 1) || ($user_id < 1))
{
return false;
}
$result = $ilDB->queryF("SELECT obj_fi FROM svy_question WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$qpl_object_id = $row["obj_fi"];
include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
return ilObjSurveyQuestionPool::_isWriteable($qpl_object_id, $user_id);
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

SurveyQuestion::_questionExists (   $question_id)

Returns true if the question already exists in the database.

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

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

References $ilDB, and $result.

{
global $ilDB;
if ($question_id < 1)
{
return false;
}
$result = $ilDB->queryF("SELECT question_id FROM svy_question WHERE question_id = %s",
array('integer'),
array($question_id)
);
return ($result->numRows() == 1) ? true : false;
}
SurveyQuestion::_resolveInternalLink (   $internal_link)

Definition at line 1487 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))
{
include_once "./Services/COPage/classes/class.ilInternalLink.php";
include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
include_once "./Modules/Glossary/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 1524 of file class.SurveyQuestion.php.

References $ilDB, $result, $row, ilInternalLink\_deleteAllLinksOfSource(), _resolveInternalLink(), and ilInternalLink\_saveLink().

Referenced by ilContObjParser\processPagesToParse().

{
global $ilDB;
$resolvedlinks = 0;
$result = $ilDB->queryF("SELECT * FROM svy_material WHERE question_fi = %s",
array('integer'),
array($question_id)
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$internal_link = $row["internal_link"];
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$resolved_link = SurveyQuestion::_resolveInternalLink($internal_link);
if (strcmp($internal_link, $resolved_link) != 0)
{
// internal link was resolved successfully
$affectedRows = $ilDB->manipulateF("UPDATE svy_material SET internal_link = %s, tstamp = %s WHERE material_id = %s",
array('text', 'integer', 'integer'),
array($resolved_link, time(), $row["material_id"])
);
$resolvedlinks++;
}
}
}
if ($resolvedlinks)
{
// there are resolved links -> reenter theses links to the database
// delete all internal links from the database
include_once "./Services/COPage/classes/class.ilInternalLink.php";
$result = $ilDB->queryF("SELECT * FROM svy_material WHERE question_fi = %s",
array('integer'),
array($question_id)
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
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:

+ Here is the caller graph for this function:

SurveyQuestion::_SurveyQuestion ( )

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

{
}
SurveyQuestion::addInternalLink (   $material_id,
  $title = "" 
)

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

References $target_id, $type, ilGlossaryTerm\_lookGlossaryTerm(), ilLMObject\_lookupContObjID(), addMaterial(), and saveMaterial().

{
if (strlen($material_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":
include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
$cont_obj_gui =& new ilObjContentObjectGUI("", $target_id, true);
$cont_obj = $cont_obj_gui->object;
$material_title .= $cont_obj->getTitle();
break;
case "pg":
include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
$cont_obj_gui =& new ilObjContentObjectGUI("", $lm_id, FALSE);
$cont_obj = $cont_obj_gui->object;
$pg_obj =& new ilLMPageObject($cont_obj, $target_id);
$material_title .= $pg_obj->getTitle();
break;
case "st":
include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
$cont_obj_gui =& new ilObjContentObjectGUI("", $lm_id, FALSE);
$cont_obj = $cont_obj_gui->object;
$st_obj =& new ilStructureObject($cont_obj, $target_id);
$material_title .= $st_obj->getTitle();
break;
case "git":
include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
$material_title = $this->lng->txt("glossary_term") . ": " . ilGlossaryTerm::_lookGlossaryTerm($target_id);
break;
case "mob":
break;
}
}
}
include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
$mat = new ilSurveyMaterial();
$mat->type = 0;
$mat->internal_link = $material_id;
$mat->title = $material_title;
$this->addMaterial($mat);
$this->saveMaterial();
}
}

+ Here is the call graph for this function:

SurveyQuestion::addMaterial (   $obj_material)

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

Referenced by addInternalLink().

{
array_push($this->material, $obj_material);
}

+ Here is the caller graph for this function:

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

Sets the materials uri.

Parameters
string$materials_fileAn uri to additional materials
string$materials_nameAn uri name to additional materials public
See Also
$materials

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

Referenced by setMaterialsfile().

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

+ Here is the caller graph for this function:

SurveyQuestion::addMaterialTag ( $a_xml_writer,
  $a_material,
  $close_material_tag = TRUE,
  $add_mobs = TRUE 
)

Creates an XML material tag from a plain text or xhtml text.

Parameters
object$a_xml_writerReference to the ILIAS XML writer
string$a_materialplain text or html text containing the material
Returns
string XML material tag public

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

References $mobs, ilObjMediaObject\_getMobsOfObject(), ilRTE\_replaceMediaObjectImageSrc(), getId(), and isHTML().

Referenced by SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), and SurveyMatrixQuestion\insertXML().

{
include_once "./Services/RTE/classes/class.ilRTE.php";
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$a_xml_writer->xmlStartTag("material");
$attrs = array(
"type" => "text/plain"
);
if ($this->isHTML($a_material))
{
$attrs["type"] = "text/xhtml";
}
$a_xml_writer->xmlElement("mattext", $attrs, ilRTE::_replaceMediaObjectImageSrc($a_material, 0));
if ($add_mobs)
{
foreach ($mobs as $mob)
{
$mob_obj =& new ilObjMediaObject($mob);
$imgattrs = array(
"label" => "il_" . IL_INST_ID . "_mob_" . $mob,
"uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle()
);
$a_xml_writer->xmlElement("matimage", $imgattrs, NULL);
}
}
if ($close_material_tag) $a_xml_writer->xmlEndTag("material");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::addUserSpecificResultsData ( $a_array,
$resultset 
)

Adds the values for the user specific results export for a given user.

Parameters
array$a_arrayAn array which is used to append the values
array$resultsetThe evaluation data for a given user public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

{
// overwrite in inherited classes
}
SurveyQuestion::addUserSpecificResultsExportTitles ( $a_array)

Adds the entries for the title row of the user specific results.

Parameters
array$a_arrayAn array which is used to append the title row entries public

Reimplemented in SurveyMatrixQuestion, and SurveyMultipleChoiceQuestion.

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

References getTitle().

{
array_push($a_array, $this->getTitle());
}

+ Here is the call graph for this function:

& SurveyQuestion::calculateCumulatedResults (   $survey_id)
protected

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

References $cumulated, $survey_id, and ilObjSurvey\_getNrOfParticipants().

Referenced by getCumulatedResultData(), and SurveyMatrixQuestion\getCumulatedResultData().

{
if (count($this->cumulated) == 0)
{
include_once "./Modules/Survey/classes/class.ilObjSurvey.php";
$this->cumulated =& $this->getCumulatedResults($survey_id, $nr_of_users);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::copyObject (   $target_questionpool,
  $title = "" 
)

Copies an assOrderingQuestion object.

public

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

References $title, _getOriginalId(), getId(), and getObjId().

{
if ($this->getId() <= 0)
{
// The question has not been saved. It cannot be copied
return;
}
$clone = $this;
$original_id = SurveyQuestion::_getOriginalId($this->getId());
$clone->setId(-1);
$source_questionpool = $this->getObjId();
$clone->setObjId($target_questionpool);
if ($title)
{
$clone->setTitle($title);
}
$clone->saveToDb();
// duplicate the materials
$clone->duplicateMaterials($original_id);
// copy XHTML media objects
$clone->copyXHTMLMediaObjectsOfQuestion($original_id);
return $clone->getId();
}

+ Here is the call graph for this function:

SurveyQuestion::copyXHTMLMediaObjectsOfQuestion (   $a_q_id)

Increases the media object usage counter when a question is duplicated.

Parameters
integer$a_q_idThe question id of the original question public

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

References $mobs, ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_saveUsage(), and getId().

{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mobs = ilObjMediaObject::_getMobsOfObject("spl:html", $a_q_id);
foreach ($mobs as $mob)
{
ilObjMediaObject::_saveUsage($mob, "spl:html", $this->getId());
}
}

+ Here is the call graph for this function:

SurveyQuestion::createNewQuestion ( )

Creates a new question with a 0 timestamp when a new question is created This assures that an ID is given to the question if a file upload or something else occurs.

Returns
integer ID of the new question

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

References $_GET, $_POST, $ilDB, $obj_id, ilObject\_lookupObjId(), getAuthor(), getId(), getObjId(), getOwner(), getQuestionTypeID(), and setId().

{
global $ilDB, $ilUser;
$obj_id = ($this->getObjId() <= 0) ? (ilObject::_lookupObjId((strlen($_GET["ref_id"])) ? $_GET["ref_id"] : $_POST["sel_qpl"])) : $this->getObjId();
if ($obj_id > 0)
{
$next_id = $ilDB->nextId('svy_question');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_question (question_id, questiontype_fi, " .
"obj_fi, owner_fi, title, description, author, questiontext, obligatory, complete, " .
"created, original_id, tstamp) VALUES " .
"(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
array('integer', 'integer', 'integer', 'integer', 'text', 'text', 'text', 'text',
'text', 'text', 'integer', 'integer', 'integer'),
array(
$next_id,
$this->getOwner(),
NULL,
NULL,
$this->getAuthor(),
NULL,
"1",
"0",
time(),
NULL,
0
)
);
$this->setId($next_id);
}
return $this->getId();
}

+ Here is the call graph for this function:

SurveyQuestion::delete (   $question_id)

Deletes a question and all materials from the database.

Parameters
integer$question_idThe database id of the question private

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

References $ilDB, $mobs, $obj_id, $result, $row, ilInternalLink\_deleteAllLinksOfSource(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilUtil\delDir(), and deleteAdditionalTableData().

{
global $ilDB;
if ($question_id < 1) return;
$result = $ilDB->queryF("SELECT obj_fi FROM svy_question WHERE question_id = %s",
array('integer'),
array($question_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
$obj_id = $row["obj_fi"];
}
else
{
return;
}
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_answer WHERE question_fi = %s",
array('integer'),
array($question_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_constraint WHERE question_fi = %s",
array('integer'),
array($question_id)
);
$result = $ilDB->queryF("SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s",
array('integer'),
array($question_id)
);
while ($row = $ilDB->fetchObject($result))
{
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_constraint WHERE constraint_id = %s",
array('integer'),
array($row->constraint_fi)
);
}
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qst_constraint WHERE question_fi = %s",
array('integer'),
array($question_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qblk_qst WHERE question_fi = %s",
array('integer'),
array($question_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qst_oblig WHERE question_fi = %s",
array('integer'),
array($question_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_svy_qst WHERE question_fi = %s",
array('integer'),
array($question_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_variable WHERE question_fi = %s",
array('integer'),
array($question_id)
);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_question WHERE question_id = %s",
array('integer'),
array($question_id)
);
$this->deleteAdditionalTableData($question_id);
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_material WHERE question_fi = %s",
array('integer'),
array($question_id)
);
include_once "./Services/COPage/classes/class.ilInternalLink.php";
$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))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::delDir($directory);
}
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mobs = ilObjMediaObject::_getMobsOfObject("spl:html", $question_id);
// remaining usages are not in text anymore -> delete them
// and media objects (note: delete method of ilObjMediaObject
// checks whether object is used in another context; if yes,
// the object is not deleted!)
foreach($mobs as $mob)
{
ilObjMediaObject::_removeUsage($mob, "spl:html", $question_id);
$mob_obj =& new ilObjMediaObject($mob);
$mob_obj->delete();
}
}

+ Here is the call graph for this function:

SurveyQuestion::deleteAdditionalTableData (   $question_id)

Deletes datasets from the additional question table in the database.

Parameters
integer$question_idThe question id which should be deleted in the additional question table public

Reimplemented in SurveyMatrixQuestion.

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

References $ilDB.

Referenced by delete().

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
array('integer'),
array($question_id)
);
}

+ Here is the caller graph for this function:

SurveyQuestion::deleteMaterial (   $materials_name = "")

Deletes a materials uri with a given name.

Parameters
string$indexA materials_name of the materials uri public
See Also
$materials

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

References $key, and 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::deleteMaterials (   $a_array)

Deletes materials.

Parameters
array$a_arrayArray with indexes of the materials to delete

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

References saveMaterial().

{
foreach ($a_array as $idx)
{
unset($this->material[$idx]);
}
$this->material = array_values($this->material);
$this->saveMaterial();
}

+ Here is the call graph for this function:

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

Duplicates a survey question.

public

Definition at line 609 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);
// copy XHTML media objects
$clone->copyXHTMLMediaObjectsOfQuestion($original_id);
return $clone->getId();
}

+ Here is the call graph for this function:

SurveyQuestion::duplicateMaterials (   $question_id)

Duplicates the materials of a question.

Parameters
integer$question_idThe database id of the original survey question public

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

References $filename, 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))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
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.

public

See Also
$materials

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

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

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 552 of file class.SurveyQuestion.php.

Referenced by createNewQuestion(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), SurveyMatrixQuestion\isComplete(), and saveToDb().

{
return (strlen($this->author)) ? $this->author : NULL;
}

+ Here is the caller graph for this function:

SurveyQuestion::getAvailableRelations ( )

Returns the available relations for the question.

Returns
array An array containing the available relations public

Reimplemented in SurveyMetricQuestion, SurveySingleChoiceQuestion, and SurveyMultipleChoiceQuestion.

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

{
// overwrite in inherited classes
return array();
}
SurveyQuestion::getCumulatedResultData (   $survey_id,
  $counter 
)

Creates a the cumulated results data for the question.

Returns
array Data

Reimplemented in SurveyMatrixQuestion.

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

References $cumulated, $questiontext, $result, $survey_id, calculateCumulatedResults(), getQuestiontext(), and getTitle().

{
$questiontext = preg_replace("/<[^>]+?>/ims", "", $this->getQuestiontext());
$maxlen = 37;
include_once "./Services/Utilities/classes/class.ilStr.php";
if (ilStr::strlen($questiontext) > $maxlen + 3)
{
$questiontext = ilStr::substr($questiontext, 0, $maxlen) . "...";
}
$result = array(
'counter' => $counter,
'title' => $this->getTitle(),
'question' => $questiontext,
'users_answered' => $cumulated['USERS_ANSWERED'],
'users_skipped' => $cumulated['USERS_SKIPPED'],
'question_type' => $this->lng->txt($cumulated["QUESTION_TYPE"]),
'mode' => $cumulated["MODE"],
'mode_nr_of_selections' => $cumulated["MODE_NR_OF_SELECTIONS"],
'median' => $cumulated["MEDIAN"],
'arithmetic_mean' => $cumulated["ARITHMETIC_MEAN"]
);
return $result;
}

+ Here is the call graph for this function:

SurveyQuestion::getDescription ( )

Gets the description string of the SurveyQuestion object.

Returns
string The description string to describe the question public
See Also
$description

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

Referenced by SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), and saveToDb().

{
return (strlen($this->description)) ? $this->description : NULL;
}

+ Here is the caller graph for this function:

SurveyQuestion::getId ( )

Gets the id of the SurveyQuestion object.

Returns
integer The id of the SurveyQuestion object public
See Also
$id

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

References $id.

Referenced by addMaterialTag(), SurveyTextQuestion\addUserSpecificResultsData(), SurveyMultipleChoiceQuestion\addUserSpecificResultsData(), SurveySingleChoiceQuestion\addUserSpecificResultsData(), SurveyMetricQuestion\addUserSpecificResultsData(), SurveyMatrixQuestion\addUserSpecificResultsData(), SurveyTextQuestion\checkUserInput(), SurveyMultipleChoiceQuestion\checkUserInput(), SurveySingleChoiceQuestion\checkUserInput(), SurveyMetricQuestion\checkUserInput(), SurveyMatrixQuestion\checkUserInput(), copyObject(), copyXHTMLMediaObjectsOfQuestion(), createNewQuestion(), duplicate(), SurveyTextQuestion\getCumulatedResults(), SurveyMultipleChoiceQuestion\getCumulatedResults(), SurveySingleChoiceQuestion\getCumulatedResults(), SurveyMetricQuestion\getCumulatedResults(), SurveyMatrixQuestion\getCumulatedResults(), SurveyMatrixQuestion\getCumulatedResultsForRow(), SurveyMatrixQuestion\getNrOfUsersAnswered(), getObligatory(), SurveyTextQuestion\getUserAnswers(), SurveyMultipleChoiceQuestion\getUserAnswers(), SurveySingleChoiceQuestion\getUserAnswers(), SurveyMetricQuestion\getUserAnswers(), SurveyMatrixQuestion\getUserAnswers(), SurveyTextQuestion\getWorkingDataFromUserInput(), SurveyMultipleChoiceQuestion\getWorkingDataFromUserInput(), SurveySingleChoiceQuestion\getWorkingDataFromUserInput(), SurveyMetricQuestion\getWorkingDataFromUserInput(), SurveyMatrixQuestion\getWorkingDataFromUserInput(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), loadFromDb(), SurveyMatrixQuestion\saveBipolarAdjectives(), SurveyMultipleChoiceQuestion\saveCategoriesToDb(), SurveySingleChoiceQuestion\saveCategoriesToDb(), SurveyMatrixQuestion\saveColumnsToDb(), saveCompletionStatus(), SurveyMatrixQuestion\saveLayout(), saveMaterial(), SurveyMultipleChoiceQuestion\saveRandomData(), SurveyTextQuestion\saveRandomData(), SurveySingleChoiceQuestion\saveRandomData(), SurveyMetricQuestion\saveRandomData(), SurveyMatrixQuestion\saveRandomData(), SurveyMatrixQuestion\saveRowsToDb(), SurveyMultipleChoiceQuestion\saveToDb(), SurveyTextQuestion\saveToDb(), SurveySingleChoiceQuestion\saveToDb(), SurveyMetricQuestion\saveToDb(), SurveyMatrixQuestion\saveToDb(), saveToDb(), SurveyMultipleChoiceQuestion\saveUserInput(), SurveyTextQuestion\saveUserInput(), SurveySingleChoiceQuestion\saveUserInput(), SurveyMetricQuestion\saveUserInput(), SurveyMatrixQuestion\saveUserInput(), and syncWithOriginal().

{
return $this->id;
}

+ Here is the caller graph for this function:

SurveyQuestion::getImagePath ( )

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 921 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.

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 943 of file class.SurveyQuestion.php.

References ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/survey/$this->obj_id/$this->id/images/";
}

+ Here is the call graph for this function:

SurveyQuestion::getMaterial ( )

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

References $material.

{
}
SurveyQuestion::getMaterialsPath ( )

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 932 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.

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 956 of file class.SurveyQuestion.php.

References ILIAS_ABSOLUTE_PATH, and ilUtil\removeTrailingPathSeparators().

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/survey/$this->obj_id/$this->id/materials/";
}

+ Here is the call graph for this function:

SurveyQuestion::getObjId ( )

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 588 of file class.SurveyQuestion.php.

References $obj_id.

Referenced by copyObject(), createNewQuestion(), and saveToDb().

{
return $this->obj_id;
}

+ Here is the caller graph for this function:

SurveyQuestion::getObligatory (   $survey_id = "")

Gets the obligatory state of the question.

Returns
integer 1, if the question is obligatory, otherwise 0
See Also
$obligatory

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

References $ilDB, $result, $row, $survey_id, and getId().

Referenced by SurveyTextQuestion\checkUserInput(), SurveyMultipleChoiceQuestion\checkUserInput(), SurveySingleChoiceQuestion\checkUserInput(), SurveyMetricQuestion\checkUserInput(), SurveyMatrixQuestion\checkUserInput(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), and saveToDb().

{
if ($survey_id > 0)
{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_qst_oblig WHERE survey_fi = %s AND question_fi = %s",
array('integer', 'integer'),
array($survey_id, $this->getId())
);
if ($result->numRows())
{
$row = $ilDB->fetchAssoc($result);
return ($row["obligatory"]) ? 1 : 0;
}
else
{
return ($this->obligatory) ? 1 : 0;
}
}
else
{
return ($this->obligatory) ? 1 : 0;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::getOrientation ( )

Gets the orientation of the question output.

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

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

References $orientation.

Referenced by SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMultipleChoiceQuestion\saveToDb(), and SurveySingleChoiceQuestion\saveToDb().

{
switch ($this->orientation)
{
case 0:
case 1:
case 2:
break;
default:
$this->orientation = 0;
break;
}
}

+ Here is the caller graph for this function:

SurveyQuestion::getOriginalId ( )

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

Referenced by SurveyMatrixQuestion\syncWithOriginal(), and syncWithOriginal().

{
return $this->original_id;
}

+ Here is the caller graph for this function:

SurveyQuestion::getOwner ( )

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 564 of file class.SurveyQuestion.php.

References $owner.

Referenced by createNewQuestion(), and saveToDb().

{
return $this->owner;
}

+ Here is the caller graph for this function:

SurveyQuestion::getPhrase (   $phrase_id)

Returns a phrase for a given database id.

Returns
String The title of the phrase public

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

References $ilDB, $result, and $row.

{
global $ilDB;
$result = $ilDB->queryF("SELECT title FROM svy_phrase WHERE phrase_id = %s",
array('integer'),
array($phrase_id)
);
if ($row = $ilDB->fetchAssoc($result))
{
return $row["title"];
}
return "";
}
SurveyQuestion::getPreconditionSelectValue (   $default = "")

Creates a value selection for preconditions.

Returns
The HTML code for the precondition value selection public

Reimplemented in SurveyMetricQuestion, SurveySingleChoiceQuestion, and SurveyMultipleChoiceQuestion.

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

{
// overwrite in inherited classes
}
SurveyQuestion::getPreconditionValueOutput (   $value)

Returns the output for a precondition value.

Parameters
string$valueThe precondition value
Returns
string The output of the precondition value public

Reimplemented in SurveyMatrixQuestion, SurveySingleChoiceQuestion, and SurveyMultipleChoiceQuestion.

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

{
// overwrite in inherited classes
return $value;
}
SurveyQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

Referenced by getQuestionTypeID().

{
return "";
}

+ Here is the caller graph for this function:

SurveyQuestion::getQuestionTypeID ( )

Returns the question type ID of the question.

Returns
integer The question type of the question public

Reimplemented in SurveyMetricQuestion.

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

References $ilDB, $result, $row, and getQuestionType().

Referenced by createNewQuestion(), and saveToDb().

{
global $ilDB;
$result = $ilDB->queryF("SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
array('text'),
array($this->getQuestionType())
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return $row["questiontype_id"];
}
else
{
return 0;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::getSubtype ( )

Reimplemented in SurveyMatrixQuestion, and SurveyMetricQuestion.

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

{
// do nothing
return null;
}
SurveyQuestion::getSurveyId ( )

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 505 of file class.SurveyQuestion.php.

References $survey_id.

{
}
& SurveyQuestion::getUserAnswers (   $survey_id)

Returns an array containing all answers to this question in a given survey.

Parameters
integer$survey_idThe database ID of the survey
Returns
array An array containing the answers to the question. The keys are either the user id or the anonymous id public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

{
// overwrite in inherited classes
return array();
}
& SurveyQuestion::getWorkingDataFromUserInput (   $post_data)

Creates the user data of the svy_answer table from the POST data.

Returns
array User data according to the svy_answer table public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

References $data.

{
// overwrite in inherited classes
$data = array();
return $data;
}
SurveyQuestion::importAdditionalMetadata (   $a_meta)

Import additional meta data from the question import file.

Usually the meta data section is used to store question elements which are not part of the standard XML schema.

Returns
array $a_meta Array containing the additional meta data public

Reimplemented in SurveyMatrixQuestion, SurveyMultipleChoiceQuestion, and SurveySingleChoiceQuestion.

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

{
// overwrite in inherited classes
}
SurveyQuestion::importAdjectives (   $a_data)

Import bipolar adjectives from the question import file.

Returns
array $a_data Array containing the adjectives public

Reimplemented in SurveyMatrixQuestion.

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

{
// overwrite in inherited classes
}
SurveyQuestion::importMatrix (   $a_data)

Import matrix rows from the question import file.

Returns
array $a_data Array containing the matrix rows public

Reimplemented in SurveyMatrixQuestion.

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

{
// overwrite in inherited classes
}
SurveyQuestion::importResponses (   $a_data)

Import response data from the question import file.

Returns
array $a_data Array containing the response data public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

{
// overwrite in inherited classes
}
SurveyQuestion::isComplete ( )

Returns 1, if a question is complete for use.

Returns
integer 1, if the question is complete for use, otherwise 0 public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

Referenced by saveCompletionStatus(), and saveToDb().

{
return 0;
}

+ Here is the caller graph for this function:

SurveyQuestion::isHTML (   $a_text)

Checks if a given string contains HTML or not.

Parameters
string$a_textText which should be checked
Returns
boolean public

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

Referenced by addMaterialTag().

{
if (preg_match("/<[^>]*?>/", $a_text))
{
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the caller graph for this function:

SurveyQuestion::loadFromDb (   $question_id)

Loads a SurveyQuestion object from the database.

Parameters
integer$question_idA unique key which defines the question in the database public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

References $ilDB, $result, $row, and getId().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_material WHERE question_fi = %s",
array('integer'),
array($this->getId())
);
$this->material = array();
if ($result->numRows())
{
include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
while ($row = $ilDB->fetchAssoc($result))
{
$mat = new ilSurveyMaterial();
$mat->type = $row['material_type'];
$mat->internal_link = $row['internal_link'];
$mat->title = $row['material_title'];
$mat->import_id = $row['import_id'];
$mat->text_material = $row['text_material'];
$mat->external_link = $row['external_link'];
$mat->file_material = $row['file_material'];
array_push($this->material, $mat);
}
}
}

+ Here is the call graph for this function:

SurveyQuestion::outChart (   $survey_id,
  $type = "" 
)

Creates an image visualising the results of the question.

Parameters
integer$survey_idThe database ID of the survey
string$typeAn additional parameter to allow to draw more than one chart per question. Must be interpreted by the question. Default is an empty string
Returns
binary Image with the visualisation private

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, and SurveyMultipleChoiceQuestion.

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

{
// overwrite in inherited classes
}
SurveyQuestion::phraseExists (   $title)

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

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

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

References $ilDB, $result, and $title.

{
global $ilUser, $ilDB;
$result = $ilDB->queryF("SELECT phrase_id FROM svy_phrase WHERE title = %s AND owner_fi = %s",
array('text', 'integer'),
array($title, $ilUser->getId())
);
return ($result->numRows() == 0) ? false : true;
}
SurveyQuestion::prepareTextareaOutput (   $txt_output,
  $prepare_for_latex_output = FALSE 
)

Prepares a string for a text area output in surveys.

Parameters
string$txt_outputString which should be prepared for output public

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

{
include_once "./Services/Utilities/classes/class.ilUtil.php";
return ilUtil::prepareTextareaOutput($txt_output, $prepare_for_latex_output);
}
SurveyQuestion::QTIMaterialToString (   $a_material)

Reads an QTI material tag an creates a text string.

Parameters
string$a_materialQTI material tag
Returns
string text or xhtml string public

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

References $_SESSION, $material, and $result.

{
$result = "";
for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
{
$material = $a_material->getMaterial($i);
if (strcmp($material["type"], "mattext") == 0)
{
$result .= $material["material"]->getContent();
}
if (strcmp($material["type"], "matimage") == 0)
{
$matimage = $material["material"];
if (preg_match("/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
{
// import an mediaobject which was inserted using tiny mce
if (!is_array($_SESSION["import_mob_xhtml"])) $_SESSION["import_mob_xhtml"] = array();
array_push($_SESSION["import_mob_xhtml"], array("mob" => $matimage->getLabel(), "uri" => $matimage->getUri()));
}
}
}
return $result;
}
SurveyQuestion::questionTitleExists (   $title,
  $questionpool_object = "" 
)

Returns TRUE if the question title exists in the database.

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

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

References $ilDB, $result, and $title.

{
global $ilDB;
$refwhere = "";
if (strcmp($questionpool_object, "") != 0)
{
$refwhere = sprintf(" AND obj_fi = %s",
$ilDB->quote($questionpool_object, 'integer')
);
}
$result = $ilDB->queryF("SELECT question_id FROM svy_question WHERE title = %s$refwhere",
array('text'),
array($title)
);
return ($result->numRows() > 0) ? true : false;
}
SurveyQuestion::saveCategoryToDb (   $categorytext,
  $neutral = 0 
)

Saves a category to the database.

Parameters
string$categorytextThe description of the category
Returns
integer The database id of the category public
See Also
$categories

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

References $ilDB, $result, and $row.

Referenced by SurveyMultipleChoiceQuestion\saveCategoriesToDb(), and SurveySingleChoiceQuestion\saveCategoriesToDb().

{
global $ilUser, $ilDB;
$result = $ilDB->queryF("SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
array('text','text','integer'),
array($categorytext, $neutral, $ilUser->getId())
);
$insert = FALSE;
$returnvalue = "";
if ($result->numRows())
{
$insert = TRUE;
while ($row = $ilDB->fetchAssoc($result))
{
if (strcmp($row["title"], $categorytext) == 0)
{
$returnvalue = $row["category_id"];
$insert = FALSE;
}
}
}
else
{
$insert = TRUE;
}
if ($insert)
{
$next_id = $ilDB->nextId('svy_category');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_category (category_id, title, neutral, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
array('integer','text','text','integer','integer'),
array($next_id, $categorytext, $neutral, $ilUser->getId(), time())
);
$returnvalue = $next_id;
}
return $returnvalue;
}

+ Here is the caller graph for this function:

SurveyQuestion::saveCompletionStatus (   $original_id = "")

Saves the complete flag to the database.

public

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

References $ilDB, getId(), and isComplete().

Referenced by SurveyMultipleChoiceQuestion\saveCategoriesToDb(), SurveySingleChoiceQuestion\saveCategoriesToDb(), SurveyMatrixQuestion\saveColumnsToDb(), and SurveyMatrixQuestion\saveRowsToDb().

{
global $ilDB;
$question_id = $this->getId();
if (strlen($original_id))
{
$question_id = $original_id;
}
if ($this->getId() > 0)
{
// update existing dataset
$affectedRows = $ilDB->manipulateF("UPDATE svy_question SET complete = %s, tstamp = %s WHERE question_id = %s",
array('text', 'integer', 'integer'),
array($this->isComplete(), time(), $question_id)
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::saveMaterial ( )

save material to db

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

References $ilDB, $material, ilInternalLink\_deleteAllLinksOfSource(), ilInternalLink\_saveLink(), and getId().

Referenced by addInternalLink(), deleteMaterials(), SurveyMultipleChoiceQuestion\saveToDb(), SurveyTextQuestion\saveToDb(), SurveySingleChoiceQuestion\saveToDb(), SurveyMetricQuestion\saveToDb(), SurveyMatrixQuestion\saveToDb(), and setMaterial().

{
global $ilDB;
include_once "./Services/COPage/classes/class.ilInternalLink.php";
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_material WHERE question_fi = %s",
array('integer'),
array($this->getId())
);
foreach ($this->material as $material)
{
$next_id = $ilDB->nextId('svy_material');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_material " .
"(material_id, question_fi, internal_link, import_id, material_title, tstamp," .
"text_material, external_link, file_material, material_type) ".
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
array('integer','integer','text','text','text','integer','text','text','text','integer'),
array(
$next_id, $this->getId(), $material->internal_link, $material->import_id,
$material->title, time(), $material->text_material, $material->external_link,
$material->file_material, $material->type)
);
if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $material->internal_link, $matches))
{
ilInternalLink::_saveLink("sqst", $this->getId(), $matches[2], $matches[3], $matches[1]);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::saveRandomData (   $active_id)

Saves random answers for a given active user in the database.

Parameters
integer$active_idThe database ID of the active user

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyTextQuestion, and SurveyMultipleChoiceQuestion.

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

{
// do nothing, overwrite in parent classes
}
SurveyQuestion::saveToDb (   $original_id = "")

Saves a SurveyQuestion object to a database.

Parameters
integer$original_idpublic

Reimplemented in SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyTextQuestion, and SurveyMultipleChoiceQuestion.

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

References $ilDB, ilRTE\_cleanupMediaObjectUsage(), ilRTE\_replaceMediaObjectImageSrc(), getAuthor(), getDescription(), getId(), getObjId(), getObligatory(), getOwner(), getQuestiontext(), getQuestionTypeID(), getTitle(), isComplete(), and setId().

Referenced by syncWithOriginal().

{
global $ilDB;
// cleanup RTE images which are not inserted into the question text
include_once("./Services/RTE/classes/class.ilRTE.php");
ilRTE::_cleanupMediaObjectUsage($this->getQuestiontext(), "spl:html", $this->getId());
$affectedRows = 0;
if ($this->getId() == -1)
{
// Write new dataset
$next_id = $ilDB->nextId('svy_question');
$affectedRows = $ilDB->insert("svy_question", array(
"question_id" => array("integer", $next_id),
"questiontype_fi" => array("integer", $this->getQuestionTypeID()),
"obj_fi" => array("integer", $this->getObjId()),
"owner_fi" => array("integer", $this->getOwner()),
"title" => array("text", $this->getTitle()),
"description" => array("text", $this->getDescription()),
"author" => array("text", $this->getAuthor()),
"questiontext" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestiontext(), 0)),
"obligatory" => array("text", $this->getObligatory()),
"complete" => array("text", $this->isComplete()),
"created" => array("integer", time()),
"original_id" => array("integer", ($original_id) ? $original_id : NULL),
"tstamp" => array("integer", time())
));
$this->setId($next_id);
}
else
{
// update existing dataset
$affectedRows = $ilDB->update("svy_question", array(
"title" => array("text", $this->getTitle()),
"description" => array("text", $this->getDescription()),
"author" => array("text", $this->getAuthor()),
"questiontext" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestiontext(), 0)),
"obligatory" => array("text", $this->getObligatory()),
"complete" => array("text", $this->isComplete()),
"tstamp" => array("integer", time())
), array(
"question_id" => array("integer", $this->getId())
));
}
return $affectedRows;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyQuestion::saveWorkingData (   $limit_to = LIMIT_NO_LIMIT)

Saves the learners input of the question to the database.

public

See Also
$answers

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

{
}
SurveyQuestion::setAuthor (   $author = "")

Sets the authors name of the SurveyQuestion object.

Parameters
string$authorA string containing the name of the questions author public
See Also
$author

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

References $author.

Referenced by SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), and SurveyMatrixQuestion\loadFromDb().

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

+ Here is the caller graph for this function:

SurveyQuestion::setComplete (   $a_complete)

Sets the complete state of the question.

Parameters
integer$a_complete1 if complete, 0 otherwise public

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

Referenced by SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), and SurveyMatrixQuestion\loadFromDb().

{
$this->complete = ($a_complete) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyQuestion::setDescription (   $description = "")

Sets the description string of the SurveyQuestion object.

Parameters
string$descriptionA description string to describe the question public
See Also
$description

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

References $description.

Referenced by SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), and SurveyMatrixQuestion\loadFromDb().

{
$this->description = $description;
}

+ Here is the caller graph for this function:

& SurveyQuestion::setExportCumulatedCVS ( $eval_data)

Creates the CSV output for the cumulated results of this question.

Parameters
object$worksheetReference to the excel worksheet
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data
integer$rowActual row in the worksheet
Returns
integer The next row which should be used for the export public

Reimplemented in SurveyMatrixQuestion.

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

References $result, getQuestiontext(), and getTitle().

{
$csvrow = array();
array_push($csvrow, $this->getTitle());
array_push($csvrow, $this->getQuestiontext());
array_push($csvrow, $this->lng->txt($eval_data["QUESTION_TYPE"]));
array_push($csvrow, $eval_data["USERS_ANSWERED"]);
array_push($csvrow, $eval_data["USERS_SKIPPED"]);
array_push($csvrow, $eval_data["MODE"]);
array_push($csvrow, $eval_data["MODE_NR_OF_SELECTIONS"]);
array_push($csvrow, $eval_data["MEDIAN"]);
array_push($csvrow, $eval_data["ARITHMETIC_MEAN"]);
$result = array();
array_push($result, $csvrow);
return $result;
}

+ Here is the call graph for this function:

SurveyQuestion::setExportCumulatedXLS ( $worksheet,
$format_title,
$format_bold,
$eval_data,
  $row 
)

Creates the Excel output for the cumulated results of this question.

Parameters
object$worksheetReference to the excel worksheet
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data
integer$rowActual row in the worksheet
Returns
integer The next row which should be used for the export public

Reimplemented in SurveyMatrixQuestion.

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

References $row, ilExcelUtils\_convert_text(), getQuestiontext(), and getTitle().

{
include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
$worksheet->writeString($row, 0, ilExcelUtils::_convert_text($this->getTitle()));
$worksheet->writeString($row, 1, ilExcelUtils::_convert_text($this->getQuestiontext()));
$worksheet->writeString($row, 2, ilExcelUtils::_convert_text($this->lng->txt($eval_data["QUESTION_TYPE"])));
$worksheet->write($row, 3, $eval_data["USERS_ANSWERED"]);
$worksheet->write($row, 4, $eval_data["USERS_SKIPPED"]);
$worksheet->write($row, 5, ilExcelUtils::_convert_text($eval_data["MODE_VALUE"]));
$worksheet->write($row, 6, ilExcelUtils::_convert_text($eval_data["MODE"]));
$worksheet->write($row, 7, $eval_data["MODE_NR_OF_SELECTIONS"]);
$worksheet->write($row, 8, ilExcelUtils::_convert_text(str_replace("<br />", " ", $eval_data["MEDIAN"])));
$worksheet->write($row, 9, $eval_data["ARITHMETIC_MEAN"]);
return $row + 1;
}

+ Here is the call graph for this function:

SurveyQuestion::setExportDetailsXLS ( $workbook,
$format_title,
$format_bold,
$eval_data 
)

Creates an Excel worksheet for the detailed cumulated results of this question.

Parameters
object$workbookReference to the parent excel workbook
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

{
// overwrite in inherited classes
}
SurveyQuestion::setId (   $id = -1)

Sets the id of the SurveyQuestion object.

Parameters
integer$idA unique integer value public
See Also
$id

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

References $id.

Referenced by createNewQuestion(), SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), SurveyMatrixQuestion\loadFromDb(), saveToDb(), and syncWithOriginal().

{
$this->id = $id;
}

+ Here is the caller graph for this function:

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

Sets a material link for the question.

Parameters
string$material_idAn internal link pointing to the material
boolean$is_importA boolean indication that the internal link was imported from another ILIAS installation public

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

References $target_id, $type, ilGlossaryTerm\_lookGlossaryTerm(), ilLMObject\_lookupContObjID(), _resolveInternalLink(), and saveMaterial().

{
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":
include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
$cont_obj_gui =& new ilObjContentObjectGUI("", $target_id, true);
$cont_obj = $cont_obj_gui->object;
$material_title .= $cont_obj->getTitle();
break;
case "pg":
include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
$cont_obj_gui =& new ilObjContentObjectGUI("", $lm_id, FALSE);
$cont_obj = $cont_obj_gui->object;
$pg_obj =& new ilLMPageObject($cont_obj, $target_id);
$material_title .= $pg_obj->getTitle();
break;
case "st":
include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
$cont_obj_gui =& new ilObjContentObjectGUI("", $lm_id, FALSE);
$cont_obj = $cont_obj_gui->object;
$st_obj =& new ilStructureObject($cont_obj, $target_id);
$material_title .= $st_obj->getTitle();
break;
case "git":
include_once "./Modules/Glossary/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
);
}
$this->saveMaterial();
}

+ Here is the call graph for this function:

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

Sets and uploads the materials uri.

Parameters
string | string | string$materials_filename,$materials_tempfilename,$materialspublic
See Also
$materials

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

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

{
if (!empty($materials_filename))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
$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.

Parameters
integer$obj_idThe reference id of the container object public
See Also
$obj_id

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

References $obj_id.

Referenced by SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), and SurveyMatrixQuestion\loadFromDb().

{
$this->obj_id = $obj_id;
}

+ Here is the caller graph for this function:

SurveyQuestion::setObligatory (   $obligatory = 1)

Sets the obligatory state of the question.

Parameters
integer$obligatory1, if the question is obligatory, otherwise 0 public
See Also
$obligatory

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

References $obligatory.

Referenced by SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), and SurveyMatrixQuestion\loadFromDb().

{
$this->obligatory = ($obligatory) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyQuestion::setOrientation (   $orientation = 0)

Sets the orientation of the question output.

Parameters
integer$orientation0 = vertical, 1 = horizontal public
See Also
$orientation

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

References $orientation.

Referenced by SurveySingleChoiceQuestion\importAdditionalMetadata(), SurveyMultipleChoiceQuestion\importAdditionalMetadata(), SurveyMultipleChoiceQuestion\loadFromDb(), and SurveySingleChoiceQuestion\loadFromDb().

{
$this->orientation = ($orientation) ? $orientation : 0;
}

+ Here is the caller graph for this function:

SurveyQuestion::setOriginalId (   $original_id)
SurveyQuestion::setOwner (   $owner = "")

Sets the creator/owner ID of the SurveyQuestion object.

Parameters
integer$ownerA numerical ID to identify the owner/creator public
See Also
$owner

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

References $owner.

Referenced by SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), and SurveyMatrixQuestion\loadFromDb().

{
$this->owner = $owner;
}

+ Here is the caller graph for this function:

SurveyQuestion::setQuestiontext (   $questiontext = "")

Sets the questiontext of the SurveyQuestion object.

Parameters
string$questiontextA string containing the questiontext public
See Also
$questiontext

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

References $questiontext.

Referenced by SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), and SurveyMatrixQuestion\loadFromDb().

{
$this->questiontext = $questiontext;
}

+ Here is the caller graph for this function:

SurveyQuestion::setSubtype (   $a_subtype)

Reimplemented in SurveyMatrixQuestion, and SurveyMetricQuestion.

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

{
// do nothing
}
SurveyQuestion::setSurveyId (   $id = -1)

Sets the survey id of the SurveyQuestion object.

Parameters
integer$idA unique integer value public
See Also
$survey_id

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

References $id.

{
$this->survey_id = $id;
}
SurveyQuestion::setTitle (   $title = "")

Sets the title string of the SurveyQuestion object.

Parameters
string$titleA title string to describe the question public
See Also
$title

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

References $title.

Referenced by SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), SurveyMetricQuestion\loadFromDb(), and SurveyMatrixQuestion\loadFromDb().

{
$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$titleA title string to describe the question
string$descriptionA description string to describe the question
string$authorA string containing the name of the questions author
integer$ownerA numerical ID to identify the owner/creator public

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

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

Referenced by SurveyMatrixQuestion\SurveyMatrixQuestion(), SurveyMetricQuestion\SurveyMetricQuestion(), SurveyMultipleChoiceQuestion\SurveyMultipleChoiceQuestion(), SurveySingleChoiceQuestion\SurveySingleChoiceQuestion(), and SurveyTextQuestion\SurveyTextQuestion().

{
global $ilias;
global $lng;
global $tpl;
$this->ilias =& $ilias;
$this->lng =& $lng;
$this->tpl =& $tpl;
$this->complete =
$this->title = $title;
$this->description = $description;
$this->questiontext = $questiontext;
$this->author = $author;
$this->cumulated = array();
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 SurveyMatrixQuestion.

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

References $id, $ilDB, ilInternalLink\_deleteAllLinksOfSource(), ilInternalLink\_saveLink(), getId(), getOriginalId(), saveToDb(), setId(), and setOriginalId().

{
global $ilDB;
if ($this->getOriginalId())
{
$id = $this->getId();
$original = $this->getOriginalId();
$this->setId($this->getOriginalId());
$this->setOriginalId(NULL);
$this->saveToDb();
$this->setId($id);
$this->setOriginalId($original);
include_once "./Services/COPage/classes/class.ilInternalLink.php";
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_material WHERE question_fi = %s",
array('integer'),
array($this->getOriginalId())
);
ilInternalLink::_deleteAllLinksOfSource("sqst", $this->original_id);
if (strlen($this->material["internal_link"]))
{
$next_id = $ilDB->nextId('svy_material');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_material (material_id, question_fi, internal_link, import_id, material_title, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
array('integer', 'integer', 'text', 'text', 'text', 'integer'),
array($next_id, $this->getOriginalId(), $this->material["internal_link"], $this->material["import_id"], $this->material["title"], time())
);
if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $this->material["internal_link"], $matches))
{
ilInternalLink::_saveLink("sqst", $this->getOriginalId(), $matches[2], $matches[3], $matches[1]);
}
}
}
}

+ Here is the call graph for this function:

SurveyQuestion::usableForPrecondition ( )

Returns if the question is usable for preconditions.

Returns
boolean TRUE if the question is usable for a precondition, FALSE otherwise public

Reimplemented in SurveyMatrixQuestion, SurveyMetricQuestion, SurveySingleChoiceQuestion, SurveyMultipleChoiceQuestion, and SurveyTextQuestion.

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

{
// overwrite in inherited classes
return FALSE;
}

Field Documentation

SurveyQuestion::$complete

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

SurveyQuestion::$ilias

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

Referenced by SurveyQuestion().

SurveyQuestion::$materials

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

SurveyQuestion::$obj_id

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

Referenced by createNewQuestion(), delete(), getObjId(), and setObjId().

SurveyQuestion::$obligatory

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

Referenced by setObligatory().

SurveyQuestion::$tpl

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

Referenced by SurveyQuestion().


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