ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
SurveyMetricQuestion Class Reference

Metric survey question. More...

+ Inheritance diagram for SurveyMetricQuestion:
+ Collaboration diagram for SurveyMetricQuestion:

Public Member Functions

 SurveyMetricQuestion ( $title="", $description="", $author="", $questiontext="", $owner=-1, $subtype=self::SUBTYPE_NON_RATIO)
 SurveyMetricQuestion constructor. More...
 
 setSubtype ($subtype=self::SUBTYPE_NON_RATIO)
 Sets the question subtype. More...
 
 setMinimum ($minimum=0)
 Sets the minimum value. More...
 
 setMaximum ($maximum="")
 Sets the maximum value. More...
 
 getSubtype ()
 Gets the question subtype. More...
 
 getMinimum ()
 Returns the minimum value of the question. More...
 
 getMaximum ()
 Returns the maximum value of the question. More...
 
 _getQuestionDataArray ($id)
 Returns the question data fields from the database. More...
 
 loadFromDb ($id)
 Loads a SurveyMetricQuestion object from the database. More...
 
 isComplete ()
 Returns true if the question is complete for use. More...
 
 saveToDb ($original_id="")
 Saves a SurveyMetricQuestion object to a database. More...
 
 toXML ($a_include_header=TRUE, $obligatory_state="")
 Returns an xml representation of the question. More...
 
 insertXML (&$a_xml_writer, $a_include_header=TRUE, $obligatory_state="")
 Adds the question XML to a given XMLWriter object. More...
 
 getQuestionTypeID ()
 Returns the question type ID of the question. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
getWorkingDataFromUserInput ($post_data)
 Creates the user data of the svy_answer table from the POST data. More...
 
 checkUserInput ($post_data, $survey_id)
 Checks the input of the active user for obligatory status and entered values. More...
 
 saveRandomData ($active_id)
 Saves random answers for a given active user in the database. More...
 
 saveUserInput ($post_data, $active_id, $a_return=false)
 
getCumulatedResults ($survey_id, $nr_of_users, $finished_ids)
 
 setExportDetailsXLS (&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 addUserSpecificResultsData (&$a_array, &$resultset)
 Adds the values for the user specific results export for a given user. More...
 
getUserAnswers ($survey_id, $finished_ids)
 Returns an array containing all answers to this question in a given survey. More...
 
 importResponses ($a_data)
 Import response data from the question import file. More...
 
 usableForPrecondition ()
 Returns if the question is usable for preconditions. More...
 
 getAvailableRelations ()
 Returns the available relations for the question. More...
 
 outPreconditionSelectValue (&$template)
 Creates a value selection for preconditions. More...
 
 getPreconditionSelectValue ($default="", $title, $variable)
 Creates a form property for the precondition value. More...
 
 getMinMaxText ()
 Creates a text for the input range of the metric question. More...
 
- Public Member Functions inherited from SurveyQuestion
 SurveyQuestion ( $title="", $description="", $author="", $questiontext="", $owner=-1)
 SurveyQuestion constructor The constructor takes possible arguments an creates an instance of the SurveyQuestion object. More...
 
 _SurveyQuestion ()
 
 setComplete ($a_complete)
 Sets the complete state of the question. More...
 
 isComplete ()
 Returns 1, if a question is complete for use. More...
 
 questionTitleExists ($title, $questionpool_object="")
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the SurveyQuestion object. More...
 
 setObligatory ($obligatory=1)
 Sets the obligatory state of the question. More...
 
 setOrientation ($orientation=0)
 Sets the orientation of the question output. More...
 
 setId ($id=-1)
 Sets the id of the SurveyQuestion object. More...
 
 setSurveyId ($id=-1)
 Sets the survey id of the SurveyQuestion object. More...
 
 setDescription ($description="")
 Sets the description string of the SurveyQuestion object. More...
 
 addMaterials ($materials_file, $materials_name="")
 Sets the materials uri. More...
 
 setMaterialsfile ($materials_filename, $materials_tempfilename="", $materials_name="")
 Sets and uploads the materials uri. More...
 
 deleteMaterial ($materials_name="")
 Deletes a materials uri with a given name. More...
 
 flushMaterials ()
 Deletes all materials uris. More...
 
 setAuthor ($author="")
 Sets the authors name of the SurveyQuestion object. More...
 
 setQuestiontext ($questiontext="")
 Sets the questiontext of the SurveyQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the SurveyQuestion object. More...
 
 getTitle ()
 Gets the title string of the SurveyQuestion object. More...
 
 getLabel ()
 
 getId ()
 Gets the id of the SurveyQuestion object. More...
 
 getObligatory ($survey_id="")
 Gets the obligatory state of the question. More...
 
 getSurveyId ()
 Gets the survey id of the SurveyQuestion object. More...
 
 getOrientation ()
 Gets the orientation of the question output. More...
 
 getDescription ()
 Gets the description string of the SurveyQuestion object. More...
 
 getAuthor ()
 Gets the authors name of the SurveyQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the SurveyQuestion object. More...
 
 getQuestiontext ()
 Gets the questiontext of the SurveyQuestion object. More...
 
 getObjId ()
 Get the reference id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the reference id of the container object. More...
 
 duplicate ($for_survey=true, $title="", $author="", $owner="")
 Duplicates a survey question. More...
 
 copyObject ($target_questionpool, $title="")
 Copies an assOrderingQuestion object. More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 Increases the media object usage counter when a question is duplicated. More...
 
 loadFromDb ($question_id)
 Loads a SurveyQuestion object from the database. More...
 
 _isComplete ($question_id)
 Checks whether the question is complete or not. More...
 
 saveCompletionStatus ($original_id="")
 Saves the complete flag to the database. More...
 
 saveToDb ($original_id="")
 Saves a SurveyQuestion object to a database. More...
 
 saveMaterial ()
 save material to db More...
 
 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. More...
 
 saveWorkingData ($limit_to=LIMIT_NO_LIMIT)
 Saves the learners input of the question to the database. More...
 
 getImagePath ()
 Returns the image path for web accessable images of a question. More...
 
 getMaterialsPath ()
 Returns the materials path for web accessable materials of a question. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getMaterialsPathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 saveCategoryToDb ($categorytext, $neutral=0)
 Saves a category to the database. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
 _getTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
 _getOriginalId ($question_id, $a_return_question_id_if_no_original=true)
 Returns the original id of a question. More...
 
 syncWithOriginal ()
 
 getPhrase ($phrase_id)
 Returns a phrase for a given database id. More...
 
 phraseExists ($title)
 Returns true if the phrase title already exists for the current user. More...
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 addInternalLink ($material_id, $title="")
 
 deleteMaterials ($a_array)
 Deletes materials. More...
 
 duplicateMaterials ($question_id)
 Duplicates the materials of a question. More...
 
 addMaterial ($obj_material)
 
 setMaterial ($material_id="", $is_import=false, $material_title="")
 Sets a material link for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 _getInternalLinkHref ($target="", $a_parent_ref_id=null)
 
 _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
 getQuestionTypeID ()
 Returns the question type ID of the question. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
_instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
_instanciateQuestionGUI ($question_id)
 Creates an instance of a question GUI with a given question id. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addMaterialTag (&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE, $a_attrs=null)
 Creates an XML material tag from a plain text or xhtml text. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=FALSE)
 Prepares a string for a text area output in surveys. More...
 
 _getQuestionDataArray ($id)
 Returns the question data fields from the database. More...
 
 addUserSpecificResultsExportTitles (&$a_array, $a_use_label=false, $a_substitute=true)
 Adds the entries for the title row of the user specific results. More...
 
 addUserSpecificResultsData (&$a_array, &$resultset)
 Adds the values for the user specific results export for a given user. More...
 
