ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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 ()
 
 getNumberOfComments (int $ref_id)
 
 fillDataSection ()
 
- 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 ()
 
 correctOffset ()
 
 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="")
 
 getBlockCommands ()
 
 getHTML ()
 
 fillHeaderCommands ()
 
 fillHeaderTitleBlock ()
 
 setDataSection (string $a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow (array $a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 
 setPreviousNextLinks ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getHTMLNew ()
 
 getNoItemFoundContent ()
 

Static Public Attributes

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

Protected Member Functions

 isRepositoryObject ()
 
 getRepositoryObjectGUIName ()
 
 getLegacyContent ()
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 specialCharsAsEntities (string $string)
 
 initCommands ()
 
 fillRowColor (string $a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getViewControls ()
 Get view controls. 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...
 
 send (string $output)
 Send. More...
 

Protected Attributes

ILIAS Notes Service $notes
 
ilPollBlock $poll_block
 
ViewManager $container_view_manager
 
bool $new_rendering = true
 
GlobalHttpState $http
 
Factory $refinery
 
- Protected Attributes inherited from ilBlockGUI
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
 
bool $new_rendering = false
 

Private Member Functions

 commentJSCall ()
 Builds JavaScript Call to open CommentLayer via html link. More...
 

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 31 of file class.ilPollBlockGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPollBlockGUI::__construct ( )

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

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

46  {
47  global $DIC;
48 
49  $this->lng = $DIC->language();
50  $this->ctrl = $DIC->ctrl();
51  $this->user = $DIC->user();
52  $this->access = $DIC->access();
53 
55 
56  $this->lng->loadLanguageModule("poll");
57  $this->setRowTemplate("tpl.block.html", "Modules/Poll");
58 
59  $this->container_view_manager = $DIC
60  ->container()
61  ->internal()
62  ->domain()
63  ->content()
64  ->view();
65  $this->http = $DIC->http();
66  $this->refinery = $DIC->refinery();
67  $this->notes = $DIC->notes();
68  }
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ commentJSCall()

ilPollBlockGUI::commentJSCall ( )
private

Builds JavaScript Call to open CommentLayer via html link.

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

References $refId, ilObject\_lookupObjectId(), ilCommonActionDispatcherGUI\buildAjaxHash(), ilNoteGUI\getListCommentsJSCall(), ilBlockGUI\getRefId(), and ilCommonActionDispatcherGUI\TYPE_REPOSITORY.

Referenced by fillRow().

441  : string
442  {
443  $refId = $this->getRefId();
444  $objectId = ilObject2::_lookupObjectId($refId);
445 
448  $refId,
449  "poll",
450  $objectId
451  );
452 
453 
454  return ilNoteGUI::getListCommentsJSCall($ajaxHash, "ilPoll.redrawComments(" . $refId . ");");
455  }
$refId
Definition: xapitoken.php:58
static _lookupObjectId(int $ref_id)
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPollBlockGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

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

◆ fillDataSection()

ilPollBlockGUI::fillDataSection ( )

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

References getLegacyContent(), and ilBlockGUI\setDataSection().

487  : void
488  {
489  $this->setDataSection($this->getLegacyContent());
490  }
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
+ Here is the call graph for this function:

◆ fillRow()

ilPollBlockGUI::fillRow ( array  $a_set)

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

References $id, $img, $url, ANONYMOUS_USER_ID, commentJSCall(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilSession\get(), ilProgressBar\getInstance(), ilChart\getInstanceByType(), getNumberOfComments(), ilBlockGUI\getRefId(), getRepositoryObjectGUIName(), IL_CAL_UNIX, ILIAS\Repository\int(), ILIAS\Repository\lng(), ilSession\set(), ilDatePresentation\setUseRelativeDates(), ilObjPoll\SHOW_RESULTS_AS_PIECHART, ilWACSignedPath\signFile(), ilArrayUtil\sortArray(), ilBlockGUI\specialCharsAsEntities(), ilChart\TYPE_PIE, ILIAS\Repository\user(), and ilDatePresentation\useRelativeDates().

Referenced by getLegacyContent().

106  : void
107  {
108  // todo: Refactoring needed
109  $a_set = $a_set[0];
110 
111  // handle messages
112 
113  $mess = $this->poll_block->getMessage($this->user->getId());
114  if ($mess) {
115  $this->tpl->setVariable("TXT_QUESTION", $mess);
116  return;
117  }
118 
119 
120  // nested form problem
121  if (!$this->container_view_manager->isAdminView()) {
122  // vote
123 
124  if ($this->poll_block->maySeeQuestion($this->user->getId())) {
125  $this->tpl->setCurrentBlock("mode_info_bl");
126  if ($this->poll_block->getPoll()->getNonAnonymous()) {
127  $mode_info = $this->lng->txt("poll_non_anonymous_warning");
128  } else {
129  $mode_info = $this->lng->txt("poll_anonymous_warning");
130  }
131  $this->tpl->setVariable("MODE_INFO", $mode_info);
132  $this->tpl->parseCurrentBlock();
133 
134  $is_multi_answer = ($this->poll_block->getPoll()->getMaxNumberOfAnswers() > 1);
135 
136  $session_last_poll_vote = ilSession::get('last_poll_vote');
137  if (isset($session_last_poll_vote[$this->poll_block->getPoll()->getId()])) {
138  $last_vote = $session_last_poll_vote[$this->poll_block->getPoll()->getId()];
139  unset($session_last_poll_vote[$this->poll_block->getPoll()->getId()]);
140  ilSession::set('last_poll_vote', $session_last_poll_vote);
141 
142  if ($is_multi_answer) {
143  $error = sprintf(
144  $this->lng->txt("poll_vote_error_multi"),
145  $this->poll_block->getPoll()->getMaxNumberOfAnswers()
146  );
147  } else {
148  $error = $this->lng->txt("poll_vote_error_single");
149  }
150 
151  $this->tpl->setCurrentBlock("error_bl");
152  $this->tpl->setVariable("FORM_ERROR", $error);
153  $this->tpl->parseCurrentBlock();
154  }
155 
156  $this->tpl->setCurrentBlock("answer");
157  foreach ($a_set->getAnswers() as $item) {
158  $status = [];
159  $id = (int) ($item['id'] ?? 0);
160  $answer = (string) ($item['answer'] ?? 0);
161  if (!$is_multi_answer) {
162  $this->tpl->setVariable("ANSWER_INPUT", "radio");
163  $this->tpl->setVariable("ANSWER_NAME", "aw");
164  } else {
165  $this->tpl->setVariable("ANSWER_INPUT", "checkbox");
166  $this->tpl->setVariable("ANSWER_NAME", "aw[]");
167 
168  if (!empty($last_vote) && is_array($last_vote) && in_array($id, $last_vote)) {
169  $status[] = 'checked="checked"';
170  }
171  }
172 
173  if (!$this->poll_block->mayVote($this->user->getId())) {
174  $status[] = 'disabled';
175  }
176 
177  if (!empty($status)) {
178  $this->tpl->setVariable("ANSWER_STATUS", implode(' ', $status));
179  }
180 
181  $this->tpl->setVariable("VALUE_ANSWER", $id);
182  $this->tpl->setVariable("TXT_ANSWER_VOTE", $this->specialCharsAsEntities(nl2br($answer)));
183  $this->tpl->parseCurrentBlock();
184  }
185 
186  if ($this->poll_block->mayVote($this->user->getId())) {
187  $this->ctrl->setParameterByClass(
189  "ref_id",
190  $this->getRefId()
191  );
192  $url = $this->ctrl->getLinkTargetByClass(
193  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
194  "vote"
195  );
196  $this->ctrl->clearParametersByClass($this->getRepositoryObjectGUIName());
197 
198  $url .= "#poll" . $a_set->getID();
199 
200  $this->tpl->setVariable("URL_FORM", $url);
201  $this->tpl->setVariable("CMD_FORM", "vote");
202  $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("poll_vote"));
203  }
204 
205  if ($this->poll_block->getPoll()->getVotingPeriod()) {
206  $this->tpl->setVariable(
207  "TXT_VOTING_END_PERIOD",
208  sprintf(
209  $this->lng->txt("poll_voting_period_info"),
210  ilDatePresentation::formatDate(new ilDateTime($this->poll_block->getPoll()->getVotingPeriodEnd(), IL_CAL_UNIX))
211  )
212  );
213  }
214  }
215 
216 
217  // result
218  if ($this->poll_block->maySeeResults($this->user->getId())) {
219  if (!$this->poll_block->mayNotResultsYet()) {
220  $answers = [];
221  foreach ($a_set->getAnswers() as $item) {
222  $id = (int) ($item['id'] ?? 0);
223  $answers[$id] = (string) ($item['answer'] ?? 0);
224  }
225 
226  $perc = $this->poll_block->getPoll()->getVotePercentages();
227  $total = (int) ($perc['total'] ?? 0);
228  $perc = (array) ($perc['perc'] ?? []);
229 
230  $this->tpl->setVariable("TOTAL_ANSWERS", sprintf($this->lng->txt("poll_population"), $total));
231 
232  if ($total) {
233  // sort results by votes / original position
234  if ($this->poll_block->getPoll()->getSortResultByVotes()) {
235  $order = array_keys(ilArrayUtil::sortArray($perc, "abs", "desc", true, true));
236 
237  foreach (array_keys($answers) as $answer_id) {
238  if (!in_array($answer_id, $order)) {
239  $order[] = $answer_id;
240  }
241  }
242  } else {
243  $order = array_keys($answers);
244  }
245 
246  // pie chart
247  if ($this->poll_block->showResultsAs() === ilObjPoll::SHOW_RESULTS_AS_PIECHART) {
248  $chart = ilChart::getInstanceByType(ilChart::TYPE_PIE, "poll_results_pie_" . $this->getRefId());
249  $chart->setSize("400", "200");
250  $chart->setAutoResize(true);
251 
252  $chart_data = $chart->getDataInstance();
253 
254  foreach ($order as $answer_id) {
255  $chart_data->addPiePoint(
256  (int) round((float) ($perc[$answer_id]["perc"] ?? 0)),
257  nl2br((string) ($answers[$answer_id] ?? ''))
258  );
259  }
260 
261  // disable legend, use inner labels - currently not preferred
262  // $chart_data->setLabelRadius(0.8);
263 
264  $chart->addData($chart_data);
265 
266  $pie_legend_id = "poll_legend_" . $this->getRefId();
267  $legend = new ilChartLegend();
268  $legend->setContainer($pie_legend_id);
269  $chart->setLegend($legend);
270 
271  $this->tpl->setVariable("PIE_LEGEND_ID", $pie_legend_id);
272  $this->tpl->setVariable("PIE_CHART", $chart->getHTML());
273  } // bar chart
274  else {
275  $this->tpl->setCurrentBlock("answer_result");
276  foreach ($order as $answer_id) {
277  $pbar = ilProgressBar::getInstance();
278  $pbar->setCurrent(round((float) ($perc[$answer_id]["perc"] ?? 0)));
279  $this->tpl->setVariable("PERC_ANSWER_RESULT", $pbar->render());
280  $this->tpl->setVariable("TXT_ANSWER_RESULT", nl2br((string) ($answers[$answer_id] ?? '')));
281  $this->tpl->parseCurrentBlock();
282  }
283  }
284  }
285  } else {
288  $end = $this->poll_block->getPoll()->getVotingPeriodEnd();
291 
292  // #14607
293  $info = "";
294  if ($this->poll_block->getPoll()->hasUserVoted($this->user->getId())) {
295  $info .= $this->lng->txt("poll_block_message_already_voted") . " ";
296  }
297 
298  $this->tpl->setVariable("TOTAL_ANSWERS", $info .
299  sprintf($this->lng->txt("poll_block_results_available_on"), $end));
300  }
301  } elseif ($this->poll_block->getPoll()->hasUserVoted($this->user->getId())) {
302  $this->tpl->setVariable("TOTAL_ANSWERS", $this->lng->txt("poll_block_message_already_voted"));
303  }
304  }
305 
306  if (!$this->poll_block->maySeeQuestion($this->user->getId()) && !$this->poll_block->getPoll()->hasUserVoted($this->user->getId())) {
307  if ($this->poll_block->getPoll()->getVotingPeriod()) {
308  $this->tpl->setVariable(
309  "TXT_VOTING_PERIOD",
310  sprintf(
311  $this->lng->txt("poll_voting_period_full_info"),
312  ilDatePresentation::formatDate(new ilDateTime($this->poll_block->getPoll()->getVotingPeriodBegin(), IL_CAL_UNIX)),
313  ilDatePresentation::formatDate(new ilDateTime($this->poll_block->getPoll()->getVotingPeriodEnd(), IL_CAL_UNIX))
314  )
315  );
316  }
317  } else {
318  $this->tpl->setVariable("TXT_QUESTION", $this->specialCharsAsEntities(nl2br(trim($a_set->getQuestion()))));
319 
320  $img = $a_set->getImageFullPath();
321  if ($img) {
322  $this->tpl->setVariable("URL_IMAGE", ilWACSignedPath::signFile($img));
323  }
324  }
325 
326 
327  $this->tpl->setVariable("ANCHOR_ID", $a_set->getID());
328 
329  $desc = trim($a_set->getDescription());
330  if ($desc) {
331  $this->tpl->setVariable("TXT_DESC", $this->specialCharsAsEntities(nl2br($desc)));
332  }
333 
334 
335  if ($this->user->getId() == ANONYMOUS_USER_ID) {
336  $this->tpl->setCurrentBlock("anon_warning");
337  $this->tpl->setVariable("ANON_WARNING", $this->lng->txt('no_access_item_public'));
338  $this->tpl->parseCurrentBlock();
339  }
340 
341 
342  if ($this->poll_block->showComments()) {
343  $this->tpl->setCurrentBlock("comment_link");
344  $this->tpl->setVariable("LANG_COMMENTS", $this->lng->txt('poll_comments'));
345  $this->tpl->setVariable("COMMENT_JSCALL", $this->commentJSCall());
346  $this->tpl->setVariable("COMMENTS_COUNT_ID", $this->getRefId());
347 
348  $comments_count = $this->getNumberOfComments($this->getRefId());
349 
350  if ($comments_count > 0) {
351  $this->tpl->setVariable("COMMENTS_COUNT", "(" . $comments_count . ")");
352  }
353 
354  if (!self::$js_init) {
355  $redraw_url = $this->ctrl->getLinkTarget(
356  $this,
357  "getNumberOfCommentsForRedraw",
358  "",
359  true
360  );
361  $this->tpl->setVariable("COMMENTS_REDRAW_URL", $redraw_url);
362 
363  $this->main_tpl->addJavaScript("Modules/Poll/js/ilPoll.js");
364  self::$js_init = true;
365  }
366  }
367  }
static get(string $a_var)
commentJSCall()
Builds JavaScript Call to open CommentLayer via html link.
const ANONYMOUS_USER_ID
Definition: constants.php:27
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SHOW_RESULTS_AS_PIECHART
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
specialCharsAsEntities(string $string)
const IL_CAL_UNIX
getNumberOfComments(int $ref_id)
const TYPE_PIE
$img
Definition: imgupload.php:83
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static signFile(string $path_to_file)
$url
static setUseRelativeDates(bool $a_status)
set use relative dates
static set(string $a_var, $a_val)
Set a value.
static getInstanceByType(int $a_type, string $a_id)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBlockType()

ilPollBlockGUI::getBlockType ( )

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

70  : string
71  {
72  return self::$block_type;
73  }

◆ getHTML()

ilPollBlockGUI::getHTML ( )

Definition at line 369 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().

369  : string
370  {
371  $this->poll_block->setRefId($this->getRefId());
372  $may_write = $this->access->checkAccess("write", "", $this->getRefId());
373  $has_content = $this->poll_block->hasAnyContent($this->user->getId(), $this->getRefId());
374 
375  #22078 and 22079 it always contains something.
376  /*if(!$may_write && !$has_content)
377  {
378  return "";
379  }*/
380 
381  $poll_obj = $this->poll_block->getPoll();
382  $this->setTitle($poll_obj->getTitle());
383  $this->setData(array(array($poll_obj)));
384 
385  $this->ctrl->setParameterByClass(
387  "ref_id",
388  $this->getRefId()
389  );
390 
391  if (
392  !$this->poll_block->getMessage($this->user->getId()) &&
393  !$this->user->isAnonymous()
394  ) {
395  // notification
396  if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $this->user->getId(), $this->poll_block->getPoll()->getId())) {
397  $this->addBlockCommand(
398  $this->ctrl->getLinkTargetByClass(
399  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
400  "unsubscribe"
401  ),
402  $this->lng->txt("poll_notification_unsubscribe")
403  );
404  } else {
405  $this->addBlockCommand(
406  $this->ctrl->getLinkTargetByClass(
407  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
408  "subscribe"
409  ),
410  $this->lng->txt("poll_notification_subscribe")
411  );
412  }
413  }
414 
415  if ($may_write) {
416  // edit
417  $this->addBlockCommand(
418  $this->ctrl->getLinkTargetByClass(
419  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
420  "render"
421  ),
422  $this->lng->txt("edit_content")
423  );
424  $this->addBlockCommand(
425  $this->ctrl->getLinkTargetByClass(
426  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
427  "edit"
428  ),
429  $this->lng->txt("settings")
430  );
431  }
432 
433  $this->ctrl->clearParametersByClass($this->getRepositoryObjectGUIName());
434 
435  return parent::getHTML();
436  }
setTitle(string $a_title)
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
setData(array $a_data)
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
+ Here is the call graph for this function:

◆ getLegacyContent()

ilPollBlockGUI::getLegacyContent ( )
protected

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

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

Referenced by fillDataSection().

499  : string
500  {
501  $this->tpl = new ilTemplate(
502  $this->getRowTemplateName(),
503  true,
504  true,
505  $this->getRowTemplateDir()
506  );
507  $this->fillRow(current($this->getData()));
508  return $this->tpl->get();
509  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumberOfComments()

ilPollBlockGUI::getNumberOfComments ( int  $ref_id)

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

References $context, and ilObject\_lookupObjectId().

Referenced by fillRow(), and getNumberOfCommentsForRedraw().

480  : int
481  {
483  $context = $this->notes->data()->context($obj_id, 0, "poll");
484  return $this->notes->domain()->getNrOfCommentsForContext($context);
485  }
$context
Definition: webdav.php:29
$ref_id
Definition: ltiauth.php:67
static _lookupObjectId(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumberOfCommentsForRedraw()

ilPollBlockGUI::getNumberOfCommentsForRedraw ( )

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

References $DIC, exit, getNumberOfComments(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

457  : void
458  {
459  global $DIC;
460 
461  $poll_id = 0;
462  if ($this->http->wrapper()->query()->has('poll_id')) {
463  $poll_id = $this->http->wrapper()->query()->retrieve(
464  'poll_id',
465  $this->refinery->kindlyTo()->int()
466  );
467  }
468 
469  $number = $this->getNumberOfComments($poll_id);
470 
471  if ($number > 0) {
472  echo "(" . $number . ")";
473  } else {
474  echo "";
475  }
476 
477  exit();
478  }
exit
Definition: login.php:28
getNumberOfComments(int $ref_id)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getRepositoryObjectGUIName()

ilPollBlockGUI::getRepositoryObjectGUIName ( )
protected

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

Referenced by fillRow(), and getHTML().

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

◆ isRepositoryObject()

ilPollBlockGUI::isRepositoryObject ( )
protected

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

78  : bool
79  {
80  return true;
81  }

◆ setBlock()

ilPollBlockGUI::setBlock ( ilPollBlock  $a_block)

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

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

88  : void
89  {
90  $this->setBlockId((string) $a_block->getId());
91  $this->poll_block = $a_block;
92  }
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 33 of file class.ilPollBlockGUI.php.

◆ $container_view_manager

ViewManager ilPollBlockGUI::$container_view_manager
protected

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

◆ $http

GlobalHttpState ilPollBlockGUI::$http
protected

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

◆ $js_init

bool ilPollBlockGUI::$js_init = false
static

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

◆ $new_rendering

bool ilPollBlockGUI::$new_rendering = true
protected

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

◆ $notes

ILIAS Notes Service ilPollBlockGUI::$notes
protected

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

◆ $poll_block

ilPollBlock ilPollBlockGUI::$poll_block
protected

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

◆ $refinery

Factory ilPollBlockGUI::$refinery
protected

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


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