ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ($a_id=0)
 Constructor. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setContextObjId ($a_context_obj_id)
 Set ContextObjId. More...
 
 getContextObjId ()
 Get ContextObjId. More...
 
 setContextObjType ($a_context_obj_type)
 Set ContextObjType. More...
 
 getContextObjType ()
 Get ContextObjType. More...
 
 setContextSubObjId ($a_context_sub_obj_id)
 Set ContextSubObjId. More...
 
 getContextSubObjId ()
 Get ContextSubObjId. More...
 
 setContextSubObjType ($a_context_sub_obj_type)
 Set ContextSubObjType. More...
 
 getContextSubObjType ()
 Get ContextSubObjType. More...
 
 setType ($a_type)
 Set Type. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 create ()
 Create new item. More...
 
 read ()
 Read item from database. More...
 
 update ()
 Update item in database. More...
 
 delete ()
 Delete item from database. More...
 
 querygetBlocksForContext ()
 Query getBlocksForContext. More...
 
 queryBlocksForContext ($a_include_sub_obj=true)
 Query BlocksForContext. More...
 
 queryTitleForId ()
 Query TitleForId. More...
 
 queryCntBlockForContext ()
 Query CntBlockForContext. More...
 

Static Public Member Functions

static multiBlockQuery ($a_context_obj_type, array $a_context_obj_ids)
 

Protected Attributes

 $db
 
 $id
 
 $context_obj_id
 
 $context_obj_type
 
 $context_sub_obj_id
 
 $context_sub_obj_type
 
 $type
 
 $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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilCustomBlock::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_id

Reimplemented in ilPollBlock, and ilExternalFeedBlock.

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

33 {
34 global $DIC;
35
36 $this->db = $DIC->database();
37 if ($a_id > 0) {
38 $this->setId($a_id);
39 $this->read();
40 }
41 }
setId($a_id)
Set Id.
read()
Read item from database.
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilCustomBlock::create ( )

Create new item.

Reimplemented in ilExternalFeedBlock.

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

188 {
190
191 $this->setId($ilDB->nextId("il_custom_block"));
192 $query = "INSERT INTO il_custom_block (" .
193 " id" .
194 ", context_obj_id" .
195 ", context_obj_type" .
196 ", context_sub_obj_id" .
197 ", context_sub_obj_type" .
198 ", type" .
199 ", title" .
200 " ) VALUES (" .
201 $ilDB->quote($this->getId(), "integer")
202 . "," . $ilDB->quote($this->getContextObjId(), "integer")
203 . "," . $ilDB->quote($this->getContextObjType(), "text")
204 . "," . $ilDB->quote($this->getContextSubObjId(), "integer")
205 . "," . $ilDB->quote($this->getContextSubObjType(), "text")
206 . "," . $ilDB->quote($this->getType(), "text")
207 . "," . $ilDB->quote($this->getTitle(), "text") . ")";
208 $ilDB->manipulate($query);
209 }
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
getContextObjId()
Get ContextObjId.
getContextSubObjId()
Get ContextSubObjId.
$query
global $ilDB

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

+ Here is the call graph for this function:

◆ delete()

ilCustomBlock::delete ( )

Delete item from database.

Reimplemented in ilExternalFeedBlock.

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

257 {
259
260 $query = "DELETE FROM il_custom_block" .
261 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
262
263 $ilDB->manipulate($query);
264 }

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

+ Here is the call graph for this function:

◆ getContextObjId()

ilCustomBlock::getContextObjId ( )

Get ContextObjId.

Returns
int

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

79 {
80 return (int) $this->context_obj_id;
81 }

References $context_obj_id.

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

+ Here is the caller graph for this function:

◆ getContextObjType()

ilCustomBlock::getContextObjType ( )

Get ContextObjType.

Returns
int

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

99 {
101 }

References $context_obj_type.

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

+ Here is the caller graph for this function:

◆ getContextSubObjId()

ilCustomBlock::getContextSubObjId ( )

Get ContextSubObjId.

Returns
int

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

119 {
120 return (int) $this->context_sub_obj_id;
121 }

References $context_sub_obj_id.

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

+ Here is the caller graph for this function:

◆ getContextSubObjType()

ilCustomBlock::getContextSubObjType ( )

Get ContextSubObjType.

Returns
int

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

139 {
141 }

References $context_sub_obj_type.

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

+ Here is the caller graph for this function:

◆ getId()

