/** * Can be used in actionDisplay like actions * @param \GO\Base\Db\ActiveRecord $model the model to render display data for * @param array $extraFields the extra fields that should be attached to the data array as key => value * @return \GO\Base\Data\JsonResponse Response object */ public function renderDisplay($model, $extraFields = array()) { $response = array('data' => array(), 'success' => true); $response['data'] = array_merge_recursive($extraFields, $model->getAttributes('html')); if (!empty($model->user)) { $response['data']['username'] = $model->user->name; } if (!empty($model->mUser)) { $response['data']['musername'] = $model->mUser->name; } //$response['data'] = $model->getAttributes('html'); //$response['data']['model'] = $model->className(); $response['data']['permission_level'] = $model->getPermissionLevel(); $response['data']['write_permission'] = \GO\Base\Model\Acl::hasPermission($response['data']['permission_level'], \GO\Base\Model\Acl::WRITE_PERMISSION); $response['data']['customfields'] = array(); if (!isset($response['data']['workflow']) && \GO::modules()->workflow) { $response = $this->_processWorkflowDisplay($model, $response); } if ($model->customfieldsRecord) { $response = $this->_processCustomFieldsDisplay($model, $response); } if ($model->hasLinks()) { $response = $this->_processLinksDisplay($model, $response); if (!isset($response['data']['events']) && \GO::modules()->calendar) { $response = $this->_processEventsDisplay($model, $response); } if (!isset($response['data']['tasks']) && \GO::modules()->tasks) { $response = $this->_processTasksDisplay($model, $response); } } if (\GO::modules()->files && !isset($response['data']['files'])) { $response = $this->_processFilesDisplay($model, $response); } if (\GO::modules()->comments) { $response = $this->_processCommentsDisplay($model, $response); } if (\GO::modules()->lists) { $response = \GO\Lists\ListsModule::displayResponse($model, $response); } $this->fireEvent('display', array(&$this, &$response, &$model)); return new \GO\Base\Data\JsonResponse($response); }