ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilPollBlockGUI Class Reference

BlockGUI class for polls. More...

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

Public Member Functions

 __construct ()
 
 getBlockType ()
 
 setBlock (ilPollBlock $a_block)
 
 executeCommand ()
 
 fillRow (array $a_set)
 
 getHTML ()
 
 getNumberOfCommentsForRedraw ()
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 
 getBlockType ()
 
 setData (array $a_data)
 
 getData ()
 
 setPresentation (int $type)
 
 getPresentation ()
 
 setBlockId (string $a_block_id="0")
 
 getBlockId ()
 
 setGuiObject (object $a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setOffset (int $a_offset)
 
 getOffset ()
 
 checkOffset (int $offset)
 
 setLimit (int $a_limit)
 
 getLimit ()
 
 setEnableEdit (bool $a_enableedit)
 
 getEnableEdit ()
 
 setRepositoryMode (bool $a_repositorymode)
 
 getRepositoryMode ()
 
 setSubtitle (string $a_subtitle)
 
 getSubtitle ()
 
 setRefId (int $a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 
 setAdminCommands (bool $a_admincommands)
 
 getAdminCommands ()
 
 setEnableNumInfo (bool $a_enablenuminfo)
 
 getEnableNumInfo ()
 
 setProperties (array $a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty (string $a_property)
 
 setProperty (string $a_property, string $a_value)
 
 setRowTemplate (string $a_rowtemplatename, string $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 
 getRowTemplateDir ()
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="", RoundTrip $modal=null)
 
 getBlockCommands ()
 
 getHTML ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getViewControlsForPanel ()
 
 sortObject ()
 
 addSortOption (string $option, string $label, bool $active)
 
 setSortTarget (string $target)
 
 addPresentation (string $label, string $target, bool $active)
 
 getNoItemFoundContent ()
 

Static Public Attributes

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

Protected Member Functions

 isRepositoryObject ()
 
 getRepositoryObjectGUIName ()
 
 initContentRenderer ()
 
 initJS ()
 
 getCommentsRedrawURL ()
 
 getVoteURL ()
 
 getLegacyContent ()
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 specialCharsAsEntities (string $string)
 
 initCommands ()
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. 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...
 
 getActionsForPanel ()
 
 send (string $output)
 Send. More...
 

Protected Attributes

ilPollBlock $poll_block
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
ilPollStateInfo $state
 
ilPollCommentsHandler $comments
 
- Protected Attributes inherited from ilBlockGUI
ILIAS UI Renderer $renderer
 
Factory $factory
 
object $gui_object
 
ILIAS Block StandardGUIRequest $request
 
ILIAS Block BlockManager $block_manager
 
bool $repositorymode = false
 
ILIAS DI UIServices $ui
 
array $data = array()
 
bool $enablenuminfo = true
 
array $footer_links = array()
 
string $block_id = "0"
 
bool $allow_moving = true
 
array $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
array $block_commands = array()
 
int $max_count = 0
 
bool $close_command = false
 
bool $image = false
 
array $property = []
 
string $nav_value = ""
 
string $css_row = ""
 
string $title = ""
 
bool $admincommands = false
 
array $dropdown
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilLanguage $lng
 
ilObjectDefinition $obj_def
 
int $presentation
 
int $requested_ref_id
 

Additional Inherited Members

- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 
- Data Fields inherited from ilBlockGUI
const PRES_MAIN_LEG = 0
 
const PRES_SEC_LEG = 1
 
const PRES_SEC_LIST = 2
 
const PRES_MAIN_LIST = 3
 
const PRES_MAIN_TILE = 4
 

Detailed Description

BlockGUI class for polls.

Author
Jörg Lützenkirchen ilPollBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPollBlockGUI::__construct ( )

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

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), getCommentsRedrawURL(), ILIAS\Repository\lng(), ilBlockGUI\setRowTemplate(), and ILIAS\Repository\user().

41  {
42  global $DIC;
43 
44  $this->lng = $DIC->language();
45  $this->ctrl = $DIC->ctrl();
46  $this->user = $DIC->user();
47  $this->access = $DIC->access();
48  $this->ui_factory = $DIC->ui()->factory();
49  $this->ui_renderer = $DIC->ui()->renderer();
50 
52 
53  $this->lng->loadLanguageModule("poll");
54  $this->setRowTemplate("tpl.block.html", "Modules/Poll");
55 
56  $this->comments = new ilPollCommentsHandler(
57  $DIC->notes(),
58  $DIC->http(),
59  $DIC->refinery(),
60  $this->getCommentsRedrawURL()
61  );
62  $this->state = new ilPollStateInfo();
63  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPollBlockGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

86  : void
87  {
88  $next_class = $this->ctrl->getNextClass();
89  $cmd = $this->ctrl->getCmd("getHTML");
90 
91  switch ($next_class) {
92  default:
93  $this->$cmd();
94  break;
95  }
96  }
+ Here is the call graph for this function:

◆ fillRow()

ilPollBlockGUI::fillRow ( array  $a_set)

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

References ilBlockGUI\getAdminCommands(), ilBlockGUI\getRefId(), initContentRenderer(), initJS(), and ILIAS\Repository\user().

Referenced by getLegacyContent().

98  : void
99  {
100  if ($this->poll_block->getPoll()->getShowComments()) {
101  $this->initJS();
102  }
103 
104  $this->initContentRenderer()->render(
105  $this->tpl,
106  $this->getRefId(),
107  $this->user->getId(),
108  $this->poll_block->getPoll(),
109  $this->getAdminCommands()
110  );
111  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBlockType()

ilPollBlockGUI::getBlockType ( )

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

65  : string
66  {
67  return self::$block_type;
68  }

◆ getCommentsRedrawURL()

ilPollBlockGUI::getCommentsRedrawURL ( )
protected

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

References ILIAS\Repository\ctrl().

Referenced by __construct().

214  : string
215  {
216  return $this->ctrl->getLinkTarget(
217  $this,
218  "getNumberOfCommentsForRedraw",
219  "",
220  true
221  );
222  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilPollBlockGUI::getHTML ( )

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

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

113  : string
114  {
115  $this->poll_block->setRefId($this->getRefId());
116  $may_write = $this->access->checkAccess("write", "", $this->getRefId());
117 
118  $poll_obj = $this->poll_block->getPoll();
119  $this->setTitle($poll_obj->getTitle());
120  $this->setData([[$poll_obj]]);
121 
122  $this->ctrl->setParameterByClass(
124  "ref_id",
125  $this->getRefId()
126  );
127 
128  if (
129  !$this->state->isOfflineOrUnavailable($this->poll_block->getPoll()) &&
130  !$this->user->isAnonymous()
131  ) {
132  // notification
133  if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $this->user->getId(), $this->poll_block->getPoll()->getId())) {
134  $this->addBlockCommand(
135  $this->ctrl->getLinkTargetByClass(
136  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
137  "unsubscribe"
138  ),
139  $this->lng->txt("poll_notification_unsubscribe")
140  );
141  } else {
142  $this->addBlockCommand(
143  $this->ctrl->getLinkTargetByClass(
144  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
145  "subscribe"
146  ),
147  $this->lng->txt("poll_notification_subscribe")
148  );
149  }
150  }
151 
152  if ($may_write) {
153  // edit
154  $this->addBlockCommand(
155  $this->ctrl->getLinkTargetByClass(
156  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
157  "render"
158  ),
159  $this->lng->txt("poll_edit_question")
160  );
161  $this->addBlockCommand(
162  $this->ctrl->getLinkTargetByClass(
163  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
164  "edit"
165  ),
166  $this->lng->txt("settings")
167  );
168  $this->addBlockCommand(
169  $this->ctrl->getLinkTargetByClass(
170  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
171  "showParticipants"
172  ),
173  $this->lng->txt("poll_result")
174  );
175  }
176 
177  $this->ctrl->clearParametersByClass($this->getRepositoryObjectGUIName());
178 
179  return parent::getHTML();
180  }
addBlockCommand(string $a_href, string $a_text, string $a_onclick="", RoundTrip $modal=null)
setTitle(string $a_title)
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
setData(array $a_data)
+ Here is the call graph for this function:

◆ getLegacyContent()

ilPollBlockGUI::getLegacyContent ( )
protected

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

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

245  : string
246  {
247  $this->tpl = new ilTemplate(
248  $this->getRowTemplateName(),
249  true,
250  true,
251  $this->getRowTemplateDir()
252  );
253  $this->fillRow(current($this->getData()));
254  return $this->tpl->get();
255  }
fillRow(array $a_set)
+ Here is the call graph for this function:

◆ getNumberOfCommentsForRedraw()

ilPollBlockGUI::getNumberOfCommentsForRedraw ( )

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

240  : void
241  {
242  $this->comments->getNumberOfCommentsForRedraw();
243  }

◆ getRepositoryObjectGUIName()

ilPollBlockGUI::getRepositoryObjectGUIName ( )
protected

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

Referenced by getHTML(), and getVoteURL().

75  : string
76  {
77  return "ilobjpollgui";
78  }
+ Here is the caller graph for this function:

◆ getVoteURL()

ilPollBlockGUI::getVoteURL ( )
protected

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

References $url, ILIAS\Repository\ctrl(), ilBlockGUI\getRefId(), and getRepositoryObjectGUIName().

Referenced by initContentRenderer().

224  : string
225  {
226  $this->ctrl->setParameterByClass(
228  "ref_id",
229  $this->getRefId()
230  );
231  $url = $this->ctrl->getLinkTargetByClass(
232  array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
233  "vote"
234  );
235  $this->ctrl->clearParametersByClass($this->getRepositoryObjectGUIName());
236 
237  return $url .= "#poll" . $this->poll_block->getPoll()->getID();
238  }
$url
Definition: ltiregstart.php:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initContentRenderer()

ilPollBlockGUI::initContentRenderer ( )
protected

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

References $results, ilBlockGUI\getRefId(), getVoteURL(), and ILIAS\Repository\lng().

Referenced by fillRow().

183  {
184  $answers = new ilPollAnswersHandler(
185  $this->poll_block->getPoll(),
186  $this->getVoteURL(),
187  'vote'
188  );
190  $this->poll_block->getPoll(),
191  $answers
192  );
193  return new ilPollContentRenderer(
194  $this->lng,
195  $this->ui_factory,
196  $this->ui_renderer,
197  $this->state,
198  $this->comments,
199  $answers,
200  new ilPollAnswersRenderer($this->lng),
201  $results,
202  new ilPollResultsRenderer($this->getRefId())
203  );
204  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$results
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initJS()

ilPollBlockGUI::initJS ( )
protected

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

Referenced by fillRow().

206  : void
207  {
208  if (!self::$js_init) {
209  $this->main_tpl->addJavaScript("Modules/Poll/js/ilPoll.js");
210  self::$js_init = true;
211  }
212  }
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilPollBlockGUI::isRepositoryObject ( )
protected

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

70  : bool
71  {
72  return true;
73  }

◆ setBlock()

ilPollBlockGUI::setBlock ( ilPollBlock  $a_block)

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

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

80  : void
81  {
82  $this->setBlockId((string) $a_block->getId());
83  $this->poll_block = $a_block;
84  }
setBlockId(string $a_block_id="0")
+ Here is the call graph for this function:

Field Documentation

◆ $block_type

string ilPollBlockGUI::$block_type = "poll"
static

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

◆ $comments

ilPollCommentsHandler ilPollBlockGUI::$comments
protected

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

◆ $js_init

bool ilPollBlockGUI::$js_init = false
static

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

◆ $poll_block

ilPollBlock ilPollBlockGUI::$poll_block
protected

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

◆ $state

ilPollStateInfo ilPollBlockGUI::$state
protected

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

◆ $ui_factory

UIFactory ilPollBlockGUI::$ui_factory
protected

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

◆ $ui_renderer

UIRenderer ilPollBlockGUI::$ui_renderer
protected

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


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