ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. 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...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 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...
 
 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)
 
- 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...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Protected Attributes

 $help
 
 $tabs
 
 $nav_history
 
- Protected Attributes inherited from ilObject2GUI
 $object_id
 
 $node_id
 
 $creation_forms = array()
 
 $id_type = array()
 
 $parent_id
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $rbacsystem
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 

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
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

36 {
37 global $DIC;
38
39 $this->lng = $DIC->language();
40 $this->ctrl = $DIC->ctrl();
41 $this->help = $DIC["ilHelp"];
42 $this->tpl = $DIC["tpl"];
43 $this->tabs = $DIC->tabs();
44 $this->nav_history = $DIC["ilNavigationHistory"];
45 $this->toolbar = $DIC->toolbar();
46 $this->user = $DIC->user();
47 $this->tree = $DIC->repositoryTree();
48 $this->locator = $DIC["ilLocator"];
49 $lng = $DIC->language();
50
51 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
52
53 $lng->loadLanguageModule("poll");
54 }
user()
Definition: user.php:4
global $DIC
Definition: saml.php:7

References $DIC, ilObjectGUI\$lng, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjPollGUI::_goto (   $a_target)
static

Deep link.

Parameters
string$a_target

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

682 {
683 global $DIC;
684
685 $tree = $DIC->repositoryTree();
686 $ilAccess = $DIC->access();
687
688 $id = explode("_", $a_target);
689 $ref_id = $id[0];
690
691 // #13728 - used in notification mostly
692 if ($ilAccess->checkAccess("write", "", $ref_id)) {
693 $_GET["baseClass"] = "ilRepositoryGUI";
694 $_GET["ref_id"] = $ref_id;
695 $_GET["cmd"] = "showParticipants";
696 include("ilias.php");
697 exit;
698 } else {
699 // is sideblock: so show parent instead
700 $container_id = $tree->getParentId($ref_id);
701
702 // #11810
703 include_once "Services/Link/classes/class.ilLink.php";
704 ilUtil::redirect(ilLink::_getLink($container_id) .
705 "#poll" . ilObject::_lookupObjId($id[0]));
706 }
707 }
$_GET["client_id"]
static _lookupObjId($a_id)
static redirect($a_script)
if(!array_key_exists('StateId', $_REQUEST)) $id

References $_GET, $DIC, $id, 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 667 of file class.ilObjPollGUI.php.

668 {
669 $ilLocator = $this->locator;
670
671 if (is_object($this->object)) {
672 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
673 }
674 }

References ilObjectGUI\$locator.

◆ afterSave()

ilObjPollGUI::afterSave ( ilObject  $a_new_object)
protected

Post (successful) object creation hook.

Parameters
ilObject$a_new_object

Reimplemented from ilObjectGUI.

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

62 {
64
65 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
66 $ilCtrl->redirect($this, "render");
67 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18

References ilObjectGUI\$ctrl, $ilCtrl, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ confirmDeleteAllVotes()

ilObjPollGUI::confirmDeleteAllVotes ( )

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

525 {
528 $ilTabs = $this->tabs;
529
530 if (!$this->checkPermissionBool("write")) {
531 ilUtil::sendInfo($lng->txt("no_permission"));
532 return;
533 }
534
535 $ilTabs->activateTab("participants");
536
537 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
538 $cgui = new ilConfirmationGUI();
539 $cgui->setHeaderText($lng->txt("poll_delete_votes_sure"));
540
541 $cgui->setFormAction($this->ctrl->getFormAction($this));
542 $cgui->setCancel($lng->txt("cancel"), "showParticipants");
543 $cgui->setConfirm($lng->txt("confirm"), "deleteAllVotes");
544
545 $tpl->setContent($cgui->getHTML());
546 }
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, $tabs, ilObjectGUI\$tpl, ilObject2GUI\checkPermissionBool(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ deleteAllVotes()

ilObjPollGUI::deleteAllVotes ( )

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

549 {
552
553 if (!$this->checkPermissionBool("write")) {
554 ilUtil::sendInfo($lng->txt("no_permission"));
555 return;
556 }
557
558 $this->object->deleteAllVotes();
559
560 $ilCtrl->redirect($this, "showParticipants");
561 }

References ilObjectGUI\$ctrl, $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 261 of file class.ilObjPollGUI.php.

262 {
265 $ilTabs = $this->tabs;
266 $ilNavigationHistory = $this->nav_history;
267
268 $next_class = $ilCtrl->getNextClass($this);
269 $cmd = $ilCtrl->getCmd();
270
271 $tpl->getStandardTemplate();
272
273 // add entry to navigation history
274 if (!$this->getCreationMode() &&
275 $this->getAccessHandler()->checkAccess("read", "", $this->node_id)) {
276 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset");
277 $ilNavigationHistory->addItem($this->node_id, $link, "poll");
278 }
279
280 switch ($next_class) {
281 case "ilinfoscreengui":
282 $this->prepareOutput();
283 $this->infoScreenForward();
284 break;
285
286 case "ilcommonactiondispatchergui":
287 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
289 $this->ctrl->forwardCommand($gui);
290 break;
291
292 case "ilpermissiongui":
293 $this->prepareOutput();
294 $ilTabs->activateTab("id_permissions");
295 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
296 $perm_gui = new ilPermissionGUI($this);
297 $this->ctrl->forwardCommand($perm_gui);
298 break;
299
300 case "ilobjectcopygui":
301 include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
302 $cp = new ilObjectCopyGUI($this);
303 $cp->setType("poll");
304 $this->ctrl->forwardCommand($cp);
305 break;
306
307 case 'ilexportgui':
308 $this->prepareOutput();
309 $ilTabs->activateTab("export");
310 include_once("./Services/Export/classes/class.ilExportGUI.php");
311 $exp_gui = new ilExportGUI($this);
312 $exp_gui->addFormat("xml");
313 $ilCtrl->forwardCommand($exp_gui);
314 break;
315
316 default:
317 return parent::executeCommand();
318 }
319
320 return true;
321 }
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.

References ilObjectGUI\$ctrl, $ilCtrl, $nav_history, $tabs, 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 157 of file class.ilObjPollGUI.php.

158 {
159 include_once "Services/Object/classes/class.ilObjectActivation.php";
160
161 $a_values["online"] = $this->object->IsOnline();
162 $a_values["results"] = $this->object->getViewResults();
163 $a_values["access_period"]["start"] = $this->object->getAccessBegin()
164 ? new ilDateTime($this->object->getAccessBegin(), IL_CAL_UNIX)
165 : null;
166 $a_values["access_period"]["end"] = $this->object->getAccessEnd()
167 ? new ilDateTime($this->object->getAccessEnd(), IL_CAL_UNIX)
168 : null;
169 $a_values["voting_period"]["start"] = $this->object->getVotingPeriodBegin()
170 ? new ilDateTime($this->object->getVotingPeriodBegin(), IL_CAL_UNIX)
171 : null;
172 $a_values["voting_period"]["end"] = $this->object->getVotingPeriodEnd()
173 ? new ilDateTime($this->object->getVotingPeriodEnd(), IL_CAL_UNIX)
174 : null;
175 $a_values["sort"] = $this->object->getSortResultByVotes();
176 $a_values["comment"] = $this->object->getShowComments();
177 $a_values["show_results_as"] = $this->object->getShowResultsAs();
178 }
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 663 of file class.ilObjPollGUI.php.

664 {
665 }

◆ getType()

ilObjPollGUI::getType ( )

Functions that must be overwritten.

Reimplemented from ilObject2GUI.

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

57 {
58 return "poll";
59 }

◆ initEditCustomForm()

ilObjPollGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

Add custom fields to update form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

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

70 {
72
73 // activation
74
75 include_once "Services/Object/classes/class.ilObjectActivation.php";
76 $this->lng->loadLanguageModule('rep');
77
79 $section->setTitle($this->lng->txt('rep_activation_availability'));
80 $a_form->addItem($section);
81
82 // additional info only with multiple references
83 $act_obj_info = $act_ref_info = "";
84 if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
85 $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
86 $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
87 }
88
89 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
90 $online->setInfo($this->lng->txt('poll_activation_online_info') . $act_obj_info);
91 $a_form->addItem($online);
92
93 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
94 $dur = new ilDateDurationInputGUI($this->lng->txt('rep_visibility_until'), "access_period");
95 $dur->setShowTime(true);
96 $a_form->addItem($dur);
97
98
99 // period/results
100
102 $section->setTitle($this->lng->txt('poll_voting_period_and_results'));
103 $a_form->addItem($section);
104
105 $vdur = new ilDateDurationInputGUI($this->lng->txt('poll_voting_period_limited'), "voting_period");
106 $vdur->setShowTime(true);
107 $a_form->addItem($vdur);
108
109 $results = new ilRadioGroupInputGUI($lng->txt("poll_view_results"), "results");
110 $results->setRequired(true);
111 $results->addOption(new ilRadioOption(
112 $lng->txt("poll_view_results_always"),
114 ));
115 $results->addOption(new ilRadioOption(
116 $lng->txt("poll_view_results_never"),
118 ));
119 $results->addOption(new ilRadioOption(
120 $lng->txt("poll_view_results_after_vote"),
122 ));
123 $results->addOption(new ilRadioOption(
124 $lng->txt("poll_view_results_after_period"),
126 ));
127 $a_form->addItem($results);
128
129 $show_result_as = new ilRadioGroupInputGUI($lng->txt("poll_show_results_as"), "show_results_as");
130 $show_result_as->setRequired(true);
131 $result_bar = new ilRadioOption(
132 $lng->txt("poll_barchart"),
134 );
135 $show_result_as->addOption($result_bar);
136 $show_result_as->addOption(new ilRadioOption(
137 $lng->txt("poll_piechart"),
139 ));
140 $a_form->addItem($show_result_as);
141
142 $sort = new ilRadioGroupInputGUI($lng->txt("poll_result_sorting"), "sort");
143 $sort->setRequired(true);
144 $sort->addOption(new ilRadioOption($lng->txt("poll_result_sorting_answers"), 0));
145 $sort->addOption(new ilRadioOption($lng->txt("poll_result_sorting_votes"), 1));
146 $a_form->addItem($sort);
147
149 $section->setTitle($this->lng->txt('poll_comments'));
150 $a_form->addItem($section);
151
152 $comment = new ilCheckboxInputGUI($this->lng->txt('poll_comments'), 'comment');
153 //$comment->setInfo($this->lng->txt('poll_comments_info'));
154 $a_form->addItem($comment);
155 }
$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
Definition: svg-scanner.php:47

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

362 {
365
366 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
367 $form = new ilPropertyFormGUI();
368 $form->setFormAction($ilCtrl->getFormAction($this, "saveQuestion"));
369 $form->setTitle($lng->txt("obj_poll"));
370
371 $question = new ilTextAreaInputGUI($lng->txt("poll_question"), "question");
372 $question->setRequired(true);
373 $question->setCols(40);
374 $question->setRows(2);
375 $question->setValue($this->object->getQuestion());
376 $question->setDisabled($a_read_only);
377 $form->addItem($question);
378
379 $dimensions = " (" . ilObjPoll::getImageSize() . "px)";
380 $img = new ilImageFileInputGUI($lng->txt("poll_image") . $dimensions, "image");
381 $img->setDisabled($a_read_only);
382 $form->addItem($img);
383
384 // show existing file
385 $file = $this->object->getImageFullPath(true);
386 if ($file) {
387 $img->setImage($file);
388 }
389
390 $anonymous = new ilRadioGroupInputGUI($lng->txt("poll_mode"), "mode");
391 $anonymous->setRequired(true);
392 $option = new ilRadioOption($lng->txt("poll_mode_anonymous"), 0);
393 $option->setInfo($lng->txt("poll_mode_anonymous_info"));
394 $anonymous->addOption($option);
395 $option = new ilRadioOption($lng->txt("poll_mode_personal"), 1);
396 $option->setInfo($lng->txt("poll_mode_personal_info"));
397 $anonymous->addOption($option);
398 $anonymous->setValue($this->object->getNonAnonymous());
399 $anonymous->setDisabled($a_read_only);
400 $form->addItem($anonymous);
401
402 $nanswers = new ilNumberInputGUI($lng->txt("poll_max_number_of_answers"), "nanswers");
403 $nanswers->setRequired(true);
404 $nanswers->setMinValue(1);
405 $nanswers->setSize(3);
406 $nanswers->setValue($this->object->getMaxNumberOfAnswers());
407 $nanswers->setDisabled($a_read_only);
408 $form->addItem($nanswers);
409
410 $answers = new ilTextInputGUI($lng->txt("poll_answers"), "answers");
411 $answers->setRequired(true);
412 $answers->setMulti(true, true);
413 $answers->setDisabled($a_read_only);
414 $form->addItem($answers);
415
416 $multi_answers = array();
417 foreach ($this->object->getAnswers() as $idx => $item) {
418 if (!$idx) {
419 $answers->setValue($item["answer"]);
420 }
421 $multi_answers[] = $item["answer"];
422 }
423 $answers->setMultiValues($multi_answers);
424
425 if (!$a_read_only) {
426 $form->addCommandButton("saveQuestion", $lng->txt("save"));
427 }
428
429 return $form;
430 }
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.
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References ilObjectGUI\$ctrl, $file, $form, $ilCtrl, $img, ilObjectGUI\$lng, and ilObjPoll\getImageSize().

Referenced by render(), and saveQuestion().

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

◆ render()

ilObjPollGUI::render (   $a_form = null)

Render object context.

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

331 {
333 $ilTabs = $this->tabs;
336 $ilToolbar = $this->toolbar;
338
339 if (!$this->checkPermissionBool("write")) {
340 ilUtil::sendInfo($lng->txt("no_permission"));
341 return;
342 }
343
344 $ilTabs->activateTab("content");
345
346 if (!$a_form) {
347 if ($this->object->countVotes()) {
348 $url = $ilCtrl->getLinkTarget($this, "showParticipants");
349 ilUtil::sendInfo($lng->txt("poll_votes_no_edit") .
350 " <a href=\"" . $url . "\">&raquo;" . $lng->txt("poll_result") . "</a>");
351 }
352
353 $a_form = $this->initQuestionForm($this->object->countVotes());
354 }
355
356 $tpl->setPermanentLink('poll', $this->node_id);
357
358 $tpl->setContent($a_form->getHTML());
359 }
initQuestionForm($a_read_only=false)
$url
$ilUser
Definition: imgupload.php:18

References ilObjectGUI\$ctrl, $ilCtrl, $ilUser, ilObjectGUI\$lng, $tabs, ilObjectGUI\$toolbar, ilObjectGUI\$tpl, $url, ilObjectGUI\$user, 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 432 of file class.ilObjPollGUI.php.

433 {
434 $form = $this->initQuestionForm();
435 if ($form->checkInput()) {
436 $this->object->setQuestion($form->getInput("question"));
437 $this->object->setNonAnonymous($form->getInput("mode"));
438
439 $image = $form->getItemByPostVar("image");
440 if ($_FILES["image"]["tmp_name"]) {
441 $this->object->uploadImage($_FILES["image"]);
442 } elseif ($image->getDeletionFlag()) {
443 $this->object->deleteImage();
444 }
445
446 $nr_of_anwers = $this->object->saveAnswers($form->getInput("answers"));
447
448 // #15073
449 $this->object->setMaxNumberOfAnswers(min($form->getInput("nanswers"), $nr_of_anwers));
450
451 if ($this->object->update()) {
452 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
453 $this->ctrl->redirect($this, "render");
454 }
455 }
456
457 $form->setValuesByPost();
458 $this->render($form);
459 }
render($a_form=null)
Render object context.

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

+ Here is the call graph for this function:

◆ sendNotifications()

ilObjPollGUI::sendNotifications ( )
protected

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

624 {
626
627 // recipients
628 include_once "./Services/Notification/classes/class.ilNotification.php";
631 $this->object->getId(),
632 null,
633 true
634 );
635 if (!sizeof($users)) {
636 return;
637 }
638
639 include_once "./Services/Notification/classes/class.ilSystemNotification.php";
640 $ntf = new ilSystemNotification();
641 $ntf->setLangModules(array("poll"));
642 $ntf->setRefId($this->ref_id);
643
644 if ($this->object->getNonAnonymous()) {
645 $ntf->setChangedByUserId($ilUser->getId());
646 }
647
648 $ntf->setSubjectLangId('poll_vote_notification_subject');
649 $ntf->setIntroductionLangId('poll_vote_notification_body');
650 $ntf->setGotoLangId('poll_vote_notification_link');
651 $ntf->setReasonLangId('poll_vote_notification_reason');
652
653 $notified = $ntf->sendMail($users, null, "read");
654
655 ilNotification::updateNotificationTime(ilNotification::TYPE_POLL, $this->object->getId(), $notified);
656 }
$users
Definition: authpage.php:44
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, ilObjectGUI\$user, $users, 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 461 of file class.ilObjPollGUI.php.

