ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPollBlockGUI Class Reference

BlockGUI class for polls. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 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...
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 Constructor. More...
 
 addHeaderLink ($a_href, $a_text, $status=true)
 
 getHeaderLinks ()
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setBigMode ($a_bigmode)
 Set Big Mode. More...
 
 getBigMode ()
 Get Big Mode. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setAvailableDetailLevels ($a_max, $a_min=0)
 Set Available Detail Levels. More...
 
 setCurrentDetailLevel ($a_currentdetaillevel)
 Set Current Detail Level. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 getCurrentDetailLevel ()
 Get Current Detail Level. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. 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...
 
 setFooterInfo ($a_footerinfo, $a_hide_and_icon=false)
 Set Footer Info. More...
 
 getFooterInfo ($a_hide_and_icon=false)
 Get Footer Info. 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 ($a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setColSpan ($a_colspan)
 Set Columns Span. More...
 
 getColSpan ()
 Get Columns Span. More...
 
 setEnableDetailRow ($a_enabledetailrow)
 Set EnableDetailRow. More...
 
 getEnableDetailRow ()
 Get EnableDetailRow. 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 ()
 
 getDetailParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand ( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 addHeaderCommand ($a_href, $a_text, $a_as_close=false)
 Add Header Block Command. More...
 
 getHeaderCommands ()
 Get Header Block commands. More...
 
 addFooterLink ( $a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
 Add a footer text/link. More...
 
 getFooterLinks ()
 Get footer links. More...
 
 clearFooterLinks ()
 Clear footer links. More...
 
 handleDetailLevel ()
 Handle read/write current detail level. More...
 
 getHTML ()
 Handle config status. 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...
 
 fillFooterLinks ($a_top=false, $a_numinfo="")
 Fill footer links. More...
 
 fillDetailRow ()
 Fill Detail Setting Row. More...
 

Static Public Member Functions

static getBlockType ()
 Get block type. More...
 
static isRepositoryObject ()
 Is block of repository object? More...
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Static Public Member Functions inherited from ilBlockGUI
static getBlockType ()
 
static isRepositoryObject ()
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Static Public Attributes

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

Protected Member Functions

 getRepositoryObjectGUIName ()
 Get repository object GUI name. More...
 
- Protected Member Functions inherited from ilBlockGUI
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Protected Attributes

 $poll_block
 
- Protected Attributes inherited from ilBlockGUI
 $data = array()
 
 $colspan = 1
 
 $enablenuminfo = true
 
 $detail_min = 0
 
 $detail_max = 0
 
 $bigmode = false
 
 $footer_links = array()
 
 $block_id = 0
 
 $header_commands = array()
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $enabledetailrow = true
 
 $header_links = array()
 
 $footerinfo = false
 
 $footerinfo_icon = false
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $dropdown
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 

Private Member Functions

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

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, 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 
38  parent::__construct();
39 
40  $lng->loadLanguageModule("poll");
41  $this->setRowTemplate("tpl.block.html", "Modules/Poll");
42  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
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 452 of file class.ilPollBlockGUI.php.

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

Referenced by fillRow().

453  {
454  include_once("./Services/Notes/classes/class.ilNoteGUI.php");
455  include_once("./Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
456 
457  $refId = $this->getRefId();
458  $objectId = ilObject2::_lookupObjectId($refId);
459 
462  $refId,
463  "poll",
464  $objectId
465  );
466 
467 
468  $comment = new ilNoteGUI();
469  $jsCall = $comment->getListCommentsJSCall($ajaxHash, "ilPoll.redrawComments(" . $refId . ");");
470 
471  return $jsCall;
472  }
static _lookupObjectId($a_ref_id)
Notes GUI class.
static buildAjaxHash($a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null)
Build ajax hash.
$comment
Definition: buildRTE.php:83
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 94 of file class.ilPollBlockGUI.php.

References ilBlockGUI\$ctrl, and $ilCtrl.

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

◆ fillRow()

ilPollBlockGUI::fillRow (   $a_poll)

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

References $_SESSION, $chart, ilBlockGUI\$ctrl, $end, $error, $ilCtrl, $ilUser, $img, $info, $legend, ilBlockGUI\$lng, ilBlockGUI\$main_tpl, $total, ilBlockGUI\$tpl, $url, ilBlockGUI\$user, array, 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().

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

◆ getBlockType()

static ilPollBlockGUI::getBlockType ( )
static

Get block type.

Returns
string Block type.

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

50  {
51  return self::$block_type;
52  }

◆ getHTML()

ilPollBlockGUI::getHTML ( )

Get block HTML code.

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

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

361  {
363  $lng = $this->lng;
364  $ilAccess = $this->access;
366 
367  $this->poll_block->setRefId($this->getRefId());
368  $this->may_write = $ilAccess->checkAccess("write", "", $this->getRefId());
369  $this->has_content = $this->poll_block->hasAnyContent($ilUser->getId(), $this->getRefId());
370 
371  #22078 and 22079 it always contains something.
372  /*if(!$this->may_write && !$this->has_content)
373  {
374  return "";
375  }*/
376 
377  $poll_obj = $this->poll_block->getPoll();
378  $this->setTitle($poll_obj->getTitle());
379  $this->setData(array($poll_obj));
380 
381  $ilCtrl->setParameterByClass(
383  "ref_id",
384  $this->getRefId()
385  );
386 
387  if (!$this->poll_block->getMessage($ilUser->getId())) {
388  // notification
389  include_once "./Services/Notification/classes/class.ilNotification.php";
390  if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->poll_block->getPoll()->getId())) {
391  $this->addBlockCommand(
392  $ilCtrl->getLinkTargetByClass(
393  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
394  "unsubscribe"
395  ),
396  $lng->txt("poll_notification_unsubscribe")
397  );
398  } else {
399  $this->addBlockCommand(
400  $ilCtrl->getLinkTargetByClass(
401  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
402  "subscribe"
403  ),
404  $lng->txt("poll_notification_subscribe")
405  );
406  }
407  }
408 
409  if ($this->may_write) {
410  // edit
411  $this->addBlockCommand(
412  $ilCtrl->getLinkTargetByClass(
413  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
414  "render"
415  ),
416  $lng->txt("edit_content")
417  );
418  $this->addBlockCommand(
419  $ilCtrl->getLinkTargetByClass(
420  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
421  "edit"
422  ),
423  $lng->txt("settings")
424  );
425 
426  /* delete (#10993 - see ilBlockGUI)
427  $parent_id = $tree->getParentId($this->getRefId());
428  $type = ilObject::_lookupType($parent_id, true);
429  $class = $objDefinition->getClassName($type);
430  if($class)
431  {
432  $class = "ilobj".strtolower($class)."gui";
433  $ilCtrl->setParameterByClass($class, "ref_id", $parent_id);
434  $ilCtrl->setParameterByClass($class, "item_ref_id", $this->getRefId());
435  $this->addBlockCommand(
436  $ilCtrl->getLinkTargetByClass($class, "delete"),
437  $lng->txt("delete"));
438  }
439  */
440  }
441 
442  $ilCtrl->clearParametersByClass($this->getRepositoryObjectGUIName());
443 
444  return parent::getHTML();
445  }
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
Create styles array
The data for the language used.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
+ Here is the call graph for this function:

◆ getNumberOfComments()

ilPollBlockGUI::getNumberOfComments (   $ref_id)

Get comment count.

Parameters
int$ref_id
Returns
int

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

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

Referenced by fillRow(), and getNumberOfCommentsForRedraw().

497  {
498  include_once("./Services/Notes/classes/class.ilNote.php");
499 
500  $obj_id = ilObject2::_lookupObjectId($ref_id);
501  $number = ilNote::_countNotesAndComments($obj_id);
502 
503  if (count($number) == 0) {
504  return 0;
505  }
506 
507  return $number[$obj_id][IL_NOTE_PUBLIC];
508  }
static _countNotesAndComments($a_rep_obj_id, $a_sub_obj_id=null)
Get all notes related to a specific object.
static _lookupObjectId($a_ref_id)
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:5
+ 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 477 of file class.ilPollBlockGUI.php.

References $_GET, exit, and getNumberOfComments().

478  {
479  $number = $this->getNumberOfComments($_GET["poll_id"]);
480 
481  if ($number > 0) {
482  echo "(" . $number . ")";
483  } else {
484  echo "";
485  }
486 
487  exit();
488  }
$_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 69 of file class.ilPollBlockGUI.php.

Referenced by fillRow(), and getHTML().

70  {
71  return "ilobjpollgui";
72  }
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPollBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

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

References IL_SCREEN_SIDE.

78  {
79  return IL_SCREEN_SIDE;
80  }
const IL_SCREEN_SIDE

◆ isRepositoryObject()

static ilPollBlockGUI::isRepositoryObject ( )
static

Is block of repository object?

Returns
string Block type.

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

60  {
61  return true;
62  }

◆ setBlock()

ilPollBlockGUI::setBlock (   $a_block)

Do most of the initialisation.

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

References ilBlockGUI\setBlockId().

86  {
87  $this->setBlockId($a_block->getId());
88  $this->poll_block = $a_block;
89  }
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.

◆ $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: