ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjExternalFeedGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once "./classes/class.ilObjectGUI.php";
25 
36 {
41  function ilObjExternalFeedGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
42  {
43  $this->type = "feed";
44  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
45  }
46 
47 
48  function &executeCommand()
49  {
50  global $rbacsystem, $tpl;
51 
52  $next_class = $this->ctrl->getNextClass($this);
53 
54  switch($next_class)
55  {
56  case 'ilpermissiongui':
57  $this->prepareOutput();
58  include_once("./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  include_once("./Services/Block/classes/class.ilExternalFeedBlockGUI.php");
66  $fb_gui =& new ilExternalFeedBlockGUI();
67  $fb_gui->setGuiObject($this);
68  if (is_object($this->object))
69  {
70  $fb_gui->setRefId($this->object->getRefId());
71  }
72  $ret =& $this->ctrl->forwardCommand($fb_gui);
73  $tpl->setContent($ret);
74  break;
75 
76  default:
77  $cmd = $this->ctrl->getCmd("view");
78  if ($cmd != "create")
79  {
80  $this->prepareOutput();
81  }
82  $cmd .= "Object";
83  $this->$cmd();
84  break;
85  }
86  return true;
87  }
88 
89  function createObject()
90  {
91  global $ilCtrl;
92  $ilCtrl->setCmdClass("ilexternalfeedblockgui");
93  $ilCtrl->setCmd("create");
94  return $this->executeCommand();
95  }
96 
101  function save($a_feed_block)
102  {
103  global $rbacadmin, $ilUser;
104 
105  // create and insert forum in objecttree
106  $_GET["new_type"] = "feed";
107  $_POST["Fobject"]["title"] = $a_feed_block->getTitle();
108  $_POST["Fobject"]["desc"] = $a_feed_block->getFeedUrl();
109  $newObj = parent::saveObject();
110  $newObj->setOwner($ilUser->getId());
111  $newObj->updateOwner();
112  $a_feed_block->setContextObjId($newObj->getId());
113  $a_feed_block->setContextObjType("feed");
114 
115  // setup rolefolder & default local roles
116  //$roles = $newObj->initDefaultRoles();
117 
118  // ...finally assign role to creator of object
119  //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
120 
121  }
122 
127  public function exitSave()
128  {
129  global $ilCtrl;
130 
131  // always send a message
132  ilUtil::sendInfo($this->lng->txt("object_added"), true);
133  $this->ctrl->returnToParent($this);
134  }
135 
140  function update($a_feed_block)
141  {
142  global $rbacadmin;
143 
144  // update object
145  $_POST["Fobject"]["title"] = $a_feed_block->getTitle();
146  $_POST["Fobject"]["desc"] = $a_feed_block->getFeedUrl();
147  $newObj = parent::updateObject();
148  }
149 
154  public function cancelUpdate()
155  {
156  global $ilCtrl, $tree;
157 
158  // always send a message
159  //ilUtil::sendInfo($this->lng->txt("object_added"), true);
160 
161  $par = $tree->getParentId($_GET["ref_id"]);
162  $_GET["ref_id"] = $par;
163  $this->redirectToRefId($par);
164 
165  //$this->ctrl->returnToParent($this);
166  }
167 
172  public function afterUpdate()
173  {
174  global $ilCtrl, $tree;
175 
176  // always send a message
177  $par = $tree->getParentId($_GET["ref_id"]);
178  $_GET["ref_id"] = $par;
179  $this->redirectToRefId($par);
180 
181  }
182 
188  function getTabs(&$tabs_gui)
189  {
190  global $rbacsystem, $ilCtrl;
191 
192  if (in_array($ilCtrl->getCmd(), array("create", "saveFeedBlock")))
193  {
194  return;
195  }
196 
197  $ilCtrl->setParameterByClass("ilexternalfeedblockgui", "external_feed_block_id",
198  $_GET["external_feed_block_id"]);
199  $ilCtrl->saveParameter($this, "external_feed_block_id");
200 
201  if ($rbacsystem->checkAccess('write', $this->object->getRefId()))
202  {
203  $force_active = ($_GET["cmd"] == "edit" ||
204  $this->ctrl->getNextClass() == "ilexternalfeedblockgui")
205  ? true
206  : false;
207  $tabs_gui->addTarget("edit_properties",
208  $this->ctrl->getLinkTargetByClass("ilexternalfeedblockgui", "editFeedBlock"),
209  "edit", get_class($this),
210  "", $force_active);
211  }
212 
213  if($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
214  {
215  $tabs_gui->addTarget("perm_settings",
216  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"), "", "ilpermissiongui");
217  }
218 
219  }
220 } // END class.ilObjExternalFeed
221 ?>