462 {
463 $ilTabs = $this->tabs;
466
467 if (!$this->object->getNonAnonymous()) {
468 return;
469 }
470
471 $ilTabs->addSubTab(
472 "result_answers",
473 $lng->txt("poll_result_answers"),
474 $ilCtrl->getLinkTarget($this, "showParticipants")
475 );
476 $ilTabs->addSubTab(
477 "result_users",
478 $lng->txt("poll_result_users"),
479 $ilCtrl->getLinkTarget($this, "showParticipantVotes")
480 );
481
482 $ilTabs->activateSubTab($a_active);
483 }

References ilObjectGUI\$ctrl, $ilCtrl, ilObjectGUI\$lng, and $tabs.

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

223 {
225 $ilHelp = $this->help;
226
227 $ilHelp->setScreenIdComponent("poll");
228
229 if ($this->checkPermissionBool("write")) {
230 $this->tabs_gui->addTab(
231 "content",
232 $lng->txt("content"),
233 $this->ctrl->getLinkTarget($this, "")
234 );
235 }
236
237 if ($this->checkPermissionBool("write")) {
238 $this->tabs_gui->addTab(
239 "settings",
240 $lng->txt("settings"),
241 $this->ctrl->getLinkTarget($this, "edit")
242 );
243
244 $this->tabs_gui->addTab(
245 "participants",
246 $lng->txt("poll_result"),
247 $this->ctrl->getLinkTarget($this, "showParticipants")
248 );
249
250 $this->tabs_gui->addTab(
251 "export",
252 $lng->txt("export"),
253 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
254 );
255 }
256
257 // will add permissions if needed
258 parent::setTabs();
259 }

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

