Source API for the «PortePlugins_Position» class

PortePlugins_Position

Plugin to add position functionnalities between records.

A record is marked as being positionable if its model define a property "position" in its table definition. A new property "position" is made available to the record with a couple of usefull methods.

PHP magic methods

__construct

This method is not yet documented.

Public methods

after

Place the current record after the provided record. Changes will take effect after calling the "save" method.

return
PorteRecord
The current record
PorteRecord
$record
after_BeforeOnSave

This method is not yet documented.

before

Place the current record before the provided record. Changes will take effect after calling the "save" method.

return
PorteRecord
The current record
PorteRecord
$record
before_BeforeOnSave

This method is not yet documented.

first

Place the current record af the first record. Its position value will be set to 1.
Changes will take effect after calling the "save" method.

return
PorteRecord
The current record
PorteRecord
$record
first_BeforeOnSave

This method is not yet documented.

last

Place the current record af the last record. Its position value should be equal to the value returned by the "count" method. Changes will take effect after calling the "save" method.

return
PorteRecord
The current record
PorteRecord
$record
last_BeforeOnSave

This method is not yet documented.

previous

Place the current record one or more step before. Changes will take effect after calling the "save" method.

return
PorteRecord
The current record
PorteRecord
$record
previous_BeforeOnSave

This event listener is on only called if record is not new.

return
next

Place the current record one or more step forward. Changes will take effect after calling the "save" method.

return
PorteRecord
The current record
PorteRecord
$record
next_BeforeOnSave

This event listener is on only called if record is not new.

return
position_BeforeOnDelete

This method is not yet documented.

max

Return the greatest position value. It is equals to the value returned by the "count" method of the record.

return
int
Greatest value
current

Return the current position value.

return
int
Position value
clean

Remove all the positioned related events registered in "$record->meta_table['position']"

return
boolean
True on success
position_BeforeOnCreate

Listener called before a new record is created. It is registered by "_recordModelBefore" which itsef is a listener of "record_model_after".

return
PorteRecord
Object
$record
_destroy

This method is not yet documented.

_setPosition_beforeOnSave

This method is not yet documented.

lst_record_load_after

This method is not yet documented.

lst_record_create_after

This method is not yet documented.

lstn_other_positionbeforeOnSave

This method is not yet documented.

Public static methods

register

Register the plugin with a Porte instance.

position_BeforeOnFind

This method is not yet documented.

_recordModelBefore

Listener called before a record is enriched. It is registered at a static level for all records.

return
Null
PorteRecord
$record
_modelTableAfter

Listener statically plugged to the "model_fields_before" event.

If model->tableposition] is set, enrich its value as follow model->table[position][field] database field name model->table[position stored value used by registered events