• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Modules/ExternalFeed/classes/class.ilObjExternalFeedGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 require_once "./classes/class.ilObjectGUI.php";
00025 
00035 class ilObjExternalFeedGUI extends ilObjectGUI
00036 {
00041         function ilObjExternalFeedGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
00042         {
00043                 $this->type = "feed";
00044                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00045         }
00046         
00047         
00048         function &executeCommand()
00049         {
00050                 global $rbacsystem, $tpl;
00051 
00052                 $next_class = $this->ctrl->getNextClass($this);
00053                 
00054                 switch($next_class)
00055                 {
00056                         case 'ilpermissiongui':
00057                                 $this->prepareOutput();
00058                                 include_once("./classes/class.ilPermissionGUI.php");
00059                                 $perm_gui =& new ilPermissionGUI($this);
00060                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
00061                                 break;
00062                                 
00063                         case "ilexternalfeedblockgui":
00064                                 $this->prepareOutput();
00065                                 include_once("./Services/Block/classes/class.ilExternalFeedBlockGUI.php");
00066                                 $fb_gui =& new ilExternalFeedBlockGUI();
00067                                 $fb_gui->setGuiObject($this);
00068                                 if (is_object($this->object))
00069                                 {
00070                                         $fb_gui->setRefId($this->object->getRefId());
00071                                 }
00072                                 $ret =& $this->ctrl->forwardCommand($fb_gui);
00073                                 $tpl->setContent($ret);
00074                                 break;
00075 
00076                         default:
00077                                 $cmd = $this->ctrl->getCmd("view");
00078                                 if ($cmd != "create")
00079                                 {
00080                                         $this->prepareOutput();
00081                                 }
00082                                 $cmd .= "Object";
00083                                 $this->$cmd();
00084                                 break;
00085                 }
00086                 return true;
00087         }
00088 
00089         function createObject()
00090         {
00091                 global $ilCtrl;
00092                 $ilCtrl->setCmdClass("ilexternalfeedblockgui");
00093                 $ilCtrl->setCmd("create");
00094                 return $this->executeCommand();
00095         }
00096         
00101         function save($a_feed_block)
00102         {
00103                 global $rbacadmin, $ilUser;
00104 
00105                 // create and insert forum in objecttree
00106                 $_GET["new_type"] = "feed";
00107                 $_POST["Fobject"]["title"] = $a_feed_block->getTitle();
00108                 $_POST["Fobject"]["desc"] = $a_feed_block->getFeedUrl();
00109                 $newObj = parent::saveObject();
00110                 $newObj->setOwner($ilUser->getId());
00111                 $newObj->updateOwner();
00112                 $a_feed_block->setContextObjId($newObj->getId());
00113                 $a_feed_block->setContextObjType("feed");
00114 
00115                 // setup rolefolder & default local roles
00116                 //$roles = $newObj->initDefaultRoles();
00117 
00118                 // ...finally assign role to creator of object
00119                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00120 
00121         }
00122         
00127         public function exitSave()
00128         {
00129                 global $ilCtrl;
00130 
00131                 // always send a message
00132                 ilUtil::sendInfo($this->lng->txt("object_added"), true);
00133                 $this->ctrl->returnToParent($this);
00134         }
00135         
00140         function update($a_feed_block)
00141         {
00142                 global $rbacadmin;
00143 
00144                 // update object
00145                 $_POST["Fobject"]["title"] = $a_feed_block->getTitle();
00146                 $_POST["Fobject"]["desc"] = $a_feed_block->getFeedUrl();
00147                 $newObj = parent::updateObject();
00148         }
00149 
00154         public function cancelUpdate()
00155         {
00156                 global $ilCtrl, $tree;
00157 
00158                 // always send a message
00159                 //ilUtil::sendInfo($this->lng->txt("object_added"), true);
00160 
00161                 $par = $tree->getParentId($_GET["ref_id"]);
00162                 $_GET["ref_id"] = $par;
00163                 $this->redirectToRefId($par);
00164                 
00165                 //$this->ctrl->returnToParent($this);
00166         }
00167 
00172         public function afterUpdate()
00173         {
00174                 global $ilCtrl, $tree;
00175 
00176                 // always send a message
00177                 $par = $tree->getParentId($_GET["ref_id"]);
00178                 $_GET["ref_id"] = $par;
00179                 $this->redirectToRefId($par);
00180 
00181         }
00182 
00188         function getTabs(&$tabs_gui)
00189         {
00190                 global $rbacsystem, $ilCtrl;
00191                 
00192                 if (in_array($ilCtrl->getCmd(), array("create", "saveFeedBlock")))
00193                 {
00194                         return;
00195                 }
00196                 
00197                 $ilCtrl->setParameterByClass("ilexternalfeedblockgui", "external_feed_block_id",
00198                         $_GET["external_feed_block_id"]);
00199                 $ilCtrl->saveParameter($this, "external_feed_block_id");
00200 
00201                 if ($rbacsystem->checkAccess('write', $this->object->getRefId()))
00202                 {
00203                         $force_active = ($_GET["cmd"] == "edit" ||
00204                                 $this->ctrl->getNextClass() == "ilexternalfeedblockgui")
00205                                 ? true
00206                                 : false;
00207                         $tabs_gui->addTarget("edit_properties",
00208                                 $this->ctrl->getLinkTargetByClass("ilexternalfeedblockgui", "editFeedBlock"),
00209                                 "edit", get_class($this),
00210                                 "", $force_active);
00211                 }
00212 
00213                 if($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
00214                 {
00215                         $tabs_gui->addTarget("perm_settings",
00216                                 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"), "", "ilpermissiongui");
00217                 }
00218 
00219         }
00220 } // END class.ilObjExternalFeed
00221 ?>

Generated on Fri Dec 13 2013 17:56:50 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1