/**
  * Processing of News editing form
  *
  * @Privilege('create', 'edit')
  *
  * @param $button
  */
 public function editNewsFormSucceded($button)
 {
     $values = $button->form->getValues(TRUE);
     $values['posted'] = new \DateTime();
     if ($this->user->isAllowed('Admin:Default:News', 'show')) {
         // User can choose
         $values['show'] = $values['show'] ? 1 : 0;
         //translate TRUE/FALSE to 1/0
     } else {
         $values['show'] = 0;
         //default value
     }
     if ($values['id']) {
         //update
         $this->loadItem($values['id'])->update($values);
         $this->flashMessage('Aktualita byla úspěšně upravena');
     } else {
         //insert
         if (empty($values['event_id'])) {
             $values['event_id'] = NULL;
         }
         $this->news->insert($values);
         $this->flashMessage('Aktualita byla úspěšně přidána');
     }
     $this->redirect('default');
 }
 public function store()
 {
     $title = Input::get('title');
     $body = Input::get('body');
     $section = Input::get('section');
     $file = Input::file('image');
     $news = News::insert(array('title' => $title, 'body' => $body, 'image' => !is_null($file), 'section' => $section));
     if (!is_null($file)) {
         $file->moveTo('images/' . $news->id . '.jpg');
     }
     return Response::redirect('/admin/news');
 }