ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
All Data Structures Namespaces Files Functions Variables Typedefs 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...
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __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 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...
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 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 448 of file class.ilPollBlockGUI.php.

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

Referenced by fillRow().

449  {
450  include_once("./Services/Notes/classes/class.ilNoteGUI.php");
451  include_once("./Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
452 
453  $refId = $this->getRefId();
454  $objectId = ilObject2::_lookupObjectId($refId);
455 
458  $refId,
459  "poll",
460  $objectId
461  );
462 
463 
464  $comment = new ilNoteGUI();
465  $jsCall = $comment->getListCommentsJSCall($ajaxHash, "ilPoll.redrawComments(" . $refId . ");");
466 
467  return $jsCall;
468  }
static _lookupObjectId($a_ref_id)
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

◆ fillRow()

ilPollBlockGUI::fillRow (   $a_poll)

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

References $_SESSION, ilBlockGUI\$ctrl, $end, $ilCtrl, $ilUser, $img, $info, $legend, 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().

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  }
259  // bar chart
260  else {
261  include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
262 
263  $this->tpl->setCurrentBlock("answer_result");
264  foreach ($order as $answer_id) {
265  $pbar = ilProgressBar::getInstance();
266  $pbar->setCurrent(round($perc[$answer_id]["perc"]));
267  $this->tpl->setVariable("PERC_ANSWER_RESULT", $pbar->render());
268  $this->tpl->setVariable("TXT_ANSWER_RESULT", nl2br($answers[$answer_id]));
269  $this->tpl->parseCurrentBlock();
270  }
271  }
272  }
273  } else {
276  $end = $this->poll_block->getPoll()->getVotingPeriodEnd();
279 
280  // #14607
281  $info = "";
282  if ($this->poll_block->getPoll()->hasUserVoted($ilUser->getId())) {
283  $info .= $lng->txt("poll_block_message_already_voted") . " ";
284  }
285 
286  $this->tpl->setVariable("TOTAL_ANSWERS", $info .
287  sprintf($lng->txt("poll_block_results_available_on"), $end));
288  }
289  } elseif ($this->poll_block->getPoll()->hasUserVoted($ilUser->getId())) {
290  $this->tpl->setVariable("TOTAL_ANSWERS", $lng->txt("poll_block_message_already_voted"));
291  }
292  }
293 
294  if (!$this->poll_block->mayVote($ilUser->getId()) && !$this->poll_block->getPoll()->hasUserVoted($ilUser->getId())) {
295  if ($this->poll_block->getPoll()->getVotingPeriod()) {
296  $this->tpl->setVariable(
297  "TXT_VOTING_PERIOD",
298  sprintf(
299  $lng->txt("poll_voting_period_full_info"),
300  ilDatePresentation::formatDate(new ilDateTime($this->poll_block->getPoll()->getVotingPeriodBegin(), IL_CAL_UNIX)),
301  ilDatePresentation::formatDate(new ilDateTime($this->poll_block->getPoll()->getVotingPeriodEnd(), IL_CAL_UNIX))
302  )
303  );
304  }
305  } else {
306  $this->tpl->setVariable("TXT_QUESTION", nl2br(trim($a_poll->getQuestion())));
307 
308  $img = $a_poll->getImageFullPath();
309  if ($img) {
310  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
311  $this->tpl->setVariable("URL_IMAGE", ilWACSignedPath::signFile($img));
312  }
313  }
314 
315 
316  $this->tpl->setVariable("ANCHOR_ID", $a_poll->getID());
317  //$this->tpl->setVariable("TXT_QUESTION", nl2br(trim($a_poll->getQuestion())));
318 
319  $desc = trim($a_poll->getDescription());
320  if ($desc) {
321  $this->tpl->setVariable("TXT_DESC", nl2br($desc));
322  }
323 
324 
325  if ($this->poll_block->showComments()) {
326  $this->tpl->setCurrentBlock("comment_link");
327  $this->tpl->setVariable("LANG_COMMENTS", $lng->txt('poll_comments'));
328  $this->tpl->setVariable("COMMENT_JSCALL", $this->commentJSCall());
329  $this->tpl->setVariable("COMMENTS_COUNT_ID", $this->getRefId());
330 
331  $comments_count = $this->getNumberOfComments($this->getRefId());
332 
333  if ($comments_count > 0) {
334  $this->tpl->setVariable("COMMENTS_COUNT", "(" . $comments_count . ")");
335  }
336 
337  if (!self::$js_init) {
338  $redraw_url = $ilCtrl->getLinkTarget(
339  $this,
340  "getNumberOfCommentsForRedraw",
341  "",
342  true,
343  false
344  );
345  $this->tpl->setVariable("COMMENTS_REDRAW_URL", $redraw_url);
346 
347  $tpl->addJavaScript("Modules/Poll/js/ilPoll.js");
348  self::$js_init = true;
349  }
350  }
351  }
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.
$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.
Date and time handling
$ilUser
Definition: imgupload.php:18
static signFile($path_to_file)
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()

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 356 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.

