ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjPollGUI Class Reference

Class ilObjPollGUI. More...

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

Public Member Functions

 __construct ($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
 
 getType ()
 
 setTabs ()
 
 executeCommand ()
 
 render ($a_form=null)
 Render object context. More...
 
 saveQuestion ()
 
 showParticipants ()
 
 confirmDeleteAllVotes ()
 
 deleteAllVotes ()
 
 vote ()
 
 getHTML ()
 return user view More...
 
 addLocatorItems ()
 
 _goto ($a_target)
 Deep link. 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)
 
 getCreationMode ()
 
 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 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 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...
 
 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...
 

Protected Member Functions

 afterSave (ilObject $a_new_object)
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 
 getEditFormCustomValues (array &$a_values)
 
 updateCustom (ilPropertyFormGUI $a_form)
 
 initQuestionForm ($a_read_only=false)
 
- 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 ()
 
 setTitleAndDescription ()
 
 showUpperIcon ()
 
 omitLocator ($a_omit=true)
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 
 setTargetFrame ($a_cmd, $a_target_frame)
 
 getCenterColumnHTML ()
 
 getRightColumnHTML ()
 
 setColumnSettings ($column_gui)
 
 checkPermission ($a_perm, $a_cmd="")
 
 showPossibleSubObjects ()
 
 redirectToRefId ()
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 
 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)
 
- 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 public More...
 
 setAdminTabs ()
 set admin tabs 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...
 
 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)
 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

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References ilObjectGUI\$lng.

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

Member Function Documentation

◆ _goto()

ilObjPollGUI::_goto (   $a_target)

Deep link.

Parameters
string$a_target

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

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

469  {
470  global $tree;
471 
472  $id = explode("_", $a_target);
473 
474  // is sideblock: so show parent instead
475  $container_id = $tree->getParentId($id[0]);
476 
477  // #11810
478  include_once "Services/Link/classes/class.ilLink.php";
479  ilUtil::redirect(ilLink::_getLink($container_id).
480  "#poll".ilObject::_lookupObjId($id[0]));
481 
482  /*
483  $_GET["baseClass"] = "ilRepositoryGUI";
484  $_GET["ref_id"] = $container_id;
485  $_GET["cmd"] = "render";
486 
487  include("ilias.php");
488  exit;
489  */
490  }
static _lookupObjId($a_id)
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjPollGUI::addLocatorItems ( )

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

References ilObject2GUI\$node_id.

454  {
455  global $ilLocator;
456 
457  if (is_object($this->object))
458  {
459  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
460  }
461  }

◆ afterSave()

ilObjPollGUI::afterSave ( ilObject  $a_new_object)
protected

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

References $ilCtrl, and ilUtil\sendSuccess().

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
+ Here is the call graph for this function:

◆ confirmDeleteAllVotes()

ilObjPollGUI::confirmDeleteAllVotes ( )

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

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

393  {
394  global $lng, $tpl, $ilTabs;
395 
396  if(!$this->checkPermissionBool("write"))
397  {
398  ilUtil::sendInfo($lng->txt("no_permission"));
399  return;
400  }
401 
402  $ilTabs->activateTab("participants");
403 
404  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
405  $cgui = new ilConfirmationGUI();
406  $cgui->setHeaderText($lng->txt("poll_delete_votes_sure"));
407 
408  $cgui->setFormAction($this->ctrl->getFormAction($this));
409  $cgui->setCancel($lng->txt("cancel"), "showParticipants");
410  $cgui->setConfirm($lng->txt("confirm"), "deleteAllVotes");
411 
412  $tpl->setContent($cgui->getHTML());
413  }
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.
Confirmation screen class.
+ Here is the call graph for this function:

◆ deleteAllVotes()

ilObjPollGUI::deleteAllVotes ( )

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

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

