本文整理汇总了PHP中Tree::sortItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::sortItems方法的具体用法?PHP Tree::sortItems怎么用?PHP Tree::sortItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::sortItems方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sortActions
/**
* Apply sorting orders for actions (sort actions)
*/
public function sortActions()
{
$this->_actions->sortItems();
}
示例2: resortItems
/**
* Resort tree Items
* @param mixed $parentId - optional, resort only item childs
* default - false (resort all items)
*/
public function resortItems($parentId = false)
{
$this->_tree->sortItems($parentId);
}
示例3: reindexColumns
/**
* Reindex columns (apply sort order)
*/
public function reindexColumns()
{
$this->_columns->sortItems();
}
示例4: test_sortChilds
public function test_sortChilds()
{
$tree = new Tree();
$tree->addItem('a', 0, 50, 1);
$tree->addItem(1, 'a', 100, 1);
$tree->addItem(2, 'a', 200, 2);
$tree->addItem(3, 'a', 300, 3);
$tree->setItemOrder(2, 4);
$tree->sortItems('a');
$items = $tree->getChilds('a');
$newOrder = array();
foreach ($items as $v) {
$newOrder[] = $v['data'];
}
$this->assertEquals($newOrder, array(100, 300, 200));
$tree = new Tree();
$tree->addItem(1, 0, 100, 1);
$tree->addItem(2, 0, 200, 2);
$tree->addItem(3, 0, 300, 3);
$tree->setItemOrder(2, 4);
$tree->sortItems();
$items = $tree->getChilds(0);
$newOrder = array();
foreach ($items as $v) {
$newOrder[] = $v['data'];
}
$this->assertEquals($newOrder, array(100, 300, 200));
}