diff options
| author | 2012-10-22 18:00:13 +0200 | |
|---|---|---|
| committer | 2012-10-22 18:00:13 +0200 | |
| commit | 0426541acbeb44d240e6dbf7a93f3a104bea61b4 (patch) | |
| tree | 209a425c5afee9e627d11023b262326812be1fbc /app/controllers/configureController.php | |
| parent | fb57be5a5af3a2fb46b2dbf2b503ffe78eb5cf49 (diff) | |
Grosse màj : ajout de la configuration + ajouts divers fonctionnalités
Diffstat (limited to 'app/controllers/configureController.php')
| -rwxr-xr-x | app/controllers/configureController.php | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 0f5d6b658..5642ef547 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -2,11 +2,66 @@ class configureController extends ActionController { public function categorizeAction () { - + $catDAO = new CategoryDAO (); + + if (Request::isPost ()) { + $cats = Request::param ('categories', array ()); + $ids = Request::param ('ids', array ()); + $newCat = Request::param ('new_category'); + + foreach ($cats as $key => $name) { + if (strlen ($name) > 0) { + $cat = new Category ($name); + $values = array ( + 'name' => $cat->name (), + 'color' => $cat->color () + ); + $catDAO->updateCategory ($ids[$key], $values); + } else { + $catDAO->deleteCategory ($ids[$key]); + } + } + + if ($newCat != false) { + $cat = new Category ($newCat); + $values = array ( + 'id' => $cat->id (), + 'name' => $cat->name (), + 'color' => $cat->color () + ); + $catDAO->addCategory ($values); + } + + $catDAO->save (); + + } + + $this->view->categories = $catDAO->listCategories (); } public function fluxAction () { - + $feedDAO = new FeedDAO (); + $this->view->feeds = $feedDAO->listFeeds (); + + $id = Request::param ('id'); + + $this->view->flux = false; + if ($id != false) { + $this->view->flux = $feedDAO->searchById ($id); + + $catDAO = new CategoryDAO (); + $this->view->categories = $catDAO->listCategories (); + + if (Request::isPost () && $this->view->flux) { + $cat = Request::param ('category'); + $values = array ( + 'category' => $cat + ); + $feedDAO->updateFeed ($id, $values); + + $this->view->flux->_category ($cat); + } + } } public function displayAction () { @@ -14,15 +69,18 @@ class configureController extends ActionController { $nb = Request::param ('posts_per_page', 10); $view = Request::param ('default_view', 'all'); $display = Request::param ('display_posts', 'no'); + $sort = Request::param ('sort_order', 'low_to_high'); $this->view->conf->_postsPerPage (intval ($nb)); $this->view->conf->_defaultView ($view); $this->view->conf->_displayPosts ($display); + $this->view->conf->_sortOrder ($sort); $values = array ( 'posts_per_page' => $this->view->conf->postsPerPage (), 'default_view' => $this->view->conf->defaultView (), - 'display_posts' => $this->view->conf->displayPosts () + 'display_posts' => $this->view->conf->displayPosts (), + 'sort_order' => $this->view->conf->sortOrder () ); $confDAO = new RSSConfigurationDAO (); |
