ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjSurveyGUI Class Reference

Class ilObjSurveyGUI. More...

+ Inheritance diagram for ilObjSurveyGUI:
+ Collaboration diagram for ilObjSurveyGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 evaluationObject ()
 Redirects the evaluation object call to the ilSurveyEvaluationGUI class. More...
 
 afterSave (ilObject $a_new_object)
 save object public More...
 
 getTabs ()
 adds tabs to tab gui object More...
 
 savePropertiesObject ()
 Save the survey properties. More...
 
 initPropertiesForm ()
 Init survey settings form. More...
 
 addSubTabs ($a_section)
 Add subtabs for tabs. More...
 
 propertiesObject (ilPropertyFormGUI $a_form=null)
 Display and fill the properties form of the test. More...
 
 doAutoCompleteObject ()
 
 confirmResetTemplateObject ()
 Enable all settings - Confirmation. More...
 
 resetTemplateObject ()
 Enable all settings - remove template. More...
 
 importSurveyObject ()
 form for new survey object import More...
 
 infoScreenObject ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed More...
 
 infoScreen ()
 show information screen More...
 
 addLocatorItems ()
 
 getUserResultsTable ($a_active_id)
 
 mailUserResultsObject ()
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _goto ($a_target, $a_access_code="")
 redirect script More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Protected Member Functions

 addDidacticTemplateOptions (array &$a_options)
 
 initImportForm ($a_new_type)
 
 viewUserResultsObject ()
 
 getUserResultsPlain ($a_active_id)
 
 checkRbacOrPositionPermission ($a_rbac_permission, $a_position_permission)
 Check rbac or position permission. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Protected Attributes

 $nav_history
 
 $tabs
 
 $help
 
 $rbacsystem
 
 $log
 
 $invitation_manager
 
- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

Additional Inherited Members

- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjSurveyGUI::__construct ( )

Definition at line 54 of file class.ilObjSurveyGUI.php.

References $_GET, $DIC, ilObjectGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ilLoggerFactory\getLogger(), help(), and user().

55  {
56  global $DIC;
57 
58  $this->lng = $DIC->language();
59  $this->nav_history = $DIC["ilNavigationHistory"];
60  $this->tabs = $DIC->tabs();
61  $this->user = $DIC->user();
62  $this->help = $DIC["ilHelp"];
63  $this->rbacsystem = $DIC->rbac()->system();
64  $this->tree = $DIC->repositoryTree();
65  $this->tpl = $DIC["tpl"];
66  $this->toolbar = $DIC->toolbar();
67  $this->access = $DIC->access();
68  $this->locator = $DIC["ilLocator"];
69  $lng = $DIC->language();
70  $ilCtrl = $DIC->ctrl();
71 
72  $this->type = "svy";
73  $lng->loadLanguageModule("survey");
74  $lng->loadLanguageModule("svy");
75  $this->ctrl = $ilCtrl;
76  $this->ctrl->saveParameter($this, "ref_id");
77 
78  $this->log = ilLoggerFactory::getLogger("svy");
79 
80  $this->invitation_manager = new Participants\InvitationsManager();
81 
82  parent::__construct("", (int) $_GET["ref_id"], true, false);
83 
84  // this class will be treated as a baseclass in most cases, therefore
85  // we need to claim the repository context manually. see #37010
86  if (!$DIC->globalScreen()->tool()->context()->stack()->hasMatch(
87  $DIC->globalScreen()->tool()->context()->collection()->repository()
88  )) {
89  $DIC->globalScreen()->tool()->context()->claim()->repository();
90  }
91  }
$_GET["client_id"]
user()
Definition: user.php:4
help()
Definition: help.php:2
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjSurveyGUI::_goto (   $a_target,
  $a_access_code = "" 
)
static

redirect script

Parameters
string$a_target

Definition at line 2061 of file class.ilObjSurveyGUI.php.

References $_GET, $_SESSION, $DIC, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), exit, ROOT_FOLDER_ID, and ilUtil\sendFailure().

2062  {
2063  global $DIC;
2064 
2065  $ilAccess = $DIC->access();
2066  $lng = $DIC->language();
2067 
2068  // see ilObjSurveyAccess::_checkGoto()
2069  if (strlen($a_access_code)) {
2070  $_SESSION["anonymous_id"][ilObject::_lookupObjId($a_target)] = $a_access_code;
2071  $_GET["baseClass"] = "ilObjSurveyGUI";
2072  $_GET["cmd"] = "infoScreen";
2073  $_GET["ref_id"] = $a_target;
2074  include("ilias.php");
2075  exit;
2076  }
2077 
2078  if ($ilAccess->checkAccess("visible", "", $a_target) ||
2079  $ilAccess->checkAccess("read", "", $a_target)) {
2080  $_GET["baseClass"] = "ilObjSurveyGUI";
2081  $_GET["cmd"] = "infoScreen";
2082  $_GET["ref_id"] = $a_target;
2083  include("ilias.php");
2084  exit;
2085  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2086  ilUtil::sendFailure(sprintf(
2087  $lng->txt("msg_no_perm_read_item"),
2089  ), true);
2091  }
2092  }
exit
Definition: login.php:29
$_SESSION["AccountId"]
const ROOT_FOLDER_ID
Definition: constants.php:30
$_GET["client_id"]
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ addDidacticTemplateOptions()

ilObjSurveyGUI::addDidacticTemplateOptions ( array &  $a_options)
protected

Definition at line 301 of file class.ilObjSurveyGUI.php.

References ilSettingsTemplate\getAllSettingsTemplates().

302  {
304  if ($templates) {
305  foreach ($templates as $item) {
306  $a_options["svytpl_" . $item["id"]] = array($item["title"],
307  nl2br(trim($item["description"])));
308  }
309  }
310 
311  // JF, 2013-06-10
312  $a_options["svy360_1"] = array($this->lng->txt("survey_360_mode"),
313  $this->lng->txt("survey_360_mode_info"));
314 
315  //Self evaluation only
316  $a_options["svyselfeval_1"] = array($this->lng->txt("svy_self_ev_mode"),
317  $this->lng->txt("svy_self_ev_info"));
318  }
static getAllSettingsTemplates($a_type, $a_include_auto_generated=false)
Get all settings templates of type.
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjSurveyGUI::addLocatorItems ( )

Definition at line 2009 of file class.ilObjSurveyGUI.php.

References $_GET, ilObjectGUI\$locator, SurveyQuestion\_getQuestionType(), and SurveyQuestion\_getTitle().

2010  {
2011  $ilLocator = $this->locator;
2012  switch ($this->ctrl->getCmd()) {
2013  case "next":
2014  case "previous":
2015  case "start":
2016  case "resume":
2017  case "redirectQuestion":
2018  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
2019  break;
2020  case "evaluation":
2021  case "checkEvaluationAccess":
2022  case "evaluationdetails":
2023  case "evaluationuser":
2024  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTargetByClass("ilsurveyevaluationgui", "evaluation"), "", $_GET["ref_id"]);
2025  break;
2026  case "create":
2027  case "save":
2028  case "cancel":
2029  case "importSurvey":
2030  case "cloneAll":
2031  break;
2032  case "infoScreen":
2033  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
2034  break;
2035  default:
2036  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
2037 
2038  // this has to be done here because ilSurveyEditorGUI is called after finalizing the locator
2039  if ((int) $_GET["q_id"] && !(int) $_REQUEST["new_for_survey"]) {
2040  // not on create
2041  // see ilObjSurveyQuestionPool::addLocatorItems
2042  $q_id = (int) $_GET["q_id"];
2043  $q_type = SurveyQuestion::_getQuestionType($q_id) . "GUI";
2044  $this->ctrl->setParameterByClass($q_type, "q_id", $q_id);
2045  $ilLocator->addItem(
2047  $this->ctrl->getLinkTargetByClass(array("ilSurveyEditorGUI", $q_type), "editQuestion")
2048  );
2049  }
2050  break;
2051  }
2052  }
$_GET["client_id"]
static _getTitle($question_id)
Returns the question title of a question with a given id.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
+ Here is the call graph for this function:

◆ addSubTabs()

ilObjSurveyGUI::addSubTabs (   $a_section)

Add subtabs for tabs.

Parameters
type$a_section

Definition at line 1452 of file class.ilObjSurveyGUI.php.

Referenced by executeCommand(), and propertiesObject().

1453  {
1454  if ($a_section == 'settings') {
1455  $this->tabs_gui->addSubTabTarget(
1456  "settings",
1457  $this->ctrl->getLinkTarget($this, 'properties')
1458  );
1459 
1460  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1461  if ($lti_settings->hasSettingsAccess()) {
1462  $this->tabs_gui->addSubTabTarget(
1463  'lti_provider',
1464  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1465  );
1466  }
1467  }
1468  }
GUI class for LTI provider object settings.
+ Here is the caller graph for this function:

◆ afterSave()

ilObjSurveyGUI::afterSave ( ilObject  $a_new_object)

save object public

Definition at line 324 of file class.ilObjSurveyGUI.php.

References ilObjectGUI\$tpl, ilObjSurvey\ANONYMIZE_CODE_ALL, ilObjSurvey\EVALUATION_ACCESS_PARTICIPANTS, ilObjectGUI\getDidacticTemplateVar(), ilObject\getRefId(), ilObjSurvey\MODE_360, ilObjSurvey\MODE_SELF_EVAL, and ilUtil\redirect().

325  {
326  // #16446
327  $a_new_object->loadFromDb();
328 
329  $tpl = $this->getDidacticTemplateVar("svytpl");
330  if ($tpl) {
331  $a_new_object->applySettingsTemplate($tpl);
332  } else {
333  //set the mode depending on didactic template
334  if ($this->getDidacticTemplateVar("svy360")) {
335  $a_new_object->setMode(ilObjSurvey::MODE_360);
336  } elseif ($this->getDidacticTemplateVar("svyselfeval")) {
337  $a_new_object->setMode(ilObjSurvey::MODE_SELF_EVAL);
338  }
339  }
340 
341  $svy_mode = $a_new_object->getMode();
342  if ($svy_mode == ilObjSurvey::MODE_360) {
343  // this should rather be ilObjSurvey::ANONYMIZE_ON - see ilObjSurvey::getUserDataFromActiveId()
344  $a_new_object->setAnonymize(ilObjSurvey::ANONYMIZE_CODE_ALL);
345  $a_new_object->setEvaluationAccess(ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS);
346  } elseif ($svy_mode == ilObjSurvey::MODE_SELF_EVAL) {
347  $a_new_object->setEvaluationAccess(ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS);
348  }
349  $a_new_object->saveToDB();
350 
351  // always send a message
352  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
353  ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&ref_id=" .
354  $a_new_object->getRefId() . "&cmd=properties");
355  }
const EVALUATION_ACCESS_PARTICIPANTS
getRefId()
get reference id public
getDidacticTemplateVar($a_type)
Get didactic template setting from creation screen.
const ANONYMIZE_CODE_ALL
static redirect($a_script)
+ Here is the call graph for this function:

◆ checkRbacOrPositionPermission()

ilObjSurveyGUI::checkRbacOrPositionPermission (   $a_rbac_permission,
  $a_position_permission 
)
protected

Check rbac or position permission.

Parameters
string$a_rbac_permission
string$a_position_permission
Returns
bool

Definition at line 2330 of file class.ilObjSurveyGUI.php.

References ilObjectGUI\$access, and $GLOBALS.

Referenced by executeCommand(), and getTabs().

2331  {
2332  $access = $GLOBALS['DIC']->access();
2333  return $access->checkRbacOrPositionPermissionAccess(
2334  $a_rbac_permission,
2335  $a_position_permission,
2336  $this->object->getRefId()
2337  );
2338  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the caller graph for this function:

◆ confirmResetTemplateObject()

ilObjSurveyGUI::confirmResetTemplateObject ( )

Enable all settings - Confirmation.

Definition at line 1533 of file class.ilObjSurveyGUI.php.

References ilUtil\sendQuestion().

1534  {
1535  ilUtil::sendQuestion($this->lng->txt("survey_confirm_template_reset"));
1536  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_confirm_resettemplate.html", "Modules/Survey");
1537  $this->tpl->setCurrentBlock("adm_content");
1538  $this->tpl->setVariable("BTN_CONFIRM_REMOVE", $this->lng->txt("confirm"));
1539  $this->tpl->setVariable("BTN_CANCEL_REMOVE", $this->lng->txt("cancel"));
1540  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "resetTemplateObject"));
1541  $this->tpl->parseCurrentBlock();
1542  }
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
+ Here is the call graph for this function:

