ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Blog\Editing\EditingGUI Class Reference

@ilCtrl_Calls ILIAS\Blog\Editing\EditingGUI: ilRepositorySearchGUI, ilBlogPostingGUI More...

+ Collaboration diagram for ILIAS\Blog\Editing\EditingGUI:

Public Member Functions

 __construct (protected InternalDataService $data, protected InternalDomainService $domain, protected InternalGUIService $gui, protected BlogGUIContext $context, protected \ILIAS\Style\Content\Service $content_style)
 
 executeCommand ()
 
 render ()
 
 printViewSelection ()
 
 printPostings ()
 
 approve ()
 
 deactivateAdmin ()
 
 createPosting ()
 Create new posting. More...
 
 setContentStyleSheet ()
 

Protected Member Functions

 getLinkBuilder ()
 
 forwardPosting ()
 

Protected Attributes

ILIAS Style Content Object ObjectFacade $content_style_domain
 
ILIAS Blog Settings Settings $blog_settings
 

Detailed Description

@ilCtrl_Calls ILIAS\Blog\Editing\EditingGUI: ilRepositorySearchGUI, ilBlogPostingGUI

Definition at line 36 of file EditingGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Blog\Editing\EditingGUI::__construct ( protected InternalDataService  $data,
protected InternalDomainService  $domain,
protected InternalGUIService  $gui,
protected BlogGUIContext  $context,
protected \ILIAS\Style\Content\Service  $content_style 
)

Definition at line 41 of file EditingGUI.php.

47 {
48 $this->blog_settings = $this->domain->blogSettings()->getByObjId($context->getBlog()->getId());
49 if (!$context->isRepositoryNode()) {
50 $this->content_style_domain = $content_style->domain()->styleForObjId($context->getBlog()->getId());
51 } else {
52 $this->content_style_domain = $content_style->domain()->styleForRefId($context->getBlog()->getRefId());
53 }
54 }

References ILIAS\Blog\BlogGUIContext\getBlog(), and ILIAS\Blog\BlogGUIContext\isRepositoryNode().

+ Here is the call graph for this function:

Member Function Documentation

◆ approve()

ILIAS\Blog\Editing\EditingGUI::approve ( )

Definition at line 294 of file EditingGUI.php.

294 : void
295 {
296 $apid = $this->context->getRequest()->getApId();
297 if ($this->context->getPermission()->canManage() && $apid > 0) {
298 $post = new \ilBlogPosting($apid);
299 $post->setApproved(true);
300 $post->setBlogNodeId($this->context->getNodeId(), !$this->context->isRepositoryNode());
301 $post->update(true, false, true, "new"); // #13434
302
303 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
304 'success',
305 $this->domain->lng()->txt("settings_saved"),
306 true
307 );
308 }
309
310 $this->gui->ctrl()->redirectByClass(
311 [
312 ilObjBlogGUI::class,
313 self::class,
314 ],
315 ""
316 );
317 }

◆ createPosting()

ILIAS\Blog\Editing\EditingGUI::createPosting ( )

Create new posting.

Definition at line 342 of file EditingGUI.php.

342 : void
343 {
344 $ctrl = $this->gui->ctrl();
345 $user = $this->domain->user();
346 $mt = $this->gui->ui()->mainTemplate();
347 $lng = $this->domain->lng();
348 $title = $this->context->getRequest()->getTitle();
349 if ($title) {
350 // create new posting
351 $posting = new \ilBlogPosting();
352 $posting->setTitle($title);
353 $posting->setBlogId($this->context->getBlog()->getId());
354 $posting->setActive(false);
355 $posting->setAuthor($user->getId());
356 $posting->create(false);
357
358 // switch month list to current month (will include new posting)
359 $ctrl->setParameter($this, "bmn", date("Y-m"));
360
361 $ctrl->setParameterByClass("ilblogpostinggui", "blpg", $posting->getId());
362 $ctrl->redirectByClass("ilblogpostinggui", "edit");
363 } else {
364 $mt->setOnScreenMessage('failure', $lng->txt("msg_no_title"), true);
365 $ctrl->redirect($this, "render");
366 }
367 }
global $lng
Definition: privfeed.php:26

