ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 

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
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 

Additional Inherited Members

- Data Fields inherited from ilObjectGUI
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, $ilCtrl, 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  }
$_GET["client_id"]
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
help()
Definition: help.php:2
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
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 2041 of file class.ilObjSurveyGUI.php.

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

2042  {
2043  global $DIC;
2044 
2045  $ilAccess = $DIC->access();
2046  $lng = $DIC->language();
2047 
2048  // see ilObjSurveyAccess::_checkGoto()
2049  if (strlen($a_access_code)) {
2050  $_SESSION["anonymous_id"][ilObject::_lookupObjId($a_target)] = $a_access_code;
2051  $_GET["baseClass"] = "ilObjSurveyGUI";
2052  $_GET["cmd"] = "infoScreen";
2053  $_GET["ref_id"] = $a_target;
2054  include("ilias.php");
2055  exit;
2056  }
2057 
2058  if ($ilAccess->checkAccess("visible", "", $a_target) ||
2059  $ilAccess->checkAccess("read", "", $a_target)) {
2060  $_GET["baseClass"] = "ilObjSurveyGUI";
2061  $_GET["cmd"] = "infoScreen";
2062  $_GET["ref_id"] = $a_target;
2063  include("ilias.php");
2064  exit;
2065  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2066  ilUtil::sendFailure(sprintf(
2067  $lng->txt("msg_no_perm_read_item"),
2069  ), true);
2071  }
2072  }
exit
Definition: login.php:29
$_SESSION["AccountId"]
$_GET["client_id"]
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ addDidacticTemplateOptions()

ilObjSurveyGUI::addDidacticTemplateOptions ( array &  $a_options)
protected

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

References ilSettingsTemplate\getAllSettingsTemplates().

290  {
292  if ($templates) {
293  foreach ($templates as $item) {
294  $a_options["svytpl_" . $item["id"]] = array($item["title"],
295  nl2br(trim($item["description"])));
296  }
297  }
298 
299  // JF, 2013-06-10
300  $a_options["svy360_1"] = array($this->lng->txt("survey_360_mode"),
301  $this->lng->txt("survey_360_mode_info"));
302 
303  //Self evaluation only
304  $a_options["svyselfeval_1"] = array($this->lng->txt("svy_self_ev_mode"),
305  $this->lng->txt("svy_self_ev_info"));
306  }
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 1989 of file class.ilObjSurveyGUI.php.

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

1990  {
1991  $ilLocator = $this->locator;
1992  switch ($this->ctrl->getCmd()) {
1993  case "next":
1994  case "previous":
1995  case "start":
1996  case "resume":
1997  case "redirectQuestion":
1998  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
1999  break;
2000  case "evaluation":
2001  case "checkEvaluationAccess":
2002  case "evaluationdetails":
2003  case "evaluationuser":
2004  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTargetByClass("ilsurveyevaluationgui", "evaluation"), "", $_GET["ref_id"]);
2005  break;
2006  case "create":
2007  case "save":
2008  case "cancel":
2009  case "importSurvey":
2010  case "cloneAll":
2011  break;
2012  case "infoScreen":
2013  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
2014  break;
2015  default:
2016  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
2017 
2018  // this has to be done here because ilSurveyEditorGUI is called after finalizing the locator
2019  if ((int) $_GET["q_id"] && !(int) $_REQUEST["new_for_survey"]) {
2020  // not on create
2021  // see ilObjSurveyQuestionPool::addLocatorItems
2022  $q_id = (int) $_GET["q_id"];
2023  $q_type = SurveyQuestion::_getQuestionType($q_id) . "GUI";
2024  $this->ctrl->setParameterByClass($q_type, "q_id", $q_id);
2025  $ilLocator->addItem(
2027  $this->ctrl->getLinkTargetByClass(array("ilSurveyEditorGUI", $q_type), "editQuestion")
2028  );
2029  }
2030  break;
2031  }
2032  }
$_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 1432 of file class.ilObjSurveyGUI.php.

Referenced by executeCommand(), and propertiesObject().