◆ doAutoCompleteObject()

ilObjSurveyGUI::doAutoCompleteObject ( )

Definition at line 1512 of file class.ilObjSurveyGUI.php.

References exit, ilUserAutoComplete\MAX_ENTRIES, and ilUtil\stripSlashes().

1513  {
1514  $fields = array('login','firstname','lastname','email');
1515 
1516  $auto = new ilUserAutoComplete();
1517  $auto->setSearchFields($fields);
1518  $auto->setResultField('login');
1519  $auto->enableFieldSearchableCheck(true);
1520  $auto->setMoreLinkAvailable(true);
1521 
1522  if (($_REQUEST['fetchall'])) {
1523  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1524  }
1525 
1526  echo $auto->getList(ilUtil::stripSlashes($_REQUEST['term']));
1527  exit();
1528  }
exit
Definition: login.php:29
Auto completion class for user lists.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ evaluationObject()

ilObjSurveyGUI::evaluationObject ( )

Redirects the evaluation object call to the ilSurveyEvaluationGUI class.

Coming from ListGUI...

private

Definition at line 294 of file class.ilObjSurveyGUI.php.

295  {
296  $eval_gui = new ilSurveyEvaluationGUI($this->object);
297  $this->ctrl->setCmdClass(get_class($eval_gui));
298  $this->ctrl->redirect($eval_gui, "evaluation");
299  }
Survey evaluation graphical output.

◆ executeCommand()

ilObjSurveyGUI::executeCommand ( )

Definition at line 93 of file class.ilObjSurveyGUI.php.

References $_GET, $_SESSION, $GLOBALS, $nav_history, $tabs, ilLink\_getLink(), ilObjSurveyAccess\_hasEvaluationAccess(), ilObjectGUI\addHeaderAction(), addSubTabs(), ilObjectGUI\checkPermission(), ilObjectGUI\checkPermissionBool(), checkRbacOrPositionPermission(), ilObjectGUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ilUtil\getStyleSheetLocation(), infoScreen(), ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ilObjSurvey\MODE_SELF_EVAL, ilObjSurvey\MODE_STANDARD, ilObjectGUI\prepareOutput(), ilLTIProviderObjectSettingGUI\setCustomRolesForSelection(), user(), and ilObjSurvey\validateExternalRaterCode().

94  {
95  $ilNavigationHistory = $this->nav_history;
96  $ilTabs = $this->tabs;
97 
98  $this->external_rater_360 = false;
99  if (!$this->creation_mode &&
100  $this->object->get360Mode() &&
101  $_SESSION["anonymous_id"][$this->object->getId()] &&
103  $this->object->getRefId(),
104  $_SESSION["anonymous_id"][$this->object->getId()]
105  )) {
106  $this->external_rater_360 = true;
107  }
108 
109  if (!$this->external_rater_360) {
110  if (!$this->checkPermissionBool("visible") &&
111  !$this->checkPermissionBool("read")) {
112  $this->checkPermission("read");
113  }
114 
115  // add entry to navigation history
116  if (!$this->getCreationMode() &&
117  $this->checkPermissionBool("read")) {
118  $this->ctrl->setParameterByClass("ilobjsurveygui", "ref_id", $this->ref_id);
119  $link = ilLink::_getLink($this->ref_id);
120  $ilNavigationHistory->addItem($this->ref_id, $link, "svy");
121  }
122  }
123 
124  $cmd = $this->ctrl->getCmd("properties");
125 
126  // workaround for bug #6288, needs better solution
127  if ($cmd == "saveTags") {
128  $this->ctrl->setCmdClass("ilinfoscreengui");
129  }
130 
131  // deep link from repository - "redirect" to page view
132  if (!$this->ctrl->getCmdClass() && $cmd == "questionsrepo") {
133  $_REQUEST["pgov"] = 1;
134  $this->ctrl->setCmd("questions");
135  $this->ctrl->setCmdClass("ilsurveyeditorgui");
136  }
137 
138  $next_class = $this->ctrl->getNextClass($this);
139  $this->ctrl->setReturn($this, "properties");
140  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "survey.css", "Modules/Survey"), "screen");
141  $this->prepareOutput();
142 
143  $this->log->debug("next_class= $next_class");
144  switch ($next_class) {
145  case 'illtiproviderobjectsettinggui':
146  $this->addSubTabs('settings');
147  $ilTabs->activateTab("settings");
148  $ilTabs->activateSubTab('lti_provider');
149  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
150  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
151  $lti_gui->offerLTIRolesForSelection(false);
152  $this->ctrl->forwardCommand($lti_gui);
153  break;
154 
155 
156  case "ilinfoscreengui":
157  if (!in_array(
158  $this->ctrl->getCmdClass(),
159  array('ilpublicuserprofilegui', 'ilobjportfoliogui')
160  )) {
161  $this->addHeaderAction();
162  $this->infoScreen(); // forwards command
163  } else {
164  // #16891
165  $ilTabs->clearTargets();
166  $info = new ilInfoScreenGUI($this);
167  $this->ctrl->forwardCommand($info);
168  }
169  break;
170 
171  case 'ilobjectmetadatagui':
172  $this->checkPermission("write");
173  $ilTabs->activateTab("meta_data");
174  $this->addHeaderAction();
175  $md_gui = new ilObjectMetaDataGUI($this->object);
176  $this->ctrl->forwardCommand($md_gui);
177  break;
178 
179  case "ilsurveyevaluationgui":
180 
181  if ($this->checkRbacOrPositionPermission('read_results', 'access_results') ||
182  ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $this->user->getId())) {
183  $ilTabs->activateTab("svy_results");
184  $this->addHeaderAction();
185  $eval_gui = new ilSurveyEvaluationGUI($this->object);
186  $this->ctrl->forwardCommand($eval_gui);
187  }
188  break;
189 
190  case "ilsurveyexecutiongui":
191  $ilTabs->clearTargets();
192  $exec_gui = new ilSurveyExecutionGUI($this->object);
193  $this->ctrl->forwardCommand($exec_gui);
194  break;
195 
196  case 'ilpermissiongui':
197  $ilTabs->activateTab("perm_settings");
198  $this->addHeaderAction();
199  $perm_gui = new ilPermissionGUI($this);
200  $this->ctrl->forwardCommand($perm_gui);
201  break;
202 
203  case 'ilobjectcopygui':
204  $cp = new ilObjectCopyGUI($this);
205  $cp->setType('svy');
206  $this->ctrl->forwardCommand($cp);
207  break;
208 
209  case "ilcommonactiondispatchergui":
211  $this->ctrl->forwardCommand($gui);
212  break;
213 
214  // 360, skill service
215  case 'ilsurveyskillgui':
216  $ilTabs->activateTab("survey_competences");
217  $gui = new ilSurveySkillGUI($this->object);
218  $this->ctrl->forwardCommand($gui);
219  break;
220 
221  case 'ilsurveyskilldeterminationgui':
222  $ilTabs->activateTab("maintenance");
223  $gui = new ilSurveySkillDeterminationGUI($this->object);
224  $this->ctrl->forwardCommand($gui);
225  break;
226 
227  case 'ilsurveyeditorgui':
228  $this->checkPermission("write");
229  $ilTabs->activateTab("survey_questions");
230  $gui = new ilSurveyEditorGUI($this);
231  $this->ctrl->forwardCommand($gui);
232  break;
233 
234  case 'ilsurveyconstraintsgui':
235  $this->checkPermission("write");
236  $ilTabs->activateTab("constraints");
237  $gui = new ilSurveyConstraintsGUI($this);
238  $this->ctrl->forwardCommand($gui);
239  break;
240 
241  case 'ilsurveyparticipantsgui':
242  if ($this->object->getMode() == ilObjSurvey::MODE_STANDARD || $this->object->getMode() == ilObjSurvey::MODE_SELF_EVAL) {
243  $ilTabs->activateTab("maintenance");
244  } else {
245  $ilTabs->activateTab("survey_360_appraisees");
246  }
247  $gui = new ilSurveyParticipantsGUI($this, $this->checkRbacOrPositionPermission('read_results', 'access_results'));
248  $this->ctrl->forwardCommand($gui);
249  break;
250 
251  case "illearningprogressgui":
252  $ilTabs->activateTab("learning_progress");
253  $new_gui = new ilLearningProgressGUI(
255  $this->object->getRefId()
256  );
257  $this->ctrl->forwardCommand($new_gui);
258  break;
259 
260  case 'ilexportgui':
261  $ilTabs->activateTab("export");
262  $exp_gui = new ilExportGUI($this);
263  $exp_gui->addFormat("xml");
264  $this->ctrl->forwardCommand($exp_gui);
265  break;
266 
267  default:
268  $this->addHeaderAction();
269  $cmd .= "Object";
270 
271  $this->log->debug("Default cmd= $cmd");
272 
273  $this->$cmd();
274  break;
275  }
276 
277  if (strtolower($_GET["baseClass"]) != "iladministrationgui" &&
278  $this->getCreationMode() != true) {
279  $this->tpl->printToStdout();
280 
281  //cherry pick conflict with d97cf1c77b
282  //$this->tpl->show();
283  //$this->log->debug("after tpl show");
284  }
285  }
Class ilSurveyParticipantsGUI.
Class ilObjectMetaDataGUI.
Survey skill service GUI class.
Class ilInfoScreenGUI.
Class ilSurveyEditorGUI.
$_SESSION["AccountId"]
GUI class for the workflow of copying objects.
static validateExternalRaterCode($a_ref_id, $a_code)
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
Class ilSurveyConstraintsGUI.
getLocalRoles($a_exclude=array())
user()
Definition: user.php:4
checkRbacOrPositionPermission($a_rbac_permission, $a_position_permission)
Check rbac or position permission.
Export User Interface Class.
setCustomRolesForSelection($a_roles)
Set custom roles for mapping to LTI roles.
prepareOutput($a_show_subobjects=true)
prepare output
GUI class for LTI provider object settings.
Survey execution graphical output.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
infoScreen()
show information screen
static _hasEvaluationAccess($a_obj_id, $user_id)
getCreationMode()
get creation mode
addSubTabs($a_section)
Add subtabs for tabs.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Survey skill determination GUI class.
Survey evaluation graphical output.
addHeaderAction()
Add header action menu.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObjUserTrackingGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ getTabs()

ilObjSurveyGUI::getTabs ( )

adds tabs to tab gui object

Parameters
object$tabs_guiilTabsGUI object

Definition at line 362 of file class.ilObjSurveyGUI.php.

References $help, $ilUser, ilObjectGUI\$user, ilObjSurveyAccess\_hasEvaluationAccess(), ilLearningProgressAccess\checkAccess(), ilObjectGUI\checkPermissionBool(), checkRbacOrPositionPermission(), ilObjSurvey\MODE_360, ilObjSurvey\MODE_SELF_EVAL, and ilObjSurvey\MODE_STANDARD.

