ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjExternalFeed.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./Services/Object/classes/class.ilObject.php";
5
14{
21 function __construct($a_id = 0,$a_call_by_reference = true)
22 {
23 $this->type = "feed";
24 parent::__construct($a_id,$a_call_by_reference);
25 }
26
33 function update()
34 {
35 if (!parent::update())
36 {
37 return false;
38 }
39
40 // put here object specific stuff
41
42 return true;
43 }
44
53 public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree = false)
54 {
55 global $ilDB, $ilLog;
56
57 $new_obj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
58 $fb = $this->getFeedBlock();
59
60 include_once("./Services/Block/classes/class.ilExternalFeedBlock.php");
61 $new_feed_block = new ilExternalFeedBlock();
62 $new_feed_block->setContextObjId($new_obj->getId());
63 $new_feed_block->setContextObjType("feed");
64
65 if (is_object($fb))
66 {
67 $new_feed_block->setFeedUrl($fb->getFeedUrl());
68 $new_feed_block->setTitle($fb->getTitle());
69 }
70 $new_feed_block->create();
71
72 return $new_obj;
73 }
74
81 function delete()
82 {
83 // always call parent delete function first!!
84 if (!parent::delete())
85 {
86 return false;
87 }
88
89 //put here your module specific stuff
90
91 // delete feed block
92 include_once("./Services/Block/classes/class.ilCustomBlock.php");
93 $costum_block = new ilCustomBlock();
94 $costum_block->setContextObjId($this->getId());
95 $costum_block->setContextObjType($this->getType());
96 $c_blocks = $costum_block->queryBlocksForContext();
97
98 include_once("./Services/Block/classes/class.ilExternalFeedBlock.php");
99 foreach($c_blocks as $c_block) // should be usually only one
100 {
101 if ($c_block["type"] == "feed")
102 {
103 $fb = new ilExternalFeedBlock($c_block["id"]);
104 $fb->delete();
105 include_once("./Services/Block/classes/class.ilBlockSetting.php");
106 ilBlockSetting::_deleteSettingsOfBlock($c_block["id"], "feed");
107 }
108 }
109
110 //ilBlockSetting::_lookupSide($type, $user_id, $c_block["id"]);
111
112 return true;
113 }
114
115 function getFeedBlock()
116 {
117 global $ilLog;
118
119 // delete feed block
120 include_once("./Services/Block/classes/class.ilCustomBlock.php");
121 $costum_block = new ilCustomBlock();
122 $costum_block->setContextObjId($this->getId());
123 $costum_block->setContextObjType($this->getType());
124 $c_blocks = $costum_block->queryBlocksForContext();
125
126 include_once("./Services/Block/classes/class.ilExternalFeedBlock.php");
127 foreach($c_blocks as $c_block) // should be usually only one
128 {
129 if ($c_block["type"] == "feed")
130 {
131 $fb = new ilExternalFeedBlock($c_block["id"]);
132 return $fb;
133 }
134 }
135
136 return false;
137 }
138
139} // END class.ilObjExternalFeed
140?>
An exception for terminatinating execution or to throw for unit testing.
static _deleteSettingsOfBlock($a_block_id, $a_block_type)
Delete block settings of block.
This is the super class of all custom blocks.
Custom block for external feeds.
Class ilObjExternalFeed.
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
update()
update object data
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone.
Class ilObject Basic functions for all objects.
getType()
get object type @access public
getId()
get object id @access public
global $ilDB