40        $this->access = 
$DIC->access();
 
   45        $this->parent_gui = $a_parent_gui;
 
   46        $this->
object = $this->parent_gui->object;
 
   57        $cmd = 
$ilCtrl->getCmd(
"constraints");
 
   69        if (array_key_exists(
"step", 
$_GET)) {
 
   70            $step = (int) 
$_GET[
"step"];
 
   87        include_once 
"Modules/Survey/classes/tables/class.SurveyConstraintsTableGUI.php";
 
   89        $this->tpl->setContent(
$tbl->getHTML());
 
   93            $link = $this->ctrl->getLinkTargetByClass(
"ilSurveyParticipantsGUI", 
"maintenance");
 
   94            $link = 
"<a href=\"" . $link . 
"\">" . $this->lng->txt(
"survey_has_datasets_warning_page_view_link") . 
"</a>";
 
   95            ilUtil::sendInfo($this->lng->txt(
"survey_has_datasets_warning_page_view") . 
" " . $link);
 
  106        if (strlen(
$_POST[
"v"]) == 0) {
 
  110        $survey_questions =&$this->
object->getSurveyQuestions();
 
  111        $structure =&
$_SESSION[
"constraintstructure"];
 
  112        $include_elements = 
$_SESSION[
"includeElements"];
 
  113        foreach ($include_elements as $elementCounter) {
 
  114            if (is_array($structure[$elementCounter])) {
 
  115                if (strlen(
$_GET[
"precondition"])) {
 
  119                    foreach ($structure[$elementCounter] as 
$key => $question_id) {
 
  120                        $this->
object->addConstraintToQuestion($question_id, $constraint_id);
 
  123                if (count($structure[$elementCounter]) > 1) {
 
  124                    $this->
object->updateConjunctionForQuestions($structure[$elementCounter], 
$_POST[
'c']);
 
  130        $this->ctrl->redirect($this, 
"constraints");
 
  138        $survey_questions =&$this->
object->getSurveyQuestions();
 
  139        $structure =&
$_SESSION[
"constraintstructure"];
 
  140        $start = 
$_GET[
"start"];
 
  141        $option_questions = array();
 
  142        for (
$i = 1; 
$i < $start; 
$i++) {
 
  143            if (is_array($structure[
$i])) {
 
  144                foreach ($structure[
$i] as 
$key => $question_id) {
 
  145                    if ($survey_questions[$question_id][
"usableForPrecondition"]) {
 
  146                        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"]));
 
  151        if (count($option_questions) == 0) {
 
  154            ilUtil::sendInfo($this->lng->txt(
"constraints_no_nonessay_available"), 
true);
 
  155            $this->ctrl->redirect($this, 
"constraints");
 
  165        $survey_questions =&$this->
object->getSurveyQuestions();
 
  166        $option_questions = array();
 
  167        array_push($option_questions, array(
"question_id" => 
$_POST[
"q"], 
"title" => $survey_questions[
$_POST[
"q"]][
"title"], 
"type_tag" => $survey_questions[
$_POST[
"q"]][
"type_tag"]));
 
  168        $this->
constraintForm(2, $_POST, $survey_questions, $option_questions);
 
  176        $survey_questions =&$this->
object->getSurveyQuestions();
 
  177        $option_questions = array();
 
  178        if (strlen(
$_GET[
"precondition"])) {
 
  180                $this->ctrl->redirect($this, 
"constraints");
 
  183            $pc = $this->
object->getPrecondition(
$_GET[
"precondition"]);
 
  185                "c" => $pc[
"conjunction"],
 
  186                "q" => $pc[
"question_fi"],
 
  187                "r" => $pc[
"relation_id"],
 
  190            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"]));
 
  191            $this->
constraintForm(3, $postvalues, $survey_questions, $option_questions);
 
  193            array_push($option_questions, array(
"question_id" => 
$_POST[
"q"], 
"title" => $survey_questions[
$_POST[
"q"]][
"title"], 
"type_tag" => $survey_questions[
$_POST[
"q"]][
"type_tag"]));
 
  194            $this->
constraintForm(3, $_POST, $survey_questions, $option_questions);
 
  198    public function constraintForm($step, $postvalues, &$survey_questions, $questions = 
false)
 
  200        if (strlen(
$_GET[
"start"])) {
 
  201            $this->ctrl->setParameter($this, 
"start", 
$_GET[
"start"]);
 
  203        $this->ctrl->saveParameter($this, 
"precondition");
 
  204        include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  206        $form->setFormAction($this->ctrl->getFormAction($this));
 
  207        $form->setTableWidth(
"100%");
 
  208        $form->setId(
"constraintsForm");
 
  212        $title_ids = 
$_SESSION[
"includeElements"];
 
  214            $title_ids = array(
$_GET[
"start"]);
 
  216        foreach ($title_ids as $title_id) {
 
  218            if ($survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"questionblock_id"] > 0) {
 
  219                $title[] = $this->lng->txt(
"questionblock") . 
": " . $survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"questionblock_title"];
 
  223                $title[] = $this->lng->txt($survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"type_tag"]) . 
": " .
 
  224                    $survey_questions[
$_SESSION[
"constraintstructure"][$title_id][0]][
"title"];
 
  232        $fulfilled->addOption(
new ilRadioOption($this->lng->txt(
"conjunction_and"), 
'0', 
''));
 
  233        $fulfilled->addOption(
new ilRadioOption($this->lng->txt(
"conjunction_or"), 
'1', 
''));
 
  234        $fulfilled->setValue((strlen($postvalues[
'c'])) ? $postvalues[
'c'] : 0);
 
  235        $form->addItem($fulfilled);
 
  237        $step1 = 
new ilSelectInputGUI($this->lng->txt(
"step") . 
" 1: " . $this->lng->txt(
"select_prior_question"), 
"q");
 
  239        if (is_array($questions)) {
 
  240            foreach ($questions as $question) {
 
  245        $step1->setValue($postvalues[
"q"]);
 
  246        $form->addItem($step1);
 
  249            $relations = $this->
object->getAllRelations();
 
  250            $step2 = 
new ilSelectInputGUI($this->lng->txt(
"step") . 
" 2: " . $this->lng->txt(
"select_relation"), 
"r");
 
  252            foreach ($relations as $rel_id => $relation) {
 
  253                if (in_array($relation[
"short"], $survey_questions[$postvalues[
"q"]][
"availableRelations"])) {
 
  254                    $options[$rel_id] = $relation[
'short'];
 
  258            $step2->setValue($postvalues[
"r"]);
 
  259            $form->addItem($step2);
 
  263            $variables =&$this->
object->getVariables($postvalues[
"q"]);
 
  264            $question_type = $survey_questions[$postvalues[
"q"]][
"type_tag"];
 
  265            include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  267            $question = 
new $question_type();
 
  268            $question->loadFromDb($postvalues[
"q"]);
 
  270            $step3 = $question->getPreconditionSelectValue($postvalues[
"v"], $this->lng->txt(
"step") . 
" 3: " . $this->lng->txt(
"select_value"), 
"v");
 
  271            $form->addItem($step3);
 
  276                $cmd_continue = 
"constraintStep2";
 
  277                $cmd_back = 
"constraints";
 
  280                $cmd_continue = 
"constraintStep3";
 
  281                $cmd_back = 
"constraintStep1";
 
  284                $cmd_continue = 
"constraintsAdd";
 
  285                $cmd_back = 
"constraintStep2";
 
  288        $form->addCommandButton($cmd_back, $this->lng->txt(
"back"));
 
  289        $form->addCommandButton($cmd_continue, $this->lng->txt(
"continue"));
 
  291        $this->tpl->setVariable(
"ADM_CONTENT", 
$form->getHTML());
 
  307        if (!$ilAccess->checkAccess(
"write", 
"", $this->object->getRefId())) {
 
  319        $id = (int) $_REQUEST[
"precondition"];
 
  321            $this->ctrl->redirect($this, 
"constraints");
 
  324        $constraint = $this->
object->getPrecondition(
$id);
 
  325        $questions = $this->
object->getSurveyQuestions();
 
  326        $question = $questions[$constraint[
"question_fi"]];
 
  327        $relation = $questions[$constraint[
"ref_question_fi"]];
 
  328        $relation = $relation[
"title"];
 
  331        include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  334        $question_obj = 
new $question_type();
 
  335        $question_obj->loadFromDb($constraint[
"question_fi"]);
 
  336        $valueoutput = $question_obj->getPreconditionValueOutput($constraint[
"value"]);
 
  338        $title = $question[
"title"] . 
" " . $constraint[
"shortname"] . 
" " . $valueoutput;
 
  340        $this->ctrl->saveParameter($this, 
"precondition");
 
  342        include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  344        $cgui->setHeaderText(
sprintf($this->lng->txt(
"survey_sure_delete_constraint"), 
$title, $relation));
 
  346        $cgui->setFormAction($this->ctrl->getFormAction($this, 
"deleteConstraints"));
 
  347        $cgui->setCancel($this->lng->txt(
"cancel"), 
"constraints");
 
  348        $cgui->setConfirm($this->lng->txt(
"confirm"), 
"deleteConstraints");
 
  350        $this->tpl->setContent($cgui->getHTML());
 
  358        $id = (int) $_REQUEST[
"precondition"];
 
  361            $this->
object->deleteConstraint(
$id);
 
  364        $this->ctrl->redirect($this, 
"constraints");
 
  369        $include_elements = 
$_POST[
"includeElements"];
 
  370        if ((!is_array($include_elements)) || (count($include_elements) == 0)) {
 
  371            ilUtil::sendInfo($this->lng->txt(
"constraints_no_questions_or_questionblocks_selected"), 
true);
 
  372            $this->ctrl->redirect($this, 
"constraints");
 
  373        } elseif (count($include_elements) >= 1) {
 
  374            $_SESSION[
"includeElements"] = $include_elements;
 
  375            sort($include_elements, SORT_NUMERIC);
 
  376            $_GET[
"start"] = $include_elements[0];
 
  384            $this->ctrl->redirect($this, 
"constraints");
 
  388        $this->ctrl->setParameter($this, 
"precondition", 
$_GET[
"precondition"]);
 
  389        $this->ctrl->setParameter($this, 
"start", 
$_GET[
"start"]);
 
  390        $this->ctrl->redirect($this, 
"constraintStep3");
 
sprintf('%.4f', $callTime)
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
TableGUI class for survey constraints.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
Confirmation screen class.
static _hasDatasets($survey_id)
This class represents an option in a radio group.
Class ilSurveyConstraintsGUI.
constraintStep2Object()
Handles the second step of the precondition add action.
constraintStep3Object()
Handles the third step of the precondition add action.
deleteConstraintsObject()
Delete constraints of a survey.
__construct(ilObjSurveyGUI $a_parent_gui)
constraintStep1Object()
Handles the first step of the precondition add action.
createConstraintsObject()
confirmDeleteConstraintsObject()
Delete constraint confirmation.
constraintsObject()
Administration page for survey constraints.
constraintsAddObject()
Add a precondition for a survey question or question block.
validateConstraintForEdit($a_id)
Validate if given constraint id is part of current survey and there are sufficient permissions to edi...
constraintForm($step, $postvalues, &$survey_questions, $questions=false)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!array_key_exists('StateId', $_REQUEST)) $id
if(isset($_POST['submit'])) $form