getUserAnswers ($survey_id)
 Returns an array containing all answers to this question in a given survey. More...
 
getWorkingDataFromUserInput ($post_data)
 Creates the user data of the svy_answer table from the POST data. More...
 
 importAdditionalMetadata ($a_meta)
 Import additional meta data from the question import file. More...
 
 importResponses ($a_data)
 Import response data from the question import file. More...
 
 importAdjectives ($a_data)
 Import bipolar adjectives from the question import file. More...
 
 importMatrix ($a_data)
 Import matrix rows from the question import file. More...
 
 setExportCumulatedXLS (&$worksheet, &$format_title, &$format_bold, &$eval_data, $row, $export_label)
 Creates the Excel output for the cumulated results of this question. More...
 
setExportCumulatedCVS (&$eval_data, $export_label)
 Creates the CSV output for the cumulated results of this question. More...
 
 setExportDetailsXLS (&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 usableForPrecondition ()
 Returns if the question is usable for preconditions. More...
 
 getAvailableRelations ()
 Returns the available relations for the question. More...
 
 getPreconditionOptions ()
 Returns the options for preconditions. More...
 
 getPreconditionValueOutput ($value)
 Returns the output for a precondition value. More...
 
 getPreconditionSelectValue ($default="", $title, $variable)
 Creates a form property for the precondition value. More...
 
 outChart ($survey_id, $type="")
 Creates an image visualising the results of the question. More...
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 saveRandomData ($active_id)
 Saves random answers for a given active user in the database. More...
 
 getMaterial ()
 
 setSubtype ($a_subtype)
 
 getSubtype ()
 
 getCumulatedResultData ($survey_id, $counter, $finished_ids)
 Creates a the cumulated results data for the question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getCopyIds ($a_group_by_survey=false)
 
 hasCopies ()
 
 getSkippedValue ()
 

Data Fields

const SUBTYPE_NON_RATIO = 3
 
const SUBTYPE_RATIO_NON_ABSOLUTE = 4
 
const SUBTYPE_RATIO_ABSOLUTE = 5
 
 $subtype
 
 $minimum
 
 $maximum
 
- Data Fields inherited from SurveyQuestion
 $id
 
 $title
 
 $description
 
 $owner
 
 $author
 
 $materials
 
 $survey_id
 
 $obj_id
 
 $questiontext
 
 $obligatory
 
 $ilias
 
 $tpl
 
 $lng
 
 $orientation
 
 $material
 
 $complete
 

Additional Inherited Members

- Static Public Member Functions inherited from SurveyQuestion
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag. More...
 
static _changeOriginalId ($a_question_id, $a_original_id, $a_object_id)
 Change original id of existing question in db. More...
 
static _lookupSurveyObjId ($a_question_id)
 
static lookupObjFi ($a_qid)
 Lookip obj fi. More...
 
- Protected Member Functions inherited from SurveyQuestion
calculateCumulatedResults ($survey_id, $finished_ids)
 
- Protected Attributes inherited from SurveyQuestion
 $cumulated
 An array containing the cumulated results of the question for a given survey. More...
 

Detailed Description

Metric survey question.

The SurveyMetricQuestion class defines and encapsulates basic methods and attributes for metric survey question types.

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$

Definition at line 37 of file class.SurveyMetricQuestion.php.

Member Function Documentation

◆ _getQuestionDataArray()

SurveyMetricQuestion::_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 @access public

Reimplemented from SurveyQuestion.

Definition at line 191 of file class.SurveyMetricQuestion.php.

192 {
193 global $ilDB;
194
195 $result = $ilDB->queryF("SELECT svy_question.*, " . $this->getAdditionalTableName() . ".* FROM svy_question, " . $this->getAdditionalTableName() . " WHERE svy_question.question_id = %s AND svy_question.question_id = " . $this->getAdditionalTableName() . ".question_fi",
196 array('integer'),
197 array($id)
198 );
199 if ($result->numRows() == 1)
200 {
201 return $ilDB->fetchAssoc($result);
202 }
203 else
204 {
205 return array();
206 }
207 }
$result
getAdditionalTableName()
Returns the name of the additional question data table in the database.
global $ilDB

References SurveyQuestion\$id, $ilDB, $result, and getAdditionalTableName().

+ Here is the call graph for this function:

◆ addUserSpecificResultsData()

SurveyMetricQuestion::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 @access public

Reimplemented from SurveyQuestion.

Definition at line 797 of file class.SurveyMetricQuestion.php.

798 {
799 if (count($resultset["answers"][$this->getId()]))
800 {
801 foreach ($resultset["answers"][$this->getId()] as $key => $answer)
802 {
803 array_push($a_array, $answer["value"]);
804 }
805 }
806 else
807 {
808 array_push($a_array, $this->getSkippedValue());
809 }
810 }
getId()
Gets the id of the SurveyQuestion object.

References SurveyQuestion\getId(), and SurveyQuestion\getSkippedValue().

+ Here is the call graph for this function:

◆ checkUserInput()

SurveyMetricQuestion::checkUserInput (   $post_data,
  $survey_id 
)

Checks the input of the active user for obligatory status and entered values.

Parameters
array$post_dataThe contents of the $_POST array
integer$survey_idThe database ID of the active survey
Returns
string Empty string if the input is ok, an error message otherwise @access public

Definition at line 514 of file class.SurveyMetricQuestion.php.

515 {
516 $entered_value = $post_data[$this->getId() . "_metric_question"];
517 // replace german notation with international notation
518 $entered_value = str_replace(",", ".", $entered_value);
519
520 if ((!$this->getObligatory($survey_id)) && (strlen($entered_value) == 0)) return "";
521
522 if (strlen($entered_value) == 0) return $this->lng->txt("survey_question_obligatory");
523
524 if (strlen($this->getMinimum()))
525 {
526 if ($entered_value < $this->getMinimum())
527 {
528 return $this->lng->txt("metric_question_out_of_bounds");
529 }
530 }
531
532 if (strlen($this->getMaximum()))
533 {
534 if (($this->getMaximum() == 1) && ($this->getMaximum() < $this->getMinimum()))
535 {
536 // old &infty; values as maximum
537 }
538 else
539 {
540 if ($entered_value > $this->getMaximum())
541 {
542 return $this->lng->txt("metric_question_out_of_bounds");
543 }
544 }
545 }
546
547 if (!is_numeric($entered_value))
548 {
549 return $this->lng->txt("metric_question_not_a_value");
550 }
551
552 if (($this->getSubType() == self::SUBTYPE_RATIO_ABSOLUTE) && (intval($entered_value) != doubleval($entered_value)))
553 {
554 return $this->lng->txt("metric_question_floating_point");
555 }
556 return "";
557 }
getMinimum()
Returns the minimum value of the question.
getMaximum()
Returns the maximum value of the question.
getObligatory($survey_id="")
Gets the obligatory state of the question.

References SurveyQuestion\$survey_id, SurveyQuestion\getId(), getMaximum(), getMinimum(), and SurveyQuestion\getObligatory().

+ Here is the call graph for this function:

◆ getAdditionalTableName()

SurveyMetricQuestion::getAdditionalTableName ( )

Returns the name of the additional question data table in the database.

Returns
string The additional table name @access public

Definition at line 483 of file class.SurveyMetricQuestion.php.

484 {
485 return "svy_qst_metric";
486 }

Referenced by _getQuestionDataArray(), loadFromDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ getAvailableRelations()

SurveyMetricQuestion::getAvailableRelations ( )

Returns the available relations for the question.

Returns
array An array containing the available relations @access public

Reimplemented from SurveyQuestion.

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

875 {
876 return array("<", "<=", "=", "<>", ">=", ">");
877 }

◆ getCumulatedResults()

& SurveyMetricQuestion::getCumulatedResults (   $survey_id,
  $nr_of_users,
  $finished_ids 
)

Definition at line 604 of file class.SurveyMetricQuestion.php.

605 {
606 global $ilDB;
607
608 $question_id = $this->getId();
609
610 $result_array = array();
611 $cumulated = array();
612
613 $sql = "SELECT svy_answer.* FROM svy_answer".
614 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
615 " WHERE svy_answer.question_fi = ".$ilDB->quote($question_id, "integer").
616 " AND svy_finished.survey_fi = ".$ilDB->quote($survey_id, "integer");
617 if($finished_ids)
618 {
619 $sql .= " AND ".$ilDB->in("svy_finished.finished_id", $finished_ids, "", "integer");
620 }
621
622 $result = $ilDB->query($sql);
623 while ($row = $ilDB->fetchAssoc($result))
624 {
625 $cumulated[$row["value"]]++;
626 }
627 asort($cumulated, SORT_NUMERIC);
628 end($cumulated);
629 $numrows = $result->numRows();
630 $result_array["USERS_ANSWERED"] = $result->numRows();
631 $result_array["USERS_SKIPPED"] = $nr_of_users - $result->numRows();
632 if(sizeof($cumulated))
633 {
634 $result_array["MODE"] = key($cumulated);
635 $result_array["MODE_VALUE"] = key($cumulated);
636 $result_array["MODE_NR_OF_SELECTIONS"] = $cumulated[key($cumulated)];
637 ksort($cumulated, SORT_NUMERIC);
638 }
639 $counter = 0;
640 foreach ($cumulated as $value => $nr_of_users)
641 {
642 $percentage = 0;
643 if ($numrows > 0)
644 {
645 $percentage = (float)($nr_of_users/$numrows);
646 }
647 $result_array["values"][$counter++] = array("value" => $value, "selected" => (int)$nr_of_users, "percentage" => $percentage);
648 }
649 $median = array();
650 $total = 0;
651 $x_i = 0;
652 $p_i = 1;
653 $x_i_inv = 0;
654 $sum_part_zero = false;
655 foreach ($cumulated as $value => $key)
656 {
657 $total += $key;
658 for ($i = 0; $i < $key; $i++)
659 {
660 array_push($median, $value);
661 $x_i += $value;
662 $p_i *= $value;
663 if ($value != 0)
664 {
665 $sum_part_zero = true;
666 $x_i_inv += 1/$value;
667 }
668 }
669 }
670 if ($total > 0)
671 {
672 if (($total % 2) == 0)
673 {
674 $median_value = 0.5 * ($median[($total/2)-1] + $median[($total/2)]);
675 }
676 else
677 {
678 $median_value = $median[(($total+1)/2)-1];
679 }
680 }
681 else
682 {
683 $median_value = "";
684 }
685 if ($total > 0)
686 {
687 if (($x_i/$total) == (int)($x_i/$total))
688 {
689 $result_array["ARITHMETIC_MEAN"] = $x_i/$total;
690 }
691 else
692 {
693 $result_array["ARITHMETIC_MEAN"] = sprintf("%.2f", $x_i/$total);
694 }
695 }
696 else
697 {
698 $result_array["ARITHMETIC_MEAN"] = "";
699 }
700 $result_array["MEDIAN"] = $median_value;
701 $result_array["QUESTION_TYPE"] = "SurveyMetricQuestion";
702 return $result_array;
703 }
$cumulated
An array containing the cumulated results of the question for a given survey.

References SurveyQuestion\$cumulated, $ilDB, $result, $row, SurveyQuestion\$survey_id, $total, and SurveyQuestion\getId().

+ Here is the call graph for this function:

◆ getMaximum()

SurveyMetricQuestion::getMaximum ( )

Returns the maximum value of the question.

Returns
double The maximum value of the question @access public
See also
$maximum

Definition at line 179 of file class.SurveyMetricQuestion.php.

180 {
181 return (strlen($this->maximum)) ? $this->maximum : NULL;
182 }

Referenced by checkUserInput(), getMinMaxText(), insertXML(), saveRandomData(), and saveToDb().

+ Here is the caller graph for this function:

◆ getMinimum()

SurveyMetricQuestion::getMinimum ( )

Returns the minimum value of the question.

Returns
double The minimum value of the question @access public
See also
$minimum

Definition at line 163 of file class.SurveyMetricQuestion.php.

164 {
165 if ((strlen($this->minimum) == 0) && ($this->getSubtype() > 3))
166 {
167 $this->minimum = 0;
168 }
169 return (strlen($this->minimum)) ? $this->minimum : NULL;
170 }
getSubtype()
Gets the question subtype.

References getSubtype().

Referenced by checkUserInput(), getMinMaxText(), insertXML(), saveRandomData(), and saveToDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMinMaxText()

SurveyMetricQuestion::getMinMaxText ( )

Creates a text for the input range of the metric question.

Returns
string Range text @access private

Definition at line 912 of file class.SurveyMetricQuestion.php.

913 {
914 $min = $this->getMinimum();
915 $max = $this->getMaximum();
916 if (strlen($min) && strlen($max))
917 {
918 return "(" . $min . " " . strtolower($this->lng->txt("to")) . " " . $max . ")";
919 }
920 else if (strlen($min))
921 {
922 return "(&gt;= " . $min . ")";
923 }
924 else if (strlen($max))
925 {
926 return "(&lt;= " . $max . ")";
927 }
928 else
929 {
930 return "";
931 }
932 }

References getMaximum(), and getMinimum().

+ Here is the call graph for this function:

◆ getPreconditionSelectValue()

SurveyMetricQuestion::getPreconditionSelectValue (   $default = "",
  $title,
  $variable 
)

Creates a form property for the precondition value.

Returns
The ILIAS form element @access public

Reimplemented from SurveyQuestion.

Definition at line 898 of file class.SurveyMetricQuestion.php.

899 {
900 include_once "./Services/Form/classes/class.ilNumberInputGUI.php";
901 $step3 = new ilNumberInputGUI($title, $variable);
902 $step3->setValue($default);
903 return $step3;
904 }
This class represents a number property in a property form.

References SurveyQuestion\$title.

◆ getQuestionType()

SurveyMetricQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question @access public

Reimplemented from SurveyQuestion.

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

473 {
474 return "SurveyMetricQuestion";
475 }

Referenced by getQuestionTypeID().

+ Here is the caller graph for this function:

◆ getQuestionTypeID()

SurveyMetricQuestion::getQuestionTypeID ( )

Returns the question type ID of the question.

Returns
integer The question type of the question @access public

Reimplemented from SurveyQuestion.

Definition at line 455 of file class.SurveyMetricQuestion.php.

456 {
457 global $ilDB;
458 $result = $ilDB->queryF("SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
459 array('text'),
460 array($this->getQuestionType())
461 );
462 $row = $ilDB->fetchAssoc($result);
463 return $row["questiontype_id"];
464 }
getQuestionType()
Returns the question type of the question.

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

+ Here is the call graph for this function:

◆ getSubtype()

SurveyMetricQuestion::getSubtype ( )

Gets the question subtype.

Returns
integer The question subtype @access public
See also
$subtype

Reimplemented from SurveyQuestion.

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

References $subtype.

Referenced by getMinimum(), insertXML(), and setExportDetailsXLS().

+ Here is the caller graph for this function:

◆ getUserAnswers()

& SurveyMetricQuestion::getUserAnswers (   $survey_id,
  $finished_ids 
)

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 @access public

Definition at line 819 of file class.SurveyMetricQuestion.php.

820 {
821 global $ilDB;
822
823 $answers = array();
824
825 $sql = "SELECT svy_answer.* FROM svy_answer".
826 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
827 " WHERE svy_answer.question_fi = ".$ilDB->quote($this->getId(), "integer").
828 " AND svy_finished.survey_fi = ".$ilDB->quote($survey_id, "integer");
829 if($finished_ids)
830 {
831 $sql .= " AND ".$ilDB->in("svy_finished.finished_id", $finished_ids, "", "integer");
832 }
833
834 $result = $ilDB->query($sql);
835 while ($row = $ilDB->fetchAssoc($result))
836 {
837 $answers[$row["active_fi"]] = $row["value"];
838 }
839 return $answers;
840 }

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

+ Here is the call graph for this function:

◆ getWorkingDataFromUserInput()

& SurveyMetricQuestion::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 @access public

Reimplemented from SurveyQuestion.

Definition at line 494 of file class.SurveyMetricQuestion.php.

495 {
496 $entered_value = $post_data[$this->getId() . "_metric_question"];
497 $data = array();
498 if (strlen($entered_value))
499 {
500 array_push($data, array("value" => $entered_value));
501 }
502 return $data;
503 }
$data

References $data, and SurveyQuestion\getId().

+ Here is the call graph for this function:

◆ importResponses()

SurveyMetricQuestion::importResponses (   $a_data)

Import response data from the question import file.

Returns
array $a_data Array containing the response data @access public

Reimplemented from SurveyQuestion.

Definition at line 848 of file class.SurveyMetricQuestion.php.

849 {
850 foreach ($a_data as $id => $data)
851 {
852 $this->setMinimum($data["min"]);
853 $this->setMaximum($data["max"]);
854 }
855 }
setMaximum($maximum="")
Sets the maximum value.
setMinimum($minimum=0)
Sets the minimum value.

References $data, SurveyQuestion\$id, setMaximum(), and setMinimum().

+ Here is the call graph for this function:

◆ insertXML()

SurveyMetricQuestion::insertXML ( $a_xml_writer,
  $a_include_header = TRUE,
  $obligatory_state = "" 
)

Adds the question XML to a given XMLWriter object.

Parameters
object$a_xml_writerThe XMLWriter object
boolean$a_include_headerDetermines wheather or not the XML should be used
string$obligatory_stateThe value of the obligatory state @access public

Definition at line 360 of file class.SurveyMetricQuestion.php.

361 {
362 $attrs = array(
363 "id" => $this->getId(),
364 "title" => $this->getTitle(),
365 "type" => $this->getQuestiontype(),
366 "subtype" => $this->getSubtype(),
367 "obligatory" => $this->getObligatory()
368 );
369 $a_xml_writer->xmlStartTag("question", $attrs);
370
371 $a_xml_writer->xmlElement("description", NULL, $this->getDescription());
372 $a_xml_writer->xmlElement("author", NULL, $this->getAuthor());
373 $a_xml_writer->xmlStartTag("questiontext");
374 $this->addMaterialTag($a_xml_writer, $this->getQuestiontext());
375 $a_xml_writer->xmlEndTag("questiontext");
376
377 $a_xml_writer->xmlStartTag("responses");
378 switch ($this->getSubtype())
379 {
380 case 3:
381 $attrs = array(
382 "id" => "0",
383 "format" => "double"
384 );
385 if (strlen($this->getMinimum()))
386 {
387 $attrs["min"] = $this->getMinimum();
388 }
389 if (strlen($this->getMaximum()))
390 {
391 $attrs["max"] = $this->getMaximum();
392 }
393 break;
394 case 4:
395 $attrs = array(
396 "id" => "0",
397 "format" => "double"
398 );
399 if (strlen($this->getMinimum()))
400 {
401 $attrs["min"] = $this->getMinimum();
402 }
403 if (strlen($this->getMaximum()))
404 {
405 $attrs["max"] = $this->getMaximum();
406 }
407 break;
408 case 5:
409 $attrs = array(
410 "id" => "0",
411 "format" => "integer"
412 );
413 if (strlen($this->getMinimum()))
414 {
415 $attrs["min"] = $this->getMinimum();
416 }
417 if (strlen($this->getMaximum()))
418 {
419 $attrs["max"] = $this->getMaximum();
420 }
421 break;
422 }
423 $a_xml_writer->xmlStartTag("response_num", $attrs);
424 $a_xml_writer->xmlEndTag("response_num");
425
426 $a_xml_writer->xmlEndTag("responses");
427
428 if (count($this->material))
429 {
430 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $this->material["internal_link"], $matches))
431 {
432 $attrs = array(
433 "label" => $this->material["title"]
434 );
435 $a_xml_writer->xmlStartTag("material", $attrs);
436 $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
437 if (strcmp($matches[1], "") != 0)
438 {
439 $intlink = $this->material["internal_link"];
440 }
441 $a_xml_writer->xmlElement("mattext", NULL, $intlink);
442 $a_xml_writer->xmlEndTag("material");
443 }
444 }
445
446 $a_xml_writer->xmlEndTag("question");
447 }
getDescription()
Gets the description string of the SurveyQuestion object.
getAuthor()
Gets the authors name of the SurveyQuestion object.
getQuestiontext()
Gets the questiontext of the SurveyQuestion object.
getTitle()
Gets the title string of the SurveyQuestion object.
addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE, $a_attrs=null)
Creates an XML material tag from a plain text or xhtml text.

References SurveyQuestion\addMaterialTag(), SurveyQuestion\getAuthor(), SurveyQuestion\getDescription(), SurveyQuestion\getId(), getMaximum(), getMinimum(), SurveyQuestion\getObligatory(), SurveyQuestion\getQuestiontext(), getSubtype(), and SurveyQuestion\getTitle().

Referenced by toXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isComplete()

SurveyMetricQuestion::isComplete ( )

Returns true if the question is complete for use.

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

Reimplemented from SurveyQuestion.

Definition at line 269 of file class.SurveyMetricQuestion.php.

270 {
271 if (
272 strlen($this->getTitle()) &&
273 strlen($this->getAuthor()) &&
274 strlen($this->getQuestiontext())
275 )
276 {
277 return 1;
278 }
279 else
280 {
281 return 0;
282 }
283 }

References SurveyQuestion\getAuthor(), SurveyQuestion\getQuestiontext(), and SurveyQuestion\getTitle().

+ Here is the call graph for this function:

◆ loadFromDb()

SurveyMetricQuestion::loadFromDb (   $id)

Loads a SurveyMetricQuestion object from the database.

Parameters
integer$idThe database id of the metric survey question @access public

Reimplemented from SurveyQuestion.

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

216 {
217 global $ilDB;
218
219 $result = $ilDB->queryF("SELECT svy_question.*, " . $this->getAdditionalTableName() . ".* FROM svy_question LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = svy_question.question_id WHERE svy_question.question_id = %s",
220 array('integer'),
221 array($id)
222 );
223 if ($result->numRows() == 1)
224 {
225 $data = $ilDB->fetchAssoc($result);
226 $this->setId($data["question_id"]);
227 $this->setTitle($data["title"]);
228 $this->setDescription($data["description"]);
229 $this->setObjId($data["obj_fi"]);
230 $this->setAuthor($data["author"]);
231 $this->setOwner($data["owner_fi"]);
232 $this->label = $data['label'];
233 include_once("./Services/RTE/classes/class.ilRTE.php");
234 $this->setQuestiontext(ilRTE::_replaceMediaObjectImageSrc($data["questiontext"], 1));
235 $this->setObligatory($data["obligatory"]);
236 $this->setComplete($data["complete"]);
237 $this->setOriginalId($data["original_id"]);
238 $this->setSubtype($data["subtype"]);
239
240 $result = $ilDB->queryF("SELECT svy_variable.* FROM svy_variable WHERE svy_variable.question_fi = %s",
241 array('integer'),
242 array($id)
243 );
244 if ($result->numRows() > 0)
245 {
246 if ($data = $ilDB->fetchAssoc($result))
247 {
248 $this->minimum = $data["value1"];
249 if (($data["value2"] < 0) or (strcmp($data["value2"], "") == 0))
250 {
251 $this->maximum = "";
252 }
253 else
254 {
255 $this->maximum = $data["value2"];
256 }
257 }
258 }
259 }
260 parent::loadFromDb($id);
261 }
setSubtype($subtype=self::SUBTYPE_NON_RATIO)
Sets the question subtype.
setQuestiontext($questiontext="")
Sets the questiontext of the SurveyQuestion object.
setId($id=-1)
Sets the id of the SurveyQuestion object.
setAuthor($author="")
Sets the authors name of the SurveyQuestion object.
setDescription($description="")
Sets the description string of the SurveyQuestion object.
setObjId($obj_id=0)
Set the reference id of the container object.
setOriginalId($original_id)
setComplete($a_complete)
Sets the complete state of the question.
setOwner($owner="")
Sets the creator/owner ID of the SurveyQuestion object.
setTitle($title="")
Sets the title string of the SurveyQuestion object.
setObligatory($obligatory=1)
Sets the obligatory state of the question.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...

