ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 isVisible ()
 
 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
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor @access public. More...
 
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...
 
 getAdminTabs (&$tabs_gui)
 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 ($in_rep=false)
 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...
 
 prepareOutput ()
 prepare output 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 ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="")
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 redirectToRefId ()
 
 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 ()
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation ()
 Deprecated functions. More...
 
 setReturnLocation ()
 
 showActions ()
 
 getTitlesByRefId ()
 
 getTabs ()
 
 __showButton ()
 
 hitsperpageObject ()
 
 __initTableGUI ()
 
 __setTableGUIBasicData ()
 
 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 ()
 
 prepareOutput ()
 prepare output More...
 
 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...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 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 ($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
 

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

655 {
656 global $tree, $ilAccess;
657
658 $id = explode("_", $a_target);
659 $ref_id = $id[0];
660
661 // #13728 - used in notification mostly
662 if ($ilAccess->checkAccess("write", "", $ref_id))
663 {
664 $_GET["baseClass"] = "ilRepositoryGUI";
665 $_GET["ref_id"] = $ref_id;
666 $_GET["cmd"] = "showParticipants";
667 include("ilias.php");
668 exit;
669 }
670 else
671 {
672 // is sideblock: so show parent instead
673 $container_id = $tree->getParentId($ref_id);
674
675 // #11810
676 include_once "Services/Link/classes/class.ilLink.php";
677 ilUtil::redirect(ilLink::_getLink($container_id).
678 "#poll".ilObject::_lookupObjId($id[0]));
679 }
680 }
$_GET["client_id"]
static _lookupObjId($a_id)
static redirect($a_script)
http redirect to other script
exit
Definition: login.php:54

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

640 {
641 global $ilLocator;
642
643 if (is_object($this->object))
644 {
645 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
646 }
647 }

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

495 {
496 global $lng, $tpl, $ilTabs;
497
498 if(!$this->checkPermissionBool("write"))
499 {
500 ilUtil::sendInfo($lng->txt("no_permission"));
501 return;
502 }
503
504 $ilTabs->activateTab("participants");
505
506 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
507 $cgui = new ilConfirmationGUI();
508 $cgui->setHeaderText($lng->txt("poll_delete_votes_sure"));
509
510 $cgui->setFormAction($this->ctrl->getFormAction($this));
511 $cgui->setCancel($lng->txt("cancel"), "showParticipants");
512 $cgui->setConfirm($lng->txt("confirm"), "deleteAllVotes");
513
514 $tpl->setContent($cgui->getHTML());
515 }
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 517 of file class.ilObjPollGUI.php.

518 {
519 global $ilCtrl, $lng;
520
521 if(!$this->checkPermissionBool("write"))
522 {
523 ilUtil::sendInfo($lng->txt("no_permission"));
524 return;
525 }
526
527 $this->object->deleteAllVotes();
528
529 $ilCtrl->redirect($this, "showParticipants");
530 }

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

236 {
237 global $ilCtrl, $tpl, $ilTabs, $ilNavigationHistory;
238
239 $next_class = $ilCtrl->getNextClass($this);
240 $cmd = $ilCtrl->getCmd();
241
242 $tpl->getStandardTemplate();
243
244 // add entry to navigation history
245 if(!$this->getCreationMode() &&
246 $this->getAccessHandler()->checkAccess("read", "", $this->node_id))
247 {
248 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset");
249 $ilNavigationHistory->addItem($this->node_id, $link, "poll");
250 }
251
252 switch($next_class)
253 {
254 case "ilinfoscreengui":
255 $this->prepareOutput();
256 $this->infoScreenForward();
257 break;
258
259 case "ilcommonactiondispatchergui":
260 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
262 $this->ctrl->forwardCommand($gui);
263 break;
264
265 case "ilpermissiongui":
266 $this->prepareOutput();
267 $ilTabs->activateTab("id_permissions");
268 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
269 $perm_gui = new ilPermissionGUI($this);
270 $this->ctrl->forwardCommand($perm_gui);
271 break;
272
273 case "ilobjectcopygui":
274 include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
275 $cp = new ilObjectCopyGUI($this);
276 $cp->setType("poll");
277 $this->ctrl->forwardCommand($cp);
278 break;
279
280 case 'ilexportgui':
281 $this->prepareOutput();
282 $ilTabs->activateTab("export");
283 include_once("./Services/Export/classes/class.ilExportGUI.php");
284 $exp_gui = new ilExportGUI($this);
285 $exp_gui->addFormat("xml");
286 $ilCtrl->forwardCommand($exp_gui);
287 break;
288
289 default:
290 return parent::executeCommand();
291 }
292
293 return true;
294 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
getAccessHandler()
Get access handler.
prepareOutput()
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 141 of file class.ilObjPollGUI.php.

142 {
143 include_once "Services/Object/classes/class.ilObjectActivation.php";
144
145 $a_values["online"] = $this->object->IsOnline();
146 $a_values["results"] = $this->object->getViewResults();
147 $a_values["access_type"] = ($this->object->getAccessType() == ilObjectActivation::TIMINGS_ACTIVATION);
148 $a_values["period"] = $this->object->getVotingPeriod();
149 $a_values["sort"] = $this->object->getSortResultByVotes();
150 $a_values["comment"] = $this->object->getShowComments();
151 $a_values["show_results_as"] = $this->object->getShowResultsAs();
152 }

References ilObjectActivation\TIMINGS_ACTIVATION.

◆ getHTML()

ilObjPollGUI::getHTML ( )

return user view

Returns
string

Reimplemented from ilObject2GUI.

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

635 {
636
637 }

◆ 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 $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'),'access_type');
68 // $act_type->setInfo($this->lng->txt('poll_availability_until_info'));
69
70 $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
71 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
72 $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
73 $dur->setShowTime(true);
74 $date = $this->object->getAccessBegin();
75 $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
76 $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
77 $date = $this->object->getAccessEnd();
78 $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
79 $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
80 $act_type->addSubItem($dur);
81
82 $a_form->addItem($act_type);
83
84
85 // period/results
86
88 $section->setTitle($this->lng->txt('poll_voting_period_and_results'));
89 $a_form->addItem($section);
90
91 $prd = new ilCheckboxInputGUI($this->lng->txt('poll_voting_period_limited'),'period');
92
93 $vdur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "voting_period");
94 $vdur->setShowTime(true);
95 $date = $this->object->getVotingPeriodBegin();
96 $vdur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
97 $vdur->setStartText($this->lng->txt('poll_voting_period_start'));
98 $date = $this->object->getVotingPeriodEnd();
99 $vdur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
100 $vdur->setEndText($this->lng->txt('poll_voting_period_end'));
101 $prd->addSubItem($vdur);
102
103 $a_form->addItem($prd);
104
105 $results = new ilRadioGroupInputGUI($lng->txt("poll_view_results"), "results");
106 $results->setRequired(true);
107 $results->addOption(new ilRadioOption($lng->txt("poll_view_results_always"),
109 $results->addOption(new ilRadioOption($lng->txt("poll_view_results_never"),
111 $results->addOption(new ilRadioOption($lng->txt("poll_view_results_after_vote"),
113 $results->addOption(new ilRadioOption($lng->txt("poll_view_results_after_period"),
115 $a_form->addItem($results);
116
117 $show_result_as = new ilRadioGroupInputGUI($lng->txt("poll_show_results_as"), "show_results_as");
118 $show_result_as->setRequired(true);
119 $result_bar = new ilRadioOption($lng->txt("poll_barchart"),
121 $show_result_as->addOption($result_bar);
122 $show_result_as->addOption(new ilRadioOption($lng->txt("poll_piechart"),
124 $a_form->addItem($show_result_as);
125
126 $sort = new ilRadioGroupInputGUI($lng->txt("poll_result_sorting"), "sort");
127 $sort->setRequired(true);
128 $sort->addOption(new ilRadioOption($lng->txt("poll_result_sorting_answers"), 0));
129 $sort->addOption(new ilRadioOption($lng->txt("poll_result_sorting_votes"), 1));
130 $a_form->addItem($sort);
131
133 $section->setTitle($this->lng->txt('poll_comments'));
134 $a_form->addItem($section);
135
136 $comment = new ilCheckboxInputGUI($this->lng->txt('poll_comments'), 'comment');
137 //$comment->setInfo($this->lng->txt('poll_comments_info'));
138 $a_form->addItem($comment);
139 }
$section
Definition: Utf8Test.php:84
$comment
Definition: buildRTE.php:83
const IL_CAL_UNIX
This class represents a checkbox property in a property form.
input GUI for a time span (start and end date)
@classDescription Date and time handling
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(), IL_CAL_UNIX, 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 332 of file class.ilObjPollGUI.php.

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

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

304 {
305 global $tpl, $ilTabs, $ilCtrl, $lng, $ilToolbar, $ilUser;
306
307 if(!$this->checkPermissionBool("write"))
308 {
309 ilUtil::sendInfo($lng->txt("no_permission"));
310 return;
311 }
312
313 $ilTabs->activateTab("content");
314
315 if(!$a_form)
316 {
317 if($this->object->countVotes())
318 {
319 $url = $ilCtrl->getLinkTarget($this, "showParticipants");
320 ilUtil::sendInfo($lng->txt("poll_votes_no_edit").
321 " <a href=\"".$url."\">&raquo;".$lng->txt("poll_result")."</a>");
322 }
323
324 $a_form = $this->initQuestionForm($this->object->countVotes());
325 }
326
327 $tpl->setPermanentLink('poll', $this->node_id);
328
329 $tpl->setContent($a_form->getHTML());
330 }
initQuestionForm($a_read_only=false)
$url
Definition: shib_logout.php:72
global $ilUser
Definition: imgupload.php:15

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

407 {
408 $form = $this->initQuestionForm();
409 if($form->checkInput())
410 {
411 $this->object->setQuestion($form->getInput("question"));
412 $this->object->setNonAnonymous($form->getInput("mode"));
413
414 $image = $form->getItemByPostVar("image");
415 if($_FILES["image"]["tmp_name"])
416 {
417 $this->object->uploadImage($_FILES["image"]);
418 }
419 else if($image->getDeletionFlag())
420 {
421 $this->object->deleteImage();
422 }
423
424 $nr_of_anwers = $this->object->saveAnswers($form->getInput("answers"));
425
426 // #15073
427 $this->object->setMaxNumberOfAnswers(min($form->getInput("nanswers"), $nr_of_anwers));
428
429 if($this->object->update())
430 {
431 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
432 $this->ctrl->redirect($this, "render");
433 }
434 }
435
436 $form->setValuesByPost();
437 $this->render($form);
438 }
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 596 of file class.ilObjPollGUI.php.

597 {
598 global $ilUser;
599
600 // recipients
601 include_once "./Services/Notification/classes/class.ilNotification.php";
603 $this->object->getId(), null, true);
604 if(!sizeof($users))
605 {
606 return;
607 }
608
609 include_once "./Services/Notification/classes/class.ilSystemNotification.php";
610 $ntf = new ilSystemNotification();
611 $ntf->setLangModules(array("poll"));
612 $ntf->setRefId($this->ref_id);
613
614 if($this->object->getNonAnonymous())
615 {
616 $ntf->setChangedByUserId($ilUser->getId());
617 }
618
619 $ntf->setSubjectLangId('poll_vote_notification_subject');
620 $ntf->setIntroductionLangId('poll_vote_notification_body');
621 $ntf->setGotoLangId('poll_vote_notification_link');
622 $ntf->setReasonLangId('poll_vote_notification_reason');
623
624 $notified = $ntf->sendMail($users, null, "read");
625
626 ilNotification::updateNotificationTime(ilNotification::TYPE_POLL, $this->object->getId(), $notified);
627 }
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 440 of file class.ilObjPollGUI.php.

441 {
442 global $ilTabs, $lng, $ilCtrl;
443
444 if(!$this->object->getNonAnonymous())
445 {
446 return;
447 }
448
449 $ilTabs->addSubTab("result_answers", $lng->txt("poll_result_answers"),
450 $ilCtrl->getLinkTarget($this, "showParticipants"));
451 $ilTabs->addSubTab("result_users", $lng->txt("poll_result_users"),
452 $ilCtrl->getLinkTarget($this, "showParticipantVotes"));
453
454 $ilTabs->activateSubTab($a_active);
455 }

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

204 {
205 global $lng, $ilHelp;
206
207 $ilHelp->setScreenIdComponent("poll");
208
209 if ($this->checkPermissionBool("write"))
210 {
211 $this->tabs_gui->addTab("content",
212 $lng->txt("content"),
213 $this->ctrl->getLinkTarget($this, ""));
214 }
215
216 if ($this->checkPermissionBool("write"))
217 {
218 $this->tabs_gui->addTab("settings",
219 $lng->txt("settings"),
220 $this->ctrl->getLinkTarget($this, "edit"));
221
222 $this->tabs_gui->addTab("participants",
223 $lng->txt("poll_result"),
224 $this->ctrl->getLinkTarget($this, "showParticipants"));
225
226 $this->tabs_gui->addTab("export",
227 $lng->txt("export"),
228 $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
229 }
230
231 // will add permissions if needed
232 parent::setTabs();
233 }

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

+ Here is the call graph for this function:

◆ showParticipants()

ilObjPollGUI::showParticipants ( )

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

458 {
459 global $lng, $ilTabs, $tpl;
460
461 if(!$this->checkPermissionBool("write"))
462 {
463 ilUtil::sendInfo($lng->txt("no_permission"));
464 return;
465 }
466
467 $ilTabs->activateTab("participants");
468 $this->setParticipantsSubTabs("result_answers");
469
470 include_once "Modules/Poll/classes/class.ilPollAnswerTableGUI.php";
471 $tbl = new ilPollAnswerTableGUI($this, "showParticipants");
472 $tpl->setContent($tbl->getHTML());
473 }
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 475 of file class.ilObjPollGUI.php.

476 {
477 global $ilTabs, $lng, $tpl;
478
479 if(!$this->checkPermissionBool("write") ||
480 !$this->object->getNonAnonymous())
481 {
482 ilUtil::sendInfo($lng->txt("no_permission"));
483 return;
484 }
485
486 $ilTabs->activateTab("participants");
487 $this->setParticipantsSubTabs("result_users");
488
489 include_once "Modules/Poll/classes/class.ilPollUserTableGUI.php";
490 $tbl = new ilPollUserTableGUI($this, "showParticipantVotes");
491 $tpl->setContent($tbl->getHTML());
492 }
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 572 of file class.ilObjPollGUI.php.

573 {
574 global $ilUser, $tree, $lng;
575
576 include_once "./Services/Notification/classes/class.ilNotification.php";
577 ilNotification::setNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->object->getId(), true);
578
579 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
580 include_once "Services/Link/classes/class.ilLink.php";
581 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
582 }
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 584 of file class.ilObjPollGUI.php.

585 {
586 global $ilUser, $tree, $lng;
587
588 include_once "./Services/Notification/classes/class.ilNotification.php";
589 ilNotification::setNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->object->getId(), false);
590
591 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
592 include_once "Services/Link/classes/class.ilLink.php";
593 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
594 }

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

168 {
169 $this->object->setViewResults($a_form->getInput("results"));
170 $this->object->setOnline($a_form->getInput("online"));
171 $this->object->setSortResultByVotes($a_form->getInput("sort"));
172 $this->object->setShowComments($a_form->getInput("comment"));
173 $this->object->setShowResultsAs($a_form->getInput("show_results_as"));
174
175 include_once "Services/Object/classes/class.ilObjectActivation.php";
176 if($a_form->getInput("access_type"))
177 {
178 $this->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION);
179
180 $period = $a_form->getItemByPostVar("access_period");
181 $this->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX));
182 $this->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX));
183 }
184 else
185 {
186 $this->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
187 }
188
189 if($a_form->getInput("period"))
190 {
191 $this->object->setVotingPeriod(1);
192
193 $period = $a_form->getItemByPostVar("voting_period");
194 $this->object->setVotingPeriodBegin($period->getStart()->get(IL_CAL_UNIX));
195 $this->object->setVotingPeriodEnd($period->getEnd()->get(IL_CAL_UNIX));
196 }
197 else
198 {
199 $this->object->setVotingPeriod(0);
200 }
201 }
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 154 of file class.ilObjPollGUI.php.

155 {
156 // #14606
157 if(!$a_form->getInput("period") &&
158 $a_form->getInput("results") == ilObjPoll::VIEW_RESULTS_AFTER_PERIOD)
159 {
160 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
161 $a_form->getItemByPostVar("results")->setAlert($this->lng->txt("poll_view_results_after_period_impossible"));
162 return false;
163 }
164 return parent::validateCustom($a_form);
165 }
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 532 of file class.ilObjPollGUI.php.

533 {
534 global $tree, $ilUser;
535
536 $valid = true;
537 if($this->object->getMaxNumberOfAnswers() > 1)
538 {
539 if(sizeof($_POST["aw"]) > $this->object->getMaxNumberOfAnswers())
540 {
541 $valid = false;
542 }
543 if(!sizeof($_POST["aw"]))
544 {
545 $valid = false;
546 }
547 }
548 else
549 {
550 if((int)!$_POST["aw"])
551 {
552 $valid = false;
553 }
554 }
555
556 if($valid)
557 {
558 unset($_SESSION["last_poll_vote"][$this->object->getId()]);
559 $this->object->saveVote($ilUser->getId(), $_POST["aw"]);
560
561 $this->sendNotifications();
562 }
563 else
564 {
565 $_SESSION["last_poll_vote"][$this->object->getId()] = $_POST["aw"];
566 }
567
568 include_once "Services/Link/classes/class.ilLink.php";
569 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
570 }
$_SESSION["AccountId"]
$_POST['username']
Definition: cron.php:12
$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: