/** * (non-PHPdoc). * * @see LibBaseViewJson::display() */ public function display() { if (!$this->_state->getItem()) { throw new LibBaseControllerExceptionUnauthorized('User is not logged in'); } else { return parent::display(); } }
/** * Return the list * * @return array */ protected function _getList() { $data = parent::_getList(); $data['scopes'] = array(); foreach ($this->_state->scopes as $scope) { $count = $this->_state->getList()->getScopeCount($scope); $data['scopes'][] = array('name' => $scope->getKey(), 'count' => (int) $count); } return $data; }
/** * (non-PHPdoc) * @see LibBaseViewJson::_getItem() */ protected function _getItem() { $item = parent::_getItem(); $context = new KCommandContext(); $context->gadgets = new LibBaseTemplateObjectContainer(); $context->actor = $this->_state->getItem(); $context->composers = new LibBaseTemplateObjectContainer(); $context->profile = new KConfig(); if ($this->_state->getItem()->authorize('access')) { $this->_state->getItem()->components->registerEventDispatcher($this->getService('anahita:event.dispatcher')); $this->getService('anahita:event.dispatcher')->dispatchEvent('onProfileDisplay', $context); dispatch_plugin('profile.onDisplay', array('actor' => $this->_state->getItem(), 'profile' => $context->profile)); $this->profile = $context->profile; } $item['gadgets'] = array_map(function ($gadget) { return $gadget->name; }, $context['gadgets']->getObjects()); $item['composers'] = array_map(function ($gadget) { return $gadget->name; }, $context['composers']->getObjects()); $item['information'] = $context['profile']; return $item; }
/** * Return the list. * * @return array */ protected function _getList() { $data = parent::_getList(); $data['pagination']['total'] = count($this->_state->getList()); return $data; }