ilCustomBlock::getId ( )

Get Id.

Returns
int

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

59 {
60 return $this->id;
61 }

References $id.

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

+ Here is the caller graph for this function:

◆ getTitle()

ilCustomBlock::getTitle ( )

Get Title.

Returns
string Title of block

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

179 {
180 return $this->title;
181 }

References $title.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getType()

ilCustomBlock::getType ( )

Get Type.

Returns
string Type of block.

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

159 {
160 return $this->type;
161 }

References $type.

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

+ Here is the caller graph for this function:

◆ multiBlockQuery()

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

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

371 {
372 global $DIC;
373
374 $ilDB = $DIC->database();
375
376 $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title " .
377 "FROM il_custom_block " .
378 "WHERE " .
379 $ilDB->in("context_obj_id", $a_context_obj_ids, "", "integer") .
380 " AND context_obj_type = " . $ilDB->quote($a_context_obj_type, "text") .
381 " ORDER BY title";
382 $set = $ilDB->query($query);
383 $result = array();
384 while ($rec = $ilDB->fetchAssoc($set)) {
385 $result[] = $rec;
386 }
387
388 return $result;
389 }
$result

References $DIC, $ilDB, $query, and $result.

◆ queryBlocksForContext()

ilCustomBlock::queryBlocksForContext (   $a_include_sub_obj = true)

Query BlocksForContext.

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

297 {
299
300 $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title " .
301 "FROM il_custom_block " .
302 "WHERE " .
303 "context_obj_id = " . $ilDB->quote($this->getContextObjId(), "integer") .
304 " AND context_obj_type = " . $ilDB->quote($this->getContextObjType(), "text");
305 if ($a_include_sub_obj_id) {
306 $query .= " AND context_sub_obj_id = " . $ilDB->quote($this->getContextSubObjId(), "integer") .
307 " AND " . $ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true);
308 //" AND context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType(), "text")."";
309 }
310 //echo "$query";
311 $set = $ilDB->query($query);
312 $result = array();
313 while ($rec = $ilDB->fetchAssoc($set)) {
314 $result[] = $rec;
315 }
316
317 return $result;
318 }

References $db, $ilDB, $query, $result, getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

+ Here is the call graph for this function:

◆ queryCntBlockForContext()

ilCustomBlock::queryCntBlockForContext ( )

Query CntBlockForContext.

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

349 {
351
352 $query = "SELECT count(*) as cnt " .
353 "FROM il_custom_block " .
354 "WHERE " .
355 "context_obj_id = " . $ilDB->quote($this->getContextObjId(), "integer") .
356 " AND context_obj_type = " . $ilDB->quote($this->getContextObjType(), "text") .
357 " AND context_sub_obj_id = " . $ilDB->quote($this->getContextSubObjId(), "integer") .
358 " AND " . $ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true) .
359 " AND type = " . $ilDB->quote($this->getType(), "text") . "";
360
361 $set = $ilDB->query($query);
362 $result = array();
363 while ($rec = $ilDB->fetchAssoc($set)) {
364 $result[] = $rec;
365 }
366
367 return $result;
368 }

References $db, $ilDB, $query, $result, getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), and getType().

+ Here is the call graph for this function:

◆ querygetBlocksForContext()

ilCustomBlock::querygetBlocksForContext ( )

Query getBlocksForContext.

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

271 {
273
274 $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title " .
275 "FROM il_custom_block " .
276 "WHERE " .
277 "context_obj_id = " . $ilDB->quote($this->getContextObjId(), "integer") .
278 " AND context_obj_type = " . $ilDB->quote($this->getContextObjType(), "text") .
279 " AND context_sub_obj_id = " . $ilDB->quote($this->getContextSubObjId(), "integer") .
280 " AND " . $ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true);
281 //" AND context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType(), "text")."";
282
283 $set = $ilDB->query($query);
284 $result = array();
285 while ($rec = $ilDB->fetchAssoc($set)) {
286 $result[] = $rec;
287 }
288
289 return $result;
290 }

References $db, $ilDB, $query, $result, getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

+ Here is the call graph for this function:

◆ queryTitleForId()

ilCustomBlock::queryTitleForId ( )

Query TitleForId.

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

325 {
327 die("ilCustomBlock::queryTitleForId is deprecated");
328 /*
329 $query = "SELECT id ".
330 "FROM il_custom_block ".
331 "WHERE "."";
332
333 $set = $ilDB->query($query);
334 $result = array();
335 while($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
336 {
337 $result[] = $rec;
338 }
339
340 return $result;
341 */
342 }