363  {
365  $ilHelp = $this->help;
366 
367  if ($this->object instanceof ilObjSurveyQuestionPool) {
368  return true;
369  }
370 
371  $ilHelp->setScreenIdComponent("svy");
372 
373  $hidden_tabs = array();
374  $template = $this->object->getTemplate();
375  if ($template) {
376  $template = new ilSettingsTemplate($template);
377  $hidden_tabs = $template->getHiddenTabs();
378  }
379 
380  if ($this->checkPermissionBool("write")) {
381  $this->tabs_gui->addTab(
382  "survey_questions",
383  $this->lng->txt("survey_questions"),
384  $this->ctrl->getLinkTargetByClass(array("ilsurveyeditorgui", "ilsurveypagegui"), "renderPage")
385  );
386  }
387 
388  if ($this->checkPermissionBool("read")) {
389  $this->tabs_gui->addTab(
390  "info_short",
391  $this->lng->txt("info_short"),
392  $this->ctrl->getLinkTarget($this, 'infoScreen')
393  );
394  }
395 
396  // properties
397  if ($this->checkPermissionBool("write")) {
398  $this->tabs_gui->addTab(
399  "settings",
400  $this->lng->txt("settings"),
401  $this->ctrl->getLinkTarget($this, 'properties')
402  );
403  } elseif ($this->checkPermissionBool("read")) {
404  if ($this->object->get360Mode() &&
405  $this->object->get360SelfRaters() &&
406  $this->object->isAppraisee($ilUser->getId()) &&
407  !$this->object->isAppraiseeClosed($ilUser->getId())) {
408  $this->tabs_gui->addTab(
409  "survey_360_edit_raters",
410  $this->lng->txt("survey_360_edit_raters"),
411  $this->ctrl->getLinkTargetByClass('ilsurveyparticipantsgui', 'editRaters')
412  );
413 
414  // :TODO: mail to raters
415  }
416  }
417 
418  // questions
419  if ($this->checkPermissionBool("write") &&
420  !in_array("constraints", $hidden_tabs) &&
421  $this->object->getMode() == ilObjSurvey::MODE_STANDARD) {
422  // constraints (tab called routing)
423  $this->tabs_gui->addTab(
424  "constraints",
425  $this->lng->txt("constraints"),
426  $this->ctrl->getLinkTargetByClass("ilsurveyconstraintsgui", "constraints")
427  );
428  }
429 
430  if ($this->checkPermissionBool("write")) {
431  switch ($this->object->getMode()) {
433  // 360 mode + competence service
434  $skmg_set = new ilSkillManagementSettings();
435  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
436  $this->tabs_gui->addTab(
437  "survey_competences",
438  $this->lng->txt("survey_competences"),
439  $this->ctrl->getLinkTargetByClass("ilsurveyskillgui", "listQuestionAssignment")
440  );
441  }
442  $this->tabs_gui->addTab(
443  "survey_360_appraisees",
444  $this->lng->txt("survey_360_appraisees"),
445  $this->ctrl->getLinkTargetByClass('ilsurveyparticipantsgui', 'listAppraisees')
446  );
447  break;
448 
450  $skmg_set = new ilSkillManagementSettings();
451  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
452  $this->tabs_gui->addTab(
453  "survey_competences",
454  $this->lng->txt("survey_competences"),
455  $this->ctrl->getLinkTargetByClass("ilsurveyskillgui", "listQuestionAssignment")
456  );
457  }
458  $this->tabs_gui->addTab(
459  "maintenance",
460  $this->lng->txt("maintenance"),
461  $this->ctrl->getLinkTargetByClass('ilsurveyparticipantsgui', 'maintenance')
462  );
463  break;
464 
465  default:
466  // maintenance (tab called participants)
467  $this->tabs_gui->addTab(
468  "maintenance",
469  $this->lng->txt("maintenance"),
470  $this->ctrl->getLinkTargetByClass('ilsurveyparticipantsgui', 'maintenance')
471  );
472  break;
473  }
474  }
475 
476  if (
477  $this->checkRbacOrPositionPermission('read_results', 'access_results') ||
478  ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())) {
479  // evaluation
480  $this->tabs_gui->addTab(
481  "svy_results",
482  $this->lng->txt("svy_results"),
483  $this->ctrl->getLinkTargetByClass("ilsurveyevaluationgui", "evaluation")
484  );
485  }
486 
487  // learning progress
488  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
489  $this->tabs_gui->addTarget(
490  "learning_progress",
491  $this->ctrl->getLinkTargetByClass(array("ilobjsurveygui", "illearningprogressgui"), ""),
492  "",
493  array("illplistofobjectsgui", "illplistofsettingsgui", "illearningprogressgui", "illplistofprogressgui")
494  );
495  }
496 
497  if ($this->checkPermissionBool("write")) {
498  if (!in_array("meta_data", $hidden_tabs)) {
499  // meta data
500  $mdgui = new ilObjectMetaDataGUI($this->object);
501  $mdtab = $mdgui->getTab();
502  if ($mdtab) {
503  $this->tabs_gui->addTab(
504  "meta_data",
505  $this->lng->txt("meta_data"),
506  $mdtab
507  );
508  }
509  }
510 
511  if (!in_array("export", $hidden_tabs)) {
512  // export
513  $this->tabs_gui->addTab(
514  "export",
515  $this->lng->txt("export"),
516  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
517  );
518  }
519  }
520 
521  if ($this->checkPermissionBool("edit_permission")) {
522  // permissions
523  $this->tabs_gui->addTab(
524  "perm_settings",
525  $this->lng->txt("perm_settings"),
526  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
527  );
528  }
529  }
Class ilObjectMetaDataGUI.
Class ilObjSurveyQuestionPool.
checkRbacOrPositionPermission($a_rbac_permission, $a_position_permission)
Check rbac or position permission.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
static _hasEvaluationAccess($a_obj_id, $user_id)
$ilUser
Definition: imgupload.php:18
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Settings template application class.
+ Here is the call graph for this function:

◆ getUserResultsPlain()

ilObjSurveyGUI::getUserResultsPlain (   $a_active_id)
protected

Definition at line 2165 of file class.ilObjSurveyGUI.php.

References $GLOBALS, $ilUser, $res, $type, ilObjectGUI\$user, ilMail\_getInstallationSignature(), ilLink\_getLink(), ilDatePresentation\formatDate(), ilMail\getSalutation(), and IL_CAL_UNIX.

2166  {
2167  $res = array();
2168 
2169  $show_titles = (bool) $this->object->getShowQuestionTitles();
2170 
2171  foreach ($this->object->getSurveyPages() as $page) {
2172  if (count($page) > 0) {
2173  $res[] = "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
2174 
2175  // question block
2176  if (count($page) > 1) {
2177  if ((bool) $page[0]["questionblock_show_blocktitle"]) {
2178  $res[$this->lng->txt("questionblock")] = trim($page[0]["questionblock_title"]) . "\n";
2179  }
2180  }
2181 
2182  // questions
2183 
2184  $page_res = array();
2185 
2186  foreach ($page as $question) {
2187  $question_gui = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
2188  if (is_object($question_gui)) {
2189  $question_parts = array();
2190 
2191  // heading
2192  if (strlen($question["heading"])) {
2193  $question_parts[$this->lng->txt("heading")] = trim($question["heading"]);
2194  }
2195 
2196  if ($show_titles) {
2197  $question_parts[$this->lng->txt("title")] = trim($question["title"]);
2198  }
2199 
2200  if ((bool) $question["questionblock_show_questiontext"]) {
2201  $question_parts[$this->lng->txt("question")] = trim(strip_tags($question_gui->object->getQuestionText()));
2202  }
2203 
2204  $answers = $question_gui->getParsedAnswers(
2205  $this->object->loadWorkingData($question["question_id"], $a_active_id),
2206  true
2207  );
2208 
2209  if (sizeof($answers)) {
2210  $multiline = false;
2211  if (sizeof($answers) > 1 ||
2212  get_class($question_gui) == "SurveyTextQuestionGUI") {
2213  $multiline = true;
2214  }
2215 
2216  $parts = array();
2217  foreach ($answers as $answer) {
2218  $text = null;
2219  if ($answer["textanswer"]) {
2220  $text = ' ("' . $answer["textanswer"] . '")';
2221  }
2222  if (!isset($answer["cols"])) {
2223  if (isset($answer["title"])) {
2224  $parts[] = $answer["title"] . $text;
2225  } elseif (isset($answer["value"])) {
2226  $parts[] = $answer["value"];
2227  } elseif ($text) {
2228  $parts[] = substr($text, 2, -1);
2229  }
2230  }
2231  // matrix
2232  else {
2233  $tmp = array();
2234  foreach ($answer["cols"] as $col) {
2235  $tmp[] = $col["title"];
2236  }
2237  $parts[] = $answer["title"] . ": " . implode(", ", $tmp) . $text;
2238  }
2239  }
2240  $question_parts[$this->lng->txt("answer")] =
2241  ($multiline ? "\n" : "") . implode("\n", $parts);
2242  }
2243 
2244  $tmp = array();
2245  foreach ($question_parts as $type => $value) {
2246  $tmp[] = $type . ": " . $value;
2247  }
2248  $page_res[] = implode("\n", $tmp);
2249  }
2250  }
2251 
2252  $res[] = implode("\n\n-------------------------------\n\n", $page_res);
2253  }
2254  }
2255 
2256  $res[] = "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
2257 
2258  return implode("\n", $res);
2259  }
$type
foreach($_POST as $key=> $value) $res
+ Here is the call graph for this function:

◆ getUserResultsTable()

ilObjSurveyGUI::getUserResultsTable (   $a_active_id)

Definition at line 2094 of file class.ilObjSurveyGUI.php.

Referenced by viewUserResultsObject().

2095  {
2096  $rtpl = new ilTemplate("tpl.svy_view_user_results.html", true, true, "Modules/Survey");
2097 
2098  $show_titles = (bool) $this->object->getShowQuestionTitles();
2099 
2100  foreach ($this->object->getSurveyPages() as $page) {
2101  if (count($page) > 0) {
2102  // question block
2103  if (count($page) > 1) {
2104  if ((bool) $page[0]["questionblock_show_blocktitle"]) {
2105  $rtpl->setVariable("BLOCK_TITLE", trim($page[0]["questionblock_title"]));
2106  }
2107  }
2108 
2109  // questions
2110  foreach ($page as $question) {
2111  $question_gui = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
2112  if (is_object($question_gui)) {
2113  $rtpl->setCurrentBlock("question_bl");
2114 
2115  // heading
2116  if (strlen($question["heading"])) {
2117  $rtpl->setVariable("HEADING", trim($question["heading"]));
2118  }
2119 
2120  $rtpl->setVariable(
2121  "QUESTION_DATA",
2122  $question_gui->getPrintView(
2123  $show_titles,
2124  (bool) $question["questionblock_show_questiontext"],
2125  $this->object->getId(),
2126  $this->object->loadWorkingData($question["question_id"], $a_active_id)
2127  )
2128  );
2129 
2130  $rtpl->parseCurrentBlock();
2131  }
2132  }
2133 
2134  $rtpl->setCurrentBlock("block_bl");
2135  $rtpl->parseCurrentBlock();
2136  }
2137  }
2138 
2139  return $rtpl->get();
2140  }
+ Here is the caller graph for this function:

◆ importSurveyObject()

ilObjSurveyGUI::importSurveyObject ( )

form for new survey object import

Definition at line 1591 of file class.ilObjSurveyGUI.php.

References $_GET, ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), ilSettingsTemplate\getAllSettingsTemplates(), initImportForm(), ilObjectGUI\putObjectInTree(), ilUtil\redirect(), and ilUtil\sendFailure().

1592  {
1593  $tpl = $this->tpl;
1594 
1595  $parent_id = $_GET["ref_id"];
1596  $new_type = $_REQUEST["new_type"];
1597 
1598  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
1599  $this->checkPermission("create", "", $new_type);
1600 
1601  $this->lng->loadLanguageModule($new_type);
1602  $this->ctrl->setParameter($this, "new_type", $new_type);
1603 
1604  $form = $this->initImportForm($new_type);
1605  if ($form->checkInput()) {
1606  $newObj = new ilObjSurvey();
1607  $newObj->setType($new_type);
1608  $newObj->setTitle("dummy");
1609  $newObj->create(true);
1610  $this->putObjectInTree($newObj);
1611 
1612  // copy uploaded file to import directory
1613 
1614  $this->log->debug("form->getInput(spl) = " . $form->getInput("spl"));
1615 
1616  $error = $newObj->importObject($_FILES["importfile"], $form->getInput("spl"));
1617  if (strlen($error)) {
1618  $newObj->delete();
1620  return;
1621  }
1622 
1623  ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
1624  ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
1625  "&baseClass=ilObjSurveyGUI");
1626 
1627  // using template?
1628  $templates = ilSettingsTemplate::getAllSettingsTemplates("svy");
1629  if ($templates) {
1630  $tpl = $this->tpl;
1631  $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery.js");
1632  // $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery-ui-min.js");
1633 
1634  $this->tpl->setCurrentBlock("template_option");
1635  $this->tpl->setVariable("VAL_TEMPLATE_OPTION", "");
1636  $this->tpl->setVariable("TXT_TEMPLATE_OPTION", $this->lng->txt("none"));
1637  $this->tpl->parseCurrentBlock();
1638 
1639  foreach ($templates as $item) {
1640  $this->tpl->setCurrentBlock("template_option");
1641  $this->tpl->setVariable("VAL_TEMPLATE_OPTION", $item["id"]);
1642  $this->tpl->setVariable("TXT_TEMPLATE_OPTION", $item["title"]);
1643  $this->tpl->parseCurrentBlock();
1644 
1645  $desc = str_replace("\n", "", nl2br($item["description"]));
1646  $desc = str_replace("\r", "", $desc);
1647 
1648  $this->tpl->setCurrentBlock("js_data");
1649  $this->tpl->setVariable("JS_DATA_ID", $item["id"]);
1650  $this->tpl->setVariable("JS_DATA_TEXT", $desc);
1651  $this->tpl->parseCurrentBlock();
1652  }
1653 
1654  $this->tpl->setCurrentBlock("templates");
1655  $this->tpl->setVariable("TXT_TEMPLATE", $this->lng->txt("svy_settings_template"));
1656  $this->tpl->parseCurrentBlock();
1657  }
1658  }
1659 
1660  // display form to correct errors
1661  $form->setValuesByPost();
1662  $tpl->setContent($form->getHtml());
1663  }
static getAllSettingsTemplates($a_type, $a_include_auto_generated=false)
Get all settings templates of type.
$_GET["client_id"]
Class ilObjSurvey.
initImportForm($a_new_type)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
static redirect($a_script)
+ Here is the call graph for this function:

◆ infoScreen()

ilObjSurveyGUI::infoScreen ( )

show information screen

Definition at line 1685 of file class.ilObjSurveyGUI.php.

References $_POST, $_SESSION, ilObjectGUI\$access, $ilUser, $tabs, ilObjectGUI\$toolbar, $txt, ilObjectGUI\$user, ilObjSurveyAccess\_hasEvaluationAccess(), ANONYMOUS_USER_ID, ilObjectGUI\checkPermission(), ilObjectGUI\checkPermissionBool(), ilDatePresentation\formatDate(), ilSubmitButton\getInstance(), ilLinkButton\getInstance(), ilUserUtil\getNamePresentation(), IL_CAL_UNIX, ilUtil\sendFailure(), ilUtil\sendInfo(), and ilDatePresentation\setUseRelativeDates().

Referenced by executeCommand(), and infoScreenObject().

1686  {
1687  $ilTabs = $this->tabs;
1688  $ilUser = $this->user;
1689  $ilToolbar = $this->toolbar;
1690  $ilAccess = $this->access;
1691 
1692  if (!$this->external_rater_360) {
1693  if (!$this->checkPermissionBool("read")) {
1694  $this->checkPermission("visible");
1695  }
1696  }
1697 
1698  $ilTabs->activateTab("info_short");
1699 
1700  $output_gui = new ilSurveyExecutionGUI($this->object);
1701 
1702  $info = new ilInfoScreenGUI($this);
1703  $info->enablePrivateNotes();
1704 
1705 
1706  $is_appraisee = false;
1707 
1708  // 360° - appraisee infos
1709  if ($this->object->get360Mode() &&
1710  $this->object->isAppraisee($ilUser->getId())) {
1711  $is_appraisee = true;
1712 
1713  $info->addSection($this->lng->txt("survey_360_appraisee_info"));
1714 
1715  $appr_data = $this->object->getAppraiseesData();
1716  $appr_data = $appr_data[$ilUser->getId()];
1717  $info->addProperty($this->lng->txt("survey_360_raters_status_info"), $appr_data["finished"]);
1718 
1719  if (!$appr_data["closed"]) {
1720  $button = ilLinkButton::getInstance();
1721  $button->setCaption("survey_360_appraisee_close_action");
1722  $button->setUrl($this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "confirmappraiseeclose"));
1723  $close_button_360 = '<div>' . $button->render() . '</div>';
1724 
1725  $txt = "survey_360_appraisee_close_action_info";
1726  if ($this->object->getSkillService()) {
1727  $txt .= "_skill";
1728  }
1729  $info->addProperty(
1730  $this->lng->txt("status"),
1731  $close_button_360 . $this->lng->txt($txt)
1732  );
1733  } else {
1735 
1736  $dt = new ilDateTime($appr_data["closed"], IL_CAL_UNIX);
1737  $info->addProperty(
1738  $this->lng->txt("status"),
1739  sprintf(
1740  $this->lng->txt("survey_360_appraisee_close_action_status"),
1742  )
1743  );
1744  }
1745  }
1746 
1747 
1748  // handle (anonymous) code
1749 
1750  // validate incoming
1751  $code_input = false;
1752  $anonymous_code = $_POST["anonymous_id"];
1753  if ($anonymous_code) {
1754  $code_input = true;
1755  // if(!$this->object->isUnusedCode($anonymous_code, $ilUser->getId()))
1756  if (!$this->object->checkSurveyCode($anonymous_code)) { // #15031 - valid as long survey is not finished
1757  $anonymous_code = null;
1758  } else {
1759  // #15860
1760  $this->object->bindSurveyCodeToUser($ilUser->getId(), $anonymous_code);
1761  }
1762  }
1763  if ($anonymous_code) {
1764  $_SESSION["anonymous_id"][$this->object->getId()] = $anonymous_code;
1765  } else {
1766  $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
1767  if ($anonymous_code) {
1768  $code_input = true;
1769  }
1770  }
1771 
1772  // try to find code for current (registered) user from existing run
1773  if ($this->object->getAnonymize() && !$anonymous_code) {
1774  $anonymous_code = $this->object->findCodeForUser($ilUser->getId());
1775  }
1776 
1777  // get existing runs for current user, might generate code
1778  $participant_status = $this->object->getUserSurveyExecutionStatus($anonymous_code);
1779  if ($participant_status) {
1780  $anonymous_code = $participant_status["code"];
1781  $participant_status = $participant_status["runs"];
1782  }
1783 
1784  // (final) check for proper anonymous code
1785  if (!$this->object->isAccessibleWithoutCode() &&
1786  !$is_appraisee &&
1787  $code_input && // #11346
1788  (!$anonymous_code || !$this->object->isAnonymousKey($anonymous_code))) {
1789  $anonymous_code = null;
1790  ilUtil::sendInfo($this->lng->txt("wrong_survey_code_used"));
1791  }
1792 
1793  // :TODO: really save in session?
1794  $_SESSION["anonymous_id"][$this->object->getId()] = $anonymous_code;
1795 
1796  $survey_started = $this->object->isSurveyStarted($ilUser->getId(), $anonymous_code);
1797 
1798  $showButtons = $big_button = false;
1799 
1800  // already finished?
1801  if (!$this->object->get360Mode() &&
1802  ($survey_started === 1 && // survey finished
1803  !(!$this->object->isAccessibleWithoutCode() && !$anonymous_code && $ilUser->getId() == ANONYMOUS_USER_ID))) { // not code accessible an no anonymous code and anonymous user (see #0020333)
1804  ilUtil::sendInfo($this->lng->txt("already_completed_survey"));
1805 
1806  if ($ilUser->getId() != ANONYMOUS_USER_ID) {
1807  if ($this->object->hasViewOwnResults()) {
1808  $button = ilLinkButton::getInstance();
1809  $button->setCaption("svy_view_own_results");
1810  $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
1811  $ilToolbar->addButtonInstance($button);
1812  }
1813 
1814  // see ilSurveyExecutionGUI
1815  if ($this->object->hasMailConfirmation()) {
1816  if ($this->object->hasViewOwnResults()) {
1817  $ilToolbar->addSeparator();
1818  }
1819 
1820  if ($ilUser->getId() == ANONYMOUS_USER_ID ||
1821  !$ilUser->getEmail()) {
1822  require_once "Services/Form/classes/class.ilTextInputGUI.php";
1823  $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
1824  $mail->setSize(25);
1825  $mail->setValue($ilUser->getEmail());
1826  $ilToolbar->addInputItem($mail, true);
1827  }
1828 
1829  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
1830 
1831  $button = ilSubmitButton::getInstance();
1832  $button->setCaption("svy_mail_send_confirmation");
1833  $button->setCommand("mailUserResults");
1834  $ilToolbar->addButtonInstance($button);
1835  }
1836  }
1837  } else {
1838  // "active" survey?
1839  $canStart = $this->object->canStartSurvey(null, $this->external_rater_360);
1840 
1841  $showButtons = $canStart["result"];
1842  if (!$showButtons) {
1843  if ($canStart["edit_settings"] &&
1844  $ilAccess->checkAccess("write", "", $this->ref_id)) {
1845  $canStart["messages"][] = "<a href=\"" . $this->ctrl->getLinkTarget($this, "properties") . "\">&raquo; " .
1846  $this->lng->txt("survey_edit_settings") . "</a>";
1847  }
1848  ilUtil::sendInfo(implode("<br />", $canStart["messages"]));
1849  }
1850  }
1851 
1852  if ($showButtons) {
1853  // code is mandatory and not given yet
1854  if (!$is_appraisee &&
1855  !$anonymous_code &&
1856  !$this->object->isAccessibleWithoutCode()) {
1857  $info->setFormAction($this->ctrl->getFormAction($this, "infoScreen"));
1858  $info->addSection($this->lng->txt("anonymization"));
1859  $info->addProperty("", $this->lng->txt("anonymize_anonymous_introduction"));
1860  $info->addPropertyTextinput($this->lng->txt("enter_anonymous_id"), "anonymous_id", "", 8, "infoScreen", $this->lng->txt("submit"), true);
1861  } else {
1862  // trunk/default
1863  if (!$this->object->get360Mode()) {
1864  if ($anonymous_code) {
1865  $info->addHiddenElement("anonymous_id", $anonymous_code);
1866  }
1867  if ($survey_started === 0) {
1868  $big_button = array("resume", $this->lng->txt("resume_survey"));
1869  } elseif ($survey_started === false) {
1870  $big_button = array("start", $this->lng->txt("start_survey"));
1871  }
1872  }
1873  // 360°
1874  else {
1875  $appr_ids = array();
1876 
1877  // use given code (if proper external one)
1878  if ($anonymous_code) {
1879  $anonymous_id = $this->object->getAnonymousIdByCode($anonymous_code);
1880  if ($anonymous_id) {
1881  $appr_ids = $this->object->getAppraiseesToRate(0, $anonymous_id);
1882  }
1883  }
1884 
1885  // registered user
1886  // if an auto-code was generated, we still have to check for the original user id
1887  if (!$appr_ids && $ilUser->getId() != ANONYMOUS_USER_ID) {
1888  $appr_ids = $this->object->getAppraiseesToRate($ilUser->getId());
1889  }
1890 
1891  if (sizeof($appr_ids)) {
1892  // map existing runs to appraisees
1893  $active_appraisees = array();
1894  if ($participant_status) {
1895  foreach ($participant_status as $item) {
1896  $active_appraisees[$item["appr_id"]] = $item["finished"];
1897  }
1898  }
1899 
1900  $list = array();
1901 
1902  foreach ($appr_ids as $appr_id) {
1903  if ($this->object->isAppraiseeClosed($appr_id)) {
1904  // closed
1905  $list[$appr_id] = $this->lng->txt("survey_360_appraisee_is_closed");
1906  } elseif (array_key_exists($appr_id, $active_appraisees)) {
1907  // already done
1908  if ($active_appraisees[$appr_id]) {
1909  $list[$appr_id] = $this->lng->txt("already_completed_survey");
1910  }
1911  // resume
1912  else {
1913  $list[$appr_id] = array("resume", $this->lng->txt("resume_survey"));
1914  }
1915  } else {
1916  // start
1917  $list[$appr_id] = array("start", $this->lng->txt("start_survey"));
1918  }
1919  }
1920 
1921  $info->addSection($this->lng->txt("survey_360_rate_other_appraisees"));
1922 
1923  foreach ($list as $appr_id => $item) {
1924  $appr_name = ilUserUtil::getNamePresentation($appr_id, false, false, "", true);
1925 
1926  if (!is_array($item)) {
1927  $info->addProperty($appr_name, $item);
1928  } else {
1929  $this->ctrl->setParameter($output_gui, "appr_id", $appr_id);
1930  $href = $this->ctrl->getLinkTarget($output_gui, $item[0]);
1931  $this->ctrl->setParameter($output_gui, "appr_id", "");
1932 
1933  $button = ilLinkButton::getInstance();
1934  $button->setCaption($item[1], false);
1935  $button->setUrl($href);
1936  $big_button_360 = '<div>' . $button->render() . '</div>';
1937 
1938  $info->addProperty($appr_name, $big_button_360);
1939  }
1940  }
1941  } elseif (!$is_appraisee) {
1942  ilUtil::sendFailure($this->lng->txt("survey_360_no_appraisees"));
1943  }
1944  }
1945  }
1946 
1947  if ($this->object->get360Mode() &&
1948  $this->object->get360SelfAppraisee() &&
1949  !$this->object->isAppraisee($ilUser->getId()) &&
1950  $ilUser->getId() != ANONYMOUS_USER_ID) { // #14968
1951  $link = $this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "addSelfAppraisee");
1952  $link = '<a href="' . $link . '">' . $this->lng->txt("survey_360_add_self_appraisee") . '</a>';
1953  $info->addProperty("&nbsp;", $link);
1954  }
1955  }
1956 
1957  if ($big_button) {
1958  $ilToolbar->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
1959 
1960  $button = ilSubmitButton::getInstance();
1961  $button->setCaption($big_button[1], false);
1962  $button->setCommand($big_button[0]);
1963  $button->setPrimary(true);
1964  $ilToolbar->addButtonInstance($button);
1965 
1966  $ilToolbar->setCloseFormTag(false);
1967  $info->setOpenFormTag(false);
1968  }
1969  /* #12016
1970  else
1971  {
1972  $info->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
1973  }
1974  */
1975 
1976  if (strlen($this->object->getIntroduction())) {
1977  $introduction = $this->object->getIntroduction();
1978  $info->addSection($this->lng->txt("introduction"));
1979  $info->addProperty("", $this->object->prepareTextareaOutput($introduction) .
1980  "<br />" . $info->getHiddenToggleButton());
1981  } else {
1982  $info->addSection($this->lng->txt("show_details"));
1983  $info->addProperty("", $info->getHiddenToggleButton());
1984  }
1985 
1986  $info->hideFurtherSections(false);
1987 
1988  if (!$this->object->get360Mode()) {
1989  $info->addSection($this->lng->txt("svy_general_properties"));
1990 
1991  $info->addProperty(
1992  $this->lng->txt("survey_results_anonymization"),
1993  !$this->object->hasAnonymizedResults()
1994  ? $this->lng->txt("survey_results_personalized_info")
1995  : $this->lng->txt("survey_results_anonymized_info")
1996  );
1997 
1998  if ($this->checkPermissionBool("write") ||
1999  ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())) {
2000  $info->addProperty($this->lng->txt("evaluation_access"), $this->lng->txt("evaluation_access_info"));
2001  }
2002  }
2003 
2004  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
2005 
2006  $this->ctrl->forwardCommand($info);
2007  }
Class ilInfoScreenGUI.
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_SESSION["AccountId"]
static setUseRelativeDates($a_status)
set use relative dates
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Survey execution graphical output.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
$txt
Definition: error.php:13
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _hasEvaluationAccess($a_obj_id, $user_id)
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$ilUser
Definition: imgupload.php:18
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjSurveyGUI::infoScreenObject ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

Definition at line 1675 of file class.ilObjSurveyGUI.php.

References infoScreen().

1676  {
1677  $this->ctrl->setCmd("showSummary");
1678  $this->ctrl->setCmdClass("ilinfoscreengui");
1679  $this->infoScreen();
1680  }
infoScreen()
show information screen
+ Here is the call graph for this function:

◆ initImportForm()

ilObjSurveyGUI::initImportForm (   $a_new_type)
protected

Definition at line 1562 of file class.ilObjSurveyGUI.php.

References ilFileInputGUI\setSuffixes().

Referenced by importSurveyObject().

1563  {
1564  $form = new ilPropertyFormGUI();
1565  $form->setTarget("_top");
1566  $form->setFormAction($this->ctrl->getFormAction($this));
1567  $form->setTitle($this->lng->txt("import_svy"));
1568 
1569  $fi = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
1570  $fi->setSuffixes(array("zip"));
1571  $fi->setRequired(true);
1572  $form->addItem($fi);
1573 
1574  $svy = new ilObjSurvey();
1575  $questionspools = $svy->getAvailableQuestionpools(true, true, true);
1576 
1577  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool_short"), "spl");
1578  $pools->setOptions(array("" => $this->lng->txt("dont_use_questionpool")) + $questionspools);
1579  $pools->setRequired(false);
1580  $form->addItem($pools);
1581 
1582  $form->addCommandButton("importSurvey", $this->lng->txt("import"));
1583  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
1584 
1585  return $form;
1586  }
This class represents a property form user interface.
This class represents a file property in a property form.
Class ilObjSurvey.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPropertiesForm()

ilObjSurveyGUI::initPropertiesForm ( )

Init survey settings form.

Returns
ilPropertyFormGUI

Definition at line 830 of file class.ilObjSurveyGUI.php.

