示例#1
0
 public function exportAction()
 {
     // construct JqGrid and let it configure
     $grid1 = Bvb_Grid::factory('Bvb_Grid_Deploy_JqGrid', $this->_config, '', array('csv' => array($this, 'configG1PostCsv')));
     $this->configG1($grid1, $this->_getParam('onlyFromPolynesia', 'false') === 'true');
     // pass grids to view and deploy() them there
     $this->view->g1 = $grid1->deploy();
     $this->render('index');
 }
示例#2
0
 public function setUp()
 {
     parent::setUp();
     $this->grid = Bvb_Grid::factory('csv');
     $this->grid->setParam('module', 'default');
     $this->grid->setParam('controller', 'site');
     $this->grid->setView(new Zend_View(array()));
     $this->grid->setExport(array('csv'));
 }
示例#3
0
 public function setUp()
 {
     date_default_timezone_set('Europe/Lisbon');
     $this->_temp = realpath(APPLICATION_PATH . '/../tests/_temp/') . '/';
     include_once APPLICATION_PATH . '/models/Model.php';
     // Assign and instantiate in one step:
     $this->bootstrap = new Zend_Application('general', APPLICATION_PATH . '/config.ini');
     $this->controller = Zend_Controller_Front::getInstance();
     $this->db = $this->bootstrap->getBootstrap()->getPluginResource('db')->getDbAdapter();
     $this->controller->setControllerDirectory(APPLICATION_PATH . '/application/controllers');
     $this->controller->setDefaultModule('defualt');
     $this->controller->setDefaultControllerName('site');
     $this->grid = Bvb_Grid::factory('Table');
     $this->grid->setParam('module', 'default');
     $this->grid->setParam('controller', 'site');
     $this->grid->setView(new Zend_View(array()));
     parent::setUp();
 }
示例#4
0
 public function listAction()
 {
     $config = new Zend_Config_Ini(BASE_PATH . DIRECTORY_SEPARATOR . "configs" . DIRECTORY_SEPARATOR . "grid.ini", 'production');
     $grid = Bvb_Grid::factory('Table', $config);
     $data = $this->_listdata();
     $source = new Bvb_Grid_Source_Array($data);
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $grid->setSource($source);
     $grid->setImagesUrl("{$baseUrl}/grid/");
     $editColumn = new Bvb_Grid_Extra_Column();
     $editColumn->setPosition('right')->setName('Edit')->setDecorator("<a href=\"{$baseUrl}/admin/subject/edit/id/{{subject_id}}\">Edit</a><input class=\"address-id\" name=\"address_id[]\" type=\"hidden\" value=\"{{subject_id}}\"/>");
     $deleteColumn = new Bvb_Grid_Extra_Column();
     $deleteColumn->setPosition('right')->setName('Delete')->setDecorator("<a class=\"delete-data\" href=\"{$baseUrl}/admin/subject/delete/id/{{subject_id}}\">Delete</a>");
     $grid->addExtraColumns($editColumn, $deleteColumn);
     $grid->updateColumn('subject_id', array('hidden' => true));
     $grid->updateColumn('del', array('hidden' => true));
     $grid->setRecordsPerPage(20);
     $grid->setPaginationInterval(array(5 => 5, 10 => 10, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100));
     $grid->setExport(array('print', 'word', 'csv', 'excel', 'pdf'));
     $this->view->grid = $grid->deploy();
 }
示例#5
0
 /**
  * Simplify the datagrid creation process
  * @return Bvb_Grid_Deploy_Table
  */
 public function grid($id = '')
 {
     $view = new Zend_View();
     $view->setEncoding('ISO-8859-1');
     $config = new Zend_Config_Ini('./application/grids/grid.ini', 'production');
     $grid = Bvb_Grid::factory('Table', $config, $id);
     $grid->setEscapeOutput(false);
     $grid->setExport(array('xml', 'csv', 'excel', 'pdf'));
     $grid->setView($view);
     #$grid->saveParamsInSession(true);
     #$grid->setCache(array('enable' => array('form'=>false,'db'=>false), 'instance' => Zend_Registry::get('cache'), 'tag' => 'grid'));
     return $grid;
 }
示例#6
0
文件: model.php 项目: tapiau/muyo
 /**
  * TODO: move to external class / trait
  * @param string $export Name of deploy
  * @param null|mixed $source
  * @return Bvb_Grid
  */
 public function getDataTable($export = 'JqGrid', $source = null)
 {
     if (is_null($source)) {
         $source = new Lib_Grid_Source_Model($this);
     }
     $config = $this->getGridConfig();
     $id = Lib_Grid::buildId($export, $source, isset($config->bvbParams->id_prefix) ? $config->bvbParams->id_prefix : null);
     $requestParams = Zend_Controller_Front::getInstance()->getRequest()->getParams();
     if (isset($requestParams['q']) && $requestParams['q'] == $id && isset($requestParams['_exportTo'])) {
         $requestParams['_exportTo' . $id] = $requestParams['_exportTo'];
     }
     /**
      * @var Bvb_Grid $grid
      */
     $grid = Bvb_Grid::factory($export, $config, $id, array(), $requestParams);
     if ($export == 'JqGrid') {
         Lib_Grid::prepareDeploy($grid, $config, $source);
     } elseif ($export == 'Pdf') {
         $config->export->pdf = 'Pdf';
         $config->disableExport = false;
         Lib_Grid::prepareDeploy($grid, $config, $source);
     }
     return $grid;
 }