.

DataObjectPostBase Class Reference

Model class for a rich content item. More...

Inheritance diagram for DataObjectPostBase:
DataObjectTimestampedCached ISelfDescribing DataObjectCached ITimeStamped DataObjectBase IDataObject IActionSource ISearchAdapter IDBTable IDBWhereHolder DataObjectPostOriginatedBase

List of all members.

Public Member Functions

  get_description ()
  Get description for this instance.
  get_meta_description ()
  Returns meta description.
  get_meta_title ()
  Returns meta title.
  get_sort_default_column ()
  Get the column to sort by default.
  get_sortable_columns ()
  Return array of sortable columns.
  get_teaser ()
  Get text for this instance.
  get_text ()
  Get text for this instance.
  get_title ()
  Get title for this class.

Static Public Member Functions

static  extend_table ($arr_fields)
  Extend every instance that extends PostBase by arbitrary many fields.

Public Attributes

  $id
  $meta_description
  $meta_keywords
  $meta_title
  $teaser
  $text
  $title

Protected Member Functions

  collect_field_definitions ()
  Collect all table fields.
  collect_relations ()
  Should be overloaded only by classes which single purpose is to be overloaded itself.
  create_table_object ()
  Create Table features.
  get_actions_for_context ($context, $user, $params)
  To be overloaded.
  get_additional_field_definitions ()
  Too be overloaded.
  get_additional_relations ()
  Too be overloaded.
  get_global_field_definitions ()
  Return global extension.
  get_meta_tag_fields ()
  Returns fields for meta tag information.
  get_model_name ()
  Too be overloaded.
  get_teaser_field ()
  Returns teaser field.
  get_teaser_field_policy ()
  Return policy for teaser.
  get_text_field_policy ()
  Return policy for text.

Detailed Description

Model class for a rich content item.

Author:
Gerd Riesselmann

Definition at line 8 of file dataobject.post.base.cls.php.


Member Function Documentation

DataObjectPostBase::collect_field_definitions (  )  [protected]

Collect all table fields.

Should be overloaded only by classes which single purpose is to be overloaded itself. The rest should overload get_additional_field_definitions()

Returns:
array

Reimplemented in DataObjectPostOriginatedBase.

Definition at line 41 of file dataobject.post.base.cls.php.

00041                                                        {
00042                 return array_merge(
00043                         array(
00044                                 new DBFieldInt('id', null, DBFieldInt::PRIMARY_KEY),
00045                                 new DBFieldText('title', 200, null, DBField::NOT_NULL),
00046                                 new DBFieldTextHtml('text', DBFieldText::BLOB_LENGTH_LARGE, null, $this->get_text_field_policy()),
00047                         ),
00048                         $this->get_teaser_field(),
00049                         $this->get_meta_tag_fields(),
00050                         $this->get_global_field_definitions(),
00051                         $this->get_timestamp_field_declarations(),
00052                         $this->get_additional_field_definitions()
00053                 );
00054         }
DataObjectPostBase::collect_relations (  )  [protected]

Should be overloaded only by classes which single purpose is to be overloaded itself.

The rest should overload get_additional_relations()

Returns:
array Array of DBRelation

Definition at line 62 of file dataobject.post.base.cls.php.

00062                                                {
00063                 return $this->get_additional_relations();
00064         }
DataObjectPostBase::create_table_object (  )  [protected]

Create Table features.

Returns:
DBTable

Reimplemented from DataObjectBase.

Definition at line 24 of file dataobject.post.base.cls.php.

00024                                                  {
00025                 return new DBTable(
00026                         $this->get_model_name(),
00027                         $this->collect_field_definitions(),
00028                         'id',
00029                         $this->collect_relations()
00030                 );
00031         }
static DataObjectPostBase::extend_table ( arr_fields  )  [static]

Extend every instance that extends PostBase by arbitrary many fields.

Parameters:
array  $arr_fields Array of DBField instances

Definition at line 71 of file dataobject.post.base.cls.php.

00071                                                          {
00072                 self::$global_extensions = $arr_fields;
00073         }
DataObjectPostBase::get_actions_for_context ( context,
user,
params  
) [protected]

To be overloaded.

Returns array of actions with action title as key and action description as value

Subclasses can return array of actions, this class will detect if they are commands or actions.

Optionally, params can be added in brackets like 'status[DISABLED]' => 'Disable this item'.

Parameters:
string  $context
mixed  $user
mixed  $params
Returns:
array

Reimplemented from DataObjectBase.

Definition at line 219 of file dataobject.post.base.cls.php.

00219                                                                              {
00220                 $ret = array();         
00221                 $ret['edit'] = tr('Edit');              
00222                 return $ret;
00223         }       
DataObjectPostBase::get_additional_field_definitions (  )  [protected]

Too be overloaded.

Return addition table fields

Returns:
array Array of IDBField

Definition at line 87 of file dataobject.post.base.cls.php.

00087                                                               {
00088                 return array();
00089         }
DataObjectPostBase::get_additional_relations (  )  [protected]

Too be overloaded.

Return addition relations

Returns:
array Array of DBRelation

Definition at line 96 of file dataobject.post.base.cls.php.

