/** * Format the "checked" column for the store response. * Use this in the model controller of the selected items. eg. Use in AddressbookController and not in ContactController. */ public function formatCheckedColumn() { //validate selection only when we display the grid $this->_validateSelection(); $this->_store->getColumnModel()->formatColumn('checked', 'in_array($model->id, $multiSelectGrid->selectedIds)', array('multiSelectGrid' => $this)); // $this->_save(); }
/** * Get the record of the totalized values * * @return array */ public function getTotals() { if (empty($this->totalizeColumns)) { return false; } $record = array(); $columns = $this->store->getColumnModel()->getColumns(); foreach ($columns as $column) { $record[$column->getDataIndex()] = isset($this->totals[$column->getDataIndex()]) ? \GO\Base\Util\Number::localize($this->totals[$column->getDataIndex()]) : ''; } return $record; }
/** * * @param \GO\Base\Data\AbstractStore $store * @param type $params */ protected function renderExport(\GO\Base\Data\AbstractStore $store, $params) { //define('EXPORTING', true); //used by custom fields to format diffently if (\GO::modules()->customfields) { \GO\Customfields\Model\AbstractCustomFieldsRecord::$formatForExport = true; } $checkboxSettings = array('export_include_headers' => !empty($params['includeHeaders']), 'export_human_headers' => empty($params['humanHeaders']), 'export_include_hidden' => !empty($params['includeHidden'])); $settings = \GO\Base\Export\Settings::load(); $settings->saveFromArray($checkboxSettings); if (!empty($params['exportOrientation']) && $params['exportOrientation'] == "H") { $orientation = 'L'; } else { $orientation = 'P'; } // Set the orientation to Portrait if (!empty($params['columns'])) { $columnModel = $store->getColumnModel(); $includeColumns = explode(',', $params['columns']); foreach ($includeColumns as $incColumn) { if (!$columnModel->getColumn($incColumn)) { $columnModel->addColumn(new \GO\Base\Data\Column($incColumn, $incColumn)); } } $columnModel->sort($includeColumns); foreach ($columnModel->getColumns() as $c) { if (!in_array($c->getDataIndex(), $includeColumns)) { $columnModel->removeColumn($c->getDataIndex()); } } } if (!empty($params['type'])) { //temporary fix for compatibility with AbsractModelController $params['type'] = str_replace('GO\\Base\\Export', 'GO\\Base\\Storeexport', $params['type']); $export = new $params['type']($store, $settings->export_include_headers, $settings->export_human_headers, $params['documentTitle'], $orientation); } else { $export = new \GO\Base\Storeexport\ExportCSV($store, $settings->export_include_headers, $settings->export_human_headers, $params['documentTitle'], $orientation); } // The default Export is the CSV outputter. if (isset($params['extraLines'])) { $export->addLines($params['extraLines']); } $export->output(); }