[ Index ]

PHP Cross Reference of Akelos Framework

title

Body

[close]

/AkActiveRecord/AkActsAsBehaviours/ -> AkActsAsList.php (summary)

(no description)

Author: Bermi Ferrer
Copyright: Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
License: GNU Lesser General Public License
File Size: 404 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 AkActiveRecord/AkObserver.php

Defines 1 class

AkActsAsList:: (37 methods):
  AkActsAsList()
  init()
  _ensureIsActiveRecordInstance()
  reloadActiveRecordInstance()
  getType()
  beforeDestroy()
  afterSave()
  afterDestroy()
  beforeCreate()
  insertAt()
  insertAtPosition()
  moveLower()
  moveHigher()
  moveToBottom()
  moveToTop()
  assumeBottomPosition()
  assumeTopPosition()
  getBottomPosition()
  getBottomItem()
  isInList()
  decrementPositionsOnHigherItems()
  decrementPositionsOnLowerItems()
  incrementPositionsOnHigherItems()
  incrementPositionsOnLowerItems()
  incrementPositionsOnAllItems()
  removeFromList()
  incrementPosition()
  decrementPosition()
  isFirst()
  isLast()
  getHigherItem()
  getLowerItem()
  addToListTop()
  _addToBottom()
  getScopeCondition()
  setScopeCondition()
  getScopedColumn()


Class: AkActsAsList  - X-Ref

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:
<code>
class TodoList extends ActiveRecord
{
var $has_many = array('todo_items', array('order' => "position"));
}

class TodoItem extends ActiveRecord
{
var $belongs_to = 'todo_list';
var $acts_as = array('list' => array('scope' => 'todo_list'));
}

$TodoList =& new TodoList();

$TodoList->list->moveToBottom();
</code>
AkActsAsList(&$ActiveRecordInstance)   X-Ref
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';
}

init($options = array()   X-Ref
No description

_ensureIsActiveRecordInstance(&$ActiveRecordInstance)   X-Ref
No description

reloadActiveRecordInstance(&$listObject)   X-Ref
No description

getType()   X-Ref
No description

beforeDestroy(&$object)   X-Ref
No description

afterSave(&$object)   X-Ref
No description

afterDestroy(&$object)   X-Ref
No description

beforeCreate(&$object)   X-Ref
No description

insertAt($position = 1)   X-Ref
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.


insertAtPosition($position)   X-Ref
This function saves the object using save() before inserting it into the list


moveLower()   X-Ref
No description

moveHigher()   X-Ref
No description

moveToBottom()   X-Ref
No description

moveToTop()   X-Ref
No description

assumeBottomPosition()   X-Ref
No description

assumeTopPosition()   X-Ref
No description

getBottomPosition($except = null)   X-Ref
No description

getBottomItem($except = null)   X-Ref
Returns an instance of the item that's on the very bottom of the list. Returns false if there's none


isInList()   X-Ref
No description

decrementPositionsOnHigherItems($position)   X-Ref
This has the effect of moving all the higher items up one.


decrementPositionsOnLowerItems()   X-Ref
This has the effect of moving all the lower items up one.


incrementPositionsOnHigherItems()   X-Ref
This has the effect of moving all the higher items down one.


incrementPositionsOnLowerItems($position)   X-Ref
This has the effect of moving all the lower items down one.


incrementPositionsOnAllItems()   X-Ref
No description

removeFromList()   X-Ref
No description

incrementPosition()   X-Ref
No description

decrementPosition()   X-Ref
No description

isFirst()   X-Ref
No description

isLast()   X-Ref
No description

getHigherItem()   X-Ref
No description

getLowerItem()   X-Ref
No description

addToListTop()   X-Ref
No description

_addToBottom()   X-Ref
No description

getScopeCondition()   X-Ref
No description

setScopeCondition($scope_condition)   X-Ref
No description

getScopedColumn($column)   X-Ref
No description



Generated: Mon Oct 27 12:43:49 2008 Cross-referenced by PHPXref 0.6