References ilObjectGUI\$object_service, $results, $section, ilObjectGUI\$tree, $txt, ilObject\_getAllReferences(), ilObjAdvancedEditing\_getRichTextEditor(), ilObjAdvancedEditing\_getUsedHTMLTags(), ilObjSurvey\_hasDatasets(), ilObjUser\_lookupName(), ilSubEnabledFormPropertyGUI\addSubItem(), ilObjSurvey\EVALUATION_ACCESS_ALL, ilObjSurvey\EVALUATION_ACCESS_OFF, ilObjSurvey\EVALUATION_ACCESS_PARTICIPANTS, ilMD\getGeneral(), ilOrgUnitGlobalSettings\getInstance(), IL_CAL_TIMESTAMP, IL_CAL_UNIX, ilObjectServiceSettingsGUI\initServiceSettingsForm(), ilObjSurvey\MODE_360, ilObjSurvey\MODE_SELF_EVAL, ilObjSurvey\NOTIFICATION_APPRAISEES, ilObjSurvey\NOTIFICATION_APPRAISEES_AND_RATERS, ilObjSurvey\NOTIFICATION_INVITED_USERS, ilObjSurvey\NOTIFICATION_PARENT_COURSE, ilObjSurvey\NOTIFICATION_RATERS, ilObjectServiceSettingsGUI\ORGU_POSITION_ACCESS, ilObjSurvey\RESULTS_360_ALL, ilObjSurvey\RESULTS_360_NONE, ilObjSurvey\RESULTS_360_OWN, ilObjSurvey\RESULTS_SELF_EVAL_ALL, ilObjSurvey\RESULTS_SELF_EVAL_NONE, ilObjSurvey\RESULTS_SELF_EVAL_OWN, ilCheckboxInputGUI\setChecked(), ilTextAreaInputGUI\setCols(), ilDateTimeInputGUI\setDate(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilCheckboxInputGUI\setOptionTitle(), ilFormPropertyGUI\setRequired(), ilDateTimeInputGUI\setShowTime(), ilDateDurationInputGUI\setShowTime(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), and ilTextAreaInputGUI\setValue().

Referenced by propertiesObject(), and savePropertiesObject().

831  {
832  $obj_service = $this->object_service;
833 
834  $template_settings = $hide_rte_switch = null;
835  $template = $this->object->getTemplate();
836  if ($template) {
837  $template = new ilSettingsTemplate($template);
838 
839  $template_settings = $template->getSettings();
840  $hide_rte_switch = $template_settings["rte_switch"]["hide"];
841  }
842 
843  $form = new ilPropertyFormGUI();
844  $form->setFormAction($this->ctrl->getFormAction($this));
845  $form->setTableWidth("100%");
846  $form->setId("survey_properties");
847 
848  // general properties
849  $header = new ilFormSectionHeaderGUI();
850  $header->setTitle($this->lng->txt("settings"));
851  $form->addItem($header);
852 
853 
854  // title & description (meta data)
855 
856  $md_obj = new ilMD($this->object->getId(), 0, "svy");
857  $md_section = $md_obj->getGeneral();
858 
859  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
860  $title->setRequired(true);
861  $title->setValue($md_section->getTitle());
862  $form->addItem($title);
863 
864  $ids = $md_section->getDescriptionIds();
865  if ($ids) {
866  $desc_obj = $md_section->getDescription(array_pop($ids));
867 
868  $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
869  $desc->setCols(50);
870  $desc->setRows(4);
871  $desc->setValue($desc_obj->getDescription());
872  $form->addItem($desc);
873  }
874 
875  // pool usage
876  $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool");
877  $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1);
878  $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info"));
879  $pool_usage->addOption($opt);
880  $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0);
881  $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info"));
882  $pool_usage->addOption($opt);
883  $pool_usage->setValue($this->object->getPoolUsage());
884  $form->addItem($pool_usage);
885 
886  // 360°: appraisees
887  if ($this->object->get360Mode()) {
888  $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval");
889  $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info"));
890  $self_eval->setChecked($this->object->get360SelfEvaluation());
891  $form->addItem($self_eval);
892 
893  $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate");
894  $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info"));
895  $self_rate->setChecked($this->object->get360SelfRaters());
896  $form->addItem($self_rate);
897 
898  $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr");
899  $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info"));
900  $self_appr->setChecked($this->object->get360SelfAppraisee());
901  $form->addItem($self_appr);
902  }
903 
904 
905  // activation
906  $this->lng->loadLanguageModule('rep');
907 
909  $section->setTitle($this->lng->txt('rep_activation_availability'));
910  $form->addItem($section);
911 
912  // additional info only with multiple references
913  $act_obj_info = $act_ref_info = "";
914  if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
915  $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
916  $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
917  }
918 
919  $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
920  $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info);
921  $online->setChecked(!$this->object->getOfflineStatus());
922  $form->addItem($online);
923 
924  $dur = new ilDateDurationInputGUI($this->lng->txt('rep_visibility_until'), "access_period");
925  $dur->setShowTime(true);
926  $date = $this->object->getActivationStartDate();
927  $dur->setStart($date
928  ? new ilDateTime($date, IL_CAL_UNIX)
929  : null);
930  $date = $this->object->getActivationEndDate();
931  $dur->setEnd($date
932  ? new ilDateTime($date, IL_CAL_UNIX)
933  : null);
934  $form->addItem($dur);
935 
936  $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
937  $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info'));
938  $visible->setChecked($this->object->getActivationVisibility());
939  $dur->addSubItem($visible);
940 
941  // presentation
943  $section->setTitle($this->lng->txt('obj_presentation'));
944  $form->addItem($section);
945 
946  // tile image
947  $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
948 
949  // before start
950 
952  $section->setTitle($this->lng->txt('svy_settings_section_before_start'));
953  $form->addItem($section);
954 
955  // introduction
956  $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction");
957  $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
958  $intro->setRows(10);
959  $intro->setCols(80);
960  if (ilObjAdvancedEditing::_getRichTextEditor() === "tinymce") {
961  $intro->setUseRte(true);
962  $intro->setInfo($this->lng->txt("survey_introduction_info"));
963  $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
964  $intro->addPlugin("latex");
965  $intro->addButton("latex");
966  $intro->addButton("pastelatex");
967  $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
968  }
969  $form->addItem($intro);
970 
971 
972  // access
973 
975  $section->setTitle($this->lng->txt('svy_settings_section_access'));
976  $form->addItem($section);
977 
978  // enable start date
979  $start = $this->object->getStartDate();
980  // start date
981  $startingtime = new ilDateTimeInputGUI($this->lng->txt("start_date"), 'start_date');
982  $startingtime->setShowTime(true);
983  if ($start) {
984  $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP));
985  }
986  $form->addItem($startingtime);
987 
988  // enable end date
989  $end = $this->object->getEndDate();
990  // end date
991  $endingtime = new ilDateTimeInputGUI($this->lng->txt("end_date"), 'end_date');
992  $endingtime->setShowTime(true);
993  if ($end) {
994  $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP));
995  }
996  $form->addItem($endingtime);
997 
998  // anonymization
999  if (!$this->object->get360Mode()) {
1000  $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes");
1001  $codes->setInfo($this->lng->txt("survey_access_codes_info"));
1002  $codes->setChecked(!$this->object->isAccessibleWithoutCode());
1003  $form->addItem($codes);
1004 
1005  if (ilObjSurvey::_hasDatasets($this->object->getSurveyId())) {
1006  $codes->setDisabled(true);
1007  }
1008  }
1009 
1010 
1011  // question behaviour
1012 
1014  $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour'));
1015  $form->addItem($section);
1016 
1017  // show question titles
1018  $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles");
1019  $show_question_titles->setValue(1);
1020  $show_question_titles->setChecked($this->object->getShowQuestionTitles());
1021  $form->addItem($show_question_titles);
1022 
1023 
1024  // finishing
1025 
1026  $info = new ilFormSectionHeaderGUI();
1027  $info->setTitle($this->lng->txt("svy_settings_section_finishing"));
1028  $form->addItem($info);
1029 
1030  $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own");
1031  $view_own->setInfo($this->lng->txt("svy_results_view_own_info"));
1032  $view_own->setChecked($this->object->hasViewOwnResults());
1033  $form->addItem($view_own);
1034 
1035  $mail_confirm = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_confirm"), "mail_confirm");
1036  $mail_confirm->setInfo($this->lng->txt("svy_results_mail_confirm_info"));
1037  $mail_confirm->setChecked($this->object->hasMailConfirmation());
1038  $form->addItem($mail_confirm);
1039 
1040  $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own");
1041  $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info"));
1042  $mail_own->setChecked($this->object->hasMailOwnResults());
1043  $mail_confirm->addSubItem($mail_own);
1044 
1045  // final statement
1046  $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro");
1047  $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
1048  $finalstatement->setRows(10);
1049  $finalstatement->setCols(80);
1050  if (ilObjAdvancedEditing::_getRichTextEditor() === "tinymce") {
1051  $finalstatement->setUseRte(true);
1052  $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
1053  $finalstatement->addPlugin("latex");
1054  $finalstatement->addButton("latex");
1055  $finalstatement->addButton("pastelatex");
1056  $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
1057  }
1058  $form->addItem($finalstatement);
1059 
1060  // mail notification
1061  $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification");
1062  // $mailnotification->setOptionTitle($this->lng->txt("activate"));
1063  $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info")); // #11762
1064  $mailnotification->setValue(1);
1065  $mailnotification->setChecked($this->object->getMailNotification());
1066 
1067  // addresses
1068  $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses");
1069  $mailaddresses->setValue($this->object->getMailAddresses());
1070  $mailaddresses->setSize(80);
1071  $mailaddresses->setInfo($this->lng->txt('mailaddresses_info'));
1072  $mailaddresses->setRequired(true);
1073 
1074  // participant data
1075  $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata");
1076  $participantdata->setValue($this->object->getMailParticipantData());
1077  $participantdata->setRows(6);
1078  $participantdata->setCols(80);
1079  $participantdata->setUseRte(false);
1080  $participantdata->setInfo($this->lng->txt("mailparticipantdata_info"));
1081 
1082  // #12755 - because of privacy concerns we restrict user data to a minimum
1083  $placeholders = array(
1084  "FIRST_NAME" => "firstname",
1085  "LAST_NAME" => "lastname",
1086  "LOGIN" => "login"
1087  );
1088  $txt = array();
1089  foreach ($placeholders as $placeholder => $caption) {
1090  $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption);
1091  }
1092  $txt = implode("<br />", $txt);
1093  $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true);
1094  $participantdatainfo->setValue($txt);
1095 
1096  $mailnotification->addSubItem($mailaddresses);
1097  $mailnotification->addSubItem($participantdata);
1098  $mailnotification->addSubItem($participantdatainfo);
1099  $form->addItem($mailnotification);
1100 
1101  // tutor notification - currently not available for 360°
1102  if (!$this->object->get360Mode()) {
1103  // parent course?
1104  $tree = $this->tree;
1105  $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp");
1106  if (!$has_parent) {
1107  $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs");
1108  }
1109  $num_inv = count($this->invitation_manager->getAllForSurvey($this->object->getSurveyId()));
1110 
1111  // notification
1112  $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut");
1113  $tut->setChecked($this->object->getTutorNotificationStatus());
1114  $form->addItem($tut);
1115 
1116  $tut_logins = array();
1117  $tuts = $this->object->getTutorNotificationRecipients();
1118  if ($tuts) {
1119  foreach ($tuts as $tut_id) {
1120  $tmp = ilObjUser::_lookupName($tut_id);
1121  if ($tmp["login"]) {
1122  $tut_logins[] = $tmp["login"];
1123  }
1124  }
1125  }
1126  $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids");
1127  $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true));
1128  $tut_ids->setRequired(true);
1129  $tut_ids->setMulti(true);
1130  $tut_ids->setMultiValues($tut_logins);
1131  $tut_ids->setValue(array_shift($tut_logins));
1132  $tut->addSubItem($tut_ids);
1133 
1134  $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp");
1135  $tut_grp->setRequired(true);
1136  $tut_grp->setValue($this->object->getTutorNotificationTarget());
1137  $tut->addSubItem($tut_grp);
1138 
1139  $tut_grp_crs = new ilRadioOption(
1140  $this->lng->txt("survey_notification_target_group_parent_course"),
1142  );
1143  if (!$has_parent) {
1144  $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
1145  } else {
1146  $tut_grp_crs->setInfo(sprintf(
1147  $this->lng->txt("survey_notification_target_group_invited_info"),
1148  count($this->object->getNotificationTargetUserIds(false))
1149  ));
1150  }
1151  $tut_grp->addOption($tut_grp_crs);
1152 
1153  $tut_grp_inv = new ilRadioOption(
1154  $this->lng->txt("survey_notification_target_group_invited"),
1156  );
1157  $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
1158  $tut_grp->addOption($tut_grp_inv);
1159 
1160  $tut_res = new ilCheckboxInputGUI($this->lng->txt("svy_notification_tutor_results"), "tut_res");
1161  $tut_res->setInfo($this->lng->txt("svy_notification_tutor_results_info"));
1162  $tut_res->setChecked($this->object->getTutorResultsStatus());
1163  $form->addItem($tut_res);
1164 
1165  $tut_res_logins = array();
1166  $tuts = $this->object->getTutorResultsRecipients();
1167  if ($tuts) {
1168  foreach ($tuts as $tut_id) {
1169  $tmp = ilObjUser::_lookupName($tut_id);
1170  if ($tmp["login"]) {
1171  $tut_res_logins[] = $tmp["login"];
1172  }
1173  }
1174  }
1175  $tut_res_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_res_ids");
1176  $tut_res_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true));
1177  $tut_res_ids->setRequired(true);
1178  $tut_res_ids->setMulti(true);
1179  $tut_res_ids->setMultiValues($tut_res_logins);
1180  $tut_res_ids->setValue(array_shift($tut_res_logins));
1181  $tut_res->addSubItem($tut_res_ids);
1182  }
1183 
1184 
1185  // reminders
1186 
1187  $info = new ilFormSectionHeaderGUI();
1188  $info->setTitle($this->lng->txt("svy_settings_section_reminders"));
1189  $form->addItem($info);
1190 
1191  $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd");
1192  $rmd->setChecked($this->object->getReminderStatus());
1193  $form->addItem($rmd);
1194 
1195  $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start");
1196  $rmd_start->setRequired(true);
1197  $start = $this->object->getReminderStart();
1198  if ($start) {
1199  $rmd_start->setDate($start);
1200  }
1201  $rmd->addSubItem($rmd_start);
1202 
1203  $end = $this->object->getReminderEnd();
1204  $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end");
1205  if ($end) {
1206  $rmd_end->setDate($end);
1207  }
1208  $rmd->addSubItem($rmd_end);
1209 
1210  $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq");
1211  $rmd_freq->setRequired(true);
1212  $rmd_freq->setSize(3);
1213  $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days"));
1214  $rmd_freq->setValue($this->object->getReminderFrequency());
1215  $rmd_freq->setMinValue(1);
1216  $rmd->addSubItem($rmd_freq);
1217 
1218 
1219  if (!$this->object->get360Mode()) {
1220  $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp");
1221  $rmd_grp->setRequired(true);
1222  $rmd_grp->setValue($this->object->getReminderTarget());
1223  $rmd->addSubItem($rmd_grp);
1224 
1225  $rmd_grp_crs = new ilRadioOption(
1226  $this->lng->txt("survey_notification_target_group_parent_course"),
1228  );
1229  if (!$has_parent) {
1230  $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
1231  } else {
1232  $rmd_grp_crs->setInfo(sprintf(
1233  $this->lng->txt("survey_notification_target_group_invited_info"),
1234  count($this->object->getNotificationTargetUserIds(false))
1235  ));
1236  }
1237  $rmd_grp->addOption($rmd_grp_crs);
1238 
1239  $rmd_grp_inv = new ilRadioOption(
1240  $this->lng->txt("survey_notification_target_group_invited"),
1242  );
1243  $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
1244  $rmd_grp->addOption($rmd_grp_inv);
1245 
1246  $mtmpl = $this->object->getReminderMailTemplates();
1247  if ($mtmpl) {
1248  $rmdt = new ilRadioGroupInputGUI($this->lng->txt("svy_reminder_mail_template"), "rmdt");
1249  $rmdt->setRequired(true);
1250  $rmdt->addOption(new ilRadioOption($this->lng->txt("svy_reminder_mail_template_none"), -1));
1251  foreach ($mtmpl as $mtmpl_id => $mtmpl_caption) {
1252  $option = new ilRadioOption($mtmpl_caption, $mtmpl_id);
1253  $rmdt->addOption($option);
1254  }
1255 
1256  $reminderTemplateValue = -1;
1257  if ($this->object->getReminderTemplate()) {
1258  $reminderTemplateValue = $this->object->getReminderTemplate();
1259  }
1260  $rmdt->setValue($reminderTemplateValue);
1261  $rmd->addSubItem($rmdt);
1262  }
1263  } else {
1264  // remind appraisees
1265  $cb = new ilCheckboxInputGUI($this->lng->txt("survey_notification_target_group"), "remind_appraisees");
1266  $cb->setOptionTitle($this->lng->txt("survey_360_appraisees"));
1267  $cb->setInfo($this->lng->txt("survey_360_appraisees_remind_info"));
1268  $cb->setValue("1");
1269  $cb->setChecked(in_array(
1270  $this->object->getReminderTarget(),
1272  ));
1273  $rmd->addSubItem($cb);
1274 
1275  // remind raters
1276  $cb = new ilCheckboxInputGUI("", "remind_raters");
1277  $cb->setOptionTitle($this->lng->txt("survey_360_raters"));
1278  $cb->setInfo($this->lng->txt("survey_360_raters_remind_info"));
1279  $cb->setValue("1");
1280  $cb->setChecked(in_array(
1281  $this->object->getReminderTarget(),
1283  ));
1284  $rmd->addSubItem($cb);
1285  }
1286 
1287 
1288  // results
1289 
1291  $results->setTitle($this->lng->txt("results"));
1292  $form->addItem($results);
1293 
1294  // evaluation access
1295  switch ($this->object->getMode()) {
1296  case ilObjSurvey::MODE_360:
1297  $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res");
1298  $ts_results->setValue($this->object->get360Results());
1299 
1300  $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE);
1301  $option->setInfo($this->lng->txt("survey_360_results_none_info"));
1302  $ts_results->addOption($option);
1303 
1304  $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN);
1305  $option->setInfo($this->lng->txt("survey_360_results_own_info"));
1306  $ts_results->addOption($option);
1307 
1308  $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL);
1309  $option->setInfo($this->lng->txt("survey_360_results_all_info"));
1310  $ts_results->addOption($option);
1311 
1312  $form->addItem($ts_results);
1313  break;
1314 
1316  //check the names of these vars
1317  $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "self_eval_res");
1318  $evaluation_access->setValue($this->object->getSelfEvaluationResults());
1319 
1320  $option = new ilRadioOption($this->lng->txt("svy_self_ev_access_results_none"), ilObjSurvey::RESULTS_SELF_EVAL_NONE);
1321  $evaluation_access->addOption($option);
1322 
1323  $option = new ilRadioOption($this->lng->txt("svy_self_ev_access_results_own"), ilObjSurvey::RESULTS_SELF_EVAL_OWN);
1324  $evaluation_access->addOption($option);
1325 
1326  $option = new ilRadioOption($this->lng->txt("svy_self_ev_access_results_all"), ilObjSurvey::RESULTS_SELF_EVAL_ALL);
1327  $evaluation_access->addOption($option);
1328 
1329  $form->addItem($evaluation_access);
1330  break;
1331 
1332  default:
1333  $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access");
1334 
1335  $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, '');
1336  $option->setInfo($this->lng->txt("svy_evaluation_access_off_info"));
1337  $evaluation_access->addOption($option);
1338 
1339  $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, '');
1340  $option->setInfo($this->lng->txt("svy_evaluation_access_all_info"));
1341  $evaluation_access->addOption($option);
1342 
1343  $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, '');
1344  $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info"));
1345  $evaluation_access->addOption($option);
1346 
1347  $evaluation_access->setValue($this->object->getEvaluationAccess());
1348  $form->addItem($evaluation_access);
1349 
1350  $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options");
1351 
1352  $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers");
1353  $option->setInfo($this->lng->txt("survey_results_personalized_info"));
1354  $anonymization_options->addOption($option);
1355 
1356  $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon");
1357  $option->setInfo($this->lng->txt("survey_results_anonymized_info"));
1358  $anonymization_options->addOption($option);
1359  $anonymization_options->setValue($this->object->hasAnonymizedResults()
1360  ? "statanon"
1361  : "statpers");
1362  $form->addItem($anonymization_options);
1363 
1364  $surveySetting = new ilSetting("survey");
1365  if ($surveySetting->get("anonymous_participants", false)) {
1366  $min = "";
1367  if ($surveySetting->get("anonymous_participants_min", 0)) {
1368  $min = " (" . $this->lng->txt("svy_anonymous_participants_min") . ": " .
1369  $surveySetting->get("anonymous_participants_min") . ")";
1370  }
1371 
1372  $anon_list = new ilCheckboxInputGUI($this->lng->txt("svy_anonymous_participants_svy"), "anon_list");
1373  $anon_list->setInfo($this->lng->txt("svy_anonymous_participants_svy_info") . $min);
1374  $anon_list->setChecked($this->object->hasAnonymousUserList());
1375  $option->addSubItem($anon_list);
1376  }
1377 
1378  if ($this->object->_hasDatasets($this->object->getSurveyId())) {
1379  $anonymization_options->setDisabled(true);
1380  if ($anon_list) {
1381  $anon_list->setDisabled(true);
1382  }
1383  }
1384 
1385  // calculate sum score
1386  $sum_score = new ilCheckboxInputGUI($this->lng->txt("survey_calculate_sum_score"), "calculate_sum_score");
1387  $sum_score->setInfo($this->lng->txt("survey_calculate_sum_score_info"));
1388  $sum_score->setValue("1");
1389  $sum_score->setChecked($this->object->getCalculateSumScore());
1390  $form->addItem($sum_score);
1391 
1392  break;
1393  }
1394 
1395  // competence service activation for 360 mode
1396 
1397  $skmg_set = new ilSkillManagementSettings();
1398  $svy_mode = $this->object->getMode();
1399  if (($svy_mode == ilObjSurvey::MODE_360 || $svy_mode == ilObjSurvey::MODE_SELF_EVAL) && $skmg_set->isActivated()) {
1400  $other = new ilFormSectionHeaderGUI();
1401  $other->setTitle($this->lng->txt("other"));
1402  $form->addItem($other);
1403 
1404  $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service");
1405  $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info"));
1406  $skill_service->setChecked($this->object->getSkillService());
1407  $form->addItem($skill_service);
1408  }
1409 
1410  $position_settings = ilOrgUnitGlobalSettings::getInstance()
1411  ->getObjectPositionSettingsByType($this->object->getType());
1412 
1413  if ($position_settings->isActive()) {
1414  // add additional feature section
1415  $feat = new ilFormSectionHeaderGUI();
1416  $feat->setTitle($this->lng->txt('obj_features'));
1417  $form->addItem($feat);
1418 
1419  // add orgunit settings
1421  $this->object->getId(),
1422  $form,
1423  array(
1425  )
1426  );
1427  }
1428 
1429  $form->addCommandButton("saveProperties", $this->lng->txt("save"));
1430 
1431  // remove items when using template
1432  if ($template_settings) {
1433  foreach ($template_settings as $id => $item) {
1434  if ($item["hide"]) {
1435  if ($id == "enabled_end_date") {
1436  $id = "end_date";
1437  }
1438  if ($id == "enabled_start_date") {
1439  $id = "start_date";
1440  }
1441  $form->removeItemByPostVar($id, true);
1442  }
1443  }
1444  }
1445  return $form;
1446  }
static _lookupName($a_user_id)
lookup user name
This class represents an option in a radio group.
This class represents an option in a checkbox group.
const EVALUATION_ACCESS_OFF
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
This class represents a property form user interface.
const EVALUATION_ACCESS_PARTICIPANTS
This class represents a section header in a property form.
static _hasDatasets($survey_id)
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
const NOTIFICATION_APPRAISEES
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
const IL_CAL_UNIX
setInfo($a_info)
Set Info.
static _getAllReferences($a_id)
get all reference ids of object
This class represents a date/time property in a property form.
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:83
setChecked($a_checked)
Set Checked.
input GUI for a time span (start and end date)
This class represents a property in a property form.
Class for single dates.
const NOTIFICATION_PARENT_COURSE
const RESULTS_SELF_EVAL_OWN
This class represents a number property in a property form.
const NOTIFICATION_APPRAISEES_AND_RATERS
setValue($a_value)
Set Value.
setDate(ilDateTime $a_date=null)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
& getGeneral()
Definition: class.ilMD.php:40
$results
setShowTime($a_showtime)
Set Show Time Information.
const NOTIFICATION_INVITED_USERS
$txt
Definition: error.php:13
const EVALUATION_ACCESS_ALL
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
const RESULTS_SELF_EVAL_NONE
const IL_CAL_TIMESTAMP
setOptionTitle($a_optiontitle)
Set Option Title (optional).
const RESULTS_SELF_EVAL_ALL
Settings template application class.
setRequired($a_required)
Set Required.
setShowTime($a_showtime)
Set Show Time Information.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailUserResultsObject()

ilObjSurveyGUI::mailUserResultsObject ( )

Definition at line 2299 of file class.ilObjSurveyGUI.php.

References $_POST, $_SESSION, $ilUser, ilObjectGUI\$user, and ilUtil\is_email().

2300  {
2301  $ilUser = $this->user;
2302 
2303  $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
2304  $active_id = $this->object->getActiveID($ilUser->getId(), $anonymous_code, 0);
2305  if ($this->object->isSurveyStarted($ilUser->getId(), $anonymous_code) !== 1 ||
2306  !$active_id) {
2307  $this->ctrl->redirect($this, "infoScreen");
2308  }
2309 
2310  $recipient = $_POST["mail"];
2311  if (!$recipient) {
2312  $recipient = $ilUser->getEmail();
2313  }
2314  if (!ilUtil::is_email($recipient)) {
2315  $this->ctrl->redirect($this, "infoScreen");
2316  }
2317 
2318  $this->sendUserResultsMail($active_id, $recipient);
2319 
2320  ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
2321  $this->ctrl->redirect($this, "infoScreen");
2322  }
$_SESSION["AccountId"]
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ propertiesObject()

ilObjSurveyGUI::propertiesObject ( ilPropertyFormGUI  $a_form = null)

Display and fill the properties form of the test.

public

Definition at line 1476 of file class.ilObjSurveyGUI.php.

References $help, $message, $tabs, addSubTabs(), ilObjectGUI\checkPermission(), ilUtil\getSystemMessageHTML(), initPropertiesForm(), and ilSettingsTemplate\lookupTitle().

Referenced by savePropertiesObject().

1477  {
1478  $ilTabs = $this->tabs;
1479  $ilHelp = $this->help;
1480 
1481  $this->checkPermission("write");
1482 
1483  $this->addSubTabs('settings');
1484  $ilTabs->activateTab("settings");
1485  $ilTabs->activateSubTab('settings');
1486 
1487  if ($this->object->get360Mode()) {
1488  $ilHelp->setScreenId("settings_360");
1489  }
1490 
1491  if (!$a_form) {
1492  $a_form = $this->initPropertiesForm();
1493  }
1494 
1495  // using template?
1496  $message = "";
1497  if ($this->object->getTemplate()) {
1498  $link = $this->ctrl->getLinkTarget($this, "confirmResetTemplate");
1499  $link = "<a href=\"" . $link . "\">" . $this->lng->txt("survey_using_template_link") . "</a>";
1500  $message = "<div style=\"margin-top:10px\">" .
1502  $this->lng->txt("survey_using_template"),
1503  ilSettingsTemplate::lookupTitle($this->object->getTemplate()),
1504  $link
1505  ), "info") . // #10651
1506  "</div>";
1507  }
1508 
1509  $this->tpl->setContent($a_form->getHTML() . $message);
1510  }
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
static lookupTitle($a_id)
Lookup title.
addSubTabs($a_section)
Add subtabs for tabs.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$message
Definition: xapiexit.php:14
initPropertiesForm()
Init survey settings form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetTemplateObject()

ilObjSurveyGUI::resetTemplateObject ( )

Enable all settings - remove template.

Definition at line 1547 of file class.ilObjSurveyGUI.php.

1548  {
1549  $this->object->setTemplate(null);
1550  $this->object->saveToDB();
1551 
1552  ilUtil::sendSuccess($this->lng->txt("survey_template_reset"), true);
1553  $this->ctrl->redirect($this, "properties");
1554  }

◆ savePropertiesObject()

ilObjSurveyGUI::savePropertiesObject ( )

Save the survey properties.

Save the survey properties

private

Definition at line 543 of file class.ilObjSurveyGUI.php.

References $_POST, $_SESSION, ilObjectGUI\$object_service, $rbacsystem, $valid, ilObjSurvey\_hasDatasets(), ilObjUser\_lookupId(), ilObjSurvey\ANONYMIZE_CODE_ALL, ilObjSurvey\ANONYMIZE_FREEACCESS, ilObjSurvey\ANONYMIZE_OFF, ilObjSurvey\ANONYMIZE_ON, ilMD\getGeneral(), IL_CAL_DATETIME, IL_CAL_UNIX, initPropertiesForm(), ilObjSurvey\MODE_360, ilObjSurvey\MODE_SELF_EVAL, ilObjSurvey\NOTIFICATION_APPRAISEES, ilObjSurvey\NOTIFICATION_APPRAISEES_AND_RATERS, ilObjSurvey\NOTIFICATION_RATERS, ilObjectServiceSettingsGUI\ORGU_POSITION_ACCESS, propertiesObject(), ilUtil\sendFailure(), ilUtil\stripSlashes(), ilMDBase\update(), and ilObjectServiceSettingsGUI\updateServiceSettingsForm().