+ Here is the call graph for this function:

◆ showParticipants()

ilObjPollGUI::showParticipants ( )

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

486 {
488 $ilTabs = $this->tabs;
490
491 if (!$this->checkPermissionBool("write")) {
492 ilUtil::sendInfo($lng->txt("no_permission"));
493 return;
494 }
495
496 $ilTabs->activateTab("participants");
497 $this->setParticipantsSubTabs("result_answers");
498
499 include_once "Modules/Poll/classes/class.ilPollAnswerTableGUI.php";
500 $tbl = new ilPollAnswerTableGUI($this, "showParticipants");
501 $tpl->setContent($tbl->getHTML());
502 }
setParticipantsSubTabs($a_active)
TableGUI class for poll answers.
$tbl
Definition: example_048.php:81

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

+ Here is the call graph for this function:

◆ showParticipantVotes()

ilObjPollGUI::showParticipantVotes ( )

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

505 {
506 $ilTabs = $this->tabs;
509
510 if (!$this->checkPermissionBool("write") ||
511 !$this->object->getNonAnonymous()) {
512 ilUtil::sendInfo($lng->txt("no_permission"));
513 return;
514 }
515
516 $ilTabs->activateTab("participants");
517 $this->setParticipantsSubTabs("result_users");
518
519 include_once "Modules/Poll/classes/class.ilPollUserTableGUI.php";
520 $tbl = new ilPollUserTableGUI($this, "showParticipantVotes");
521 $tpl->setContent($tbl->getHTML());
522 }
TableGUI class for poll users.

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