References $data, SurveyQuestion\$id, $ilDB, $result, ilRTE\_replaceMediaObjectImageSrc(), getAdditionalTableName(), SurveyQuestion\setAuthor(), SurveyQuestion\setComplete(), SurveyQuestion\setDescription(), SurveyQuestion\setId(), SurveyQuestion\setObjId(), SurveyQuestion\setObligatory(), SurveyQuestion\setOriginalId(), SurveyQuestion\setOwner(), SurveyQuestion\setQuestiontext(), setSubtype(), and SurveyQuestion\setTitle().

+ Here is the call graph for this function:

◆ outPreconditionSelectValue()

SurveyMetricQuestion::outPreconditionSelectValue ( $template)

Creates a value selection for preconditions.

Parameters
object$templateThe template for the value selection (usually tpl.svy_svy_add_constraint.html) @access public

Definition at line 885 of file class.SurveyMetricQuestion.php.

886 {
887 $template->setCurrentBlock("textfield");
888 $template->setVariable("TEXTFIELD_VALUE", "");
889 $template->parseCurrentBlock();
890 }

◆ saveRandomData()

SurveyMetricQuestion::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 from SurveyQuestion.

Definition at line 564 of file class.SurveyMetricQuestion.php.

565 {
566 global $ilDB;
567 // single response
568 $number = rand($this->getMinimum(), (strlen($this->getMaximum())) ? $this->getMaximum() : 100);
569 $next_id = $ilDB->nextId('svy_answer');
570 $affectedRows = $ilDB->manipulateF("INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
571 array('integer','integer','integer','float','text','integer'),
572 array($next_id, $this->getId(), $active_id, $number, NULL, time())
573 );
574 }

