ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjBlogListGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 public function init()
16 {
17 $this->copy_enabled = true;
18 $this->delete_enabled = true;
19 $this->cut_enabled = true;
20 $this->subscribe_enabled = true;
21 $this->link_enabled = true; // #10498
22 $this->info_screen_enabled = true;
23 $this->type = "blog";
24 $this->gui_class_name = "ilobjbloggui";
25
26 // general commands array
27 $this->commands = ilObjBlogAccess::_getCommands();
28 }
29
30 public function getCommands()
31 {
32 $commands = parent::getCommands();
33
34 // #10182 - handle edit and contribute
35 $permissions = array();
36 foreach ($commands as $idx => $item) {
37 if ($item["lang_var"] == "edit" && $item["granted"]) {
38 $permissions[$item["permission"]] = $idx;
39 }
40 }
41 if (sizeof($permissions) == 2) {
42 unset($commands[$permissions["contribute"]]);
43 }
44
45 return $commands;
46 }
47
56 public function insertCommand($a_href, $a_text, $a_frame = "", $a_img = "", $a_cmd = "", $a_onclick = "")
57 {
59
60 if ($a_cmd === "export"
62 && (bool) $this->settings->get('item_cmd_asynch')) {
63 $a_href = $this->getCommandLink("forwardExport");
64 $a_cmd = "forwardExport";
65 $a_onclick = "";
66 }
67
68 if ($a_cmd != "export" || !ilObjBlogAccess::isCommentsExportPossible($this->obj_id)) {
69 parent::insertCommand($a_href, $a_text, $a_frame, $a_img, $a_cmd, $a_onclick);
70 return;
71 }
72
73 // #11099
74 $chksum = md5($a_href . $a_text);
75 if ($a_href == "#" ||
76 !in_array($chksum, $this->prevent_duplicate_commands)) {
77 if ($a_href != "#") {
78 $this->prevent_duplicate_commands[] = $chksum;
79 }
80
81 $prevent_background_click = false;
82
84 $comment_export_helper = new \ILIAS\Notes\Export\ExportHelperGUI();
85 $this->lng->loadLanguageModule("note");
86 $this->comment_modal = $comment_export_helper->getCommentIncludeModalDialog(
87 'HTML Export',
88 $this->lng->txt("note_html_export_include_comments"),
89 $ctrl->getLinkTargetByClass("ilobjbloggui", "export"),
90 $ctrl->getLinkTargetByClass("ilobjbloggui", "exportWithComments")
91 );
92 $signal = $this->comment_modal->getShowSignal();
93 $this->current_selection_list->addItem(
94 $a_text,
95 "",
96 $a_href,
97 $a_img,
98 $a_text,
99 $a_frame,
100 "",
101 $prevent_background_click,
102 "( function() { $(document).trigger('" . $signal . "', {'id': '" . $signal . "','triggerer':$(this), 'options': JSON.parse('[]')}); return false;})()"
103 );
104 }
105 }
106 }
107
108 public function getListItemHTML(
109 $a_ref_id,
110 $a_obj_id,
111 $a_title,
112 $a_description,
113 $a_use_asynch = false,
114 $a_get_asynch_commands = false,
115 $a_asynch_url = ""
116 ) {
117 $html = parent::getListItemHTML(
118 $a_ref_id,
119 $a_obj_id,
120 $a_title,
121 $a_description,
122 $a_use_asynch,
123 $a_get_asynch_commands,
124 $a_asynch_url
125 );
126
127 if (!is_null($this->comment_modal)) {
128 global $DIC;
129 $renderer = $DIC->ui()->renderer();
130 $html .= $renderer->render($this->comment_modal);
131 }
132 return $html;
133 }
134}
An exception for terminatinating execution or to throw for unit testing.
static _getCommands()
get commands
static isCommentsExportPossible($blog_id)
Is comments export possible?
Class ilObjBlogListGUI.
getListItemHTML( $a_ref_id, $a_obj_id, $a_title, $a_description, $a_use_asynch=false, $a_get_asynch_commands=false, $a_asynch_url="")
Get all item information (title, commands, description) in HTML.
getCommands()
get all current commands for a specific ref id (in the permission context of the current user)
insertCommand($a_href, $a_text, $a_frame="", $a_img="", $a_cmd="", $a_onclick="")
insert command button
Class ilObjectListGUI.
getCommandLink($a_cmd)
Get command link url.
global $DIC
Definition: goto.php:24
settings()
Definition: settings.php:2