本文整理匯總了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'];
}