Class AkActsAsList

(line 44)

Description

AkObject
   |
   --AkObserver
      |
      --AkActsAsList

Located in File: /AkActiveRecord/AkActsAsBehaviours/AkActsAsList.php

This act provides the capabilities for sorting and reordering a number of objects in list.

The class that has this specified needs to have a "position" column defined as an integer on the mapped database table.

Todo list example:

  1.    class TodoList extends ActiveRecord
  2.    {
  3.        var $has_many = array('todo_items'array('order' => "position"));
  4.    }
  5.  
  6.    class TodoItem extends ActiveRecord
  7.    {
  8.        var $belongs_to 'todo_list';
  9.        var $acts_as = array('list' => array('scope' => 'todo_list'));
  10.    }
  11.  
  12.    $TodoList =new TodoList();
  13.  
  14.    $TodoList->list->moveToBottom();



Class Variables

Summary:
mixed $column
mixed $scope

$column = 'position' (line 46)

Data type : mixed

$scope = '' (line 47)

Data type : mixed

$scope_condition (line 48)

Data type : mixed

$_ActiveRecordInstance (line 62)

Data type : mixed

Configuration options are:

* +column+ - specifies the column name to use for keeping the position integer (default: position) * +scope+ - restricts what is to be considered a list. Example:

class TodoTask extends ActiveRecord { var $acts_as = array('list'=> array('scope'=> array('todo_list_id','completed = 0'))); var $belongs_to = 'todo_list'; }

Class Constants

Summary:

Method Detail

Summary:
AkActsAsList AkActsAsList ( &$ActiveRecordInstance)
void addToListTop ()
void afterDestroy ( &$object)
void afterSave ( &$object)
void beforeCreate ( &$object)
void beforeDestroy ( &$object)
void decrementPositionsOnHigherItems ( $position)
void getBottomItem ([ $except = null])
void getBottomPosition ([ $except = null])
void getHigherItem ()
void getLowerItem ()
void getScopedColumn ( $column)
void getType ()
void incrementPositionsOnLowerItems ( $position)
void init ([ $options = array()])
void insertAt ([ $position = 1])
void insertAtPosition ( $position)
void isFirst ()
void isInList ()
void isLast ()
void moveHigher ()
void moveLower ()
void moveToBottom ()
void moveToTop ()
void reloadActiveRecordInstance ( &$listObject)
void removeFromList ()
void setScopeCondition ( $scope_condition)
void _addToBottom ()
void _ensureIsActiveRecordInstance ( &$ActiveRecordInstance)

Constructor AkActsAsList (line 63)

AkActsAsList AkActsAsList( &$ActiveRecordInstance)

Parameters

  • &$ActiveRecordInstance:

Info

Method addToListTop (line 358)

void addToListTop( )

Info

Method afterDestroy (line 115)

void afterDestroy( &$object)

Parameters

  • &$object:

Info

Method afterSave (line 109)

void afterSave( &$object)

Parameters

  • &$object:

Info

Method assumeBottomPosition (line 221)

void assumeBottomPosition( )

Info

Method assumeTopPosition (line 226)

void assumeTopPosition( )

Info

Method beforeCreate (line 120)

void beforeCreate( &$object)

Parameters

  • &$object:

Info

Method beforeDestroy (line 103)

void beforeDestroy( &$object)

Parameters

  • &$object:

Info

Method decrementPosition (line 318)

void decrementPosition( )

Info

Method decrementPositionsOnHigherItems (line 257)

void decrementPositionsOnHigherItems( $position)

This has the effect of moving all the higher items up one.

Parameters

  • $position:

Info

Method decrementPositionsOnLowerItems (line 265)

void decrementPositionsOnLowerItems( )

This has the effect of moving all the lower items up one.

Info

Method getBottomItem (line 239)

void getBottomItem( [ $except = null])

Returns an instance of the item that's on the very bottom of the list. Returns false if there's none

Parameters

  • $except:

Info

Method getBottomPosition (line 231)

void getBottomPosition( [ $except = null])

Parameters

  • $except:

Info

Method getHigherItem (line 342)

void getHigherItem( )

Info

Method getLowerItem (line 350)

void getLowerItem( )

Info

Method getScopeCondition (line 368)

void getScopeCondition( )

Info

Method getScopedColumn (line 391)

void getScopedColumn( $column)

Parameters

  • $column:

Info

Method getType (line 98)

void getType( )

Info

Method incrementPosition (line 310)

void incrementPosition( )

Info

Method incrementPositionsOnAllItems (line 294)

void incrementPositionsOnAllItems( )

Info

Method incrementPositionsOnHigherItems (line 277)

void incrementPositionsOnHigherItems( )

This has the effect of moving all the higher items down one.

Info

Method incrementPositionsOnLowerItems (line 289)

void incrementPositionsOnLowerItems( $position)

This has the effect of moving all the lower items down one.

Parameters

  • $position:

Info

Method init (line 68)

void init( [ $options = array()])

Parameters

  • $options:

Info

Method insertAt (line 134)

void insertAt( [ $position = 1])

All the methods available to a record that has had <tt>acts_as list</tt> specified. Each method works by assuming the object to be the item in the list, so <tt>$Chapter->list->moveLower()</tt> would move that chapter lower in the list of all chapters. Likewise, <tt>$Chapter->list->isFirst()</tt> would return true if that chapter is the first in the list of all chapters.

Parameters

  • $position:

Info

Method insertAtPosition (line 142)

void insertAtPosition( $position)

This function saves the object using save() before inserting it into the list

Parameters

  • $position:

Info

Method isFirst (line 326)

void isFirst( )

Info

Method isInList (line 249)

void isInList( )

Info

Method isLast (line 334)

void isLast( )

Info

Method moveHigher (line 176)

void moveHigher( )

Info

Method moveLower (line 161)

void moveLower( )

Info

Method moveToBottom (line 191)

void moveToBottom( )

Info

Method moveToTop (line 206)

void moveToTop( )

Info

Method reloadActiveRecordInstance (line 93)

void reloadActiveRecordInstance( &$listObject)

Parameters

  • &$listObject:

Info

Method removeFromList (line 299)

void removeFromList( )

Info

Method setScopeCondition (line 382)

void setScopeCondition( $scope_condition)

Parameters

  • $scope_condition:

Info

Method _addToBottom (line 363)

void _addToBottom( )

Info

Method _ensureIsActiveRecordInstance (line 75)

void _ensureIsActiveRecordInstance( &$ActiveRecordInstance)

Parameters

  • &$ActiveRecordInstance:

Info

Inherited Variables

Inherited Class Variable Summary

Inherited From Class AkObserver

AkObserver::$_observing - $_observing array of models that we're observing

Inherited Methods

Inherited Method Summary

Inherited From Class AkObserver

AkObserver::__construct() -

AkObserver::observe() - Constructs the Observer

AkObserver::setObservedModels() - Constructs the Observer

AkObserver::update() -


Inherited From Class AkObject

AkObject::AkObject() - A hack to support __construct() on PHP 4

AkObject::__construct() - Class constructor, overriden in descendant classes

AkObject::freeMemory() - Unsets circular reference children that are not freed from memory when calling unset() or when the parent object is garbage collected.

AkObject::log() -

AkObject::toString() - Object-to-string conversion

AkObject::__clone() - Clone class (Zend Engine 2 compatibility trick)

AkObject::__destruct() - Class destructor, overriden in descendant classes

AkObject::__toString() -



Documentation generated on Tue, 17 Jun 2008 14:24:14 +0200 by phpDocumentor 1.3.2