Example #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;
 }
Example #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;
 }
Example #3
0
File: User.php Project: 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']);
     }
 }