ILIAS  release_4-4 Revision
SurveyQuestionGUI Class Reference

Basic class for all survey question types. More...

+ Inheritance diagram for SurveyQuestionGUI:
+ Collaboration diagram for SurveyQuestionGUI:

Public Member Functions

 __construct ($a_id=-1)
 
 setQuestionTabs ()
 
executeCommand ()
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
 getQuestionType ()
 Returns the question type string. More...
 
 setBackUrl ($a_url)
 
 setQuestionTabsForClass ($guiclass)
 
 getPrintView ($question_title=1, $show_questiontext=1)
 
 preview ()
 Creates a preview of the question. More...
 
 getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
 
 getCumulatedResultsDetails ($survey_id, $counter, $finished_ids)
 
 material ($checkonly=FALSE)
 Material tab of the survey questions. More...
 
 deleteMaterial ()
 
 addMaterial ()
 Add materials to a question. More...
 
 removeMaterial ()
 
 cancelExplorer ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 linkChilds ()
 
 savePhrase ($a_reload=false)
 Creates an output to save the current answers as a phrase. More...
 
 confirmSavePhrase ()
 Save a new phrase to the database. More...
 

Static Public Member Functions

static & _getQuestionGUI ($questiontype, $question_id=-1)
 Creates a question gui representation. More...
 

Data Fields

 $object
 

Protected Member Functions

 initObject ()
 
 outQuestionText ($template)
 
 initEditForm ()
 
 addCommandButtons ($a_form)
 
 editQuestion (ilPropertyFormGUI $a_form=null)
 
 saveSync ()
 
 saveReturn ()
 
 saveForm ()
 
 save ($a_return=false, $a_sync=false)
 
 copySyncForm ()
 
 syncCopies ()
 
 originalSyncForm ()
 
 sync ()
 
 cancelSync ()
 
 redirectAfterSaving ($a_return=false)
 Redirect to calling survey or to edit form. More...
 
 cancel ()
 
 validateEditForm (ilPropertyFormGUI $a_form)
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
 getMaterialOutput ()
 Creates the HTML output of the question material(s) More...
 
 renderChart ($a_id, $a_variables)
 
 initPhrasesForm ()
 
 addPhrase (ilPropertyFormGUI $a_form=null)
 Creates an output for the addition of phrases. More...
 
 addSelectedPhrase ()
 

Protected Attributes

 $tpl
 
 $lng
 
 $ctrl
 
 $cumulated
 
 $parent_url
 

Detailed Description

Basic class for all survey question types.

The SurveyQuestionGUI class defines and encapsulates basic methods and attributes for survey question types to be used for all parent classes.

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 34 of file class.SurveyQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

SurveyQuestionGUI::__construct (   $a_id = -1)

Definition at line 44 of file class.SurveyQuestionGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, initObject(), and setQuestionTabs().