References $ilDB, SurveyQuestion\getId(), getMaximum(), and getMinimum().

+ Here is the call graph for this function:

◆ saveToDb()

SurveyMetricQuestion::saveToDb (   $original_id = "")

Saves a SurveyMetricQuestion object to a database.

@access public

Reimplemented from SurveyQuestion.

Definition at line 290 of file class.SurveyMetricQuestion.php.

291 {
292 global $ilDB;
293
294 $affectedRows = parent::saveToDb($original_id);
295 if ($affectedRows == 1)
296 {
297 $affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
298 array('integer'),
299 array($this->getId())
300 );
301 $affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, subtype) VALUES (%s, %s)",
302 array('integer', 'text'),
303 array($this->getId(), $this->getSubType())
304 );
305
306 // saving material uris in the database
307 $this->saveMaterial();
308
309 // save categories
310 $affectedRows = $ilDB->manipulateF("DELETE FROM svy_variable WHERE question_fi = %s",
311 array('integer'),
312 array($this->getId())
313 );
314
315 if (preg_match("/[\D]/", $this->maximum) or (strcmp($this->maximum, "&infin;") == 0))
316 {
317 $max = -1;
318 }
319 else
320 {
321 $max = $this->getMaximum();
322 }
323 $next_id = $ilDB->nextId('svy_variable');
324 $affectedRows = $ilDB->manipulateF("INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, value2, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
325 array('integer','integer','integer','float','float','integer','integer'),
326 array($next_id, 0, $this->getId(), $this->getMinimum(), $max, 0, time())
327 );
328 }
329 }
saveMaterial()
save material to db

