ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 include_once("./Services/Block/classes/class.ilExternalFeedBlockGUI.php");
67 $fb_gui = new ilExternalFeedBlockGUI();
68 $fb_gui->setGuiObject($this);
69 if (is_object($this->object)) {
70 $fb_gui->setRefId($this->object->getRefId());
71 }
72 $ret = $this->ctrl->forwardCommand($fb_gui);
73 $tpl->setContent($ret);
74 break;
75
76 case "ilexportgui":
77 $this->prepareOutput();
78 $ilTabs->activateTab("export");
79 include_once("./Services/Export/classes/class.ilExportGUI.php");
80 $exp_gui = new ilExportGUI($this);
81 $exp_gui->addFormat("xml");
82 $ret = $this->ctrl->forwardCommand($exp_gui);
83// $this->tpl->show();
84 break;
85
86 default:
87 $cmd = $this->ctrl->getCmd("view");
88 if ($cmd != "create") {
89 $this->prepareOutput();
90 }
91 $cmd .= "Object";
92 $this->$cmd();
93 break;
94 }
95 return true;
96 }
97
98 public function createObject()
99 {
101 $ilCtrl->setCmdClass("ilexternalfeedblockgui");
102 $ilCtrl->setCmd("create");
103 return $this->executeCommand();
104 }
105
110 public function save($a_feed_block)
111 {
112 // create and insert forum in objecttree
113 $_REQUEST["new_type"] = "feed";
114 $_POST["title"] = $a_feed_block->getTitle();
115 $_POST["desc"] = $a_feed_block->getFeedUrl();
116 parent::saveObject($a_feed_block);
117 }
118
119 public function afterSave(ilObject $a_new_object, $a_feed_block = null)
120 {
121 if ($a_feed_block != null) {
122 // saveObject() parameters are sent as array
123 $a_feed_block = $a_feed_block[0];
124
125 $a_feed_block->setContextObjId($a_new_object->getId());
126 $a_feed_block->setContextObjType("feed");
127 }
128 }
129
134 public function exitSave()
135 {
137
138 // always send a message
139 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
140 $this->ctrl->returnToParent($this);
141 }
142
147 public function update($a_feed_block)
148 {
149 $_POST["title"] = $a_feed_block->getTitle();
150 $_POST["desc"] = $a_feed_block->getFeedUrl();
151 parent::updateObject();
152 }
153
158 public function cancelUpdate()
159 {
161
162 $par = $tree->getParentId($_GET["ref_id"]);
163 $_GET["ref_id"] = $par;
164 $this->redirectToRefId($par);
165 }
166
171 public function afterUpdate()
172 {
174
175 $par = $tree->getParentId($_GET["ref_id"]);
176 $_GET["ref_id"] = $par;
177 $this->redirectToRefId($par);
178 }
179
184 public function setTabs()
185 {
186 $ilAccess = $this->access;
188 $ilTabs = $this->tabs;
190 $ilHelp = $this->help;
191
192 if (in_array($ilCtrl->getCmd(), array("create", "saveFeedBlock"))) {
193 return;
194 }
195 $ilHelp->setScreenIdComponent("feed");
196
197 $ilCtrl->setParameterByClass(
198 "ilexternalfeedblockgui",
199 "external_feed_block_id",
200 $_GET["external_feed_block_id"]
201 );
202 $ilCtrl->saveParameter($this, "external_feed_block_id");
203
204 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
205 $ilTabs->addTab(
206 "id_settings",
207 $lng->txt("settings"),
208 $this->ctrl->getLinkTargetByClass("ilexternalfeedblockgui", "editFeedBlock")
209 );
210 }
211
212 // export
213 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()) && DEVMODE == 1) {
214 $ilTabs->addTab(
215 "export",
216 $lng->txt("export"),
217 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
218 );
219 }
220
221
222 if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId())) {
223 $ilTabs->addTab(
224 "id_permissions",
225 $lng->txt("perm_settings"),
226 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
227 );
228 }
229 }
230
231 public static function _goto($a_target)
232 {
233 global $DIC;
234
235 $tree = $DIC->repositoryTree();
236
237 $id = explode("_", $a_target);
238 $ref_id = $id[0];
239
240 // is sideblock: so show parent instead
241 $container_id = $tree->getParentId($ref_id);
242
243 // #14870
244 include_once "Services/Link/classes/class.ilLink.php";
245 ilUtil::redirect(ilLink::_getLink($container_id));
246 }
247} // 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)
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
global $DIC
Definition: saml.php:7