ILIAS  Release_4_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.
 getNeutralColumn ()
 Returns the text of the neutral column.
 getNeutralColumnIndex ()
 Returns the index of the neutral column.
 setNeutralColumn ($a_text)
 Sets the text of the neutral column.
 getColumnCount ()
 Returns the number of columns.
 addColumnAtPosition ($columnname, $position)
 Adds a column at a given position.
 addColumn ($columnname)
 Adds a column.
 addColumnArray ($columns)
 Adds a column array.
 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.
 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)
 Adds a row to the question.
 addRowAtPosition ($a_text, $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 ($phrases, $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)
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database.
 getNrOfUsersAnswered ($survey_id)
 Returns the number of users that answered the question for a given survey.
getCumulatedResultsForRow ($rowindex, $survey_id, $nr_of_users)
 Returns the cumulated results for a given row.
getCumulatedResults ($survey_id, $nr_of_users)
 Returns the cumulated results for the question.
 setExportCumulatedXLS (&$worksheet, &$format_title, &$format_bold, &$eval_data, $row)
 Creates the Excel output for the cumulated results of this question.
setExportCumulatedCVS (&$eval_data)
 Creates the CSV output for the cumulated results of this question.
 setExportDetailsXLS (&$workbook, &$format_title, &$format_bold, &$eval_data)
 Creates an Excel worksheet for the detailed cumulated results of this question.
 addUserSpecificResultsExportTitles (&$a_array)
 Adds the entries for the title row of the user specific results.
 addUserSpecificResultsData (&$a_array, &$resultset)
 Adds the values for the user specific results export for a given user.
getUserAnswers ($survey_id)
 Returns an array containing all answers to this question in a given survey.
 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.
 outChart ($survey_id, $type="")
 Creates an image visualising the results of the question.
 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)
 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)
 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="")
 _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)
 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.
 getAvailableRelations ()
 Returns the available relations for the question.
 getPreconditionSelectValue ($default="")
 Creates a value selection for preconditions.
 setOriginalId ($original_id)
 getOriginalId ()
 getMaterial ()

Data Fields

 $columns
 $neutralColumn
 $rows
 $bipolar_adjective1
 $bipolar_adjective2
 $columnSeparators
 $rowSeparators
 $neutralColumnSeparator
 $layout
 $columnPlaceholders
 $legend
 $singleLineRowCaption
 $repeatColumnHeader
 $columnHeaderPosition
 $randomRows
 $columnOrder
 $columnImages
 $rowImages
 $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.
- Protected Member Functions inherited from SurveyQuestion
calculateCumulatedResults ($survey_id)
- 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 36 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 551 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::addColumn (   $columnname)

Adds a column.

Parameters
integer$columnnameThe name of the column
integer$neutralIndicates if the column is a neutral column public
See Also
$columns

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

Referenced by addPhrase(), addStandardNumbers(), importResponses(), and loadFromDb().

