ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
SurveyMatrixQuestion Class Reference

The SurveyMatrixQuestion class defines and encapsulates basic methods and attributes for matrix question types. More...

+ Inheritance diagram for SurveyMatrixQuestion:
+ Collaboration diagram for SurveyMatrixQuestion:

Public Member Functions

 SurveyMatrixQuestion ($title="", $description="", $author="", $questiontext="", $owner=-1)
 SurveyMatrixQuestion constructor The constructor takes possible arguments an creates an instance of the SurveyMatrixQuestion object.
 getColumnCount ()
 Returns the number of columns.
 removeColumn ($index)
 Removes a column from the list of columns.
 removeColumns ($array)
 Removes many columns from the list of columns.
 removeColumnWithName ($name)
 Removes a column from the list of columns.
 getColumns ()
 Return the columns.
 getColumn ($index)
 Returns the name of a column for a given index.
 getColumnForScale ($scale)
 getColumnIndex ($name)
 Returns the index of a column with a given name.
 flushColumns ()
 Empties the columns list.
 getRowCount ()
 Returns the number of rows in the question.
 addRow ($a_text, $a_other, $a_label)
 Adds a row to the question.
 addRowAtPosition ($a_text, $a_other, $a_position)
 Adds a row at a given position.
 flushRows ()
 Empties the row list.
 getRow ($a_index)
 Returns a specific row.
 moveRowUp ($index)
 moveRowDown ($index)
 removeRows ($array)
 Removes rows from the question.
 removeRow ($index)
 Removes a row.
 getBipolarAdjective ($a_index)
 Returns one of the bipolar adjectives.
 setBipolarAdjective ($a_index, $a_value)
 Sets one of the bipolar adjectives.
 addPhrase ($phrase_id)
 Adds a phrase to the question.
 _getQuestionDataArray ($id)
 Returns the question data fields from the database.
 loadFromDb ($id)
 Loads a SurveyMatrixQuestion object from the database.
 isComplete ()
 Returns 1 if the question is complete for use.
 saveToDb ($original_id=NULL, $withanswers=true)
 Saves a SurveyMatrixQuestion object to a database.
 saveBipolarAdjectives ($adjective1, $adjective2)
 saveColumnToDb ($columntext, $neutral=0)
 Saves a column to the database.
 saveColumnsToDb ($original_id="")
 saveRowsToDb ($original_id="")
 toXML ($a_include_header=TRUE, $obligatory_state="")
 Returns an xml representation of the question.
 insertXML (&$a_xml_writer, $a_include_header=TRUE, $obligatory_state="")
 Adds the question XML to a given XMLWriter object.
 syncWithOriginal ()
 addStandardNumbers ($lower_limit, $upper_limit)
 Adds standard numbers as columns.
 savePhrase ($title)
 Saves a set of columns to a default phrase.
 getQuestionType ()
 Returns the question type of the question.
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database.
getWorkingDataFromUserInput ($post_data)
 Creates the user data of the svy_answer table from the POST data.
 checkUserInput ($post_data, $survey_id)
 Checks the input of the active user for obligatory status and entered values.
 saveRandomData ($active_id)
 Saves random answers for a given active user in the database.
 saveUserInput ($post_data, $active_id, $a_return=false)
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database.
 getNrOfUsersAnswered ($survey_id, $finished_ids=null, $rowindex=null)
 Returns the number of users that answered the question for a given survey.
getCumulatedResultsForRow ($rowindex, $survey_id, $nr_of_users, $finished_ids)
 Returns the cumulated results for a given row.
getCumulatedResults ($survey_id, $nr_of_users, $finished_ids)
 Returns the cumulated results for the question.
 setExportCumulatedXLS (&$worksheet, &$format_title, &$format_bold, &$eval_data, $row, $export_label)
 Creates the Excel output for the cumulated results of this question.
setExportCumulatedCVS (&$eval_data, $export_label)
 Creates the CSV output for the cumulated results of this question.
 setExportDetailsXLS (&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label)
 Creates an Excel worksheet for the detailed cumulated results of this question.
 addUserSpecificResultsExportTitles (&$a_array, $a_use_label=false, $a_substitute=true)
 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, $finished_ids)
 Returns an array containing all answers to this question in a given survey.
 getSubtype ()
 Returns the subtype of the matrix question.
 setSubtype ($a_subtype=0)
 Sets the subtype of the matrix question.
 setColumnSeparators ($enable=0)
 Enables/Disables separators for the matrix columns.
 getColumnSeparators ()
 Gets the separators enable state for the matrix columns.
 setRowSeparators ($enable=0)
 Enables/Disables separators for the matrix rows.
 getRowSeparators ()
 Gets the separators enable state for the matrix rows.
 setNeutralColumnSeparator ($enable=0)
 Enables/Disables a separator for the neutral column.
 getNeutralColumnSeparator ()
 Gets the separator enable state for the neutral column.
 importAdditionalMetadata ($a_meta)
 Import additional meta 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.
 importResponses ($a_data)
 Import response data from the question import file.
 usableForPrecondition ()
 Returns if the question is usable for preconditions.
 getPreconditionValueOutput ($value)
 Returns the output for a precondition value.
 getPreconditionSelectValue ($default="", $title, $variable)
 Creates a form property for the precondition value.
 saveLayout ($percent_row, $percent_columns, $percent_bipolar_adjective1="", $percent_bipolar_adjective2="", $percent_neutral)
 Saves the layout of a matrix question.
 getLayout ()
 setLayout ($layout)
 hasBipolarAdjectives ()
 Returns TRUE if bipolar adjectives exist.
 hasNeutralColumn ()
 Returns TRUE if a neutral column exists.
 setColumnPlaceholders ($a_value=0)
 Set whether placeholders should be used for the column titles or not.
 getColumnPlaceholders ()
 Get whether placeholders should be used for the column titles or not.
 setLegend ($a_value=0)
 Set whether the legend should be shown or not.
 getLegend ()
 Get whether the legend should be shown or not.
 setSingleLineRowCaption ($a_value=0)
 getSingleLineRowCaption ()
 setRepeatColumnHeader ($a_value=0)
 getRepeatColumnHeader ()
 setColumnHeaderPosition ($a_value)
 getColumnHeaderPosition ()
 setRandomRows ($a_value=0)
 getRandomRows ()
 setColumnOrder ($a_value)
 getColumnOrder ()
 setColumnImages ($a_value=0)
 getColumnImages ()
 setRowImages ($a_value=0)
 getRowImages ()
 getRows ()
 getCumulatedResultData ($survey_id, $counter, $finished_ids)
 Creates a the cumulated results data for the question.
- 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.
 _SurveyQuestion ()
 setComplete ($a_complete)
 Sets the complete state of the question.
 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.
 _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.
 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, $a_return_question_id_if_no_original=true)
 Returns the original id of a question.
 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="", $a_parent_ref_id=null)
 _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.
_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, $a_attrs=null)
 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.
getUserAnswers ($survey_id)
 Returns an array containing all answers to this question in a given survey.
 getAvailableRelations ()
 Returns the available relations for the question.
 getPreconditionOptions ()
 Returns the options for preconditions.
 outChart ($survey_id, $type="")
 Creates an image visualising the results of the question.
 setOriginalId ($original_id)
 getOriginalId ()
 getMaterial ()
 __get ($value)
 Object getter.
 __set ($key, $value)
 Object setter.
 getCopyIds ($a_group_by_survey=false)
 hasCopies ()
 getSkippedValue ()

Data Fields

 $columns
 $rows
 $bipolar_adjective1
 $bipolar_adjective2
 $columnSeparators
 $rowSeparators
 $neutralColumnSeparator
 $layout
 $columnPlaceholders
 $legend
 $singleLineRowCaption
 $repeatColumnHeader
 $columnHeaderPosition
 $randomRows
 $columnOrder
 $columnImages
 $rowImages
 $openRows
 $subtype
- 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.
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag.
static _changeOriginalId ($a_question_id, $a_original_id, $a_object_id)
 Change original id of existing question in db.
static _lookupSurveyObjId ($a_question_id)
static lookupObjFi ($a_qid)
 Lookip obj fi.
- 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.

Detailed Description

The SurveyMatrixQuestion class defines and encapsulates basic methods and attributes for matrix 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 35 of file class.SurveyMatrixQuestion.php.

Member Function Documentation

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

Definition at line 441 of file class.SurveyMatrixQuestion.php.

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

{
global $ilDB;
$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",
array('integer'),
array($id)
);
if ($result->numRows() == 1)
{
return $ilDB->fetchAssoc($result);
}
else
{
return array();
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::addPhrase (   $phrase_id)

Adds a phrase to the question.

Parameters
integer$phrase_idThe database id of the given phrase public

Definition at line 411 of file class.SurveyMatrixQuestion.php.

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

{
global $ilUser;
global $ilDB;
$result = $ilDB->queryF("SELECT svy_category.* FROM svy_category, svy_phrase_cat WHERE svy_phrase_cat.category_fi = svy_category.category_id AND svy_phrase_cat.phrase_fi = %s AND (svy_category.owner_fi = %s OR svy_category.owner_fi = %s) ORDER BY svy_phrase_cat.sequence",
array('integer', 'integer', 'integer'),
array($phrase_id, 0, $ilUser->getId())
);
while ($row = $ilDB->fetchAssoc($result))
{
$neutral = $row["neutral"];
if (($row["defaultvalue"] == 1) && ($row["owner_fi"] == 0))
{
$this->columns->addCategory($this->lng->txt($row["title"]), 0, $neutral);
}
else
{
$this->columns->addCategory($row["title"], 0, $neutral);
}
}
}
SurveyMatrixQuestion::addRow (   $a_text,
  $a_other,
  $a_label 
)

Adds a row to the question.

Parameters
string$a_textThe text of the row

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

Referenced by importMatrix(), and loadFromDb().

{
$this->rows->addCategory($a_text, $a_other, 0, $a_label);
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::addRowAtPosition (   $a_text,
  $a_other,
  $a_position 
)

Adds a row at a given position.

Parameters
string$a_textThe text of the row
integer$a_positionThe row position

Definition at line 303 of file class.SurveyMatrixQuestion.php.

{
$this->rows->addCategoryAtPosition($a_text, $a_position, $a_other);
}
SurveyMatrixQuestion::addStandardNumbers (   $lower_limit,
  $upper_limit 
)

Adds standard numbers as columns.

Parameters
integer$lower_limitThe lower limit
integer$upper_limitThe upper limit public

Definition at line 900 of file class.SurveyMatrixQuestion.php.

{
for ($i = $lower_limit; $i <= $upper_limit; $i++)
{
$this->columns->addCategory($i);
}
}
SurveyMatrixQuestion::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 from SurveyQuestion.

Definition at line 1814 of file class.SurveyMatrixQuestion.php.

References $result, $row, getColumn(), getColumnCount(), SurveyQuestion\getId(), getRow(), getRowCount(), SurveyQuestion\getSkippedValue(), and getSubtype().

{
if (count($resultset["answers"][$this->getId()]))
{
array_push($a_array, "");
switch ($this->getSubtype())
{
case 0:
for ($i = 0; $i < $this->getRowCount(); $i++)
{
// add textanswer column for single choice mode
$row = $this->getRow($i);
$textanswer = "";
$checked = FALSE;
foreach ($resultset["answers"][$this->getId()] as $result)
{
if ($result["rowvalue"] == $i)
{
$checked = TRUE;
array_push($a_array, $result["value"] + 1);
if ($result["textanswer"])
{
$textanswer = $result["textanswer"];
}
}
}
if (!$checked)
{
array_push($a_array, $this->getSkippedValue());
}
if ($row->other)
{
array_push($a_array, $textanswer);
}
}
break;
case 1:
for ($i = 0; $i < $this->getRowCount(); $i++)
{
// add textanswer column for multiple choice mode
$row = $this->getRow($i);
$textanswer = "";
$checked = FALSE;
$checked_values = array();
foreach ($resultset["answers"][$this->getId()] as $result)
{
if ($result["rowvalue"] == $i)
{
$checked = TRUE;
array_push($checked_values, $result["value"] + 1);
if ($result["textanswer"])
{
$textanswer = $result["textanswer"];
}
}
}
if (!$checked)
{
array_push($a_array, $this->getSkippedValue());
}
else
{
array_push($a_array, "");
}
if ($row->other)
{
array_push($a_array, $textanswer);
}
for ($index = 0; $index < $this->getColumnCount(); $index++)
{
if (!$checked)
{
array_push($a_array, "");
}
else
{
$cat = $this->getColumn($index);
$scale = $cat->scale;
if (in_array($scale, $checked_values))
{
array_push($a_array, $scale);
}
else
{
array_push($a_array, 0);
}
}
}
}
break;
}
}
else
{
array_push($a_array, $this->getSkippedValue());
for ($i = 0; $i < $this->getRowCount(); $i++)
{
array_push($a_array, "");
// add empty "other" column if not answered
$row = $this->getRow($i);
if ($row->other)
{
array_push($a_array, "");
}
switch ($this->getSubtype())
{
case 0:
break;
case 1:
for ($index = 0; $index < $this->getColumnCount(); $index++)
{
array_push($a_array, "");
}
break;
}
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::addUserSpecificResultsExportTitles ( $a_array,
  $a_use_label = false,
  $a_substitute = true 
)

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

Definition at line 1747 of file class.SurveyMatrixQuestion.php.

References $row, SurveyQuestion\$title, getColumn(), getColumnCount(), getRow(), getRowCount(), and getSubtype().

{
parent::addUserSpecificResultsExportTitles($a_array, $a_use_label, $a_substitute);
for ($i = 0; $i < $this->getRowCount(); $i++)
{
// create row title according label, add 'other column'
$row = $this->getRow($i);
if(!$a_use_label)
{
$title = $row->title;
}
else
{
if($a_substitute)
{
$title = $row->label ? $row->label : $row->title;
}
else
{
$title = $row->label;
}
}
array_push($a_array, $title);
if ($row->other)
{
if(!$a_use_label || $a_substitute)
{
array_push($a_array, $title. ' - '. $this->lng->txt('other'));
}
else
{
array_push($a_array, "");
}
}
switch ($this->getSubtype())
{
case 0:
break;
case 1:
for ($index = 0; $index < $this->getColumnCount(); $index++)
{
$col = $this->getColumn($index);
if(!$a_use_label || $a_substitute)
{
array_push($a_array, ($index+1) . " - " . $col->title);
}
else
{
array_push($a_array, "");
}
}
break;
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::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 public

Definition at line 1026 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\$survey_id, SurveyQuestion\getId(), SurveyQuestion\getObligatory(), getRowCount(), and getSubtype().

{
if (!$this->getObligatory($survey_id)) return "";
switch ($this->getSubtype())
{
case 0:
$counter = 0;
foreach ($post_data as $key => $value)
{
if (preg_match("/matrix_" . $this->getId() . "_(\d+)/", $key, $matches))
{
if (array_key_exists('matrix_other_' . $this->getId() . "_" . $matches[1], $post_data) && strlen($post_data['matrix_other_' . $this->getId() . "_" . $matches[1]]) == 0)
{
return $this->lng->txt("question_mr_no_other_answer");
}
$counter++;
}
}
if ($counter != $this->getRowCount()) return $this->lng->txt("matrix_question_radio_button_not_checked");
break;
case 1:
$counter = 0;
foreach ($post_data as $key => $value)
{
if (preg_match("/matrix_" . $this->getId() . "_(\d+)/", $key, $matches))
{
if (array_key_exists('matrix_other_' . $this->getId() . "_" . $matches[1], $post_data) && strlen($post_data['matrix_other_' . $this->getId() . "_" . $matches[1]]) == 0)
{
return $this->lng->txt("question_mr_no_other_answer");
}
$counter++;
if ((!is_array($value)) || (count($value) < 1))
{
return $this->lng->txt("matrix_question_checkbox_not_checked");
}
}
}
if ($counter != $this->getRowCount()) return $this->lng->txt("matrix_question_checkbox_not_checked");
break;
}
return "";
}

+ Here is the call graph for this function:

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

Definition at line 1180 of file class.SurveyMatrixQuestion.php.

References $ilDB.

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
array('integer'),
array($question_id)
);
}
SurveyMatrixQuestion::flushColumns ( )

Empties the columns list.

public

See Also
$columns

Definition at line 271 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

{
$this->columns->flushCategories();
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::flushRows ( )

Empties the row list.

public

See Also
$rows

Definition at line 314 of file class.SurveyMatrixQuestion.php.

{
$this->rows = new SurveyCategories();
}
SurveyMatrixQuestion::getAdditionalTableName ( )

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

Returns
string The additional table name public

Definition at line 962 of file class.SurveyMatrixQuestion.php.

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

{
return "svy_qst_matrix";
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getBipolarAdjective (   $a_index)

Returns one of the bipolar adjectives.

Parameters
integer$a_indexThe number of the bipolar adjective (0 for the first and 1 for the second adjective)
Returns
string The text of the bipolar adjective public

Definition at line 369 of file class.SurveyMatrixQuestion.php.

Referenced by hasBipolarAdjectives(), insertXML(), and saveToDb().

{
switch ($a_index)
{
case 1:
return (strlen($this->bipolar_adjective2)) ? $this->bipolar_adjective2 : NULL;
break;
case 0:
default:
return (strlen($this->bipolar_adjective1)) ? $this->bipolar_adjective1 : NULL;
break;
}
return NULL;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumn (   $index)

Returns the name of a column for a given index.

Parameters
integer$indexThe index of the column
Returns
array column public
See Also
$columns

Definition at line 242 of file class.SurveyMatrixQuestion.php.

Referenced by addUserSpecificResultsData(), addUserSpecificResultsExportTitles(), getCumulatedResults(), getCumulatedResultsForRow(), hasNeutralColumn(), insertXML(), and saveColumnsToDb().

{
return $this->columns->getCategory($index);
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumnCount ( )

Returns the number of columns.

Returns
integer The number of contained columns public
See Also
$columns

Definition at line 185 of file class.SurveyMatrixQuestion.php.

Referenced by addUserSpecificResultsData(), addUserSpecificResultsExportTitles(), getCumulatedResults(), getCumulatedResultsForRow(), hasNeutralColumn(), insertXML(), isComplete(), saveColumnsToDb(), and saveRandomData().

{
return $this->columns->getCategoryCount();
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumnForScale (   $scale)

Definition at line 247 of file class.SurveyMatrixQuestion.php.

Referenced by getCumulatedResults(), getCumulatedResultsForRow(), and getUserAnswers().

{
return $this->columns->getCategoryForScale($scale);
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumnHeaderPosition ( )

Definition at line 2412 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->columnHeaderPosition) ? $this->columnHeaderPosition : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumnImages ( )

Definition at line 2442 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->columnImages) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumnIndex (   $name)

Returns the index of a column with a given name.

Parameters
string$nameThe name of the column public
See Also
$columns

Definition at line 259 of file class.SurveyMatrixQuestion.php.

{
return $this->columns->getCategoryIndex($name);
}
SurveyMatrixQuestion::getColumnOrder ( )

Definition at line 2432 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->columnOrder) ? $this->columnOrder : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumnPlaceholders ( )

Get whether placeholders should be used for the column titles or not.

Returns
integer 1 for placeholders, 0 otherwise

Definition at line 2362 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->columnPlaceholders) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumns ( )

Return the columns.

Definition at line 229 of file class.SurveyMatrixQuestion.php.

References $columns.

{
}
SurveyMatrixQuestion::getColumnSeparators ( )

Gets the separators enable state for the matrix columns.

Returns
integer 1 if the separators are enabled, 0 otherwise public

Definition at line 2037 of file class.SurveyMatrixQuestion.php.

Referenced by insertXML(), and saveToDb().

{
return ($this->columnSeparators) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getCumulatedResultData (   $survey_id,
  $counter,
  $finished_ids 
)

Creates a the cumulated results data for the question.

Returns
array Data

Reimplemented from SurveyQuestion.

Definition at line 2467 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\$cumulated, SurveyQuestion\$questiontext, $result, $row, SurveyQuestion\$survey_id, SurveyQuestion\calculateCumulatedResults(), and SurveyQuestion\getQuestiontext().

{
$cumulated =& $this->calculateCumulatedResults($survey_id, $finished_ids);
$questiontext = preg_replace("/<[^>]+?>/ims", "", $this->getQuestiontext());
include_once "./Services/Utilities/classes/class.ilStr.php";
$maxlen = 75;
if (strlen($questiontext) > $maxlen + 3)
{
$questiontext = ilStr::substr($questiontext, 0, $maxlen) . "...";
}
$result = array();
$row = array(
'counter' => $counter,
'title' => $counter.'. '.$this->getTitle(),
'question' => $questiontext,
'users_answered' => $cumulated['TOTAL']['USERS_ANSWERED'],
'users_skipped' => $cumulated['TOTAL']['USERS_SKIPPED'],
'question_type' => $this->lng->txt($cumulated['TOTAL']['QUESTION_TYPE']),
'mode' => $cumulated['TOTAL']['MODE'],
'mode_nr_of_selections' => $cumulated['TOTAL']['MODE_NR_OF_SELECTIONS'],
'median' => $cumulated['TOTAL']['MEDIAN'],
'arithmetic_mean' => $cumulated['TOTAL']['ARITHMETIC_MEAN']
);
array_push($result, $row);
$maxlen -= 3;
foreach ($cumulated as $key => $value)
{
if (is_numeric($key))
{
if (strlen($value['ROW']) > $maxlen + 3)
{
$value['ROW'] = ilStr::substr($value['ROW'], 0, $maxlen) . "...";
}
$row = array(
'title' => '',
'question' => ($key+1) . ". " . $value['ROW'],
'users_answered' => $value['USERS_ANSWERED'],
'users_skipped' => $value['USERS_SKIPPED'],
'question_type' => '',
'mode' => $value["MODE"],
'mode_nr_of_selections' => $value["MODE_NR_OF_SELECTIONS"],
'median' => $value["MEDIAN"],
'arithmetic_mean' => $value["ARITHMETIC_MEAN"]
);
array_push($result, $row);
}
}
return $result;
}

+ Here is the call graph for this function:

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

Returns the cumulated results for the question.

Parameters
integer$survey_idThe database ID of the survey
Returns
integer The number of users who took part in the survey public

Definition at line 1351 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\$cumulated, $ilDB, $result, $row, SurveyQuestion\$survey_id, $total, getColumn(), getColumnCount(), getColumnForScale(), getCumulatedResultsForRow(), SurveyQuestion\getId(), getNrOfUsersAnswered(), getRowCount(), and getSubtype().

{
global $ilDB;
$question_id = $this->getId();
$result_array = array();
$cumulated = array();
$sql = "SELECT svy_answer.* FROM svy_answer".
" JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
" WHERE svy_answer.question_fi = ".$ilDB->quote($question_id, "integer").
" AND svy_finished.survey_fi = ".$ilDB->quote($survey_id, "integer");
if($finished_ids)
{
$sql .= " AND ".$ilDB->in("svy_finished.finished_id", $finished_ids, "", "integer");
}
$result = $ilDB->query($sql);
switch ($this->getSubtype())
{
case 0:
case 1:
while ($row = $ilDB->fetchAssoc($result))
{
$cumulated[$row["value"]]++;
}
asort($cumulated, SORT_NUMERIC);
end($cumulated);
break;
}
$numrows = $result->numRows();
$result_array["USERS_ANSWERED"] = $this->getNrOfUsersAnswered($survey_id, $finished_ids);
$result_array["USERS_SKIPPED"] = $nr_of_users - $this->getNrOfUsersAnswered($survey_id, $finished_ids);
if(sizeof($cumulated))
{
$prefix = "";
if (strcmp(key($cumulated), "") != 0)
{
$prefix = (key($cumulated)+1) . " - ";
}
$cat = $this->getColumnForScale(key($cumulated)+1);
$result_array["MODE"] = $prefix . $cat->title;
$result_array["MODE_VALUE"] = key($cumulated)+1;
$result_array["MODE_NR_OF_SELECTIONS"] = $cumulated[key($cumulated)];
}
for ($key = 0; $key < $this->getColumnCount(); $key++)
{
$cat = $this->getColumn($key);
$scale = $cat->scale-1;
$percentage = 0;
if ($numrows > 0)
{
$percentage = (float)((int)$cumulated[$scale]/$numrows);
}
$result_array["variables"][$key] = array("title" => $cat->title, "selected" => (int)$cumulated[$scale], "percentage" => $percentage);
}
ksort($cumulated, SORT_NUMERIC);
$median = array();
$total = 0;
foreach ($cumulated as $value => $key)
{
$total += $key;
for ($i = 0; $i < $key; $i++)
{
array_push($median, $value+1);
}
}
if ($total > 0)
{
if (($total % 2) == 0)
{
$median_value = 0.5 * ($median[($total/2)-1] + $median[($total/2)]);
if (round($median_value) != $median_value)
{
$cat = $this->getColumnForScale((int)floor($median_value));
$cat2 = $this->getColumnForScale((int)ceil($median_value));
$median_value = $median_value . "<br />" . "(" . $this->lng->txt("median_between") . " " . (floor($median_value)) . "-" . $cat->title . " " . $this->lng->txt("and") . " " . (ceil($median_value)) . "-" . $cat2->title . ")";
}
}
else
{
$median_value = $median[(($total+1)/2)-1];
}
}
else
{
$median_value = "";
}
$result_array["ARITHMETIC_MEAN"] = "";
$result_array["MEDIAN"] = $median_value;
$result_array["QUESTION_TYPE"] = "SurveyMatrixQuestion";
$cumulated_results = array();
$cumulated_results["TOTAL"] = $result_array;
for ($i = 0; $i < $this->getRowCount(); $i++)
{
$rowresult =& $this->getCumulatedResultsForRow($i, $survey_id, $nr_of_users, $finished_ids);
$cumulated_results[$i] = $rowresult;
}
return $cumulated_results;
}

+ Here is the call graph for this function:

& SurveyMatrixQuestion::getCumulatedResultsForRow (   $rowindex,
  $survey_id,
  $nr_of_users,
  $finished_ids 
)

Returns the cumulated results for a given row.

Parameters
integer$rowThe index of the row
integer$survey_idThe database ID of the survey
Returns
integer The number of users who took part in the survey public

Definition at line 1233 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\$cumulated, $ilDB, $result, $row, SurveyQuestion\$survey_id, $total, getColumn(), getColumnCount(), getColumnForScale(), SurveyQuestion\getId(), getNrOfUsersAnswered(), getRow(), and getSubtype().

Referenced by getCumulatedResults().

{
global $ilDB;
$question_id = $this->getId();
$result_array = array();
$cumulated = array();
$sql = "SELECT svy_answer.* FROM svy_answer".
" JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
" WHERE svy_answer.question_fi = ".$ilDB->quote($question_id, "integer").
" AND svy_answer.rowvalue = ".$ilDB->quote($rowindex, "integer").
" AND svy_finished.survey_fi = ".$ilDB->quote($survey_id, "integer");
if($finished_ids)
{
$sql .= " AND ".$ilDB->in("svy_finished.finished_id", $finished_ids, "", "integer");
}
$result = $ilDB->query($sql);
switch ($this->getSubtype())
{
case 0:
case 1:
while ($row = $ilDB->fetchAssoc($result))
{
$cumulated[$row["value"]]++;
// add text value to result array
if ($row["textanswer"])
{
$result_array["textanswers"][$row["value"]][] = $row["textanswer"];
}
}
// sort textanswers by value
if (is_array($result_array["textanswers"]))
{
ksort($result_array["textanswers"], SORT_NUMERIC);
}
asort($cumulated, SORT_NUMERIC);
end($cumulated);
break;
}
$numrows = $result->numRows();
$result_array["USERS_ANSWERED"] = $this->getNrOfUsersAnswered($survey_id, $finished_ids, $rowindex);
$result_array["USERS_SKIPPED"] = $nr_of_users - $result_array["USERS_ANSWERED"];
if(sizeof($cumulated))
{
$prefix = "";
if (strcmp(key($cumulated), "") != 0)
{
$prefix = (key($cumulated)+1) . " - ";
}
$cat = $this->getColumnForScale(key($cumulated)+1);
$result_array["MODE"] = $prefix . $cat->title;
$result_array["MODE_VALUE"] = key($cumulated)+1;
$result_array["MODE_NR_OF_SELECTIONS"] = $cumulated[key($cumulated)];
}
for ($key = 0; $key < $this->getColumnCount(); $key++)
{
$cat = $this->getColumn($key);
$scale = $cat->scale-1;
$percentage = 0;
if ($numrows > 0)
{
$percentage = (float)((int)$cumulated[$scale]/$numrows);
}
$result_array["variables"][$key] = array("title" => $cat->title, "selected" => (int)$cumulated[$scale], "percentage" => $percentage);
}
ksort($cumulated, SORT_NUMERIC);
$median = array();
$total = 0;
foreach ($cumulated as $value => $key)
{
$total += $key;
for ($i = 0; $i < $key; $i++)
{
array_push($median, $value+1);
}
}
if ($total > 0)
{
if (($total % 2) == 0)
{
$median_value = 0.5 * ($median[($total/2)-1] + $median[($total/2)]);
if (round($median_value) != $median_value)
{
$cat = $this->getColumnForScale((int)floor($median_value));
$cat2 = $this->getColumnForScale((int)ceil($median_value));
$median_value = $median_value . "<br />" . "(" . $this->lng->txt("median_between") . " " . (floor($median_value)) . "-" . $cat->title . " " . $this->lng->txt("and") . " " . (ceil($median_value)) . "-" . $cat2->title . ")";
}
}
else
{
$median_value = $median[(($total+1)/2)-1];
}
}
else
{
$median_value = "";
}
$result_array["ARITHMETIC_MEAN"] = "";
$result_array["MEDIAN"] = $median_value;
$result_array["QUESTION_TYPE"] = "SurveyMatrixQuestion";
$result_array["ROW"] = $this->getRow($rowindex)->title;
return $result_array;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getLayout ( )

Definition at line 2255 of file class.SurveyMatrixQuestion.php.

References $layout, hasBipolarAdjectives(), and hasNeutralColumn().

Referenced by insertXML(), and saveToDb().

{
if (!is_array($this->layout) || count($this->layout) == 0)
{
if ($this->hasBipolarAdjectives() && $this->hasNeutralColumn())
{
$this->layout = array(
"percent_row" => 30,
"percent_columns" => 40,
"percent_bipolar_adjective1" => 10,
"percent_bipolar_adjective2" => 10,
"percent_neutral" => 10
);
}
elseif ($this->hasBipolarAdjectives())
{
$this->layout = array(
"percent_row" => 30,
"percent_columns" => 50,
"percent_bipolar_adjective1" => 10,
"percent_bipolar_adjective2" => 10,
"percent_neutral" => 0
);
}
elseif ($this->hasNeutralColumn())
{
$this->layout = array(
"percent_row" => 30,
"percent_columns" => 50,
"percent_bipolar_adjective1" => 0,
"percent_bipolar_adjective2" => 0,
"percent_neutral" => 20
);
}
else
{
$this->layout = array(
"percent_row" => 30,
"percent_columns" => 70,
"percent_bipolar_adjective1" => 0,
"percent_bipolar_adjective2" => 0,
"percent_neutral" => 0
);
}
}
return $this->layout;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getLegend ( )

Get whether the legend should be shown or not.

Returns
integer Show legend

Definition at line 2382 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->legend) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getNeutralColumnSeparator ( )

Gets the separator enable state for the neutral column.

Returns
integer 1 if the separator is enabled, 0 otherwise public

Definition at line 2099 of file class.SurveyMatrixQuestion.php.

Referenced by insertXML(), and saveToDb().

{
return ($this->neutralColumnSeparator) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getNrOfUsersAnswered (   $survey_id,
  $finished_ids = null,
  $rowindex = null 
)

Returns the number of users that answered the question for a given survey.

Parameters
integer$survey_idThe database ID of the survey
Returns
integer The number of users public

Definition at line 1198 of file class.SurveyMatrixQuestion.php.

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

Referenced by getCumulatedResults(), and getCumulatedResultsForRow().

{
global $ilDB;
$sql = "SELECT svy_answer.active_fi, svy_answer.question_fi".
" FROM svy_answer".
" JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
" WHERE svy_answer.question_fi = ".$ilDB->quote($this->getId(), "integer").
" AND svy_finished.survey_fi = ".$ilDB->quote($survey_id, "integer");
if($finished_ids)
{
$sql .= " AND ".$ilDB->in("svy_finished.finished_id", $finished_ids, "", "integer");
}
if($rowindex)
{
$sql .= " AND rowvalue = ".$ilDB->quote($rowindex, "integer");
}
$result = $ilDB->query($sql);
$found = array();
while ($row = $ilDB->fetchAssoc($result))
{
$found[$row["active_fi"].$row["question_fi"]] = 1;
}
return count($found);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Creates a form property for the precondition value.

Returns
The ILIAS form element public

Reimplemented from SurveyQuestion.

Definition at line 2219 of file class.SurveyMatrixQuestion.php.

References $options, SurveyQuestion\$title, and SurveyQuestion\getPreconditionOptions().

{
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$step3 = new ilSelectInputGUI($title, $variable);
$step3->setOptions($options);
$step3->setValue($default);
return $step3;
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::getPreconditionValueOutput (   $value)

Returns the output for a precondition value.

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

Reimplemented from SurveyQuestion.

Definition at line 2208 of file class.SurveyMatrixQuestion.php.

{
return $value;
}
SurveyMatrixQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question public

Reimplemented from SurveyQuestion.

Definition at line 951 of file class.SurveyMatrixQuestion.php.

{
return "SurveyMatrixQuestion";
}
SurveyMatrixQuestion::getRandomRows ( )

Definition at line 2422 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->randomRows) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getRepeatColumnHeader ( )

Definition at line 2402 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->repeatColumnHeader) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getRow (   $a_index)

Returns a specific row.

Parameters
integer$a_indexThe index position of the row public

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

Referenced by addUserSpecificResultsData(), addUserSpecificResultsExportTitles(), getCumulatedResultsForRow(), getUserAnswers(), insertXML(), and saveRowsToDb().

{
return $this->rows->getCategory($a_index);
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getRowCount ( )

Returns the number of rows in the question.

Returns
integer The number of rows public

Definition at line 282 of file class.SurveyMatrixQuestion.php.

Referenced by addUserSpecificResultsData(), addUserSpecificResultsExportTitles(), checkUserInput(), getCumulatedResults(), insertXML(), isComplete(), saveRandomData(), and saveRowsToDb().

{
return $this->rows->getCategoryCount();
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getRowImages ( )

Definition at line 2452 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->rowImages) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getRows ( )

Definition at line 2457 of file class.SurveyMatrixQuestion.php.

References $rows.

{
return $this->rows;
}
SurveyMatrixQuestion::getRowSeparators ( )

Gets the separators enable state for the matrix rows.

Returns
integer 1 if the separators are enabled, 0 otherwise public

Definition at line 2068 of file class.SurveyMatrixQuestion.php.

Referenced by insertXML(), and saveToDb().

{
return ($this->rowSeparators) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getSingleLineRowCaption ( )

Definition at line 2392 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

{
return ($this->singleLineRowCaption) ? 1 : 0;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getSubtype ( )

Returns the subtype of the matrix question.

Returns
integer The subtype of the matrix question public

Reimplemented from SurveyQuestion.

Definition at line 1981 of file class.SurveyMatrixQuestion.php.

References $subtype.

Referenced by addUserSpecificResultsData(), addUserSpecificResultsExportTitles(), checkUserInput(), getCumulatedResults(), getCumulatedResultsForRow(), getWorkingDataFromUserInput(), insertXML(), saveToDb(), and saveUserInput().

{
}

+ Here is the caller graph for this function:

& SurveyMatrixQuestion::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 public

Definition at line 1944 of file class.SurveyMatrixQuestion.php.

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

{
global $ilDB;
$answers = array();
$sql = "SELECT svy_answer.* FROM svy_answer".
" JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
" WHERE svy_answer.question_fi = ".$ilDB->quote($this->getId(), "integer").
" AND svy_finished.survey_fi = ".$ilDB->quote($survey_id, "integer");
if($finished_ids)
{
$sql .= " AND ".$ilDB->in("svy_finished.finished_id", $finished_ids, "", "integer");
}
$sql .= " ORDER BY rowvalue, value";
$result = $ilDB->query($sql);
while ($row = $ilDB->fetchAssoc($result))
{
$column = $this->getColumnForScale($row["value"]+1);
if (!is_array($answers[$row["active_fi"]])) $answers[$row["active_fi"]] = array();
$rowobj = $this->getRow($row["rowvalue"]);
array_push($answers[$row["active_fi"]], $rowobj->title . (($rowobj->other) ? (" " . $row["textanswer"]) : "") . ": " . ($row["value"] + 1) . " - " . $column->title);
}
foreach ($answers as $key => $value)
{
$answers[$key] = implode("<br />", $value);
}
return $answers;
}

+ Here is the call graph for this function:

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

Definition at line 973 of file class.SurveyMatrixQuestion.php.

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

{
$data = array();
foreach ($post_data as $key => $value)
{
switch ($this->getSubtype())
{
case 0:
if (preg_match("/matrix_" . $this->getId() . "_(\d+)/", $key, $matches))
{
if (is_array($value))
{
foreach ($value as $val)
{
array_push($data, array("value" => $val, "rowvalue" => $matches[1], "textanswer" => $post_data['matrix_other_' . $this->getId() . '_' . $matches[1]]));
}
}
else
{
array_push($data, array("value" => $value, "rowvalue" => $matches[1], "textanswer" => $post_data['matrix_other_' . $this->getId() . '_' . $matches[1]]));
}
}
break;
case 1:
if (preg_match("/matrix_" . $this->getId() . "_(\d+)/", $key, $matches))
{
if (is_array($value))
{
foreach ($value as $val)
{
array_push($data, array("value" => $val, "rowvalue" => $matches[1], "textanswer" => $post_data['matrix_other_' . $this->getId() . '_' . $matches[1]]));
}
}
else
{
array_push($data, array("value" => $value, "rowvalue" => $matches[1], "textanswer" => $post_data['matrix_other_' . $this->getId() . '_' . $matches[1]]));
}
}
break;
}
}
return $data;
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::hasBipolarAdjectives ( )

Returns TRUE if bipolar adjectives exist.

Returns
boolean TRUE if bipolar adjectives exist, FALSE otherwise

Definition at line 2320 of file class.SurveyMatrixQuestion.php.

References getBipolarAdjective().

Referenced by getLayout().

{
if ((strlen($this->getBipolarAdjective(0))) && (strlen($this->getBipolarAdjective(1))))
{
return TRUE;
}
else
{
return FALSE;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyMatrixQuestion::hasNeutralColumn ( )

Returns TRUE if a neutral column exists.

Returns
boolean TRUE if a neutral column exists, FALSE otherwise

Definition at line 2337 of file class.SurveyMatrixQuestion.php.

References getColumn(), and getColumnCount().

Referenced by getLayout().

{
for ($i = 0; $i < $this->getColumnCount(); $i++)
{
$column = $this->getColumn($i);
if ($column->neutral && strlen($column->title)) return true;
}
return FALSE;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 2112 of file class.SurveyMatrixQuestion.php.

References setColumnSeparators(), setLayout(), setNeutralColumnSeparator(), and setRowSeparators().

{
foreach ($a_meta as $key => $value)
{
switch ($value["label"])
{
case "column_separators":
$this->setColumnSeparators($value["entry"]);
break;
case "row_separators":
$this->setRowSeparators($value["entry"]);
break;
case "layout":
$this->setLayout($value["entry"]);
break;
case "neutral_column_separator":
$this->setNeutralColumnSeparator($value["entry"]);
break;
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::importAdjectives (   $a_data)

Import bipolar adjectives from the question import file.

Returns
array $a_data Array containing the adjectives public

Reimplemented from SurveyQuestion.

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

References setBipolarAdjective().

{
$i = 0;
foreach ($a_data as $adjective)
{
if (is_numeric($adjective["label"]))
{
$this->setBipolarAdjective($adjective["label"], $adjective["text"]);
}
else
{
$this->setBipolarAdjective($i, $adjective["text"]);
}
$i++;
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::importMatrix (   $a_data)

Import matrix rows from the question import file.

Returns
array $a_data Array containing the matrix rows public

Reimplemented from SurveyQuestion.

Definition at line 2163 of file class.SurveyMatrixQuestion.php.

References $row, and addRow().

{
foreach ($a_data as $row)
{
$this->addRow($row['title'], $row['other'], $row['label']);
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::importResponses (   $a_data)

Import response data from the question import file.

Returns
array $a_data Array containing the response data public

Reimplemented from SurveyQuestion.

Definition at line 2177 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\$id, and SurveyQuestion\$material.

{
foreach ($a_data as $id => $data)
{
$column = "";
foreach ($data["material"] as $material)
{
$column .= $material["text"];
}
$this->columns->addCategory($column, null, (strcmp($data["label"], "neutral") == 0) ? true : false);
}
}
SurveyMatrixQuestion::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 public

Definition at line 753 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\addMaterialTag(), SurveyQuestion\getAuthor(), getBipolarAdjective(), getColumn(), getColumnCount(), getColumnSeparators(), SurveyQuestion\getDescription(), SurveyQuestion\getId(), getLayout(), getNeutralColumnSeparator(), SurveyQuestion\getObligatory(), SurveyQuestion\getQuestiontext(), getRow(), getRowCount(), getRowSeparators(), getSubtype(), and SurveyQuestion\getTitle().

Referenced by toXML().

{
$attrs = array(
"id" => $this->getId(),
"title" => $this->getTitle(),
"type" => $this->getQuestiontype(),
"subtype" => $this->getSubtype(),
"obligatory" => $this->getObligatory()
);
$a_xml_writer->xmlStartTag("question", $attrs);
$a_xml_writer->xmlElement("description", NULL, $this->getDescription());
$a_xml_writer->xmlElement("author", NULL, $this->getAuthor());
$a_xml_writer->xmlStartTag("questiontext");
$this->addMaterialTag($a_xml_writer, $this->getQuestiontext());
$a_xml_writer->xmlEndTag("questiontext");
$a_xml_writer->xmlStartTag("matrix");
$a_xml_writer->xmlStartTag("matrixrows");
for ($i = 0; $i < $this->getRowCount(); $i++)
{
$attrs = array(
"id" => $i
);
if (strlen($this->getRow($i)->label))
{
$attrs['label'] = $this->getRow($i)->label;
}
if ($this->getRow($i)->other)
{
$attrs['other'] = 1;
}
$a_xml_writer->xmlStartTag("matrixrow", $attrs);
$this->addMaterialTag($a_xml_writer, $this->getRow($i)->title);
$a_xml_writer->xmlEndTag("matrixrow");
}
$a_xml_writer->xmlEndTag("matrixrows");
$a_xml_writer->xmlStartTag("responses");
if (strlen($this->getBipolarAdjective(0)) && (strlen($this->getBipolarAdjective(1))))
{
$a_xml_writer->xmlStartTag("bipolar_adjectives");
$attribs = array(
"label" => "0"
);
$a_xml_writer->xmlElement("adjective", $attribs, $this->getBipolarAdjective(0));
$attribs = array(
"label" => "1"
);
$a_xml_writer->xmlElement("adjective", $attribs, $this->getBipolarAdjective(1));
$a_xml_writer->xmlEndTag("bipolar_adjectives");
}
for ($i = 0; $i < $this->getColumnCount(); $i++)
{
$attrs = array(
"id" => $i
);
if ($this->getColumn($i)->neutral)
{
$attrs['label'] = 'neutral';
}
switch ($this->getSubtype())
{
case 0:
$a_xml_writer->xmlStartTag("response_single", $attrs);
break;
case 1:
$a_xml_writer->xmlStartTag("response_multiple", $attrs);
break;
}
$this->addMaterialTag($a_xml_writer, $this->getColumn($i)->title);
switch ($this->getSubtype())
{
case 0:
$a_xml_writer->xmlEndTag("response_single");
break;
case 1:
$a_xml_writer->xmlEndTag("response_multiple");
break;
}
}
$a_xml_writer->xmlEndTag("responses");
$a_xml_writer->xmlEndTag("matrix");
if (count($this->material))
{
if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $this->material["internal_link"], $matches))
{
$attrs = array(
"label" => $this->material["title"]
);
$a_xml_writer->xmlStartTag("material", $attrs);
$intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
if (strcmp($matches[1], "") != 0)
{
$intlink = $this->material["internal_link"];
}
$a_xml_writer->xmlElement("mattext", NULL, $intlink);
$a_xml_writer->xmlEndTag("material");
}
}
$a_xml_writer->xmlStartTag("metadata");
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "column_separators");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getColumnSeparators());
$a_xml_writer->xmlEndTag("metadatafield");
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "row_separators");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getRowSeparators());
$a_xml_writer->xmlEndTag("metadatafield");
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "neutral_column_separator");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getNeutralColumnSeparator());
$a_xml_writer->xmlEndTag("metadatafield");
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "layout");
$a_xml_writer->xmlElement("fieldentry", NULL, serialize($this->getLayout()));
$a_xml_writer->xmlEndTag("metadatafield");
$a_xml_writer->xmlEndTag("metadata");
$a_xml_writer->xmlEndTag("question");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyMatrixQuestion::isComplete ( )

Returns 1 if the question is complete for use.

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

Reimplemented from SurveyQuestion.

Definition at line 535 of file class.SurveyMatrixQuestion.php.

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

{
if (
strlen($this->getTitle()) &&
strlen($this->getAuthor()) &&
strlen($this->getQuestiontext()) &&
$this->getColumnCount() &&
$this->getRowCount()
)
{
return 1;
}
else
{
return 0;
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::loadFromDb (   $id)

Loads a SurveyMatrixQuestion object from the database.

Parameters
integer$idThe database id of the matrix question public

Reimplemented from SurveyQuestion.

Definition at line 465 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\$id, $ilDB, $result, $row, ilRTE\_replaceMediaObjectImageSrc(), addRow(), flushColumns(), getAdditionalTableName(), SurveyQuestion\setAuthor(), setBipolarAdjective(), setColumnHeaderPosition(), setColumnImages(), setColumnOrder(), setColumnPlaceholders(), setColumnSeparators(), SurveyQuestion\setComplete(), SurveyQuestion\setDescription(), SurveyQuestion\setId(), setLayout(), setLegend(), setNeutralColumnSeparator(), SurveyQuestion\setObjId(), SurveyQuestion\setObligatory(), SurveyQuestion\setOriginalId(), SurveyQuestion\setOwner(), SurveyQuestion\setQuestiontext(), setRandomRows(), setRepeatColumnHeader(), setRowImages(), setRowSeparators(), setSingleLineRowCaption(), setSubtype(), and SurveyQuestion\setTitle().

{
global $ilDB;
$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",
array('integer'),
array($id)
);
if ($result->numRows() == 1)
{
$data = $ilDB->fetchAssoc($result);
$this->setId($data["question_id"]);
$this->setTitle($data["title"]);
$this->label = $data['label'];
$this->setDescription($data["description"]);
$this->setObjId($data["obj_fi"]);
$this->setAuthor($data["author"]);
$this->setOwner($data["owner_fi"]);
include_once("./Services/RTE/classes/class.ilRTE.php");
$this->setQuestiontext(ilRTE::_replaceMediaObjectImageSrc($data["questiontext"], 1));
$this->setObligatory($data["obligatory"]);
$this->setComplete($data["complete"]);
$this->setOriginalId($data["original_id"]);
$this->setSubtype($data["subtype"]);
$this->setRowSeparators($data["row_separators"]);
$this->setNeutralColumnSeparator($data["neutral_column_separator"]);
$this->setColumnSeparators($data["column_separators"]);
$this->setColumnPlaceholders($data["column_placeholders"]);
$this->setLegend($data["legend"]);
$this->setSingleLineRowCaption($data["singleline_row_caption"]);
$this->setRepeatColumnHeader($data["repeat_column_header"]);
$this->setColumnHeaderPosition($data["column_header_position"]);
$this->setRandomRows($data["random_rows"]);
$this->setColumnOrder($data["column_order"]);
$this->setColumnImages($data["column_images"]);
$this->setRowImages($data["row_images"]);
$this->setBipolarAdjective(0, $data["bipolar_adjective1"]);
$this->setBipolarAdjective(1, $data["bipolar_adjective2"]);
$this->setLayout($data["layout"]);
$this->flushColumns();
$result = $ilDB->queryF("SELECT svy_variable.*, svy_category.title, svy_category.neutral FROM svy_variable, svy_category WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id ORDER BY sequence ASC",
array('integer'),
array($id)
);
if ($result->numRows() > 0)
{
while ($data = $ilDB->fetchAssoc($result))
{
$this->columns->addCategory($data["title"], $data["other"], $data["neutral"], null, ($data['scale']) ? $data['scale'] : ($data['sequence'] + 1));
}
}
$result = $ilDB->queryF("SELECT * FROM svy_qst_matrixrows WHERE question_fi = %s ORDER BY sequence",
array('integer'),
array($id)
);
while ($row = $ilDB->fetchAssoc($result))
{
$this->addRow($row["title"], $row['other'], $row['label']);
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::moveRowDown (   $index)

Definition at line 335 of file class.SurveyMatrixQuestion.php.

{
$this->rows->moveCategoryDown($index);
}
SurveyMatrixQuestion::moveRowUp (   $index)

Definition at line 330 of file class.SurveyMatrixQuestion.php.

{
$this->rows->moveCategoryUp($index);
}
SurveyMatrixQuestion::removeColumn (   $index)

Removes a column from the list of columns.

Parameters
integer$indexThe index of the column to be removed public
See Also
$columns

Definition at line 197 of file class.SurveyMatrixQuestion.php.

{
$this->columns->removeCategory($index);
}
SurveyMatrixQuestion::removeColumns (   $array)

Removes many columns from the list of columns.

Parameters
array$arrayAn array containing the index positions of the columns to be removed public
See Also
$columns

Definition at line 209 of file class.SurveyMatrixQuestion.php.

{
$this->columns->removeCategories($array);
}
SurveyMatrixQuestion::removeColumnWithName (   $name)

Removes a column from the list of columns.

Parameters
string$nameThe name of the column to be removed public
See Also
$columns

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

{
$this->columns->removeCategoryWithName($name);
}
SurveyMatrixQuestion::removeRow (   $index)

Removes a row.

Parameters
integer$indexThe index of the row to be removed

Definition at line 357 of file class.SurveyMatrixQuestion.php.

{
$this->rows->removeCategory($index);
}
SurveyMatrixQuestion::removeRows (   $array)

Removes rows from the question.

Parameters
array$arrayAn array containing the index positions of the rows to be removed public
See Also
$rows

Definition at line 347 of file class.SurveyMatrixQuestion.php.

{
$this->rows->removeCategories($array);
}
SurveyMatrixQuestion::saveBipolarAdjectives (   $adjective1,
  $adjective2 
)

Definition at line 609 of file class.SurveyMatrixQuestion.php.

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

{
global $ilDB;
$affectedRows = $ilDB->manipulateF("UPDATE " . $this->getAdditionalTableName() . " SET bipolar_adjective1 = %s, bipolar_adjective2 = %s WHERE question_fi = %s",
array('text', 'text', 'integer'),
array((strlen($adjective1)) ? $adjective1 : NULL, (strlen($adjective2)) ? $adjective2 : NULL, $this->getId())
);
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::saveColumnsToDb (   $original_id = "")

Definition at line 665 of file class.SurveyMatrixQuestion.php.

References $ilDB, getColumn(), getColumnCount(), SurveyQuestion\getId(), saveColumnToDb(), and SurveyQuestion\saveCompletionStatus().

Referenced by saveToDb(), and syncWithOriginal().

{
global $ilDB;
// save columns
$question_id = $this->getId();
if (strlen($original_id))
{
$question_id = $original_id;
}
// delete existing column relations
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_variable WHERE question_fi = %s",
array('integer'),
array($question_id)
);
// create new column relations
for ($i = 0; $i < $this->getColumnCount(); $i++)
{
$cat = $this->getColumn($i);
$column_id = $this->saveColumnToDb($cat->title, $cat->neutral);
$next_id = $ilDB->nextId('svy_variable');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, other, sequence, scale, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','float','integer','integer', 'integer','integer'),
array($next_id, $column_id, $question_id, ($i + 1), $cat->other, $i, ($cat->scale > 0) ? $cat->scale : null, time())
);
}
$this->saveCompletionStatus($original_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyMatrixQuestion::saveColumnToDb (   $columntext,
  $neutral = 0 
)

Saves a column to the database.

Parameters
string$columntextThe text of the column
Returns
integer The database ID of the column public
See Also
$columns

Definition at line 627 of file class.SurveyMatrixQuestion.php.

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

Referenced by saveColumnsToDb().

{
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($columntext, $neutral, $ilUser->getId())
);
$insert = FALSE;
$returnvalue = "";
if ($result->numRows())
{
$insert = TRUE;
while ($row = $ilDB->fetchAssoc($result))
{
if (strcmp($row["title"], $columntext) == 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, defaultvalue, owner_fi, neutral, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
array('integer', 'text', 'text', 'integer', 'text', 'integer'),
array($next_id, $columntext, 0, $ilUser->getId(), $neutral, time())
);
$returnvalue = $next_id;
}
return $returnvalue;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::saveLayout (   $percent_row,
  $percent_columns,
  $percent_bipolar_adjective1 = "",
  $percent_bipolar_adjective2 = "",
  $percent_neutral 
)

Saves the layout of a matrix question.

Parameters
double$percent_rowThe width in percent for the matrix rows
double$percent_columnsThe width in percent for the matrix columns
double$percent_bipolar_adjective1The width in percent for the first bipolar adjective
double$percent_bipolar_adjective2The width in percent for the second bipolar adjective
Returns
void

Definition at line 2238 of file class.SurveyMatrixQuestion.php.

References $ilDB, $layout, getAdditionalTableName(), and SurveyQuestion\getId().

{
global $ilDB;
$layout = array(
"percent_row" => $percent_row,
"percent_columns" => $percent_columns,
"percent_bipolar_adjective1" => $percent_bipolar_adjective1,
"percent_bipolar_adjective2" => $percent_bipolar_adjective2,
"percent_neutral" => $percent_neutral
);
$affectedRows = $ilDB->manipulateF("UPDATE " . $this->getAdditionalTableName() . " SET layout = %s WHERE question_fi = %s",
array('text', 'integer'),
array(serialize($layout), $this->getId())
);
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::savePhrase (   $title)

Saves a set of columns to a default phrase.

Parameters
array$phrasesThe database ids of the seleted phrases
string$titleThe title of the default phrase public

Definition at line 915 of file class.SurveyMatrixQuestion.php.

References $_SESSION, $ilDB, $ilUser, and SurveyQuestion\$title.

{
global $ilUser;
global $ilDB;
$next_id = $ilDB->nextId('svy_phrase');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_phrase (phrase_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
array('integer','text','text','integer','integer'),
array($next_id, $title, 1, $ilUser->getId(), time())
);
$phrase_id = $next_id;
$counter = 1;
foreach ($_SESSION['save_phrase_data'] as $data)
{
$next_id = $ilDB->nextId('svy_category');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp, neutral) VALUES (%s, %s, %s, %s, %s, %s)",
array('integer','text','text','integer','integer','text'),
array($next_id, $data['answer'], 1, $ilUser->getId(), time(), $data['neutral'])
);
$category_id = $next_id;
$next_id = $ilDB->nextId('svy_phrase_cat');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence, other, scale) VALUES (%s, %s, %s, %s, %s, %s)",
array('integer', 'integer', 'integer','integer', 'integer', 'integer'),
array($next_id, $phrase_id, $category_id, $counter, ($data['other']) ? 1 : 0, $data['scale'])
);
$counter++;
}
}
SurveyMatrixQuestion::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 1074 of file class.SurveyMatrixQuestion.php.

References $ilDB, $row, getColumnCount(), SurveyQuestion\getId(), and getRowCount().

{
global $ilDB;
$columncount = $this->getColumnCount();
for ($row = 0; $row < $this->getRowCount(); $row++)
{
if ($this->getSubType() == 1)
{
// multiple responses
for ($i = 0; $i < $columncount; $i++)
{
if (rand(0,1))
{
$next_id = $ilDB->nextId('svy_answer');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, rowvalue, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','float','text','integer','integer'),
array($next_id, $this->getId(), $active_id, $i, NULL, $row, time())
);
}
}
}
else
{
// single responses
$category = rand(0, $columncount-1);
$next_id = $ilDB->nextId('svy_answer');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, rowvalue, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','float','text','integer','integer'),
array($next_id, $this->getId(), $active_id, $category, NULL, $row, time())
);
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::saveRowsToDb (   $original_id = "")

Definition at line 695 of file class.SurveyMatrixQuestion.php.

References $ilDB, $row, SurveyQuestion\getId(), getRow(), getRowCount(), and SurveyQuestion\saveCompletionStatus().

Referenced by saveToDb(), and syncWithOriginal().

{
global $ilDB;
// save rows
$question_id = $this->getId();
if (strlen($original_id))
{
$question_id = $original_id;
}
// delete existing rows
$affectedRows = $ilDB->manipulateF("DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
array('integer'),
array($question_id)
);
// create new rows
for ($i = 0; $i < $this->getRowCount(); $i++)
{
$row = $this->getRow($i);
$next_id = $ilDB->nextId('svy_qst_matrixrows');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_qst_matrixrows (id_svy_qst_matrixrows, title, label, other, sequence, question_fi) VALUES (%s, %s, %s, %s, %s, %s)",
array('integer','text','text','integer','integer','integer'),
array($next_id, $row->title, $row->label, ($row->other) ? 1 : 0, $i, $question_id)
);
}
$this->saveCompletionStatus($original_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyMatrixQuestion::saveToDb (   $original_id = NULL,
  $withanswers = true 
)

Saves a SurveyMatrixQuestion object to a database.

public

Definition at line 558 of file class.SurveyMatrixQuestion.php.

References $ilDB, getAdditionalTableName(), getBipolarAdjective(), getColumnHeaderPosition(), getColumnImages(), getColumnOrder(), getColumnPlaceholders(), getColumnSeparators(), SurveyQuestion\getId(), getLayout(), getLegend(), getNeutralColumnSeparator(), getRandomRows(), getRepeatColumnHeader(), getRowImages(), getRowSeparators(), getSingleLineRowCaption(), getSubtype(), saveColumnsToDb(), SurveyQuestion\saveMaterial(), and saveRowsToDb().

{
global $ilDB;
$affectedRows = parent::saveToDb($original_id);
if ($affectedRows == 1)
{
$affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
array('integer'),
array($this->getId())
);
$affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (
question_fi, subtype, column_separators, row_separators, neutral_column_separator,column_placeholders,
legend, singleline_row_caption, repeat_column_header, column_header_position, random_rows,
column_order, column_images, row_images, bipolar_adjective1, bipolar_adjective2, layout, tstamp)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
array(
'integer', 'integer', 'text', 'text', 'text', 'integer', 'text', 'text', 'text',
'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer'
),
array(
$this->getId(),
$this->getSubtype(),
$this->getRowSeparators(),
$this->getLegend(),
$this->getRandomRows(),
$this->getColumnOrder(),
$this->getColumnImages(),
$this->getRowImages(),
serialize($this->getLayout()),
time()
)
);
// saving material uris in the database
$this->saveMaterial();
$this->saveColumnsToDb();
$this->saveRowsToDb();
}
}

+ Here is the call graph for this function:

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

Definition at line 1108 of file class.SurveyMatrixQuestion.php.

References $ilDB, SurveyQuestion\getId(), and getSubtype().

{
global $ilDB;
$answer_data = array();
// gather data
switch ($this->getSubtype())
{
case 0:
foreach ($post_data as $key => $value)
{
if (preg_match("/matrix_" . $this->getId() . "_(\d+)/", $key, $matches))
{
if(strlen($value))
{
$other_value = (array_key_exists('matrix_other_' . $this->getId() . '_' . $matches[1], $post_data))
? ($post_data['matrix_other_' . $this->getId() . '_' . $matches[1]])
: null;
$answer_data[] = array("value"=>$value,
"textanswer"=>$other_value,
"rowvalue"=>$matches[1]);
}
}
}
break;
case 1:
foreach ($post_data as $key => $value)
{
if (preg_match("/matrix_" . $this->getId() . "_(\d+)/", $key, $matches))
{
$other_value = (array_key_exists('matrix_other_' . $this->getId() . '_' . $matches[1], $post_data))
? ($post_data['matrix_other_' . $this->getId() . '_' . $matches[1]])
: null;
foreach ($value as $checked)
{
$answer_data[] = array("value"=>$checked,
"textanswer"=>$other_value,
"rowvalue"=>$matches[1]);
}
}
}
break;
}
if ($a_return)
{
return $answer_data;
}
// #16387 - only if any input
if(sizeof($answer_data))
{
// save data
foreach ($answer_data as $item)
{
$next_id = $ilDB->nextId('svy_answer');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, rowvalue, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','float','text','integer','integer'),
array($next_id, $this->getId(), $active_id, $item['value'], $item['textanswer'], $item['rowvalue'], time())
);
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::setBipolarAdjective (   $a_index,
  $a_value 
)

Sets one of the bipolar adjectives.

Parameters
integer$a_indexThe number of the bipolar adjective (0 for the first and 1 for the second adjective)
string$a_valueThe text of the bipolar adjective public

Definition at line 391 of file class.SurveyMatrixQuestion.php.

Referenced by importAdjectives(), and loadFromDb().

{
switch ($a_index)
{
case 1:
$this->bipolar_adjective2 = $a_value;
break;
case 0:
default:
$this->bipolar_adjective1 = $a_value;
break;
}
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setColumnHeaderPosition (   $a_value)

Definition at line 2407 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

{
$this->columnHeaderPosition = $a_value;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setColumnImages (   $a_value = 0)

Definition at line 2437 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setColumnOrder (   $a_value)

Definition at line 2427 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

{
$this->columnOrder = $a_value;
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setColumnPlaceholders (   $a_value = 0)

Set whether placeholders should be used for the column titles or not.

Parameters
integer$a_value1 for placeholders, 0 otherwise

Definition at line 2352 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setColumnSeparators (   $enable = 0)

Enables/Disables separators for the matrix columns.

Parameters
integer$enable1 if the separators should be enabled, 0 otherwise public

Definition at line 2017 of file class.SurveyMatrixQuestion.php.

Referenced by importAdditionalMetadata(), and loadFromDb().

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

+ Here is the caller graph for this function:

& SurveyMatrixQuestion::setExportCumulatedCVS ( $eval_data,
  $export_label 
)

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

Definition at line 1544 of file class.SurveyMatrixQuestion.php.

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

{
$result = array();
foreach ($eval_data as $evalkey => $evalvalue)
{
$csvrow = array();
if (is_numeric($evalkey))
{
array_push($csvrow, "");
array_push($csvrow, $evalvalue["ROW"]);
array_push($csvrow, "");
}
else
{
switch ($export_label)
{
case 'label_only':
array_push($csvrow, $this->label);
break;
case 'title_only':
array_push($csvrow, $this->getTitle());
break;
default:
array_push($csvrow, $this->getTitle());
array_push($csvrow, $this->label);
break;
}
array_push($csvrow, strip_tags($this->getQuestiontext()));
array_push($csvrow, $this->lng->txt($evalvalue["QUESTION_TYPE"]));
}
array_push($csvrow, $evalvalue["USERS_ANSWERED"]);
array_push($csvrow, $evalvalue["USERS_SKIPPED"]);
array_push($csvrow, $evalvalue["MODE"]);
array_push($csvrow, $evalvalue["MODE_NR_OF_SELECTIONS"]);
array_push($csvrow, $evalvalue["MEDIAN"]);
array_push($csvrow, $evalvalue["ARITHMETIC_MEAN"]);
array_push($result, $csvrow);
}
return $result;
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::setExportCumulatedXLS ( $worksheet,
$format_title,
$format_bold,
$eval_data,
  $row,
  $export_label 
)

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

Definition at line 1468 of file class.SurveyMatrixQuestion.php.

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

{
include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
$column = 0;
switch ($export_label)
{
case 'label_only':
$worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->label));
break;
case 'title_only':
$worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->getTitle()));
break;
default:
$worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->getTitle()));
$column++;
$worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->label));
break;
}
$column++;
$worksheet->writeString($row, $column, ilExcelUtils::_convert_text(strip_tags($this->getQuestiontext())));
$column++;
$worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->lng->txt($eval_data["TOTAL"]["QUESTION_TYPE"])));
$column++;
$worksheet->write($row, $column, $eval_data["TOTAL"]["USERS_ANSWERED"]);
$column++;
$worksheet->write($row, $column, $eval_data["TOTAL"]["USERS_SKIPPED"]);
$column++;
$worksheet->write($row, $column, ilExcelUtils::_convert_text($eval_data["TOTAL"]["MODE_VALUE"]));
$column++;
$worksheet->write($row, $column, ilExcelUtils::_convert_text($eval_data["TOTAL"]["MODE"]));
$column++;
$worksheet->write($row, $column, $eval_data["TOTAL"]["MODE_NR_OF_SELECTIONS"]);
$column++;
$worksheet->write($row, $column, ilExcelUtils::_convert_text(str_replace("<br />", " ", $eval_data["TOTAL"]["MEDIAN"])));
$column++;
$worksheet->write($row, $column, $eval_data["TOTAL"]["ARITHMETIC_MEAN"]);
$row++;
$add = 0;
switch ($export_label)
{
case 'label_only':
case 'title_only':
break;
default:
$add = 1;
break;
}
foreach ($eval_data as $evalkey => $evalvalue)
{
if (is_numeric($evalkey))
{
$worksheet->writeString($row, 1+$add, ilExcelUtils::_convert_text($evalvalue["ROW"]));
$worksheet->write($row, 3+$add, $evalvalue["USERS_ANSWERED"]);
$worksheet->write($row, 4+$add, $evalvalue["USERS_SKIPPED"]);
$worksheet->write($row, 5+$add, ilExcelUtils::_convert_text($evalvalue["MODE_VALUE"]));
$worksheet->write($row, 6+$add, ilExcelUtils::_convert_text($evalvalue["MODE"]));
$worksheet->write($row, 7+$add, $evalvalue["MODE_NR_OF_SELECTIONS"]);
$worksheet->write($row, 8+$add, ilExcelUtils::_convert_text(str_replace("<br />", " ", $evalvalue["MEDIAN"])));
$worksheet->write($row, 9+$add, $evalvalue["ARITHMETIC_MEAN"]);
$row++;
}
}
return $row;
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::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 public

Reimplemented from SurveyQuestion.

Definition at line 1594 of file class.SurveyMatrixQuestion.php.

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

{
include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
$worksheet =& $workbook->addWorksheet();
$rowcounter = 0;
switch ($export_label)
{
case 'label_only':
$worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold);
$worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->label));
break;
case 'title_only':
$worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
$worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
break;
default:
$worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
$worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
$rowcounter++;
$worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold);
$worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->label));
break;
}
$rowcounter++;
$worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold);
$worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->getQuestiontext()));
$rowcounter++;
$worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold);
$worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())));
$rowcounter++;
$worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold);
$worksheet->write($rowcounter, 1, $eval_data["TOTAL"]["USERS_ANSWERED"]);
$rowcounter++;
$worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold);
$worksheet->write($rowcounter, 1, $eval_data["TOTAL"]["USERS_SKIPPED"]);
$rowcounter++;
preg_match("/(.*?)\s+-\s+(.*)/", $eval_data["TOTAL"]["MODE"], $matches);
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold);
$worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[1]));
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold);
$worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[2]));
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold);
$worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["TOTAL"]["MODE_NR_OF_SELECTIONS"]));
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median")), $format_bold);
$worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text(str_replace("<br />", " ", $eval_data["TOTAL"]["MEDIAN"])));
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("categories")), $format_bold);
$worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_title);
$worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title);
$worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title);
$worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections")), $format_title);
foreach ($eval_data["TOTAL"]["variables"] as $key => $value)
{
$worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["title"]));
$worksheet->write($rowcounter, 2, $key+1);
$worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($value["selected"]));
$worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($value["percentage"]), $format_percent);
}
foreach ($eval_data as $evalkey => $evalvalue)
{
if (is_numeric($evalkey))
{
$worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("row")), $format_bold);
$worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($evalvalue["ROW"]));
$worksheet->writeString($rowcounter + 1, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold);
$worksheet->write($rowcounter + 1, 1, $evalvalue["USERS_ANSWERED"]);
$worksheet->writeString($rowcounter + 2, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold);
$worksheet->write($rowcounter + 2, 1, $evalvalue["USERS_SKIPPED"]);
$rowcounter = $rowcounter + 3;
preg_match("/(.*?)\s+-\s+(.*)/", $evalvalue["MODE"], $matches);
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold);
$worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[1]));
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold);
$worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[2]));
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold);
$worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($evalvalue["MODE_NR_OF_SELECTIONS"]));
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median")), $format_bold);
$worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text(str_replace("<br />", " ", $evalvalue["MEDIAN"])));
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("categories")), $format_bold);
$worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_title);
$worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title);
$worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title);
$worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections")), $format_title);
foreach ($evalvalue["variables"] as $key => $value)
{
$worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["title"]));
$worksheet->write($rowcounter, 2, $key+1);
$worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($value["selected"]));
$worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($value["percentage"]), $format_percent);
}
// add text answers to detailed results
if (is_array($evalvalue["textanswers"]))
{
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("freetext_answers")), $format_bold);
$worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_title);
$worksheet->write($rowcounter++, 2, ilExcelUtils::_convert_text($this->lng->txt("answer")), $format_title);
foreach ($evalvalue["textanswers"] as $key => $answers)
{
$title = $evalvalue["variables"][$key]["title"];
foreach ($answers as $answer)
{
$worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($title));
$worksheet->write($rowcounter++, 2, ilExcelUtils::_convert_text($answer));
}
}
}
}
}
// out compressed 2D-Matrix
$format_center =& $workbook->addFormat();
$format_center->setColor('black');
$format_center->setAlign('center');
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("overview")), $format_bold);
// title row with variables
$rowcounter++;
$counter = 0;
$worksheet->write($rowcounter, $counter, "", $format_title);
foreach ($eval_data["TOTAL"]["variables"] as $variable)
{
$worksheet->write($rowcounter, 1+$counter, ilExcelUtils::_convert_text($variable["title"]), $format_title);
$counter++;
}
$rowcounter++;
// rows with variable values
foreach ($eval_data as $index => $data)
{
if (is_numeric($index))
{
$worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($data["ROW"]), $format_title);
$counter = 1;
foreach ($data["variables"] as $vardata)
{
$worksheet->write($rowcounter, $counter, $vardata["selected"], $format_center);
$counter++;
}
$rowcounter++;
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::setLayout (   $layout)

Definition at line 2303 of file class.SurveyMatrixQuestion.php.

References $layout.

Referenced by importAdditionalMetadata(), and loadFromDb().

{
if (is_array($layout))
{
$this->layout = $layout;
}
else
{
$this->layout = unserialize($layout);
}
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setLegend (   $a_value = 0)

Set whether the legend should be shown or not.

Parameters
integer$a_valueShow legend

Definition at line 2372 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setNeutralColumnSeparator (   $enable = 0)

Enables/Disables a separator for the neutral column.

Parameters
integer$enable1 if the separator should be enabled, 0 otherwise public

Definition at line 2079 of file class.SurveyMatrixQuestion.php.

Referenced by importAdditionalMetadata(), and loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setRandomRows (   $a_value = 0)

Definition at line 2417 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setRepeatColumnHeader (   $a_value = 0)

Definition at line 2397 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setRowImages (   $a_value = 0)

Definition at line 2447 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setRowSeparators (   $enable = 0)

Enables/Disables separators for the matrix rows.

Parameters
integer$enable1 if the separators should be enabled, 0 otherwise public

Definition at line 2048 of file class.SurveyMatrixQuestion.php.

Referenced by importAdditionalMetadata(), and loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setSingleLineRowCaption (   $a_value = 0)

Definition at line 2387 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setSubtype (   $a_subtype = 0)

Sets the subtype of the matrix question.

Returns
integer $a_subtype The subtype of the matrix question public

Reimplemented from SurveyQuestion.

Definition at line 1992 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

{
switch ($a_subtype)
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
$this->subtype = $a_subtype;
break;
case 0:
default:
$this->subtype = 0;
break;
}
}

+ Here is the caller graph for this function:

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

SurveyMatrixQuestion constructor The constructor takes possible arguments an creates an instance of the SurveyMatrixQuestion 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 158 of file class.SurveyMatrixQuestion.php.

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

{
$this->subtype = 0;
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
$this->columns = new SurveyCategories();
$this->rows = new SurveyCategories();
$this->bipolar_adjective1 = "";
$this->bipolar_adjective2 = "";
$this->rowSeparators = 0;
$this->columnSeparators = 0;
$this->neutralColumnSeparator = 1;
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::syncWithOriginal ( )

Reimplemented from SurveyQuestion.

Definition at line 882 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\getOriginalId(), saveColumnsToDb(), and saveRowsToDb().

{
if ($this->getOriginalId())
{
$this->saveColumnsToDb($this->getOriginalId());
$this->saveRowsToDb($this->getOriginalId());
}
}

+ Here is the call graph for this function:

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

Returns an xml representation of the question.

Returns
string The xml representation of the question public

Definition at line 730 of file class.SurveyMatrixQuestion.php.

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

{
include_once("./Services/Xml/classes/class.ilXmlWriter.php");
$a_xml_writer = new ilXmlWriter;
$a_xml_writer->xmlHeader();
$this->insertXML($a_xml_writer, $a_include_header, $obligatory_state);
$xml = $a_xml_writer->xmlDumpMem(FALSE);
if (!$a_include_header)
{
$pos = strpos($xml, "?>");
$xml = substr($xml, $pos + 2);
}
return $xml;
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::usableForPrecondition ( )

Returns if the question is usable for preconditions.

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

Reimplemented from SurveyQuestion.

Definition at line 2196 of file class.SurveyMatrixQuestion.php.

{
return FALSE;
}

Field Documentation

SurveyMatrixQuestion::$bipolar_adjective1

Definition at line 56 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$bipolar_adjective2

Definition at line 63 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$columnHeaderPosition

Definition at line 114 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$columnImages

Definition at line 125 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$columnOrder

Definition at line 123 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$columnPlaceholders

Definition at line 101 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$columns

Definition at line 42 of file class.SurveyMatrixQuestion.php.

Referenced by getColumns().

SurveyMatrixQuestion::$columnSeparators

Definition at line 71 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$layout

Definition at line 94 of file class.SurveyMatrixQuestion.php.

Referenced by getLayout(), saveLayout(), and setLayout().

SurveyMatrixQuestion::$legend

Definition at line 108 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$neutralColumnSeparator

Definition at line 87 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$openRows

Definition at line 129 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$randomRows

Definition at line 121 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$repeatColumnHeader

Definition at line 112 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$rowImages

Definition at line 127 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$rows

Definition at line 49 of file class.SurveyMatrixQuestion.php.

Referenced by getRows().

SurveyMatrixQuestion::$rowSeparators

Definition at line 79 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$singleLineRowCaption

Definition at line 110 of file class.SurveyMatrixQuestion.php.

SurveyMatrixQuestion::$subtype

Definition at line 146 of file class.SurveyMatrixQuestion.php.

Referenced by getSubtype().


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