ILIAS  release_4-4 Revision
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 ()
 Query BlocksForContext. More...
 
 queryTitleForId ()
 Query TitleForId. More...
 
 queryCntBlockForContext ()
 Query CntBlockForContext. More...
 

Protected Attributes

 $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

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

References read(), and setId().

28  {
29  if ($a_id > 0)
30  {
31  $this->setId($a_id);
32  $this->read();
33  }
34 
35  }
read()
Read item from database.
setId($a_id)
Set Id.
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilCustomBlock::create ( )

Create new item.

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

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

182  {
183  global $ilDB;
184 
185  $this->setId($ilDB->nextId("il_custom_block"));
186  $query = "INSERT INTO il_custom_block (".
187  " id".
188  ", context_obj_id".
189  ", context_obj_type".
190  ", context_sub_obj_id".
191  ", context_sub_obj_type".
192  ", type".
193  ", title".
194  " ) VALUES (".
195  $ilDB->quote($this->getId(), "integer")
196  .",".$ilDB->quote($this->getContextObjId(), "integer")
197  .",".$ilDB->quote($this->getContextObjType(), "text")
198  .",".$ilDB->quote($this->getContextSubObjId(), "integer")
199  .",".$ilDB->quote($this->getContextSubObjType(), "text")
200  .",".$ilDB->quote($this->getType(), "text")
201  .",".$ilDB->quote($this->getTitle(), "text").")";
202  $ilDB->manipulate($query);
203  }
setId($a_id)
Set Id.
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
getContextSubObjId()
Get ContextSubObjId.
getTitle()
Get Title.
getContextObjId()
Get ContextObjId.
+ Here is the call graph for this function:

◆ delete()

ilCustomBlock::delete ( )

Delete item from database.

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

References $query, and getId().

253  {
254  global $ilDB;
255 
256  $query = "DELETE FROM il_custom_block".
257  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
258 
259  $ilDB->manipulate($query);
260 
261  }
+ Here is the call graph for this function:

◆ getContextObjId()

ilCustomBlock::getContextObjId ( )

Get ContextObjId.

Returns
int

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

References $context_obj_id.

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

73  {
74  return (int) $this->context_obj_id;
75  }
+ Here is the caller graph for this function:

◆ getContextObjType()

ilCustomBlock::getContextObjType ( )

Get ContextObjType.

Returns
int

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

References $context_obj_type.

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

93  {
95  }
+ Here is the caller graph for this function:

◆ getContextSubObjId()

ilCustomBlock::getContextSubObjId ( )

Get ContextSubObjId.

Returns
int

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

References $context_sub_obj_id.

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

113  {
114  return (int) $this->context_sub_obj_id;
115  }
+ Here is the caller graph for this function:

◆ getContextSubObjType()

ilCustomBlock::getContextSubObjType ( )

Get ContextSubObjType.

Returns
int

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

References $context_sub_obj_type.

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

133  {
135  }
+ Here is the caller graph for this function:

◆ getId()

ilCustomBlock::getId ( )

◆ getTitle()

ilCustomBlock::getTitle ( )

Get Title.

Returns
string Title of block

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

References $title.

Referenced by create(), and update().

173  {
174  return $this->title;
175  }
+ Here is the caller graph for this function:

◆ getType()

ilCustomBlock::getType ( )

Get Type.

Returns
string Type of block.

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

References $type.

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

153  {
154  return $this->type;
155  }
+ Here is the caller graph for this function:

◆ queryBlocksForContext()

ilCustomBlock::queryBlocksForContext ( )

Query BlocksForContext.

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

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

296  {
297  global $ilDB;
298 
299  $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title ".
300  "FROM il_custom_block ".
301  "WHERE ".
302  "context_obj_id = ".$ilDB->quote($this->getContextObjId(), "integer").
303  " AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), "text").
304  " AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId(), "integer").
305  " AND ".$ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true);
306  //" AND context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType(), "text")."";
307 //echo "$query";
308  $set = $ilDB->query($query);
309  $result = array();
310  while($rec = $ilDB->fetchAssoc($set))
311  {
312  $result[] = $rec;
313  }
314 
315  return $result;
316 
317  }
$result
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
+ Here is the call graph for this function:

◆ queryCntBlockForContext()

ilCustomBlock::queryCntBlockForContext ( )

Query CntBlockForContext.

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

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

348  {
349  global $ilDB;
350 
351  $query = "SELECT count(*) as cnt ".
352  "FROM il_custom_block ".
353  "WHERE ".
354  "context_obj_id = ".$ilDB->quote($this->getContextObjId(), "integer").
355  " AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), "text").
356  " AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId(), "integer").
357  " AND ".$ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true).
358  " AND type = ".$ilDB->quote($this->getType(), "text")."";
359 
360  $set = $ilDB->query($query);
361  $result = array();
362  while($rec = $ilDB->fetchAssoc($set))
363  {
364  $result[] = $rec;
365  }
366 
367  return $result;
368 
369  }
$result
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
+ Here is the call graph for this function:

◆ querygetBlocksForContext()

ilCustomBlock::querygetBlocksForContext ( )

Query getBlocksForContext.

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

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

268  {
269  global $ilDB;
270 
271  $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title ".
272  "FROM il_custom_block ".
273  "WHERE ".
274  "context_obj_id = ".$ilDB->quote($this->getContextObjId(), "integer").
275  " AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), "text").
276  " AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId(), "integer").
277  " AND ".$ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true);
278  //" AND context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType(), "text")."";
279 
280  $set = $ilDB->query($query);
281  $result = array();
282  while($rec = $ilDB->fetchAssoc($set))
283  {
284  $result[] = $rec;
285  }
286 
287  return $result;
288 
289  }
$result
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
+ Here is the call graph for this function:

◆ queryTitleForId()

ilCustomBlock::queryTitleForId ( )

Query TitleForId.

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

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

◆ read()

ilCustomBlock::read ( )

Read item from database.

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

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

Referenced by __construct().

210  {
211  global $ilDB;
212 
213  $query = "SELECT * FROM il_custom_block WHERE id = ".
214  $ilDB->quote($this->getId(), "integer");
215  $set = $ilDB->query($query);
216  $rec = $ilDB->fetchAssoc($set);
217 
218  $this->setContextObjId($rec["context_obj_id"]);
219  $this->setContextObjType($rec["context_obj_type"]);
220  $this->setContextSubObjId($rec["context_sub_obj_id"]);
221  $this->setContextSubObjType($rec["context_sub_obj_type"]);
222  $this->setType($rec["type"]);
223  $this->setTitle($rec["title"]);
224 
225  }
setContextSubObjType($a_context_sub_obj_type)
Set ContextSubObjType.
setContextSubObjId($a_context_sub_obj_id)
Set ContextSubObjId.
setTitle($a_title)
Set Title.
setType($a_type)
Set Type.
setContextObjType($a_context_obj_type)
Set ContextObjType.
setContextObjId($a_context_obj_id)
Set ContextObjId.
+ 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 62 of file class.ilCustomBlock.php.

Referenced by read().

63  {
64  $this->context_obj_id = $a_context_obj_id;
65  }
+ 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 82 of file class.ilCustomBlock.php.

Referenced by read().

83  {
84  $this->context_obj_type = $a_context_obj_type;
85  }
+ 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 102 of file class.ilCustomBlock.php.

Referenced by read().

103  {
104  $this->context_sub_obj_id = $a_context_sub_obj_id;
105  }
+ 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 122 of file class.ilCustomBlock.php.

Referenced by read().

123  {
124  $this->context_sub_obj_type = $a_context_sub_obj_type;
125  }
+ Here is the caller graph for this function:

◆ setId()

ilCustomBlock::setId (   $a_id)

Set Id.

Parameters
int$a_id

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

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

43  {
44  $this->id = $a_id;
45  }
+ Here is the caller graph for this function:

◆ setTitle()

ilCustomBlock::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle of block

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

Referenced by read().

163  {
164  $this->title = $a_title;
165  }
+ Here is the caller graph for this function:

◆ setType()

ilCustomBlock::setType (   $a_type)

Set Type.

Parameters
string$a_typeType of block.

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

Referenced by read().

143  {
144  $this->type = $a_type;
145  }
+ Here is the caller graph for this function:

◆ update()

ilCustomBlock::update ( )

Update item in database.

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

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

232  {
233  global $ilDB;
234 
235  $query = "UPDATE il_custom_block SET ".
236  " context_obj_id = ".$ilDB->quote($this->getContextObjId(), "integer").
237  ", context_obj_type = ".$ilDB->quote($this->getContextObjType(), "text").
238  ", context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId(), "integer").
239  ", context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType(), "text").
240  ", type = ".$ilDB->quote($this->getType(), "text").
241  ", title = ".$ilDB->quote($this->getTitle(), "text").
242  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
243 
244  $ilDB->manipulate($query);
245 
246  }
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
getContextSubObjId()
Get ContextSubObjId.
getTitle()
Get Title.
getContextObjId()
Get ContextObjId.
+ Here is the call graph for this function:

Field Documentation

◆ $context_obj_id

ilCustomBlock::$context_obj_id
protected

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

Referenced by getContextObjId().

◆ $context_obj_type

ilCustomBlock::$context_obj_type
protected

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

Referenced by getContextObjType().

◆ $context_sub_obj_id

ilCustomBlock::$context_sub_obj_id
protected

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

Referenced by getContextSubObjId().

◆ $context_sub_obj_type

ilCustomBlock::$context_sub_obj_type
protected

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

Referenced by getContextSubObjType().

◆ $id

ilCustomBlock::$id
protected

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

Referenced by getId().

◆ $title

ilCustomBlock::$title
protected

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

Referenced by getTitle().

◆ $type

ilCustomBlock::$type
protected

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

Referenced by getType().


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