ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCustomBlock Class Reference

This is the super class of all custom blocks. More...

+ Inheritance diagram for ilCustomBlock:
+ Collaboration diagram for ilCustomBlock:

Public Member Functions

 __construct (int $a_id=0)
 
 setId (int $a_id)
 
 getId ()
 
 setContextObjId (int $a_context_obj_id)
 
 getContextObjId ()
 
 setContextObjType (string $a_context_obj_type)
 
 getContextObjType ()
 
 setContextSubObjId (int $a_context_sub_obj_id)
 
 getContextSubObjId ()
 
 setContextSubObjType (string $a_context_sub_obj_type)
 
 getContextSubObjType ()
 
 setType (string $a_type)
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 create ()
 
 read ()
 
 update ()
 
 delete ()
 
 queryBlocksForContext (bool $a_include_sub_obj=true)
 Query BlocksForContext. More...
 
 queryCntBlockForContext ()
 

Static Public Member Functions

static multiBlockQuery (string $a_context_obj_type, array $a_context_obj_ids)
 

Protected Attributes

ilDBInterface $db
 
int $id = 0
 
int $context_obj_id = 0
 
string $context_obj_type = ""
 
int $context_sub_obj_id = 0
 
string $context_sub_obj_type = ""
 
string $type = ""
 
string $title = ""
 

Detailed Description

This is the super class of all custom blocks.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 25 of file class.ilCustomBlock.php.

Constructor & Destructor Documentation

◆ __construct()

ilCustomBlock::__construct ( int  $a_id = 0)

Reimplemented in ilPollBlock.

Definition at line 36 of file class.ilCustomBlock.php.

38 {
39 global $DIC;
40
41 $this->db = $DIC->database();
42 if ($a_id > 0) {
43 $this->setId($a_id);
44 $this->read();
45 }
46 }
global $DIC
Definition: shib_login.php:26

References $DIC, read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilCustomBlock::create ( )

Definition at line 121 of file class.ilCustomBlock.php.

121 : void
122 {
124
125 $this->setId($ilDB->nextId("il_custom_block"));
126 $query = "INSERT INTO il_custom_block (" .
127 " id" .
128 ", context_obj_id" .
129 ", context_obj_type" .
130 ", context_sub_obj_id" .
131 ", context_sub_obj_type" .
132 ", type" .
133 ", title" .
134 " ) VALUES (" .
135 $ilDB->quote($this->getId(), "integer")
136 . "," . $ilDB->quote($this->getContextObjId(), "integer")
137 . "," . $ilDB->quote($this->getContextObjType(), "text")
138 . "," . $ilDB->quote($this->getContextSubObjId(), "integer")
139 . "," . $ilDB->quote($this->getContextSubObjType(), "text")
140 . "," . $ilDB->quote($this->getType(), "text")
141 . "," . $ilDB->quote($this->getTitle(), "text") . ")";
142 $ilDB->manipulate($query);
143 }
ilDBInterface $db

References $db, $ilDB, getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), getId(), getTitle(), getType(), and setId().

+ Here is the call graph for this function:

◆ delete()

ilCustomBlock::delete ( )

Definition at line 178 of file class.ilCustomBlock.php.

178 : void
179 {
181
182 $query = "DELETE FROM il_custom_block" .
183 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
184
185 $ilDB->manipulate($query);
186 }

References $db, $ilDB, and getId().

+ Here is the call graph for this function:

◆ getContextObjId()

ilCustomBlock::getContextObjId ( )

Definition at line 63 of file class.ilCustomBlock.php.

63 : int
64 {
66 }

References $context_obj_id.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getContextObjType()

ilCustomBlock::getContextObjType ( )

Definition at line 73 of file class.ilCustomBlock.php.

73 : string
74 {
76 }

References $context_obj_type.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getContextSubObjId()

ilCustomBlock::getContextSubObjId ( )

Definition at line 83 of file class.ilCustomBlock.php.

83 : int
84 {
86 }

References $context_sub_obj_id.

Referenced by create(), queryBlocksForContext(), and update().

+ Here is the caller graph for this function:

◆ getContextSubObjType()

ilCustomBlock::getContextSubObjType ( )

Definition at line 93 of file class.ilCustomBlock.php.

93 : string
94 {
96 }

References $context_sub_obj_type.

Referenced by create(), queryBlocksForContext(), and update().

+ Here is the caller graph for this function:

◆ getId()

