ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPollBlockGUI Class Reference

BlockGUI class for polls. More...

+ Inheritance diagram for ilPollBlockGUI:
+ Collaboration diagram for ilPollBlockGUI:

Public Member Functions

 __construct ()
 
 getBlockType ()
 
 setBlock (ilPollBlock $a_block)
 
 executeCommand ()
 
 fillRow (array $a_set)
 
 getHTML ()
 
 getNumberOfCommentsForRedraw ()
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 
 getBlockType ()
 
 setData (array $a_data)
 
 getData ()
 
 setPresentation (int $type)
 
 getPresentation ()
 
 setBlockId (string $a_block_id="0")
 
 getBlockId ()
 
 setGuiObject (object $a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setOffset (int $a_offset)
 
 getOffset ()
 
 checkOffset (int $offset)
 
 setLimit (int $a_limit)
 
 getLimit ()
 
 setEnableEdit (bool $a_enableedit)
 
 getEnableEdit ()
 
 setRepositoryMode (bool $a_repositorymode)
 
 getRepositoryMode ()
 
 setSubtitle (string $a_subtitle)
 
 getSubtitle ()
 
 setRefId (int $a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 
 setAdminCommands (bool $a_admincommands)
 
 getAdminCommands ()
 
 setEnableNumInfo (bool $a_enablenuminfo)
 
 getEnableNumInfo ()
 
 setProperties (array $a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty (string $a_property)
 
 setProperty (string $a_property, string $a_value)
 
 setRowTemplate (string $a_rowtemplatename, string $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 
 getRowTemplateDir ()
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
 
 getBlockCommands ()
 
 getHTML ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getViewControlsForPanel ()
 
 sortObject ()
 
 addSortOption (string $option, string $label, bool $active)
 
 setSortTarget (string $target)
 
 addPresentation (string $label, string $target, bool $active)
 
 getNoItemFoundContent ()
 

Static Public Attributes

static string $block_type = "poll"
 
static bool $js_init = false
 

Protected Member Functions

 isRepositoryObject ()
 
 getRepositoryObjectGUIName ()
 
 initContentRenderer ()
 
 initJS ()
 
 getCommentsRedrawURL ()
 
 getVoteURL ()
 
 getLegacyContent ()
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 specialCharsAsEntities (string $string)
 
 initCommands ()
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getListItemForData (array $data)
 Get list item for data array. More...
 
 handleNavigation ()
 Handle navigation. More...
 
 loadData ()
 Load data for current page. More...
 
 getListItemGroups ()
 Get items. More...
 
 addRepoCommands ()
 Add repo commands. More...
 
 getActionsForPanel ()
 
 send (string $output)
 Send. More...
 

Protected Attributes

ilPollBlock $poll_block
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Refinery $refinery
 
DataFactory $data_factory
 
ilPollStateInfo $state
 
ilPollCommentsHandler $comments
 
ilPollImageFactoryInterface $poll_image_factory
 
- Protected Attributes inherited from ilBlockGUI
ILIAS UI Renderer $renderer
 
Factory $factory
 
object $gui_object
 
ILIAS Block StandardGUIRequest $request
 
ILIAS Block BlockManager $block_manager
 
bool $repositorymode = false
 
ILIAS DI UIServices $ui
 
array $data = array()
 
bool $enablenuminfo = true
 
array $footer_links = array()
 
string $block_id = "0"
 
bool $allow_moving = true
 
array $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
array $block_commands = array()
 
int $max_count = 0
 
bool $close_command = false
 
bool $image = false
 
array $property = []
 
string $nav_value = ""
 
string $css_row = ""
 
string $title = ""
 
bool $admincommands = false
 
array $dropdown
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilLanguage $lng
 
ilObjectDefinition $obj_def
 
int $presentation
 
int $requested_ref_id
 

Additional Inherited Members

- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 
- Data Fields inherited from ilBlockGUI
const PRES_MAIN_LEG = 0
 
const PRES_SEC_LEG = 1
 
const PRES_SEC_LIST = 2
 
const PRES_MAIN_LIST = 3
 
const PRES_MAIN_TILE = 4
 

Detailed Description

BlockGUI class for polls.

Author
Jörg Lützenkirchen ilPollBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPollBlockGUI::__construct ( )

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), getCommentsRedrawURL(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilBlockGUI\setRowTemplate(), and ILIAS\Repository\user().

48  {
49  global $DIC;
50 
51  $this->lng = $DIC->language();
52  $this->ctrl = $DIC->ctrl();
53  $this->user = $DIC->user();
54  $this->access = $DIC->access();
55  $this->ui_factory = $DIC->ui()->factory();
56  $this->ui_renderer = $DIC->ui()->renderer();
57  $this->data_factory = new DataFactory();
58  $this->refinery = $DIC->refinery();
59 
61 
62  $this->lng->loadLanguageModule("poll");
63  $this->setRowTemplate("tpl.block.html", "components/ILIAS/Poll");
64  $this->poll_image_factory = new ilPollImageFactory();
65  $this->comments = new ilPollCommentsHandler(
66  $DIC->notes(),
67  $DIC->http(),
68  $DIC->refinery(),
69  $this->getCommentsRedrawURL()
70  );
71  $this->state = new ilPollStateInfo();
72  }
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPollBlockGUI::executeCommand ( )

Definition at line 95 of file class.ilPollBlockGUI.php.

References ILIAS\Repository\ctrl().

95  : void
96  {
97  $next_class = $this->ctrl->getNextClass();
98  $cmd = $this->ctrl->getCmd("getHTML");
99 
100  switch ($next_class) {
101  default:
102  $this->$cmd();
103  break;
104  }
105  }
+ Here is the call graph for this function:

◆ fillRow()

ilPollBlockGUI::fillRow ( array  $a_set)

Definition at line 107 of file class.ilPollBlockGUI.php.

References ilBlockGUI\getAdminCommands(), ilBlockGUI\getRefId(), initContentRenderer(), initJS(), and ILIAS\Repository\user().

Referenced by getLegacyContent().

107  : void
108  {
109  if ($this->poll_block->getPoll()->getShowComments()) {
110  $this->initJS();
111  }
112 
113  $this->initContentRenderer()->render(
114  $this->tpl,
115  $this->getRefId(),
116  $this->user->getId(),
117  $this->poll_block->getPoll(),
118  $this->getAdminCommands()
119  );
120  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBlockType()

ilPollBlockGUI::getBlockType ( )

Definition at line 74 of file class.ilPollBlockGUI.php.

74  : string
75  {
76  return self::$block_type;
77  }

◆ getCommentsRedrawURL()

ilPollBlockGUI::getCommentsRedrawURL ( )
protected

Definition at line 235 of file class.ilPollBlockGUI.php.

References ILIAS\Repository\ctrl().

Referenced by __construct().

235  : string
236  {
237  return $this->ctrl->getLinkTarget(
238  $this,
239  "getNumberOfCommentsForRedraw",
240  "",
241  true
242  );
243  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilPollBlockGUI::getHTML ( )

Definition at line 122 of file class.ilPollBlockGUI.php.

References ILIAS\Repository\access(), ilBlockGUI\addBlockCommand(), ILIAS\Repository\ctrl(), ilBlockGUI\getRefId(), getRepositoryObjectGUIName(), ilNotification\hasNotification(), ILIAS\Repository\lng(), ilBlockGUI\setData(), ilBlockGUI\setTitle(), ilNotification\TYPE_POLL, and ILIAS\Repository\user().

122  : string
123  {
124  $this->poll_block->setRefId($this->getRefId());
125  $may_write = $this->access->checkAccess("write", "", $this->getRefId());
126 
127  $poll_obj = $this->poll_block->getPoll();
128  $this->setTitle($poll_obj->getTitle());
129  $this->setData([[$poll_obj]]);
130 
131  $this->ctrl->setParameterByClass(
133  "ref_id",
134  $this->getRefId()
135  );
136 
137  if (
138  !$this->state->isOfflineOrUnavailable($this->poll_block->getPoll()) &&
139  !$this->user->isAnonymous()
140  ) {
141  // notification
142  if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $this->user->getId(), $this->poll_block->getPoll()->getId())) {
143  $this->addBlockCommand(
144  $this->ctrl->getLinkTargetByClass(
145  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
146  "unsubscribe"
147  ),
148  $this->lng->txt("poll_notification_unsubscribe")
149  );
150  } else {
151  $this->addBlockCommand(
152  $this->ctrl->getLinkTargetByClass(
153  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
154  "subscribe"
155  ),
156  $this->lng->txt("poll_notification_subscribe")
157  );
158  }
159  }
160 
161  if ($may_write) {
162  // edit
163  $this->addBlockCommand(
164  $this->ctrl->getLinkTargetByClass(
165  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
166  "render"
167  ),
168  $this->lng->txt("poll_edit_question")
169  );
170  $this->addBlockCommand(
171  $this->ctrl->getLinkTargetByClass(
172  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
173  "edit"
174  ),
175  $this->lng->txt("settings")
176  );
177  $this->addBlockCommand(
178  $this->ctrl->getLinkTargetByClass(
179  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
180  "showParticipants"
181  ),
182  $this->lng->txt("poll_result")
183  );
184  }
185 
186  $this->ctrl->clearParametersByClass($this->getRepositoryObjectGUIName());
187 
188  return parent::getHTML();
189  }
setTitle(string $a_title)
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
setData(array $a_data)
+ Here is the call graph for this function:

◆ getLegacyContent()

ilPollBlockGUI::getLegacyContent ( )
protected

Definition at line 266 of file class.ilPollBlockGUI.php.

References fillRow(), ilBlockGUI\getData(), ilBlockGUI\getRowTemplateDir(), and ilBlockGUI\getRowTemplateName().

266  : string
267  {
268  $this->tpl = new ilTemplate(
269  $this->getRowTemplateName(),
270  true,
271  true,
272  $this->getRowTemplateDir()
273  );
274  $this->fillRow(current($this->getData()));
275  return $this->tpl->get();
276  }
+ Here is the call graph for this function:

◆ getNumberOfCommentsForRedraw()

ilPollBlockGUI::getNumberOfCommentsForRedraw ( )

Definition at line 261 of file class.ilPollBlockGUI.php.

261  : void
262  {
263  $this->comments->getNumberOfCommentsForRedraw();
264  }

◆ getRepositoryObjectGUIName()

ilPollBlockGUI::getRepositoryObjectGUIName ( )
protected

Definition at line 84 of file class.ilPollBlockGUI.php.

Referenced by getHTML(), and getVoteURL().

84  : string
85  {
86  return "ilobjpollgui";
87  }
+ Here is the caller graph for this function:

◆ getVoteURL()

ilPollBlockGUI::getVoteURL ( )
protected

Definition at line 245 of file class.ilPollBlockGUI.php.

References $url, ILIAS\Repository\ctrl(), ilBlockGUI\getRefId(), and getRepositoryObjectGUIName().

Referenced by initContentRenderer().

245  : string
246  {
247  $this->ctrl->setParameterByClass(
249  "ref_id",
250  $this->getRefId()
251  );
252  $url = $this->ctrl->getLinkTargetByClass(
253  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
254  "vote"
255  );
256  $this->ctrl->clearParametersByClass($this->getRepositoryObjectGUIName());
257 
258  return $url .= "#poll" . $this->poll_block->getPoll()->getID();
259  }
$url
Definition: shib_logout.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initContentRenderer()

ilPollBlockGUI::initContentRenderer ( )
protected

Definition at line 191 of file class.ilPollBlockGUI.php.

References $results, ilBlockGUI\getRefId(), getVoteURL(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

Referenced by fillRow().

192  {
193  $answers = new ilPollAnswersHandler(
194  $this->poll_block->getPoll(),
195  $this->getVoteURL(),
196  'vote'
197  );
199  $this->poll_block->getPoll(),
200  $answers
201  );
202  return new ilPollContentRenderer(
203  $this->lng,
204  $this->ui_factory,
205  $this->ui_renderer,
206  $this->refinery,
207  $this->state,
208  $this->comments,
209  $answers,
211  $this->lng,
212  $this->refinery
213  ),
214  $results,
216  $this->getRefId(),
217  $this->refinery,
218  $this->data_factory,
219  $this->ui_factory,
220  $this->ui_renderer,
221  $this->lng
222  ),
223  $this->poll_image_factory
224  );
225  }
$results
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initJS()

ilPollBlockGUI::initJS ( )
protected

Definition at line 227 of file class.ilPollBlockGUI.php.

Referenced by fillRow().

227  : void
228  {
229  if (!self::$js_init) {
230  $this->main_tpl->addJavaScript("assets/js/ilPoll.js");
231  self::$js_init = true;
232  }
233  }
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilPollBlockGUI::isRepositoryObject ( )
protected

Definition at line 79 of file class.ilPollBlockGUI.php.

79  : bool
80  {
81  return true;
82  }

◆ setBlock()

ilPollBlockGUI::setBlock ( ilPollBlock  $a_block)

Definition at line 89 of file class.ilPollBlockGUI.php.

References ilCustomBlock\getId(), and ilBlockGUI\setBlockId().

89  : void
90  {
91  $this->setBlockId((string) $a_block->getId());
92  $this->poll_block = $a_block;
93  }
setBlockId(string $a_block_id="0")
+ Here is the call graph for this function:

Field Documentation

◆ $block_type

string ilPollBlockGUI::$block_type = "poll"
static

Definition at line 36 of file class.ilPollBlockGUI.php.

◆ $comments

ilPollCommentsHandler ilPollBlockGUI::$comments
protected

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

◆ $data_factory

DataFactory ilPollBlockGUI::$data_factory
protected

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

◆ $js_init

bool ilPollBlockGUI::$js_init = false
static

Definition at line 38 of file class.ilPollBlockGUI.php.

◆ $poll_block

ilPollBlock ilPollBlockGUI::$poll_block
protected

Definition at line 37 of file class.ilPollBlockGUI.php.

◆ $poll_image_factory

ilPollImageFactoryInterface ilPollBlockGUI::$poll_image_factory
protected

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

◆ $refinery

Refinery ilPollBlockGUI::$refinery
protected

Definition at line 41 of file class.ilPollBlockGUI.php.

◆ $state

ilPollStateInfo ilPollBlockGUI::$state
protected

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

◆ $ui_factory

UIFactory ilPollBlockGUI::$ui_factory
protected

Definition at line 39 of file class.ilPollBlockGUI.php.

◆ $ui_renderer

UIRenderer ilPollBlockGUI::$ui_renderer
protected

Definition at line 40 of file class.ilPollBlockGUI.php.


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