544  {
546  $obj_service = $this->object_service;
547 
548  $form = $this->initPropertiesForm();
549  if ($form->checkInput()) {
550  $valid = true;
551 
552  if (!$this->object->get360Mode()) {
553  if ($form->getInput("tut")) {
554  // check if given "tutors" have write permission
555  $tut_ids = array();
556  $tut_logins = $form->getInput("tut_ids");
557  foreach ($tut_logins as $tut_login) {
558  $tut_id = ilObjUser::_lookupId($tut_login);
559  if ($tut_id && $rbacsystem->checkAccessOfUser($tut_id, "write", $this->object->getRefId())) {
560  $tut_ids[] = $tut_id;
561  }
562  }
563  if (!$tut_ids) {
564  $tut_ids = $form->getItemByPostVar("tut_ids");
565  $tut_ids->setAlert($this->lng->txt("survey_notification_tutor_recipients_invalid"));
566  $valid = false;
567  }
568  }
569  if ($form->getInput("tut_res")) {
570  $end = $form->getItemByPostVar("end_date");
571  if (!$end->getDate()) {
572  $tut_res = $form->getItemByPostVar("tut_res");
573  $tut_res->setAlert($this->lng->txt("svy_notification_tutor_results_alert"));
574  $valid = false;
575  }
576 
577  // check if given "tutors" have write permission
578  $tut_res_ids = array();
579  $tut_logins = $form->getInput("tut_res_ids");
580  foreach ($tut_logins as $tut_login) {
581  $tut_id = ilObjUser::_lookupId($tut_login);
582  if ($tut_id && $rbacsystem->checkAccessOfUser($tut_id, "write", $this->object->getRefId())) {
583  $tut_res_ids[] = $tut_id;
584  }
585  }
586  if (!$tut_res_ids) {
587  $tut_res_ids = $form->getItemByPostVar("tut_res_ids");
588  $tut_res_ids->setAlert($this->lng->txt("survey_notification_tutor_recipients_invalid"));
589  $valid = false;
590  }
591  }
592  }
593 
594  if ($valid) {
595  if ($form->getInput("rmd")) {
596  $rmd_start = $form->getItemByPostVar("rmd_start")->getDate();
597  $rmd_end = $form->getItemByPostVar("rmd_end")->getDate();
598  if ($rmd_end) {
599  if ($rmd_start->get(IL_CAL_UNIX) > $rmd_end->get(IL_CAL_UNIX)) {
600  $tmp = $rmd_start;
601  $rmd_start = $rmd_end;
602  $rmd_end = $tmp;
603  }
604  }
605  $this->object->setReminderStatus(true);
606  $this->object->setReminderStart($rmd_start);
607  $this->object->setReminderEnd($rmd_end);
608  $this->object->setReminderFrequency($form->getInput("rmd_freq"));
609  if (!$this->object->get360Mode()) {
610  $this->object->setReminderTarget($form->getInput("rmd_grp"));
611  $this->object->setReminderTemplate(($form->getInput("rmdt") > 0)
612  ? $form->getInput("rmdt")
613  : null);
614  } else {
615  if ($form->getInput("remind_appraisees") && $form->getInput("remind_raters")) {
616  $this->object->setReminderTarget(ilObjSurvey::NOTIFICATION_APPRAISEES_AND_RATERS);
617  } elseif ($form->getInput("remind_appraisees")) {
618  $this->object->setReminderTarget(ilObjSurvey::NOTIFICATION_APPRAISEES);
619  } elseif ($form->getInput("remind_raters")) {
620  $this->object->setReminderTarget(ilObjSurvey::NOTIFICATION_RATERS);
621  } else {
622  $this->object->setReminderTarget(0);
623  }
624  }
625  } else {
626  $this->object->setReminderStatus(false);
627  }
628 
629  if (!$this->object->get360Mode()) {
630  if ($form->getInput("tut")) {
631  $this->object->setTutorNotificationStatus(true);
632  $this->object->setTutorNotificationRecipients($tut_ids); // see above
633  $this->object->setTutorNotificationTarget($form->getInput("tut_grp"));
634  } else {
635  $this->object->setTutorNotificationStatus(false);
636  }
637 
638  if ($form->getInput("tut_res")) {
639  $this->object->setTutorResultsStatus(true);
640  $this->object->setTutorResultsRecipients($tut_res_ids); // see above
641  } else {
642  $this->object->setTutorResultsStatus(false);
643  }
644  }
645 
646  // #10055
647  if ($_POST['online'] && count($this->object->questions) == 0) {
648  $_POST['online'] = null;
649  ilUtil::sendFailure($this->lng->txt("cannot_switch_to_online_no_questions"), true);
650  }
651 
652  $template_settings = null;
653  $template = $this->object->getTemplate();
654  if ($template) {
655  $template = new ilSettingsTemplate($template);
656  $template_settings = $template->getSettings();
657  }
658 
659  $md_obj = new ilMD($this->object->getId(), 0, "svy");
660  $md_section = $md_obj->getGeneral();
661 
662  // title
663  $md_section->setTitle(ilUtil::stripSlashes($_POST['title']));
664  $md_section->update();
665 
666  // Description
667  $md_desc_ids = $md_section->getDescriptionIds();
668  if ($md_desc_ids) {
669  $md_desc = $md_section->getDescription(array_pop($md_desc_ids));
670  $md_desc->setDescription(ilUtil::stripSlashes($_POST['description']));
671  $md_desc->update();
672  }
673 
674  $this->object->setViewOwnResults($_POST["view_own"]);
675  $this->object->setMailOwnResults($_POST["mail_own"]);
676  $this->object->setMailConfirmation($_POST["mail_confirm"]);
677 
678  // both are saved in object, too
679  $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
680  $this->object->setDescription(ilUtil::stripSlashes($_POST['description']));
681  $this->object->setOfflineStatus((bool) !$_POST['online']);
682  $this->object->update();
683 
684  // activation
685  $period = $form->getItemByPostVar("access_period");
686  if ($period->getStart() && $period->getEnd()) {
687  $this->object->setActivationLimited(true);
688  $this->object->setActivationVisibility($_POST["access_visiblity"]);
689  $this->object->setActivationStartDate($period->getStart()->get(IL_CAL_UNIX));
690  $this->object->setActivationEndDate($period->getEnd()->get(IL_CAL_UNIX));
691  } else {
692  $this->object->setActivationLimited(false);
693  }
694 
695  // tile image
696  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
697 
698 
699  if (!$template_settings["enabled_start_date"]["hide"]) {
700  $start = $form->getItemByPostVar("start_date");
701  if ($start->getDate()) {
702  $datetime = explode(" ", $start->getDate()->get(IL_CAL_DATETIME));
703  $this->object->setStartDateAndTime($datetime[0], $datetime[1]);
704  } else {
705  $this->object->setStartDate(null);
706  }
707  }
708 
709  if (!$template_settings["enabled_end_date"]["hide"]) {
710  $end = $form->getItemByPostVar("end_date");
711  if ($end->getDate()) {
712  $datetime = explode(" ", $end->getDate()->get(IL_CAL_DATETIME));
713  $this->object->setEndDateAndTime($datetime[0], $datetime[1]);
714  } else {
715  $this->object->setEndDate(null);
716  }
717  }
718 
719 
720  $introduction = $_POST["introduction"];
721  $this->object->setIntroduction($introduction);
722  $outro = $_POST["outro"];
723  $this->object->setOutro($outro);
724 
725  if (!$template_settings["show_question_titles"]["hide"]) {
726  $this->object->setShowQuestionTitles($_POST["show_question_titles"]);
727  }
728 
729  if (!$template_settings["use_pool"]["hide"]) {
730  $this->object->setPoolUsage($_POST["use_pool"]);
731  }
732 
733  $this->object->setMailNotification($_POST['mailnotification']);
734  $this->object->setMailAddresses($_POST['mailaddresses']);
735  $this->object->setMailParticipantData($_POST['mailparticipantdata']);
736 
737  switch ($this->object->getMode()) {
739  $this->object->set360SelfEvaluation((bool) $_POST["self_eval"]);
740  $this->object->set360SelfAppraisee((bool) $_POST["self_appr"]);
741  $this->object->set360SelfRaters((bool) $_POST["self_rate"]);
742  $this->object->set360Results((int) $_POST["ts_res"]);;
743  $this->object->setSkillService((int) $_POST["skill_service"]);
744  break;
746  $this->object->setSelfEvaluationResults($_POST["self_eval_res"]);
747  $this->object->setSkillService((int) $_POST["skill_service"]);
748  break;
749  default:
750  if (!$template_settings["evaluation_access"]["hide"]) {
751  $this->object->setEvaluationAccess($_POST["evaluation_access"]);
752  }
753  $this->object->setCalculateSumScore((int) $_POST["calculate_sum_score"]);
754  $hasDatasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
755  if (!$hasDatasets) {
756  $hide_codes = $template_settings["acc_codes"]["hide"];
757  $hide_anon = $template_settings["anonymization_options"]["hide"];
758  if (!$hide_codes || !$hide_anon) {
759  $current = $this->object->getAnonymize();
760 
761  // get current setting if property is hidden
762  if (!$hide_codes) {
763  $codes = (bool) $_POST["acc_codes"];
764  } else {
765  $codes = ($current == ilObjSurvey::ANONYMIZE_CODE_ALL ||
766  $current == ilObjSurvey::ANONYMIZE_ON);
767  }
768  if (!$hide_anon) {
769  $anon = ((string) $_POST["anonymization_options"] == "statanon");
770  } else {
771  $anon = ($current == ilObjSurvey::ANONYMIZE_FREEACCESS ||
772  $current == ilObjSurvey::ANONYMIZE_ON);
773  }
774 
775  // parse incoming values
776  if (!$anon) {
777  if (!$codes) {
778  $this->object->setAnonymize(ilObjSurvey::ANONYMIZE_OFF);
779  } else {
780  $this->object->setAnonymize(ilObjSurvey::ANONYMIZE_CODE_ALL);
781  }
782  } else {
783  if ($codes) {
784  $this->object->setAnonymize(ilObjSurvey::ANONYMIZE_ON);
785  } else {
786  $this->object->setAnonymize(ilObjSurvey::ANONYMIZE_FREEACCESS);
787  }
788 
789  $this->object->setAnonymousUserList($_POST["anon_list"]);
790  }
791 
792  // if settings were changed get rid of existing code
793  unset($_SESSION["anonymous_id"][$this->object->getId()]);
794  }
795  }
796  break;
797  }
798 
799  $this->object->saveToDb();
800 
802  $this->object->getId(),
803  $form,
804  array(
806  )
807  );
808 
809  if (strcmp($_SESSION["info"], "") != 0) {
810  ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("settings_saved"), true);
811  } else {
812  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
813  }
814  $this->ctrl->redirect($this, "properties");
815  } else {
816  // #16714
817  ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
818  }
819  }
820 
821  $form->setValuesByPost();
822  $this->propertiesObject($form);
823  }
const IL_CAL_DATETIME
$_SESSION["AccountId"]
static _hasDatasets($survey_id)
$valid
const NOTIFICATION_APPRAISEES
static _lookupId($a_user_str)
Lookup id by login.
const IL_CAL_UNIX
const ANONYMIZE_FREEACCESS
const NOTIFICATION_APPRAISEES_AND_RATERS
& getGeneral()
Definition: class.ilMD.php:40
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
propertiesObject(ilPropertyFormGUI $a_form=null)
Display and fill the properties form of the test.
const ANONYMIZE_CODE_ALL
$_POST["username"]
Settings template application class.
initPropertiesForm()
Init survey settings form.
+ Here is the call graph for this function:

◆ viewUserResultsObject()

ilObjSurveyGUI::viewUserResultsObject ( )
protected

Definition at line 2142 of file class.ilObjSurveyGUI.php.

References $_SESSION, $ilUser, $tabs, ilObjectGUI\$tpl, ilObjectGUI\$user, and getUserResultsTable().

2143  {
2144  $ilUser = $this->user;
2145  $tpl = $this->tpl;
2146  $ilTabs = $this->tabs;
2147 
2148  $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
2149  $active_id = $this->object->getActiveID($ilUser->getId(), $anonymous_code, 0);
2150  if ($this->object->isSurveyStarted($ilUser->getId(), $anonymous_code) !== 1 ||
2151  !$active_id) {
2152  $this->ctrl->redirect($this, "infoScreen");
2153  }
2154 
2155  $ilTabs->clearTargets();
2156  $ilTabs->setBackTarget(
2157  $this->lng->txt("btn_back"),
2158  $this->ctrl->getLinkTarget($this, "infoScreen")
2159  );
2160 
2161  $html = $this->getUserResultsTable($active_id);
2162  $tpl->setContent($html);
2163  }
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18
getUserResultsTable($a_active_id)
+ Here is the call graph for this function:

Field Documentation

◆ $help

ilObjSurveyGUI::$help
protected

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

Referenced by getTabs(), and propertiesObject().

◆ $invitation_manager

ilObjSurveyGUI::$invitation_manager
protected

Definition at line 51 of file class.ilObjSurveyGUI.php.

◆ $log

ilObjSurveyGUI::$log
protected

Definition at line 46 of file class.ilObjSurveyGUI.php.

◆ $nav_history

ilObjSurveyGUI::$nav_history
protected

Definition at line 26 of file class.ilObjSurveyGUI.php.

Referenced by executeCommand().

◆ $rbacsystem

ilObjSurveyGUI::$rbacsystem
protected

Definition at line 41 of file class.ilObjSurveyGUI.php.

Referenced by savePropertiesObject().

◆ $tabs

ilObjSurveyGUI::$tabs
protected

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