{
$this->columns->addCategory($columnname);
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::addColumnArray (   $columns)

Adds a column array.

Parameters
array$columnsAn array with columns public
See Also
$columns

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

References $columns.

{
$this->columns->addCategoryArray($columns);
}
SurveyMatrixQuestion::addColumnAtPosition (   $columnname,
  $position 
)

Adds a column at a given position.

Parameters
string$columnnameThe name of the column
integer$positionThe position of the column (starting with index 0) public
See Also
$columns

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

{
$this->columns->addCategoryAtPosition($columnname, $position);
}
SurveyMatrixQuestion::addPhrase (   $phrase_id)

Adds a phrase to the question.

Parameters
integer$phrase_idThe database id of the given phrase public

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

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

{
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))
{
if (($row["defaultvalue"] == 1) && ($row["owner_fi"] == 0))
{
$this->addColumn($this->lng->txt($row["title"]));
}
else
{
$this->addColumn($row["title"]);
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::addRow (   $a_text)

Adds a row to the question.

Parameters
string$a_textThe text of the row

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

Referenced by importMatrix(), and loadFromDb().

{
array_push($this->rows, $a_text);
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::addRowAtPosition (   $a_text,
  $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 386 of file class.SurveyMatrixQuestion.php.

{
if (array_key_exists($a_position, $this->rows))
{
$head = array_slice($this->rows, 0, $a_position);
$tail = array_slice($this->rows, $a_position);
$this->rows = array_merge($head, array($a_text), $tail);
}
else
{
array_push($this->rows, $a_text);
}
}
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 1039 of file class.SurveyMatrixQuestion.php.

References addColumn().

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

+ Here is the call graph for this function:

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 1774 of file class.SurveyMatrixQuestion.php.

References $result, getColumnCount(), SurveyQuestion\getId(), getNeutralColumn(), getRowCount(), and getSubtype().

{
if (count($resultset["answers"][$this->getId()]))
{
array_push($a_array, "");
switch ($this->getSubtype())
{
case 0:
for ($i = 0; $i < $this->getRowCount(); $i++)
{
$checked = FALSE;
foreach ($resultset["answers"][$this->getId()] as $result)
{
if ($result["rowvalue"] == $i)
{
$checked = TRUE;
array_push($a_array, $result["value"] + 1);
}
}
if (!$checked)
{
array_push($a_array, $this->lng->txt("skipped"));
}
}
break;
case 1:
for ($i = 0; $i < $this->getRowCount(); $i++)
{
$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 (!$checked)
{
array_push($a_array, $this->lng->txt("skipped"));
}
else
{
array_push($a_array, "");
}
for ($index = 0; $index < $this->getColumnCount(); $index++)
{
if (!$checked)
{
array_push($a_array, "");
}
else
{
if (in_array($index+1, $checked_values))
{
array_push($a_array, 1);
}
else
{
array_push($a_array, 0);
}
}
}
if (strlen($this->getNeutralColumn()))
{
if (!$checked)
{
array_push($a_array, "");
}
else
{
if (in_array($this->getColumnCount()+1, $checked_values))
{
array_push($a_array, 1);
}
else
{
array_push($a_array, 0);
}
}
}
}
break;
}
}
else
{
array_push($a_array, $this->lng->txt("skipped"));
for ($i = 0; $i < $this->getRowCount(); $i++)
{
array_push($a_array, "");
switch ($this->getSubtype())
{
case 0:
break;
case 1:
for ($index = 0; $index < $this->getColumnCount(); $index++)
{
array_push($a_array, "");
}
if (strlen($this->getNeutralColumn()))
{
array_push($a_array, "");
}
break;
}
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::addUserSpecificResultsExportTitles ( $a_array)

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

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

Reimplemented from SurveyQuestion.

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

References getColumn(), getColumnCount(), getNeutralColumn(), getRow(), getRowCount(), and getSubtype().

{
for ($i = 0; $i < $this->getRowCount(); $i++)
{
array_push($a_array, $this->getRow($i));
switch ($this->getSubtype())
{
case 0:
break;
case 1:
for ($index = 0; $index < $this->getColumnCount(); $index++)
{
$col = $this->getColumn($index);
array_push($a_array, ($index+1) . " - $col");
}
if (strlen($this->getNeutralColumn()))
{
array_push($a_array, ($this->getColumnCount()+1) . " - " . $this->getNeutralColumn());
}
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 1165 of file class.SurveyMatrixQuestion.php.

References $key, 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))
{
$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))
{
$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 1286 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 354 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 406 of file class.SurveyMatrixQuestion.php.

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

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

Returns
string The additional table name public

Definition at line 1101 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 480 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 330 of file class.SurveyMatrixQuestion.php.

Referenced by addUserSpecificResultsExportTitles(), getCumulatedResults(), getCumulatedResultsForRow(), getUserAnswers(), 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 235 of file class.SurveyMatrixQuestion.php.

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

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getColumnHeaderPosition ( )

Definition at line 2378 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 2408 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 342 of file class.SurveyMatrixQuestion.php.

References $name.

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

Definition at line 2398 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 2328 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 317 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 1978 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 
)

Creates a the cumulated results data for the question.

Returns
array Data

Reimplemented from SurveyQuestion.

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

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

{
$questiontext = preg_replace("/<[^>]+?>/ims", "", $this->getQuestiontext());
$maxlen = 37;
if (strlen($questiontext) > $maxlen + 3)
{
include_once "./Services/Utilities/classes/class.ilStr.php";
$questiontext = ilStr::substr($questiontext, 0, $maxlen) . "...";
}
$result = array();
$row = array(
'counter' => $counter,
'title' => $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);
foreach ($cumulated as $key => $value)
{
if (is_numeric($key))
{
$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 
)

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 1432 of file class.SurveyMatrixQuestion.php.

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

Referenced by outChart().

{
global $ilDB;
$question_id = $this->getId();
$result_array = array();
$cumulated = array();
$result = $ilDB->queryF("SELECT svy_answer.* FROM svy_answer, svy_finished WHERE svy_answer.question_fi = %s AND svy_finished.survey_fi = %s AND svy_finished.finished_id = svy_answer.active_fi",
array('integer', 'integer'),
array($question_id, $survey_id)
);
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);
$result_array["USERS_SKIPPED"] = $nr_of_users - $this->getNrOfUsersAnswered($survey_id);
$prefix = "";
if (strcmp(key($cumulated), "") != 0)
{
$prefix = (key($cumulated)+1) . " - ";
}
$cat = $this->getColumn(key($cumulated));
$result_array["MODE"] = $prefix . $cat;
$result_array["MODE_VALUE"] = key($cumulated)+1;
$result_array["MODE_NR_OF_SELECTIONS"] = $cumulated[key($cumulated)];
for ($key = 0; $key < $this->getColumnCount(); $key++)
{
$percentage = 0;
if ($numrows > 0)
{
$percentage = (float)((int)$cumulated[$key]/$numrows);
}
$cat = $this->getColumn($key);
$result_array["variables"][$key] = array("title" => $cat, "selected" => (int)$cumulated[$key], "percentage" => $percentage);
}
if ($this->hasNeutralColumn())
{
$percentage = 0;
if ($numrows > 0)
{
$percentage = (float)((int)$cumulated[$this->getNeutralColumnIndex()]/$numrows);
}
$result_array["variables"][$this->getNeutralColumnIndex()] = array("title" => $this->getNeutralColumn(), "selected" => (int)$cumulated[$this->getNeutralColumnIndex()], "percentage" => $percentage);
}
ksort($cumulated, SORT_NUMERIC);
$median = array();
$total = 0;
foreach ($cumulated as $value => $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->getColumn((int)floor($median_value)-1);
$cat2 = $this->getColumn((int)ceil($median_value)-1);
$median_value = $median_value . "<br />" . "(" . $this->lng->txt("median_between") . " " . (floor($median_value)) . "-" . $cat . " " . $this->lng->txt("and") . " " . (ceil($median_value)) . "-" . $cat2 . ")";
}
}
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);
$cumulated_results[$i] = $rowresult;
}
return $cumulated_results;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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 1328 of file class.SurveyMatrixQuestion.php.

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

Referenced by getCumulatedResults().

{
global $ilDB;
$question_id = $this->getId();
$result_array = array();
$cumulated = array();
$result = $ilDB->queryF("SELECT svy_answer.* FROM svy_answer, svy_finished WHERE svy_answer.question_fi = %s AND svy_finished.survey_fi = %s AND svy_answer.rowvalue = %s AND svy_finished.finished_id = svy_answer.active_fi",
array('integer', 'integer', 'integer'),
array($question_id, $survey_id, $rowindex)
);
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);
$result_array["USERS_SKIPPED"] = $nr_of_users - $this->getNrOfUsersAnswered($survey_id);
$prefix = "";
if (strcmp(key($cumulated), "") != 0)
{
$prefix = (key($cumulated)+1) . " - ";
}
$cat = $this->getColumn(key($cumulated));
$result_array["MODE"] = $prefix . $cat;
$result_array["MODE_VALUE"] = key($cumulated)+1;
$result_array["MODE_NR_OF_SELECTIONS"] = $cumulated[key($cumulated)];
for ($key = 0; $key < $this->getColumnCount(); $key++)
{
$percentage = 0;
if ($numrows > 0)
{
$percentage = (float)((int)$cumulated[$key]/$numrows);
}
$cat = $this->getColumn($key);
$result_array["variables"][$key] = array("title" => $cat, "selected" => (int)$cumulated[$key], "percentage" => $percentage);
}
if ($this->hasNeutralColumn())
{
$percentage = 0;
if ($numrows > 0)
{
$percentage = (float)((int)$cumulated[$this->getNeutralColumnIndex()]/$numrows);
}
$result_array["variables"][$this->getNeutralColumnIndex()] = array("title" => $this->getNeutralColumn(), "selected" => (int)$cumulated[$this->getNeutralColumnIndex()], "percentage" => $percentage);
}
ksort($cumulated, SORT_NUMERIC);
$median = array();
$total = 0;
foreach ($cumulated as $value => $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->getColumn((int)floor($median_value)-1);
$cat2 = $this->getColumn((int)ceil($median_value)-1);
$median_value = $median_value . "<br />" . "(" . $this->lng->txt("median_between") . " " . (floor($median_value)) . "-" . $cat . " " . $this->lng->txt("and") . " " . (ceil($median_value)) . "-" . $cat2 . ")";
}
}
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);
return $result_array;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getLayout ( )

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

References $layout, elseif(), 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
);
}
{
$this->layout = array(
"percent_row" => 30,
"percent_columns" => 50,
"percent_bipolar_adjective1" => 10,
"percent_bipolar_adjective2" => 10,
"percent_neutral" => 0
);
}
{
$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 2348 of file class.SurveyMatrixQuestion.php.

Referenced by saveToDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getNeutralColumn ( )

Returns the text of the neutral column.

Returns
string The text of the neutral column public
See Also
$neutralColumn

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

References $neutralColumn.

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

{
}

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getNeutralColumnIndex ( )

Returns the index of the neutral column.

Returns
integer The index of the neutral column public
See Also
$neutralColumn

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

References getColumnCount(), and getNeutralColumn().

Referenced by getCumulatedResults(), and getCumulatedResultsForRow().

{
if (strlen($this->getNeutralColumn()))
{
return $this->getColumnCount();
}
else
{
return FALSE;
}
}

+ Here is the call graph for this function:

+ 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 2040 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)

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 1304 of file class.SurveyMatrixQuestion.php.

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

Referenced by getCumulatedResults(), and getCumulatedResultsForRow().

{
global $ilDB;
$result = $ilDB->queryF("SELECT svy_answer.active_fi, svy_answer.question_fi FROM svy_answer, svy_finished WHERE svy_answer.question_fi = %s AND svy_finished.survey_fi = %s AND svy_finished.finished_id = svy_answer.active_fi",
array('integer', 'integer'),
array($this->getId(), $survey_id)
);
$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::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 2156 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 1090 of file class.SurveyMatrixQuestion.php.

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

Definition at line 2388 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 2368 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 417 of file class.SurveyMatrixQuestion.php.

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

{
if (array_key_exists($a_index, $this->rows))
{
return $this->rows[$a_index];
}
return "";
}

+ 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 365 of file class.SurveyMatrixQuestion.php.

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

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::getRowImages ( )

Definition at line 2418 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 2423 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 2009 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 2358 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 1922 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)

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

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

Reimplemented from SurveyQuestion.

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

References $ilDB, $key, $result, $results, $row, SurveyQuestion\$survey_id, getColumn(), SurveyQuestion\getId(), and getRow().

{
global $ilDB;
$answers = array();
$result = $ilDB->queryF("SELECT svy_answer.* FROM svy_answer, svy_finished WHERE svy_finished.survey_fi = %s AND svy_answer.question_fi = %s AND svy_finished.finished_id = svy_answer.active_fi ORDER BY rowvalue, value",
array('integer','integer'),
array($survey_id, $this->getId())
);
$results = array();
while ($row = $ilDB->fetchAssoc($result))
{
$column = $this->getColumn($row["value"]);
if (!is_array($answers[$row["active_fi"]])) $answers[$row["active_fi"]] = array();
array_push($answers[$row["active_fi"]], $this->getRow($row["rowvalue"]) . ": " . ($row["value"] + 1) . " - " . $column);
}
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 1112 of file class.SurveyMatrixQuestion.php.

References $data, $key, 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]));
}
}
else
{
array_push($data, array("value" => $value, "rowvalue" => $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]));
}
}
else
{
array_push($data, array("value" => $value, "rowvalue" => $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 2284 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 2301 of file class.SurveyMatrixQuestion.php.

References getNeutralColumn().

Referenced by getCumulatedResults(), getCumulatedResultsForRow(), getLayout(), and saveRandomData().

{
if (strlen($this->getNeutralColumn()))
{
return TRUE;
}
else
{
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 2053 of file class.SurveyMatrixQuestion.php.

References $key, 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 2081 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 2104 of file class.SurveyMatrixQuestion.php.

References $row, and addRow().

{
foreach ($a_data as $row)
{
$this->addRow($row);
}
}

+ 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 2118 of file class.SurveyMatrixQuestion.php.

References $data, SurveyQuestion\$id, SurveyQuestion\$material, addColumn(), and setNeutralColumn().

{
foreach ($a_data as $id => $data)
{
$column = "";
foreach ($data["material"] as $material)
{
$column .= $material["text"];
}
if (strcmp($data["label"], "neutral") == 0)
{
$this->setNeutralColumn($column);
}
else
{
$this->addColumn($column);
}
}
}

+ Here is the call graph for this function:

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 878 of file class.SurveyMatrixQuestion.php.

References SurveyQuestion\addMaterialTag(), SurveyQuestion\getAuthor(), getBipolarAdjective(), getColumn(), getColumnCount(), getColumnSeparators(), SurveyQuestion\getDescription(), SurveyQuestion\getId(), getLayout(), getNeutralColumn(), 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
);
$a_xml_writer->xmlStartTag("matrixrow", $attrs);
$this->addMaterialTag($a_xml_writer, $this->getRow($i));
$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
);
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));
switch ($this->getSubtype())
{
case 0:
$a_xml_writer->xmlEndTag("response_single");
break;
case 1:
$a_xml_writer->xmlEndTag("response_multiple");
break;
}
}
if (strlen($this->getNeutralColumn()))
{
$attrs = array(
"id" => $this->getColumnCount(),
"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->getNeutralColumn());
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 651 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 575 of file class.SurveyMatrixQuestion.php.

References $data, SurveyQuestion\$id, $ilDB, $result, $row, ilRTE\_replaceMediaObjectImageSrc(), addColumn(), addRow(), flushColumns(), getAdditionalTableName(), SurveyQuestion\setAuthor(), setBipolarAdjective(), setColumnHeaderPosition(), setColumnImages(), setColumnOrder(), setColumnPlaceholders(), setColumnSeparators(), SurveyQuestion\setComplete(), SurveyQuestion\setDescription(), SurveyQuestion\setId(), setLayout(), setLegend(), setNeutralColumn(), 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->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->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))
{
if ($data["neutral"] == 0)
{
$this->addColumn($data["title"]);
}
else
{
$this->setNeutralColumn($data["title"]);
}
}
}
$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"]);
}
}
}

