Matrix question GUI representation. More...
Inheritance diagram for SurveyMatrixQuestionGUI:
Collaboration diagram for SurveyMatrixQuestionGUI:Public Member Functions | |
| SurveyMatrixQuestionGUI ($id=-1) | |
| SurveyMatrixQuestionGUI constructor. | |
| & | executeCommand () |
| execute command | |
| editQuestion () | |
| Creates an output of the edit form for the question. | |
| getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="") | |
| Creates the question output form for the learner. | |
| getPrintView ($question_title=1, $show_questiontext=1) | |
| Creates a HTML representation of the question. | |
| preview () | |
| Creates a preview of the question. | |
| layout () | |
| Creates a layout view of the question. | |
| saveLayout () | |
| Saves the layout for the matrix question. | |
| getLayoutRow () | |
| Creates a row to define the matrix question layout with percentage values. | |
| writePostData () | |
| Evaluates a posted edit form and writes the form data in the question object. | |
| moveColumnUp ($column) | |
| Moves a column up. | |
| moveColumnDown ($column) | |
| Moves a column down. | |
| categories () | |
| Creates the form to edit the question columns. | |
| setQuestionTabs () | |
| addPhrase () | |
| Creates an output for the addition of phrases. | |
| cancelViewPhrase () | |
| Cancels the form adding a phrase. | |
| addSelectedPhrase () | |
| Adds a selected phrase. | |
| addStandardNumbers () | |
| Creates an output for the addition of standard numbers. | |
| cancelStandardNumbers () | |
| Cancels the form adding standard numbers. | |
| insertStandardNumbers () | |
| Insert standard numbers to the question. | |
| savePhrase () | |
| Creates an output to save a phrase. | |
| cancelSavePhrase () | |
| Cancels the form saving a phrase. | |
| confirmSavePhrase () | |
| Save a new phrase to the database. | |
| addColumn () | |
| Adds a column to the question. | |
| addRow () | |
| Adds a row to the question. | |
| writeRowColData ($save=FALSE) | |
| Saves the columns and rows of the question. | |
| saveRowColEditor () | |
| Saves the rows and columns. | |
| deleteColumn () | |
| Removes one or more columns. | |
| deleteRow () | |
| Removes one or more rows. | |
| getCumulatedResultRow ($counter, $css_class, $survey_id) | |
| Creates the cumulated results row for the question. | |
| getCumulatedResultsDetails ($survey_id, $counter) | |
| Creates the detailed output of the cumulated results for the question. | |
Data Fields | |
| $show_layout_row | |
Matrix question GUI representation.
The SurveyMatrixQuestionGUI class encapsulates the GUI representation for matrix question types.
Definition at line 38 of file class.SurveyMatrixQuestionGUI.php.
| SurveyMatrixQuestionGUI::addColumn | ( | ) |
Adds a column to the question.
Adds a column to the question
private
Definition at line 1473 of file class.SurveyMatrixQuestionGUI.php.
References $_SESSION, categories(), ilUtil::sendInfo(), and writeRowColData().
Referenced by addRow().
{
$result = $this->writeRowColData();
if ($result == FALSE)
{
ilUtil::sendInfo($this->errormessage);
}
$_SESSION["spl_modified"] = true;
$this->categories();
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::addPhrase | ( | ) |
Creates an output for the addition of phrases.
Creates an output for the addition of phrases
public
Definition at line 1221 of file class.SurveyMatrixQuestionGUI.php.
References ilSurveyPhrases::_getAvailablePhrases(), ilSurveyPhrases::_getCategoriesForPhrase(), and writeRowColData().
Referenced by addSelectedPhrase().
{
$complete = $this->writeRowColData(true);
$this->ctrl->setParameterByClass(get_class($this), "q_id", $this->object->getId());
$this->ctrl->setParameterByClass("ilobjsurveyquestionpoolgui", "q_id", $this->object->getId());
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_addphrase.html", "Modules/SurveyQuestionPool");
// set the id to return to the selected question
$this->tpl->setCurrentBlock("hidden");
$this->tpl->setVariable("HIDDEN_NAME", "id");
$this->tpl->setVariable("HIDDEN_VALUE", $this->object->getId());
$this->tpl->parseCurrentBlock();
include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
$phrases =& ilSurveyPhrases::_getAvailablePhrases();
$colors = array("tblrow1", "tblrow2");
$counter = 0;
foreach ($phrases as $phrase_id => $phrase_array)
{
$this->tpl->setCurrentBlock("phraserow");
$this->tpl->setVariable("COLOR_CLASS", $colors[$counter++ % 2]);
$this->tpl->setVariable("PHRASE_VALUE", $phrase_id);
$this->tpl->setVariable("PHRASE_NAME", $phrase_array["title"]);
$columns =& ilSurveyPhrases::_getCategoriesForPhrase($phrase_id);
$this->tpl->setVariable("PHRASE_CONTENT", join($columns, ","));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable("TEXT_CANCEL", $this->lng->txt("cancel"));
$this->tpl->setVariable("TEXT_PHRASE", $this->lng->txt("phrase"));
$this->tpl->setVariable("TEXT_CONTENT", $this->lng->txt("categories"));
$this->tpl->setVariable("TEXT_ADD_PHRASE", $this->lng->txt("add_phrase"));
$this->tpl->setVariable("TEXT_INTRODUCTION",$this->lng->txt("add_phrase_introduction"));
$this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "addPhrase"));
$this->tpl->parseCurrentBlock();
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::addRow | ( | ) |
Adds a row to the question.
Adds a row to the question
private
Definition at line 1492 of file class.SurveyMatrixQuestionGUI.php.
References addColumn().
{
$this->addColumn();
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::addSelectedPhrase | ( | ) |
Adds a selected phrase.
Adds a selected phrase
public
Definition at line 1279 of file class.SurveyMatrixQuestionGUI.php.
References addPhrase(), addStandardNumbers(), and ilUtil::sendInfo().
{
if (strcmp($_POST["phrases"], "") == 0)
{
ilUtil::sendInfo($this->lng->txt("select_phrase_to_add"));
$this->addPhrase();
}
else
{
if (strcmp($this->object->getPhrase($_POST["phrases"]), "dp_standard_numbers") != 0)
{
$this->object->addPhrase($_POST["phrases"]);
$this->object->saveColumnsToDb();
}
else
{
$this->addStandardNumbers();
return;
}
$this->ctrl->redirect($this, "categories");
}
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::addStandardNumbers | ( | ) |
Creates an output for the addition of standard numbers.
Creates an output for the addition of standard numbers
public
Definition at line 1309 of file class.SurveyMatrixQuestionGUI.php.
Referenced by addSelectedPhrase(), and insertStandardNumbers().
{
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_addphrase_standard_numbers.html", "Modules/SurveyQuestionPool");
// set the id to return to the selected question
$this->tpl->setCurrentBlock("hidden");
$this->tpl->setVariable("HIDDEN_NAME", "id");
$this->tpl->setVariable("HIDDEN_VALUE", $this->object->getId());
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable("ADD_STANDARD_NUMBERS", $this->lng->txt("add_standard_numbers"));
$this->tpl->setVariable("TEXT_ADD_LIMITS", $this->lng->txt("add_limits_for_standard_numbers"));
$this->tpl->setVariable("TEXT_LOWER_LIMIT",$this->lng->txt("lower_limit"));
$this->tpl->setVariable("TEXT_UPPER_LIMIT",$this->lng->txt("upper_limit"));
$this->tpl->setVariable("VALUE_LOWER_LIMIT", $_POST["lower_limit"]);
$this->tpl->setVariable("VALUE_UPPER_LIMIT", $_POST["upper_limit"]);
$this->tpl->setVariable("BTN_ADD",$this->lng->txt("add_phrase"));
$this->tpl->setVariable("BTN_CANCEL",$this->lng->txt("cancel"));
$this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "addStandardNumbers"));
$this->tpl->parseCurrentBlock();
}
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::cancelSavePhrase | ( | ) |
Cancels the form saving a phrase.
Cancels the form saving a phrase
public
Definition at line 1433 of file class.SurveyMatrixQuestionGUI.php.
{
$this->ctrl->redirect($this, "categories");
}
| SurveyMatrixQuestionGUI::cancelStandardNumbers | ( | ) |
Cancels the form adding standard numbers.
Cancels the form adding standard numbers
public
Definition at line 1339 of file class.SurveyMatrixQuestionGUI.php.
{
$this->ctrl->redirect($this, "categories");
}
| SurveyMatrixQuestionGUI::cancelViewPhrase | ( | ) |
Cancels the form adding a phrase.
Cancels the form adding a phrase
public
Definition at line 1267 of file class.SurveyMatrixQuestionGUI.php.
{
$this->ctrl->redirect($this, "categories");
}
| SurveyMatrixQuestionGUI::categories | ( | ) |
Creates the form to edit the question columns.
Creates the form to edit the question columns
private
Definition at line 932 of file class.SurveyMatrixQuestionGUI.php.
References $_SESSION, ilUtil::getImagePath(), moveColumnDown(), moveColumnUp(), ilUtil::prepareFormOutput(), and ilUtil::sendInfo().
Referenced by addColumn(), deleteColumn(), deleteRow(), savePhrase(), and saveRowColEditor().
{
if (count($_POST) == 0) $_SESSION["spl_modified"] = FALSE;
if (is_array($_POST))
{
foreach ($_POST as $key => $value)
{
if (preg_match("/moveUp_(\d+)_x/", $key, $matches))
{
$this->moveColumnUp($matches[1]);
}
if (preg_match("/moveDown_(\d+)_x/", $key, $matches))
{
$this->moveColumnDown($matches[1]);
}
}
}
if ($this->object->getId() < 1)
{
ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_category"), true);
$this->ctrl->redirect($this, "editQuestion");
}
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_matrix_answers.html", "Modules/SurveyQuestionPool");
// check for ordinal columns
if ($this->object->getSubtype() == 0)
{
$this->tpl->setCurrentBlock("ordinal");
$this->tpl->setVariable("TEXT_COLUMN_SETTINGS", $this->lng->txt("matrix_column_settings"));
$this->tpl->setVariable("TEXT_BIPOLAR_ADJECTIVES", $this->lng->txt("matrix_bipolar_adjectives"));
$this->tpl->setVariable("TEXT_BIPOLAR_ADJECTIVES_DESCRIPTION", $this->lng->txt("matrix_bipolar_adjectives_description"));
$this->tpl->setVariable("TEXT_ADJECTIVE_1", $this->lng->txt("matrix_adjective") . " 1");
$this->tpl->setVariable("TEXT_ADJECTIVE_2", $this->lng->txt("matrix_adjective") . " 2");
$this->tpl->setVariable("VALUE_BIPOLAR1", " value=\"" . ilUtil::prepareFormOutput($this->object->getBipolarAdjective(0)) . "\"");
$this->tpl->setVariable("VALUE_BIPOLAR2", " value=\"" . ilUtil::prepareFormOutput($this->object->getBipolarAdjective(1)) . "\"");
$this->tpl->setVariable("SAVE", $this->lng->txt("save"));
$this->tpl->parseCurrentBlock();
}
// create an empty column if nothing is defined
if ($this->object->getColumnCount() == 0)
{
$this->object->addColumn("");
}
if (strcmp($this->ctrl->getCmd(), "addColumn") == 0)
{
$nrOfCategories = $_POST["nrOfCategories"];
if ($nrOfCategories < 1) $nrOfCategories = 1;
// Create template for a new column
for ($i = 1; $i <= $nrOfCategories; $i++)
{
$this->object->addColumn("");
}
}
// output of existing single response answers
$hasneutralcolumn = FALSE;
for ($i = 0; $i < $this->object->getColumnCount(); $i++)
{
$column = $this->object->getColumn($i);
if ($this->object->getColumnCount() > 1)
{
if ($i == 0)
{
$this->tpl->setCurrentBlock("move_down");
$this->tpl->setVariable("IMAGE_DOWN", ilUtil::getImagePath("a_down.gif"));
$this->tpl->setVariable("ALT_DOWN", $this->lng->txt("move_down"));
$this->tpl->setVariable("TITLE_DOWN", $this->lng->txt("move_down"));
$this->tpl->setVariable("COLUMN", $i);
$this->tpl->parseCurrentBlock();
}
else if ($i == $this->object->getColumnCount() - 1)
{
$this->tpl->setCurrentBlock("move_up");
$this->tpl->setVariable("IMAGE_UP", ilUtil::getImagePath("a_up.gif"));
$this->tpl->setVariable("ALT_UP", $this->lng->txt("move_up"));
$this->tpl->setVariable("TITLE_UP", $this->lng->txt("move_up"));
$this->tpl->setVariable("COLUMN", $i);
$this->tpl->parseCurrentBlock();
}
else
{
$this->tpl->setCurrentBlock("move_down");
$this->tpl->setVariable("IMAGE_DOWN", ilUtil::getImagePath("a_down.gif"));
$this->tpl->setVariable("ALT_DOWN", $this->lng->txt("move_down"));
$this->tpl->setVariable("TITLE_DOWN", $this->lng->txt("move_down"));
$this->tpl->setVariable("COLUMN", $i);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("move_up");
$this->tpl->setVariable("IMAGE_UP", ilUtil::getImagePath("a_up.gif"));
$this->tpl->setVariable("ALT_UP", $this->lng->txt("move_up"));
$this->tpl->setVariable("TITLE_UP", $this->lng->txt("move_up"));
$this->tpl->setVariable("COLUMN", $i);
$this->tpl->parseCurrentBlock();
}
}
$this->tpl->setCurrentBlock("categories");
$this->tpl->setVariable("CATEGORY_ORDER", $i);
$this->tpl->setVariable("CATEGORY_ORDER", $i);
$this->tpl->setVariable("CATEGORY_NUMBER", $i+1);
$this->tpl->setVariable("VALUE_CATEGORY", $column);
$this->tpl->setVariable("TEXT_CATEGORY", $this->lng->txt("category"));
$this->tpl->parseCurrentBlock();
}
if (strlen($this->object->getNeutralColumn()))
{
$this->tpl->setVariable("VALUE_NEUTRAL", " value=\"" . ilUtil::prepareFormOutput($this->object->getNeutralColumn()) . "\"");
}
$this->tpl->setVariable("CATEGORY_NEUTRAL", $this->object->getColumnCount() + 1);
if ($this->object->getRowCount() == 0)
{
$this->object->addRow("");
}
if (strcmp($this->ctrl->getCmd(), "addRow") == 0)
{
$nrOfRows = $_POST["nrOfRows"];
if ($nrOfRows < 1) $nrOfRows = 1;
// Create template for a new column
for ($i = 1; $i <= $nrOfRows; $i++)
{
$this->object->addRow("");
}
}
// output of existing rows
for ($i = 0; $i < $this->object->getRowCount(); $i++)
{
$this->tpl->setCurrentBlock("rows");
$this->tpl->setVariable("ROW_ORDER", $i);
$row = $this->object->getRow($i);
$this->tpl->setVariable("ROW_ORDER", $i);
$this->tpl->setVariable("ROW_NUMBER", $i+1);
$this->tpl->setVariable("VALUE_ROW", $row);
$this->tpl->setVariable("TEXT_ROW", $this->lng->txt("row"));
$this->tpl->parseCurrentBlock();
}
include_once "./Services/Utilities/classes/class.ilUtil.php";
if ($this->object->getColumnCount() > 0)
{
$this->tpl->setCurrentBlock("selectall");
$this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("existingcategories");
$this->tpl->setVariable("DELETE", $this->lng->txt("delete"));
$this->tpl->setVariable("VALUE_SAVE_PHRASE", $this->lng->txt("save_phrase"));
$this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\">");
$this->tpl->parseCurrentBlock();
}
if ($this->object->getRowCount() > 0)
{
$this->tpl->setCurrentBlock("selectall_rows");
$this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
$this->tpl->parseCurrentBlock();
}
for ($i = 1; $i < 10; $i++)
{
$this->tpl->setCurrentBlock("numbers");
$this->tpl->setVariable("VALUE_NUMBER", $i);
if ($i == 1)
{
$this->tpl->setVariable("TEXT_NUMBER", $i . " " . $this->lng->txt("category"));
}
else
{
$this->tpl->setVariable("TEXT_NUMBER", $i . " " . $this->lng->txt("categories"));
}
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("rownumbers");
$this->tpl->setVariable("VALUE_NUMBER", $i);
if ($i == 1)
{
$this->tpl->setVariable("TEXT_NUMBER", $i . " " . $this->lng->txt("row"));
}
else
{
$this->tpl->setVariable("TEXT_NUMBER", $i . " " . $this->lng->txt("rows"));
}
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "categories"));
$this->tpl->setVariable("TEXT_ANSWERS", $this->lng->txt("matrix_columns"));
$this->tpl->setVariable("VALUE_ADD_CATEGORY", $this->lng->txt("add"));
$this->tpl->setVariable("VALUE_ADD_PHRASE", $this->lng->txt("add_phrase"));
$this->tpl->setVariable("TEXT_STANDARD_ANSWERS", $this->lng->txt("matrix_standard_answers"));
$this->tpl->setVariable("TEXT_NEUTRAL_ANSWER", $this->lng->txt("matrix_neutral_answer"));
if (!$hasneutralcolumn)
{
$this->tpl->setVariable("CATEGORY_NEUTRAL", $this->object->getColumnCount()+1);
}
$this->tpl->setVariable("SAVE", $this->lng->txt("save"));
$this->tpl->setVariable("TEXT_ROWS", $this->lng->txt("matrix_rows"));
$this->tpl->setVariable("SAVEROWS", $this->lng->txt("save"));
$this->tpl->setVariable("VALUE_ADD_ROW", $this->lng->txt("add"));
$this->tpl->setVariable("DELETE", $this->lng->txt("delete"));
$this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\">");
if ($_SESSION["spl_modified"])
{
$this->tpl->setVariable("FORM_DATA_MODIFIED_PRESS_SAVE", $this->lng->txt("form_data_modified_press_save"));
}
$questiontext = $this->object->getQuestiontext();
$this->tpl->setVariable("QUESTION_TEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
$this->tpl->parseCurrentBlock();
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::confirmSavePhrase | ( | ) |
Save a new phrase to the database.
Save a new phrase to the database
public
Definition at line 1445 of file class.SurveyMatrixQuestionGUI.php.
References savePhrase(), and ilUtil::sendInfo().
{
if (!$_POST["phrase_title"])
{
ilUtil::sendInfo($this->lng->txt("qpl_savephrase_empty"));
$this->savePhrase();
return;
}
if ($this->object->phraseExists($_POST["phrase_title"]))
{
ilUtil::sendInfo($this->lng->txt("qpl_savephrase_exists"));
$this->savePhrase();
return;
}
$this->object->savePhrase($_POST["chb_category"], $_POST["phrase_title"]);
ilUtil::sendInfo($this->lng->txt("phrase_saved"), true);
$this->ctrl->redirect($this, "categories");
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::deleteColumn | ( | ) |
Removes one or more columns.
Removes one or more columns
private
Definition at line 1610 of file class.SurveyMatrixQuestionGUI.php.
References $_SESSION, categories(), ilUtil::sendInfo(), and writeRowColData().
{
$this->writeRowColData();
$nothing_selected = true;
if (array_key_exists("chb_category", $_POST))
{
if (count($_POST["chb_category"]))
{
$nothing_selected = false;
$this->object->removeColumns($_POST["chb_category"]);
}
}
if ($nothing_selected)
{
ilUtil::sendInfo($this->lng->txt("matrix_column_delete_select_none"));
}
else
{
$_SESSION["spl_modified"] = true;
}
$this->categories();
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::deleteRow | ( | ) |
Removes one or more rows.
Removes one or more rows
private
Definition at line 1640 of file class.SurveyMatrixQuestionGUI.php.
References $_SESSION, categories(), ilUtil::sendInfo(), and writeRowColData().
{
$this->writeRowColData();
$nothing_selected = true;
if (array_key_exists("chb_row", $_POST))
{
if (count($_POST["chb_row"]))
{
$nothing_selected = false;
$this->object->removeRows($_POST["chb_row"]);
}
}
if ($nothing_selected)
{
ilUtil::sendInfo($this->lng->txt("matrix_row_delete_select_none"));
}
else
{
$_SESSION["spl_modified"] = true;
}
$this->categories();
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::editQuestion | ( | ) |
Creates an output of the edit form for the question.
Creates an output of the edit form for the question
public
Definition at line 90 of file class.SurveyMatrixQuestionGUI.php.
References $_GET, SurveyQuestion::_getInternalLinkHref(), ilRTE::_getRTEClassname(), ilObject::_lookupType(), and ilUtil::prepareFormOutput().
{
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_matrix.html", "Modules/SurveyQuestionPool");
$this->tpl->addBlockFile("OTHER_QUESTION_DATA", "other_question_data", "tpl.il_svy_qpl_other_question_data.html", "Modules/SurveyQuestionPool");
$subtypes = array(
"0" => "matrix_subtype_sr",
"1" => "matrix_subtype_mr",
//"2" => "matrix_subtype_text",
//"3" => "matrix_subtype_integer",
//"4" => "matrix_subtype_double",
//"5" => "matrix_subtype_date",
//"6" => "matrix_subtype_time"
);
foreach ($subtypes as $value => $text)
{
$this->tpl->setCurrentBlock("subtype_row");
$this->tpl->setVariable("VALUE_SUBTYPE", $value);
$this->tpl->setVariable("TEXT_SUBTYPE", $this->lng->txt($text));
if ($value == $this->object->getSubtype())
{
$this->tpl->setVariable("CHECKED_SUBTYPE", " checked=\"checked\"");
}
$this->tpl->parseCurrentBlock();
}
$internallinks = array(
"lm" => $this->lng->txt("obj_lm"),
"st" => $this->lng->txt("obj_st"),
"pg" => $this->lng->txt("obj_pg"),
"glo" => $this->lng->txt("glossary_term")
);
foreach ($internallinks as $key => $value)
{
$this->tpl->setCurrentBlock("internallink");
$this->tpl->setVariable("TYPE_INTERNAL_LINK", $key);
$this->tpl->setVariable("TEXT_INTERNAL_LINK", $value);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable("TEXT_MATERIAL", $this->lng->txt("material"));
if (count($this->object->material))
{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$href = SurveyQuestion::_getInternalLinkHref($this->object->material["internal_link"]);
$this->tpl->setVariable("TEXT_VALUE_MATERIAL", " <a href=\"$href\" target=\"content\">" . $this->lng->txt("material"). "</a> ");
$this->tpl->setVariable("BUTTON_REMOVE_MATERIAL", $this->lng->txt("remove"));
$this->tpl->setVariable("BUTTON_ADD_MATERIAL", $this->lng->txt("change"));
$this->tpl->setVariable("VALUE_MATERIAL", $this->object->material["internal_link"]);
$this->tpl->setVariable("VALUE_MATERIAL_TITLE", $this->object->material["title"]);
$this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
}
else
{
$this->tpl->setVariable("BUTTON_ADD_MATERIAL", $this->lng->txt("add"));
}
$this->tpl->setVariable("TEXT_ORIENTATION", $this->lng->txt("orientation"));
$this->tpl->setVariable("QUESTION_ID", $this->object->getId());
$this->tpl->setVariable("VALUE_TITLE", $this->object->getTitle());
$this->tpl->setVariable("VALUE_DESCRIPTION", $this->object->getDescription());
$this->tpl->setVariable("VALUE_AUTHOR", $this->object->getAuthor());
$questiontext = $this->object->getQuestiontext();
$this->tpl->setVariable("VALUE_QUESTION", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($questiontext)));
$this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
$this->tpl->setVariable("TEXT_AUTHOR", $this->lng->txt("author"));
$this->tpl->setVariable("TEXT_DESCRIPTION", $this->lng->txt("description"));
$this->tpl->setVariable("TEXT_QUESTION", $this->lng->txt("question"));
$this->tpl->setVariable("TEXT_QUESTION_TYPE", $this->lng->txt("questiontype"));
$this->tpl->setVariable("TEXT_OBLIGATORY", $this->lng->txt("obligatory"));
if ($this->object->getObligatory())
{
$this->tpl->setVariable("CHECKED_OBLIGATORY", " checked=\"checked\"");
}
$this->tpl->setVariable("TEXT_APPEARANCE", $this->lng->txt("matrix_appearance"));
$this->tpl->setVariable("TEXT_COLUMN_SEPARATORS", $this->lng->txt("matrix_column_separators"));
$this->tpl->setVariable("TEXT_ROW_SEPARATORS", $this->lng->txt("matrix_row_separators"));
$this->tpl->setVariable("TEXT_NEUTRAL_COLUMN_SEPARATOR", $this->lng->txt("matrix_neutral_column_separator"));
$this->tpl->setVariable("DESCRIPTION_NEUTRAL_COLUMN_SEPARATOR", $this->lng->txt("matrix_neutral_column_separator_description"));
$this->tpl->setVariable("DESCRIPTION_ROW_SEPARATORS", $this->lng->txt("matrix_row_separators_description"));
$this->tpl->setVariable("DESCRIPTION_COLUMN_SEPARATORS", $this->lng->txt("matrix_column_separators_description"));
if ($this->object->getRowSeparators())
{
$this->tpl->setVariable("CHECKED_ROW_SEPARATORS", " checked=\"checked\"");
}
if ($this->object->getColumnSeparators())
{
$this->tpl->setVariable("CHECKED_COLUMN_SEPARATORS", " checked=\"checked\"");
}
if ($this->object->getNeutralColumnSeparator())
{
$this->tpl->setVariable("CHECKED_NEUTRAL_COLUMN_SEPARATOR", " checked=\"checked\"");
}
$this->tpl->setVariable("SAVE",$this->lng->txt("save"));
$this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "editQuestion"));
$this->tpl->setVariable("TEXT_QUESTION_TYPE", $this->lng->txt($this->getQuestionType()));
$this->tpl->setVariable("TEXT_SUBTYPE", $this->lng->txt("subtype"));
$this->tpl->setVariable("DESCRIPTION_SUBTYPE", $this->lng->txt("matrix_subtype_description"));
$this->tpl->parseCurrentBlock();
include_once "./Services/RTE/classes/class.ilRTE.php";
$rtestring = ilRTE::_getRTEClassname();
include_once "./Services/RTE/classes/class.$rtestring.php";
$rte = new $rtestring();
$rte->addPlugin("latex");
$rte->addButton("latex"); $rte->addButton("pastelatex");
$rte->removePlugin("ibrowser");
include_once "./classes/class.ilObject.php";
$obj_id = $_GET["q_id"];
$obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
$rte->addRTESupport($obj_id, $obj_type, "survey");
}
Here is the call graph for this function:| & SurveyMatrixQuestionGUI::executeCommand | ( | ) |
execute command
Reimplemented from SurveyQuestionGUI.
Definition at line 68 of file class.SurveyMatrixQuestionGUI.php.
References $cmd, $ret, and SurveyQuestionGUI::getCommand().
{
$cmd = $this->ctrl->getCmd();
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->getCommand($cmd);
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::getCumulatedResultRow | ( | $ | counter, | |
| $ | css_class, | |||
| $ | survey_id | |||
| ) |
Creates the cumulated results row for the question.
Creates the cumulated results row for the question
Reimplemented from SurveyQuestionGUI.
Definition at line 1671 of file class.SurveyMatrixQuestionGUI.php.
References ilObjSurvey::_getNrOfParticipants().
{
$output = "";
include_once "./classes/class.ilTemplate.php";
if (count($this->cumulated) == 0)
{
include_once "./Modules/Survey/classes/class.ilObjSurvey.php";
$nr_of_users = ilObjSurvey::_getNrOfParticipants($survey_id);
$this->cumulated =& $this->object->getCumulatedResults($survey_id, $nr_of_users);
}
$template = new ilTemplate("tpl.il_svy_svy_cumulated_results_row.html", TRUE, TRUE, "Modules/Survey");
$template->setVariable("QUESTION_TITLE", ($counter+1) . ". ".$this->object->getTitle());
$maxlen = 37;
$questiontext = preg_replace("/<[^>]+?>/ims", "", $this->object->getQuestiontext());
if (strlen($questiontext) > $maxlen + 3)
{
$questiontext = substr($questiontext, 0, $maxlen) . "...";
}
$template->setVariable("QUESTION_TEXT", $questiontext);
$template->setVariable("USERS_ANSWERED", $this->cumulated["TOTAL"]["USERS_ANSWERED"]);
$template->setVariable("USERS_SKIPPED", $this->cumulated["TOTAL"]["USERS_SKIPPED"]);
$template->setVariable("QUESTION_TYPE", $this->lng->txt($this->cumulated["TOTAL"]["QUESTION_TYPE"]));
$template->setVariable("MODE", $this->cumulated["TOTAL"]["MODE"]);
$template->setVariable("MODE_NR_OF_SELECTIONS", $this->cumulated["TOTAL"]["MODE_NR_OF_SELECTIONS"]);
$template->setVariable("MEDIAN", $this->cumulated["TOTAL"]["MEDIAN"]);
$template->setVariable("ARITHMETIC_MEAN", $this->cumulated["TOTAL"]["ARITHMETIC_MEAN"]);
$template->setVariable("COLOR_CLASS", $css_class);
$output = $template->get();
foreach ($this->cumulated as $key => $value)
{
if (is_numeric($key))
{
$template = new ilTemplate("tpl.il_svy_svy_cumulated_results_row_matrix.html", TRUE, TRUE, "Modules/Survey");
$template->setVariable("QUESTION_TITLE", "");
$template->setVariable("ROW", ($key+1) . ". " . $value["ROW"]);
$template->setVariable("USERS_ANSWERED", $value["USERS_ANSWERED"]);
$template->setVariable("USERS_SKIPPED", $value["USERS_SKIPPED"]);
$template->setVariable("MODE", $value["MODE"]);
$template->setVariable("MODE_NR_OF_SELECTIONS", $value["MODE_NR_OF_SELECTIONS"]);
$template->setVariable("MEDIAN", $value["MEDIAN"]);
$template->setVariable("ARITHMETIC_MEAN", $value["ARITHMETIC_MEAN"]);
$template->setVariable("COLOR_CLASS", $css_class);
$output .= $template->get();
}
}
return $output;
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::getCumulatedResultsDetails | ( | $ | survey_id, | |
| $ | counter | |||
| ) |
Creates the detailed output of the cumulated results for the question.
Creates the detailed output of the cumulated results for the question
| integer | $survey_id The database ID of the survey | |
| integer | $counter The counter of the question position in the survey |
Definition at line 1729 of file class.SurveyMatrixQuestionGUI.php.
References ilObjSurvey::_getNrOfParticipants().
{
if (count($this->cumulated) == 0)
{
include_once "./Modules/Survey/classes/class.ilObjSurvey.php";
$nr_of_users = ilObjSurvey::_getNrOfParticipants($survey_id);
$this->cumulated =& $this->object->getCumulatedResults($survey_id, $nr_of_users);
}
$output = "";
include_once "./classes/class.ilTemplate.php";
$template = new ilTemplate("tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE, "Modules/Survey");
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("question"));
$questiontext = $this->object->getQuestiontext();
$template->setVariable("TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("question_type"));
$template->setVariable("TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("users_answered"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["USERS_ANSWERED"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("users_skipped"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["USERS_SKIPPED"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("mode"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["MODE"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("mode_nr_of_selections"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["MODE_NR_OF_SELECTIONS"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("median"));
$template->setVariable("TEXT_OPTION_VALUE", $this->cumulated["TOTAL"]["MEDIAN"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("categories"));
$columns = "";
foreach ($this->cumulated["TOTAL"]["variables"] as $key => $value)
{
$columns .= "<li>" . $this->lng->txt("title") . ":" . "<span class=\"bold\">" . $value["title"] . "</span><br />" .
$this->lng->txt("category_nr_selected") . ": " . "<span class=\"bold\">" . $value["selected"] . "</span><br />" .
$this->lng->txt("percentage_of_selections") . ": " . "<span class=\"bold\">" . sprintf("%.2f", 100*$value["percentage"]) . "</span></li>";
}
$columns = "<ol>$columns</ol>";
$template->setVariable("TEXT_OPTION_VALUE", $columns);
$template->parseCurrentBlock();
foreach ($this->cumulated as $key => $value)
{
if (is_numeric($key))
{
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("row"));
$questiontext = $value["ROW"];
$template->setVariable("TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("users_answered"));
$template->setVariable("TEXT_OPTION_VALUE", $value["USERS_ANSWERED"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("users_skipped"));
$template->setVariable("TEXT_OPTION_VALUE", $value["USERS_SKIPPED"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("mode"));
$template->setVariable("TEXT_OPTION_VALUE", $value["MODE"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("mode_nr_of_selections"));
$template->setVariable("TEXT_OPTION_VALUE", $value["MODE_NR_OF_SELECTIONS"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("median"));
$template->setVariable("TEXT_OPTION_VALUE", $value["MEDIAN"]);
$template->parseCurrentBlock();
$template->setCurrentBlock("detail_row");
$template->setVariable("TEXT_OPTION", $this->lng->txt("categories"));
$columns = "";
foreach ($value["variables"] as $key => $value)
{
$columns .= "<li>" . $this->lng->txt("title") . ":" . "<span class=\"bold\">" . $value["title"] . "</span><br />" .
$this->lng->txt("category_nr_selected") . ": " . "<span class=\"bold\">" . $value["selected"] . "</span><br />" .
$this->lng->txt("percentage_of_selections") . ": " . "<span class=\"bold\">" . sprintf("%.2f", 100*$value["percentage"]) . "</span></li>";
}
$columns = "<ol>$columns</ol>";
$template->setVariable("TEXT_OPTION_VALUE", $columns);
$template->parseCurrentBlock();
}
}
// display chart for matrix question for array $eval["variables"]
foreach ($this->cumulated as $key => $value)
{
if (is_numeric($key))
{
$template->setCurrentBlock("chartimage");
$template->setVariable("ALT_CHART", $this->lng->txt("chart"));
$this->ctrl->setParameterByClass("ilsurveyevaluationgui", "type", $key);
$this->ctrl->setParameterByClass("ilsurveyevaluationgui", "survey", $survey_id);
$this->ctrl->setParameterByClass("ilsurveyevaluationgui", "question", $this->object->getId());
$template->setVariable("CHART", $this->ctrl->getLinkTargetByClass("ilsurveyevaluationgui", "outChart"));
$template->parseCurrentBlock();
}
}
$template->setCurrentBlock("chart");
$template->setVariable("TEXT_CHART", $this->lng->txt("chart"));
$template->parseCurrentBlock();
$template->setVariable("QUESTION_TITLE", "$counter. ".$this->object->getTitle());
$output = $template->get();
return $output;
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::getLayoutRow | ( | ) |
Creates a row to define the matrix question layout with percentage values.
Creates a row to define the matrix question layout with percentage values
public
Definition at line 809 of file class.SurveyMatrixQuestionGUI.php.
Referenced by getPrintView(), and getWorkingForm().
{
$percent_values = $this->object->getLayout();
$template = new ilTemplate("tpl.il_svy_out_matrix_layout.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
if (strlen($this->object->getBipolarAdjective(0)) && strlen($this->object->getBipolarAdjective(1)))
{
$template->setCurrentBlock("bipolar_start");
$template->setVariable("VALUE_PERCENT_BIPOLAR_ADJECTIVE1", " value=\"" . $percent_values["percent_bipolar_adjective1"] . "\"");
$template->setVariable("STYLE", " style=\"width:" . $percent_values["percent_bipolar_adjective1"] . "%\"");
$template->parseCurrentBlock();
$template->setCurrentBlock("bipolar_end");
$template->setVariable("VALUE_PERCENT_BIPOLAR_ADJECTIVE2", " value=\"" . $percent_values["percent_bipolar_adjective2"] . "\"");
$template->setVariable("STYLE", " style=\"width:" . $percent_values["percent_bipolar_adjective2"] . "%\"");
$template->parseCurrentBlock();
}
if (strlen($this->object->getNeutralColumn()))
{
$template->setCurrentBlock("bipolar_end");
$template->setVariable("VALUE_PERCENT_NEUTRAL", " value=\"" . $percent_values["percent_neutral"] . "\"");
$template->setVariable("STYLE_NEUTRAL", " style=\"width:" . $percent_values["percent_neutral"] . "%\"");
$template->parseCurrentBlock();
}
$template->setVariable("VALUE_PERCENT_ROW", " value=\"" . $percent_values["percent_row"] . "\"");
$template->setVariable("STYLE_ROW", " style=\"width:" . $percent_values["percent_row"] . "%\"");
$counter = $this->object->getColumnCount();
$template->setVariable("COLSPAN_COLUMNS", $counter);
$template->setVariable("VALUE_PERCENT_COLUMNS", " value=\"" . $percent_values["percent_columns"] . "\"");
$template->setVariable("STYLE_COLUMNS", " style=\"width:" . $percent_values["percent_columns"] . "%\"");
return $template->get();
}
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::getPrintView | ( | $ | question_title = 1, |
|
| $ | show_questiontext = 1 | |||
| ) |
Creates a HTML representation of the question.
Creates a HTML representation of the question
private
Reimplemented from SurveyQuestionGUI.
Definition at line 511 of file class.SurveyMatrixQuestionGUI.php.
References ilUtil::getHtmlPath(), ilUtil::getImagePath(), getLayoutRow(), and ilUtil::prepareFormOutput().
{
$layout = $this->object->getLayout();
$neutralstyle = "3px solid #808080";
$bordercolor = "#808080";
$template = new ilTemplate("tpl.il_svy_qpl_matrix_printview.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
if ($this->show_layout_row)
{
$layout_row = $this->getLayoutRow();
$template->setCurrentBlock("matrix_row");
$template->setVariable("ROW", $layout_row);
$template->parseCurrentBlock();
}
$tplheaders = new ilTemplate("tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
{
$tplheaders->setCurrentBlock("bipolar_start");
$style = array();
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_bipolar_adjective1"], "%"));
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplheaders->parseCurrentBlock();
}
// column headers
for ($i = 0; $i < $this->object->getColumnCount(); $i++)
{
$style = array();
if ($this->object->getColumnSeparators() == 1)
{
if (($i < $this->object->getColumnCount() - 1))
{
array_push($style, "border-right: 1px solid $bordercolor!important");
}
}
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_columns"] / $this->object->getColumnCount(), "%"));
$tplheaders->setCurrentBlock("column_header");
$tplheaders->setVariable("TEXT", ilUtil::prepareFormOutput($this->object->getColumn($i)));
$tplheaders->setVariable("CLASS", "center");
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplheaders->parseCurrentBlock();
}
if (strlen($this->object->getNeutralColumn()))
{
$tplheaders->setCurrentBlock("neutral_column_header");
$tplheaders->setVariable("TEXT", ilUtil::prepareFormOutput($this->object->getNeutralColumn()));
$tplheaders->setVariable("CLASS", "rsep");
$style = array();
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_neutral"], "%"));
if ($this->object->getNeutralColumnSeparator())
{
array_push($style, "border-left: $neutralstyle!important;");
}
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplheaders->parseCurrentBlock();
}
if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
{
$tplheaders->setCurrentBlock("bipolar_end");
$style = array();
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_bipolar_adjective2"], "%"));
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplheaders->parseCurrentBlock();
}
$style = array();
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_row"], "%"));
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$template->setCurrentBlock("matrix_row");
$template->setVariable("ROW", $tplheaders->get());
$template->parseCurrentBlock();
$rowclass = array("tblrow1", "tblrow2");
for ($i = 0; $i < $this->object->getRowCount(); $i++)
{
$tplrow = new ilTemplate("tpl.il_svy_qpl_matrix_printview_row.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
for ($j = 0; $j < $this->object->getColumnCount(); $j++)
{
if (($i == 0) && ($j == 0))
{
if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
{
$tplrow->setCurrentBlock("bipolar_start");
$tplrow->setVariable("TEXT_BIPOLAR_START", ilUtil::prepareFormOutput($this->object->getBipolarAdjective(0)));
$tplrow->setVariable("ROWSPAN", $this->object->getRowCount());
$tplrow->parseCurrentBlock();
}
}
if (($i == 0) && ($j == $this->object->getColumnCount()-1))
{
if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
{
$tplrow->setCurrentBlock("bipolar_end");
$tplrow->setVariable("TEXT_BIPOLAR_END", ilUtil::prepareFormOutput($this->object->getBipolarAdjective(1)));
$tplrow->setVariable("ROWSPAN", $this->object->getRowCount());
$tplrow->parseCurrentBlock();
}
}
switch ($this->object->getSubtype())
{
case 0:
$tplrow->setCurrentBlock("radiobutton");
$tplrow->setVariable("IMAGE_RADIO", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.gif")));
$tplrow->setVariable("ALT_RADIO", $this->lng->txt("unchecked"));
$tplrow->setVariable("TITLE_RADIO", $this->lng->txt("unchecked"));
$tplrow->parseCurrentBlock();
break;
case 1:
$tplrow->setCurrentBlock("checkbox");
$tplrow->setVariable("IMAGE_CHECKBOX", ilUtil::getHtmlPath(ilUtil::getImagePath("checkbox_unchecked.gif")));
$tplrow->setVariable("ALT_CHECKBOX", $this->lng->txt("unchecked"));
$tplrow->setVariable("TITLE_CHECKBOX", $this->lng->txt("unchecked"));
$tplrow->parseCurrentBlock();
break;
}
$tplrow->setCurrentBlock("answer");
$style = array();
if ($this->object->getColumnSeparators() == 1)
{
if ($j < $this->object->getColumnCount() - 1)
{
array_push($style, "border-right: 1px solid $bordercolor!important");
}
}
if ($this->object->getRowSeparators() == 1)
{
if ($i < $this->object->getRowCount() - 1)
{
array_push($style, "border-bottom: 1px solid $bordercolor!important");
}
}
if (count($style))
{
$tplrow->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplrow->parseCurrentBlock();
}
if (strlen($this->object->getNeutralColumn()))
{
$j = $this->object->getRowCount();
switch ($this->object->getSubtype())
{
case 0:
$tplrow->setCurrentBlock("neutral_radiobutton");
$tplrow->setVariable("IMAGE_RADIO", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.gif")));
$tplrow->setVariable("ALT_RADIO", $this->lng->txt("unchecked"));
$tplrow->setVariable("TITLE_RADIO", $this->lng->txt("unchecked"));
$tplrow->parseCurrentBlock();
break;
case 1:
$tplrow->setCurrentBlock("neutral_checkbox");
$tplrow->setVariable("IMAGE_CHECKBOX", ilUtil::getHtmlPath(ilUtil::getImagePath("checkbox_unchecked.gif")));
$tplrow->setVariable("ALT_CHECKBOX", $this->lng->txt("unchecked"));
$tplrow->setVariable("TITLE_CHECKBOX", $this->lng->txt("unchecked"));
$tplrow->parseCurrentBlock();
break;
}
$tplrow->setCurrentBlock("neutral_answer");
$style = array();
if ($this->object->getNeutralColumnSeparator())
{
array_push($style, "border-left: $neutralstyle!important");
}
if ($this->object->getColumnSeparators() == 1)
{
if ($j < $this->object->getColumnCount() - 1)
{
array_push($style, "border-right: 1px solid $bordercolor!important");
}
}
if ($this->object->getRowSeparators() == 1)
{
if ($i < $this->object->getRowCount() - 1)
{
array_push($style, "border-bottom: 1px solid $bordercolor!important");
}
}
if (count($style))
{
$tplrow->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplrow->parseCurrentBlock();
}
$tplrow->setVariable("TEXT_ROW", ilUtil::prepareFormOutput($this->object->getRow($i)));
$tplrow->setVariable("ROWCLASS", $rowclass[$i % 2]);
if ($this->object->getRowSeparators() == 1)
{
if ($i < $this->object->getRowCount() - 1)
{
$tplrow->setVariable("STYLE", " style=\"border-bottom: 1px solid $bordercolor!important\"");
}
}
$template->setCurrentBlock("matrix_row");
$template->setVariable("ROW", $tplrow->get());
$template->parseCurrentBlock();
}
if ($question_title)
{
$template->setVariable("QUESTION_TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
}
$template->setCurrentBlock();
if ($show_questiontext)
{
$questiontext = $this->object->getQuestiontext();
$template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
}
if (! $this->object->getObligatory())
{
$template->setVariable("OBLIGATORY_TEXT", $this->lng->txt("survey_question_optional"));
}
$template->parseCurrentBlock();
return $template->get();
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::getWorkingForm | ( | $ | working_data = "", |
|
| $ | question_title = 1, |
|||
| $ | show_questiontext = 1, |
|||
| $ | error_message = "" | |||
| ) |
Creates the question output form for the learner.
Creates the question output form for the learner
public
Definition at line 214 of file class.SurveyMatrixQuestionGUI.php.
References $data, SurveyQuestion::_getInternalLinkHref(), getLayoutRow(), and ilUtil::prepareFormOutput().
Referenced by layout(), and preview().
{
$layout = $this->object->getLayout();
$neutralstyle = "3px solid #808080";
$bordercolor = "#808080";
$template = new ilTemplate("tpl.il_svy_out_matrix.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
if (count($this->object->material))
{
$template->setCurrentBlock("material_matrix");
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$href = SurveyQuestion::_getInternalLinkHref($this->object->material["internal_link"]);
$template->setVariable("TEXT_MATERIAL", $this->lng->txt("material") . ": <a href=\"$href\" target=\"content\">" . $this->object->material["title"]. "</a> ");
$template->parseCurrentBlock();
}
if ($this->show_layout_row)
{
$layout_row = $this->getLayoutRow();
$template->setCurrentBlock("matrix_row");
$template->setVariable("ROW", $layout_row);
$template->parseCurrentBlock();
}
$tplheaders = new ilTemplate("tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
{
$tplheaders->setCurrentBlock("bipolar_start");
$style = array();
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_bipolar_adjective1"], "%"));
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplheaders->parseCurrentBlock();
}
// column headers
for ($i = 0; $i < $this->object->getColumnCount(); $i++)
{
$style = array();
if ($this->object->getColumnSeparators() == 1)
{
if (($i < $this->object->getColumnCount() - 1))
{
array_push($style, "border-right: 1px solid $bordercolor!important");
}
}
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_columns"] / $this->object->getColumnCount(), "%"));
$tplheaders->setCurrentBlock("column_header");
$tplheaders->setVariable("TEXT", ilUtil::prepareFormOutput($this->object->getColumn($i)));
$tplheaders->setVariable("CLASS", "center");
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplheaders->parseCurrentBlock();
}
if (strlen($this->object->getNeutralColumn()))
{
$tplheaders->setCurrentBlock("neutral_column_header");
$tplheaders->setVariable("TEXT", ilUtil::prepareFormOutput($this->object->getNeutralColumn()));
$tplheaders->setVariable("CLASS", "rsep");
$style = array();
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_neutral"], "%"));
if ($this->object->getNeutralColumnSeparator())
{
array_push($style, "border-left: $neutralstyle!important;");
}
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplheaders->parseCurrentBlock();
}
if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
{
$tplheaders->setCurrentBlock("bipolar_end");
$style = array();
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_bipolar_adjective2"], "%"));
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplheaders->parseCurrentBlock();
}
$style = array();
array_push($style, sprintf("width: %.2f%s!important", $layout["percent_row"], "%"));
if (count($style) > 0)
{
$tplheaders->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$template->setCurrentBlock("matrix_row");
$template->setVariable("ROW", $tplheaders->get());
$template->parseCurrentBlock();
$rowclass = array("tblrow1", "tblrow2");
for ($i = 0; $i < $this->object->getRowCount(); $i++)
{
$tplrow = new ilTemplate("tpl.il_svy_out_matrix_row.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
for ($j = 0; $j < $this->object->getColumnCount(); $j++)
{
if (($i == 0) && ($j == 0))
{
if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
{
$tplrow->setCurrentBlock("bipolar_start");
$tplrow->setVariable("TEXT_BIPOLAR_START", ilUtil::prepareFormOutput($this->object->getBipolarAdjective(0)));
$tplrow->setVariable("ROWSPAN", $this->object->getRowCount());
$tplrow->parseCurrentBlock();
}
}
if (($i == 0) && ($j == $this->object->getColumnCount()-1))
{
if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
{
$tplrow->setCurrentBlock("bipolar_end");
$tplrow->setVariable("TEXT_BIPOLAR_END", ilUtil::prepareFormOutput($this->object->getBipolarAdjective(1)));
$tplrow->setVariable("ROWSPAN", $this->object->getRowCount());
$tplrow->parseCurrentBlock();
}
}
switch ($this->object->getSubtype())
{
case 0:
$tplrow->setCurrentBlock("radiobutton");
$tplrow->setVariable("QUESTION_ID", $this->object->getId());
$tplrow->setVariable("ROW", $i);
$tplrow->setVariable("VALUE", $j);
if (is_array($working_data))
{
foreach ($working_data as $data)
{
if (($data["value"] == $j) && ($data["row"] == $i))
{
$tplrow->setVariable("CHECKED_RADIOBUTTON", " checked=\"checked\"");
}
}
}
$tplrow->parseCurrentBlock();
break;
case 1:
$tplrow->setCurrentBlock("checkbox");
$tplrow->setVariable("QUESTION_ID", $this->object->getId());
$tplrow->setVariable("ROW", $i);
$tplrow->setVariable("VALUE", $j);
if (is_array($working_data))
{
foreach ($working_data as $data)
{
if (($data["value"] == $j) && ($data["row"] == $i))
{
$tplrow->setVariable("CHECKED_CHECKBOX", " checked=\"checked\"");
}
}
}
$tplrow->parseCurrentBlock();
break;
}
$tplrow->setCurrentBlock("answer");
$style = array();
if ($this->object->getColumnSeparators() == 1)
{
if ($j < $this->object->getColumnCount() - 1)
{
array_push($style, "border-right: 1px solid $bordercolor!important");
}
}
if ($this->object->getRowSeparators() == 1)
{
if ($i < $this->object->getRowCount() - 1)
{
array_push($style, "border-bottom: 1px solid $bordercolor!important");
}
}
if (count($style))
{
$tplrow->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplrow->parseCurrentBlock();
}
if (strlen($this->object->getNeutralColumn()))
{
$j = $this->object->getNeutralColumnIndex();
switch ($this->object->getSubtype())
{
case 0:
$tplrow->setCurrentBlock("neutral_radiobutton");
$tplrow->setVariable("QUESTION_ID", $this->object->getId());
$tplrow->setVariable("ROW", $i);
$tplrow->setVariable("VALUE", $j);
if (is_array($working_data))
{
foreach ($working_data as $data)
{
if (($data["value"] == $j) && ($data["row"] == $i))
{
$tplrow->setVariable("CHECKED_RADIOBUTTON", " checked=\"checked\"");
}
}
}
$tplrow->parseCurrentBlock();
break;
case 1:
$tplrow->setCurrentBlock("neutral_checkbox");
$tplrow->setVariable("QUESTION_ID", $this->object->getId());
$tplrow->setVariable("ROW", $i);
$tplrow->setVariable("VALUE", $j);
if (is_array($working_data))
{
foreach ($working_data as $data)
{
if (($data["value"] == $j) && ($data["row"] == $i))
{
$tplrow->setVariable("CHECKED_CHECKBOX", " checked=\"checked\"");
}
}
}
$tplrow->parseCurrentBlock();
break;
}
$tplrow->setCurrentBlock("neutral_answer");
$style = array();
if ($this->object->getNeutralColumnSeparator())
{
array_push($style, "border-left: $neutralstyle!important");
}
if ($this->object->getColumnSeparators() == 1)
{
if ($j < $this->object->getColumnCount() - 1)
{
array_push($style, "border-right: 1px solid $bordercolor!important");
}
}
if ($this->object->getRowSeparators() == 1)
{
if ($i < $this->object->getRowCount() - 1)
{
array_push($style, "border-bottom: 1px solid $bordercolor!important");
}
}
if (count($style))
{
$tplrow->setVariable("STYLE", " style=\"" . implode(";", $style) . "\"");
}
$tplrow->parseCurrentBlock();
}
$tplrow->setVariable("TEXT_ROW", ilUtil::prepareFormOutput($this->object->getRow($i)));
$tplrow->setVariable("ROWCLASS", $rowclass[$i % 2]);
if ($this->object->getRowSeparators() == 1)
{
if ($i < $this->object->getRowCount() - 1)
{
$tplrow->setVariable("STYLE", " style=\"border-bottom: 1px solid $bordercolor!important\"");
}
}
$template->setCurrentBlock("matrix_row");
$template->setVariable("ROW", $tplrow->get());
$template->parseCurrentBlock();
}
if ($question_title)
{
$template->setVariable("QUESTION_TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
}
$template->setCurrentBlock("question_data_matrix");
if (strcmp($error_message, "") != 0)
{
$template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
}
if ($show_questiontext)
{
$questiontext = $this->object->getQuestiontext();
$template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
}
if (! $this->object->getObligatory())
{
$template->setVariable("OBLIGATORY_TEXT", $this->lng->txt("survey_question_optional"));
}
$template->parseCurrentBlock();
return $template->get();
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::insertStandardNumbers | ( | ) |
Insert standard numbers to the question.
Insert standard numbers to the question
public
Definition at line 1351 of file class.SurveyMatrixQuestionGUI.php.
References addStandardNumbers(), and ilUtil::sendInfo().
{
if ((strcmp($_POST["lower_limit"], "") == 0) or (strcmp($_POST["upper_limit"], "") == 0))
{
ilUtil::sendInfo($this->lng->txt("missing_upper_or_lower_limit"));
$this->addStandardNumbers();
}
else if ((int)$_POST["upper_limit"] <= (int)$_POST["lower_limit"])
{
ilUtil::sendInfo($this->lng->txt("upper_limit_must_be_greater"));
$this->addStandardNumbers();
}
else
{
$this->object->addStandardNumbers($_POST["lower_limit"], $_POST["upper_limit"]);
$this->object->saveColumnsToDb();
$this->ctrl->redirect($this, "categories");
}
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::layout | ( | ) |
Creates a layout view of the question.
Creates a layout view of the question
public
Definition at line 770 of file class.SurveyMatrixQuestionGUI.php.
References getWorkingForm().
Referenced by saveLayout().
{
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_layout.html", "Modules/SurveyQuestionPool");
$this->show_layout_row = TRUE;
$question_output = $this->getWorkingForm();
$this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "saveLayout"));
$this->tpl->setVariable("SAVE", $this->lng->txt("save"));
$this->tpl->parseCurrentBlock();
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::moveColumnDown | ( | $ | column | ) |
Moves a column down.
Moves a column down
public
Definition at line 916 of file class.SurveyMatrixQuestionGUI.php.
References $_SESSION, and writeRowColData().
Referenced by categories().
{
$complete = $this->writeRowColData();
$columntext = $this->object->getColumn($column);
$this->object->removeColumn($column);
$this->object->addColumnAtPosition($columntext, $column + 1);
$_SESSION["spl_modified"] = TRUE;
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::moveColumnUp | ( | $ | column | ) |
Moves a column up.
Moves a column up
public
Definition at line 900 of file class.SurveyMatrixQuestionGUI.php.
References $_SESSION, and writeRowColData().
Referenced by categories().
{
$complete = $this->writeRowColData();
$columntext = $this->object->getColumn($column);
$this->object->removeColumn($column);
$this->object->addColumnAtPosition($columntext, $column - 1);
$_SESSION["spl_modified"] = TRUE;
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::preview | ( | ) |
Creates a preview of the question.
Creates a preview of the question
private
Definition at line 755 of file class.SurveyMatrixQuestionGUI.php.
References getWorkingForm().
{
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_preview.html", "Modules/SurveyQuestionPool");
$question_output = $this->getWorkingForm();
$this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
$this->tpl->parseCurrentBlock();
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::saveLayout | ( | ) |
Saves the layout for the matrix question.
Saves the layout for the matrix question
Definition at line 788 of file class.SurveyMatrixQuestionGUI.php.
References layout().
{
$this->object->saveLayout($_POST["percent_row"], $_POST['percent_columns'], $_POST['percent_bipolar_adjective1'], $_POST['percent_bipolar_adjective2'], $_POST["percent_neutral"]);
$percent_values = array(
"percent_row" => $_POST["percent_row"],
"percent_columns" => $_POST["percent_columns"],
"percent_bipolar_adjective1" => $_POST['percent_bipolar_adjective1'],
"percent_bipolar_adjective2" => $_POST['percent_bipolar_adjective2'],
"percent_neutral" => $_POST["percent_neutral"]
);
$this->object->setLayout($percent_values);
$this->layout();
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::savePhrase | ( | ) |
Creates an output to save a phrase.
Creates an output to save a phrase
public
Definition at line 1378 of file class.SurveyMatrixQuestionGUI.php.
References $_SESSION, categories(), ilUtil::sendInfo(), and writeRowColData().
Referenced by confirmSavePhrase().
{
$complete = $this->writeRowColData(true);
if (!$complete)
{
$_SESSION["spl_modified"] = TRUE;
ilUtil::sendInfo($this->errormessage);
return $this->categories();
}
$nothing_selected = true;
if (array_key_exists("chb_category", $_POST))
{
if (count($_POST["chb_category"]))
{
$nothing_selected = false;
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_savephrase.html", "Modules/SurveyQuestionPool");
$rowclass = array("tblrow1", "tblrow2");
$counter = 0;
foreach ($_POST["chb_category"] as $column)
{
$this->tpl->setCurrentBlock("row");
$this->tpl->setVariable("TXT_TITLE", $this->object->getColumn($column));
$this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("hidden");
$this->tpl->setVariable("HIDDEN_NAME", "chb_category[]");
$this->tpl->setVariable("HIDDEN_VALUE", $column["title"]);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable("SAVE_PHRASE_INTRODUCTION", $this->lng->txt("save_phrase_introduction"));
$this->tpl->setVariable("TEXT_PHRASE_TITLE", $this->lng->txt("enter_phrase_title"));
$this->tpl->setVariable("TXT_TITLE", $this->lng->txt("category"));
$this->tpl->setVariable("VALUE_PHRASE_TITLE", $_POST["phrase_title"]);
$this->tpl->setVariable("BTN_CANCEL",$this->lng->txt("cancel"));
$this->tpl->setVariable("BTN_CONFIRM",$this->lng->txt("confirm"));
$this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "savePhrase"));
$this->tpl->parseCurrentBlock();
}
}
if ($nothing_selected)
{
ilUtil::sendInfo($this->lng->txt("check_category_to_save_phrase"), true);
$this->ctrl->redirect($this, "categories");
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::saveRowColEditor | ( | ) |
Saves the rows and columns.
Saves the rows and columns
private
Definition at line 1573 of file class.SurveyMatrixQuestionGUI.php.
References $_GET, $_SESSION, SurveyQuestion::_isWriteable(), categories(), SurveyQuestionGUI::originalSyncForm(), ilUtil::sendInfo(), and writeRowColData().
{
global $ilUser;
$complete = $this->writeRowColData(true);
if (!$complete)
{
$_SESSION["spl_modified"] = TRUE;
ilUtil::sendInfo($this->errormessage);
$this->categories();
}
else
{
$_SESSION["spl_modified"] = FALSE;
ilUtil::sendInfo($this->lng->txt("saved_successfully"), true);
$originalexists = $this->object->_questionExists($this->object->original_id);
$this->ctrl->setParameter($this, "q_id", $this->object->getId());
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
if ($_GET["calling_survey"] && $originalexists && SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
{
$this->originalSyncForm();
return;
}
else
{
$this->ctrl->redirect($this, "categories");
}
}
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::setQuestionTabs | ( | ) |
Definition at line 1143 of file class.SurveyMatrixQuestionGUI.php.
References $_GET, $ref_id, $title, and SurveyQuestionGUI::getQuestionType().
{
global $rbacsystem,$ilTabs;
$this->ctrl->setParameterByClass("$guiclass", "sel_question_types", $this->getQuestionType());
$this->ctrl->setParameterByClass("$guiclass", "q_id", $_GET["q_id"]);
if (($_GET["calling_survey"] > 0) || ($_GET["new_for_survey"] > 0))
{
$ref_id = $_GET["calling_survey"];
if (!strlen($ref_id)) $ref_id = $_GET["new_for_survey"];
$addurl = "";
if (strlen($_GET["new_for_survey"]))
{
$addurl = "&new_id=" . $_GET["q_id"];
}
$ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), "ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions" . $addurl);
}
else
{
$ilTabs->setBackTarget($this->lng->txt("spl"), $this->ctrl->getLinkTargetByClass("ilObjSurveyQuestionPoolGUI", "questions"));
}
if ($_GET["q_id"])
{
$ilTabs->addTarget("preview",
$this->ctrl->getLinkTarget($this, "preview"),
array("preview"),
"",
"");
$ilTabs->addTarget("layout",
$this->ctrl->getLinkTarget($this, "layout"),
array("layout", "saveLayout"),
"",
"");
}
if ($rbacsystem->checkAccess('edit', $_GET["ref_id"]))
{
$ilTabs->addTarget("edit_properties",
$this->ctrl->getLinkTarget($this, "editQuestion"),
array("editQuestion", "cancelExplorer", "linkChilds", "addGIT", "addST",
"addPG", "editQuestion", "addMaterial", "removeMaterial",
"save", "cancel"),
"",
"");
}
if ($this->object->getId() > 0)
{
$ilTabs->addTarget("matrix_columns_rows",
$this->ctrl->getLinkTarget($this, "categories"),
array("categories", "addColumn", "addRow", "deleteRow", "moveColumn",
"deleteColumn", "saveRowColEditor", "savePhrase", "addPhrase",
"savePhrase", "addSelectedPhrase", "cancelViewPhrase", "confirmSavePhrase",
"cancelSavePhrase", "confirmdeleteColumn", "canceldeleteColumn"),
"",
""
);
}
if ($this->object->getId() > 0)
{
$title = $this->lng->txt("edit") . " "" . $this->object->getTitle() . """;
}
else
{
$title = $this->lng->txt("create_new") . " " . $this->lng->txt($this->getQuestionType());
}
$this->tpl->setVariable("HEADER", $title);
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::SurveyMatrixQuestionGUI | ( | $ | id = -1 |
) |
SurveyMatrixQuestionGUI constructor.
The constructor takes possible arguments an creates an instance of the SurveyMatrixQuestionGUI object.
| integer | $id The database id of a matrix question object public |
Definition at line 50 of file class.SurveyMatrixQuestionGUI.php.
References SurveyQuestionGUI::SurveyQuestionGUI().
{
$this->SurveyQuestionGUI();
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestion.php";
$this->object = new SurveyMatrixQuestion();
$this->show_layout_row = FALSE;
if ($id >= 0)
{
$this->object->loadFromDb($id);
}
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::writePostData | ( | ) |
Evaluates a posted edit form and writes the form data in the question object.
Evaluates a posted edit form and writes the form data in the question object
Definition at line 848 of file class.SurveyMatrixQuestionGUI.php.
References ilObjAdvancedEditing::_getUsedHTMLTagsAsString(), and ilUtil::stripSlashes().
{
$result = 0;
if ((!$_POST["title"]) or (!$_POST["author"]) or (!$_POST["question"]))
$result = 1;
// Set the question id from a hidden form parameter
if ($_POST["id"] > 0)
$this->object->setId($_POST["id"]);
include_once "./Services/Utilities/classes/class.ilUtil.php";
$this->object->setTitle(ilUtil::stripSlashes($_POST["title"]));
$this->object->setAuthor(ilUtil::stripSlashes($_POST["author"]));
$this->object->setDescription(ilUtil::stripSlashes($_POST["description"]));
$this->object->setOrientation($_POST["orientation"]);
if (strlen($_POST["material"]))
{
$this->object->setMaterial($_POST["material"], 0, ilUtil::stripSlashes($_POST["material_title"]));
}
include_once "./classes/class.ilObjAdvancedEditing.php";
$questiontext = ilUtil::stripSlashes($_POST["question"], true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("survey"));
$this->object->setQuestiontext($questiontext);
if ($_POST["obligatory"])
{
$this->object->setObligatory(1);
}
else
{
$this->object->setObligatory(0);
}
$this->object->setSubtype($_POST["subtype"]);
$this->object->setRowSeparators(($_POST["row_separators"]) ? 1 : 0);
$this->object->setColumnSeparators(($_POST["column_separators"]) ? 1 : 0);
$this->object->setNeutralColumnSeparator(($_POST["neutral_column_separator"]) ? 1 : 0);
if ($saved)
{
// If the question was saved automatically before an upload, we have to make
// sure, that the state after the upload is saved. Otherwise the user could be
// irritated, if he presses cancel, because he only has the question state before
// the upload process.
$this->object->saveToDb();
}
return $result;
}
Here is the call graph for this function:| SurveyMatrixQuestionGUI::writeRowColData | ( | $ | save = FALSE |
) |
Saves the columns and rows of the question.
Saves the columns and rows of the question
| boolean | $save If set to true the POST data will be saved to the database private |
Definition at line 1505 of file class.SurveyMatrixQuestionGUI.php.
References ilUtil::stripSlashes().
Referenced by addColumn(), addPhrase(), deleteColumn(), deleteRow(), moveColumnDown(), moveColumnUp(), savePhrase(), and saveRowColEditor().
{
// Delete all existing columns and create new columns from the form data
$this->object->flushColumns();
$this->object->flushRows();
$messages = array();
$columnscomplete = TRUE;
$rowscomplete = TRUE;
// Add standard columns and rows
include_once "./Services/Utilities/classes/class.ilUtil.php";
$cats = "";
$rows = "";
foreach ($_POST as $key => $value)
{
if (preg_match("/^category_(\d+)/", $key, $matches))
{
$this->object->addColumn(ilUtil::stripSlashes($value));
$cats .= $value;
}
if (preg_match("/^row_(\d+)/", $key, $matches))
{
$this->object->addRow(ilUtil::stripSlashes($value));
$rows .= $value;
}
}
if (strlen($cats) == 0)
{
$columnscomplete = FALSE;
array_push($messages, $this->lng->txt("matrix_error_no_columns"));
}
if (strlen($rows) == 0)
{
$rowscomplete = FALSE;
array_push($messages, $this->lng->txt("matrix_error_no_rows"));
}
// Set neutral column
$this->object->setNeutralColumn(ilUtil::stripSlashes($_POST["neutral"]));
// Set bipolar adjectives
$this->object->setBipolarAdjective(0, ilUtil::stripSlashes($_POST["bipolar1"]));
$this->object->setBipolarAdjective(1, ilUtil::stripSlashes($_POST["bipolar2"]));
if ($save)
{
$this->object->saveColumnsToDb();
$this->object->saveRowsToDb();
if (array_key_exists("bipolar1", $_POST))
{
$this->object->saveBipolarAdjectives(ilUtil::stripSlashes($_POST["bipolar1"]), ilUtil::stripSlashes($_POST["bipolar2"]));
}
}
if (count($messages))
{
$this->errormessage = implode("<br />", $messages);
}
return $columnscomplete && $rowscomplete;
}
Here is the call graph for this function:
Here is the caller graph for this function:| SurveyMatrixQuestionGUI::$show_layout_row |
Definition at line 40 of file class.SurveyMatrixQuestionGUI.php.
1.7.1