416  {
417  global $ilCtrl, $lng;
418 
419  if(!$this->checkPermissionBool("write"))
420  {
421  ilUtil::sendInfo($lng->txt("no_permission"));
422  return;
423  }
424 
425  $this->object->deleteAllVotes();
426 
427  $ilCtrl->redirect($this, "showParticipants");
428  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ executeCommand()

ilObjPollGUI::executeCommand ( )

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

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

194  {
195  global $ilCtrl, $tpl, $ilTabs, $ilNavigationHistory;
196 
197  $next_class = $ilCtrl->getNextClass($this);
198  $cmd = $ilCtrl->getCmd();
199 
200  $tpl->getStandardTemplate();
201 
202  // add entry to navigation history
203  if(!$this->getCreationMode() &&
204  $this->getAccessHandler()->checkAccess("read", "", $this->node_id))
205  {
206  $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset");
207  $ilNavigationHistory->addItem($this->node_id, $link, "poll");
208  }
209 
210  switch($next_class)
211  {
212  case "ilinfoscreengui":
213  $this->prepareOutput();
214  $this->infoScreenForward();
215  break;
216 
217  case "ilcommonactiondispatchergui":
218  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
220  $this->ctrl->forwardCommand($gui);
221  break;
222 
223  case "ilpermissiongui":
224  $this->prepareOutput();
225  $ilTabs->activateTab("id_permissions");
226  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
227  $perm_gui = new ilPermissionGUI($this);
228  $this->ctrl->forwardCommand($perm_gui);
229  break;
230 
231  case "ilobjectcopygui":
232  include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
233  $cp = new ilObjectCopyGUI($this);
234  $cp->setType("poll");
235  $this->ctrl->forwardCommand($cp);
236  break;
237 
238  case 'ilexportgui':
239  $this->prepareOutput();
240  $ilTabs->activateTab("export");
241  include_once("./Services/Export/classes/class.ilExportGUI.php");
242  $exp_gui = new ilExportGUI($this);
243  $exp_gui->addFormat("xml");
244  $ilCtrl->forwardCommand($exp_gui);
245  break;
246 
247  default:
248  return parent::executeCommand();
249  }
250 
251  return true;
252  }
GUI class for the workflow of copying objects.
getAccessHandler()
Get access handler.
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
Export User Interface Class.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ getEditFormCustomValues()

ilObjPollGUI::getEditFormCustomValues ( array &  $a_values)
protected

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

References ilObjectActivation\TIMINGS_ACTIVATION.

119  {
120  include_once "Services/Object/classes/class.ilObjectActivation.php";
121 
122  $a_values["online"] = $this->object->IsOnline();
123  $a_values["results"] = $this->object->getViewResults();
124  $a_values["access_type"] = ($this->object->getAccessType() == ilObjectActivation::TIMINGS_ACTIVATION);
125  $a_values["period"] = $this->object->getVotingPeriod();
126  }

◆ getHTML()

ilObjPollGUI::getHTML ( )

return user view

Returns
string

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

449  {
450 
451  }

◆ getType()

ilObjPollGUI::getType ( )

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

30  {
31  return "poll";
32  }

◆ initEditCustomForm()

ilObjPollGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

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

References ilObjectGUI\$lng, $results, $section, ilObject\_getAllReferences(), ilPropertyFormGUI\addItem(), ilSubEnabledFormPropertyGUI\addSubItem(), IL_CAL_UNIX, ilFormPropertyGUI\setInfo(), ilDateDurationInputGUI\setShowTime(), ilObjPoll\VIEW_RESULTS_AFTER_PERIOD, ilObjPoll\VIEW_RESULTS_AFTER_VOTE, ilObjPoll\VIEW_RESULTS_ALWAYS, and ilObjPoll\VIEW_RESULTS_NEVER.

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  }
This class represents an option in a radio group.
const VIEW_RESULTS_AFTER_PERIOD
const VIEW_RESULTS_AFTER_VOTE
const VIEW_RESULTS_NEVER
This class represents a section header in a property form.
const VIEW_RESULTS_ALWAYS
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
const IL_CAL_UNIX
static _getAllReferences($a_id)
get all reference ids of object
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:84
input GUI for a time span (start and end date)
This class represents a property in a property form.
Date and time handling
$results
setShowTime($a_showtime)
Set Show Time Information.
+ Here is the call graph for this function:

◆ initQuestionForm()

ilObjPollGUI::initQuestionForm (   $a_read_only = false)
protected

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

References $file, $ilCtrl, $img, ilObjectGUI\$lng, and ilFormPropertyGUI\setRequired().

Referenced by render(), and saveQuestion().

292  {
293  global $lng, $ilCtrl;
294 
295  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
296  $form = new ilPropertyFormGUI();
297  $form->setFormAction($ilCtrl->getFormAction($this, "saveQuestion"));
298  $form->setTitle($lng->txt("obj_poll"));
299 
300  $question = new ilTextAreaInputGUI($lng->txt("poll_question"), "question");
301  $question->setRequired(true);
302  $question->setCols(40);
303  $question->setRows(2);
304  $question->setValue($this->object->getQuestion());
305  $question->setDisabled($a_read_only);
306  $form->addItem($question);
307 
308  $dimensions = " (".ilObjPoll::getImageSize()."px)";
309  $img = new ilImageFileInputGUI($lng->txt("poll_image").$dimensions, "image");
310  $img->setDisabled($a_read_only);
311  $form->addItem($img);
312 
313  // show existing file
314  $file = $this->object->getImageFullPath(true);
315  if($file)
316  {
317  $img->setImage($file);
318  }
319 
320  $answers = new ilTextInputGUI($lng->txt("poll_answers"), "answers");
321  $answers->setRequired(true);
322  $answers->setMulti(true, true);
323  $answers->setDisabled($a_read_only);
324  $form->addItem($answers);
325 
326  $multi_answers = array();
327  foreach($this->object->getAnswers() as $idx => $item)
328  {
329  if(!$idx)
330  {
331  $answers->setValue($item["answer"]);
332  }
333  $multi_answers[] = $item["answer"];
334  }
335  $answers->setMultiValues($multi_answers);
336 
337  if(!$a_read_only)
338  {
339  $form->addCommandButton("saveQuestion", $lng->txt("save"));
340  }
341 
342  return $form;
343  }
print $file
This class represents a property form user interface.
global $ilCtrl
Definition: ilias.php:18
This class represents a text property in a property form.
This class represents an image file property in a property form.
This class represents a text area property in a property form.
setRequired($a_required)
Set Required.
+ 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 261 of file class.ilObjPollGUI.php.

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

Referenced by saveQuestion().

