gyro/core/lib/interfaces/iblock.cls.php
Go to the documentation of this file.00001 <?php 00002 require_once dirname(__FILE__) . '/irenderer.cls.php'; 00003 /** 00004 * Interface for Blcoks 00005 * 00006 * If you are familiar with Drupal (http://drupal.org), the concept of blocks is 00007 * not new to you. A block represents a snipppet of HTML that is grouped along 00008 * with other blocks and placed in a location (left, right, too..) on a page. 00009 * 00010 * Most common use is to build dynamic site bars or footers. 00011 * 00012 * @author Gerd Riesselmann 00013 * @ingroup Interface 00014 */ 00015 interface IBlock extends IRenderer { 00016 const LEFT = 'LEFT'; 00017 const RIGHT = 'RIGHT'; 00018 const TOP = 'TOP'; 00019 const BOTTOM = 'BOTTOM'; 00020 const CONTENT = 'CONTENT'; 00021 00022 /** 00023 * Get title of block (heading) 00024 * 00025 * @return string 00026 */ 00027 public function get_title(); 00028 /** 00029 * Set title of block (heading) 00030 * 00031 * @param string 00032 */ 00033 public function set_title($title); 00034 00035 /** 00036 * Get content of block (HTML) 00037 * 00038 * @return string 00039 */ 00040 public function get_content(); 00041 /** 00042 * Set content of block (HTML) 00043 * 00044 * @param string 00045 */ 00046 public function set_content($content); 00047 00048 /** 00049 * An index to sort blocks 00050 * 00051 * @return integer 00052 */ 00053 public function get_index(); 00054 /** 00055 * Set index to sort blocks 00056 * 00057 * @param integer 00058 */ 00059 public function set_index($index); 00060 00061 /** 00062 * Name (used as CSS class) 00063 * 00064 * @return string 00065 */ 00066 public function get_name(); 00067 /** 00068 * Sets Name (used as CSS class) 00069 * 00070 * @param string 00071 */ 00072 public function set_name($name); 00073 00074 /** 00075 * One of LEFT, RIGHT, CONTENT etc... 00076 * 00077 * @return string 00078 */ 00079 public function get_position(); 00080 /** 00081 * Set position 00082 * 00083 * @param string 00084 */ 00085 public function set_position($position); 00086 00087 /** 00088 * Returns true if this block is valid 00089 * 00090 * @return boolean True if this block has content 00091 */ 00092 public function is_valid(); 00093 00094 /** 00095 * Compare this block to another 00096 * 00097 * @return int 0 if index of this is equal to other's index, -1 if this index is less than and +1 if it is more than other's index 00098 */ 00099 public function compare($other); 00100 } 00101 00102 /** 00103 * Callback function for sorting blocks. Invokes $item_1->compare($item_2); 00104 */ 00105 function gyro_block_sort(&$item_1, &$item_2) { 00106 return $item_1->compare($item_2); 00107 } 00108