ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
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 432 of file class.ilPollBlockGUI.php.

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

Referenced by fillRow().

433  {
434  include_once("./Services/Notes/classes/class.ilNoteGUI.php");
435  include_once("./Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
436 
437  $refId = $this->getRefId();
438  $objectId = ilObject2::_lookupObjectId($refId);
439 
442  $refId,
443  "poll",
444  $objectId
445  );
446 
447 
448  $comment = new ilNoteGUI();
449  $jsCall = $comment->getListCommentsJSCall($ajaxHash, "ilPoll.redrawComments(" . $refId . ");");
450 
451  return $jsCall;
452  }
static _lookupObjectId($a_ref_id)
$refId
Definition: xapitoken.php:42
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, and $ilCtrl.

91  {
93 
94  $next_class = $ilCtrl->getNextClass();
95  $cmd = $ilCtrl->getCmd("getHTML");
96 
97  switch ($next_class) {
98  default:
99  return $this->$cmd();
100  }
101  }
global $ilCtrl
Definition: ilias.php:18

◆ fillDataSection()

ilPollBlockGUI::fillDataSection ( )

Fill data section.

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

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

494  {
495  $this->setDataSection($this->getLegacyContent());
496  }
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, $ilCtrl, $ilUser, $img, ilBlockGUI\$lng, ilBlockGUI\$main_tpl, $total, ilBlockGUI\$tpl, $url, ilBlockGUI\$user, 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  {
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->mayVote($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  if (!$is_multi_answer) {
157  $this->tpl->setVariable("ANSWER_INPUT", "radio");
158  $this->tpl->setVariable("ANSWER_NAME", "aw");
159  } else {
160  $this->tpl->setVariable("ANSWER_INPUT", "checkbox");
161  $this->tpl->setVariable("ANSWER_NAME", "aw[]");
162 
163  if (is_array($last_vote) && in_array($item["id"], $last_vote)) {
164  $this->tpl->setVariable("ANSWER_STATUS", 'checked="checked"');
165  }
166  }
167  $this->tpl->setVariable("VALUE_ANSWER", $item["id"]);
168  $this->tpl->setVariable("TXT_ANSWER_VOTE", nl2br($item["answer"]));
169  $this->tpl->parseCurrentBlock();
170  }
171 
172  $ilCtrl->setParameterByClass(
174  "ref_id",
175  $this->getRefId()
176  );
177  $url = $ilCtrl->getLinkTargetByClass(
178  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
179  "vote"
180  );
181  $ilCtrl->clearParametersByClass($this->getRepositoryObjectGUIName());
182 
183  $url .= "#poll" . $a_poll->getID();
184 
185  $this->tpl->setVariable("URL_FORM", $url);
186  $this->tpl->setVariable("CMD_FORM", "vote");
187  $this->tpl->setVariable("TXT_SUBMIT", $lng->txt("poll_vote"));
188 
189  if ($this->poll_block->getPoll()->getVotingPeriod()) {
190  $this->tpl->setVariable(
191  "TXT_VOTING_END_PERIOD",
192  sprintf(
193  $lng->txt("poll_voting_period_info"),
194  ilDatePresentation::formatDate(new ilDateTime($this->poll_block->getPoll()->getVotingPeriodEnd(), IL_CAL_UNIX))
195  )
196  );
197  }
198  }
199 
200 
201  // result
202  if ($this->poll_block->maySeeResults($ilUser->getId())) {
203  if (!$this->poll_block->mayNotResultsYet($ilUser->getId())) {
204  $answers = array();
205  foreach ($a_poll->getAnswers() as $item) {
206  $answers[$item["id"]] = $item["answer"];
207  }
208 
209  $perc = $this->poll_block->getPoll()->getVotePercentages();
210  $total = $perc["total"];
211  $perc = $perc["perc"];
212 
213  $this->tpl->setVariable("TOTAL_ANSWERS", sprintf($lng->txt("poll_population"), $total));
214 
215  if ($total) {
216  // sort results by votes / original position
217  if ($this->poll_block->getPoll()->getSortResultByVotes()) {
218  $order = array_keys(ilUtil::sortArray($perc, "abs", "desc", true, true));
219 
220  foreach (array_keys($answers) as $answer_id) {
221  if (!in_array($answer_id, $order)) {
222  $order[] = $answer_id;
223  }
224  }
225  } else {
226  $order = array_keys($answers);
227  }
228 
229  // pie chart
230  if ($this->poll_block->showResultsAs() == ilObjPoll::SHOW_RESULTS_AS_PIECHART) {
231  include_once("./Services/Chart/classes/class.ilChart.php");
232 
233  $chart = ilChart::getInstanceByType(ilCHart::TYPE_PIE, "poll_results_pie_" . $this->getRefId());
234  $chart->setSize("100%", 200);
235  $chart->setAutoResize(true);
236 
237  $chart_data = $chart->getDataInstance();
238 
239  foreach ($order as $answer_id) {
240  $chart_data->addPoint(
241  round($perc[$answer_id]["perc"]),
242  nl2br($answers[$answer_id])
243  );
244  }
245 
246  // disable legend, use inner labels - currently not preferred
247  // $chart_data->setLabelRadius(0.8);
248 
249  $chart->addData($chart_data);
250 
251  $pie_legend_id = "poll_legend_" . $this->getRefId();
252  $legend = new ilChartLegend();
253  $legend->setContainer($pie_legend_id);
254  $chart->setLegend($legend);
255 
256  $this->tpl->setVariable("PIE_LEGEND_ID", $pie_legend_id);
257  $this->tpl->setVariable("PIE_CHART", $chart->getHTML());
258  } // bar chart
259  else {
260  include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
261 
262  $this->tpl->setCurrentBlock("answer_result");
263  foreach ($order as $answer_id) {
264  $pbar = ilProgressBar::getInstance();
265  $pbar->setCurrent(round($perc[$answer_id]["perc"]));
266  $this->tpl->setVariable("PERC_ANSWER_RESULT", $pbar->render());
267  $this->tpl->setVariable("TXT_ANSWER_RESULT", nl2br($answers[$answer_id]));
268  $this->tpl->parseCurrentBlock();
269  }
270  }
271  }
272  } else {
275  $end = $this->poll_block->getPoll()->getVotingPeriodEnd();
278 
279  // #14607
280  $info = "";
281  if ($this->poll_block->getPoll()->hasUserVoted($ilUser->getId())) {
282  $info .= $lng->txt("poll_block_message_already_voted") . " ";
283  }
284 
285  $this->tpl->setVariable("TOTAL_ANSWERS", $info .
286  sprintf($lng->txt("poll_block_results_available_on"), $end));
287  }
288  } elseif ($this->poll_block->getPoll()->hasUserVoted($ilUser->getId())) {
289  $this->tpl->setVariable("TOTAL_ANSWERS", $lng->txt("poll_block_message_already_voted"));
290  }
291  }
292 
293  if (!$this->poll_block->mayVote($ilUser->getId()) && !$this->poll_block->getPoll()->hasUserVoted($ilUser->getId())) {
294  if ($this->poll_block->getPoll()->getVotingPeriod()) {
295  $this->tpl->setVariable(
296  "TXT_VOTING_PERIOD",
297  sprintf(
298  $lng->txt("poll_voting_period_full_info"),
299  ilDatePresentation::formatDate(new ilDateTime($this->poll_block->getPoll()->getVotingPeriodBegin(), IL_CAL_UNIX)),
300  ilDatePresentation::formatDate(new ilDateTime($this->poll_block->getPoll()->getVotingPeriodEnd(), IL_CAL_UNIX))
301  )
302  );
303  }
304  } else {
305  $this->tpl->setVariable("TXT_QUESTION", nl2br(trim($a_poll->getQuestion())));
306 
307  $img = $a_poll->getImageFullPath();
308  if ($img) {
309  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
310  $this->tpl->setVariable("URL_IMAGE", ilWACSignedPath::signFile($img));
311  }
312  }
313 
314 
315  $this->tpl->setVariable("ANCHOR_ID", $a_poll->getID());
316  //$this->tpl->setVariable("TXT_QUESTION", nl2br(trim($a_poll->getQuestion())));
317 
318  $desc = trim($a_poll->getDescription());
319  if ($desc) {
320  $this->tpl->setVariable("TXT_DESC", nl2br($desc));
321  }
322 
323 
324  if ($this->poll_block->showComments()) {
325  $this->tpl->setCurrentBlock("comment_link");
326  $this->tpl->setVariable("LANG_COMMENTS", $lng->txt('poll_comments'));
327  $this->tpl->setVariable("COMMENT_JSCALL", $this->commentJSCall());
328  $this->tpl->setVariable("COMMENTS_COUNT_ID", $this->getRefId());
329 
330  $comments_count = $this->getNumberOfComments($this->getRefId());
331 
332  if ($comments_count > 0) {
333  $this->tpl->setVariable("COMMENTS_COUNT", "(" . $comments_count . ")");
334  }
335 
336  if (!self::$js_init) {
337  $redraw_url = $ilCtrl->getLinkTarget(
338  $this,
339  "getNumberOfCommentsForRedraw",
340  "",
341  true,
342  false
343  );
344  $this->tpl->setVariable("COMMENTS_REDRAW_URL", $redraw_url);
345 
346  $tpl->addJavaScript("Modules/Poll/js/ilPoll.js");
347  self::$js_init = true;
348  }
349  }
350  }
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.
$_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
global $ilCtrl
Definition: ilias.php:18
static getInstance()
Factory.
$ilUser
Definition: imgupload.php:18
static signFile($path_to_file)
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
$url
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 355 of file class.ilPollBlockGUI.php.

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