+ Here is the call graph for this function:

SurveyMatrixQuestion::moveRowDown (   $index)

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

{
if ($index < (count($this->rows)-1))
{
$temp = $this->rows[$index+1];
$this->rows[$index + 1] = $this->rows[$index];
$this->rows[$index] = $temp;
}
}
SurveyMatrixQuestion::moveRowUp (   $index)

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

{
if ($index > 0)
{
$temp = $this->rows[$index-1];
$this->rows[$index - 1] = $this->rows[$index];
$this->rows[$index] = $temp;
}
}
SurveyMatrixQuestion::outChart (   $survey_id,
  $type = "" 
)

Creates an image visualising the results of the question.

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

Reimplemented from SurveyQuestion.

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

References $ilLog, $key, SurveyQuestion\$survey_id, SurveyQuestion\$title, $type, ilObjSurvey\_getNrOfParticipants(), getCumulatedResults(), and getRow().

{
if (count($this->cumulated) == 0)
{
include_once "./Modules/Survey/classes/class.ilObjSurvey.php";
$this->cumulated =& $this->getCumulatedResults($survey_id, $nr_of_users);
}
global $ilLog;
if (is_numeric($type))
{
foreach ($this->cumulated[$type]["variables"] as $key => $value)
{
foreach ($value as $key2 => $value2)
{
$this->cumulated["variables"][$key][$key2] = utf8_decode($value2);
}
}
$title = preg_replace("/<[^>]+?>/ims", "", $this->getRow($type));
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyChart.php";
$b1 = new SurveyChart("bars", 400, 250, utf8_decode($title),utf8_decode($this->lng->txt("answers")), utf8_decode($this->lng->txt("users_answered")), $this->cumulated[$type]["variables"]);
}
}

