本文整理汇总了PHP中Tree::getItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::getItem方法的具体用法?PHP Tree::getItem怎么用?PHP Tree::getItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::getItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getColumn
/**
* Get column object by its ID
* @param mixed $id
* @throws Exception
* @return Ext_Grid_Column
*/
public function getColumn($id)
{
if (!$this->_columns->itemExists($id)) {
throw new Exception('Invalid column ID');
}
$item = $this->_columns->getItem($id);
return $item['data'];
}
示例2: _fillQuery
/**
* Recursive method
* @param string $parent - parent part id
* @param Db_Select $sql
*/
protected function _fillQuery($partId, $sql, $countOnly = false)
{
$parentItem = $this->_tree->getItem($partId);
$childs = $this->_tree->getChilds($partId);
foreach ($childs as $child) {
$this->_addSqlPart($child['data'], $sql, $parentItem['data'], $countOnly);
$part = $child['data'];
if ($this->_tree->hasChilds($part->getId())) {
$this->_fillQuery($part->getId(), $sql, $countOnly);
}
}
}
示例3: testGetItem
public function testGetItem()
{
$tree = new Tree();
$item = new stdClass();
$item->id = 1;
$tree->addItem($item->id, 0, $item);
$itemResult = $tree->getItem($item->id);
$this->assertTrue(!empty($itemResult));
$this->assertTrue(is_array($itemResult));
$this->assertEquals($itemResult['id'], $item->id);
$this->assertEquals($itemResult['parent'], 0);
$this->assertEquals($itemResult['data'], $item);
$this->assertEquals($itemResult['order'], 0);
$exception = false;
try {
$tree->getItem(8);
} catch (Exception $e) {
$exception = true;
}
$this->assertTrue($exception);
}
示例4: getObject
/**
* Get object by name
* @param string $name
* @return Ext_Object
*/
public function getObject($name)
{
$objData = $this->_tree->getItem($name);
return $objData['data'];
}