References $ilDB, getAdditionalTableName(), SurveyQuestion\getId(), getMaximum(), getMinimum(), and SurveyQuestion\saveMaterial().

+ Here is the call graph for this function:

◆ saveUserInput()

SurveyMetricQuestion::saveUserInput (   $post_data,
  $active_id,
  $a_return = false 
)

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

577 {
578 global $ilDB;
579
580 $entered_value = $post_data[$this->getId() . "_metric_question"];
581
582 // replace german notation with international notation
583 $entered_value = str_replace(",", ".", $entered_value);
584
585 if($a_return)
586 {
587 return array(array("value"=>$entered_value, "textanswer"=>null));
588 }
589 if (strlen($entered_value) == 0) return;
590
591 $next_id = $ilDB->nextId('svy_answer');
592 #20216
593 $fields = array();
594 $fields['answer_id'] = array("integer", $next_id);
595 $fields['question_fi'] = array("integer", $this->getId());
596 $fields['active_fi'] = array("integer", $active_id);
597 $fields['value'] = array("float", (strlen($entered_value)) ? $entered_value : NULL);
598 $fields['textanswer'] = array("clob", NULL);
599 $fields['tstamp'] = array("integer", time());
600
601 $affectedRows = $ilDB->insert("svy_answer", $fields);
602 }

