@@ 48-63 (lines=16) @@ | ||
45 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'newsfeed/index.php', ['pageNum' => $pageNum]); |
|
46 | } |
|
47 | ||
48 | public function create(){ |
|
49 | ||
50 | $content = $this->request->data("content"); |
|
51 | ||
52 | $newsfeed = $this->newsfeed->create(Session::getUserId(), $content); |
|
53 | ||
54 | if(!$newsfeed){ |
|
55 | ||
56 | Session::set('newsfeed-errors', $this->newsfeed->errors()); |
|
57 | return $this->redirector->root("NewsFeed"); |
|
58 | ||
59 | }else{ |
|
60 | ||
61 | return $this->redirector->root("NewsFeed"); |
|
62 | } |
|
63 | } |
|
64 | ||
65 | public function getUpdateForm(){ |
|
66 |
@@ 44-67 (lines=24) @@ | ||
41 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/todo/", Config::get('VIEWS_PATH') . 'todo/index.php'); |
|
42 | } |
|
43 | ||
44 | public function create(){ |
|
45 | ||
46 | $content = $this->request->data("content"); |
|
47 | $todo = $this->todo->create(Session::getUserId(), $content); |
|
48 | ||
49 | if(!$todo){ |
|
50 | ||
51 | // in case of normal post request |
|
52 | Session::set('errors', $this->todo->errors()); |
|
53 | return $this->redirector->root("Todo"); |
|
54 | ||
55 | // in case of ajax |
|
56 | // $this->view->renderErrors($this->todo->errors()); |
|
57 | ||
58 | }else{ |
|
59 | ||
60 | // in case of normal post request |
|
61 | Session::set('success', "Todo has been created"); |
|
62 | return $this->redirector->root("Todo"); |
|
63 | ||
64 | // in case of ajax |
|
65 | // $this->view->renderJson(array("success" => "Todo has been created")); |
|
66 | } |
|
67 | } |
|
68 | ||
69 | public function delete(){ |
|
70 |