protected function actionCalendarStore() { $colModel = new \GO\Base\Data\ColumnModel(\GO\Favorites\Model\Calendar::model()); $colModel->setColumnsFromModel(\GO\Calendar\Model\Calendar::model()); $findParams = new \GO\Base\Db\FindParams(); $findParams->getCriteria()->addCondition('user_id', \GO::user()->id, '=', 'cal'); $findParams->order('name'); $findParams->joinModel(array('model' => 'GO\\Favorites\\Model\\Calendar', 'localTableAlias' => 't', 'localField' => 'id', 'foreignField' => 'calendar_id', 'tableAlias' => 'cal', 'type' => 'INNER')); $store = new \GO\Base\Data\DbStore('GO\\Calendar\\Model\\Calendar', $colModel, $_POST, $findParams); $store->defaultSort = array('name'); $store->multiSelectable('calendars'); echo $this->renderStore($store); }
protected function actionCombinedStore($params) { $response = array('success' => true, 'total' => 0, 'results' => array()); $cm = new \GO\Base\Data\ColumnModel(); $cm->setColumnsFromModel(\GO::getModel('GO\\Comments\\Model\\Comment')); $store = \GO\Base\Data\Store::newInstance($cm); $storeParams = $store->getDefaultParams($params)->mergeWith($this->getStoreParams($params)); $findParams = \GO\Base\Db\FindParams::newInstance()->select('t.*,type.model_name')->joinModel(array('model' => 'GO\\Base\\Model\\ModelType', 'localTableAlias' => 't', 'localField' => 'model_type_id', 'foreignField' => 'id', 'tableAlias' => 'type')); $findParams->mergeWith($storeParams); $store->setStatement(\GO\Comments\Model\Comment::model()->find($findParams)); return $store->getData(); // // return $response; }
/** * Override this function to format the grid record data. * @TODO: THIS DESCRIPTION IS NOT OK * @param array $record The grid record returned from the \GO\Base\Db\ActiveRecord->getAttributes * @param \GO\Base\Db\ActiveRecord $model * @return array The grid record data */ protected function getStoreColumnModel($withCustomfields = true) { $cm = new \GO\Base\Data\ColumnModel(); $cm->setColumnsFromModel(\GO::getModel($this->model), $this->getStoreExcludeColumns(), array(), $withCustomfields); return $cm; }