ilCustomBlock::getId ( )

Definition at line 53 of file class.ilCustomBlock.php.

53 : int
54 {
55 return $this->id;
56 }

References $id.

Referenced by create(), delete(), read(), ilPollBlockGUI\setBlock(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilCustomBlock::getTitle ( )

Definition at line 116 of file class.ilCustomBlock.php.

116 : string
117 {
118 return $this->title;
119 }

References $title.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getType()

ilCustomBlock::getType ( )

Definition at line 106 of file class.ilCustomBlock.php.

106 : string
107 {
108 return $this->type;
109 }

References $type.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ multiBlockQuery()

static ilCustomBlock::multiBlockQuery ( string  $a_context_obj_type,
array  $a_context_obj_ids 
)
static

Definition at line 238 of file class.ilCustomBlock.php.

241 : array {
242 global $DIC;
243
244 $ilDB = $DIC->database();
245
246 $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title " .
247 "FROM il_custom_block " .
248 "WHERE " .
249 $ilDB->in("context_obj_id", $a_context_obj_ids, false, "integer") .
250 " AND context_obj_type = " . $ilDB->quote($a_context_obj_type, "text") .
251 " ORDER BY title";
252 $set = $ilDB->query($query);
253 $result = array();
254 while ($rec = $ilDB->fetchAssoc($set)) {
255 $result[] = $rec;
256 }
257
258 return $result;
259 }

◆ queryBlocksForContext()

ilCustomBlock::queryBlocksForContext ( bool  $a_include_sub_obj = true)

Query BlocksForContext.

Definition at line 191 of file class.ilCustomBlock.php.

193 : array {
195
196 $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title " .
197 "FROM il_custom_block " .
198 "WHERE " .
199 "context_obj_id = " . $ilDB->quote($this->getContextObjId(), "integer") .
200 " AND context_obj_type = " . $ilDB->quote($this->getContextObjType(), "text");
201 if ($a_include_sub_obj) {
202 $query .= " AND context_sub_obj_id = " . $ilDB->quote($this->getContextSubObjId(), "integer") .
203 " AND " . $ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true);
204 //" AND context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType(), "text")."";
205 }
206 //echo "$query";
207 $set = $ilDB->query($query);
208 $result = array();
209 while ($rec = $ilDB->fetchAssoc($set)) {
210 $result[] = $rec;
211 }
212
213 return $result;
214 }

References $ilDB, getContextSubObjId(), and getContextSubObjType().

+ Here is the call graph for this function:

◆ queryCntBlockForContext()

ilCustomBlock::queryCntBlockForContext ( )

Definition at line 216 of file class.ilCustomBlock.php.

216 : array
217 {
219
220 $query = "SELECT count(*) as cnt " .
221 "FROM il_custom_block " .
222 "WHERE " .
223 "context_obj_id = " . $ilDB->quote($this->getContextObjId(), "integer") .
224 " AND context_obj_type = " . $ilDB->quote($this->getContextObjType(), "text") .
225 " AND context_sub_obj_id = " . $ilDB->quote($this->getContextSubObjId(), "integer") .
226 " AND " . $ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true) .
227 " AND type = " . $ilDB->quote($this->getType(), "text");
228
229 $set = $ilDB->query($query);
230 $result = array();
231 while ($rec = $ilDB->fetchAssoc($set)) {
232 $result[] = $rec;
233 }
234
235 return $result;
236 }

References $ilDB.

◆ read()

ilCustomBlock::read ( )

Definition at line 145 of file class.ilCustomBlock.php.

145 : void
146 {
148
149 $query = "SELECT * FROM il_custom_block WHERE id = " .
150 $ilDB->quote($this->getId(), "integer");
151 $set = $ilDB->query($query);
152 $rec = $ilDB->fetchAssoc($set);
153
154 $this->setContextObjId((int) $rec["context_obj_id"]);
155 $this->setContextObjType($rec["context_obj_type"]);
156 $this->setContextSubObjId((int) $rec["context_sub_obj_id"]);
157 $this->setContextSubObjType((string) $rec["context_sub_obj_type"]);
158 $this->setType($rec["type"]);
159 $this->setTitle((string) $rec["title"]);
160 }
setType(string $a_type)
setTitle(string $a_title)
setContextSubObjType(string $a_context_sub_obj_type)
setContextObjType(string $a_context_obj_type)
setContextSubObjId(int $a_context_sub_obj_id)
setContextObjId(int $a_context_obj_id)

