ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 public function __construct($a_id = 0, $a_call_by_reference = true)
22 {
23 global $DIC;
24
25 $this->db = $DIC->database();
26 $this->log = $DIC["ilLog"];
27 $this->type = "feed";
28 parent::__construct($a_id, $a_call_by_reference);
29 }
30
37 public function update()
38 {
39 if (!parent::update()) {
40 return false;
41 }
42
43 // put here object specific stuff
44
45 return true;
46 }
47
56 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
57 {
60
61 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
62 $fb = $this->getFeedBlock();
63
64 $new_feed_block = new ilExternalFeedBlock();
65 $new_feed_block->setContextObjId($new_obj->getId());
66 $new_feed_block->setContextObjType("feed");
67
68 if (is_object($fb)) {
69 $new_feed_block->setFeedUrl($fb->getFeedUrl());
70 $new_feed_block->setTitle($fb->getTitle());
71 }
72 $new_feed_block->create();
73
74 return $new_obj;
75 }
76
83 public function delete()
84 {
85 // always call parent delete function first!!
86 if (!parent::delete()) {
87 return false;
88 }
89
90 //put here your module specific stuff
91
92 // delete feed block
93 include_once("./Services/Block/classes/class.ilCustomBlock.php");
94 $costum_block = new ilCustomBlock();
95 $costum_block->setContextObjId($this->getId());
96 $costum_block->setContextObjType($this->getType());
97 $c_blocks = $costum_block->queryBlocksForContext();
98
99 foreach ($c_blocks as $c_block) { // should be usually only one
100 if ($c_block["type"] == "feed") {
101 $fb = new ilExternalFeedBlock($c_block["id"]);
102 $fb->delete();
103 include_once("./Services/Block/classes/class.ilBlockSetting.php");
104 ilBlockSetting::_deleteSettingsOfBlock($c_block["id"], "feed");
105 }
106 }
107
108 //ilBlockSetting::_lookupSide($type, $user_id, $c_block["id"]);
109
110 return true;
111 }
112
113 public function getFeedBlock()
114 {
116
117 // delete feed block
118 include_once("./Services/Block/classes/class.ilCustomBlock.php");
119 $costum_block = new ilCustomBlock();
120 $costum_block->setContextObjId($this->getId());
121 $costum_block->setContextObjType($this->getType());
122 $c_blocks = $costum_block->queryBlocksForContext();
123
124 foreach ($c_blocks as $c_block) { // should be usually only one
125 if ($c_block["type"] == "feed") {
126 $fb = new ilExternalFeedBlock($c_block["id"]);
127 return $fb;
128 }
129 }
130
131 return false;
132 }
133} // END class.ilObjExternalFeed
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
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilDB
$DIC
Definition: xapitoken.php:46