public function testExtraRows()
 {
     $select = $this->db->select()->from('unit');
     $this->grid->setSource(new Bvb_Grid_Source_Zend_Select($select));
     $rows = new Bvb_Grid_Extra_Rows();
     $rows->addRow('beforeHeader', array(array('colspan' => 15, 'class' => 'myclass', 'content' => 'my content')));
     $rows->addRow('beforePagination', array(array('colspan' => 9, 'content' => "This is an extra row added before pagination")));
     $this->grid->addExtraRows($rows);
     $grid = $this->grid->deploy();
     $this->controller->getResponse()->setBody($grid);
     $this->assertQueryContentContains("td", 'my content');
     $this->assertQueryContentContains("td", 'This is an extra row added before pagination');
 }
示例#2
0
 public function columnsAction()
 {
     $grid = $this->grid();
     $select = $this->_db->select()->from('Country', array('Name', 'Continent', 'Population', 'LocalName', 'GovernmentForm'));
     #$grid->setSource(new Bvb_Grid_Source_Zend_Select($select));
     $grid->query($select);
     $rows = new Bvb_Grid_Extra_Rows();
     $rows->addRow('beforeHeader', array('', array('colspan' => 1, 'class' => 'myclass', 'content' => 'my content'), array('colspan' => 2, 'class' => 'myotherclass', 'content' => 'some '), array('colspan' => 1, 'class' => 'myclass', 'content' => 'flowers:) ')));
     $rows->addRow('beforePagination', array(array('colspan' => 5, 'content' => "This is an extra row added before pagination")));
     $grid->addExtraRows($rows);
     $this->view->pages = $grid->deploy();
     $this->render('index');
 }
示例#3
0
 /**
  * Apply config options
  *
  * @param array $options   Array of options to apply
  * @param bool  $firstCall If this is the first time this metod is being called
  *
  * @return void
  */
 protected function _applyConfigOptions($options, $firstCall = false)
 {
     $this->_deployOptions = $options;
     if (isset($this->_deployOptions['templateDir'])) {
         $this->_deployOptions['templateDir'] = (array) $this->_deployOptions['templateDir'];
         foreach ($this->_deployOptions['templateDir'] as $templates) {
             $temp = $templates;
             $temp = str_replace('_', '/', $temp);
             $this->addTemplateDir($temp, $templates, 'table');
         }
     }
     if ($firstCall === true && isset($this->_options['extra'])) {
         if (isset($this->_options['extra']['row']) && is_array($this->_options['extra']['row'])) {
             $rows = new Bvb_Grid_Extra_Rows();
             foreach ($this->_options['extra']['row'] as $key => $value) {
                 $value['name'] = $key;
                 $rows->addRow($value['position'], array($value));
             }
             $this->addExtraRows($rows);
         }
         if (isset($this->_options['extra']['column']) && is_array($this->_options['extra']['column'])) {
             $columns = array();
             foreach ($this->_options['extra']['column'] as $key => $value) {
                 $columns[] = new Bvb_Grid_Extra_Column($key, $value);
             }
             $this->addExtraColumns($columns);
         }
     }
     if (isset($this->_deployOptions['imagesUrl'])) {
         $this->setImagesUrl($this->_deployOptions['imagesUrl']);
     }
     if (isset($this->_deployOptions['template'])) {
         $this->setTemplate($this->_deployOptions['template'], 'table');
     }
 }