+ Here is the call graph for this function:

◆ subscribe()

ilObjPollGUI::subscribe ( )

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

596 {
600
601 include_once "./Services/Notification/classes/class.ilNotification.php";
602 ilNotification::setNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->object->getId(), true);
603
604 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
605 include_once "Services/Link/classes/class.ilLink.php";
606 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
607 }
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.

References $ilUser, ilObjectGUI\$lng, ilObject2GUI\$tree, ilObjectGUI\$user, 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 609 of file class.ilObjPollGUI.php.

610 {
614
615 include_once "./Services/Notification/classes/class.ilNotification.php";
616 ilNotification::setNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->object->getId(), false);
617
618 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
619 include_once "Services/Link/classes/class.ilLink.php";
620 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
621 }

References $ilUser, ilObjectGUI\$lng, ilObject2GUI\$tree, ilObjectGUI\$user, 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 192 of file class.ilObjPollGUI.php.

193 {
194 $this->object->setViewResults($a_form->getInput("results"));
195 $this->object->setOnline($a_form->getInput("online"));
196 $this->object->setSortResultByVotes($a_form->getInput("sort"));
197 $this->object->setShowComments($a_form->getInput("comment"));
198 $this->object->setShowResultsAs($a_form->getInput("show_results_as"));
199
200 include_once "Services/Object/classes/class.ilObjectActivation.php";
201 $period = $a_form->getItemByPostVar("access_period");
202 if ($period->getStart() && $period->getEnd()) {
203 $this->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION);
204 $this->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX));
205 $this->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX));
206 } else {
207 $this->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
208 }
209
210 $period = $a_form->getItemByPostVar("voting_period");
211 if ($period->getStart() && $period->getEnd()) {
212 $this->object->setVotingPeriod(1);
213 $this->object->setVotingPeriodBegin($period->getStart()->get(IL_CAL_UNIX));
214 $this->object->setVotingPeriodEnd($period->getEnd()->get(IL_CAL_UNIX));
215 } else {
216 $this->object->setVotingPeriodBegin(null);
217 $this->object->setVotingPeriodEnd(null);
218 $this->object->setVotingPeriod(0);
219 }
220 }
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 180 of file class.ilObjPollGUI.php.