References $lng, and ILIAS\UI\examples\Symbol\Glyph\Date\date().

+ Here is the call graph for this function:

◆ deactivateAdmin()

ILIAS\Blog\Editing\EditingGUI::deactivateAdmin ( )

Definition at line 319 of file EditingGUI.php.

319 : void
320 {
321 $apid = $this->context->getRequest()->getApId();
322 if ($this->context->getPermission()->canWrite() && $apid > 0) {
323 // ilBlogPostingGUI::deactivatePage()
324 $post = new \ilBlogPosting($apid);
325 $post->setApproved(false);
326 $post->setActive(false);
327 $post->update(true, false, false);
328
329 $this->gui->ui()->mainTemplate()->setOnScreenMessage(
330 'success',
331 $this->domain->lng()->txt("settings_saved"),
332 true
333 );
334 }
335
336 $this->gui->ctrl()->redirect($this, "render");
337 }

◆ executeCommand()

ILIAS\Blog\Editing\EditingGUI::executeCommand ( )

Definition at line 56 of file EditingGUI.php.

56 : void
57 {
58 $next_class = $this->gui->ctrl()->getNextClass($this);
59 $cmd = $this->gui->ctrl()->getCmd("render");
60
61 switch ($next_class) {
62 case strtolower(ilBlogPostingGUI::class):
63 $this->forwardPosting();
64 break;
65
66 default:
67 $this->$cmd();
68 break;
69 }
70 }

References ILIAS\Blog\Editing\EditingGUI\forwardPosting().

+ Here is the call graph for this function:

◆ forwardPosting()

ILIAS\Blog\Editing\EditingGUI::forwardPosting ( )
protected

Definition at line 77 of file EditingGUI.php.

77 : void
78 {
79 $ilCtrl = $this->gui->ctrl();
80 $tpl = $this->gui->ui()->mainTemplate();
81 $lng = $this->domain->lng();
82 $req = $this->context->getRequest();
83
84 $ilCtrl->saveParameter($this, "user_page");
86
87 if (!$this->context->getPermission()->mayContribute()) {
88 $tpl->setOnScreenMessage('info', $lng->txt("no_permission"));
89 return;
90 }
91
92 $style_sheet_id = $this->content_style_domain->getEffectiveStyleId();
93
94 $bpost_gui = new ilBlogPostingGUI(
95 $this->context->getNodeId(),
96 $this->context->getPermission()->getAccessHandler(),
97 $req->getBlogPage(),
98 $req->getOldNr(),
99 $this->context->getBlog()->getNotesStatus(),
100 $this->context->getPermission()->mayEditPosting($req->getBlogPage()),
101 $style_sheet_id
102 );
103
104 $this->setContentStyleSheet();
105
106 $ilCtrl->setParameterByClass(ilBlogPostingGUI::class, "blpg", $req->getBlogPage());
107 $this->gui->tabs()->addNonTabbedLink(
108 "preview",
109 $lng->txt("blog_preview"),
110 $ilCtrl->getLinkTargetByClass(ilBlogPostingGUI::class, "previewFullscreen")
111 );
112 $ilCtrl->setParameterByClass(ilBlogPostingGUI::class, "blpg", "");
113
114 $ret = $ilCtrl->forwardCommand($bpost_gui);
115
116 if ($ret != "") {
117 $is_owner = $this->context->getPermission()->mayContribute();
118 $is_active = $bpost_gui->getBlogPosting()->getActive();
119
120 // do not show inactive postings
121 $cmd = $ilCtrl->getCmd();
122 if (($cmd === "previewFullscreen")
123 && !$is_owner && !$is_active) {
124 $ilCtrl->redirectByClass(ilObjBlogGUI::class, "preview");
125 }
126
127 // infos about draft status / snippet
128 $info = array();
129 if (!$is_active) {
130 $info[] = $lng->txt("blog_draft_info_contributors");
131 }
132 $public_action = false;
133 if ($cmd !== "history" && $cmd !== "edit" && $is_active && empty($info)) {
134 $info[] = $lng->txt("blog_new_posting_info");
135 $public_action = true;
136 }
137 if ($this->context->getBlog()->getNotesStatus() &&
138 $this->blog_settings->getApproval() &&
139 !$bpost_gui->getBlogPosting()->isApproved()) {
140 // #9737
141 $info[] = $lng->txt("blog_posting_edit_approval_info");
142 }
143 if ($public_action) {
144 $tpl->setOnScreenMessage('success', implode("<br />", $info));
145 } else {
146 if (count($info) > 0) {
147 $tpl->setOnScreenMessage('info', implode("<br />", $info));
148 }
149 }
150
151 // revert to edit cmd to avoid confusion
152 $tpl->setContent($ret);
153 }
154
155 if (!$this->gui->tabs()->back_target) {
156 $ilCtrl->setParameter($this, "bmn", "");
157 $this->gui->tabs()->setBackTarget(
158 $lng->txt("back"),
159 $ilCtrl->getLinkTarget($this, "")
160 );
161 }
162 }
Class ilBlogPosting GUI class.
$info
Definition: entry_point.php:21
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.
readonly ilGlobalTemplateInterface $tpl
catch(\Exception $e) $req
Definition: xapiproxy.php:81

References $info, $lng, XapiProxy\$req, ILIAS\News\Common\Table\$tpl, ILIAS\UICore\GlobalTemplate\loadStandardTemplate(), ILIAS\UICore\GlobalTemplate\setContent(), ILIAS\Blog\Editing\EditingGUI\setContentStyleSheet(), and ILIAS\UICore\GlobalTemplate\setOnScreenMessage().

Referenced by ILIAS\Blog\Editing\EditingGUI\executeCommand().

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

◆ getLinkBuilder()

ILIAS\Blog\Editing\EditingGUI::getLinkBuilder ( )
protected

Definition at line 72 of file EditingGUI.php.

72 : EditingLinkBuilder
73 {
74 return $this->gui->navigation()->editingLink();
75 }

◆ printPostings()

ILIAS\Blog\Editing\EditingGUI::printPostings ( )

Definition at line 284 of file EditingGUI.php.

284 : void
285 {
286 $print_view = $this->gui->presentation()->getPrintView(
287 $this->context->getNodeId(),
288 $this->context->isRepositoryNode(),
289 $this->context->getRequest()->getObjIds()
290 );
291 $print_view->sendPrintView();
292 }

◆ printViewSelection()

ILIAS\Blog\Editing\EditingGUI::printViewSelection ( )

Definition at line 274 of file EditingGUI.php.

274 : void
275 {
276 $print_view = $this->gui->presentation()->getPrintView(
277 $this->context->getNodeId(),
278 $this->context->isRepositoryNode(),
279 $this->context->getRequest()->getObjIds()
280 );
281 $print_view->sendForm();
282 }

◆ render()

ILIAS\Blog\Editing\EditingGUI::render ( )

Definition at line 164 of file EditingGUI.php.

164 : void
165 {
166 $tpl = $this->gui->ui()->mainTemplate();
167 $ilTabs = $this->gui->tabs();
168 $ilCtrl = $this->gui->ctrl();
169 $lng = $this->domain->lng();
170 $ilToolbar = new ilToolbarGUI();
171
172 if (!$this->context->getPermission()->canRead()) {
173 $tpl->setOnScreenMessage('info', $lng->txt("no_permission"));
174 return;
175 }
176
177 $ilTabs->activateTab("content");
178
179 // toolbar
180 if ($this->context->getPermission()->mayContribute()) {
181 $ilToolbar->setFormAction($ilCtrl->getFormActionByClass(self::class, "createPosting"));
182
183 $title = new ilTextInputGUI($lng->txt("title"), "title");
184 $title->setSize(30);
185 $ilToolbar->addStickyItem($title, true);
187 document.getElementById('title').setAttribute('data-blog-input', 'posting-title');
188 document.getElementById('title').setAttribute('placeholder', ' ');
189 ");
190
191 $this->gui->button(
192 $lng->txt("blog_add_posting"),
193 "createPosting"
194 )->submit()->toToolbar(true, $ilToolbar);
195
196
197 // #18763
198 $items = $this->domain->postingList($this->context->getBlog()->getId())->getPostingsGroupedByMonth();
199 $keys = array_keys($items);
200 $first = array_shift($keys);
201 if ($first != $this->context->getRequest()->getMonth()) {
202 $ilToolbar->addSeparator();
203
204 $ilCtrl->setParameterByClass(ilObjBlogGUI::class, "bmn", $first);
205 $url = $ilCtrl->getLinkTargetByClass(ilObjBlogGUI::class, "");
206 $ilCtrl->setParameterByClass(ilObjBlogGUI::class, "bmn", $this->context->getRequest()->getMonth());
207
208 $ilToolbar->addComponent(
209 $this->gui->ui()->factory()->button()->standard(
210 $lng->txt("blog_show_latest"),
211 $url
212 )
213 );
214 }
215
216 // print/pdf
217 $print_view = $this->gui->presentation()->getPrintView(
218 $this->context->getNodeId(),
219 $this->context->isRepositoryNode(),
220 $this->context->getRequest()->getObjIds()
221 );
222 $modal_elements = $print_view->getModalElements(
223 $ilCtrl->getLinkTarget(
224 $this,
225 "printViewSelection"
226 )
227 );
228 $ilToolbar->addSeparator();
229 $ilToolbar->addComponent($modal_elements->button);
230 $ilToolbar->addComponent($modal_elements->modal);
231 }
232
233 $include_inactive = $this->context->getPermission()->mayContribute();
234 $list_items = $this->domain->postingList($this->context->getBlog()->getId(), $include_inactive)
235 ->getPostingsForView(
236 $this->context->getAuthor() ?? 0,
237 $this->context->getRequest()->getKeyword(),
238 $this->context->getMonth()
239 );
240
241
242 $list = $nav = "";
243 if ($list_items) {
244 $list = $this->gui->posting()->postingList(
245 $this->context->getBlog()->getId(),
246 $this->context->getPermission(),
247 $this->context->getMonth(),
248 $this->context->getNodeId(),
249 $this->context->getIdType()
250 )->render(
251 $list_items,
252 "preview",
253 "",
254 $include_inactive
255 );
256 $nav = $this->gui->navigation()->sideBar(
257 $this->context->getPermission(),
258 $this->getLinkBuilder(),
259 $this->blog_settings,
260 $this->context->getNodeId(),
261 $this->context->getIdType()
262 )->render(
263 $this->domain->postingList($this->context->getBlog()->getId())->getPostingsGroupedByMonth(),
264 $include_inactive
265 );
266 }
267
268 $this->setContentStyleSheet();
269
270 $tpl->setContent($ilToolbar->getHTML() . $list);
271 $tpl->setRightContent($nav);
272 }
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRightContent(string $a_html)
Sets content of right column.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.

References $lng, ILIAS\News\Common\Table\$tpl, ILIAS\UICore\GlobalTemplate\addOnLoadCode(), ILIAS\UICore\GlobalTemplate\setContent(), ILIAS\Blog\Editing\EditingGUI\setContentStyleSheet(), ILIAS\UICore\GlobalTemplate\setOnScreenMessage(), and ILIAS\UICore\GlobalTemplate\setRightContent().

+ Here is the call graph for this function:

◆ setContentStyleSheet()

ILIAS\Blog\Editing\EditingGUI::setContentStyleSheet ( )

Definition at line 369 of file EditingGUI.php.

369 : void
370 {
371 $this->content_style->gui()->addCss(
372 $this->gui->ui()->mainTemplate(),
373 $this->context->getBlog()->getRefId(),
374 $this->context->getBlog()->getId()
375 );
376 }

Referenced by ILIAS\Blog\Editing\EditingGUI\forwardPosting(), and ILIAS\Blog\Editing\EditingGUI\render().

+ Here is the caller graph for this function:

Field Documentation

◆ $blog_settings

ILIAS Blog Settings Settings ILIAS\Blog\Editing\EditingGUI::$blog_settings
protected

Definition at line 39 of file EditingGUI.php.

◆ $content_style_domain

ILIAS Style Content Object ObjectFacade ILIAS\Blog\Editing\EditingGUI::$content_style_domain
protected

Definition at line 38 of file EditingGUI.php.


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