262  {
263  global $tpl, $ilTabs, $ilCtrl, $lng, $ilToolbar, $ilUser;
264 
265  if(!$this->checkPermissionBool("write"))
266  {
267  ilUtil::sendInfo($lng->txt("no_permission"));
268  return;
269  }
270 
271  $ilTabs->activateTab("content");
272 
273  if(!$a_form)
274  {
275  if($this->object->countVotes())
276  {
277  $url = $ilCtrl->getLinkTarget($this, "showParticipants");
278  ilUtil::sendInfo($lng->txt("poll_votes_no_edit").
279  " <a href=\"".$url."\">&raquo;".$lng->txt("poll_result")."</a>");
280  }
281 
282  $a_form = $this->initQuestionForm($this->object->countVotes());
283  }
284 
285  include_once('Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
286  $plink = new ilPermanentLinkGUI('poll', $this->node_id);
287 
288  $tpl->setContent($a_form->getHTML().$plink->getHTML());
289  }
Class for permanent links.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
initQuestionForm($a_read_only=false)
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveQuestion()

ilObjPollGUI::saveQuestion ( )

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

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

346  {
347  $form = $this->initQuestionForm();
348  if($form->checkInput())
349  {
350  $this->object->setQuestion($form->getInput("question"));
351 
352  $image = $form->getItemByPostVar("image");
353  if($_FILES["image"]["tmp_name"])
354  {
355  $this->object->uploadImage($_FILES["image"]);
356  }
357  else if($image->getDeletionFlag())
358  {
359  $this->object->deleteImage();
360  }
361 
362  $this->object->saveAnswers($form->getInput("answers"));
363 
364  if($this->object->update())
365  {
366  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
367  $this->ctrl->redirect($this, "render");
368  }
369  }
370 
371  $form->setValuesByPost();
372  $this->render($form);
373  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
render($a_form=null)
Render object context.
initQuestionForm($a_read_only=false)
+ Here is the call graph for this function:

◆ setTabs()

ilObjPollGUI::setTabs ( )

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

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

162  {
163  global $lng, $ilHelp;
164 
165  $ilHelp->setScreenIdComponent("poll");
166 
167  if ($this->checkPermissionBool("write"))
168  {
169  $this->tabs_gui->addTab("content",
170  $lng->txt("content"),
171  $this->ctrl->getLinkTarget($this, ""));
172  }
173 
174  if ($this->checkPermissionBool("write"))
175  {
176  $this->tabs_gui->addTab("settings",
177  $lng->txt("settings"),
178  $this->ctrl->getLinkTarget($this, "edit"));
179 
180  $this->tabs_gui->addTab("participants",
181  $lng->txt("poll_result"),
182  $this->ctrl->getLinkTarget($this, "showParticipants"));
183 
184  $this->tabs_gui->addTab("export",
185  $lng->txt("export"),
186  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
187  }
188 
189  // will add permissions if needed
190  parent::setTabs();
191  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
+ Here is the call graph for this function:

◆ showParticipants()

ilObjPollGUI::showParticipants ( )

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

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

376  {
377  global $lng, $ilTabs, $tpl;
378 
379  if(!$this->checkPermissionBool("write"))
380  {
381  ilUtil::sendInfo($lng->txt("no_permission"));
382  return;
383  }
384 
385  $ilTabs->activateTab("participants");
386 
387  include_once "Modules/Poll/classes/class.ilPollAnswerTableGUI.php";
388  $tbl = new ilPollAnswerTableGUI($this, "showParticipants");
389  $tpl->setContent($tbl->getHTML());
390  }
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.
TableGUI class for poll answers.
+ Here is the call graph for this function:

◆ updateCustom()

ilObjPollGUI::updateCustom ( ilPropertyFormGUI  $a_form)
protected

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

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

129  {
130  $this->object->setViewResults($a_form->getInput("results"));
131  $this->object->setOnline($a_form->getInput("online"));
132 
133  include_once "Services/Object/classes/class.ilObjectActivation.php";
134  if($a_form->getInput("access_type"))
135  {
136  $this->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION);
137 
138  $period = $a_form->getItemByPostVar("access_period");
139  $this->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX));
140  $this->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX));
141  }
142  else
143  {
144  $this->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED);
145  }
146 
147  if($a_form->getInput("period"))
148  {
149  $this->object->setVotingPeriod(1);
150 
151  $period = $a_form->getItemByPostVar("voting_period");
152  $this->object->setVotingPeriodBegin($period->getStart()->get(IL_CAL_UNIX));
153  $this->object->setVotingPeriodEnd($period->getEnd()->get(IL_CAL_UNIX));
154  }
155  else
156  {
157  $this->object->setVotingPeriod(0);
158  }
159  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
const IL_CAL_UNIX
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ vote()

ilObjPollGUI::vote ( )

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

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

431  {
432  global $tree, $ilUser;
433 
434  if($_POST["aw"])
435  {
436  $this->object->saveVote($ilUser->getId(), $_POST["aw"]);
437  }
438 
439  include_once "Services/Link/classes/class.ilLink.php";
440  ilUtil::redirect(ilLink:: _getLink($tree->getParentId($this->ref_id)));
441  }
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

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