1433  {
1434  if ($a_section == 'settings') {
1435  $this->tabs_gui->addSubTabTarget(
1436  "settings",
1437  $this->ctrl->getLinkTarget($this, 'properties')
1438  );
1439 
1440  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1441  if ($lti_settings->hasSettingsAccess()) {
1442  $this->tabs_gui->addSubTabTarget(
1443  'lti_provider',
1444  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1445  );
1446  }
1447  }
1448  }
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 312 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().

313  {
314  // #16446
315  $a_new_object->loadFromDb();
316 
317  $tpl = $this->getDidacticTemplateVar("svytpl");
318  if ($tpl) {
319  $a_new_object->applySettingsTemplate($tpl);
320  } else {
321  //set the mode depending on didactic template
322  if ($this->getDidacticTemplateVar("svy360")) {
323  $a_new_object->setMode(ilObjSurvey::MODE_360);
324  } elseif ($this->getDidacticTemplateVar("svyselfeval")) {
325  $a_new_object->setMode(ilObjSurvey::MODE_SELF_EVAL);
326  }
327  }
328 
329  $svy_mode = $a_new_object->getMode();
330  if ($svy_mode == ilObjSurvey::MODE_360) {
331  // this should rather be ilObjSurvey::ANONYMIZE_ON - see ilObjSurvey::getUserDataFromActiveId()
332  $a_new_object->setAnonymize(ilObjSurvey::ANONYMIZE_CODE_ALL);
333  $a_new_object->setEvaluationAccess(ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS);
334  } elseif ($svy_mode == ilObjSurvey::MODE_SELF_EVAL) {
335  $a_new_object->setEvaluationAccess(ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS);
336  }
337  $a_new_object->saveToDB();
338 
339  // always send a message
340  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
341  ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&ref_id=" .
342  $a_new_object->getRefId() . "&cmd=properties");
343  }
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 2310 of file class.ilObjSurveyGUI.php.

References ilObjectGUI\$access, and $GLOBALS.

Referenced by executeCommand(), and getTabs().

2311  {
2312  $access = $GLOBALS['DIC']->access();
2313  return $access->checkRbacOrPositionPermissionAccess(
2314  $a_rbac_permission,
2315  $a_position_permission,
2316  $this->object->getRefId()
2317  );
2318  }
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 1513 of file class.ilObjSurveyGUI.php.

References ilUtil\sendQuestion().

1514  {
1515  ilUtil::sendQuestion($this->lng->txt("survey_confirm_template_reset"));
1516  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_confirm_resettemplate.html", "Modules/Survey");
1517  $this->tpl->setCurrentBlock("adm_content");
1518  $this->tpl->setVariable("BTN_CONFIRM_REMOVE", $this->lng->txt("confirm"));
1519  $this->tpl->setVariable("BTN_CANCEL_REMOVE", $this->lng->txt("cancel"));
1520  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "resetTemplateObject"));
1521  $this->tpl->parseCurrentBlock();
1522  }
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 1492 of file class.ilObjSurveyGUI.php.

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

1493  {
1494  $fields = array('login','firstname','lastname','email');
1495 
1496  $auto = new ilUserAutoComplete();
1497  $auto->setSearchFields($fields);
1498  $auto->setResultField('login');
1499  $auto->enableFieldSearchableCheck(true);
1500  $auto->setMoreLinkAvailable(true);
1501 
1502  if (($_REQUEST['fetchall'])) {
1503  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1504  }
1505 
1506  echo $auto->getList(ilUtil::stripSlashes($_REQUEST['term']));
1507  exit();
1508  }
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 282 of file class.ilObjSurveyGUI.php.

283  {
284  $eval_gui = new ilSurveyEvaluationGUI($this->object);
285  $this->ctrl->setCmdClass(get_class($eval_gui));
286  $this->ctrl->redirect($eval_gui, "evaluation");
287  }
Survey evaluation graphical output.

◆ executeCommand()

ilObjSurveyGUI::executeCommand ( )

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

References $_GET, $_SESSION, $GLOBALS, $nav_history, $tabs, ilLink\_getLink(), 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(), and ilObjSurvey\validateExternalRaterCode().

86  {
87  $ilNavigationHistory = $this->nav_history;
88  $ilTabs = $this->tabs;
89 
90  $this->external_rater_360 = false;
91  if (!$this->creation_mode &&
92  $this->object->get360Mode() &&
93  $_SESSION["anonymous_id"][$this->object->getId()] &&
95  $this->object->getRefId(),
96  $_SESSION["anonymous_id"][$this->object->getId()]
97  )) {
98  $this->external_rater_360 = true;
99  }
100 
101  if (!$this->external_rater_360) {
102  if (!$this->checkPermissionBool("visible") &&
103  !$this->checkPermissionBool("read")) {
104  $this->checkPermission("read");
105  }
106 
107  // add entry to navigation history
108  if (!$this->getCreationMode() &&
109  $this->checkPermissionBool("read")) {
110  $this->ctrl->setParameterByClass("ilobjsurveygui", "ref_id", $this->ref_id);
111  $link = ilLink::_getLink($this->ref_id);
112  $ilNavigationHistory->addItem($this->ref_id, $link, "svy");
113  }
114  }
115 
116  $cmd = $this->ctrl->getCmd("properties");
117 
118  // workaround for bug #6288, needs better solution
119  if ($cmd == "saveTags") {
120  $this->ctrl->setCmdClass("ilinfoscreengui");
121  }
122 
123  // deep link from repository - "redirect" to page view
124  if (!$this->ctrl->getCmdClass() && $cmd == "questionsrepo") {
125  $_REQUEST["pgov"] = 1;
126  $this->ctrl->setCmd("questions");
127  $this->ctrl->setCmdClass("ilsurveyeditorgui");
128  }
129 
130  $next_class = $this->ctrl->getNextClass($this);
131  $this->ctrl->setReturn($this, "properties");
132  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "survey.css", "Modules/Survey"), "screen");
133  $this->prepareOutput();
134 
135  $this->log->debug("next_class= $next_class");
136  switch ($next_class) {
137  case 'illtiproviderobjectsettinggui':
138  $this->addSubTabs('settings');
139  $ilTabs->activateTab("settings");
140  $ilTabs->activateSubTab('lti_provider');
141  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
142  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
143  $lti_gui->offerLTIRolesForSelection(false);
144  $this->ctrl->forwardCommand($lti_gui);
145  break;
146 
147 
148  case "ilinfoscreengui":
149  if (!in_array(
150  $this->ctrl->getCmdClass(),
151  array('ilpublicuserprofilegui', 'ilobjportfoliogui')
152  )) {
153  $this->addHeaderAction();
154  $this->infoScreen(); // forwards command
155  } else {
156  // #16891
157  $ilTabs->clearTargets();
158  $info = new ilInfoScreenGUI($this);
159  $this->ctrl->forwardCommand($info);
160  }
161  break;
162 
163  case 'ilobjectmetadatagui':
164  $this->checkPermission("write");
165  $ilTabs->activateTab("meta_data");
166  $this->addHeaderAction();
167  $md_gui = new ilObjectMetaDataGUI($this->object);
168  $this->ctrl->forwardCommand($md_gui);
169  break;
170 
171  case "ilsurveyevaluationgui":
172  $ilTabs->activateTab("svy_results");
173  $this->addHeaderAction();
174  $eval_gui = new ilSurveyEvaluationGUI($this->object);
175  $this->ctrl->forwardCommand($eval_gui);
176  break;
177 
178  case "ilsurveyexecutiongui":
179  $ilTabs->clearTargets();
180  $exec_gui = new ilSurveyExecutionGUI($this->object);
181  $this->ctrl->forwardCommand($exec_gui);
182  break;
183 
184  case 'ilpermissiongui':
185  $ilTabs->activateTab("perm_settings");
186  $this->addHeaderAction();
187  $perm_gui = new ilPermissionGUI($this);
188  $this->ctrl->forwardCommand($perm_gui);
189  break;
190 
191  case 'ilobjectcopygui':
192  $cp = new ilObjectCopyGUI($this);
193  $cp->setType('svy');
194  $this->ctrl->forwardCommand($cp);
195  break;
196 
197  case "ilcommonactiondispatchergui":
199  $this->ctrl->forwardCommand($gui);
200  break;
201 
202  // 360, skill service
203  case 'ilsurveyskillgui':
204  $ilTabs->activateTab("survey_competences");
205  $gui = new ilSurveySkillGUI($this->object);
206  $this->ctrl->forwardCommand($gui);
207  break;
208 
209  case 'ilsurveyskilldeterminationgui':
210  $ilTabs->activateTab("maintenance");
211  $gui = new ilSurveySkillDeterminationGUI($this->object);
212  $this->ctrl->forwardCommand($gui);
213  break;
214 
215  case 'ilsurveyeditorgui':
216  $this->checkPermission("write");
217  $ilTabs->activateTab("survey_questions");
218  $gui = new ilSurveyEditorGUI($this);
219  $this->ctrl->forwardCommand($gui);
220  break;
221 
222  case 'ilsurveyconstraintsgui':
223  $this->checkPermission("write");
224  $ilTabs->activateTab("constraints");
225  $gui = new ilSurveyConstraintsGUI($this);
226  $this->ctrl->forwardCommand($gui);
227  break;
228 
229  case 'ilsurveyparticipantsgui':
230  if ($this->object->getMode() == ilObjSurvey::MODE_STANDARD || $this->object->getMode() == ilObjSurvey::MODE_SELF_EVAL) {
231  $ilTabs->activateTab("maintenance");
232  } else {
233  $ilTabs->activateTab("survey_360_appraisees");
234  }
235  $gui = new ilSurveyParticipantsGUI($this, $this->checkRbacOrPositionPermission('read_results', 'access_results'));
236  $this->ctrl->forwardCommand($gui);
237  break;
238 
239  case "illearningprogressgui":
240  $ilTabs->activateTab("learning_progress");
241  $new_gui = new ilLearningProgressGUI(
243  $this->object->getRefId()
244  );
245  $this->ctrl->forwardCommand($new_gui);
246  break;
247 
248  case 'ilexportgui':
249  $ilTabs->activateTab("export");
250  $exp_gui = new ilExportGUI($this);
251  $exp_gui->addFormat("xml");
252  $this->ctrl->forwardCommand($exp_gui);
253  break;
254 
255  default:
256  $this->addHeaderAction();
257  $cmd .= "Object";
258 
259  $this->log->debug("Default cmd= $cmd");
260 
261  $this->$cmd();
262  break;
263  }
264 
265  if (strtolower($_GET["baseClass"]) != "iladministrationgui" &&
266  $this->getCreationMode() != true) {
267  $this->tpl->printToStdout();
268 
269  //cherry pick conflict with d97cf1c77b
270  //$this->tpl->show();
271  //$this->log->debug("after tpl show");
272  }
273  }
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.
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
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 350 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.

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

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

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

