예제 #1
0
 /**
  * Return a response that shows an edition page.
  * @param  type $id the ID of the entity to edit, if any.
  * @return Html
  */
 protected function getEditionResponse(Entity $entity = null)
 {
     // Create a new HTML response.
     $response = $this->getHtmlResponse();
     // Indicate where is the template.
     $response->setTemplateId(sprintf('%s/edit', $this->getCollectionName()));
     // If there is an entity ID, load that entity in the response as well.
     if ($entity) {
         $response->setData($this->getItemName(), $entity->getFieldsData());
     }
     return $response;
 }
예제 #2
0
 /**
  * Generate a response that displays an entity's data.
  *
  * @param  \Eix\Services\Data\Entity $entity
  * @return Response
  */
 protected function getViewResponse(Entity $entity)
 {
     $response = $this->getHtmlResponse();
     $response->setTemplateId($this->getViewTemplateId());
     $response->setData($this->getItemName(), $entity->getFieldsData());
     $response->appendToTitle(sprintf(_('%s %s'), ucfirst($this->getItemName()), $entity->getId()));
     return $response;
 }
예제 #3
0
파일: User.php 프로젝트: eix/core
 /**
  * Flag the user as no longer in existence, so that it does not
  * automatically get saved in the session.
  */
 public function destroy()
 {
     parent::destroy();
     Logger::get()->debug('Destroying user ' . $this->id);
     // If this user is the one stored in the session, destroy that too.
     if (!empty($_SESSION) && $_SESSION['current_user'] == $this) {
         unset($_SESSION['current_user']);
     }
 }