ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 require_once "./Services/Object/classes/class.ilObjectGUI.php";
5 
16 {
21  function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
22  {
23  $this->type = "feed";
24  parent::__construct($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
25  }
26 
27 
28  function executeCommand()
29  {
30  global $tpl, $ilTabs;
31 
32  $next_class = $this->ctrl->getNextClass($this);
33 
34  switch($next_class)
35  {
36  case 'ilpermissiongui':
37  $this->prepareOutput();
38  $ilTabs->activateTab("id_permissions");
39  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
40  $perm_gui = new ilPermissionGUI($this);
41  $ret = $this->ctrl->forwardCommand($perm_gui);
42  break;
43 
44  case "ilexternalfeedblockgui":
45  $this->prepareOutput();
46  $ilTabs->activateTab("id_settings");
47  include_once("./Services/Block/classes/class.ilExternalFeedBlockGUI.php");
48  $fb_gui = new ilExternalFeedBlockGUI();
49  $fb_gui->setGuiObject($this);
50  if (is_object($this->object))
51  {
52  $fb_gui->setRefId($this->object->getRefId());
53  }
54  $ret = $this->ctrl->forwardCommand($fb_gui);
55  $tpl->setContent($ret);
56  break;
57 
58  case "ilexportgui":
59  $this->prepareOutput();
60  $ilTabs->activateTab("export");
61  include_once("./Services/Export/classes/class.ilExportGUI.php");
62  $exp_gui = new ilExportGUI($this);
63  $exp_gui->addFormat("xml");
64  $ret = $this->ctrl->forwardCommand($exp_gui);
65 // $this->tpl->show();
66  break;
67 
68  default:
69  $cmd = $this->ctrl->getCmd("view");
70  if ($cmd != "create")
71  {
72  $this->prepareOutput();
73  }
74  $cmd .= "Object";
75  $this->$cmd();
76  break;
77  }
78  return true;
79  }
80 
81  function createObject()
82  {
83  global $ilCtrl;
84  $ilCtrl->setCmdClass("ilexternalfeedblockgui");
85  $ilCtrl->setCmd("create");
86  return $this->executeCommand();
87  }
88 
93  function save($a_feed_block)
94  {
95  // create and insert forum in objecttree
96  $_REQUEST["new_type"] = "feed";
97  $_POST["title"] = $a_feed_block->getTitle();
98  $_POST["desc"] = $a_feed_block->getFeedUrl();
99  parent::saveObject($a_feed_block);
100  }
101 
102  function afterSave(ilObject $a_new_object, $a_feed_block = null)
103  {
104  if ($a_feed_block != null)
105  {
106  // saveObject() parameters are sent as array
107  $a_feed_block = $a_feed_block[0];
108 
109  $a_feed_block->setContextObjId($a_new_object->getId());
110  $a_feed_block->setContextObjType("feed");
111  }
112  }
113 
118  public function exitSave()
119  {
120  global $ilCtrl;
121 
122  // always send a message
123  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
124  $this->ctrl->returnToParent($this);
125  }
126 
131  function update($a_feed_block)
132  {
133  $_POST["title"] = $a_feed_block->getTitle();
134  $_POST["desc"] = $a_feed_block->getFeedUrl();
135  parent::updateObject();
136  }
137 
142  public function cancelUpdate()
143  {
144  global $tree;
145 
146  $par = $tree->getParentId($_GET["ref_id"]);
147  $_GET["ref_id"] = $par;
148  $this->redirectToRefId($par);
149  }
150 
155  public function afterUpdate()
156  {
157  global $tree;
158 
159  $par = $tree->getParentId($_GET["ref_id"]);
160  $_GET["ref_id"] = $par;
161  $this->redirectToRefId($par);
162  }
163 
168  function setTabs()
169  {
170  global $ilAccess, $ilCtrl, $ilTabs, $lng, $ilHelp;
171 
172  if (in_array($ilCtrl->getCmd(), array("create", "saveFeedBlock")))
173  {
174  return;
175  }
176  $ilHelp->setScreenIdComponent("feed");
177 
178  $ilCtrl->setParameterByClass("ilexternalfeedblockgui", "external_feed_block_id",
179  $_GET["external_feed_block_id"]);
180  $ilCtrl->saveParameter($this, "external_feed_block_id");
181 
182  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
183  {
184  $ilTabs->addTab("id_settings",
185  $lng->txt("settings"),
186  $this->ctrl->getLinkTargetByClass("ilexternalfeedblockgui", "editFeedBlock"));
187  }
188 
189  // export
190  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()) && DEVMODE == 1)
191  {
192  $ilTabs->addTab("export",
193  $lng->txt("export"),
194  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
195  }
196 
197 
198  if($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
199  {
200  $ilTabs->addTab("id_permissions",
201  $lng->txt("perm_settings"),
202  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
203  }
204  }
205 
206  public static function _goto($a_target)
207  {
208  global $tree;
209 
210  $id = explode("_", $a_target);
211  $ref_id = $id[0];
212 
213  // is sideblock: so show parent instead
214  $container_id = $tree->getParentId($ref_id);
215 
216  // #14870
217  include_once "Services/Link/classes/class.ilLink.php";
218  ilUtil::redirect(ilLink::_getLink($container_id));
219  }
220 } // END class.ilObjExternalFeed
221 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
Class ilObject Basic functions for all objects.
$cmd
Definition: sahs_server.php:35
update($a_feed_block)
update object public
global $ilCtrl
Definition: ilias.php:18
afterSave(ilObject $a_new_object, $a_feed_block=null)
Export User Interface Class.
prepareOutput($a_show_subobjects=true)
prepare output
getId()
get object id public
Class ilObjectGUI Basic methods of all Output classes.
save($a_feed_block)
save object public
Create styles array
The data for the language used.
BlockGUI class for external feed block.
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...
Create new PHPExcel object
obj_idprivate
$ret
Definition: parser.php:6
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor public.
Class ilObjExternalFeedGUI.
static redirect($a_script)
http redirect to other script
$_POST["username"]