ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 ()
 Functions that must be overwritten. More...
 
 executeCommand ()
 execute command More...
 
 render (?ilPropertyFormGUI $a_form=null)
 
 saveQuestion ()
 
 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)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 isVisible (int $ref_id, string $type)
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 CRUD. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
- Public Member Functions inherited from ilObjectGUI
 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] does belong to the parent 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 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)
 
 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)
 Post (successful) object creation hook. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 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...
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 initQuestionForm (bool $a_read_only=false)
 
 setParticipantsSubTabs (string $a_active)
 
 sendNotifications ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
- 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="")
 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...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) 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...
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation (string $cmd, string $location="")
 Deprecated functions. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 showActions ()
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 addLocatorItems ()
 Functions to be overwritten. 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...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 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...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 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...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 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 ()
 @abstract 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...
 
 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...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

ilHelpGUI $help
 
ilTabsGUI $tabs
 
ilNavigationHistory $nav_history
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
DataFactory $data_factory
 
HTTPServices $http_services
 
PollImageFactoryInterface $poll_image_factory
 
- Protected Attributes inherited from ilObject2GUI
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ilFavouritesManager $favourites
 
ilErrorHandling $error
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
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 = []
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
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
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
CustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
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 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
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

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 
)

Reimplemented from ilObject2GUI.

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