◆ getUserResultsTable()

ilObjSurveyGUI::getUserResultsTable (   $a_active_id)

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

Referenced by viewUserResultsObject().

2075  {
2076  $rtpl = new ilTemplate("tpl.svy_view_user_results.html", true, true, "Modules/Survey");
2077 
2078  $show_titles = (bool) $this->object->getShowQuestionTitles();
2079 
2080  foreach ($this->object->getSurveyPages() as $page) {
2081  if (count($page) > 0) {
2082  // question block
2083  if (count($page) > 1) {
2084  if ((bool) $page[0]["questionblock_show_blocktitle"]) {
2085  $rtpl->setVariable("BLOCK_TITLE", trim($page[0]["questionblock_title"]));
2086  }
2087  }
2088 
2089  // questions
2090  foreach ($page as $question) {
2091  $question_gui = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
2092  if (is_object($question_gui)) {
2093  $rtpl->setCurrentBlock("question_bl");
2094 
2095  // heading
2096  if (strlen($question["heading"])) {
2097  $rtpl->setVariable("HEADING", trim($question["heading"]));
2098  }
2099 
2100  $rtpl->setVariable(
2101  "QUESTION_DATA",
2102  $question_gui->getPrintView(
2103  $show_titles,
2104  (bool) $question["questionblock_show_questiontext"],
2105  $this->object->getId(),
2106  $this->object->loadWorkingData($question["question_id"], $a_active_id)
2107  )
2108  );
2109 
2110  $rtpl->parseCurrentBlock();
2111  }
2112  }
2113 
2114  $rtpl->setCurrentBlock("block_bl");
2115  $rtpl->parseCurrentBlock();
2116  }
2117  }
2118 
2119  return $rtpl->get();
2120  }
+ Here is the caller graph for this function:

◆ importSurveyObject()

ilObjSurveyGUI::importSurveyObject ( )

form for new survey object import

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

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

1572  {
1573  $tpl = $this->tpl;
1574 
1575  $parent_id = $_GET["ref_id"];
1576  $new_type = $_REQUEST["new_type"];
1577 
1578  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
1579  $this->checkPermission("create", "", $new_type);
1580 
1581  $this->lng->loadLanguageModule($new_type);
1582  $this->ctrl->setParameter($this, "new_type", $new_type);
1583 
1584  $form = $this->initImportForm($new_type);
1585  if ($form->checkInput()) {
1586  $newObj = new ilObjSurvey();
1587  $newObj->setType($new_type);
1588  $newObj->setTitle("dummy");
1589  $newObj->create(true);
1590  $this->putObjectInTree($newObj);
1591 
1592  // copy uploaded file to import directory
1593 
1594  $this->log->debug("form->getInput(spl) = " . $form->getInput("spl"));
1595 
1596  $error = $newObj->importObject($_FILES["importfile"], $form->getInput("spl"));
1597  if (strlen($error)) {
1598  $newObj->delete();
1599  ilUtil::sendFailure($error);
1600  return;
1601  }
1602 
1603  ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
1604  ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
1605  "&baseClass=ilObjSurveyGUI");
1606 
1607  // using template?
1608  $templates = ilSettingsTemplate::getAllSettingsTemplates("svy");
1609  if ($templates) {
1610  $tpl = $this->tpl;
1611  $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery.js");
1612  // $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery-ui-min.js");
1613 
1614  $this->tpl->setCurrentBlock("template_option");
1615  $this->tpl->setVariable("VAL_TEMPLATE_OPTION", "");
1616  $this->tpl->setVariable("TXT_TEMPLATE_OPTION", $this->lng->txt("none"));
1617  $this->tpl->parseCurrentBlock();
1618 
1619  foreach ($templates as $item) {
1620  $this->tpl->setCurrentBlock("template_option");
1621  $this->tpl->setVariable("VAL_TEMPLATE_OPTION", $item["id"]);
1622  $this->tpl->setVariable("TXT_TEMPLATE_OPTION", $item["title"]);
1623  $this->tpl->parseCurrentBlock();
1624 
1625  $desc = str_replace("\n", "", nl2br($item["description"]));
1626  $desc = str_replace("\r", "", $desc);
1627 
1628  $this->tpl->setCurrentBlock("js_data");
1629  $this->tpl->setVariable("JS_DATA_ID", $item["id"]);
1630  $this->tpl->setVariable("JS_DATA_TEXT", $desc);
1631  $this->tpl->parseCurrentBlock();
1632  }
1633 
1634  $this->tpl->setCurrentBlock("templates");
1635  $this->tpl->setVariable("TXT_TEMPLATE", $this->lng->txt("svy_settings_template"));
1636  $this->tpl->parseCurrentBlock();
1637  }
1638  }
1639 
1640  // display form to correct errors
1641  $form->setValuesByPost();
1642  $tpl->setContent($form->getHtml());
1643  }
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 1665 of file class.ilObjSurveyGUI.php.

References $_POST, $_SESSION, ilObjectGUI\$access, $ilUser, $tabs, ilObjectGUI\$toolbar, $txt, ilObjectGUI\$user, ilObjSurveyAccess\_hasEvaluationAccess(), 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().

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

References infoScreen().

1656  {
1657  $this->ctrl->setCmd("showSummary");
1658  $this->ctrl->setCmdClass("ilinfoscreengui");
1659  $this->infoScreen();
1660  }
infoScreen()
show information screen
+ Here is the call graph for this function:

◆ initImportForm()

ilObjSurveyGUI::initImportForm (   $a_new_type)
protected

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

References ilFileInputGUI\setSuffixes().

Referenced by importSurveyObject().

