ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjPollGUI Class Reference

Class ilObjPollGUI. More...

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

Public Member Functions

 __construct ($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
 Constructor. More...
 
 getType ()
 Functions that must be overwritten. More...
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 executeCommand ()
 execute command More...
 
 render ($a_form=null)
 Render object context. More...
 
 saveQuestion ()
 
 showParticipants ()
 
 showParticipantVotes ()
 
 confirmDeleteAllVotes ()
 
 deleteAllVotes ()
 
 vote ()
 
 subscribe ()
 
 unsubscribe ()
 
 getHTML ()
 return user view More...
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
- Public Member Functions inherited from ilObject2GUI
 __construct ($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
 Constructor. More...
 
 executeCommand ()
 execute command More...
 
 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 ($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...
 
 isVisible ($a_ref_id, $a_type)
 
 trash ()
 
 undelete ()
 
 cancelDelete ()
 
 removeFromSystem ()
 
 cloneAll ()
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 Deleted in ilObject. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 importFile ()
 Import. More...
 
- 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 @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object 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 ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Static Public Member Functions

static _goto ($a_target)
 Deep link. More...
 
- Static Public Member Functions inherited from ilObject2GUI
static handleAfterSaveCallback (ilObject $a_obj, $a_callback_ref_id)
 After creation callback. 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

 afterSave (ilObject $a_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 $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 initQuestionForm ($a_read_only=false)
 
 setParticipantsSubTabs ($a_active)
 
 sendNotifications ()
 
- 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 ()
 Get access handler. More...
 
 setLocator ()
 set Locator More...
 
 deleteConfirmation ()
 Display delete confirmation form (workspace specific) More...
 
 deleteConfirmedObjects ()
 Delete objects (workspace specific) More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 showUpperIcon ()
 
 omitLocator ($a_omit=true)
 
 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...
 
 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...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) 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...
 
 fillCloneSearchTemplate ($a_tpl_varname, $a_type)
 
 searchCloneSource ()
 
 buildCloneSelect ($existing_objs)
 
 addAdminLocatorItems ($a_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 ($a_cmd, $a_location="")
 Deprecated functions. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 showActions ()
 
 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...
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
 Check permission. More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 redrawHeaderAction ()
 Updating icons after ajax call. More...
 
 getPermanentLinkWidget ($a_append=null, $a_center=false)
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 
- Protected Member Functions inherited from ilObjectGUI
 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...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs @access public More...
 
 setAdminTabs ()
 set admin tabs @access 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...
 
 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...
 
 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...
 

Additional Inherited Members

- Data Fields inherited from ilObject2GUI
 $tree
 
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 COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $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
 
- Protected Attributes inherited from ilObject2GUI
 $object_id
 
 $node_id
 
 $creation_forms = array()
 
 $id_type = array()
 
 $parent_id
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
int$a_id
int$a_id_type
int$a_parent_node_id

Reimplemented from ilObject2GUI.

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

21 {
22 global $lng;
23
24 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
25
26 $lng->loadLanguageModule("poll");
27 }

References ilObjectGUI\$lng.

Member Function Documentation

◆ _goto()

static ilObjPollGUI::_goto (   $a_target)
static

Deep link.

Parameters
string$a_target

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

644 {
645 global $tree, $ilAccess;
646
647 $id = explode("_", $a_target);
648 $ref_id = $id[0];
649
650 // #13728 - used in notification mostly
651 if ($ilAccess->checkAccess("write", "", $ref_id))
652 {
653 $_GET["baseClass"] = "ilRepositoryGUI";
654 $_GET["ref_id"] = $ref_id;
655 $_GET["cmd"] = "showParticipants";
656 include("ilias.php");
657 exit;
658 }
659 else
660 {
661 // is sideblock: so show parent instead
662 $container_id = $tree->getParentId($ref_id);
663
664 // #11810
665 include_once "Services/Link/classes/class.ilLink.php";
666 ilUtil::redirect(ilLink::_getLink($container_id).
667 "#poll".ilObject::_lookupObjId($id[0]));
668 }
669 }
$_GET["client_id"]
static _lookupObjId($a_id)
static redirect($a_script)
http redirect to other script

References $_GET, ilObjectGUI\$ref_id, ilObject2GUI\$tree, ilLink\_getLink(), ilObject\_lookupObjId(), exit, and ilUtil\redirect().

+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjPollGUI::addLocatorItems ( )

Functions to be overwritten.

Reimplemented from ilObject2GUI.

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

629 {
630 global $ilLocator;
631
632 if (is_object($this->object))
633 {
634 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
635 }
636 }

◆ afterSave()

ilObjPollGUI::afterSave ( ilObject  $a_new_object)
protected

Post (successful) object creation hook.

Parameters
ilObject$a_new_object

Reimplemented from ilObjectGUI.

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

35 {
36 global $ilCtrl;
37
38 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
39 $ilCtrl->redirect($this, "render");
40 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ confirmDeleteAllVotes()

ilObjPollGUI::confirmDeleteAllVotes ( )

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

484 {
485 global $lng, $tpl, $ilTabs;
486
487 if(!$this->checkPermissionBool("write"))
488 {
489 ilUtil::sendInfo($lng->txt("no_permission"));
490 return;
491 }
492
493 $ilTabs->activateTab("participants");
494
495 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
496 $cgui = new ilConfirmationGUI();
497 $cgui->setHeaderText($lng->txt("poll_delete_votes_sure"));
498
499 $cgui->setFormAction($this->ctrl->getFormAction($this));
500 $cgui->setCancel($lng->txt("cancel"), "showParticipants");
501 $cgui->setConfirm($lng->txt("confirm"), "deleteAllVotes");
502
503 $tpl->setContent($cgui->getHTML());
504 }
Confirmation screen class.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References ilObjectGUI\$lng, ilObjectGUI\$tpl, ilObject2GUI\checkPermissionBool(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ deleteAllVotes()

ilObjPollGUI::deleteAllVotes ( )

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

507 {
508 global $ilCtrl, $lng;
509
510 if(!$this->checkPermissionBool("write"))
511 {
512 ilUtil::sendInfo($lng->txt("no_permission"));
513 return;
514 }
515
516 $this->object->deleteAllVotes();
517
518 $ilCtrl->redirect($this, "showParticipants");
519 }

References $ilCtrl, ilObjectGUI\$lng, ilObject2GUI\checkPermissionBool(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjPollGUI::executeCommand ( )

execute command

Reimplemented from ilObject2GUI.

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

225 {
226 global $ilCtrl, $tpl, $ilTabs, $ilNavigationHistory;
227
228 $next_class = $ilCtrl->getNextClass($this);
229 $cmd = $ilCtrl->getCmd();
230
231 $tpl->getStandardTemplate();
232
233 // add entry to navigation history
234 if(!$this->getCreationMode() &&
235 $this->getAccessHandler()->checkAccess("read", "", $this->node_id))
236 {
237 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset");
238 $ilNavigationHistory->addItem($this->node_id, $link, "poll");
239 }
240
241 switch($next_class)
242 {
243 case "ilinfoscreengui":
244 $this->prepareOutput();
245 $this->infoScreenForward();
246 break;
247
248 case "ilcommonactiondispatchergui":
249 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
251 $this->ctrl->forwardCommand($gui);
252 break;
253
254 case "ilpermissiongui":
255 $this->prepareOutput();
256 $ilTabs->activateTab("id_permissions");
257 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
258 $perm_gui = new ilPermissionGUI($this);
259 $this->ctrl->forwardCommand($perm_gui);
260 break;
261
262 case "ilobjectcopygui":
263 include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
264 $cp = new ilObjectCopyGUI($this);
265 $cp->setType("poll");
266 $this->ctrl->forwardCommand($cp);
267 break;
268
269 case 'ilexportgui':
270 $this->prepareOutput();
271 $ilTabs->activateTab("export");
272 include_once("./Services/Export/classes/class.ilExportGUI.php");
273 $exp_gui = new ilExportGUI($this);
274 $exp_gui->addFormat("xml");
275 $ilCtrl->forwardCommand($exp_gui);
276 break;
277
278 default:
279 return parent::executeCommand();
280 }
281
282 return true;
283 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
getAccessHandler()
Get access handler.
prepareOutput($a_show_subobjects=true)
prepare output
getCreationMode()
get creation mode
GUI class for the workflow of copying objects.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
$cmd
Definition: sahs_server.php:35

References $cmd, $ilCtrl, ilObjectGUI\$tpl, ilObject2GUI\getAccessHandler(), ilObject2GUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), and ilObject2GUI\prepareOutput().

+ Here is the call graph for this function:

◆ getEditFormCustomValues()

ilObjPollGUI::getEditFormCustomValues ( array &  $a_values)
protected

Add values to custom edit fields.

Parameters
array$a_values

Reimplemented from ilObjectGUI.

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

120 {
121 include_once "Services/Object/classes/class.ilObjectActivation.php";
122
123 $a_values["online"] = $this->object->IsOnline();
124 $a_values["results"] = $this->object->getViewResults();
125 $a_values["access_period"]["start"] = $this->object->getAccessBegin()
126 ? new ilDateTime($this->object->getAccessBegin(), IL_CAL_UNIX)
127 : null;
128 $a_values["access_period"]["end"] = $this->object->getAccessEnd()
129 ? new ilDateTime($this->object->getAccessEnd(), IL_CAL_UNIX)
130 : null;
131 $a_values["voting_period"]["start"] = $this->object->getVotingPeriodBegin()
132 ? new ilDateTime($this->object->getVotingPeriodBegin(), IL_CAL_UNIX)
133 : null;
134 $a_values["voting_period"]["end"] = $this->object->getVotingPeriodEnd()
135 ? new ilDateTime($this->object->getVotingPeriodEnd(), IL_CAL_UNIX)
136 : null;
137 $a_values["sort"] = $this->object->getSortResultByVotes();
138 $a_values["comment"] = $this->object->getShowComments();
139 $a_values["show_results_as"] = $this->object->getShowResultsAs();
140 }
const IL_CAL_UNIX
@classDescription Date and time handling

References IL_CAL_UNIX.

◆ getHTML()

ilObjPollGUI::getHTML ( )

return user view

Returns
string

Reimplemented from ilObject2GUI.

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

624 {
625
626 }

◆ getType()

ilObjPollGUI::getType ( )

Functions that must be overwritten.

Reimplemented from ilObject2GUI.

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

30 {
31 return "poll";
32 }

◆ initEditCustomForm()

ilObjPollGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

Add custom fields to update form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

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

43 {
44 global $lng;
45
46 // activation
47
48 include_once "Services/Object/classes/class.ilObjectActivation.php";
49 $this->lng->loadLanguageModule('rep');
50
52 $section->setTitle($this->lng->txt('rep_activation_availability'));
53 $a_form->addItem($section);
54
55 // additional info only with multiple references
56 $act_obj_info = $act_ref_info = "";
57 if(sizeof(ilObject::_getAllReferences($this->object->getId())) > 1)
58 {
59 $act_obj_info = ' '.$this->lng->txt('rep_activation_online_object_info');
60 $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
61 }
62
63 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'),'online');
64 $online->setInfo($this->lng->txt('poll_activation_online_info').$act_obj_info);
65 $a_form->addItem($online);
66
67 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
68 $dur = new ilDateDurationInputGUI($this->lng->txt('rep_visibility_until'), "access_period");
69 $dur->setShowTime(true);
70 $a_form->addItem($dur);
71
72
73 // period/results
74
76 $section->setTitle($this->lng->txt('poll_voting_period_and_results'));
77 $a_form->addItem($section);
78
79 $vdur = new ilDateDurationInputGUI($this->lng->txt('poll_voting_period_limited'), "voting_period");
80 $vdur->setShowTime(true);
81 $a_form->addItem($vdur);
82
83 $results = new ilRadioGroupInputGUI($lng->txt("poll_view_results"), "results");
84 $results->setRequired(true);
85 $results->addOption(new ilRadioOption($lng->txt("poll_view_results_always"),
87 $results->addOption(new ilRadioOption($lng->txt("poll_view_results_never"),
89 $results->addOption(new ilRadioOption($lng->txt("poll_view_results_after_vote"),
91 $results->addOption(new ilRadioOption($lng->txt("poll_view_results_after_period"),
93 $a_form->addItem($results);
94
95 $show_result_as = new ilRadioGroupInputGUI($lng->txt("poll_show_results_as"), "show_results_as");
96 $show_result_as->setRequired(true);
97 $result_bar = new ilRadioOption($lng->txt("poll_barchart"),
99 $show_result_as->addOption($result_bar);
100 $show_result_as->addOption(new ilRadioOption($lng->txt("poll_piechart"),
102 $a_form->addItem($show_result_as);
103
104 $sort = new ilRadioGroupInputGUI($lng->txt("poll_result_sorting"), "sort");
105 $sort->setRequired(true);
106 $sort->addOption(new ilRadioOption($lng->txt("poll_result_sorting_answers"), 0));
107 $sort->addOption(new ilRadioOption($lng->txt("poll_result_sorting_votes"), 1));
108 $a_form->addItem($sort);
109
111 $section->setTitle($this->lng->txt('poll_comments'));
112 $a_form->addItem($section);
113
114 $comment = new ilCheckboxInputGUI($this->lng->txt('poll_comments'), 'comment');
115 //$comment->setInfo($this->lng->txt('poll_comments_info'));
116 $a_form->addItem($comment);
117 }
$section
Definition: Utf8Test.php:83
$comment
Definition: buildRTE.php:83
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 VIEW_RESULTS_ALWAYS
const SHOW_RESULTS_AS_PIECHART
const VIEW_RESULTS_AFTER_VOTE
const SHOW_RESULTS_AS_BARCHART
const VIEW_RESULTS_AFTER_PERIOD
const VIEW_RESULTS_NEVER
static _getAllReferences($a_id)
get all reference ids of object
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
This class represents an option in a radio group.
$results

References $comment, ilObjectGUI\$lng, $results, $section, ilObject\_getAllReferences(), ilPropertyFormGUI\addItem(), 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.

+ Here is the call graph for this function:

◆ initQuestionForm()

ilObjPollGUI::initQuestionForm (   $a_read_only = false)
protected

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

322 {
323 global $lng, $ilCtrl;
324
325 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
326 $form = new ilPropertyFormGUI();
327 $form->setFormAction($ilCtrl->getFormAction($this, "saveQuestion"));
328 $form->setTitle($lng->txt("obj_poll"));
329
330 $question = new ilTextAreaInputGUI($lng->txt("poll_question"), "question");
331 $question->setRequired(true);
332 $question->setCols(40);
333 $question->setRows(2);
334 $question->setValue($this->object->getQuestion());
335 $question->setDisabled($a_read_only);
336 $form->addItem($question);
337
338 $dimensions = " (".ilObjPoll::getImageSize()."px)";
339 $img = new ilImageFileInputGUI($lng->txt("poll_image").$dimensions, "image");
340 $img->setDisabled($a_read_only);
341 $form->addItem($img);
342
343 // show existing file
344 $file = $this->object->getImageFullPath(true);
345 if($file)
346 {
347 $img->setImage($file);
348 }
349
350 $anonymous = new ilRadioGroupInputGUI($lng->txt("poll_mode"), "mode");
351 $anonymous->setRequired(true);
352 $option = new ilRadioOption($lng->txt("poll_mode_anonymous"), 0);
353 $option->setInfo($lng->txt("poll_mode_anonymous_info"));
354 $anonymous->addOption($option);
355 $option = new ilRadioOption($lng->txt("poll_mode_personal"), 1);
356 $option->setInfo($lng->txt("poll_mode_personal_info"));
357 $anonymous->addOption($option);
358 $anonymous->setValue($this->object->getNonAnonymous());
359 $anonymous->setDisabled($a_read_only);
360 $form->addItem($anonymous);
361
362 $nanswers = new ilNumberInputGUI($lng->txt("poll_max_number_of_answers"), "nanswers");
363 $nanswers->setRequired(true);
364 $nanswers->setMinValue(1);
365 $nanswers->setSize(3);
366 $nanswers->setValue($this->object->getMaxNumberOfAnswers());
367 $nanswers->setDisabled($a_read_only);
368 $form->addItem($nanswers);
369
370 $answers = new ilTextInputGUI($lng->txt("poll_answers"), "answers");
371 $answers->setRequired(true);
372 $answers->setMulti(true, true);
373 $answers->setDisabled($a_read_only);
374 $form->addItem($answers);
375
376 $multi_answers = array();
377 foreach($this->object->getAnswers() as $idx => $item)
378 {
379 if(!$idx)
380 {
381 $answers->setValue($item["answer"]);
382 }
383 $multi_answers[] = $item["answer"];
384 }
385 $answers->setMultiValues($multi_answers);
386
387 if(!$a_read_only)
388 {
389 $form->addCommandButton("saveQuestion", $lng->txt("save"));
390 }
391
392 return $form;
393 }
This class represents an image file property in a property form.
This class represents a number property in a property form.
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.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $ilCtrl, $img, and ilObjectGUI\$lng.

Referenced by render(), and saveQuestion().

+ Here is the caller graph for this function:

◆ render()

ilObjPollGUI::render (   $a_form = null)

Render object context.

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

293 {
294 global $tpl, $ilTabs, $ilCtrl, $lng, $ilToolbar, $ilUser;
295
296 if(!$this->checkPermissionBool("write"))
297 {
298 ilUtil::sendInfo($lng->txt("no_permission"));
299 return;
300 }
301
302 $ilTabs->activateTab("content");
303
304 if(!$a_form)
305 {
306 if($this->object->countVotes())
307 {
308 $url = $ilCtrl->getLinkTarget($this, "showParticipants");
309 ilUtil::sendInfo($lng->txt("poll_votes_no_edit").
310 " <a href=\"".$url."\">&raquo;".$lng->txt("poll_result")."</a>");
311 }
312
313 $a_form = $this->initQuestionForm($this->object->countVotes());
314 }
315
316 $tpl->setPermanentLink('poll', $this->node_id);
317
318 $tpl->setContent($a_form->getHTML());
319 }
initQuestionForm($a_read_only=false)
$url
Definition: shib_logout.php:72
$ilUser
Definition: imgupload.php:18

References $ilCtrl, $ilUser, ilObjectGUI\$lng, ilObjectGUI\$tpl, $url, ilObject2GUI\checkPermissionBool(), initQuestionForm(), and ilUtil\sendInfo().

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

396 {
397 $form = $this->initQuestionForm();
398 if($form->checkInput())
399 {
400 $this->object->setQuestion($form->getInput("question"));
401 $this->object->setNonAnonymous($form->getInput("mode"));
402
403 $image = $form->getItemByPostVar("image");
404 if($_FILES["image"]["tmp_name"])
405 {
406 $this->object->uploadImage($_FILES["image"]);
407 }
408 else if($image->getDeletionFlag())
409 {
410 $this->object->deleteImage();
411 }
412
413 $nr_of_anwers = $this->object->saveAnswers($form->getInput("answers"));
414
415 // #15073
416 $this->object->setMaxNumberOfAnswers(min($form->getInput("nanswers"), $nr_of_anwers));
417
418 if($this->object->update())
419 {
420 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
421 $this->ctrl->redirect($this, "render");
422 }
423 }
424
425 $form->setValuesByPost();
426 $this->render($form);
427 }
render($a_form=null)
Render object context.

References initQuestionForm(), render(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ sendNotifications()

ilObjPollGUI::sendNotifications ( )
protected

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

586 {
587 global $ilUser;
588
589 // recipients
590 include_once "./Services/Notification/classes/class.ilNotification.php";
592 $this->object->getId(), null, true);
593 if(!sizeof($users))
594 {
595 return;
596 }
597
598 include_once "./Services/Notification/classes/class.ilSystemNotification.php";
599 $ntf = new ilSystemNotification();
600 $ntf->setLangModules(array("poll"));
601 $ntf->setRefId($this->ref_id);
602
603 if($this->object->getNonAnonymous())
604 {
605 $ntf->setChangedByUserId($ilUser->getId());
606 }
607
608 $ntf->setSubjectLangId('poll_vote_notification_subject');
609 $ntf->setIntroductionLangId('poll_vote_notification_body');
610 $ntf->setGotoLangId('poll_vote_notification_link');
611 $ntf->setReasonLangId('poll_vote_notification_reason');
612
613 $notified = $ntf->sendMail($users, null, "read");
614
615 ilNotification::updateNotificationTime(ilNotification::TYPE_POLL, $this->object->getId(), $notified);
616 }
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
Wrapper classes for system notifications.

References $ilUser, ilNotification\getNotificationsForObject(), 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 (   $a_active)
protected

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

430 {
431 global $ilTabs, $lng, $ilCtrl;
432
433 if(!$this->object->getNonAnonymous())
434 {
435 return;
436 }
437
438 $ilTabs->addSubTab("result_answers", $lng->txt("poll_result_answers"),
439 $ilCtrl->getLinkTarget($this, "showParticipants"));
440 $ilTabs->addSubTab("result_users", $lng->txt("poll_result_users"),
441 $ilCtrl->getLinkTarget($this, "showParticipantVotes"));
442
443 $ilTabs->activateSubTab($a_active);
444 }

References $ilCtrl, and ilObjectGUI\$lng.

Referenced by showParticipants(), and showParticipantVotes().

+ Here is the caller graph for this function:

◆ setTabs()

ilObjPollGUI::setTabs ( )

create tabs (repository/workspace switch)

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

Reimplemented from ilObject2GUI.

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

193 {
194 global $lng, $ilHelp;
195
196 $ilHelp->setScreenIdComponent("poll");
197
198 if ($this->checkPermissionBool("write"))
199 {
200 $this->tabs_gui->addTab("content",
201 $lng->txt("content"),
202 $this->ctrl->getLinkTarget($this, ""));
203 }
204
205 if ($this->checkPermissionBool("write"))
206 {
207 $this->tabs_gui->addTab("settings",
208 $lng->txt("settings"),
209 $this->ctrl->getLinkTarget($this, "edit"));
210
211 $this->tabs_gui->addTab("participants",
212 $lng->txt("poll_result"),
213 $this->ctrl->getLinkTarget($this, "showParticipants"));
214
215 $this->tabs_gui->addTab("export",
216 $lng->txt("export"),
217 $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
218 }
219
220 // will add permissions if needed
221 parent::setTabs();
222 }

References ilObjectGUI\$lng, and ilObject2GUI\checkPermissionBool().

+ Here is the call graph for this function:

◆ showParticipants()

ilObjPollGUI::showParticipants ( )

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

447 {
448 global $lng, $ilTabs, $tpl;
449
450 if(!$this->checkPermissionBool("write"))
451 {
452 ilUtil::sendInfo($lng->txt("no_permission"));
453 return;
454 }
455
456 $ilTabs->activateTab("participants");
457 $this->setParticipantsSubTabs("result_answers");
458
459 include_once "Modules/Poll/classes/class.ilPollAnswerTableGUI.php";
460 $tbl = new ilPollAnswerTableGUI($this, "showParticipants");
461 $tpl->setContent($tbl->getHTML());
462 }
setParticipantsSubTabs($a_active)
TableGUI class for poll answers.
$tbl
Definition: example_048.php:81

References ilObjectGUI\$lng, $tbl, ilObjectGUI\$tpl, ilObject2GUI\checkPermissionBool(), ilUtil\sendInfo(), and setParticipantsSubTabs().

+ Here is the call graph for this function:

◆ showParticipantVotes()

ilObjPollGUI::showParticipantVotes ( )

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

465 {
466 global $ilTabs, $lng, $tpl;
467
468 if(!$this->checkPermissionBool("write") ||
469 !$this->object->getNonAnonymous())
470 {
471 ilUtil::sendInfo($lng->txt("no_permission"));
472 return;
473 }
474
475 $ilTabs->activateTab("participants");
476 $this->setParticipantsSubTabs("result_users");
477
478 include_once "Modules/Poll/classes/class.ilPollUserTableGUI.php";
479 $tbl = new ilPollUserTableGUI($this, "showParticipantVotes");
480 $tpl->setContent($tbl->getHTML());
481 }
TableGUI class for poll users.

References ilObjectGUI\$lng, $tbl, ilObjectGUI\$tpl, ilObject2GUI\checkPermissionBool(), ilUtil\sendInfo(), and setParticipantsSubTabs().

+ Here is the call graph for this function:

◆ subscribe()

ilObjPollGUI::subscribe ( )

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

562 {
563 global $ilUser, $tree, $lng;
564
565 include_once "./Services/Notification/classes/class.ilNotification.php";
566 ilNotification::setNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->object->getId(), true);
567
568 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
569 include_once "Services/Link/classes/class.ilLink.php";
570 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
571 }
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.

References $ilUser, ilObjectGUI\$lng, ilObject2GUI\$tree, ilLink\_getLink(), ilUtil\redirect(), ilUtil\sendSuccess(), ilNotification\setNotification(), and ilNotification\TYPE_POLL.

+ Here is the call graph for this function:

◆ unsubscribe()

ilObjPollGUI::unsubscribe ( )

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

574 {
575 global $ilUser, $tree, $lng;
576
577 include_once "./Services/Notification/classes/class.ilNotification.php";
578 ilNotification::setNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->object->getId(), false);
579
580 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
581 include_once "Services/Link/classes/class.ilLink.php";
582 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
583 }

References $ilUser, ilObjectGUI\$lng, ilObject2GUI\$tree, ilLink\_getLink(), ilUtil\redirect(), ilUtil\sendSuccess(), ilNotification\setNotification(), and ilNotification\TYPE_POLL.

+ Here is the call graph for this function:

◆ updateCustom()

ilObjPollGUI::updateCustom ( ilPropertyFormGUI  $a_form)
protected

Insert custom update form values into object.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

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

156 {
157 $this->object->setViewResults($a_form->getInput("results"));
158 $this->object->setOnline($a_form->getInput("online"));
159 $this->object->setSortResultByVotes($a_form->getInput("sort"));
160 $this->object->setShowComments($a_form->getInput("comment"));
161 $this->object->setShowResultsAs($a_form->getInput("show_results_as"));
162
163 include_once "Services/Object/classes/class.ilObjectActivation.php";
164 $period = $a_form->getItemByPostVar("access_period");
165 if($period->getStart() && $period->getEnd())
166 {
167 $this->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION);
168 $this->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX));
169 $this->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX));
170 }
171 else
172 {
173 $this->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
174 }
175
176 $period = $a_form->getItemByPostVar("voting_period");
177 if($period->getStart() && $period->getEnd())
178 {
179 $this->object->setVotingPeriod(1);
180 $this->object->setVotingPeriodBegin($period->getStart()->get(IL_CAL_UNIX));
181 $this->object->setVotingPeriodEnd($period->getEnd()->get(IL_CAL_UNIX));
182 }
183 else
184 {
185 #20594
186 $this->object->setVotingPeriodBegin(null);
187 $this->object->setVotingPeriodEnd(null);
188 $this->object->setVotingPeriod(0);
189 }
190 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
getItemByPostVar($a_post_var)
Get Item by POST variable.

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  $a_form)
protected

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

Parameters
ilPropertyFormGUI$a_form
Returns
boolean

Reimplemented from ilObjectGUI.

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

143 {
144 // #14606 #20594
145 if(!$a_form->getInput("voting_period") &&
146 $a_form->getInput("results") == ilObjPoll::VIEW_RESULTS_AFTER_PERIOD)
147 {
148 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
149 $a_form->getItemByPostVar("results")->setAlert($this->lng->txt("poll_view_results_after_period_impossible"));
150 return false;
151 }
152 return parent::validateCustom($a_form);
153 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilUtil\sendFailure(), and ilObjPoll\VIEW_RESULTS_AFTER_PERIOD.

+ Here is the call graph for this function:

◆ vote()

ilObjPollGUI::vote ( )

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

522 {
523 global $tree, $ilUser;
524
525 $valid = true;
526 if($this->object->getMaxNumberOfAnswers() > 1)
527 {
528 if(sizeof($_POST["aw"]) > $this->object->getMaxNumberOfAnswers())
529 {
530 $valid = false;
531 }
532 if(!sizeof($_POST["aw"]))
533 {
534 $valid = false;
535 }
536 }
537 else
538 {
539 if((int)!$_POST["aw"])
540 {
541 $valid = false;
542 }
543 }
544
545 if($valid)
546 {
547 unset($_SESSION["last_poll_vote"][$this->object->getId()]);
548 $this->object->saveVote($ilUser->getId(), $_POST["aw"]);
549
550 $this->sendNotifications();
551 }
552 else
553 {
554 $_SESSION["last_poll_vote"][$this->object->getId()] = $_POST["aw"];
555 }
556
557 include_once "Services/Link/classes/class.ilLink.php";
558 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
559 }
$_POST["username"]
$_SESSION["AccountId"]
$valid

References $_POST, $_SESSION, $ilUser, ilObject2GUI\$tree, $valid, ilLink\_getLink(), ilUtil\redirect(), and sendNotifications().

+ Here is the call graph for this function:

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