ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjExternalFeedGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./Services/Object/classes/class.ilObjectGUI.php";
5
16{
20 protected $tabs;
21
25 protected $help;
26
31 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
32 {
33 global $DIC;
34
35 $this->tpl = $DIC["tpl"];
36 $this->tabs = $DIC->tabs();
37 $this->ctrl = $DIC->ctrl();
38 $this->tree = $DIC->repositoryTree();
39 $this->access = $DIC->access();
40 $this->lng = $DIC->language();
41 $this->help = $DIC["ilHelp"];
42 $this->type = "feed";
43 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
44 }
45
46
47 public function executeCommand()
48 {
50 $ilTabs = $this->tabs;
51
52 $next_class = $this->ctrl->getNextClass($this);
53
54 switch ($next_class) {
55 case 'ilpermissiongui':
56 $this->prepareOutput();
57 $ilTabs->activateTab("id_permissions");
58 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
59 $perm_gui = new ilPermissionGUI($this);
60 $ret = $this->ctrl->forwardCommand($perm_gui);
61 break;
62
63 case "ilexternalfeedblockgui":
64 $this->prepareOutput();
65 $ilTabs->activateTab("id_settings");
66 $fb_gui = new ilExternalFeedBlockGUI();
67 $fb_gui->setGuiObject($this);
68 if (is_object($this->object)) {
69 $fb_gui->setRefId($this->object->getRefId());
70 }
71 $ret = $this->ctrl->forwardCommand($fb_gui);
72 $tpl->setContent($ret);
73 break;
74
75 case "ilexportgui":
76 $this->prepareOutput();
77 $ilTabs->activateTab("export");
78 include_once("./Services/Export/classes/class.ilExportGUI.php");
79 $exp_gui = new ilExportGUI($this);
80 $exp_gui->addFormat("xml");
81 $ret = $this->ctrl->forwardCommand($exp_gui);
82// $this->tpl->show();
83 break;
84
85 default:
86 $cmd = $this->ctrl->getCmd("view");
87 if ($cmd != "create") {
88 $this->prepareOutput();
89 }
90 $cmd .= "Object";
91 $this->$cmd();
92 break;
93 }
94 return true;
95 }
96
97 public function createObject()
98 {
99 $ilCtrl = $this->ctrl;
100 $ilCtrl->setCmdClass("ilexternalfeedblockgui");
101 $ilCtrl->setCmd("create");
102 return $this->executeCommand();
103 }
104
109 public function save($a_feed_block)
110 {
111 // create and insert forum in objecttree
112 $_REQUEST["new_type"] = "feed";
113 $_POST["title"] = $a_feed_block->getTitle();
114 $_POST["desc"] = $a_feed_block->getFeedUrl();
115 parent::saveObject($a_feed_block);
116 }
117
118 public function afterSave(ilObject $a_new_object, $a_feed_block = null)
119 {
120 if ($a_feed_block != null) {
121 // saveObject() parameters are sent as array
122 $a_feed_block = $a_feed_block[0];
123
124 $a_feed_block->setContextObjId($a_new_object->getId());
125 $a_feed_block->setContextObjType("feed");
126 }
127 }
128
133 public function exitSave()
134 {
135 $ilCtrl = $this->ctrl;
136
137 // always send a message
138 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
139 $this->ctrl->returnToParent($this);
140 }
141
146 public function update($a_feed_block)
147 {
148 $_POST["title"] = $a_feed_block->getTitle();
149 $_POST["desc"] = $a_feed_block->getFeedUrl();
150 parent::updateObject();
151 }
152
157 public function cancelUpdate()
158 {
160
161 $par = $tree->getParentId($_GET["ref_id"]);
162 $_GET["ref_id"] = $par;
163 $this->redirectToRefId($par);
164 }
165
170 public function afterUpdate()
171 {
173
174 $par = $tree->getParentId($_GET["ref_id"]);
175 $_GET["ref_id"] = $par;
176 $this->redirectToRefId($par);
177 }
178
183 public function setTabs()
184 {
185 $ilAccess = $this->access;
186 $ilCtrl = $this->ctrl;
187 $ilTabs = $this->tabs;
189 $ilHelp = $this->help;
190
191 if (in_array($ilCtrl->getCmd(), array("create", "saveFeedBlock"))) {
192 return;
193 }
194 $ilHelp->setScreenIdComponent("feed");
195
196 $ilCtrl->setParameterByClass(
197 "ilexternalfeedblockgui",
198 "external_feed_block_id",
199 $_GET["external_feed_block_id"]
200 );
201 $ilCtrl->saveParameter($this, "external_feed_block_id");
202
203 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
204 $ilTabs->addTab(
205 "id_settings",
206 $lng->txt("settings"),
207 $this->ctrl->getLinkTargetByClass("ilexternalfeedblockgui", "editFeedBlock")
208 );
209 }
210
211 // export
212 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()) && DEVMODE == 1) {
213 $ilTabs->addTab(
214 "export",
215 $lng->txt("export"),
216 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
217 );
218 }
219
220
221 if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId())) {
222 $ilTabs->addTab(
223 "id_permissions",
224 $lng->txt("perm_settings"),
225 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
226 );
227 }
228 }
229
230 public static function _goto($a_target)
231 {
232 global $DIC;
233
234 $tree = $DIC->repositoryTree();
235
236 $id = explode("_", $a_target);
237 $ref_id = $id[0];
238
239 // is sideblock: so show parent instead
240 $container_id = $tree->getParentId($ref_id);
241
242 // #14870
243 include_once "Services/Link/classes/class.ilLink.php";
244 ilUtil::redirect(ilLink::_getLink($container_id));
245 }
246} // END class.ilObjExternalFeed
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Export User Interface Class.
BlockGUI class for external feed block.
Class ilObjExternalFeedGUI.
save($a_feed_block)
save object @access public
update($a_feed_block)
update object @access public
afterSave(ilObject $a_new_object, $a_feed_block=null)
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor @access public.
createObject()
create new object form
setTabs()
get tabs @access public
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
redirectToRefId($a_ref_id, $a_cmd="")
redirects to (repository) view per ref id usually to a container and usually used at the end of a sav...
Class ilObject Basic functions for all objects.
getId()
get object id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static redirect($a_script)
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6