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 92)

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 $author_groups = array(DEFAULT_AUTHOR_GROUPS) (line 156)

The group membership for Authoring privilege

mixed $background_colour = "" (line 119)

Colour of block background

mixed $background_img = NULLVALUE (line 121)

Background image - ID from ax_catalog table, if defined

mixed $blockfm = "" (line 148)

The form name for the current block @access private

mixed $blockid = 0 (line 97)

The id of the current block

mixed $blocklets = array() (line 131)

Array of blocklet objects in this block

mixed $blocklet_sep = 0 (line 113)

Vertical separation of blocklets in pixels

mixed $block_desc = "" (line 99)

The description of the current block

mixed $block_style = "" (line 127)

Manual style entered by user

mixed $block_type = "" (line 144)

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

mixed $border_colour = "" (line 117)

Colour of border

mixed $border_width = 0 (line 115)

Width of border in pixels

mixed $cols = 1 (line 107)

The number of columns in this block

mixed $editor_groups = array(DEFAULT_EDITOR_GROUPS) (line 153)

The group membership for Editor privilege

mixed $entry_groups = array(DEFAULT_ENTRY_GROUPS) (line 159)

The group membership for Entry privilege

mixed $exists = false (line 95)

Whether the block exists in database or not

mixed $exportable = false (line 129)

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

mixed $gutter_colour = "" (line 111)

Colour of inter-column gutter

mixed $gutter_width = 0 (line 109)

Width of inter-column gutter in pixels

mixed $justify = "" (line 123)

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

mixed $language = 0 (line 101)

The language of the block (0 = default)

mixed $lang_direction = "" (line 105)

The language text direction

mixed $lang_encoding = "" (line 103)

The language encoding code

mixed $layoutid (line 133)

The layout this block belongs to

mixed $layout_lang_direction = "" (line 142)

The language direction for the containing layout

mixed $layout_lang_encoding = "" (line 140)

The language encoding for the containing layout

mixed $layout_version = VERSION_UNDEFINED (line 136)

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

mixed $layout_version_count = 0 (line 138)

Count of layout versions in existence.

mixed $mode = "viewing" (line 150)

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

mixed $valign = "" (line 125)

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

Methods
Constructor block (line 171)

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 196)

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 441)

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 741)

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 479)

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 273)

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 773)

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 498)

Index the block.

Index all blocklets of this block using a search engine, if Search Engine indexing is enabled (via the configvalue 'Search Engine Host'). 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 371)

Save the block.

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

void put ()
remove_blocklet (line 455)

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 431)

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 551)

Un-index the block.

Un-index this block from the search engine, if indexing is enabled (via the configvalue 'Search Engine Host'). This has no effect if you are not using the Axyl framework.

void unindex ()
user_can_edit (line 243)

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