53 {
54 global $DIC;
55
56 $this->lng = $DIC->language();
57 $this->ctrl = $DIC->ctrl();
58 $this->help = $DIC["ilHelp"];
59 $this->tpl = $DIC["tpl"];
60 $this->tabs = $DIC->tabs();
61 $this->nav_history = $DIC["ilNavigationHistory"];
62 $this->toolbar = $DIC->toolbar();
63 $this->user = $DIC->user();
64 $this->tree = $DIC->repositoryTree();
65 $this->locator = $DIC["ilLocator"];
66 $this->ui_factory = $DIC->ui()->factory();
67 $this->ui_renderer = $DIC->ui()->renderer();
68 $this->http_services = $DIC->http();
69 $this->poll_image_factory = new PollImageFactory();
70 $this->data_factory = new DataFactory();
71
72 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
73
74 $this->lng->loadLanguageModule("poll");
75 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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().

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjPollGUI::_goto ( string  $a_target)
static

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

677 : void
678 {
679 global $DIC;
680
681 $tree = $DIC->repositoryTree();
682 $ilAccess = $DIC->access();
683 $ilCtrl = $DIC->ctrl();
684
685 $id = explode("_", $a_target);
686 $ref_id = (int) ($id[0] ?? 0);
687
688 // #13728 - used in notification mostly
689 if ($ilAccess->checkAccess("write", "", $ref_id)) {
690 $ilCtrl->setParameterByClass(self::class, "ref_id", $ref_id);
691 $ilCtrl->redirectByClass([ilRepositoryGUI::class, self::class,], "showParticipants");
692 } else {
693 // is sideblock: so show parent instead
694 $container_id = $tree->getParentId($ref_id);
695
696 // #11810
697 ilUtil::redirect(ilLink::_getLink($container_id) .
699 }
700 }
static _lookupObjId(int $ref_id)
getParentId(int $a_node_id)
get parent id of given node
static redirect(string $a_script)

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

+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjPollGUI::addLocatorItems ( )
protected

Functions to be overwritten.

Reimplemented from ilObject2GUI.

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

670 : void
671 {
672 if (is_object($this->object)) {
673 $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
674 }
675 }

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

+ Here is the call graph for this function:

◆ afterSave()

ilObjPollGUI::afterSave ( ilObject  $new_object)
protected

Post (successful) object creation hook.

Reimplemented from ilObjectGUI.

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

82 : void
83 {
84 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
85 $this->ctrl->redirect($this, "render");
86 }

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

+ Here is the call graph for this function:

◆ confirmDeleteAllVotes()

ilObjPollGUI::confirmDeleteAllVotes ( )

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

564 : void
565 {
566 if (!$this->checkPermissionBool("write")) {
567 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"));
568 return;
569 }
570
571 $this->tabs->activateTab("participants");
572
573 $cgui = new ilConfirmationGUI();
574 $cgui->setHeaderText($this->lng->txt("poll_delete_votes_sure"));
575
576 $cgui->setFormAction($this->ctrl->getFormAction($this));
577 $cgui->setCancel($this->lng->txt("cancel"), "showParticipants");
578 $cgui->setConfirm($this->lng->txt("confirm"), "deleteAllVotes");
579
580 $this->tpl->setContent($cgui->getHTML());
581 }
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)

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

+ Here is the call graph for this function:

◆ deleteAllVotes()

ilObjPollGUI::deleteAllVotes ( )

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

583 : void
584 {
585 if (!$this->checkPermissionBool("write")) {
586 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"));
587 return;
588 }
589
590 $this->object->deleteAllVotes();
591
592 $this->ctrl->redirect($this, "showParticipants");
593 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilObjPollGUI::executeCommand ( )

execute command

Reimplemented from ilObject2GUI.

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

274 : void
275 {
276 $next_class = $this->ctrl->getNextClass($this);
277 $cmd = $this->ctrl->getCmd();
278
279 $this->tpl->loadStandardTemplate();
280
281 // add entry to navigation history
282 if (!$this->getCreationMode() &&
283 $this->getAccessHandler()->checkAccess("read", "", $this->node_id)) {
284 $link = $this->ctrl->getLinkTargetByClass("ilrepositorygui");
285 $this->nav_history->addItem($this->node_id, $link, "poll");
286 }
287
288 switch ($next_class) {
289 case "ilcommonactiondispatchergui":
291 $this->ctrl->forwardCommand($gui);
292 break;
293
294 case "ilpermissiongui":
295 $this->prepareOutput();
296 $this->tabs->activateTab("id_permissions");
297 $perm_gui = new ilPermissionGUI($this);
298 $this->ctrl->forwardCommand($perm_gui);
299 break;
300
301 case "ilobjectcopygui":
302 $cp = new ilObjectCopyGUI($this);
303 $cp->setType("poll");
304 $this->ctrl->forwardCommand($cp);
305 break;
306
307 case 'ilexportgui':
308 $this->prepareOutput();
309 $this->tabs->activateTab("export");
310 $exp_gui = new ilExportGUI($this);
311 $this->ctrl->forwardCommand($exp_gui);
312 break;
313
314 default:
315 parent::executeCommand();
316 }
317 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
prepareOutput(bool $show_sub_objects=true)
GUI class for the workflow of copying objects.

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

+ Here is the call graph for this function:

◆ getEditFormCustomValues()

ilObjPollGUI::getEditFormCustomValues ( array &  $a_values)
protected

Add values to custom edit fields.

Reimplemented from ilObjectGUI.

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

168 : void
169 {
170 $a_values["online"] = !$this->object->getOfflineStatus();
171 $a_values["results"] = $this->object->getViewResults();
172 $a_values["access_period"]["start"] = $this->object->getAccessBegin()
173 ? new ilDateTime($this->object->getAccessBegin(), IL_CAL_UNIX)
174 : null;
175 $a_values["access_period"]["end"] = $this->object->getAccessEnd()
176 ? new ilDateTime($this->object->getAccessEnd(), IL_CAL_UNIX)
177 : null;
178 $a_values["voting_period"]["start"] = $this->object->getVotingPeriodBegin()
179 ? new ilDateTime($this->object->getVotingPeriodBegin(), IL_CAL_UNIX)
180 : null;
181 $a_values["voting_period"]["end"] = $this->object->getVotingPeriodEnd()
182 ? new ilDateTime($this->object->getVotingPeriodEnd(), IL_CAL_UNIX)
183 : null;
184 $a_values["sort"] = (string) (int) $this->object->getSortResultByVotes();
185 $a_values["comment"] = $this->object->getShowComments();
186 $a_values["show_results_as"] = $this->object->getShowResultsAs();
187 }
const IL_CAL_UNIX
@classDescription Date and time handling

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

+ Here is the call graph for this function:

◆ getType()

ilObjPollGUI::getType ( )

Functions that must be overwritten.

Reimplemented from ilObject2GUI.

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

77 : string
78 {
79 return "poll";
80 }

◆ initEditCustomForm()

ilObjPollGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

Add custom fields to update form.

Reimplemented from ilObjectGUI.

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

88 : void
89 {
90 // activation
91 $this->lng->loadLanguageModule('rep');
92
93 $section = new ilFormSectionHeaderGUI();
94 $section->setTitle($this->lng->txt('rep_activation_availability'));
95 $a_form->addItem($section);
96
97 // additional info only with multiple references
98 $act_obj_info = $act_ref_info = "";
99 if (count(ilObject::_getAllReferences($this->object->getId())) > 1) {
100 $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
101 $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
102 }
103
104 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
105 $online->setInfo($this->lng->txt('poll_activation_online_info') . $act_obj_info);
106 $a_form->addItem($online);
107
108 $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_based_availability'), "access_period");
109 $dur->setShowTime(true);
110 $a_form->addItem($dur);
111
112
113 // period/results
114
115 $section = new ilFormSectionHeaderGUI();
116 $section->setTitle($this->lng->txt('poll_voting_period_and_results'));
117 $a_form->addItem($section);
118
119 $vdur = new ilDateDurationInputGUI($this->lng->txt('poll_voting_period_limited'), "voting_period");
120 $vdur->setShowTime(true);
121 $a_form->addItem($vdur);
122
123 $results = new ilRadioGroupInputGUI($this->lng->txt("poll_view_results"), "results");
124 $results->addOption(new ilRadioOption(
125 $this->lng->txt("poll_view_results_always"),
127 ));
128 $results->addOption(new ilRadioOption(
129 $this->lng->txt("poll_view_results_never"),
131 ));
132 $results->addOption(new ilRadioOption(
133 $this->lng->txt("poll_view_results_after_vote"),
135 ));
136 $results->addOption(new ilRadioOption(
137 $this->lng->txt("poll_view_results_after_period"),
139 ));
140 $a_form->addItem($results);
141
142 $show_result_as = new ilRadioGroupInputGUI($this->lng->txt("poll_show_results_as"), "show_results_as");
143 $result_bar = new ilRadioOption(
144 $this->lng->txt("poll_barchart"),
146 );
147 $show_result_as->addOption($result_bar);
148 $show_result_as->addOption(new ilRadioOption(
149 $this->lng->txt("poll_stacked_chart"),
151 ));
152 $a_form->addItem($show_result_as);
153
154 $sort = new ilRadioGroupInputGUI($this->lng->txt("poll_result_sorting"), "sort");
155 $sort->addOption(new ilRadioOption($this->lng->txt("poll_result_sorting_answers"), "0"));
156 $sort->addOption(new ilRadioOption($this->lng->txt("poll_result_sorting_votes"), "1"));
157 $a_form->addItem($sort);
158
159 $section = new ilFormSectionHeaderGUI();
160 $section->setTitle($this->lng->txt('poll_comments'));
161 $a_form->addItem($section);
162
163 $comment = new ilCheckboxInputGUI($this->lng->txt('poll_comments'), 'comment');
164 //$comment->setInfo($this->lng->txt('poll_comments_info'));
165 $a_form->addItem($comment);
166 }
$comment
Definition: buildRTE.php:72
This class represents a checkbox property in a property form.
input GUI for a time span (start and end date)
This class represents a section header in a property form.
const int VIEW_RESULTS_AFTER_VOTE
const int VIEW_RESULTS_ALWAYS
const int SHOW_RESULTS_AS_STACKED_CHART
const int VIEW_RESULTS_NEVER
const int VIEW_RESULTS_AFTER_PERIOD
const int SHOW_RESULTS_AS_BARCHART
static _getAllReferences(int $id)
get all reference ids for object ID
This class represents a property in a property form.
This class represents an option in a radio group.
$results

References $comment, $results, ilObject\_getAllReferences(), ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilObjPoll\SHOW_RESULTS_AS_BARCHART, ilObjPoll\SHOW_RESULTS_AS_STACKED_CHART, ilObjPoll\VIEW_RESULTS_AFTER_PERIOD, ilObjPoll\VIEW_RESULTS_AFTER_VOTE, ilObjPoll\VIEW_RESULTS_ALWAYS, and ilObjPoll\VIEW_RESULTS_NEVER.

+ Here is the call graph for this function:

◆ initQuestionForm()

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

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

351 {
352 $form = new ilPropertyFormGUI();
353 $form->setFormAction($this->ctrl->getFormAction($this, "saveQuestion"));
354 $form->setTitle($this->lng->txt("obj_poll"));
355
356 $question = new ilTextAreaInputGUI($this->lng->txt("poll_question"), "question");
357 $question->setRequired(true);
358 $question->setCols(40);
359 $question->setRows(2);
360 $question->setValue($this->object->getQuestion());
361 $question->setDisabled($a_read_only);
362 $form->addItem($question);
363
364 $dimensions = " (" . ilObjPoll::getImageSize() . "px)";
365 $img = new ilImageFileInputGUI($this->lng->txt("poll_image") . $dimensions, "image");
366 $img->setDisabled($a_read_only);
367 $form->addItem($img);
368
369 // show existing file
370 $url = $this->poll_image_factory->handler()->getThumbnailImageURL($this->data_factory->objId($this->object_id));
371 if (!is_null($url)) {
372 $img->setImage($url);
373 }
374
375 $anonymous = new ilRadioGroupInputGUI($this->lng->txt("poll_mode"), "mode");
376 $option = new ilRadioOption($this->lng->txt("poll_mode_anonymous"), "0");
377 $option->setInfo($this->lng->txt("poll_mode_anonymous_info"));
378 $anonymous->addOption($option);
379 $option = new ilRadioOption($this->lng->txt("poll_mode_personal"), "1");
380 $option->setInfo($this->lng->txt("poll_mode_personal_info"));
381 $anonymous->addOption($option);
382 $anonymous->setValue($this->object->getNonAnonymous() ? "1" : "0");
383 $anonymous->setDisabled($a_read_only);
384 $form->addItem($anonymous);
385
386 $answers = new ilTextInputGUI($this->lng->txt("poll_answers"), "answers");
387 $answers->setRequired(true);
388 $answers->setMulti(true, true);
389 $answers->setDisabled($a_read_only);
390 $form->addItem($answers);
391
392 $multi_answers = array();
393 foreach ($this->object->getAnswers() as $idx => $item) {
394 $answer = (string) ($item['answer'] ?? '');
395 if (!$idx) {
396 $answers->setValue($answer);
397 }
398 $multi_answers[] = $answer;
399 }
400 $answers->setMultiValues($multi_answers);
401
402 $answer_count = count($this->object->getAnswers());
403 $limit = new ilCheckboxInputGUI($this->lng->txt("poll_limit_number_of_answers"), 'limit');
404 $limit->setChecked($this->object->getMaxNumberOfAnswers() !== $answer_count);
405 $limit->setDisabled($a_read_only);
406 $nanswers = new ilNumberInputGUI($this->lng->txt("poll_max_number_of_answers"), "nanswers");
407 $nanswers->setRequired(true);
408 $nanswers->setMinValue(1);
409 $nanswers->setSize(3);
410 $max_answers = 1;
411 if ($this->object->getMaxNumberOfAnswers() < $answer_count) {
412 $max_answers = $this->object->getMaxNumberOfAnswers();
413 }
414 $nanswers->setValue((string) $max_answers);
415 $nanswers->setDisabled($a_read_only);
416 $limit->addSubItem($nanswers);
417 $form->addItem($limit);
418
419 if (!$a_read_only) {
420 $form->addCommandButton("saveQuestion", $this->lng->txt("save"));
421 }
422
423 return $form;
424 }
This class represents an image file property in a property form.
This class represents a number property in a property form.
static getImageSize()
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

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

Referenced by render(), and saveQuestion().

+ 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 319 of file class.ilObjPollGUI.php.

319 : void
320 {
321 if (!$this->checkPermissionBool("write")) {
322 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"));
323 return;
324 }
325
326 $this->tabs->activateTab("question");
327
328 $message = "";
329 if (!$a_form) {
330 if ($this->object->countVotes()) {
331 $url = $this->ctrl->getLinkTarget($this, "showParticipants");
332
333 $mbox = $this->ui_factory->messageBox()->info($this->lng->txt("poll_votes_no_edit"))
334 ->withLinks([$this->ui_factory->link()->standard(
335 $this->lng->txt("poll_result"),
336 $url
337 )]);
338
339 $message = $this->ui_renderer->render($mbox);
340 }
341
342 $a_form = $this->initQuestionForm((bool) $this->object->countVotes());
343 }
344
345 $this->tpl->setPermanentLink('poll', $this->node_id);
346
347 $this->tpl->setContent($message . $a_form->getHTML());
348 }
initQuestionForm(bool $a_read_only=false)

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

Referenced by saveQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveQuestion()

ilObjPollGUI::saveQuestion ( )

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

427 : void
428 {
429 $form = $this->initQuestionForm();
430 if ($form->checkInput()) {
431 $prelim_nr_of_answers = count((array) $form->getInput("answers"));
432
433 if (
434 $form->getInput("limit") &&
435 (int) $form->getInput("nanswers") >= $prelim_nr_of_answers
436 ) {
437 $form->getItemByPostVar('nanswers')->setAlert(
438 $this->lng->txt('poll_limit_not_below_answer_count')
439 );
440 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
441 $form->setValuesByPost();
442 $this->render($form);
443 return;
444 }
445
446 $nr_of_anwers = $this->object->saveAnswers((array) $form->getInput("answers"));
447
448 if ($form->getInput("limit")) {
449 // #15073
450 $this->object->setMaxNumberOfAnswers(min((int) $form->getInput("nanswers"), $nr_of_anwers));
451 } else {
452 $this->object->setMaxNumberOfAnswers($nr_of_anwers);
453 }
454
455 $this->object->setQuestion((string) $form->getInput("question"));
456 $this->object->setNonAnonymous((bool) $form->getInput("mode"));
457
458 $image = $form->getItemByPostVar("image");
459 $res = $form->getFileUpload("image");
460 if (!empty($res)) {
461 $this->object->uploadImage(
462 (string) ($res['tmp_name'] ?? ""),
463 (string) ($res['name'] ?? "")
464 );
465 } elseif ($image->getDeletionFlag()) {
466 $this->poll_image_factory->handler()->deleteImage(
467 $this->data_factory->objId($this->object->getId()),
468 $this->user->getId()
469 );
470 }
471
472 if ($this->object->update()) {
473 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
474 $this->ctrl->redirect($this, "render");
475 }
476 }
477
478 $form->setValuesByPost();
479 $this->render($form);
480 }
render(?ilPropertyFormGUI $a_form=null)
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

◆ sendNotifications()

ilObjPollGUI::sendNotifications ( )
protected

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

643 : void
644 {
645 // recipients
648 $this->object->getId(),
649 null,
650 true
651 );
652 if (!count($users)) {
653 return;
654 }
655
656 $ntf = new ilSystemNotification();
657 $ntf->setLangModules(array("poll"));
658 $ntf->setRefId($this->ref_id);
659
660 $ntf->setSubjectLangId('poll_vote_notification_subject');
661 $ntf->setIntroductionLangId('poll_vote_notification_body');
662 $ntf->setGotoLangId('poll_vote_notification_link');
663 $ntf->setReasonLangId('poll_vote_notification_reason');
664
665 $notified = $ntf->sendMailAndReturnRecipients($users, null, "read");
666
668 }
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.
static getNotificationsForObject(int $type, int $id, ?int $page_id=null, bool $ignore_threshold=false)
Get all users/recipients for given object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

Referenced by vote().

+ 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 482 of file class.ilObjPollGUI.php.

482 : void
483 {
484 if (!$this->object->getNonAnonymous()) {
485 return;
486 }
487
488 $this->tabs->addSubTab(
489 "result_answers",
490 $this->lng->txt("poll_result_answers"),
491 $this->ctrl->getLinkTarget($this, "showParticipants")
492 );
493 $this->tabs->addSubTab(
494 "result_users",
495 $this->lng->txt("poll_result_users"),
496 $this->ctrl->getLinkTarget($this, "showParticipantVotes")
497 );
498
499 $this->tabs->activateSubTab($a_active);
500 }

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

+ Here is the call graph for this function:

◆ setTabs()

ilObjPollGUI::setTabs ( )
protected

create tabs (repository/workspace switch)

this had to be moved here because of the context-specific permission tab

Reimplemented from ilObject2GUI.

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

238 : void
239 {
240 $this->help->setScreenIdComponent("poll");
241
242 if ($this->checkPermissionBool("write")) {
243 $this->tabs_gui->addTab(
244 "question",
245 $this->lng->txt("question"),
246 $this->ctrl->getLinkTarget($this, "")
247 );
248 }
249
250 if ($this->checkPermissionBool("write")) {
251 $this->tabs_gui->addTab(
252 "settings",
253 $this->lng->txt("settings"),
254 $this->ctrl->getLinkTarget($this, "edit")
255 );
256
257 $this->tabs_gui->addTab(
258 "participants",
259 $this->lng->txt("poll_result"),
260 $this->ctrl->getLinkTarget($this, "showParticipants")
261 );
262
263 $this->tabs_gui->addTab(
264 "export",
265 $this->lng->txt("export"),
266 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
267 );
268 }
269
270 // will add permissions if needed
271 parent::setTabs();
272 }

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

+ Here is the call graph for this function:

◆ subscribe()

ilObjPollGUI::subscribe ( )

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

627 : void
628 {
629 ilNotification::setNotification(ilNotification::TYPE_POLL, $this->user->getId(), $this->object->getId(), true);
630
631 $this->tpl->setOnScreenMessage('success', $this->lng->txt("poll_notification_activated"), true);
632 ilUtil::redirect(ilLink::_getLink($this->tree->getParentId($this->ref_id)));
633 }
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.

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

+ Here is the call graph for this function:

◆ unsubscribe()

ilObjPollGUI::unsubscribe ( )

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

635 : void
636 {
637 ilNotification::setNotification(ilNotification::TYPE_POLL, $this->user->getId(), $this->object->getId(), false);
638
639 $this->tpl->setOnScreenMessage('success', $this->lng->txt("poll_notification_deactivated"), true);
640 ilUtil::redirect(ilLink::_getLink($this->tree->getParentId($this->ref_id)));
641 }

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

+ Here is the call graph for this function:

◆ updateCustom()

ilObjPollGUI::updateCustom ( ilPropertyFormGUI  $form)
protected

Insert custom update form values into object.

Reimplemented from ilObjectGUI.

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

209 : void
210 {
211 $this->object->setViewResults((int) $form->getInput("results"));
212 $this->object->setOfflineStatus(!((string) $form->getInput("online") === "1"));
213 $this->object->setSortResultByVotes((bool) $form->getInput("sort"));
214 $this->object->setShowComments((bool) $form->getInput("comment"));
215 $this->object->setShowResultsAs((int) $form->getInput("show_results_as"));
216
217 $period = $form->getItemByPostVar("access_period");
218 if ($period->getStart() && $period->getEnd()) {
219 $this->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION);
220 $this->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX));
221 $this->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX));
222 } else {
223 $this->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
224 }
225
226 $period = $form->getItemByPostVar("voting_period");
227 if ($period->getStart() && $period->getEnd()) {
228 $this->object->setVotingPeriod(true);
229 $this->object->setVotingPeriodBegin($period->getStart()->get(IL_CAL_UNIX));
230 $this->object->setVotingPeriodEnd($period->getEnd()->get(IL_CAL_UNIX));
231 } else {
232 $this->object->setVotingPeriodBegin(0);
233 $this->object->setVotingPeriodEnd(0);
234 $this->object->setVotingPeriod(false);
235 }
236 }
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-...
getItemByPostVar(string $a_post_var)

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

