Yii Access Control Lists
0.8
Advanced and convenient Access Control
|
Public Member Functions | |
__construct ($table, $type, $relatedTable= '{{aco_aro}}') | |
synchronizeDenormalization () | |
moveItem ($item, $parent) | |
deleteItem ($item) | |
addItem ($item) | |
Protected Member Functions | |
updatePosition ($type, $direction, $scalar, $startRgt) | |
getParentRight ($parent=NULL) | |
getParentLeft ($parent=NULL) | |
getParentValue ($value, $parent=NULL) | |
Protected Attributes | |
$table = NULL | |
$relatedTable = NULL | |
$type = NULL |
Tree::addItem | ( | $ | item | ) |
Increase all lft and rgt which are greater than the old parent rgt by 2*childrenCount + 2
Tree::getParentLeft | ( | $ | parent = NULL | ) | [protected] |
Just a Wrapper for getParentValue getParentValue
int | $parent | the ID of the parent to use |
Tree::getParentRight | ( | $ | parent = NULL | ) | [protected] |
Just a Wrapper for getParentValue getParentValue
int | $parent | the ID of the parent to use |
Tree::getParentValue | ( | $ | value, |
$ | parent = NULL |
||
) | [protected] |
This position gathers the given value of the given parent
string | $value | the value to look up |
int | $parent | the ID of the parent. If no parent is existent, usees 0 as default value |
Tree::moveItem | ( | $ | item, |
$ | parent | ||
) |
If we don't have a parent, we have to incrase the parentRgt manually, because we don't want this parent The method getParentRight can't do this as it always returns a valid ID - we need a new one!
The new lft is the rgt of the left neighbor + 1 The rgt of the new parent - 2 * childrenCount - 2 equals this
Update the nodes right from the newly inserted node As we take newLft from the rgt-value of the parent, we can use it now
Now move the positions of all child-nodes They need to be moved by the size of the occupied area
As the last step, we move everything to the opposite direction, as there's space left ^^ As usual, do this independently
Tree::synchronizeDenormalization | ( | ) |
For the sake of performance the normal tenets have been broken. Thereupon lft and rgt-values are available in both {{aco/aro}} and {{aco_aro}} Whenever we do something complex and we don't bother to update the values on-the-fly (the tree only operates on the single table and not on the MANY-TO-MANY-relations) we just updated the hole thing
: Keep the eyes peeled for a better solution. Though I doubt there is any.
: remove keys, process update and restore them later
Tree::updatePosition | ( | $ | type, |
$ | direction, | ||
$ | scalar, | ||
$ | startRgt | ||
) | [protected] |
Updates the position of the nodes having a $type greater or equal than $startRgt in direction $direction by $scalar
string | $type | The type (lft or rgt or both) |
int | $direction | the direciton (+ or -) |
int | $scalar | the amount to move by |
type | $startRgt | the starting rgt value (note: the value is also moved) |