References $db, and $ilDB.

◆ read()

ilCustomBlock::read ( )

Read item from database.

Reimplemented in ilExternalFeedBlock.

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

216 {
218
219 $query = "SELECT * FROM il_custom_block WHERE id = " .
220 $ilDB->quote($this->getId(), "integer");
221 $set = $ilDB->query($query);
222 $rec = $ilDB->fetchAssoc($set);
223
224 $this->setContextObjId($rec["context_obj_id"]);
225 $this->setContextObjType($rec["context_obj_type"]);
226 $this->setContextSubObjId($rec["context_sub_obj_id"]);
227 $this->setContextSubObjType($rec["context_sub_obj_type"]);
228 $this->setType($rec["type"]);
229 $this->setTitle($rec["title"]);
230 }
setTitle($a_title)
Set Title.
setContextSubObjType($a_context_sub_obj_type)
Set ContextSubObjType.
setContextObjType($a_context_obj_type)
Set ContextObjType.
setContextObjId($a_context_obj_id)
Set ContextObjId.
setType($a_type)
Set Type.
setContextSubObjId($a_context_sub_obj_id)
Set ContextSubObjId.

References $db, $ilDB, $query, 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 (   $a_context_obj_id)

Set ContextObjId.

Parameters
int$a_context_obj_id

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

69 {
70 $this->context_obj_id = $a_context_obj_id;
71 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setContextObjType()

ilCustomBlock::setContextObjType (   $a_context_obj_type)

Set ContextObjType.

Parameters
int$a_context_obj_type

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

89 {
90 $this->context_obj_type = $a_context_obj_type;
91 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setContextSubObjId()

ilCustomBlock::setContextSubObjId (   $a_context_sub_obj_id)

Set ContextSubObjId.

Parameters
int$a_context_sub_obj_id

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

109 {
110 $this->context_sub_obj_id = $a_context_sub_obj_id;
111 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setContextSubObjType()

ilCustomBlock::setContextSubObjType (   $a_context_sub_obj_type)

Set ContextSubObjType.

Parameters
int$a_context_sub_obj_type

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

129 {
130 $this->context_sub_obj_type = $a_context_sub_obj_type;
131 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilCustomBlock::setId (   $a_id)

Set Id.

Parameters
int$a_id

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

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

Referenced by __construct(), ilExternalFeedBlock\__construct(), and create().

+ Here is the caller graph for this function:

◆ setTitle()

ilCustomBlock::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle of block

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

169 {
170 $this->title = $a_title;
171 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilCustomBlock::setType (   $a_type)

Set Type.

Parameters
string$a_typeType of block.

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

149 {
150 $this->type = $a_type;
151 }
$a_type
Definition: workflow.php:92

References $a_type.

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilCustomBlock::update ( )

Update item in database.

Reimplemented in ilExternalFeedBlock.

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

237 {
239
240 $query = "UPDATE il_custom_block SET " .
241 " context_obj_id = " . $ilDB->quote($this->getContextObjId(), "integer") .
242 ", context_obj_type = " . $ilDB->quote($this->getContextObjType(), "text") .
243 ", context_sub_obj_id = " . $ilDB->quote($this->getContextSubObjId(), "integer") .
244 ", context_sub_obj_type = " . $ilDB->quote($this->getContextSubObjType(), "text") .
245 ", type = " . $ilDB->quote($this->getType(), "text") .
246 ", title = " . $ilDB->quote($this->getTitle(), "text") .
247 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
248
249 $ilDB->manipulate($query);
250 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $context_obj_id

ilCustomBlock::$context_obj_id
protected

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

Referenced by getContextObjId().

◆ $context_obj_type

ilCustomBlock::$context_obj_type
protected

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

Referenced by getContextObjType().

◆ $context_sub_obj_id

ilCustomBlock::$context_sub_obj_id
protected

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

Referenced by getContextSubObjId().

◆ $context_sub_obj_type

ilCustomBlock::$context_sub_obj_type
protected

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

Referenced by getContextSubObjType().

◆ $db

◆ $id

ilCustomBlock::$id
protected

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

Referenced by getId().

◆ $title

ilCustomBlock::$title
protected

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

Referenced by getTitle().

◆ $type

ilCustomBlock::$type
protected

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

Referenced by getType().


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