ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 ilObjExternalFeedGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
22  {
23  $this->type = "feed";
24  $this->ilObjectGUI($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)
103  {
104  // saveObject() parameters are sent as array
105  $a_feed_block = $a_feed_block[0];
106 
107  $a_feed_block->setContextObjId($a_new_object->getId());
108  $a_feed_block->setContextObjType("feed");
109  }
110 
115  public function exitSave()
116  {
117  global $ilCtrl;
118 
119  // always send a message
120  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
121  $this->ctrl->returnToParent($this);
122  }
123 
128  function update($a_feed_block)
129  {
130  $_POST["title"] = $a_feed_block->getTitle();
131  $_POST["desc"] = $a_feed_block->getFeedUrl();
133  }
134 
139  public function cancelUpdate()
140  {
141  global $tree;
142 
143  $par = $tree->getParentId($_GET["ref_id"]);
144  $_GET["ref_id"] = $par;
145  $this->redirectToRefId($par);
146  }
147 
152  public function afterUpdate()
153  {
154  global $tree;
155 
156  $par = $tree->getParentId($_GET["ref_id"]);
157  $_GET["ref_id"] = $par;
158  $this->redirectToRefId($par);
159  }
160 
165  function setTabs()
166  {
167  global $ilAccess, $ilCtrl, $ilTabs, $lng, $ilHelp;
168 
169  if (in_array($ilCtrl->getCmd(), array("create", "saveFeedBlock")))
170  {
171  return;
172  }
173  $ilHelp->setScreenIdComponent("feed");
174 
175  $ilCtrl->setParameterByClass("ilexternalfeedblockgui", "external_feed_block_id",
176  $_GET["external_feed_block_id"]);
177  $ilCtrl->saveParameter($this, "external_feed_block_id");
178 
179  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
180  {
181  $ilTabs->addTab("id_settings",
182  $lng->txt("settings"),
183  $this->ctrl->getLinkTargetByClass("ilexternalfeedblockgui", "editFeedBlock"));
184  }
185 
186  // export
187  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()) && DEVMODE == 1)
188  {
189  $ilTabs->addTab("export",
190  $lng->txt("export"),
191  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
192  }
193 
194 
195  if($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
196  {
197  $ilTabs->addTab("id_permissions",
198  $lng->txt("perm_settings"),
199  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
200  }
201 
202  }
203 } // END class.ilObjExternalFeed
204 ?>