+ Here is the call graph for this function:

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 285 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 297 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 309 of file class.SurveyMatrixQuestion.php.

References $name.

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

Removes a row.

Parameters
integer$indexThe index of the row to be removed

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

{
unset($this->rows[$index]);
$this->rows = array_values($this->rows);
}
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 453 of file class.SurveyMatrixQuestion.php.

{
foreach ($array as $index)
{
unset($this->rows[$index]);
}
$this->rows = array_values($this->rows);
}
SurveyMatrixQuestion::saveBipolarAdjectives (   $adjective1,
  $adjective2 
)

Definition at line 725 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 781 of file class.SurveyMatrixQuestion.php.

References $ilDB, getColumn(), getColumnCount(), SurveyQuestion\getId(), getNeutralColumn(), 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);
$next_id = $ilDB->nextId('svy_variable');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, value2, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','float','float','integer','integer'),
array($next_id, $column_id, $question_id, ($i + 1), NULL, $i, time())
);
}
if (strlen($this->getNeutralColumn()))
{
$column_id = $this->saveColumnToDb($this->getNeutralColumn(), 1);
$next_id = $ilDB->nextId('svy_variable');
$affectedRows = $ilDB->manipulateF("INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, value2, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
array('integer','integer','integer','float','float','integer','integer'),
array($next_id, $column_id, $question_id, ($i + 1), NULL, $i, 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 743 of file class.SurveyMatrixQuestion.php.

References $ilDB, $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 2202 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 (   $phrases,
  $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 1054 of file class.SurveyMatrixQuestion.php.

References $ilDB, 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 ($phrases as $category)
{
$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, $category, 1, $ilUser->getId(), 0, time())
);
$column_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) VALUES (%s, %s, %s, %s)",
array('integer', 'integer', 'integer', 'integer'),
array($next_id, $phrase_id, $column_id, $counter)
);
$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 1205 of file class.SurveyMatrixQuestion.php.

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

{
global $ilDB;
$columncount = ($this->hasNeutralColumn()) ? $this->getColumnCount()+1 : $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 820 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, sequence, question_fi) VALUES (%s, %s, %s, %s)",
array('integer','text','integer','integer'),
array($next_id, $row, $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 674 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 
)

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

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

{
global $ilDB;
switch ($this->getSubtype())
{
case 0:
foreach ($post_data as $key => $value)
{
if (preg_match("/matrix_" . $this->getId() . "_(\d+)/", $key, $matches))
{
$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, $value, NULL, $matches[1], time())
);
}
}
break;
case 1:
foreach ($post_data as $key => $value)
{
if (preg_match("/matrix_" . $this->getId() . "_(\d+)/", $key, $matches))
{
foreach ($value as $checked)
{
if (strlen($checked))
{
$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, $checked, NULL, $matches[1], time())
);
}
}
}
}
break;
}
}

+ 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 502 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 2373 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 2403 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 2393 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 2318 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 1958 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)

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 1590 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
{
array_push($csvrow, $this->getTitle());
array_push($csvrow, $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 
)

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 1547 of file class.SurveyMatrixQuestion.php.

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

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

+ Here is the call graph for this function:

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

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

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

Reimplemented from SurveyQuestion.

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

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

{
include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
$worksheet =& $workbook->addWorksheet();
$worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
$worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
$worksheet->writeString(1, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold);
$worksheet->writeString(1, 1, ilExcelUtils::_convert_text($this->getQuestiontext()));
$worksheet->writeString(2, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold);
$worksheet->writeString(2, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())));
$worksheet->writeString(3, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold);
$worksheet->write(3, 1, $eval_data["TOTAL"]["USERS_ANSWERED"]);
$worksheet->writeString(4, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold);
$worksheet->write(4, 1, $eval_data["TOTAL"]["USERS_SKIPPED"]);
$rowcounter = 5;
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);
}
}
}
// 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 2267 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 2338 of file class.SurveyMatrixQuestion.php.

Referenced by loadFromDb().

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

+ Here is the caller graph for this function:

SurveyMatrixQuestion::setNeutralColumn (   $a_text)

Sets the text of the neutral column.

Parameters
string$a_textThe text of the neutral column public
See Also
$neutralColumn

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

