Class block

Description

Block

We define a class called a 'block'. This can contain multiple 'blocklet' elements which fill up a block top-to-bottom. A block can be divided into multiple columns, and blocklets fill these left-to-right. Blocklets can be of several defined blocklet_types: Text, List, Ordered list, Bullets, and Table A blocklet can also have a heading and a ruler defined for it, with various formatting properties. Provision is also made for inserting special 'tags' into the blocklet content which are translated by the system accordingly. These are: Data - tags to access database information Images - reference to a resident image Links - A clickable link (url) Doc links - A link to a resident document file

Located in /block-defs.php (line 85)

RenderableObject
   |
   --block
Variable Summary
Method Summary
 block block ([string $id = NEW_BLOCK])
 void add_blocklet ()
 string csv ()
 void delete ()
 void get ([string $id = ""])
 string html ()
 void index (string $path, string $title, [string $category = ""], [string $metadata = false])
 void put ()
 void remove_blocklet (mixed $id)
 void replicate ([mixed $layoutname = ""])
 void unindex ()
 boolean user_can_edit ([mixed $required_version = VERSION_UNDEFINED])
Variables
mixed $background_colour = "" (line 112)

Colour of block background

mixed $background_img = NULLVALUE (line 114)

Background image - ID from ax_catalog table, if defined

mixed $blockfm = "" (line 141)

The form name for the current block @access private

mixed $blockid = 0 (line 90)

The id of the current block

mixed $blocklets = array() (line 124)

Array of blocklet objects in this block

mixed $blocklet_sep = 0 (line 106)

Vertical separation of blocklets in pixels

mixed $block_desc (line 92)

The description of the current block

mixed $block_style = "" (line 120)

Manual style entered by user

mixed $block_type = "" (line 137)

Type of block, ""=empty, "b"=block content, "w"=wysiwyg, "p"=plain cell

mixed $border_colour = "" (line 110)

Colour of border

mixed $border_width = 0 (line 108)

Width of border in pixels

mixed $cols = 1 (line 100)

The number of columns in this block

mixed $exists = false (line 88)

Whether the block exists in database or not

mixed $exportable = false (line 122)

If true, then an EXPORT button will be provided for CSV dump

mixed $gutter_colour = "" (line 104)

Colour of inter-column gutter

mixed $gutter_width = 0 (line 102)

Width of inter-column gutter in pixels

mixed $justify = "" (line 116)

Justification: 'left', 'center', 'right'

mixed $language = 0 (line 94)

The language of the block (0 = default)

mixed $lang_direction = "" (line 98)

The language text direction

mixed $lang_encoding = "" (line 96)

The language encoding code

mixed $layoutid (line 126)

The layout this block belongs to

mixed $layout_lang_direction = "" (line 135)

The language direction for the containing layout

mixed $layout_lang_encoding = "" (line 133)

The language encoding for the containing layout

mixed $layout_version = VERSION_UNDEFINED (line 129)

Version of layout this block belongs to (optional). If present

mixed $layout_version_count = 0 (line 131)

Count of layout versions in existence.

mixed $mode = "viewing" (line 143)

Mode of operation, 'viewing', 'editing', 'saving' @access private

mixed $valign = "" (line 118)

Vertical alignment: 'top', 'middle', 'bottom'

Methods
Constructor block (line 155)

Constructor Create a new block object.

Blocks are self-contained entities, and so this constructor is written to return the rendered block content. This just allows you to avoid having to make the render() call, and use the constructor to return the block content in one hit.

block block ([string $id = NEW_BLOCK])
  • string $id: The unique name/identity of the block. $return string The block content, whatever that may be.
activate_editing (line 180)

Provide a blockeditor. This is used to instantiate a blockeditor object for when we need to change this block somewhow. We only need one, so we check if it's already been done first.

void activate_editing ()
add_blocklet (line 413)

Add a new blocklet to the block.

This adds a new blocklet to the list, but does not add any records to the database.

void add_blocklet ()
csv (line 705)

Render the block content as a CSV formatted stream. This is designed to facilitate the exporting of complex tables of data as CSV format for importing into spreadsheets, or databases etc.

  • return: The content in CSV format.
string csv ()
delete (line 451)

Delete this block from the database. NB: we do not rely on RI to do this since various versions of Postgres don't support this nicely.

All related entities are explicitly deleted in a transaction.

void delete ()
get (line 245)

Get the block.

Retrieves the specified block from database.

void get ([string $id = ""])
  • string $id: The unique name/identity of the block to get
html (line 737)

Render the block content according to the mode of operation we are in. Possible modes: 'viewing', 'editing', 'saving'.

  • return: The HTML
string html ()

Redefinition of:
RenderableObject::html()
Return output suitable for normal HTML-capable device. This method must be over-ridden by a method of the same name in the descendant class which renders output to web browsers.
index (line 470)

Index the block.

Index all blocklets of this block using Lucene, if Lucene indexing is enabled (via the configvalue 'Lucene Site Indexing'). This has no effect unless you are using the Axyl framework. Notes: This method indexes the blocklets in this block which are at the present time in the database, ie. not the blocklets as defined in this block object. This method is usually called from the POSTprocess() method, just after saving any changes to the database.

void index (string $path, string $title, [string $category = ""], [string $metadata = false])
  • string $path: The relative path to the webpage this block is in
  • string $title: The title of the webpage this block is in
  • string $category: The category string to index content with
  • string $metadata: Metadata object containing metadata to index
put (line 343)

Save the block.

Save this block to the database. Create a new one if it doesn't already exist.

void put ()
remove_blocklet (line 427)

Remove blocklet from the block.

We remove the entry from the block_blocklet link table, and, if it is the last link involving the blocklet we delete the blocklet record.

void remove_blocklet (mixed $id)
replicate (line 403)

Replicate this block into a new block with a new set of blocklets as a complete content copy of this original block.

NOTE: We end up with this current block as the replicated one.

void replicate ([mixed $layoutname = ""])
unindex (line 517)

Un-index the block.

Un-index this block from Lucene, if Lucene indexing is enabled (via the configvalue 'Lucene Site Indexing'). This has no effect if you are not using the Axyl framework.

void unindex ()
user_can_edit (line 215)

Return true if the current user is permitted to edit block details.

We allow editing only for versions VERSION_PENDING and VERSION_LIVE and the latter only for Editors.

  • return: True if editing is permitted by current user.
boolean user_can_edit ([mixed $required_version = VERSION_UNDEFINED])

Inherited Methods

Inherited From RenderableObject

 RenderableObject::RenderableObject()
 RenderableObject::html()
 RenderableObject::render()
 RenderableObject::wml()
 RenderableObject::wmlup()
 RenderableObject::xml()

Documentation generated by phpDocumentor 1.3.0RC3