ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 Constructor. More...
 
 getBlockType ()
 
 setBlock ($a_block)
 Do most of the initialisation. More...
 
 executeCommand ()
 execute command More...
 
 fillRow ($a_poll)
 
 getHTML ()
 Get block HTML code. More...
 
 getNumberOfCommentsForRedraw ()
 Returns comment count for JS Redraw. More...
 
 getNumberOfComments ($ref_id)
 Get comment count. More...
 
 fillDataSection ()
 Fill data section. More...
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __construct ()
 Constructor. More...
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setPresentation (int $type)
 Set presentation. More...
 
 getPresentation ()
 Get presentation type. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands (bool $a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 getHTML ()
 Get HTML. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($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 ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getHTMLNew ()
 Get HTML. More...
 

Static Public Member Functions

static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Static Public Attributes

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

Protected Member Functions

 isRepositoryObject ()
 
 getRepositoryObjectGUIName ()
 Get repository object GUI name. More...
 
 getLegacyContent ()
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 initCommands ()
 Init commands. More...
 
 fillRowColor ($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...
 
 getNoItemFoundContent ()
 No item entry. More...
 

Protected Attributes

 $poll_block
 
 $new_rendering = true
 
- Protected Attributes inherited from ilBlockGUI
 $ui
 
 $data = array()
 
 $enablenuminfo = true
 
 $footer_links = array()
 
 $block_id = 0
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $title = ""
 
 $admincommands = false
 
 $dropdown
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 
 $presentation
 
 $new_rendering = false
 

Private Member Functions

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

Additional Inherited Members

- 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
 

Detailed Description

BlockGUI class for polls.

Author
Jörg Lützenkirchen
Version
$Id$

ilPollBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPollBlockGUI::__construct ( )

Constructor.

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

References $DIC, ilBlockGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ilBlockGUI\setRowTemplate(), and user().

29  {
30  global $DIC;
31 
32  $this->lng = $DIC->language();
33  $this->ctrl = $DIC->ctrl();
34  $this->user = $DIC->user();
35  $this->access = $DIC->access();
36  $lng = $DIC->language();
37 
39 
40  $lng->loadLanguageModule("poll");
41  $this->setRowTemplate("tpl.block.html", "Modules/Poll");
42  }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
+ Here is the call graph for this function:

Member Function Documentation

◆ commentJSCall()

ilPollBlockGUI::commentJSCall ( )
private

Builds JavaScript Call to open CommentLayer via html link.

Returns
string jsCall

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

References $comment, $refId, ilObject2\_lookupObjectId(), ilCommonActionDispatcherGUI\buildAjaxHash(), ilBlockGUI\getRefId(), and ilCommonActionDispatcherGUI\TYPE_REPOSITORY.

Referenced by fillRow().

452  {
453  include_once("./Services/Notes/classes/class.ilNoteGUI.php");
454  include_once("./Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
455 
456  $refId = $this->getRefId();
457  $objectId = ilObject2::_lookupObjectId($refId);
458 
461  $refId,
462  "poll",
463  $objectId
464  );
465 
466 
467  $comment = new ilNoteGUI();
468  $jsCall = $comment->getListCommentsJSCall($ajaxHash, "ilPoll.redrawComments(" . $refId . ");");
469 
470  return $jsCall;
471  }
static _lookupObjectId($a_ref_id)
$refId
Definition: xapitoken.php:40
Notes GUI class.
$comment
Definition: buildRTE.php:83
static buildAjaxHash( $a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null, $a_news_id=0)
Build ajax hash.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPollBlockGUI::executeCommand ( )

execute command

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

References ilBlockGUI\$ctrl.

91  {
92  $ilCtrl = $this->ctrl;
93 
94  $next_class = $ilCtrl->getNextClass();
95  $cmd = $ilCtrl->getCmd("getHTML");
96 
97  switch ($next_class) {
98  default:
99  return $this->$cmd();
100  }
101  }

◆ fillDataSection()

ilPollBlockGUI::fillDataSection ( )

Fill data section.

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

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

513  {
514  $this->setDataSection($this->getLegacyContent());
515  }
setDataSection($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 (   $a_poll)

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

References $_SESSION, ilBlockGUI\$ctrl, $ilUser, $img, ilBlockGUI\$lng, ilBlockGUI\$main_tpl, $total, ilBlockGUI\$tpl, $url, ilBlockGUI\$user, ANONYMOUS_USER_ID, commentJSCall(), ilDatePresentation\formatDate(), ilProgressBar\getInstance(), ilChart\getInstanceByType(), getNumberOfComments(), ilBlockGUI\getRefId(), getRepositoryObjectGUIName(), IL_CAL_UNIX, ilDatePresentation\setUseRelativeDates(), ilObjPoll\SHOW_RESULTS_AS_PIECHART, ilWACSignedPath\signFile(), ilUtil\sortArray(), and ilDatePresentation\useRelativeDates().

Referenced by getLegacyContent().

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

◆ getBlockType()

ilPollBlockGUI::getBlockType ( )

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

47  : string
48  {
49  return self::$block_type;
50  }

◆ getHTML()

ilPollBlockGUI::getHTML ( )

Get block HTML code.

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

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

375  {
376  $ilCtrl = $this->ctrl;
377  $lng = $this->lng;
378  $ilAccess = $this->access;
380 
381  $this->poll_block->setRefId($this->getRefId());
382  $this->may_write = $ilAccess->checkAccess("write", "", $this->getRefId());
383  $this->has_content = $this->poll_block->hasAnyContent($ilUser->getId(), $this->getRefId());
384 
385  #22078 and 22079 it always contains something.
386  /*if(!$this->may_write && !$this->has_content)
387  {
388  return "";
389  }*/
390 
391  $poll_obj = $this->poll_block->getPoll();
392  $this->setTitle($poll_obj->getTitle());
393  $this->setData(array($poll_obj));
394 
395  $ilCtrl->setParameterByClass(
397  "ref_id",
398  $this->getRefId()
399  );
400 
401  if (!$this->poll_block->getMessage($ilUser->getId())) {
402  // notification
403  include_once "./Services/Notification/classes/class.ilNotification.php";
404  if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->poll_block->getPoll()->getId())) {
405  $this->addBlockCommand(
406  $ilCtrl->getLinkTargetByClass(
407  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
408  "unsubscribe"
409  ),
410  $lng->txt("poll_notification_unsubscribe")
411  );
412  } else {
413  $this->addBlockCommand(
414  $ilCtrl->getLinkTargetByClass(
415  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
416  "subscribe"
417  ),
418  $lng->txt("poll_notification_subscribe")
419  );
420  }
421  }
422 
423  if ($this->may_write) {
424  // edit
425  $this->addBlockCommand(
426  $ilCtrl->getLinkTargetByClass(
427  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
428  "render"
429  ),
430  $lng->txt("edit_content")
431  );
432  $this->addBlockCommand(
433  $ilCtrl->getLinkTargetByClass(
434  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
435  "edit"
436  ),
437  $lng->txt("settings")
438  );
439  }
440 
441  $ilCtrl->clearParametersByClass($this->getRepositoryObjectGUIName());
442 
443  return parent::getHTML();
444  }
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
getRepositoryObjectGUIName()
Get repository object GUI name.
setTitle($a_title)
Set Title.
setData($a_data)
Set Data.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
$ilUser
Definition: imgupload.php:18
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
+ Here is the call graph for this function:

◆ getLegacyContent()

ilPollBlockGUI::getLegacyContent ( )
protected

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

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

Referenced by fillDataSection().

527  : string
528  {
529  $this->tpl = new ilTemplate(
530  $this->getRowTemplateName(),
531  true,
532  true,
533  $this->getRowTemplateDir()
534  );
535  $this->fillRow(current($this->getData()));
536  return $this->tpl->get();
537  }
getRowTemplateDir()
Get Row Template Directory.
getData()
Get Data.
getRowTemplateName()
Get Row Template Name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumberOfComments()

ilPollBlockGUI::getNumberOfComments (   $ref_id)

Get comment count.

Parameters
int$ref_id
Returns
int

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

References ilNote\_countNotesAndComments(), ilObject2\_lookupObjectId(), and IL_NOTE_PUBLIC.

Referenced by fillRow(), and getNumberOfCommentsForRedraw().

496  {
497  include_once("./Services/Notes/classes/class.ilNote.php");
498 
501 
502  if (count($number) == 0) {
503  return 0;
504  }
505 
506  return $number[$obj_id][IL_NOTE_PUBLIC];
507  }
static _lookupObjectId($a_ref_id)
static _countNotesAndComments( $a_rep_obj_id, $a_sub_obj_id=null, $a_obj_type="", $a_news_id=0)
Get all notes related to a specific object.
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumberOfCommentsForRedraw()

ilPollBlockGUI::getNumberOfCommentsForRedraw ( )

Returns comment count for JS Redraw.

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

References $_GET, exit, and getNumberOfComments().

477  {
478  $number = $this->getNumberOfComments($_GET["poll_id"]);
479 
480  if ($number > 0) {
481  echo "(" . $number . ")";
482  } else {
483  echo "";
484  }
485 
486  exit();
487  }
exit
Definition: login.php:29
$_GET["client_id"]
getNumberOfComments($ref_id)
Get comment count.
+ Here is the call graph for this function:

◆ getRepositoryObjectGUIName()

ilPollBlockGUI::getRepositoryObjectGUIName ( )
protected

Get repository object GUI name.

Returns
string

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

Referenced by fillRow(), and getHTML().

66  {
67  return "ilobjpollgui";
68  }
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPollBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

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

References IL_SCREEN_SIDE.

74  {
75  return IL_SCREEN_SIDE;
76  }
const IL_SCREEN_SIDE

◆ isRepositoryObject()

ilPollBlockGUI::isRepositoryObject ( )
protected

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

55  : bool
56  {
57  return true;
58  }

◆ setBlock()

ilPollBlockGUI::setBlock (   $a_block)

Do most of the initialisation.

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

References ilBlockGUI\setBlockId().

82  {
83  $this->setBlockId($a_block->getId());
84  $this->poll_block = $a_block;
85  }
setBlockId($a_block_id=0)
Set Block Id.
+ Here is the call graph for this function:

Field Documentation

◆ $block_type

ilPollBlockGUI::$block_type = "poll"
static

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

◆ $js_init

ilPollBlockGUI::$js_init = false
static

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

◆ $new_rendering

ilPollBlockGUI::$new_rendering = true
protected

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

◆ $poll_block

ilPollBlockGUI::$poll_block
protected

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


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