181 {
182 #20594
183 if (!$a_form->getInput("voting_period") &&
184 $a_form->getInput("results") == ilObjPoll::VIEW_RESULTS_AFTER_PERIOD) {
185 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
186 $a_form->getItemByPostVar("results")->setAlert($this->lng->txt("poll_view_results_after_period_impossible"));
187 return false;
188 }
189 return parent::validateCustom($a_form);
190 }
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 563 of file class.ilObjPollGUI.php.

564 {
567
568 $valid = true;
569 if ($this->object->getMaxNumberOfAnswers() > 1) {
570 if (sizeof($_POST["aw"]) > $this->object->getMaxNumberOfAnswers()) {
571 $valid = false;
572 }
573 if (!sizeof($_POST["aw"])) {
574 $valid = false;
575 }
576 } else {
577 if ((int) !$_POST["aw"]) {
578 $valid = false;
579 }
580 }
581
582 if ($valid) {
583 unset($_SESSION["last_poll_vote"][$this->object->getId()]);
584 $this->object->saveVote($ilUser->getId(), $_POST["aw"]);
585
586 $this->sendNotifications();
587 } else {
588 $_SESSION["last_poll_vote"][$this->object->getId()] = $_POST["aw"];
589 }
590
591 include_once "Services/Link/classes/class.ilLink.php";
592 ilUtil::redirect(ilLink::_getLink($tree->getParentId($this->ref_id)));
593 }
$_POST["username"]
$_SESSION["AccountId"]
$valid

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

+ Here is the call graph for this function:

Field Documentation

◆ $help

ilObjPollGUI::$help
protected

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

Referenced by setTabs().

◆ $nav_history

ilObjPollGUI::$nav_history
protected

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

Referenced by executeCommand().

◆ $tabs

ilObjPollGUI::$tabs
protected

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