356  {
358  $lng = $this->lng;
359  $ilAccess = $this->access;
361 
362  $this->poll_block->setRefId($this->getRefId());
363  $this->may_write = $ilAccess->checkAccess("write", "", $this->getRefId());
364  $this->has_content = $this->poll_block->hasAnyContent($ilUser->getId(), $this->getRefId());
365 
366  #22078 and 22079 it always contains something.
367  /*if(!$this->may_write && !$this->has_content)
368  {
369  return "";
370  }*/
371 
372  $poll_obj = $this->poll_block->getPoll();
373  $this->setTitle($poll_obj->getTitle());
374  $this->setData(array($poll_obj));
375 
376  $ilCtrl->setParameterByClass(
378  "ref_id",
379  $this->getRefId()
380  );
381 
382  if (!$this->poll_block->getMessage($ilUser->getId())) {
383  // notification
384  include_once "./Services/Notification/classes/class.ilNotification.php";
385  if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->poll_block->getPoll()->getId())) {
386  $this->addBlockCommand(
387  $ilCtrl->getLinkTargetByClass(
388  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
389  "unsubscribe"
390  ),
391  $lng->txt("poll_notification_unsubscribe")
392  );
393  } else {
394  $this->addBlockCommand(
395  $ilCtrl->getLinkTargetByClass(
396  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
397  "subscribe"
398  ),
399  $lng->txt("poll_notification_subscribe")
400  );
401  }
402  }
403 
404  if ($this->may_write) {
405  // edit
406  $this->addBlockCommand(
407  $ilCtrl->getLinkTargetByClass(
408  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
409  "render"
410  ),
411  $lng->txt("edit_content")
412  );
413  $this->addBlockCommand(
414  $ilCtrl->getLinkTargetByClass(
415  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
416  "edit"
417  ),
418  $lng->txt("settings")
419  );
420  }
421 
422  $ilCtrl->clearParametersByClass($this->getRepositoryObjectGUIName());
423 
424  return parent::getHTML();
425  }
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
getRepositoryObjectGUIName()
Get repository object GUI name.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
setData($a_data)
Set Data.
$ilUser
Definition: imgupload.php:18
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
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 508 of file class.ilPollBlockGUI.php.

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

Referenced by fillDataSection().

508  : string
509  {
510  $this->tpl = new ilTemplate(
511  $this->getRowTemplateName(),
512  true,
513  true,
514  $this->getRowTemplateDir()
515  );
516  $this->fillRow(current($this->getData()));
517  return $this->tpl->get();
518  }
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 476 of file class.ilPollBlockGUI.php.

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

Referenced by fillRow(), and getNumberOfCommentsForRedraw().

477  {
478  include_once("./Services/Notes/classes/class.ilNote.php");
479 
480  $obj_id = ilObject2::_lookupObjectId($ref_id);
481  $number = ilNote::_countNotesAndComments($obj_id);
482 
483  if (count($number) == 0) {
484  return 0;
485  }
486 
487  return $number[$obj_id][IL_NOTE_PUBLIC];
488  }
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 457 of file class.ilPollBlockGUI.php.

References $_GET, exit, and getNumberOfComments().

458  {
459  $number = $this->getNumberOfComments($_GET["poll_id"]);
460 
461  if ($number > 0) {
462  echo "(" . $number . ")";
463  } else {
464  echo "";
465  }
466 
467  exit();
468  }
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 502 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: