Ejemplo n.º 1
0
 /**
  * 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'];
 }
Ejemplo n.º 2
0
 /**
  * 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);
         }
     }
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 /**
  * Get object by name
  * @param string $name
  * @return Ext_Object
  */
 public function getObject($name)
 {
     $objData = $this->_tree->getItem($name);
     return $objData['data'];
 }