References $db, $ilDB, getId(), setContextObjId(), setContextObjType(), setContextSubObjId(), setContextSubObjType(), setTitle(), and setType().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContextObjId()

ilCustomBlock::setContextObjId ( int  $a_context_obj_id)

Definition at line 58 of file class.ilCustomBlock.php.

58 : void
59 {
60 $this->context_obj_id = $a_context_obj_id;
61 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setContextObjType()

ilCustomBlock::setContextObjType ( string  $a_context_obj_type)

Definition at line 68 of file class.ilCustomBlock.php.

68 : void
69 {
70 $this->context_obj_type = $a_context_obj_type;
71 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setContextSubObjId()

ilCustomBlock::setContextSubObjId ( int  $a_context_sub_obj_id)

Definition at line 78 of file class.ilCustomBlock.php.

78 : void
79 {
80 $this->context_sub_obj_id = $a_context_sub_obj_id;
81 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setContextSubObjType()

ilCustomBlock::setContextSubObjType ( string  $a_context_sub_obj_type)

Definition at line 88 of file class.ilCustomBlock.php.

88 : void
89 {
90 $this->context_sub_obj_type = $a_context_sub_obj_type;
91 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilCustomBlock::setId ( int  $a_id)

Definition at line 48 of file class.ilCustomBlock.php.

48 : void
49 {
50 $this->id = $a_id;
51 }

Referenced by __construct(), and create().

+ Here is the caller graph for this function:

◆ setTitle()

ilCustomBlock::setTitle ( string  $a_title)

Definition at line 111 of file class.ilCustomBlock.php.

111 : void
112 {
113 $this->title = $a_title;
114 }

Referenced by read(), and PollBlockTest\testSetTitle().

+ Here is the caller graph for this function:

◆ setType()

ilCustomBlock::setType ( string  $a_type)
Parameters
string$a_typeType of block.

Definition at line 101 of file class.ilCustomBlock.php.

101 : void
102 {
103 $this->type = $a_type;
104 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilCustomBlock::update ( )

Definition at line 162 of file class.ilCustomBlock.php.

162 : void
163 {
165
166 $query = "UPDATE il_custom_block SET " .
167 " context_obj_id = " . $ilDB->quote($this->getContextObjId(), "integer") .
168 ", context_obj_type = " . $ilDB->quote($this->getContextObjType(), "text") .
169 ", context_sub_obj_id = " . $ilDB->quote($this->getContextSubObjId(), "integer") .
170 ", context_sub_obj_type = " . $ilDB->quote($this->getContextSubObjType(), "text") .
171 ", type = " . $ilDB->quote($this->getType(), "text") .
172 ", title = " . $ilDB->quote($this->getTitle(), "text") .
173 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
174
175 $ilDB->manipulate($query);
176 }

References $db, $ilDB, getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), getId(), getTitle(), and getType().

+ Here is the call graph for this function:

Field Documentation

◆ $context_obj_id

int ilCustomBlock::$context_obj_id = 0
protected

Definition at line 29 of file class.ilCustomBlock.php.

Referenced by getContextObjId().

◆ $context_obj_type

string ilCustomBlock::$context_obj_type = ""
protected

Definition at line 30 of file class.ilCustomBlock.php.

Referenced by getContextObjType().

◆ $context_sub_obj_id

int ilCustomBlock::$context_sub_obj_id = 0
protected

Definition at line 31 of file class.ilCustomBlock.php.

Referenced by getContextSubObjId().

◆ $context_sub_obj_type

string ilCustomBlock::$context_sub_obj_type = ""
protected

Definition at line 32 of file class.ilCustomBlock.php.

Referenced by getContextSubObjType().

◆ $db

ilDBInterface ilCustomBlock::$db
protected

Definition at line 27 of file class.ilCustomBlock.php.

Referenced by create(), delete(), read(), and update().

◆ $id

int ilCustomBlock::$id = 0
protected

Definition at line 28 of file class.ilCustomBlock.php.

Referenced by getId().

◆ $title

string ilCustomBlock::$title = ""
protected

Definition at line 34 of file class.ilCustomBlock.php.

Referenced by getTitle().

◆ $type

string ilCustomBlock::$type = ""
protected

Definition at line 33 of file class.ilCustomBlock.php.

Referenced by getType().


The documentation for this class was generated from the following file: