Public Member Functions | Protected Attributes

ilCustomBlock Class Reference

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

Inheritance diagram for ilCustomBlock:

Public Member Functions

 __construct ($a_id=0)
 Constructor.
 setId ($a_id)
 Set Id.
 getId ()
 Get Id.
 setContextObjId ($a_context_obj_id)
 Set ContextObjId.
 getContextObjId ()
 Get ContextObjId.
 setContextObjType ($a_context_obj_type)
 Set ContextObjType.
 getContextObjType ()
 Get ContextObjType.
 setContextSubObjId ($a_context_sub_obj_id)
 Set ContextSubObjId.
 getContextSubObjId ()
 Get ContextSubObjId.
 setContextSubObjType ($a_context_sub_obj_type)
 Set ContextSubObjType.
 getContextSubObjType ()
 Get ContextSubObjType.
 setType ($a_type)
 Set Type.
 getType ()
 Get Type.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 create ()
 Create new item.
 read ()
 Read item from database.
 update ()
 Update item in database.
 delete ()
 Delete item from database.
 querygetBlocksForContext ()
 Query getBlocksForContext.
 queryBlocksForContext ()
 Query BlocksForContext.
 queryTitleForId ()
 Query TitleForId.
 queryCntBlockForContext ()
 Query CntBlockForContext.

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.killing@gmx.de>
Version:
$Id$

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


Constructor & Destructor Documentation

ilCustomBlock::__construct ( a_id = 0  ) 

Constructor.

Parameters:
int $a_id

Reimplemented in ilExternalFeedBlock, and ilHtmlBlock.

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

References read(), and setId().

        {
                if ($a_id > 0)
                {
                        $this->setId($a_id);
                        $this->read();
                }

        }

Here is the call graph for this function:


Member Function Documentation

ilCustomBlock::create (  ) 

Create new item.

Reimplemented in ilExternalFeedBlock, and ilHtmlBlock.

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

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

        {
                global $ilDB;
                
                $query = "INSERT INTO il_custom_block (".
                        " context_obj_id".
                        ", context_obj_type".
                        ", context_sub_obj_id".
                        ", context_sub_obj_type".
                        ", type".
                        ", title".
                        " ) VALUES (".
                        $ilDB->quote($this->getContextObjId())
                        .",".$ilDB->quote($this->getContextObjType())
                        .",".$ilDB->quote($this->getContextSubObjId())
                        .",".$ilDB->quote($this->getContextSubObjType())
                        .",".$ilDB->quote($this->getType())
                        .",".$ilDB->quote($this->getTitle()).")";
                $ilDB->query($query);
                $this->setId($ilDB->getLastInsertId());
                

        }

Here is the call graph for this function:

ilCustomBlock::delete (  ) 

Delete item from database.

Reimplemented in ilExternalFeedBlock, and ilHtmlBlock.

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

References getId().

        {
                global $ilDB;
                
                $query = "DELETE FROM il_custom_block".
                        " WHERE id = ".$ilDB->quote($this->getId());
                
                $ilDB->query($query);

        }

Here is the call graph for this function:

ilCustomBlock::getContextObjId (  ) 

Get ContextObjId.

Returns:
int

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

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

        {
                return $this->context_obj_id;
        }

Here is the caller graph for this function:

ilCustomBlock::getContextObjType (  ) 

Get ContextObjType.

Returns:
int

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

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

        {
                return $this->context_obj_type;
        }

Here is the caller graph for this function:

ilCustomBlock::getContextSubObjId (  ) 

Get ContextSubObjId.

Returns:
int

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

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

        {
                return $this->context_sub_obj_id;
        }

Here is the caller graph for this function:

ilCustomBlock::getContextSubObjType (  ) 

Get ContextSubObjType.

Returns:
int

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

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

        {
                return $this->context_sub_obj_type;
        }

Here is the caller graph for this function:

ilCustomBlock::getId (  ) 
ilCustomBlock::getTitle (  ) 

Get Title.

Returns:
string Title of block

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

Referenced by create(), and update().

        {
                return $this->title;
        }

Here is the caller graph for this function:

ilCustomBlock::getType (  ) 

Get Type.

Returns:
string Type of block.

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

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

        {
                return $this->type;
        }

Here is the caller graph for this function:

ilCustomBlock::queryBlocksForContext (  ) 

Query BlocksForContext.

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

References getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

        {
                global $ilDB;
                
                $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title ".
                        "FROM il_custom_block ".
                        "WHERE ".
                                "context_obj_id = ".$ilDB->quote($this->getContextObjId()).
                                " AND context_obj_type = ".$ilDB->quote($this->getContextObjType()).
                                " AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId()).
                                " AND context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType())."";
                                
                $set = $ilDB->query($query);
                $result = array();
                while($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $result[] = $rec;
                }
                
                return $result;

        }

Here is the call graph for this function:

ilCustomBlock::queryCntBlockForContext (  ) 

Query CntBlockForContext.

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

References getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), and getType().

        {
                global $ilDB;
                
                $query = "SELECT count(*) as cnt ".
                        "FROM il_custom_block ".
                        "WHERE ".
                                "context_obj_id = ".$ilDB->quote($this->getContextObjId()).
                                " AND context_obj_type = ".$ilDB->quote($this->getContextObjType()).
                                " AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId()).
                                " AND context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType()).
                                " AND type = ".$ilDB->quote($this->getType())."";
                                
                $set = $ilDB->query($query);
                $result = array();
                while($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $result[] = $rec;
                }
                
                return $result;

        }

Here is the call graph for this function:

ilCustomBlock::querygetBlocksForContext (  ) 

Query getBlocksForContext.

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

References getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

        {
                global $ilDB;
                
                $query = "SELECT id, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, type, title ".
                        "FROM il_custom_block ".
                        "WHERE ".
                                "context_obj_id = ".$ilDB->quote($this->getContextObjId()).
                                " AND context_obj_type = ".$ilDB->quote($this->getContextObjType()).
                                " AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId()).
                                " AND context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType())."";
                                
                $set = $ilDB->query($query);
                $result = array();
                while($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $result[] = $rec;
                }
                
                return $result;

        }

Here is the call graph for this function:

ilCustomBlock::queryTitleForId (  ) 

Query TitleForId.

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

        {
                global $ilDB;
                
                $query = "SELECT id ".
                        "FROM il_custom_block ".
                        "WHERE "."";
                                
                $set = $ilDB->query($query);
                $result = array();
                while($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $result[] = $rec;
                }
                
                return $result;

        }

ilCustomBlock::read (  ) 

Read item from database.

Reimplemented in ilExternalFeedBlock, and ilHtmlBlock.

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

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

Referenced by __construct().

        {
                global $ilDB;
                
                $query = "SELECT * FROM il_custom_block WHERE id = ".
                        $ilDB->quote($this->getId());
                $set = $ilDB->query($query);
                $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);

                $this->setContextObjId($rec["context_obj_id"]);
                $this->setContextObjType($rec["context_obj_type"]);
                $this->setContextSubObjId($rec["context_sub_obj_id"]);
                $this->setContextSubObjType($rec["context_sub_obj_type"]);
                $this->setType($rec["type"]);
                $this->setTitle($rec["title"]);

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCustomBlock::setContextObjId ( a_context_obj_id  ) 

Set ContextObjId.

Parameters:
int $a_context_obj_id

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

Referenced by read().

        {
                $this->context_obj_id = $a_context_obj_id;
        }

Here is the caller graph for this function:

ilCustomBlock::setContextObjType ( a_context_obj_type  ) 

Set ContextObjType.

Parameters:
int $a_context_obj_type

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

Referenced by read().

        {
                $this->context_obj_type = $a_context_obj_type;
        }

Here is the caller graph for this function:

ilCustomBlock::setContextSubObjId ( a_context_sub_obj_id  ) 

Set ContextSubObjId.

Parameters:
int $a_context_sub_obj_id

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

Referenced by read().

        {
                $this->context_sub_obj_id = $a_context_sub_obj_id;
        }

Here is the caller graph for this function:

ilCustomBlock::setContextSubObjType ( a_context_sub_obj_type  ) 

Set ContextSubObjType.

Parameters:
int $a_context_sub_obj_type

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

Referenced by read().

        {
                $this->context_sub_obj_type = $a_context_sub_obj_type;
        }

Here is the caller graph for this function:

ilCustomBlock::setId ( a_id  ) 

Set Id.

Parameters:
int $a_id

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

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

        {
                $this->id = $a_id;
        }

Here is the caller graph for this function:

ilCustomBlock::setTitle ( a_title  ) 

Set Title.

Parameters:
string $a_title Title of block

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

Referenced by read().

        {
                $this->title = $a_title;
        }

Here is the caller graph for this function:

ilCustomBlock::setType ( a_type  ) 

Set Type.

Parameters:
string $a_type Type of block.

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

Referenced by read().

        {
                $this->type = $a_type;
        }

Here is the caller graph for this function:

ilCustomBlock::update (  ) 

Update item in database.

Reimplemented in ilExternalFeedBlock, and ilHtmlBlock.

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

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

        {
                global $ilDB;
                
                $query = "UPDATE il_custom_block SET ".
                        " context_obj_id = ".$ilDB->quote($this->getContextObjId()).
                        ", context_obj_type = ".$ilDB->quote($this->getContextObjType()).
                        ", context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId()).
                        ", context_sub_obj_type = ".$ilDB->quote($this->getContextSubObjType()).
                        ", type = ".$ilDB->quote($this->getType()).
                        ", title = ".$ilDB->quote($this->getTitle()).
                        " WHERE id = ".$ilDB->quote($this->getId());
                
                $ilDB->query($query);

        }

Here is the call graph for this function:


Field Documentation

ilCustomBlock::$context_obj_id [protected]

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

ilCustomBlock::$context_obj_type [protected]

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

ilCustomBlock::$context_sub_obj_id [protected]

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

ilCustomBlock::$context_sub_obj_type [protected]

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

ilCustomBlock::$id [protected]

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

ilCustomBlock::$title [protected]

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

ilCustomBlock::$type [protected]

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


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