protected function actionStore($params) { $columnModel = new ColumnModel(Category::model()); $columnModel->formatColumn('user_name', '$model->user ? $model->user->name : 0'); $store = new DbStore('GO\\Notes\\Model\\Category', $columnModel, $params); $store->defaultSort = 'name'; $store->multiSelectable('no-multiselect'); echo $this->render('store', array('store' => $store)); }
private function _listShares($params) { //$store = \GO\Base\Data\Store::newInstance(\GO\Files\Model\Folder::model()); // // //set sort aliases // $store->getColumnModel()->formatColumn('type', '$model->type',array(),'name'); // $store->getColumnModel()->formatColumn('size', '"-"',array(),'name'); // // $store->getColumnModel()->setFormatRecordFunction(array($this, 'formatListRecord')); // $findParams = $store->getDefaultParams($params); // $stmt = \GO\Files\Model\Folder::model()->findShares($findParams); // $store->setStatement($stmt); // // $response = $store->getData(); // $fp = \GO\Base\Db\FindParams::newInstance()->limit(100); //$fp = \GO\Base\Db\FindParams::newInstance()->calcFoundRows(); $cm = new \GO\Base\Data\ColumnModel('GO\\Files\\Model\\Folder'); $cm->setFormatRecordFunction(array($this, 'formatListRecord')); $findParams = \GO\Base\Db\FindParams::newInstance()->joinRelation('sharedRootFolders')->ignoreAcl()->order('name', 'ASC'); $findParams->getCriteria()->addCondition('user_id', \GO::user()->id, '=', 'sharedRootFolders'); $store = new \GO\Base\Data\DbStore('GO\\Files\\Model\\Folder', $cm, $params, $findParams); $response = $store->getData(); $response['permission_level'] = \GO\Base\Model\Acl::READ_PERMISSION; // $response['results']=array(); // $shares =\GO\Files\Model\Folder::model()->getTopLevelShares($fp); // foreach($shares as $folder){ // $record=$folder->getAttributes("html"); // $record = $this->formatListRecord($record, $folder, false); // $response['results'][]=$record; // } // $response['total']=$shares->foundRows; return $response; }
public function getRecords() { return $this->store->getRecords(); }
/** * Render JSON output that can be used by ExtJS GridPanel * @param array $params the $_REQUEST params */ protected function actionStore($excerpt = false) { //Create ColumnModel from model $columnModel = new \GO\Base\Data\ColumnModel(); $columnModel->formatColumn('user_name', '$model->user->name', array(), 'user_id'); $columnModel->setModelFormatType('raw'); $findParams = \GO\Base\Db\FindParams::newInstance()->export('notes'); if ($excerpt) { $columnModel->formatColumn('excerpt', '$model->excerpt'); $findParams->select('t.*'); } $nn = new Note(); $store = new \GO\Base\Data\DbStore($nn->className(), $columnModel, null, $findParams); $store->multiSelect('no-multiselect', Category::className(), 'category_id'); echo $this->render('store', array('store' => $store)); }