00096                                                       {
00097                 return array();
00098         }
DataObjectPostBase::get_description (  ) 

Get description for this instance.

Returns:
string

Implements ISelfDescribing.

Definition at line 243 of file dataobject.post.base.cls.php.

00243                                           {
00244                 return $this->teaser;
00245         }
DataObjectPostBase::get_global_field_definitions (  )  [protected]

Return global extension.

Returns:
array Array of IDBField

Definition at line 123 of file dataobject.post.base.cls.php.

00123                                                           {
00124                 return self::$global_extensions;
00125         }
DataObjectPostBase::get_meta_description (  ) 

Returns meta description.

Definition at line 182 of file dataobject.post.base.cls.php.

00182                                                {
00183                 return $this->meta_description ? $this->meta_description : String::unescape($this->get_teaser());
00184         }
DataObjectPostBase::get_meta_tag_fields (  )  [protected]

Returns fields for meta tag information.

Returns:
array

Definition at line 132 of file dataobject.post.base.cls.php.

00132                                                  {
00133                 return array(
00134                         new DBFieldText('meta_title', 200, null, DBField::NONE),
00135                         new DBFieldText('meta_keywords', 255, null, DBField::NONE),
00136                         new DBFieldText('meta_description', DBFieldText::BLOB_LENGTH_SMALL, null, DBField::NONE),
00137                 );
00138         }
DataObjectPostBase::get_meta_title (  ) 

Returns meta title.

Definition at line 175 of file dataobject.post.base.cls.php.

00175                                          {
00176                 return $this->meta_title ? $this->meta_title : $this->get_title();
00177         }
DataObjectPostBase::get_model_name (  )  [abstract, protected]

Too be overloaded.

Return addition table name

Returns:
string
DataObjectPostBase::get_sort_default_column (  ) 

Get the column to sort by default.

Reimplemented from DataObjectBase.

Definition at line 203 of file dataobject.post.base.cls.php.

00203                                                   {
00204                 return 'title'; 
00205         }
DataObjectPostBase::get_sortable_columns (  ) 

Return array of sortable columns.

Array has column name as key and a sort type (enum) as value

Reimplemented from DataObjectBase.

Definition at line 193 of file dataobject.post.base.cls.php.

00193                                                {
00194                 return array(
00195                         'title' => new DBSortColumn('title', tr('Title', 'postbase'), DBSortColumn::TYPE_TEXT),
00196                         'creationdate' => new DBSortColumn('creationdate', tr('Creation Date'), DBSortColumn::TYPE_DATE, DBSortColumn::ORDER_BACKWARD),         
00197                 );      
00198         }
DataObjectPostBase::get_teaser (  ) 

Get text for this instance.

Text is converted using HtmlText::OUTPUT chains

Returns:
string

Definition at line 168 of file dataobject.post.base.cls.php.

00168                                      {
00169                 return ($this->teaser) ? $this->teaser : String::substr_word(strip_tags($this->text), 0, 300);
00170         }
DataObjectPostBase::get_teaser_field (  )  [protected]

Returns teaser field.

Returns:
array

Definition at line 145 of file dataobject.post.base.cls.php.

00145                                               {
00146                 return array(
00147                         new DBFieldText('teaser', DBFieldText::BLOB_LENGTH_SMALL, null, $this->get_teaser_field_policy()),
00148                 );
00149         }
DataObjectPostBase::get_teaser_field_policy (  )  [protected]

Return policy for teaser.

Returns:
Int DBField::NONE or DBField::NOT_NULL

Definition at line 105 of file dataobject.post.base.cls.php.

00105                                                      {
00106                 return DBField::NOT_NULL;
00107         }
DataObjectPostBase::get_text (  ) 

Get text for this instance.

Text is converted using HtmlText::OUTPUT chains

Returns:
string

Definition at line 159 of file dataobject.post.base.cls.php.

00159                                    {
00160                 return HtmlText::apply_conversion(HtmlText::OUTPUT, $this->text, $this->get_table_name());
00161         }
DataObjectPostBase::get_text_field_policy (  )  [protected]

Return policy for text.

Returns:
Int DBField::NONE or DBField::NOT_NULL

Definition at line 114 of file dataobject.post.base.cls.php.

00114                                                    {
00115                 return DBField::NOT_NULL;
00116         }
DataObjectPostBase::get_title (  ) 

Get title for this class.

Returns:
string

Implements ISelfDescribing.

Definition at line 234 of file dataobject.post.base.cls.php.

00234                                     {
00235                 return $this->title;
00236         }

Member Data Documentation

DataObjectPostBase::$id

Definition at line 11 of file dataobject.post.base.cls.php.

DataObjectPostBase::$meta_description

Definition at line 17 of file dataobject.post.base.cls.php.

DataObjectPostBase::$meta_keywords

Definition at line 16 of file dataobject.post.base.cls.php.

DataObjectPostBase::$meta_title

Definition at line 15 of file dataobject.post.base.cls.php.

DataObjectPostBase::$teaser

Definition at line 13 of file dataobject.post.base.cls.php.

DataObjectPostBase::$text

Definition at line 14 of file dataobject.post.base.cls.php.

DataObjectPostBase::$title

Definition at line 12 of file dataobject.post.base.cls.php.


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