Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once "./classes/class.ilObject.php";
00025
00033 class ilObjExternalFeed extends ilObject
00034 {
00041 function ilObjExternalFeed($a_id = 0,$a_call_by_reference = true)
00042 {
00043 $this->type = "feed";
00044 $this->ilObject($a_id,$a_call_by_reference);
00045 }
00046
00053 function update()
00054 {
00055 if (!parent::update())
00056 {
00057 return false;
00058 }
00059
00060
00061
00062 return true;
00063 }
00064
00073 public function cloneObject($a_target_id,$a_copy_id = 0)
00074 {
00075 global $ilDB, $ilLog;
00076
00077 $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
00078 $fb = $this->getFeedBlock();
00079
00080 include_once("./Services/Block/classes/class.ilExternalFeedBlock.php");
00081 $new_feed_block = new ilExternalFeedBlock();
00082 $new_feed_block->setContextObjId($new_obj->getId());
00083 $new_feed_block->setContextObjType("feed");
00084
00085 if (is_object($fb))
00086 {
00087 $new_feed_block->setFeedUrl($fb->getFeedUrl());
00088 $new_feed_block->setTitle($fb->getTitle());
00089 }
00090 $new_feed_block->create();
00091
00092 return $new_obj;
00093 }
00094
00101 function delete()
00102 {
00103
00104 if (!parent::delete())
00105 {
00106 return false;
00107 }
00108
00109
00110
00111
00112 include_once("./Services/Block/classes/class.ilCustomBlock.php");
00113 $costum_block = new ilCustomBlock();
00114 $costum_block->setContextObjId($this->getId());
00115 $costum_block->setContextObjType($this->getType());
00116 $c_blocks = $costum_block->queryBlocksForContext();
00117
00118 include_once("./Services/Block/classes/class.ilExternalFeedBlock.php");
00119 foreach($c_blocks as $c_block)
00120 {
00121 if ($c_block["type"] == "feed")
00122 {
00123 $fb = new ilExternalFeedBlock($c_block["id"]);
00124 $fb->delete();
00125 include_once("./Services/Block/classes/class.ilBlockSetting.php");
00126 ilBlockSetting::_deleteSettingsOfBlock($c_block["id"], "feed");
00127 }
00128 }
00129
00130
00131
00132 return true;
00133 }
00134
00135 function getFeedBlock()
00136 {
00137 global $ilLog;
00138
00139
00140 include_once("./Services/Block/classes/class.ilCustomBlock.php");
00141 $costum_block = new ilCustomBlock();
00142 $costum_block->setContextObjId($this->getId());
00143 $costum_block->setContextObjType($this->getType());
00144 $c_blocks = $costum_block->queryBlocksForContext();
00145
00146 include_once("./Services/Block/classes/class.ilExternalFeedBlock.php");
00147 foreach($c_blocks as $c_block)
00148 {
00149 if ($c_block["type"] == "feed")
00150 {
00151 $fb = new ilExternalFeedBlock($c_block["id"]);
00152 return $fb;
00153 }
00154 }
00155
00156 return false;
00157 }
00158
00168 function initDefaultRoles()
00169 {
00170 global $rbacadmin;
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 return $roles ? $roles : array();
00183 }
00184
00198 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00199 {
00200 global $tree;
00201
00202 switch ($a_event)
00203 {
00204 case "link":
00205
00206
00207
00208
00209 break;
00210
00211 case "cut":
00212
00213
00214
00215 break;
00216
00217 case "copy":
00218
00219
00220
00221
00222 break;
00223
00224 case "paste":
00225
00226
00227
00228 break;
00229
00230 case "new":
00231
00232
00233
00234 break;
00235 }
00236
00237
00238 if ($a_node_id==$_GET["ref_id"])
00239 {
00240 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00241 $parent_type = $parent_obj->getType();
00242 if($parent_type == $this->getType())
00243 {
00244 $a_node_id = (int) $tree->getParentId($a_node_id);
00245 }
00246 }
00247
00248 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00249 }
00250
00251 }
00252 ?>