diff options
| author | 2014-05-04 08:57:19 -0400 | |
|---|---|---|
| committer | 2014-05-04 17:23:53 -0400 | |
| commit | 8521c876d4b2ce69ff5d4313493017f26aa2cd6b (patch) | |
| tree | 36b2c4ee9f3237502a7f15c0a8e6c132ad7a53a7 /app/Controllers/configureController.php | |
| parent | 2f51556f775045689abcde413c765cd08b85058a (diff) | |
Add user queries
It's an intermediary step to remove the favorite button.
I add a button to store the current query as a favorite query. It redirects automatically to the configuration page where it is possible to name and remove user queries.
To make the queries more straigtforward, I removed the default behavior when searching for a string. This way, when we search for a string, the filter is not defaulted to all articles.
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 df5212041..573c42d64 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -298,4 +298,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 ($params['queries']); + $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); + } } |
