ILIAS  eassessment Revision 61809
 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 "./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  global $rbacadmin, $ilUser;
96 
97  // create and insert forum in objecttree
98  $_GET["new_type"] = "feed";
99  $_POST["Fobject"]["title"] = $a_feed_block->getTitle();
100  $_POST["Fobject"]["desc"] = $a_feed_block->getFeedUrl();
101  $newObj = parent::saveObject();
102  $newObj->setOwner($ilUser->getId());
103  $newObj->updateOwner();
104  $a_feed_block->setContextObjId($newObj->getId());
105  $a_feed_block->setContextObjType("feed");
106  }
107 
112  public function exitSave()
113  {
114  global $ilCtrl;
115 
116  // always send a message
117  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
118  $this->ctrl->returnToParent($this);
119  }
120 
125  function update($a_feed_block)
126  {
127  global $rbacadmin;
128 
129  // update object
130  $_POST["Fobject"]["title"] = $a_feed_block->getTitle();
131  $_POST["Fobject"]["desc"] = $a_feed_block->getFeedUrl();
132  $newObj = parent::updateObject();
133  }
134 
139  public function cancelUpdate()
140  {
141  global $ilCtrl, $tree;
142 
143 
144  $par = $tree->getParentId($_GET["ref_id"]);
145  $_GET["ref_id"] = $par;
146  $this->redirectToRefId($par);
147 
148  //$this->ctrl->returnToParent($this);
149  }
150 
155  public function afterUpdate()
156  {
157  global $ilCtrl, $tree;
158 
159  // always send a message
160  $par = $tree->getParentId($_GET["ref_id"]);
161  $_GET["ref_id"] = $par;
162  $this->redirectToRefId($par);
163 
164  }
165 
170  function setTabs()
171  {
172  global $ilAccess, $ilCtrl, $ilTabs, $lng;
173 
174  if (in_array($ilCtrl->getCmd(), array("create", "saveFeedBlock")))
175  {
176  return;
177  }
178 
179  $ilCtrl->setParameterByClass("ilexternalfeedblockgui", "external_feed_block_id",
180  $_GET["external_feed_block_id"]);
181  $ilCtrl->saveParameter($this, "external_feed_block_id");
182 
183  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
184  {
185  $ilTabs->addTab("id_settings",
186  $lng->txt("settings"),
187  $this->ctrl->getLinkTargetByClass("ilexternalfeedblockgui", "editFeedBlock"));
188  }
189 
190  // export
191  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()) && DEVMODE == 1)
192  {
193  $ilTabs->addTab("export",
194  $lng->txt("export"),
195  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
196  }
197 
198 
199  if($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
200  {
201  $ilTabs->addTab("id_permissions",
202  $lng->txt("perm_settings"),
203  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
204  }
205 
206  }
207 } // END class.ilObjExternalFeed
208 ?>