1543  {
1544  $form = new ilPropertyFormGUI();
1545  $form->setTarget("_top");
1546  $form->setFormAction($this->ctrl->getFormAction($this));
1547  $form->setTitle($this->lng->txt("import_svy"));
1548 
1549  $fi = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
1550  $fi->setSuffixes(array("zip"));
1551  $fi->setRequired(true);
1552  $form->addItem($fi);
1553 
1554  $svy = new ilObjSurvey();
1555  $questionspools = $svy->getAvailableQuestionpools(true, true, true);
1556 
1557  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool_short"), "spl");
1558  $pools->setOptions(array("" => $this->lng->txt("dont_use_questionpool")) + $questionspools);
1559  $pools->setRequired(false);
1560  $form->addItem($pools);
1561 
1562  $form->addCommandButton("importSurvey", $this->lng->txt("import"));
1563  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
1564 
1565  return $form;
1566  }
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 818 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().

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

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

2280  {
2281  $ilUser = $this->user;
2282 
2283  $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
2284  $active_id = $this->object->getActiveID($ilUser->getId(), $anonymous_code, 0);
2285  if ($this->object->isSurveyStarted($ilUser->getId(), $anonymous_code) !== 1 ||
2286  !$active_id) {
2287  $this->ctrl->redirect($this, "infoScreen");
2288  }
2289 
2290  $recipient = $_POST["mail"];
2291  if (!$recipient) {
2292  $recipient = $ilUser->getEmail();
2293  }
2294  if (!ilUtil::is_email($recipient)) {
2295  $this->ctrl->redirect($this, "infoScreen");
2296  }
2297 
2298  $this->sendUserResultsMail($active_id, $recipient);
2299 
2300  ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
2301  $this->ctrl->redirect($this, "infoScreen");
2302  }
$_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 1456 of file class.ilObjSurveyGUI.php.

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

Referenced by savePropertiesObject().

1457  {
1458  $ilTabs = $this->tabs;
1459  $ilHelp = $this->help;
1460 
1461  $this->checkPermission("write");
1462 
1463  $this->addSubTabs('settings');
1464  $ilTabs->activateTab("settings");
1465  $ilTabs->activateSubTab('settings');
1466 
1467  if ($this->object->get360Mode()) {
1468  $ilHelp->setScreenId("settings_360");
1469  }
1470 
1471  if (!$a_form) {
1472  $a_form = $this->initPropertiesForm();
1473  }
1474 
1475  // using template?
1476  $message = "";
1477  if ($this->object->getTemplate()) {
1478  $link = $this->ctrl->getLinkTarget($this, "confirmResetTemplate");
1479  $link = "<a href=\"" . $link . "\">" . $this->lng->txt("survey_using_template_link") . "</a>";
1480  $message = "<div style=\"margin-top:10px\">" .
1482  $this->lng->txt("survey_using_template"),
1483  ilSettingsTemplate::lookupTitle($this->object->getTemplate()),
1484  $link
1485  ), "info") . // #10651
1486  "</div>";
1487  }
1488 
1489  $this->tpl->setContent($a_form->getHTML() . $message);
1490  }
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 1527 of file class.ilObjSurveyGUI.php.

1528  {
1529  $this->object->setTemplate(null);
1530  $this->object->saveToDB();
1531 
1532  ilUtil::sendSuccess($this->lng->txt("survey_template_reset"), true);
1533  $this->ctrl->redirect($this, "properties");
1534  }

◆ savePropertiesObject()

ilObjSurveyGUI::savePropertiesObject ( )

Save the survey properties.

Save the survey properties

private

Definition at line 531 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().

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

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

2123  {
2124  $ilUser = $this->user;
2125  $tpl = $this->tpl;
2126  $ilTabs = $this->tabs;
2127 
2128  $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
2129  $active_id = $this->object->getActiveID($ilUser->getId(), $anonymous_code, 0);
2130  if ($this->object->isSurveyStarted($ilUser->getId(), $anonymous_code) !== 1 ||
2131  !$active_id) {
2132  $this->ctrl->redirect($this, "infoScreen");
2133  }
2134 
2135  $ilTabs->clearTargets();
2136  $ilTabs->setBackTarget(
2137  $this->lng->txt("btn_back"),
2138  $this->ctrl->getLinkTarget($this, "infoScreen")
2139  );
2140 
2141  $html = $this->getUserResultsTable($active_id);
2142  $tpl->setContent($html);
2143  }
$_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: