ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjPollGUI Class Reference

Class ilObjPollGUI. More...

+ Inheritance diagram for ilObjPollGUI:
+ Collaboration diagram for ilObjPollGUI:

Public Member Functions

 __construct (int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
 
 getType ()
 
 executeCommand ()
 
 render (?ilPropertyFormGUI $a_form=null)
 
 saveQuestion ()
 
 showParticipants ()
 
 showParticipantVotes ()
 
 confirmDeleteAllVotes ()
 
 deleteAllVotes ()
 
 vote ()
 
 subscribe ()
 
 unsubscribe ()
 
- Public Member Functions inherited from ilObject2GUI
 __construct (int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
 
 executeCommand ()
 execute command More...
 
 getIdType ()
 
 delete ()
 Display delete confirmation form (repository/workspace switch) More...
 
 confirmedDelete ()
 Delete objects (repository/workspace switch) More...
 
 getHTML ()
 
 withReferences ()
 Final/Private declaration of unchanged parent methods. More...
 
 setCreationMode (bool $mode=true)
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 isVisible (int $ref_id, string $type)
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 cancelDelete ()
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 CRUD. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 importFile ()
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 if true, a creation screen is displayed the current [ref_id] don't belong to the current class! The mode is determined in ilRepositoryGUI More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 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 More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _goto (string $a_target)
 
- Static Public Member Functions inherited from ilObject2GUI
static handleAfterSaveCallback (ilObject $obj, ?int $callback_ref_id)
 After creation callback. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 

Protected Member Functions

 afterSave (ilObject $new_object)
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 
 getEditFormCustomValues (array &$a_values)
 
 validateCustom (ilPropertyFormGUI $form)
 
 updateCustom (ilPropertyFormGUI $form)
 
 setTabs ()
 
 initQuestionForm (bool $a_read_only=false)
 
 setParticipantsSubTabs (string $a_active)
 
 sendNotifications ()
 
 addLocatorItems ()
 
- Protected Member Functions inherited from ilObject2GUI
 afterConstructor ()
 Do anything that should be done after constructor in here. More...
 
 assignObject ()
 create object instance as internal property (repository/workspace switch) More...
 
 getAccessHandler ()
 
 setLocator ()
 set Locator More...
 
 deleteConfirmedObjects ()
 Delete objects (workspace specific) This should probably be moved elsewhere as done with RepUtil. More...
 
 setTitleAndDescription ()
 
 omitLocator (bool $omit=true)
 
 getTargetFrame (string $cmd, string $target_frame="")
 
 setTargetFrame (string $cmd, string $target_frame)
 
 getCenterColumnHTML ()
 
 getRightColumnHTML ()
 
 checkPermission (string $perm, string $cmd="", string $type="", int $ref_id=null)
 
 showPossibleSubObjects ()
 
 redirectToRefId (int $ref_id, string $cmd="")
 
 fillCloneTemplate (?string $tpl_varname, string $type)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation (string $cmd, string $location="")
 Deprecated functions. More...
 
 setReturnLocation (string $cmd, string $location)
 
 showActions ()
 
 getTabs ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $node_id=null)
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 redrawHeaderAction ()
 Updating icons after ajax call. More...
 
 getPermanentLinkWidget (string $append=null, bool $center=false)
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 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 More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $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 ["ref_id"] value of the request More...
 
 fillCloneTemplate (?string $tpl_name, string $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...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

Protected Attributes

ilHelpGUI $help
 
ilTabsGUI $tabs
 
ilNavigationHistory $nav_history
 
Factory $ui_factory
 
Renderer $ui_renderer
 
- Protected Attributes inherited from ilObject2GUI
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ilObjectService $object_service
 
ilFavouritesManager $favourites
 
ilErrorHandling $error
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
int $request_ref_id
 
int $id_type
 
int $parent_id
 
string $type
 
string $html
 
int $object_id
 
int $node_id = null
 
array $creation_forms = array()
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Additional Inherited Members

- Data Fields inherited from ilObject2GUI
const OBJECT_ID = 0
 
const REPOSITORY_NODE_ID = 1
 
const WORKSPACE_NODE_ID = 2
 
const REPOSITORY_OBJECT_ID = 3
 
const WORKSPACE_OBJECT_ID = 4
 
const PORTFOLIO_OBJECT_ID = 5
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjPollGUI::__construct ( int  $a_id = 0,
int  $a_id_type = self::REPOSITORY_NODE_ID,
int  $a_parent_node_id = 0 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\locator(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

41  {
42  global $DIC;
43 
44  $this->lng = $DIC->language();
45  $this->ctrl = $DIC->ctrl();
46  $this->help = $DIC["ilHelp"];
47  $this->tpl = $DIC["tpl"];
48  $this->tabs = $DIC->tabs();
49  $this->nav_history = $DIC["ilNavigationHistory"];
50  $this->toolbar = $DIC->toolbar();
51  $this->user = $DIC->user();
52  $this->tree = $DIC->repositoryTree();
53  $this->locator = $DIC["ilLocator"];
54  $this->ui_factory = $DIC->ui()->factory();
55  $this->ui_renderer = $DIC->ui()->renderer();
56 
57  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
58 
59  $this->lng->loadLanguageModule("poll");
60  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjPollGUI::_goto ( string  $a_target)
static

Definition at line 591 of file class.ilObjPollGUI.php.

References $DIC, ilObjectGUI\$id, ilObjectGUI\$ref_id, ilObjectGUI\$tree, ilLink\_getLink(), ilObject\_lookupObjId(), ilTree\getParentId(), ILIAS\Repository\int(), and ilUtil\redirect().

591  : void
592  {
593  global $DIC;
594 
595  $tree = $DIC->repositoryTree();
596  $ilAccess = $DIC->access();
597  $ilCtrl = $DIC->ctrl();
598 
599  $id = explode("_", $a_target);
600  $ref_id = (int) ($id[0] ?? 0);
601 
602  // #13728 - used in notification mostly
603  if ($ilAccess->checkAccess("write", "", $ref_id)) {
604  $ilCtrl->setParameterByClass(self::class, "ref_id", $ref_id);
605  $ilCtrl->redirectByClass([ilRepositoryGUI::class, self::class,], "showParticipants");
606  } else {
607  // is sideblock: so show parent instead
608  $container_id = $tree->getParentId($ref_id);
609 
610  // #11810
611  ilUtil::redirect(ilLink::_getLink($container_id) .
612  "#poll" . ilObject::_lookupObjId($ref_id));
613  }
614  }
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
getParentId(int $a_node_id)
get parent id of given node
static redirect(string $a_script)
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjPollGUI::addLocatorItems ( )
protected

Definition at line 584 of file class.ilObjPollGUI.php.

References ilObject2GUI\$node_id, ILIAS\Repository\ctrl(), ILIAS\Repository\locator(), and ILIAS\Repository\object().

584  : void
585  {
586  if (is_object($this->object)) {
587  $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
588  }
589  }
+ Here is the call graph for this function:

◆ afterSave()

ilObjPollGUI::afterSave ( ilObject  $new_object)
protected

Definition at line 67 of file class.ilObjPollGUI.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

67  : void
68  {
69  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
70  $this->ctrl->redirect($this, "render");
71  }
+ Here is the call graph for this function:

◆ confirmDeleteAllVotes()

ilObjPollGUI::confirmDeleteAllVotes ( )

Definition at line 478 of file class.ilObjPollGUI.php.

References ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

478  : void
479  {
480  if (!$this->checkPermissionBool("write")) {
481  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"));
482  return;
483  }
484 
485  $this->tabs->activateTab("participants");
486 
487  $cgui = new ilConfirmationGUI();
488  $cgui->setHeaderText($this->lng->txt("poll_delete_votes_sure"));
489 
490  $cgui->setFormAction($this->ctrl->getFormAction($this));
491  $cgui->setCancel($this->lng->txt("cancel"), "showParticipants");
492  $cgui->setConfirm($this->lng->txt("confirm"), "deleteAllVotes");
493 
494  $this->tpl->setContent($cgui->getHTML());
495  }
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ deleteAllVotes()

ilObjPollGUI::deleteAllVotes ( )

Definition at line 497 of file class.ilObjPollGUI.php.

References ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

497  : void
498  {
499  if (!$this->checkPermissionBool("write")) {
500  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"));
501  return;
502  }
503 
504  $this->object->deleteAllVotes();
505 
506  $this->ctrl->redirect($this, "showParticipants");
507  }
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
+ Here is the call graph for this function:

◆ executeCommand()

ilObjPollGUI::executeCommand ( )

Definition at line 254 of file class.ilObjPollGUI.php.

References ILIAS\Repository\ctrl(), ilObject2GUI\getAccessHandler(), ilObject2GUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ilObject2GUI\prepareOutput(), and ILIAS\Repository\tabs().

254  : void
255  {
256  $next_class = $this->ctrl->getNextClass($this);
257  $cmd = $this->ctrl->getCmd();
258 
259  $this->tpl->loadStandardTemplate();
260 
261  // add entry to navigation history
262  if (!$this->getCreationMode() &&
263  $this->getAccessHandler()->checkAccess("read", "", $this->node_id)) {
264  $link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", "frameset");
265  $this->nav_history->addItem($this->node_id, $link, "poll");
266  }
267 
268  switch ($next_class) {
269  case "ilcommonactiondispatchergui":
271  $this->ctrl->forwardCommand($gui);
272  break;
273 
274  case "ilpermissiongui":
275  $this->prepareOutput();
276  $this->tabs->activateTab("id_permissions");
277  $perm_gui = new ilPermissionGUI($this);
278  $this->ctrl->forwardCommand($perm_gui);
279  break;
280 
281  case "ilobjectcopygui":
282  $cp = new ilObjectCopyGUI($this);
283  $cp->setType("poll");
284  $this->ctrl->forwardCommand($cp);
285  break;
286 
287  case 'ilexportgui':
288  $this->prepareOutput();
289  $this->tabs->activateTab("export");
290  $exp_gui = new ilExportGUI($this);
291  $exp_gui->addFormat("xml");
292  $this->ctrl->forwardCommand($exp_gui);
293  break;
294 
295  default:
296  parent::executeCommand();
297  }
298  }
GUI class for the workflow of copying objects.
prepareOutput(bool $show_sub_objects=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ getEditFormCustomValues()

ilObjPollGUI::getEditFormCustomValues ( array &  $a_values)
protected

Definition at line 156 of file class.ilObjPollGUI.php.

References IL_CAL_UNIX, and ILIAS\Repository\object().

156  : void
157  {
158  $a_values["online"] = !$this->object->getOfflineStatus();
159  $a_values["results"] = $this->object->getViewResults();
160  $a_values["access_period"]["start"] = $this->object->getAccessBegin()
161  ? new ilDateTime($this->object->getAccessBegin(), IL_CAL_UNIX)
162  : null;
163  $a_values["access_period"]["end"] = $this->object->getAccessEnd()
164  ? new ilDateTime($this->object->getAccessEnd(), IL_CAL_UNIX)
165  : null;
166  $a_values["voting_period"]["start"] = $this->object->getVotingPeriodBegin()
167  ? new ilDateTime($this->object->getVotingPeriodBegin(), IL_CAL_UNIX)
168  : null;
169  $a_values["voting_period"]["end"] = $this->object->getVotingPeriodEnd()
170  ? new ilDateTime($this->object->getVotingPeriodEnd(), IL_CAL_UNIX)
171  : null;
172  $a_values["sort"] = (string) (int) $this->object->getSortResultByVotes();
173  $a_values["comment"] = $this->object->getShowComments();
174  $a_values["show_results_as"] = $this->object->getShowResultsAs();
175  }
const IL_CAL_UNIX
+ Here is the call graph for this function:

◆ getType()

ilObjPollGUI::getType ( )

Definition at line 62 of file class.ilObjPollGUI.php.

62  : string
63  {
64  return "poll";
65  }

◆ initEditCustomForm()

ilObjPollGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

Definition at line 73 of file class.ilObjPollGUI.php.

References $comment, $results, ilObject\_getAllReferences(), ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilDateDurationInputGUI\setShowTime(), ilObjPoll\SHOW_RESULTS_AS_BARCHART, ilObjPoll\SHOW_RESULTS_AS_PIECHART, ilObjPoll\VIEW_RESULTS_AFTER_PERIOD, ilObjPoll\VIEW_RESULTS_AFTER_VOTE, ilObjPoll\VIEW_RESULTS_ALWAYS, and ilObjPoll\VIEW_RESULTS_NEVER.

73  : void
74  {
75  // activation
76  $this->lng->loadLanguageModule('rep');
77 
78  $section = new ilFormSectionHeaderGUI();
79  $section->setTitle($this->lng->txt('rep_activation_availability'));
80  $a_form->addItem($section);
81 
82  // additional info only with multiple references
83  $act_obj_info = $act_ref_info = "";
84  if (count(ilObject::_getAllReferences($this->object->getId())) > 1) {
85  $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
86  $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
87  }
88 
89  $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
90  $online->setInfo($this->lng->txt('poll_activation_online_info') . $act_obj_info);
91  $a_form->addItem($online);
92 
93  $dur = new ilDateDurationInputGUI($this->lng->txt('rep_visibility_until'), "access_period");
94  $dur->setShowTime(true);
95  $a_form->addItem($dur);
96 
97 
98  // period/results
99 
100  $section = new ilFormSectionHeaderGUI();
101  $section->setTitle($this->lng->txt('poll_voting_period_and_results'));
102  $a_form->addItem($section);
103 
104  $vdur = new ilDateDurationInputGUI($this->lng->txt('poll_voting_period_limited'), "voting_period");
105  $vdur->setShowTime(true);
106  $a_form->addItem($vdur);
107 
108  $results = new ilRadioGroupInputGUI($this->lng->txt("poll_view_results"), "results");
109  $results->setRequired(true);
110  $results->addOption(new ilRadioOption(
111  $this->lng->txt("poll_view_results_always"),
113  ));
114  $results->addOption(new ilRadioOption(
115  $this->lng->txt("poll_view_results_never"),
117  ));
118  $results->addOption(new ilRadioOption(
119  $this->lng->txt("poll_view_results_after_vote"),
121  ));
122  $results->addOption(new ilRadioOption(
123  $this->lng->txt("poll_view_results_after_period"),
125  ));
126  $a_form->addItem($results);
127 
128  $show_result_as = new ilRadioGroupInputGUI($this->lng->txt("poll_show_results_as"), "show_results_as");
129  $show_result_as->setRequired(true);
130  $result_bar = new ilRadioOption(
131  $this->lng->txt("poll_barchart"),
133  );
134  $show_result_as->addOption($result_bar);
135  $show_result_as->addOption(new ilRadioOption(
136  $this->lng->txt("poll_piechart"),
138  ));
139  $a_form->addItem($show_result_as);
140 
141  $sort = new ilRadioGroupInputGUI($this->lng->txt("poll_result_sorting"), "sort");
142  $sort->setRequired(true);
143  $sort->addOption(new ilRadioOption($this->lng->txt("poll_result_sorting_answers"), "0"));
144  $sort->addOption(new ilRadioOption($this->lng->txt("poll_result_sorting_votes"), "1"));
145  $a_form->addItem($sort);
146 
147  $section = new ilFormSectionHeaderGUI();
148  $section->setTitle($this->lng->txt('poll_comments'));
149  $a_form->addItem($section);
150 
151  $comment = new ilCheckboxInputGUI($this->lng->txt('poll_comments'), 'comment');
152  //$comment->setInfo($this->lng->txt('poll_comments_info'));
153  $a_form->addItem($comment);
154  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const VIEW_RESULTS_AFTER_PERIOD
const VIEW_RESULTS_AFTER_VOTE
const VIEW_RESULTS_NEVER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const VIEW_RESULTS_ALWAYS
static _getAllReferences(int $id)
get all reference ids for object ID
const SHOW_RESULTS_AS_PIECHART
This class represents a checkbox property in a property form.
const SHOW_RESULTS_AS_BARCHART
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
$results
setRequired(bool $a_required)
$comment
Definition: buildRTE.php:72
+ Here is the call graph for this function:

◆ initQuestionForm()

ilObjPollGUI::initQuestionForm ( bool  $a_read_only = false)
protected

Definition at line 331 of file class.ilObjPollGUI.php.

References $img, ILIAS\Repository\ctrl(), ilObjPoll\getImageSize(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilRadioOption\setInfo(), ilFormPropertyGUI\setRequired(), and ilWACSignedPath\signFile().

Referenced by render(), and saveQuestion().

332  {
333  $form = new ilPropertyFormGUI();
334  $form->setFormAction($this->ctrl->getFormAction($this, "saveQuestion"));
335  $form->setTitle($this->lng->txt("obj_poll"));
336 
337  $question = new ilTextAreaInputGUI($this->lng->txt("poll_question"), "question");
338  $question->setRequired(true);
339  $question->setCols(40);
340  $question->setRows(2);
341  $question->setValue($this->object->getQuestion());
342  $question->setDisabled($a_read_only);
343  $form->addItem($question);
344 
345  $dimensions = " (" . ilObjPoll::getImageSize() . "px)";
346  $img = new ilImageFileInputGUI($this->lng->txt("poll_image") . $dimensions, "image");
347  $img->setDisabled($a_read_only);
348  $form->addItem($img);
349 
350  // show existing file
351  $file = $this->object->getImageFullPath(true);
352  if ($file) {
353  $img->setImage(ilWACSignedPath::signFile($file));
354  }
355 
356  $anonymous = new ilRadioGroupInputGUI($this->lng->txt("poll_mode"), "mode");
357  $anonymous->setRequired(true);
358  $option = new ilRadioOption($this->lng->txt("poll_mode_anonymous"), "0");
359  $option->setInfo($this->lng->txt("poll_mode_anonymous_info"));
360  $anonymous->addOption($option);
361  $option = new ilRadioOption($this->lng->txt("poll_mode_personal"), "1");
362  $option->setInfo($this->lng->txt("poll_mode_personal_info"));
363  $anonymous->addOption($option);
364  $anonymous->setValue($this->object->getNonAnonymous() ? "1" : "0");
365  $anonymous->setDisabled($a_read_only);
366  $form->addItem($anonymous);
367 
368  $nanswers = new ilNumberInputGUI($this->lng->txt("poll_max_number_of_answers"), "nanswers");
369  $nanswers->setRequired(true);
370  $nanswers->setMinValue(1);
371  $nanswers->setSize(3);
372  $nanswers->setValue((string) $this->object->getMaxNumberOfAnswers());
373  $nanswers->setDisabled($a_read_only);
374  $form->addItem($nanswers);
375 
376  $answers = new ilTextInputGUI($this->lng->txt("poll_answers"), "answers");
377  $answers->setRequired(true);
378  $answers->setMulti(true, true);
379  $answers->setDisabled($a_read_only);
380  $form->addItem($answers);
381 
382  $multi_answers = array();
383  foreach ($this->object->getAnswers() as $idx => $item) {
384  $answer = (string) ($item['answer'] ?? '');
385  if (!$idx) {
386  $answers->setValue($answer);
387  }
388  $multi_answers[] = $answer;
389  }
390  $answers->setMultiValues($multi_answers);
391 
392  if (!$a_read_only) {
393  $form->addCommandButton("saveQuestion", $this->lng->txt("save"));
394  }
395 
396  return $form;
397  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInfo(string $a_info)
This class represents a property in a property form.
This class represents a number property in a property form.
static getImageSize()
setRequired(bool $a_required)
$img
Definition: imgupload.php:83
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
static signFile(string $path_to_file)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilObjPollGUI::render ( ?ilPropertyFormGUI  $a_form = null)

Definition at line 300 of file class.ilObjPollGUI.php.

References $message, $url, ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), initQuestionForm(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\tabs().

Referenced by saveQuestion().

300  : void
301  {
302  if (!$this->checkPermissionBool("write")) {
303  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"));
304  return;
305  }
306 
307  $this->tabs->activateTab("content");
308 
309  $message = "";
310  if (!$a_form) {
311  if ($this->object->countVotes()) {
312  $url = $this->ctrl->getLinkTarget($this, "showParticipants");
313 
314  $mbox = $this->ui_factory->messageBox()->info($this->lng->txt("poll_votes_no_edit"))
315  ->withLinks([$this->ui_factory->link()->standard(
316  $this->lng->txt("poll_result"),
317  $url
318  )]);
319 
320  $message = $this->ui_renderer->render($mbox);
321  }
322 
323  $a_form = $this->initQuestionForm((bool) $this->object->countVotes());
324  }
325 
326  $this->tpl->setPermanentLink('poll', $this->node_id);
327 
328  $this->tpl->setContent($message . $a_form->getHTML());
329  }
initQuestionForm(bool $a_read_only=false)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
$message
Definition: xapiexit.php:32
$url
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveQuestion()

ilObjPollGUI::saveQuestion ( )

Definition at line 399 of file class.ilObjPollGUI.php.

References $res, ILIAS\Repository\ctrl(), initQuestionForm(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and render().

399  : void
400  {
401  $form = $this->initQuestionForm();
402  if ($form->checkInput()) {
403  $this->object->setQuestion((string) $form->getInput("question"));
404  $this->object->setNonAnonymous((bool) $form->getInput("mode"));
405 
406  $image = $form->getItemByPostVar("image");
407  $res = $form->getFileUpload("image");
408  if (!empty($res)) {
409  $this->object->uploadImage($res);
410  } elseif ($image->getDeletionFlag()) {
411  $this->object->deleteImage();
412  }
413 
414  $nr_of_anwers = $this->object->saveAnswers((array) $form->getInput("answers"));
415 
416  // #15073
417  $this->object->setMaxNumberOfAnswers(min((int) $form->getInput("nanswers"), $nr_of_anwers));
418 
419  if ($this->object->update()) {
420  $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
421  $this->ctrl->redirect($this, "render");
422  }
423  }
424 
425  $form->setValuesByPost();
426  $this->render($form);
427  }
$res
Definition: ltiservices.php:69
initQuestionForm(bool $a_read_only=false)
render(?ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ sendNotifications()

ilObjPollGUI::sendNotifications ( )
protected

Definition at line 557 of file class.ilObjPollGUI.php.

References ilNotification\getNotificationsForObject(), ILIAS\Repository\object(), ilNotification\TYPE_POLL, and ilNotification\updateNotificationTime().

Referenced by vote().

557  : void
558  {
559  // recipients
562  $this->object->getId(),
563  null,
564  true
565  );
566  if (!count($users)) {
567  return;
568  }
569 
570  $ntf = new ilSystemNotification();
571  $ntf->setLangModules(array("poll"));
572  $ntf->setRefId($this->ref_id);
573 
574  $ntf->setSubjectLangId('poll_vote_notification_subject');
575  $ntf->setIntroductionLangId('poll_vote_notification_body');
576  $ntf->setGotoLangId('poll_vote_notification_link');
577  $ntf->setReasonLangId('poll_vote_notification_reason');
578 
579  $notified = $ntf->sendMailAndReturnRecipients($users, null, "read");
580 
582  }
static getNotificationsForObject(int $type, int $id, ?int $page_id=null, bool $ignore_threshold=false)
Get all users/recipients for given object.
static updateNotificationTime(int $type, int $id, array $user_ids, ?int $page_id=null, bool $activate_new_entries=true)
Update the last mail timestamp for given object and users.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParticipantsSubTabs()

ilObjPollGUI::setParticipantsSubTabs ( string  $a_active)
protected

Definition at line 429 of file class.ilObjPollGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\tabs().

Referenced by showParticipants(), and showParticipantVotes().

429  : void
430  {
431  if (!$this->object->getNonAnonymous()) {
432  return;
433  }
434 
435  $this->tabs->addSubTab(
436  "result_answers",
437  $this->lng->txt("poll_result_answers"),
438  $this->ctrl->getLinkTarget($this, "showParticipants")
439  );
440  $this->tabs->addSubTab(
441  "result_users",
442  $this->lng->txt("poll_result_users"),
443  $this->ctrl->getLinkTarget($this, "showParticipantVotes")
444  );
445 
446  $this->tabs->activateSubTab($a_active);
447  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTabs()

ilObjPollGUI::setTabs ( )
protected

Definition at line 218 of file class.ilObjPollGUI.php.

References ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), and ILIAS\Repository\lng().

218  : void
219  {
220  $this->help->setScreenIdComponent("poll");
221 
222  if ($this->checkPermissionBool("write")) {
223  $this->tabs_gui->addTab(
224  "content",
225  $this->lng->txt("content"),
226  $this->ctrl->getLinkTarget($this, "")
227  );
228  }
229 
230  if ($this->checkPermissionBool("write")) {
231  $this->tabs_gui->addTab(
232  "settings",
233  $this->lng->txt("settings"),
234  $this->ctrl->getLinkTarget($this, "edit")
235  );
236 
237  $this->tabs_gui->addTab(
238  "participants",
239  $this->lng->txt("poll_result"),
240  $this->ctrl->getLinkTarget($this, "showParticipants")
241  );
242 
243  $this->tabs_gui->addTab(
244  "export",
245  $this->lng->txt("export"),
246  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
247  );
248  }
249 
250  // will add permissions if needed
251  parent::setTabs();
252  }
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
+ Here is the call graph for this function:

◆ showParticipants()

ilObjPollGUI::showParticipants ( )

Definition at line 449 of file class.ilObjPollGUI.php.

References ilObject2GUI\checkPermissionBool(), ILIAS\Repository\lng(), setParticipantsSubTabs(), and ILIAS\Repository\tabs().

449  : void
450  {
451  if (!$this->checkPermissionBool("write")) {
452  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"));
453  return;
454  }
455 
456  $this->tabs->activateTab("participants");
457  $this->setParticipantsSubTabs("result_answers");
458 
459  $tbl = new ilPollAnswerTableGUI($this, "showParticipants");
460  $this->tpl->setContent($tbl->getHTML());
461  }
setParticipantsSubTabs(string $a_active)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
+ Here is the call graph for this function:

◆ showParticipantVotes()

ilObjPollGUI::showParticipantVotes ( )

Definition at line 463 of file class.ilObjPollGUI.php.

References ilObject2GUI\checkPermissionBool(), ILIAS\Repository\lng(), ILIAS\Repository\object(), setParticipantsSubTabs(), and ILIAS\Repository\tabs().

463  : void
464  {
465  if (!$this->checkPermissionBool("write") ||
466  !$this->object->getNonAnonymous()) {
467  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"));
468  return;
469  }
470 
471  $this->tabs->activateTab("participants");
472  $this->setParticipantsSubTabs("result_users");
473 
474  $tbl = new ilPollUserTableGUI($this, "showParticipantVotes");
475  $this->tpl->setContent($tbl->getHTML());
476  }
setParticipantsSubTabs(string $a_active)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
TableGUI class for poll users.
+ Here is the call graph for this function:

◆ subscribe()

ilObjPollGUI::subscribe ( )

Definition at line 541 of file class.ilObjPollGUI.php.

References ilLink\_getLink(), ILIAS\Repository\lng(), ilUtil\redirect(), ilNotification\setNotification(), ilNotification\TYPE_POLL, and ILIAS\Repository\user().

541  : void
542  {
543  ilNotification::setNotification(ilNotification::TYPE_POLL, $this->user->getId(), $this->object->getId(), true);
544 
545  $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
546  ilUtil::redirect(ilLink::_getLink($this->tree->getParentId($this->ref_id)));
547  }
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
static redirect(string $a_script)
+ Here is the call graph for this function:

◆ unsubscribe()

ilObjPollGUI::unsubscribe ( )

Definition at line 549 of file class.ilObjPollGUI.php.

References ilLink\_getLink(), ILIAS\Repository\lng(), ilUtil\redirect(), ilNotification\setNotification(), ilNotification\TYPE_POLL, and ILIAS\Repository\user().

549  : void
550  {
551  ilNotification::setNotification(ilNotification::TYPE_POLL, $this->user->getId(), $this->object->getId(), false);
552 
553  $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
554  ilUtil::redirect(ilLink::_getLink($this->tree->getParentId($this->ref_id)));
555  }
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
static redirect(string $a_script)
+ Here is the call graph for this function:

◆ updateCustom()

ilObjPollGUI::updateCustom ( ilPropertyFormGUI  $form)
protected

Definition at line 189 of file class.ilObjPollGUI.php.

References ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), IL_CAL_UNIX, ilObjectActivation\TIMINGS_ACTIVATION, and ilObjectActivation\TIMINGS_DEACTIVATED.

189  : void
190  {
191  $this->object->setViewResults((int) $form->getInput("results"));
192  $this->object->setOfflineStatus(!((string) $form->getInput("online") === "1"));
193  $this->object->setSortResultByVotes((bool) $form->getInput("sort"));
194  $this->object->setShowComments((bool) $form->getInput("comment"));
195  $this->object->setShowResultsAs((int) $form->getInput("show_results_as"));
196 
197  $period = $form->getItemByPostVar("access_period");
198  if ($period->getStart() && $period->getEnd()) {
199  $this->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION);
200  $this->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX));
201  $this->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX));
202  } else {
203  $this->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
204  }
205 
206  $period = $form->getItemByPostVar("voting_period");
207  if ($period->getStart() && $period->getEnd()) {
208  $this->object->setVotingPeriod(true);
209  $this->object->setVotingPeriodBegin($period->getStart()->get(IL_CAL_UNIX));
210  $this->object->setVotingPeriodEnd($period->getEnd()->get(IL_CAL_UNIX));
211  } else {
212  $this->object->setVotingPeriodBegin(0);
213  $this->object->setVotingPeriodEnd(0);
214  $this->object->setVotingPeriod(false);
215  }
216  }
getItemByPostVar(string $a_post_var)
const IL_CAL_UNIX
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
+ Here is the call graph for this function:

◆ validateCustom()

ilObjPollGUI::validateCustom ( ilPropertyFormGUI  $form)
protected

Definition at line 177 of file class.ilObjPollGUI.php.

References ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ilObjPoll\VIEW_RESULTS_AFTER_PERIOD.

177  : bool
178  {
179  #20594
180  if (!$form->getInput("voting_period") &&
181  (int) $form->getInput("results") === ilObjPoll::VIEW_RESULTS_AFTER_PERIOD) {
182  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("form_input_not_valid"));
183  $form->getItemByPostVar("results")->setAlert($this->lng->txt("poll_view_results_after_period_impossible"));
184  return false;
185  }
186  return parent::validateCustom($form);
187  }
const VIEW_RESULTS_AFTER_PERIOD
getItemByPostVar(string $a_post_var)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
+ Here is the call graph for this function:

◆ vote()

ilObjPollGUI::vote ( )

Definition at line 509 of file class.ilObjPollGUI.php.

References $DIC, $valid, ilLink\_getLink(), ANONYMOUS_USER_ID, ilSession\get(), ILIAS\Repository\object(), ilUtil\redirect(), sendNotifications(), ilSession\set(), and ILIAS\Repository\user().

509  : void
510  {
511  global $DIC;
512  $aw = (array) ($DIC->http()->request()->getParsedBody()['aw'] ?? array());
513 
514  $valid = true;
515  if ($this->object->getMaxNumberOfAnswers() > 1) {
516  if (count($aw) > $this->object->getMaxNumberOfAnswers()) {
517  $valid = false;
518  }
519  if (!count($aw)) {
520  $valid = false;
521  }
522  } elseif ((int) !$aw) {
523  $valid = false;
524  }
525 
526  $session_last_poll_vote = ilSession::get('last_poll_vote');
527  if ($valid && $this->user->getId() != ANONYMOUS_USER_ID) {
528  unset($session_last_poll_vote[$this->object->getId()]);
529  ilSession::set('last_poll_vote', $session_last_poll_vote);
530  $this->object->saveVote($this->user->getId(), $aw);
531 
532  $this->sendNotifications();
533  } else {
534  $session_last_poll_vote[$this->object->getId()] = $aw;
535  ilSession::set('last_poll_vote', $session_last_poll_vote);
536  }
537 
538  ilUtil::redirect(ilLink::_getLink($this->tree->getParentId($this->ref_id)));
539  }
static get(string $a_var)
const ANONYMOUS_USER_ID
Definition: constants.php:27
$valid
global $DIC
Definition: feed.php:28
static redirect(string $a_script)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

Field Documentation

◆ $help

ilHelpGUI ilObjPollGUI::$help
protected

Definition at line 34 of file class.ilObjPollGUI.php.

◆ $nav_history

ilNavigationHistory ilObjPollGUI::$nav_history
protected

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

◆ $tabs

ilTabsGUI ilObjPollGUI::$tabs
protected

Definition at line 35 of file class.ilObjPollGUI.php.

◆ $ui_factory

Factory ilObjPollGUI::$ui_factory
protected

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

◆ $ui_renderer

Renderer ilObjPollGUI::$ui_renderer
protected

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


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