diff options
| author | 2014-06-13 20:20:43 +0200 | |
|---|---|---|
| committer | 2014-06-13 20:20:43 +0200 | |
| commit | 2b8dc666345d334f50bf2f4f32f0b127edb40c3a (patch) | |
| tree | 0802e16f4fc2c98a706b8d68cea0bcf89549a18d /app/Controllers/configureController.php | |
| parent | 61f4d5457818204eb28ed394d4f1b97160542baa (diff) | |
| parent | a61180032f6c663ed3946fe0bbdb70ac3b8ec96a (diff) | |
Merge branch 'user-queries' of https://github.com/aledeg/FreshRSS into aledeg-user-queries
Conflicts:
app/layout/nav_menu.phtml
Diffstat (limited to 'app/Controllers/configureController.php')
| -rwxr-xr-x | app/Controllers/configureController.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index a117e0f9c..14cd65647 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -299,4 +299,58 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->size_total = $entryDAO->size(true); } } + + public function queriesAction () { + if (Minz_Request::isPost ()) { + $params = Minz_Request::params(); + $this->view->conf->_queries (isset($params['queries']) ? $params['queries'] : array()); + $this->view->conf->save(); + + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('configuration_updated') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'queries'), true); + } else { + $this->view->query_get = array(); + foreach ($this->view->conf->queries as $key => $query) { + if (isset($query['get'])) { + switch ($query['get'][0]) { + case 'c': + $dao = new FreshRSS_CategoryDAO(); + $category = $dao->searchById(substr($query['get'], 2)); + $this->view->query_get[$key] = array( + 'type' => 'category', + 'name' => $category->name(), + ); + break; + case 'f': + $dao = new FreshRSS_FeedDAO(); + $feed = $dao->searchById(substr($query['get'], 2)); + $this->view->query_get[$key] = array( + 'type' => 'feed', + 'name' => $feed->name(), + ); + break; + } + } + } + } + + Minz_View::prependTitle (Minz_Translate::t ('queries') . ' ยท '); + } + + public function addQueryAction () { + $queries = $this->view->conf->queries; + $query = Minz_Request::params(); + unset($query['output']); + unset($query['token']); + $queries[] = $query; + $this->view->conf->_queries($queries); + $this->view->conf->save(); + + Minz_Request::forward(array('c' => 'configure', 'a' => 'queries'), true); + } } |