45  {
46  global $lng, $tpl, $ilCtrl;
47 
48  $this->lng = $lng;
49  $this->tpl = $tpl;
50  $this->ctrl = $ilCtrl;
51  $this->ctrl->saveParameter($this, "q_id");
52  $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
53  $this->cumulated = array();
54 
55  $this->initObject();
56 
57  if($a_id > 0)
58  {
59  $this->object->loadFromDb($a_id);
60  }
61  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ _getClassNameForQType()

SurveyQuestionGUI::_getClassNameForQType (   $q_type)

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

Referenced by _getGUIClassNameForId().

113  {
114  return $q_type;
115  }
+ Here is the caller graph for this function:

◆ _getGUIClassNameForId()

SurveyQuestionGUI::_getGUIClassNameForId (   $a_q_id)

Definition at line 103 of file class.SurveyQuestionGUI.php.

References _getClassNameForQType().

Referenced by ilSurveyQuestionsTableGUI\fillRow().

104  {
105  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
106  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
107  $q_type = SurveyQuestion::_getQuestiontype($a_q_id);
108  $class_name = SurveyQuestionGUI::_getClassNameForQType($q_type);
109  return $class_name;
110  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getQuestionGUI()

static& SurveyQuestionGUI::_getQuestionGUI (   $questiontype,
  $question_id = -1 
)
static

Creates a question gui representation.

Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls

Parameters
string$question_typeThe question type as it is used in the language database
integer$question_idThe database ID of an existing question to load it into ASS_QuestionGUI
Returns
object The alias to the question object public

Definition at line 90 of file class.SurveyQuestionGUI.php.

References SurveyQuestion\_includeClass().

Referenced by ilSurveyPageGUI\addQuestion(), ilObjSurveyQuestionPoolGUI\createQuestionObject(), ilSurveyEditorGUI\executeCommand(), ilObjSurveyQuestionPoolGUI\executeCommand(), ilSurveyEditorGUI\executeCreateQuestionObject(), ilObjSurvey\getQuestionGUI(), and ilObjSurveyQuestionPoolGUI\previewObject().

91  {
92  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
93  if ((!$questiontype) and ($question_id > 0))
94  {
95  $questiontype = SurveyQuestion::_getQuestiontype($question_id);
96  }
97  SurveyQuestion::_includeClass($questiontype, 1);
98  $question_type_gui = $questiontype . "GUI";
99  $question = new $question_type_gui($question_id);
100  return $question;
101  }
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCommandButtons()

SurveyQuestionGUI::addCommandButtons (   $a_form)
protected

Definition at line 278 of file class.SurveyQuestionGUI.php.

References ilObject\_lookupType().

Referenced by initEditForm().

279  {
280  $a_form->addCommandButton("saveReturn", $this->lng->txt("save_return"));
281  $a_form->addCommandButton("save", $this->lng->txt("save"));
282 
283  // pool question?
284  if(ilObject::_lookupType($this->object->getObjId()) == "spl")
285  {
286  if($this->object->hasCopies())
287  {
288  $a_form->addCommandButton("saveSync", $this->lng->txt("svy_save_sync"));
289  }
290  }
291  }
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFieldsToEditForm()

SurveyQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
abstractprotected

Referenced by initEditForm(), and validateEditForm().

+ Here is the caller graph for this function:

◆ addGIT()

SurveyQuestionGUI::addGIT ( )

Definition at line 856 of file class.SurveyQuestionGUI.php.

References $_GET, $_SESSION, and ilUtil\sendSuccess().

857  {
858  $this->object->addInternalLink("il__git_" . $_GET["git"]);
859  unset($_SESSION["link_new_type"]);
860  unset($_SESSION["search_link_type"]);
861  ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
862  $this->ctrl->redirect($this, "material");
863  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
+ Here is the call graph for this function:

◆ addMaterial()

SurveyQuestionGUI::addMaterial ( )

Add materials to a question.

Definition at line 765 of file class.SurveyQuestionGUI.php.

References $_GET, $_POST, $_SESSION, $path, material(), and ilUtil\sendInfo().

766  {
767  global $tree, $ilTabs;
768 
769  $ilTabs->activateTab("material");
770 
771  if (strlen($_SESSION["link_new_type"]) || !$this->material(true))
772  {
773  include_once("./Modules/SurveyQuestionPool/classes/class.ilMaterialExplorer.php");
774  switch ($_POST["internalLinkType"])
775  {
776  case "lm":
777  $_SESSION["link_new_type"] = "lm";
778  $_SESSION["search_link_type"] = "lm";
779  break;
780  case "glo":
781  $_SESSION["link_new_type"] = "glo";
782  $_SESSION["search_link_type"] = "glo";
783  break;
784  case "st":
785  $_SESSION["link_new_type"] = "lm";
786  $_SESSION["search_link_type"] = "st";
787  break;
788  case "pg":
789  $_SESSION["link_new_type"] = "lm";
790  $_SESSION["search_link_type"] = "pg";
791  break;
792  }
793 
794  ilUtil::sendInfo($this->lng->txt("select_object_to_link"));
795 
796  $exp = new ilMaterialExplorer($this->ctrl->getLinkTarget($this, 'addMaterial'), get_class($this));
797 
798  // expand current path (if no specific node given)
799  if(!$_GET["expand"])
800  {
801  $path = $tree->getPathId($_GET["ref_id"]);
802  $exp->setForceOpenPath($path);
803  }
804  else
805  {
806  $exp->setExpand($_GET["expand"]);
807  }
808  $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'addMaterial'));
809  $exp->setTargetGet("ref_id");
810  $exp->setRefId($_GET["ref_id"]);
811  $exp->addFilter($_SESSION["link_new_type"]);
812  $exp->setSelectableType($_SESSION["link_new_type"]);
813 
814  // build html-output
815  $exp->setOutput(0);
816 
817  $this->tpl->addBlockFile("ADM_CONTENT", "explorer", "tpl.il_svy_qpl_explorer.html", "Modules/SurveyQuestionPool");
818  $this->tpl->setVariable("EXPLORER_TREE",$exp->getOutput());
819  $this->tpl->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
820  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
821  }
822  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$path
Definition: index.php:22
material($checkonly=FALSE)
Material tab of the survey questions.
+ Here is the call graph for this function:

◆ addPG()

SurveyQuestionGUI::addPG ( )

Definition at line 838 of file class.SurveyQuestionGUI.php.

References $_GET, $_SESSION, and ilUtil\sendSuccess().

839  {
840  $this->object->addInternalLink("il__pg_" . $_GET["pg"]);
841  unset($_SESSION["link_new_type"]);
842  unset($_SESSION["search_link_type"]);
843  ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
844  $this->ctrl->redirect($this, "material");
845  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
+ Here is the call graph for this function:

◆ addPhrase()

SurveyQuestionGUI::addPhrase ( ilPropertyFormGUI  $a_form = null)
protected

Creates an output for the addition of phrases.

Definition at line 1012 of file class.SurveyQuestionGUI.php.

References $result, ilPropertyFormGUI\getHTML(), initPhrasesForm(), and saveForm().

Referenced by addSelectedPhrase().

1013  {
1014  global $ilTabs;
1015 
1016  $ilTabs->activateTab("edit_properties");
1017 
1018  if(!$a_form)
1019  {
1020  $result = $this->saveForm();
1021  if($result)
1022  {
1023  $this->object->saveToDb();
1024  }
1025 
1026  $a_form = $this->initPhrasesForm();
1027  }
1028 
1029  $this->tpl->setContent($a_form->getHTML());
1030  }
$result
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSelectedPhrase()

SurveyQuestionGUI::addSelectedPhrase ( )
protected

Definition at line 1032 of file class.SurveyQuestionGUI.php.

References $valid, addPhrase(), initPhrasesForm(), and ilUtil\sendSuccess().

1033  {
1034  $form = $this->initPhrasesForm();
1035  if($form->checkInput())
1036  {
1037  $phrase_id = $form->getInput("phrases");
1038 
1039  $valid = true;
1040  if (strcmp($this->object->getPhrase($phrase_id), "dp_standard_numbers") != 0)
1041  {
1042  $this->object->addPhrase($phrase_id);
1043  }
1044  else
1045  {
1046  $min = $form->getInput("lower_limit");
1047  $max = $form->getInput("upper_limit");
1048 
1049  if($max <= $min)
1050  {
1051  $max_field = $form->getItemByPostVar("upper_limit");
1052  $max_field->setAlert($this->lng->txt("upper_limit_must_be_greater"));
1053  $valid = false;
1054  }
1055  else
1056  {
1057  $this->object->addStandardNumbers($min, $max);
1058  }
1059  }
1060 
1061  if($valid)
1062  {
1063  $this->object->saveToDb();
1064 
1065  ilUtil::sendSuccess($this->lng->txt('phrase_added'), true);
1066  $this->ctrl->redirect($this, 'editQuestion');
1067  }
1068  }
1069 
1070  $form->setValuesByPost();
1071  $this->addPhrase($form);
1072  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$valid
addPhrase(ilPropertyFormGUI $a_form=null)
Creates an output for the addition of phrases.
+ Here is the call graph for this function:

◆ addST()

SurveyQuestionGUI::addST ( )

Definition at line 847 of file class.SurveyQuestionGUI.php.

References $_GET, $_SESSION, and ilUtil\sendSuccess().

848  {
849  $this->object->addInternalLink("il__st_" . $_GET["st"]);
850  unset($_SESSION["link_new_type"]);
851  unset($_SESSION["search_link_type"]);
852  ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
853  $this->ctrl->redirect($this, "material");
854  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
+ Here is the call graph for this function:

◆ cancel()

SurveyQuestionGUI::cancel ( )
protected

Definition at line 526 of file class.SurveyQuestionGUI.php.

References ilUtil\redirect().

527  {
528  if ($this->parent_url)
529  {
530  ilUtil::redirect($this->parent_url);
531  }
532  else
533  {
534  $this->ctrl->redirectByClass("ilobjsurveyquestionpoolgui", "questions");
535  }
536  }
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ cancelExplorer()

SurveyQuestionGUI::cancelExplorer ( )

Definition at line 831 of file class.SurveyQuestionGUI.php.

References $_SESSION, and ilUtil\sendInfo().

832  {
833  unset($_SESSION["link_new_type"]);
834  ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
835  $this->ctrl->redirect($this, 'material');
836  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ cancelSync()

SurveyQuestionGUI::cancelSync ( )
protected

Definition at line 483 of file class.SurveyQuestionGUI.php.

References $_REQUEST, redirectAfterSaving(), and ilUtil\sendInfo().

484  {
485  ilUtil::sendInfo($this->lng->txt("question_changed_in_survey_only"), true);
486  $this->redirectAfterSaving($_REQUEST["rtrn"]);
487  }
redirectAfterSaving($a_return=false)
Redirect to calling survey or to edit form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ confirmSavePhrase()

SurveyQuestionGUI::confirmSavePhrase ( )

Save a new phrase to the database.

public

Definition at line 1137 of file class.SurveyQuestionGUI.php.

References $_POST, $valid, savePhrase(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

1138  {
1139  $title = $_POST["phrase_title"];
1140 
1141  $valid = true;
1142  if (!trim($title))
1143  {
1144  ilUtil::sendFailure($this->lng->txt("qpl_savephrase_empty"));
1145  $valid = false;
1146  }
1147  else if ($this->object->phraseExists($title))
1148  {
1149  ilUtil::sendFailure($this->lng->txt("qpl_savephrase_exists"));
1150  $valid = false;
1151  }
1152 
1153  if($valid)
1154  {
1155  $this->object->savePhrase($title);
1156 
1157  ilUtil::sendSuccess($this->lng->txt("phrase_saved"), true);
1158  $this->ctrl->redirect($this, "editQuestion");
1159  }
1160 
1161  $this->savePhrase(true);
1162  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$valid
savePhrase($a_reload=false)
Creates an output to save the current answers as a phrase.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ copySyncForm()

SurveyQuestionGUI::copySyncForm ( )
protected

Definition at line 390 of file class.SurveyQuestionGUI.php.

Referenced by syncCopies().

391  {
392  global $ilTabs;
393 
394  $ilTabs->activateTab("edit_properties");
395 
396  include_once "Modules/SurveyQuestionPool/classes/class.ilSurveySyncTableGUI.php";
397  $tbl = new ilSurveySyncTableGUI($this, "copySyncForm", $this->object);
398 
399  $this->tpl->setContent($tbl->getHTML());
400  }
Survey sync table GUI class.
+ Here is the caller graph for this function:

◆ deleteMaterial()

SurveyQuestionGUI::deleteMaterial ( )

Definition at line 748 of file class.SurveyQuestionGUI.php.

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

749  {
750  if (is_array($_POST['idx']))
751  {
752  $this->object->deleteMaterials($_POST['idx']);
753  ilUtil::sendSuccess($this->lng->txt('materials_deleted'), true);
754  }
755  else
756  {
757  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
758  }
759  $this->ctrl->redirect($this, 'material');
760  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ editQuestion()

SurveyQuestionGUI::editQuestion ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 293 of file class.SurveyQuestionGUI.php.

References initEditForm().

Referenced by removeMaterial(), save(), and saveForm().

294  {
295  global $ilTabs;
296 
297  $ilTabs->activateTab("edit_properties");
298 
299  if(!$a_form)
300  {
301  $a_form = $this->initEditForm();
302  }
303  $this->tpl->setContent($a_form->getHTML());
304  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

& SurveyQuestionGUI::executeCommand ( )

Definition at line 66 of file class.SurveyQuestionGUI.php.

References $cmd, and $ret.

67  {
68  $cmd = $this->ctrl->getCmd();
69  $next_class = $this->ctrl->getNextClass($this);
70  switch($next_class)
71  {
72  default:
73  $ret =& $this->$cmd();
74  break;
75  }
76  return $ret;
77  }
$cmd
Definition: sahs_server.php:35

◆ getCumulatedResultsDetails()

SurveyQuestionGUI::getCumulatedResultsDetails (   $survey_id,
  $counter,
  $finished_ids 
)
abstract

Referenced by getMaterialOutput().

+ Here is the caller graph for this function:

◆ getMaterialOutput()

SurveyQuestionGUI::getMaterialOutput ( )
protected

Creates the HTML output of the question material(s)

Definition at line 582 of file class.SurveyQuestionGUI.php.

References $_GET, SurveyQuestion\_getInternalLinkHref(), getCumulatedResultsDetails(), and ilUtil\prepareFormOutput().

Referenced by SurveyTextQuestionGUI\getWorkingForm(), SurveyMetricQuestionGUI\getWorkingForm(), SurveySingleChoiceQuestionGUI\getWorkingForm(), SurveyMultipleChoiceQuestionGUI\getWorkingForm(), and SurveyMatrixQuestionGUI\getWorkingForm().

583  {
584  if (count($this->object->getMaterial()))
585  {
586  $template = new ilTemplate("tpl.il_svy_qpl_material.html", TRUE, TRUE, "Modules/SurveyQuestionPool");
587  foreach ($this->object->getMaterial() as $material)
588  {
589  $template->setCurrentBlock('material');
590  switch ($material->type)
591  {
592  case 0:
593  $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
594  $template->setVariable('MATERIAL_TYPE', 'internallink');
595  $template->setVariable('MATERIAL_HREF', $href);
596  break;
597  }
598  $template->setVariable('MATERIAL_TITLE', (strlen($material->title)) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material'));
599  $template->setVariable('TEXT_AVAILABLE_MATERIALS', $this->lng->txt('material'));
600  $template->parseCurrentBlock();
601  }
602  return $template->get();
603  }
604  return "";
605  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
_getInternalLinkHref($target="", $a_parent_ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPrintView()

SurveyQuestionGUI::getPrintView (   $question_title = 1,
  $show_questiontext = 1 
)
abstract

Referenced by validateEditForm().

+ Here is the caller graph for this function:

◆ getQuestionType()

SurveyQuestionGUI::getQuestionType ( )

Returns the question type string.

Returns
string The question type string public

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

Referenced by setQuestionTabsForClass().

124  {
125  return $this->object->getQuestionType();
126  }
+ Here is the caller graph for this function:

◆ getWorkingForm()

SurveyQuestionGUI::getWorkingForm (   $working_data = "",
  $question_title = 1,
  $show_questiontext = 1,
  $error_message = "",
  $survey_id = null 
)
abstract

Referenced by preview().

+ Here is the caller graph for this function:

◆ importEditFormValues()

SurveyQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
abstractprotected

Referenced by saveForm(), and validateEditForm().

+ Here is the caller graph for this function:

◆ initEditForm()

SurveyQuestionGUI::initEditForm ( )
protected

Definition at line 212 of file class.SurveyQuestionGUI.php.

References ilObjAdvancedEditing\_getUsedHTMLTags(), addCommandButtons(), addFieldsToEditForm(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), and ilCheckboxInputGUI\setValue().

Referenced by editQuestion(), and saveForm().

213  {
214  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
215  $form = new ilPropertyFormGUI();
216  $form->setFormAction($this->ctrl->getFormAction($this, "save"));
217  $form->setTitle($this->lng->txt($this->getQuestionType()));
218  $form->setMultipart(FALSE);
219  $form->setTableWidth("100%");
220  // $form->setId("essay");
221 
222  // title
223  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
224  $title->setRequired(TRUE);
225  $form->addItem($title);
226 
227  // label
228  $label = new ilTextInputGUI($this->lng->txt("label"), "label");
229  $label->setInfo($this->lng->txt("label_info"));
230  $label->setRequired(false);
231  $form->addItem($label);
232 
233  // author
234  $author = new ilTextInputGUI($this->lng->txt("author"), "author");
235  $author->setRequired(TRUE);
236  $form->addItem($author);
237 
238  // description
239  $description = new ilTextInputGUI($this->lng->txt("description"), "description");
240  $description->setRequired(FALSE);
241  $form->addItem($description);
242 
243  // questiontext
244  $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
245  $question->setRequired(TRUE);
246  $question->setRows(10);
247  $question->setCols(80);
248  $question->setUseRte(TRUE);
249  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
250  $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
251  $question->addPlugin("latex");
252  $question->addButton("latex");
253  $question->addButton("pastelatex");
254  $question->setRTESupport($this->object->getId(), "spl", "survey");
255  $form->addItem($question);
256 
257  // obligatory
258  $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
259  $shuffle->setValue(1);
260  $shuffle->setRequired(FALSE);
261  $form->addItem($shuffle);
262 
263  $this->addFieldsToEditForm($form);
264 
265  $this->addCommandButtons($form);
266 
267  // values
268  $title->setValue($this->object->getTitle());
269  $label->setValue($this->object->label);
270  $author->setValue($this->object->getAuthor());
271  $description->setValue($this->object->getDescription());
272  $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
273  $shuffle->setChecked($this->object->getObligatory());
274 
275  return $form;
276  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
setValue($a_value)
Set Value.
addFieldsToEditForm(ilPropertyFormGUI $a_form)
This class represents a text property in a property form.
& _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
This class represents a text area property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initObject()

SurveyQuestionGUI::initObject ( )
abstractprotected

Referenced by __construct().

+ Here is the caller graph for this function:

◆ initPhrasesForm()

SurveyQuestionGUI::initPhrasesForm ( )
protected

Definition at line 968 of file class.SurveyQuestionGUI.php.

References ilSurveyPhrases\_getAvailablePhrases(), ilSurveyPhrases\_getCategoriesForPhrase(), and ilFormPropertyGUI\setRequired().

Referenced by addPhrase(), and addSelectedPhrase().

969  {
970  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
971  $form = new ilPropertyFormGUI();
972  $form->setFormAction($this->ctrl->getFormAction($this, "addSelectedPhrase"));
973  $form->setTitle($this->lng->txt("add_phrase"));
974  // $form->setDescription($this->lng->txt("add_phrase_introduction"));
975 
976  $group = new ilRadioGroupInputGUI($this->lng->txt("phrase"), "phrases");
977  $group->setRequired(true);
978  $form->addItem($group);
979 
980  include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
981  foreach (ilSurveyPhrases::_getAvailablePhrases() as $phrase_id => $phrase_array)
982  {
983  $categories = ilSurveyPhrases::_getCategoriesForPhrase($phrase_id);
984 
985  $opt = new ilRadioOption($phrase_array["title"], $phrase_id);
986  $opt->setInfo(join($categories, ","));
987  $group->addOption($opt);
988 
989  if($phrase_array["org_title"] == "dp_standard_numbers")
990  {
991  $min = new ilNumberInputGUI($this->lng->txt("lower_limit"), "lower_limit");
992  $min->setRequired(true);
993  $min->setSize(5);
994  $opt->addSubItem($min);
995 
996  $max = new ilNumberInputGUI($this->lng->txt("upper_limit"), "upper_limit");
997  $max->setRequired(true);
998  $max->setSize(5);
999  $opt->addSubItem($max);
1000  }
1001  }
1002 
1003  $form->addCommandButton("addSelectedPhrase", $this->lng->txt("add_phrase"));
1004  $form->addCommandButton("editQuestion", $this->lng->txt("cancel"));
1005 
1006  return $form;
1007  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a property in a property form.
static & _getCategoriesForPhrase($phrase_id)
Gets the available categories for a given phrase.
This class represents a number property in a property form.
static & _getAvailablePhrases($useronly=0)
Gets the available phrases from the database.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ linkChilds()

SurveyQuestionGUI::linkChilds ( )

Definition at line 865 of file class.SurveyQuestionGUI.php.

References $_GET, $_SESSION, ilLMPageObject\getPageList(), and ilUtil\sendSuccess().

866  {
867  switch ($_SESSION["search_link_type"])
868  {
869  case "pg":
870  include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
871  include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
872  $cont_obj_gui =& new ilObjContentObjectGUI("", $_GET["source_id"], true);
873  $cont_obj = $cont_obj_gui->object;
874  $pages = ilLMPageObject::getPageList($cont_obj->getId());
875  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
876  $color_class = array("tblrow1", "tblrow2");
877  $counter = 0;
878  $this->tpl->addBlockFile("ADM_CONTENT", "link_selection", "tpl.il_svy_qpl_internallink_selection.html", "Modules/SurveyQuestionPool");
879  foreach($pages as $page)
880  {
881  if($page["type"] == $_SESSION["search_link_type"])
882  {
883  $this->tpl->setCurrentBlock("linktable_row");
884  $this->tpl->setVariable("TEXT_LINK", $page["title"]);
885  $this->tpl->setVariable("TEXT_ADD", $this->lng->txt("add"));
886  $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($page["type"])) . "&" . $page["type"] . "=" . $page["obj_id"]);
887  $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
888  $this->tpl->parseCurrentBlock();
889  $counter++;
890  }
891  }
892  $this->tpl->setCurrentBlock("link_selection");
893  $this->tpl->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
894  $this->tpl->setVariable("TEXT_LINK_TYPE", $this->lng->txt("obj_" . $_SESSION["search_link_type"]));
895  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
896  $this->tpl->parseCurrentBlock();
897  break;
898  case "st":
899  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
900  $color_class = array("tblrow1", "tblrow2");
901  $counter = 0;
902  include_once("./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
903  $cont_obj_gui =& new ilObjContentObjectGUI("", $_GET["source_id"], true);
904  $cont_obj = $cont_obj_gui->object;
905  // get all chapters
906  $ctree =& $cont_obj->getLMTree();
907  $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
908  $this->tpl->addBlockFile("ADM_CONTENT", "link_selection", "tpl.il_svy_qpl_internallink_selection.html", "Modules/SurveyQuestionPool");
909  foreach($nodes as $node)
910  {
911  if($node["type"] == $_SESSION["search_link_type"])
912  {
913  $this->tpl->setCurrentBlock("linktable_row");
914  $this->tpl->setVariable("TEXT_LINK", $node["title"]);
915  $this->tpl->setVariable("TEXT_ADD", $this->lng->txt("add"));
916  $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($node["type"])) . "&" . $node["type"] . "=" . $node["obj_id"]);
917  $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
918  $this->tpl->parseCurrentBlock();
919  $counter++;
920  }
921  }
922  $this->tpl->setCurrentBlock("link_selection");
923  $this->tpl->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
924  $this->tpl->setVariable("TEXT_LINK_TYPE", $this->lng->txt("obj_" . $_SESSION["search_link_type"]));
925  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
926  $this->tpl->parseCurrentBlock();
927  break;
928  case "glo":
929  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
930  $color_class = array("tblrow1", "tblrow2");
931  $counter = 0;
932  $this->tpl->addBlockFile("ADM_CONTENT", "link_selection", "tpl.il_svy_qpl_internallink_selection.html", "Modules/SurveyQuestionPool");
933  include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
934  $glossary =& new ilObjGlossary($_GET["source_id"], true);
935  // get all glossary items
936  $terms = $glossary->getTermList();
937  foreach($terms as $term)
938  {
939  $this->tpl->setCurrentBlock("linktable_row");
940  $this->tpl->setVariable("TEXT_LINK", $term["term"]);
941  $this->tpl->setVariable("TEXT_ADD", $this->lng->txt("add"));
942  $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "addGIT") . "&git=" . $term["id"]);
943  $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
944  $this->tpl->parseCurrentBlock();
945  $counter++;
946  }
947  $this->tpl->setCurrentBlock("link_selection");
948  $this->tpl->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
949  $this->tpl->setVariable("TEXT_LINK_TYPE", $this->lng->txt("glossary_term"));
950  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
951  $this->tpl->parseCurrentBlock();
952  break;
953  case "lm":
954  $this->object->addInternalLink("il__lm_" . $_GET["source_id"]);
955  unset($_SESSION["link_new_type"]);
956  unset($_SESSION["search_link_type"]);
957  ilUtil::sendSuccess($this->lng->txt("material_added_successfully"), true);
958  $this->ctrl->redirect($this, "material");
959  break;
960  }
961  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
Class ilObjGlossary.
getPageList($lm_id)
static
Class ilObjContentObjectGUI.
+ Here is the call graph for this function:

◆ material()

SurveyQuestionGUI::material (   $checkonly = FALSE)

Material tab of the survey questions.

Definition at line 682 of file class.SurveyQuestionGUI.php.

References $_GET, $data, $errors, SurveyQuestion\_getInternalLinkHref(), ilUtil\prepareFormOutput(), and ilFormPropertyGUI\setRequired().

Referenced by addMaterial().

683  {
684  global $rbacsystem, $ilTabs;
685 
686  $ilTabs->activateTab("material");
687 
688  $add_html = '';
689  if ($rbacsystem->checkAccess('write', $_GET['ref_id']))
690  {
691  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
692  $form = new ilPropertyFormGUI();
693  $form->setFormAction($this->ctrl->getFormAction($this));
694  $form->setTitle($this->lng->txt('add_material'));
695  $form->setMultipart(FALSE);
696  $form->setTableWidth("100%");
697  $form->setId("material");
698 
699  // material
700  $material = new ilRadioGroupInputGUI($this->lng->txt("material"), "internalLinkType");
701  $material->setRequired(true);
702  $material->addOption(new ilRadioOption($this->lng->txt('obj_lm'), "lm"));
703  $material->addOption(new ilRadioOption($this->lng->txt('obj_st'), "st"));
704  $material->addOption(new ilRadioOption($this->lng->txt('obj_pg'), "pg"));
705  $material->addOption(new ilRadioOption($this->lng->txt('glossary_term'), "glo"));
706  $form->addItem($material);
707 
708  $form->addCommandButton("addMaterial", $this->lng->txt("add"));
709 
710  $errors = false;
711 
712  if ($checkonly)
713  {
714  $form->setValuesByPost();
715  $errors = !$form->checkInput();
716  if ($errors) $checkonly = false;
717  }
718  $add_html = $form->getHTML();
719  }
720 
721 
722  $mat_html = "";
723  if (count($this->object->getMaterial()))
724  {
725  include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyMaterialsTableGUI.php";
726  $table_gui = new ilSurveyMaterialsTableGUI($this, 'material', (($rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false)));
727  $data = array();
728  foreach ($this->object->getMaterial() as $material)
729  {
730  switch ($material->type)
731  {
732  case 0:
733  $href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
734  $type = $this->lng->txt('internal_link');
735  break;
736  }
737  $title = (strlen($material->title)) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material');
738  array_push($data, array('href' => $href, 'title' => $title, 'type' => $type));
739  }
740  $table_gui->setData($data);
741  $mat_html = $table_gui->getHTML();
742  }
743 
744  if (!$checkonly) $this->tpl->setVariable("ADM_CONTENT", $add_html . $mat_html);
745  return $errors;
746  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
This class represents a property form user interface.
$_GET["client_id"]
$errors
TableGUI class for survey question materials.
This class represents a property in a property form.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
_getInternalLinkHref($target="", $a_parent_ref_id=null)
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ originalSyncForm()

SurveyQuestionGUI::originalSyncForm ( )
protected

Definition at line 452 of file class.SurveyQuestionGUI.php.

453  {
454  global $ilTabs;
455 
456  $ilTabs->activateTab("edit_properties");
457 
458  $this->ctrl->saveParameter($this, "rtrn");
459 
460  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
461  $cgui = new ilConfirmationGUI();
462  $cgui->setHeaderText($this->lng->txt("confirm_sync_questions"));
463 
464  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
465  $cgui->setCancel($this->lng->txt("no"), "cancelSync");
466  $cgui->setConfirm($this->lng->txt("yes"), "sync");
467 
468  $this->tpl->setContent($cgui->getHTML());
469  }
Confirmation screen class.

◆ outQuestionText()

SurveyQuestionGUI::outQuestionText (   $template)
protected

Definition at line 128 of file class.SurveyQuestionGUI.php.

Referenced by SurveyTextQuestionGUI\getPrintView(), SurveySingleChoiceQuestionGUI\getPrintView(), SurveyMetricQuestionGUI\getPrintView(), SurveyMultipleChoiceQuestionGUI\getPrintView(), SurveyMatrixQuestionGUI\getPrintView(), SurveyTextQuestionGUI\getWorkingForm(), SurveyMetricQuestionGUI\getWorkingForm(), SurveySingleChoiceQuestionGUI\getWorkingForm(), SurveyMultipleChoiceQuestionGUI\getWorkingForm(), and SurveyMatrixQuestionGUI\getWorkingForm().

129  {
130  $questiontext = $this->object->getQuestiontext();
131  if (preg_match("/^<.[\\>]?>(.*?)<\\/.[\\>]*?>$/", $questiontext, $matches))
132  {
133  $questiontext = $matches[1];
134  }
135  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
136  if ($this->object->getObligatory($survey_id))
137  {
138  $template->setVariable("OBLIGATORY_TEXT", ' *');
139  }
140  }
+ Here is the caller graph for this function:

◆ preview()

SurveyQuestionGUI::preview ( )

Creates a preview of the question.

private

Definition at line 553 of file class.SurveyQuestionGUI.php.

References getWorkingForm().

554  {
555  global $ilTabs;
556 
557  $ilTabs->activateTab("preview");
558 
559  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_preview.html", "Modules/SurveyQuestionPool");
560  $question_output = $this->getWorkingForm();
561 
562  if ($this->object->getObligatory())
563  {
564  $this->tpl->setCurrentBlock("required");
565  $this->tpl->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
566  $this->tpl->parseCurrentBlock();
567  }
568 
569  $this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
570  }
getWorkingForm($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
+ Here is the call graph for this function:

◆ redirectAfterSaving()

SurveyQuestionGUI::redirectAfterSaving (   $a_return = false)
protected

Redirect to calling survey or to edit form.

Parameters
bool$a_return

Definition at line 494 of file class.SurveyQuestionGUI.php.

References $_GET, $_SESSION, and ilUtil\redirect().

Referenced by cancelSync(), save(), sync(), and syncCopies().

495  {
496  // return?
497  if($a_return)
498  {
499  // to calling survey
500  if($this->parent_url)
501  {
502  $addurl = "";
503  if (strlen($_GET["new_for_survey"]))
504  {
505  $addurl = "&new_id=" . $_GET["q_id"];
506  }
507  ilUtil::redirect(str_replace("&amp;", "&", $this->parent_url) . $addurl);
508  }
509  // to pool
510  else
511  {
512  $this->ctrl->setParameterByClass("ilObjSurveyQuestionPoolGUI", "q_id_table_nav", $_SESSION['q_id_table_nav']);
513  $this->ctrl->redirectByClass("ilObjSurveyQuestionPoolGUI", "questions");
514  }
515  }
516  // stay in form
517  else
518  {
519  $this->ctrl->setParameterByClass($_GET["cmdClass"], "q_id", $this->object->getId());
520  $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
521  $this->ctrl->setParameterByClass($_GET["cmdClass"], "new_for_survey", $_GET["new_for_survey"]);
522  $this->ctrl->redirectByClass($_GET["cmdClass"], "editQuestion");
523  }
524  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_GET["client_id"]
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeMaterial()

SurveyQuestionGUI::removeMaterial ( )

Definition at line 824 of file class.SurveyQuestionGUI.php.

References editQuestion().

825  {
826  $this->object->material = array();
827  $this->object->saveToDb();
828  $this->editQuestion();
829  }
editQuestion(ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ renderChart()

SurveyQuestionGUI::renderChart (   $a_id,
  $a_variables 
)
protected

Definition at line 614 of file class.SurveyQuestionGUI.php.

References $data, and ilUtil\prepareFormOutput().

Referenced by SurveySingleChoiceQuestionGUI\getCumulatedResultsDetails(), SurveyMultipleChoiceQuestionGUI\getCumulatedResultsDetails(), and SurveyMatrixQuestionGUI\getCumulatedResultsDetails().

615  {
616  include_once "Services/Chart/classes/class.ilChart.php";
617  $chart = new ilChart($a_id, 700, 400);
618 
619  $legend = new ilChartLegend();
620  $chart->setLegend($legend);
621  $chart->setYAxisToInteger(true);
622 
623  $data = new ilChartData("bars");
624  $data->setLabel($this->lng->txt("users_answered"));
625  $data->setBarOptions(0.5, "center");
626 
627  $max = 5;
628 
629  if(sizeof($a_variables) <= $max)
630  {
631  if($a_variables)
632  {
633  $labels = array();
634  foreach($a_variables as $idx => $points)
635  {
636  $data->addPoint($idx, $points["selected"]);
637  $labels[$idx] = ($idx+1).". ".ilUtil::prepareFormOutput($points["title"]);
638  }
639  $chart->addData($data);
640 
641  $chart->setTicks($labels, false, true);
642  }
643 
644  return "<div style=\"margin:10px\">".$chart->getHTML()."</div>";
645  }
646  else
647  {
648  $chart_legend = array();
649  $labels = array();
650  foreach($a_variables as $idx => $points)
651  {
652  $data->addPoint($idx, $points["selected"]);
653  $labels[$idx] = ($idx+1).".";
654  $chart_legend[($idx+1)] = ilUtil::prepareFormOutput($points["title"]);
655  }
656  $chart->addData($data);
657 
658  $chart->setTicks($labels, false, true);
659 
660  $legend = "<table>";
661  foreach($chart_legend as $number => $caption)
662  {
663  $legend .= "<tr valign=\"top\"><td>".$number.".</td><td>".$caption."</td></tr>";
664  }
665  $legend .= "</table>";
666 
667  return "<div style=\"margin:10px\"><table><tr valign=\"bottom\"><td>".
668  $chart->getHTML()."</td><td class=\"small\" style=\"padding-left:15px\">".
669  $legend."</td></tr></table></div>";
670  }
671  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
Chart legend.
Chart generator.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
Chart data series.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

SurveyQuestionGUI::save (   $a_return = false,
  $a_sync = false 
)
protected

Definition at line 344 of file class.SurveyQuestionGUI.php.

References $ilUser, SurveyQuestion\_isComplete(), SurveyQuestion\_isWriteable(), editQuestion(), redirectAfterSaving(), saveForm(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by saveReturn(), and saveSync().

345  {
346  global $ilUser;
347 
348  if($this->saveForm())
349  {
350  // #13784
351  if ($a_return &&
352  !SurveyQuestion::_isComplete($this->object->getId()))
353  {
354  ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
355  return $this->editQuestion();
356  }
357 
358  $ilUser->setPref("svy_lastquestiontype", $this->object->getQuestionType());
359  $ilUser->writePref("svy_lastquestiontype", $this->object->getQuestionType());
360 
361  $originalexists = $this->object->_questionExists($this->object->original_id);
362  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
363  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
364 
365  // pool question?
366  if($a_sync)
367  {
368  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
369  $this->ctrl->redirect($this, 'copySyncForm');
370  }
371  else
372  {
373  // form: update original pool question, too?
374  if ($originalexists &&
375  SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
376  {
377  if($a_return)
378  {
379  $this->ctrl->setParameter($this, 'rtrn', 1);
380  }
381  $this->ctrl->redirect($this, 'originalSyncForm');
382  }
383  }
384 
385  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
386  $this->redirectAfterSaving($a_return);
387  }
388  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
redirectAfterSaving($a_return=false)
Redirect to calling survey or to edit form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
editQuestion(ilPropertyFormGUI $a_form=null)
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
_isComplete($question_id)
Checks whether the question is complete or not.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveForm()

SurveyQuestionGUI::saveForm ( )
protected

Definition at line 316 of file class.SurveyQuestionGUI.php.

References editQuestion(), importEditFormValues(), initEditForm(), and validateEditForm().

Referenced by addPhrase(), save(), and savePhrase().

317  {
318  $form = $this->initEditForm();
319  if($form->checkInput())
320  {
321  if ($this->validateEditForm($form))
322  {
323  $this->object->setTitle($form->getInput("title"));
324  $this->object->label = ($form->getInput("label"));
325  $this->object->setAuthor($form->getInput("author"));
326  $this->object->setDescription($form->getInput("description"));
327  $this->object->setQuestiontext($form->getInput("question"));
328  $this->object->setObligatory($form->getInput("obligatory"));
329 
330  $this->importEditFormValues($form);
331 
332  // will save both core and extended data
333  $this->object->saveToDb();
334 
335  return true;
336  }
337  }
338 
339  $form->setValuesByPost();
340  $this->editQuestion($form);
341  return false;
342  }
validateEditForm(ilPropertyFormGUI $a_form)
importEditFormValues(ilPropertyFormGUI $a_form)
editQuestion(ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePhrase()

SurveyQuestionGUI::savePhrase (   $a_reload = false)

Creates an output to save the current answers as a phrase.

public

Definition at line 1079 of file class.SurveyQuestionGUI.php.

References $_SESSION, $data, $result, and saveForm().

Referenced by confirmSavePhrase().

1080  {
1081  global $ilTabs, $ilToolbar;
1082 
1083  $ilTabs->activateTab("edit_properties");
1084 
1085  if (!$a_reload)
1086  {
1087  $result = $this->saveForm();
1088  if ($result)
1089  {
1090  $this->object->saveToDb();
1091  }
1092  }
1093 
1094  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
1095  $txt = new ilTextInputGUI($this->lng->txt("enter_phrase_title"), "phrase_title");
1096  $ilToolbar->addInputItem($txt, true);
1097  $ilToolbar->addFormButton($this->lng->txt("confirm"), "confirmSavePhrase");
1098  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
1099 
1100  include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
1101  $table_gui = new ilSurveySavePhraseTableGUI($this, 'editQuestion');
1102  $table_gui->setDescription($this->lng->txt("save_phrase_introduction"));
1103 
1104  // matrix?
1105  if(method_exists($this->object, "getCategories"))
1106  {
1107  $categories = $this->object->getCategories();
1108  }
1109  else
1110  {
1111  $categories = $this->object->getColumns();
1112  }
1113 
1114  $data = array();
1115  for ($i = 0; $i < $categories->getCategoryCount(); $i++)
1116  {
1117  $cat = $categories->getCategory($i);
1118 
1119  $data[] = array(
1120  "answer" => $cat->title,
1121  "other" => $cat->other,
1122  "scale" => $cat->scale,
1123  "neutral" => $cat->neutral
1124  );
1125  }
1126  $table_gui->setData($data);
1127  $_SESSION['save_phrase_data'] = $data; // :TODO: see savePhrase()
1128 
1129  $this->tpl->setContent($table_gui->getHTML());
1130  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$result
This class represents a text property in a property form.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveReturn()

SurveyQuestionGUI::saveReturn ( )
protected

Definition at line 311 of file class.SurveyQuestionGUI.php.

References save().

312  {
313  $this->save(true);
314  }
save($a_return=false, $a_sync=false)
+ Here is the call graph for this function:

◆ saveSync()

SurveyQuestionGUI::saveSync ( )
protected

Definition at line 306 of file class.SurveyQuestionGUI.php.

References $_REQUEST, and save().

307  {
308  $this->save($_REQUEST["rtrn"], true);
309  }
save($a_return=false, $a_sync=false)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ setBackUrl()

SurveyQuestionGUI::setBackUrl (   $a_url)

Definition at line 142 of file class.SurveyQuestionGUI.php.

143  {
144  $this->parent_url = $a_url;
145  }

◆ setQuestionTabs()

SurveyQuestionGUI::setQuestionTabs ( )
abstract

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setQuestionTabsForClass()

SurveyQuestionGUI::setQuestionTabsForClass (   $guiclass)

Definition at line 147 of file class.SurveyQuestionGUI.php.

References $_GET, $_SESSION, and getQuestionType().

Referenced by SurveyMultipleChoiceQuestionGUI\setQuestionTabs(), SurveyTextQuestionGUI\setQuestionTabs(), SurveySingleChoiceQuestionGUI\setQuestionTabs(), SurveyMetricQuestionGUI\setQuestionTabs(), and SurveyMatrixQuestionGUI\setQuestionTabs().

148  {
149  global $rbacsystem,$ilTabs;
150 
151  $this->ctrl->setParameterByClass($guiclass, "sel_question_types", $this->getQuestionType());
152  $this->ctrl->setParameterByClass($guiclass, "q_id", $_GET["q_id"]);
153 
154  if ($this->parent_url)
155  {
156  $addurl = "";
157  if (strlen($_GET["new_for_survey"]))
158  {
159  $addurl = "&new_id=" . $_GET["q_id"];
160  }
161  $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $this->parent_url . $addurl);
162  }
163  else
164  {
165  $this->ctrl->setParameterByClass("ilObjSurveyQuestionPoolGUI", "q_id_table_nav", $_SESSION['q_id_table_nav']);
166  $ilTabs->setBackTarget($this->lng->txt("spl"), $this->ctrl->getLinkTargetByClass("ilObjSurveyQuestionPoolGUI", "questions"));
167  }
168  if ($_GET["q_id"])
169  {
170  $ilTabs->addTab("preview",
171  $this->lng->txt("preview"),
172  $this->ctrl->getLinkTargetByClass($guiclass, "preview"));
173  }
174 
175  if ($rbacsystem->checkAccess('edit', $_GET["ref_id"]))
176  {
177  $ilTabs->addTab("edit_properties",
178  $this->lng->txt("properties"),
179  $this->ctrl->getLinkTargetByClass($guiclass, "editQuestion"));
180 
181  if(stristr($guiclass, "matrix"))
182  {
183  $ilTabs->addTab("layout",
184  $this->lng->txt("layout"),
185  $this->ctrl->getLinkTargetByClass($guiclass, "layout"));
186  }
187  }
188  if ($_GET["q_id"])
189  {
190  $ilTabs->addTab("material",
191  $this->lng->txt("material"),
192  $this->ctrl->getLinkTargetByClass($guiclass, "material"));
193  }
194 
195  if ($this->object->getId() > 0)
196  {
197  $title = $this->lng->txt("edit") . " &quot;" . $this->object->getTitle() . "&quot";
198  }
199  else
200  {
201  $title = $this->lng->txt("create_new") . " " . $this->lng->txt($this->getQuestionType());
202  }
203 
204  $this->tpl->setVariable("HEADER", $title);
205  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_GET["client_id"]
getQuestionType()
Returns the question type string.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sync()

SurveyQuestionGUI::sync ( )
protected

Definition at line 471 of file class.SurveyQuestionGUI.php.

References $_REQUEST, redirectAfterSaving(), and ilUtil\sendSuccess().

472  {
473  $original_id = $this->object->original_id;
474  if ($original_id)
475  {
476  $this->object->syncWithOriginal();
477  }
478 
479  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
480  $this->redirectAfterSaving($_REQUEST["rtrn"]);
481  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
redirectAfterSaving($a_return=false)
Redirect to calling survey or to edit form.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ syncCopies()

SurveyQuestionGUI::syncCopies ( )
protected

Definition at line 402 of file class.SurveyQuestionGUI.php.

References $_POST, $_REQUEST, $lng, $ref_id, ilObject\_getAllReferences(), copySyncForm(), redirectAfterSaving(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

403  {
404  global $lng, $ilAccess;
405 
406  if(!sizeof($_POST["qid"]))
407  {
408  ilUtil::sendFailure($lng->txt("select_one"));
409  return $this->copySyncForm();
410  }
411 
412  foreach($this->object->getCopyIds(true) as $survey_id => $questions)
413  {
414  // check permissions for "parent" survey
415  $can_write = false;
416  $ref_ids = ilObject::_getAllReferences($survey_id);
417  foreach($ref_ids as $ref_id)
418  {
419  if($ilAccess->checkAccess("edit", "", $ref_id))
420  {
421  $can_write = true;
422  break;
423  }
424  }
425 
426  if($can_write)
427  {
428  foreach($questions as $qid)
429  {
430  if(in_array($qid, $_POST["qid"]))
431  {
432  $id = $this->object->getId();
433 
434  $this->object->setId($qid);
435  $this->object->setOriginalId($id);
436  $this->object->saveToDb();
437 
438  $this->object->setId($id);
439  $this->object->setOriginalId(null);
440 
441  // see: SurveyQuestion::syncWithOriginal()
442  // what about material?
443  }
444  }
445  }
446  }
447 
448  ilUtil::sendSuccess($lng->txt("survey_sync_success"), true);
449  $this->redirectAfterSaving($_REQUEST["rtrn"]);
450  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
redirectAfterSaving($a_return=false)
Redirect to calling survey or to edit form.
static _getAllReferences($a_id)
get all reference ids of object
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ref_id
Definition: sahs_server.php:39
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ validateEditForm()

SurveyQuestionGUI::validateEditForm ( ilPropertyFormGUI  $a_form)
protected

Definition at line 538 of file class.SurveyQuestionGUI.php.

References addFieldsToEditForm(), getPrintView(), and importEditFormValues().

Referenced by saveForm().

539  {
540  return true;
541  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

SurveyQuestionGUI::$ctrl
protected

Definition at line 38 of file class.SurveyQuestionGUI.php.

◆ $cumulated

SurveyQuestionGUI::$cumulated
protected

Definition at line 39 of file class.SurveyQuestionGUI.php.

◆ $lng

SurveyQuestionGUI::$lng
protected

Definition at line 37 of file class.SurveyQuestionGUI.php.

Referenced by __construct(), and syncCopies().

◆ $object

SurveyQuestionGUI::$object

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

◆ $parent_url

SurveyQuestionGUI::$parent_url
protected

Definition at line 40 of file class.SurveyQuestionGUI.php.

◆ $tpl

SurveyQuestionGUI::$tpl
protected

Definition at line 36 of file class.SurveyQuestionGUI.php.

Referenced by __construct().


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