Exemple #1
0
 public function action_imgedit()
 {
     $file = ORM::factory('file', $this->request->param('id'));
     if (!$file->loaded()) {
         notes::add('error', 'Filen blev ikke fundet!');
         cms::redirect('files');
     }
     $this->load_css('media/libs/jcrop/css/jquery.Jcrop.min.css');
     $this->load_script('media/libs/jcrop/js/jquery.Jcrop.min.js');
     $this->bind('file', $file);
 }
Exemple #2
0
 public function action_show()
 {
     $token = $this->request->param('id');
     $mail = ORM::factory('Mail')->where('token', '=', $token)->find();
     if ($mail->loaded()) {
         $view = View::factory('templates/mail');
         $view->mail = $mail;
         echo $view;
     } else {
         notes::add('error', 'Mail not found!');
         site::redirect('');
         die;
     }
 }
 public function action_edit()
 {
     $content = ORM::factory('Content', $this->request->param('id'));
     if (!$content->loaded()) {
         notes::add('error', 'Indholdet blev ikke fundet.');
         //cms::redirect();
     }
     $view = View::factory('Cms/Content/edit', array('content' => $content));
     $tags = DB::select('tag_id')->from('contents_tags')->group_by('tag_id')->execute();
     $alltags = array();
     if ((bool) $tags->count()) {
         foreach ($tags as $tag) {
             $tag = ORM::factory('Tag', arr::get($tag, 'tag_id'));
             $alltags[] = array('title' => $tag->tag, 'id' => $tag->id, 'slug' => $tag->slug);
         }
     }
     reply::ok($view, 'contenttype-' . $content->contenttype_id, array('viewModel' => 'viewModels/Content/edit', 'alltags' => $alltags));
 }
Exemple #4
0
 public function action_signup()
 {
     $errors = false;
     $password = false;
     if ($_POST) {
         $user = ORM::factory('User');
         try {
             user::create($_POST);
             notes::add('success', 'You are now signed up. Welcome!');
             if (user::logged()) {
                 site::redirect('write');
             } else {
                 // should log this error (user wasnt logged in with user::create())
                 user::redirect('login');
             }
         } catch (ORM_Validation_Exception $e) {
             $errors = $e->errors('models');
         }
     }
     $this->bind('errors', $errors);
 }