357  {
359  $lng = $this->lng;
360  $ilAccess = $this->access;
362 
363  $this->poll_block->setRefId($this->getRefId());
364  $this->may_write = $ilAccess->checkAccess("write", "", $this->getRefId());
365  $this->has_content = $this->poll_block->hasAnyContent($ilUser->getId(), $this->getRefId());
366 
367  #22078 and 22079 it always contains something.
368  /*if(!$this->may_write && !$this->has_content)
369  {
370  return "";
371  }*/
372 
373  $poll_obj = $this->poll_block->getPoll();
374  $this->setTitle($poll_obj->getTitle());
375  $this->setData(array($poll_obj));
376 
377  $ilCtrl->setParameterByClass(
379  "ref_id",
380  $this->getRefId()
381  );
382 
383  if (!$this->poll_block->getMessage($ilUser->getId())) {
384  // notification
385  include_once "./Services/Notification/classes/class.ilNotification.php";
386  if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->poll_block->getPoll()->getId())) {
387  $this->addBlockCommand(
388  $ilCtrl->getLinkTargetByClass(
389  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
390  "unsubscribe"
391  ),
392  $lng->txt("poll_notification_unsubscribe")
393  );
394  } else {
395  $this->addBlockCommand(
396  $ilCtrl->getLinkTargetByClass(
397  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
398  "subscribe"
399  ),
400  $lng->txt("poll_notification_subscribe")
401  );
402  }
403  }
404 
405  if ($this->may_write) {
406  // edit
407  $this->addBlockCommand(
408  $ilCtrl->getLinkTargetByClass(
409  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
410  "render"
411  ),
412  $lng->txt("edit_content")
413  );
414  $this->addBlockCommand(
415  $ilCtrl->getLinkTargetByClass(
416  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
417  "edit"
418  ),
419  $lng->txt("settings")
420  );
421 
422  /* delete (#10993 - see ilBlockGUI)
423  $parent_id = $tree->getParentId($this->getRefId());
424  $type = ilObject::_lookupType($parent_id, true);
425  $class = $objDefinition->getClassName($type);
426  if($class)
427  {
428  $class = "ilobj".strtolower($class)."gui";
429  $ilCtrl->setParameterByClass($class, "ref_id", $parent_id);
430  $ilCtrl->setParameterByClass($class, "item_ref_id", $this->getRefId());
431  $this->addBlockCommand(
432  $ilCtrl->getLinkTargetByClass($class, "delete"),
433  $lng->txt("delete"));
434  }
435  */
436  }
437 
438  $ilCtrl->clearParametersByClass($this->getRepositoryObjectGUIName());
439 
440  return parent::getHTML();
441  }
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
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 492 of file class.ilPollBlockGUI.php.

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

Referenced by fillRow(), and getNumberOfCommentsForRedraw().

493  {
494  include_once("./Services/Notes/classes/class.ilNote.php");
495 
496  $obj_id = ilObject2::_lookupObjectId($ref_id);
497  $number = ilNote::_countNotesAndComments($obj_id);
498 
499  if (count($number) == 0) {
500  return 0;
501  }
502 
503  return $number[$obj_id][IL_NOTE_PUBLIC];
504  }
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 473 of file class.ilPollBlockGUI.php.

References $_GET, exit, and getNumberOfComments().

474  {
475  $number = $this->getNumberOfComments($_GET["poll_id"]);
476 
477  if ($number > 0) {
478  echo "(" . $number . ")";
479  } else {
480  echo "";
481  }
482 
483  exit();
484  }
$_GET["client_id"]
getNumberOfComments($ref_id)
Get comment count.
exit
Definition: backend.php:16
+ 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.

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