ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 Returns whether block has a corresponding repository object. More...
 
 getRepositoryObjectGUIName ()
 
 initContentRenderer ()
 
 initJS ()
 
 getCommentsRedrawURL ()
 
 getVoteURL ()
 
 getLegacyContent ()
 Get legacy content. More...
 
- 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
 
Refinery $refinery
 
DataFactory $data_factory
 
ilPollStateInfo $state
 
ilPollCommentsHandler $comments
 
ilPollImageFactoryInterface $poll_image_factory
 
- Protected Attributes inherited from ilBlockGUI
ILIAS UI Renderer $renderer
 
Factory $factory
 
object $gui_object
 
ILIAS Container Block StandardGUIRequest $request
 
ILIAS Container 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 @ilCtrl_IsCalledBy ilPollBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPollBlockGUI::__construct ( )

Reimplemented from ilBlockGUI.

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

48 {
49 global $DIC;
50
51 $this->lng = $DIC->language();
52 $this->ctrl = $DIC->ctrl();
53 $this->user = $DIC->user();
54 $this->access = $DIC->access();
55 $this->ui_factory = $DIC->ui()->factory();
56 $this->ui_renderer = $DIC->ui()->renderer();
57 $this->data_factory = new DataFactory();
58 $this->refinery = $DIC->refinery();
59
61
62 $this->lng->loadLanguageModule("poll");
63 $this->setRowTemplate("tpl.block.html", "components/ILIAS/Poll");
64 $this->poll_image_factory = new ilPollImageFactory();
65 $this->comments = new ilPollCommentsHandler(
66 $DIC->notes(),
67 $DIC->http(),
68 $DIC->refinery(),
69 $this->getCommentsRedrawURL()
70 );
71 $this->state = new ilPollStateInfo();
72 }
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPollBlockGUI::executeCommand ( )

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

95 : void
96 {
97 $next_class = $this->ctrl->getNextClass();
98 $cmd = $this->ctrl->getCmd("getHTML");
99
100 switch ($next_class) {
101 default:
102 $this->$cmd();
103 break;
104 }
105 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ fillRow()

ilPollBlockGUI::fillRow ( array  $a_set)

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

107 : void
108 {
109 if ($this->poll_block->getPoll()->getShowComments()) {
110 $this->initJS();
111 }
112
113 $this->initContentRenderer()->render(
114 $this->tpl,
115 $this->getRefId(),
116 $this->user->getId(),
117 $this->poll_block->getPoll(),
118 $this->getAdminCommands()
119 );
120 }

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

Referenced by getLegacyContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBlockType()

ilPollBlockGUI::getBlockType ( )

Reimplemented from ilBlockGUI.

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

74 : string
75 {
76 return self::$block_type;
77 }
static string $block_type

References $block_type.

◆ getCommentsRedrawURL()

ilPollBlockGUI::getCommentsRedrawURL ( )
protected

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

235 : string
236 {
237 return $this->ctrl->getLinkTarget(
238 $this,
239 "getNumberOfCommentsForRedraw",
240 "",
241 true
242 );
243 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getHTML()

ilPollBlockGUI::getHTML ( )

Reimplemented from ilBlockGUI.

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

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

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().

+ Here is the call graph for this function:

◆ getLegacyContent()

ilPollBlockGUI::getLegacyContent ( )
protected

Get legacy content.

Returns
string

Reimplemented from ilBlockGUI.

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

266 : string
267 {
268 $this->tpl = new ilTemplate(
269 $this->getRowTemplateName(),
270 true,
271 true,
272 $this->getRowTemplateDir()
273 );
274 $this->fillRow(current($this->getData()));
275 return $this->tpl->get();
276 }
special template class to simplify handling of ITX/PEAR

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

+ Here is the call graph for this function:

◆ getNumberOfCommentsForRedraw()

ilPollBlockGUI::getNumberOfCommentsForRedraw ( )

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

261 : void
262 {
263 $this->comments->getNumberOfCommentsForRedraw();
264 }

◆ getRepositoryObjectGUIName()

ilPollBlockGUI::getRepositoryObjectGUIName ( )
protected

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

84 : string
85 {
86 return "ilobjpollgui";
87 }

Referenced by getHTML(), and getVoteURL().

+ Here is the caller graph for this function:

◆ getVoteURL()

ilPollBlockGUI::getVoteURL ( )
protected

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

245 : string
246 {
247 $this->ctrl->setParameterByClass(
249 "ref_id",
250 $this->getRefId()
251 );
252 $url = $this->ctrl->getLinkTargetByClass(
253 array("ilrepositorygui", $this->getRepositoryObjectGUIName()),
254 "vote"
255 );
256 $this->ctrl->clearParametersByClass($this->getRepositoryObjectGUIName());
257
258 return $url .= "#poll" . $this->poll_block->getPoll()->getID();
259 }
$url
Definition: shib_logout.php:68

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

+ Here is the call graph for this function:

◆ initContentRenderer()

ilPollBlockGUI::initContentRenderer ( )
protected

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

192 {
193 $answers = new ilPollAnswersHandler(
194 $this->poll_block->getPoll(),
195 $this->getVoteURL(),
196 'vote'
197 );
199 $this->poll_block->getPoll(),
200 $answers
201 );
202 return new ilPollContentRenderer(
203 $this->lng,
204 $this->ui_factory,
205 $this->ui_renderer,
206 $this->refinery,
207 $this->state,
208 $this->comments,
209 $answers,
211 $this->lng,
212 $this->refinery
213 ),
214 $results,
216 $this->getRefId(),
217 $this->refinery,
218 $this->data_factory,
219 $this->ui_factory,
220 $this->ui_renderer,
221 $this->lng
222 ),
223 $this->poll_image_factory
224 );
225 }
$results

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

Referenced by fillRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initJS()

ilPollBlockGUI::initJS ( )
protected

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

227 : void
228 {
229 if (!self::$js_init) {
230 $this->main_tpl->addJavaScript("assets/js/ilPoll.js");
231 self::$js_init = true;
232 }
233 }

Referenced by fillRow().

+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilPollBlockGUI::isRepositoryObject ( )
protected

Returns whether block has a corresponding repository object.

Reimplemented from ilBlockGUI.

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

79 : bool
80 {
81 return true;
82 }

◆ setBlock()

ilPollBlockGUI::setBlock ( ilPollBlock  $a_block)

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

89 : void
90 {
91 $this->setBlockId((string) $a_block->getId());
92 $this->poll_block = $a_block;
93 }
setBlockId(string $a_block_id="0")

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

+ Here is the call graph for this function:

Field Documentation

◆ $block_type

string ilPollBlockGUI::$block_type = "poll"
static

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

Referenced by getBlockType().

◆ $comments

ilPollCommentsHandler ilPollBlockGUI::$comments
protected

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

◆ $data_factory

DataFactory ilPollBlockGUI::$data_factory
protected

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

◆ $js_init

bool ilPollBlockGUI::$js_init = false
static

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

◆ $poll_block

ilPollBlock ilPollBlockGUI::$poll_block
protected

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

◆ $poll_image_factory

ilPollImageFactoryInterface ilPollBlockGUI::$poll_image_factory
protected

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

◆ $refinery

Refinery ilPollBlockGUI::$refinery
protected

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

◆ $state

ilPollStateInfo ilPollBlockGUI::$state
protected

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

◆ $ui_factory

UIFactory ilPollBlockGUI::$ui_factory
protected

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

◆ $ui_renderer

UIRenderer ilPollBlockGUI::$ui_renderer
protected

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


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