20 $this->parent_gui = $a_parent_gui;
21 $this->
object = $this->parent_gui->object;
32 $cmd = $ilCtrl->getCmd(
"constraints");
44 if (array_key_exists(
"step",
$_GET))
64 include_once
"Modules/Survey/classes/tables/class.SurveyConstraintsTableGUI.php";
66 $this->tpl->setContent(
$tbl->getHTML());
71 $link = $this->ctrl->getLinkTargetByClass(
"ilSurveyParticipantsGUI",
"maintenance");
72 $link =
"<a href=\"".$link.
"\">".$this->lng->txt(
"survey_has_datasets_warning_page_view_link").
"</a>";
73 ilUtil::sendInfo($this->lng->txt(
"survey_has_datasets_warning_page_view").
" ".$link);
86 if (strlen(
$_POST[
"v"]) == 0)
91 $survey_questions =& $this->
object->getSurveyQuestions();
92 $structure =&
$_SESSION[
"constraintstructure"];
93 $include_elements =
$_SESSION[
"includeElements"];
94 foreach ($include_elements as $elementCounter)
96 if (is_array($structure[$elementCounter]))
98 if (strlen(
$_GET[
"precondition"]))
105 foreach ($structure[$elementCounter] as $key => $question_id)
107 $this->
object->addConstraintToQuestion($question_id, $constraint_id);
110 if (count($structure[$elementCounter]) > 1)
112 $this->
object->updateConjunctionForQuestions($structure[$elementCounter],
$_POST[
'c']);
118 $this->ctrl->redirect($this,
"constraints");
126 $survey_questions =& $this->
object->getSurveyQuestions();
127 $structure =&
$_SESSION[
"constraintstructure"];
129 $option_questions =
array();
130 for ($i = 1; $i <
$start; $i++)
132 if (is_array($structure[$i]))
134 foreach ($structure[$i] as $key => $question_id)
136 if ($survey_questions[$question_id][
"usableForPrecondition"])
138 array_push($option_questions,
array(
"question_id" => $survey_questions[$question_id][
"question_id"],
"title" => $survey_questions[$question_id][
"title"],
"type_tag" => $survey_questions[$question_id][
"type_tag"]));
143 if (count($option_questions) == 0)
147 ilUtil::sendInfo($this->lng->txt(
"constraints_no_nonessay_available"),
true);
148 $this->ctrl->redirect($this,
"constraints");
158 $survey_questions =& $this->
object->getSurveyQuestions();
159 $option_questions =
array();
160 array_push($option_questions,
array(
"question_id" =>
$_POST[
"q"],
"title" => $survey_questions[
$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
161 $this->
constraintForm(2, $_POST, $survey_questions, $option_questions);
169 $survey_questions =& $this->
object->getSurveyQuestions();
170 $option_questions =
array();
171 if (strlen(
$_GET[
"precondition"]))
175 $this->ctrl->redirect($this,
"constraints");
178 $pc = $this->
object->getPrecondition(
$_GET[
"precondition"]);
180 "c" => $pc[
"conjunction"],
181 "q" => $pc[
"question_fi"],
182 "r" => $pc[
"relation_id"],
185 array_push($option_questions,
array(
"question_id" => $pc[
"question_fi"],
"title" => $survey_questions[$pc[
"question_fi"]][
"title"],
"type_tag" => $survey_questions[$pc[
"question_fi"]][
"type_tag"]));
186 $this->
constraintForm(3, $postvalues, $survey_questions, $option_questions);
190 array_push($option_questions,
array(
"question_id" =>
$_POST[
"q"],
"title" => $survey_questions[
$_POST[
"q"]][
"title"],
"type_tag" => $survey_questions[$_POST[
"q"]][
"type_tag"]));
191 $this->
constraintForm(3, $_POST, $survey_questions, $option_questions);
197 if (strlen(
$_GET[
"start"])) $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
198 $this->ctrl->saveParameter($this,
"precondition");
199 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
201 $form->setFormAction($this->ctrl->getFormAction($this));
202 $form->setTableWidth(
"100%");
203 $form->setId(
"constraintsForm");
207 $title_ids =
$_SESSION[
"includeElements"];
212 foreach($title_ids as $title_id)
215 if ($survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"questionblock_id"] > 0)
217 $title[] = $this->lng->txt(
"questionblock") .
": " . $survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"questionblock_title"];
222 $title[] = $this->lng->txt($survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"type_tag"]) .
": " .
223 $survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"title"];
232 $fulfilled->addOption(
new ilRadioOption($this->lng->txt(
"conjunction_or"),
'1',
''));
233 $fulfilled->setValue((strlen($postvalues[
'c'])) ? $postvalues[
'c'] : 0);
234 $form->addItem($fulfilled);
236 $step1 =
new ilSelectInputGUI($this->lng->txt(
"step") .
" 1: " . $this->lng->txt(
"select_prior_question"),
"q");
238 if (is_array($questions))
240 foreach ($questions as $question)
245 $step1->setOptions($options);
246 $step1->setValue($postvalues[
"q"]);
247 $form->addItem($step1);
251 $relations = $this->
object->getAllRelations();
252 $step2 =
new ilSelectInputGUI($this->lng->txt(
"step") .
" 2: " . $this->lng->txt(
"select_relation"),
"r");
254 foreach ($relations as $rel_id => $relation)
256 if (in_array($relation[
"short"], $survey_questions[$postvalues[
"q"]][
"availableRelations"]))
258 $options[$rel_id] = $relation[
'short'];
262 $step2->setValue($postvalues[
"r"]);
263 $form->addItem($step2);
268 $variables =& $this->
object->getVariables($postvalues[
"q"]);
269 $question_type = $survey_questions[$postvalues[
"q"]][
"type_tag"];
270 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
272 $question =
new $question_type();
273 $question->loadFromDb($postvalues[
"q"]);
275 $step3 = $question->getPreconditionSelectValue($postvalues[
"v"], $this->lng->txt(
"step") .
" 3: " . $this->lng->txt(
"select_value"),
"v");
276 $form->addItem($step3);
282 $cmd_continue =
"constraintStep2";
283 $cmd_back =
"constraints";
286 $cmd_continue =
"constraintStep3";
287 $cmd_back =
"constraintStep1";
290 $cmd_continue =
"constraintsAdd";
291 $cmd_back =
"constraintStep2";
294 $form->addCommandButton($cmd_back, $this->lng->txt(
"back"));
295 $form->addCommandButton($cmd_continue, $this->lng->txt(
"continue"));
297 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
314 if(!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
327 $id = (int)$_REQUEST[
"precondition"];
330 $this->ctrl->redirect($this,
"constraints");
333 $constraint = $this->
object->getPrecondition($id);
334 $questions = $this->
object->getSurveyQuestions();
335 $question = $questions[$constraint[
"question_fi"]];
336 $relation = $questions[$constraint[
"ref_question_fi"]];
337 $relation = $relation[
"title"];
340 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
343 $question_obj =
new $question_type();
344 $question_obj->loadFromDb($constraint[
"question_fi"]);
345 $valueoutput = $question_obj->getPreconditionValueOutput($constraint[
"value"]);
347 $title = $question[
"title"].
" ".$constraint[
"shortname"].
" ".$valueoutput;
349 $this->ctrl->saveParameter($this,
"precondition");
351 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
353 $cgui->setHeaderText(sprintf($this->lng->txt(
"survey_sure_delete_constraint"),
$title, $relation));
355 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteConstraints"));
356 $cgui->setCancel($this->lng->txt(
"cancel"),
"constraints");
357 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteConstraints");
359 $this->tpl->setContent($cgui->getHTML());
367 $id = (int)$_REQUEST[
"precondition"];
371 $this->
object->deleteConstraint($id);
374 $this->ctrl->redirect($this,
"constraints");
379 $include_elements =
$_POST[
"includeElements"];
380 if ((!is_array($include_elements)) || (count($include_elements) == 0))
382 ilUtil::sendInfo($this->lng->txt(
"constraints_no_questions_or_questionblocks_selected"),
true);
383 $this->ctrl->redirect($this,
"constraints");
385 else if (count($include_elements) >= 1)
387 $_SESSION[
"includeElements"] = $include_elements;
388 sort($include_elements, SORT_NUMERIC);
389 $_GET[
"start"] = $include_elements[0];
398 $this->ctrl->redirect($this,
"constraints");
402 $this->ctrl->setParameter($this,
"precondition",
$_GET[
"precondition"]);
403 $this->ctrl->setParameter($this,
"start",
$_GET[
"start"]);
404 $this->ctrl->redirect($this,
"constraintStep3");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents an option in a radio group.
constraintStep1Object()
Handles the first step of the precondition add action.
createConstraintsObject()
confirmDeleteConstraintsObject()
Delete constraint confirmation.
constraintStep2Object()
Handles the second step of the precondition add action.
Class ilSurveyConstraintsGUI.
static _hasDatasets($survey_id)
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
constraintForm($step, $postvalues, &$survey_questions, $questions=FALSE)
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
TableGUI class for survey constraints.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options
foreach( $_REQUEST as $var) foreach(array('_POST'=> 'HTTP_POST_VARS', '_GET'=> 'HTTP_GET_VARS', '_COOKIE'=> 'HTTP_COOKIE_VARS', '_SERVER'=> 'HTTP_SERVER_VARS', '_ENV'=> 'HTTP_ENV_VARS', '_FILES'=> 'HTTP_POST_FILES') as $array=> $other) $step
deleteConstraintsObject()
Delete constraints of a survey.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
constraintsObject()
Administration page for survey constraints.
validateConstraintForEdit($a_id)
Validate if given constraint id is part of current survey and there are sufficient permissions to edi...
constraintStep3Object()
Handles the third step of the precondition add action.
constraintsAddObject()
Add a precondition for a survey question or question block.
__construct(ilObjSurveyGUI $a_parent_gui)
Confirmation screen class.