References $ilDB, and SurveyQuestion\getId().

+ Here is the call graph for this function:

◆ setExportDetailsXLS()

SurveyMetricQuestion::setExportDetailsXLS ( $workbook,
$format_title,
$format_bold,
$eval_data,
  $export_label 
)

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 @access public

Reimplemented from SurveyQuestion.

Definition at line 714 of file class.SurveyMetricQuestion.php.

715 {
716 include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
717 $worksheet =& $workbook->addWorksheet();
718 $rowcounter = 0;
719 switch ($export_label)
720 {
721 case 'label_only':
722 $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold);
723 $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->label));
724 break;
725 case 'title_only':
726 $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
727 $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
728 break;
729 default:
730 $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
731 $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
732 $rowcounter++;
733 $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold);
734 $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->label));
735 break;
736 }
737 $rowcounter++;
738 $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold);
739 $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->getQuestiontext()));
740 $rowcounter++;
741 $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold);
742 $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())));
743 $rowcounter++;
744 $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold);
745 $worksheet->write($rowcounter, 1, $eval_data["USERS_ANSWERED"]);
746 $rowcounter++;
747 $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold);
748 $worksheet->write($rowcounter, 1, $eval_data["USERS_SKIPPED"]);
749 $rowcounter++;
750
751 $worksheet->write($rowcounter, 0, $this->lng->txt("subtype"), $format_bold);
752 switch ($this->getSubtype())
753 {
755 $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("non_ratio")), $format_bold);
756 break;
758 $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_non_absolute")), $format_bold);
759 break;
761 $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_absolute")), $format_bold);
762 break;
763 }
764 $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold);
765 $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"]));
766 $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold);
767 $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"]));
768 $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold);
769 $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE_NR_OF_SELECTIONS"]));
770 $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median")), $format_bold);
771 $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MEDIAN"]));
772 $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean")), $format_bold);
773 $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["ARITHMETIC_MEAN"]));
774 $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("values")), $format_bold);
775 $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title);
776 $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title);
777 $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($this->lng->txt("svy_fraction_of_selections")), $format_title);
778 $values = "";
779 if (is_array($eval_data["values"]))
780 {
781 foreach ($eval_data["values"] as $key => $value)
782 {
783 $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["value"]));
784 $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($value["selected"]));
785 $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($value["percentage"]), $format_percent);
786 }
787 }
788 }
_convert_text($a_text, $a_target="has been removed")

References ilExcelUtils\_convert_text(), SurveyQuestion\getQuestiontext(), getSubtype(), SurveyQuestion\getTitle(), SUBTYPE_NON_RATIO, SUBTYPE_RATIO_ABSOLUTE, and SUBTYPE_RATIO_NON_ABSOLUTE.

+ Here is the call graph for this function:

◆ setMaximum()

SurveyMetricQuestion::setMaximum (   $maximum = "")

Sets the maximum value.

Parameters
double$maximumThe maximum value @access public
See also
$maximum

Definition at line 131 of file class.SurveyMetricQuestion.php.

132 {
133 if($maximum !== NULL)
134 {
135 $maximum = (float)$maximum;
136 }
137 if(!$maximum)
138 {
139 $maximum = NULL;
140 }
141 $this->maximum = $maximum;
142 }

References $maximum.

Referenced by importResponses().

+ Here is the caller graph for this function:

◆ setMinimum()

SurveyMetricQuestion::setMinimum (   $minimum = 0)

Sets the minimum value.

Parameters
double$minimumThe minimum value @access public
See also
$minimum

Definition at line 111 of file class.SurveyMetricQuestion.php.

112 {
113 if($minimum !== NULL)
114 {
115 $minimum = (float)$minimum;
116 }
117 if(!$minimum)
118 {
119 $minimum = NULL;
120 }
121 $this->minimum = $minimum;
122 }

References $minimum.

Referenced by importResponses().

+ Here is the caller graph for this function:

◆ setSubtype()

SurveyMetricQuestion::setSubtype (   $subtype = self::SUBTYPE_NON_RATIO)

Sets the question subtype.

Parameters
integer$subtypeThe question subtype @access public
See also
$subtype

Reimplemented from SurveyQuestion.

Definition at line 99 of file class.SurveyMetricQuestion.php.

100 {
101 $this->subtype = $subtype;
102 }

References $subtype.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ SurveyMetricQuestion()

SurveyMetricQuestion::SurveyMetricQuestion (   $title = "",
  $description = "",
  $author = "",
  $questiontext = "",
  $owner = -1,
  $subtype = self::SUBTYPE_NON_RATIO 
)

SurveyMetricQuestion constructor.

The constructor takes possible arguments an creates an instance of the SurveyMetricQuestion 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 @access public

Definition at line 77 of file class.SurveyMetricQuestion.php.

85 {
87 $this->subtype = $subtype;
88 $this->minimum = "";
89 $this->maximum = "";
90 }
SurveyQuestion( $title="", $description="", $author="", $questiontext="", $owner=-1)
SurveyQuestion constructor The constructor takes possible arguments an creates an instance of the Sur...

References SurveyQuestion\$author, SurveyQuestion\$description, SurveyQuestion\$owner, SurveyQuestion\$questiontext, $subtype, SurveyQuestion\$title, and SurveyQuestion\SurveyQuestion().

+ Here is the call graph for this function:

◆ toXML()

SurveyMetricQuestion::toXML (   $a_include_header = TRUE,
  $obligatory_state = "" 
)

Returns an xml representation of the question.

Returns
string The xml representation of the question @access public

Definition at line 337 of file class.SurveyMetricQuestion.php.

338 {
339 include_once("./Services/Xml/classes/class.ilXmlWriter.php");
340 $a_xml_writer = new ilXmlWriter;
341 $a_xml_writer->xmlHeader();
342 $this->insertXML($a_xml_writer, $a_include_header, $obligatory_state);
343 $xml = $a_xml_writer->xmlDumpMem(FALSE);
344 if (!$a_include_header)
345 {
346 $pos = strpos($xml, "?>");
347 $xml = substr($xml, $pos + 2);
348 }
349 return $xml;
350 }
insertXML(&$a_xml_writer, $a_include_header=TRUE, $obligatory_state="")
Adds the question XML to a given XMLWriter object.
XML writer class.
xmlHeader()
Writes xml header @access public.

References insertXML(), and ilXmlWriter\xmlHeader().

+ Here is the call graph for this function:

◆ usableForPrecondition()

SurveyMetricQuestion::usableForPrecondition ( )

Returns if the question is usable for preconditions.

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

Reimplemented from SurveyQuestion.

Definition at line 863 of file class.SurveyMetricQuestion.php.

864 {
865 return TRUE;
866 }

Field Documentation

◆ $maximum

SurveyMetricQuestion::$maximum

Definition at line 64 of file class.SurveyMetricQuestion.php.

Referenced by setMaximum().

◆ $minimum

SurveyMetricQuestion::$minimum

Definition at line 57 of file class.SurveyMetricQuestion.php.

Referenced by setMinimum().

◆ $subtype

SurveyMetricQuestion::$subtype

Definition at line 50 of file class.SurveyMetricQuestion.php.

Referenced by getSubtype(), setSubtype(), and SurveyMetricQuestion().

◆ SUBTYPE_NON_RATIO

const SurveyMetricQuestion::SUBTYPE_NON_RATIO = 3

◆ SUBTYPE_RATIO_ABSOLUTE

const SurveyMetricQuestion::SUBTYPE_RATIO_ABSOLUTE = 5

◆ SUBTYPE_RATIO_NON_ABSOLUTE

const SurveyMetricQuestion::SUBTYPE_RATIO_NON_ABSOLUTE = 4

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