Referenced by importResponses(), and loadFromDb().

{
$this->neutralColumn = $a_text;
}

+ 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 2020 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 2383 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 2363 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 2413 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 1989 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 2353 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 1933 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 164 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 = array();
$this->neutralColumn = "";
$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 1021 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 855 of file class.SurveyMatrixQuestion.php.

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

{
include_once("./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 2144 of file class.SurveyMatrixQuestion.php.

{
return FALSE;
}

Field Documentation

SurveyMatrixQuestion::$bipolar_adjective1

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

SurveyMatrixQuestion::$bipolar_adjective2

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

SurveyMatrixQuestion::$columnHeaderPosition

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

SurveyMatrixQuestion::$columnImages

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

SurveyMatrixQuestion::$columnOrder

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

SurveyMatrixQuestion::$columnPlaceholders

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

SurveyMatrixQuestion::$columns

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

Referenced by addColumnArray(), and getColumns().

SurveyMatrixQuestion::$columnSeparators

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

SurveyMatrixQuestion::$layout

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

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

SurveyMatrixQuestion::$legend

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

SurveyMatrixQuestion::$neutralColumn

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

Referenced by getNeutralColumn().

SurveyMatrixQuestion::$neutralColumnSeparator

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

SurveyMatrixQuestion::$randomRows

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

SurveyMatrixQuestion::$repeatColumnHeader

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

SurveyMatrixQuestion::$rowImages

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

SurveyMatrixQuestion::$rows

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

Referenced by getRows().

SurveyMatrixQuestion::$rowSeparators

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

SurveyMatrixQuestion::$singleLineRowCaption

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

SurveyMatrixQuestion::$subtype

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

Referenced by getSubtype().


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