+ Here is the call graph for this function:

◆ validateCustom()

ilObjPollGUI::validateCustom ( ilPropertyFormGUI  $form)
protected

Validate custom values (if not possible with checkInput())

Reimplemented from ilObjectGUI.

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

189 : bool
190 {
191 $valid = true;
192 if ($form->getInput("online") && !$this->object->getAnswers()) {
193 $form->getItemByPostVar("online")->setAlert($this->lng->txt("poll_cannot_set_online_no_answers"));
194 $valid = false;
195 }
196 #20594
197 if (!array_filter($form->getInput("voting_period")) &&
198 (int) $form->getInput("results") === ilObjPoll::VIEW_RESULTS_AFTER_PERIOD) {
199 $form->getItemByPostVar("results")->setAlert($this->lng->txt("poll_view_results_after_period_impossible"));
200 $valid = false;
201 }
202 if (!$valid) {
203 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("form_input_not_valid"));
204 return false;
205 }
206 return parent::validateCustom($form);
207 }

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

+ Here is the call graph for this function:

◆ vote()

ilObjPollGUI::vote ( )

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

595 : void
596 {
597 global $DIC;
598 $aw = (array) ($DIC->http()->request()->getParsedBody()['aw'] ?? array());
599
600 $valid = true;
601 if ($this->object->getMaxNumberOfAnswers() > 1) {
602 if (count($aw) > $this->object->getMaxNumberOfAnswers()) {
603 $valid = false;
604 }
605 if (!count($aw)) {
606 $valid = false;
607 }
608 } elseif ((int) !$aw) {
609 $valid = false;
610 }
611
612 $session_last_poll_vote = ilSession::get('last_poll_vote');
613 if ($valid && $this->user->getId() != ANONYMOUS_USER_ID) {
614 unset($session_last_poll_vote[$this->object->getId()]);
615 ilSession::set('last_poll_vote', $session_last_poll_vote);
616 $this->object->saveVote($this->user->getId(), $aw);
617
618 $this->sendNotifications();
619 } else {
620 $session_last_poll_vote[$this->object->getId()] = $aw;
621 ilSession::set('last_poll_vote', $session_last_poll_vote);
622 }
623
624 ilUtil::redirect(ilLink::_getLink($this->tree->getParentId($this->ref_id)));
625 }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
const ANONYMOUS_USER_ID
Definition: constants.php:27

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

+ Here is the call graph for this function:

Field Documentation

◆ $data_factory

DataFactory ilObjPollGUI::$data_factory
protected

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

◆ $help

ilHelpGUI ilObjPollGUI::$help
protected

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

◆ $http_services

HTTPServices ilObjPollGUI::$http_services
protected

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

◆ $nav_history

ilNavigationHistory ilObjPollGUI::$nav_history
protected

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

◆ $poll_image_factory

PollImageFactoryInterface ilObjPollGUI::$poll_image_factory
protected

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

◆ $tabs

ilTabsGUI ilObjPollGUI::$tabs
protected

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

◆ $ui_factory

UIFactory ilObjPollGUI::$ui_factory
protected

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

◆ $ui_renderer

UIRenderer ilObjPollGUI::$ui_renderer
protected

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


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