aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/indexController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-22 13:52:20 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-22 13:52:20 +0200
commitf1f9b2f5ff60f6dca05fad831b766ea7d63ff3a3 (patch)
tree9f764ec6b7be91554e1ae20323a55c1f1d2be992 /app/Controllers/indexController.php
parentb446a510ebacddd1437d907e795c83b3d05a9b98 (diff)
Entries are loaded again! It's working :)
See https://github.com/marienfressinaud/FreshRSS/issues/634
Diffstat (limited to 'app/Controllers/indexController.php')
-rwxr-xr-xapp/Controllers/indexController.php58
1 files changed, 41 insertions, 17 deletions
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index be85aa68d..d711997be 100755
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -14,23 +14,6 @@ class FreshRSS_index_Controller extends Minz_ActionController {
'c' => 'index',
'a' => $prefered_output
));
-
- return;
-
- try {
- $entries = $entryDAO->listWhere($getType, $getId, $this->view->state, $order, $nb + 1, $first, $filter);
-
- if (count($entries) > $nb) {
- // We have more elements for pagination
- $last_entry = array_pop($entries);
- FreshRSS_Context::$next_id = $last_entry->id();
- }
-
- $this->view->entries = $entries;
- } catch (FreshRSS_EntriesGetter_Exception $e) {
- Minz_Log::notice($e->getMessage());
- Minz_Error::error(404);
- }
}
/**
@@ -48,6 +31,21 @@ class FreshRSS_index_Controller extends Minz_ActionController {
Minz_Error::error(404);
}
+ try {
+ $entries = $this->listByContext();
+
+ if (count($entries) > FreshRSS_Context::$number) {
+ // We have more elements for pagination
+ $last_entry = array_pop($entries);
+ FreshRSS_Context::$next_id = $last_entry->id();
+ }
+
+ $this->view->entries = $entries;
+ } catch (FreshRSS_EntriesGetter_Exception $e) {
+ Minz_Log::notice($e->getMessage());
+ Minz_Error::error(404);
+ }
+
$this->view->categories = FreshRSS_Context::$categories;
$title = FreshRSS_Context::$name;
@@ -100,6 +98,13 @@ class FreshRSS_index_Controller extends Minz_ActionController {
Minz_Error::error(404);
}
+ try {
+ $this->view->entries = $this->listByContext();
+ } catch (FreshRSS_EntriesGetter_Exception $e) {
+ Minz_Log::notice($e->getMessage());
+ Minz_Error::error(404);
+ }
+
// No layout for RSS output.
$this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title();
$this->view->_useLayout(false);
@@ -130,6 +135,25 @@ class FreshRSS_index_Controller extends Minz_ActionController {
FreshRSS_Context::$first_id = Minz_Request::param('next', '');
}
+ private function listByContext() {
+ $entryDAO = FreshRSS_Factory::createEntryDao();
+
+ $get = FreshRSS_Context::currentGet(true);
+ if (count($get) > 1) {
+ $type = $get[0];
+ $id = $get[1];
+ } else {
+ $type = $get;
+ $id = '';
+ }
+
+ return $entryDAO->listWhere(
+ $type, $id, FreshRSS_Context::$state, FreshRSS_Context::$order,
+ FreshRSS_Context::$number + 1, FreshRSS_Context::$first_id,
+ FreshRSS_Context::$search
+ );
+ }
+
/**
* This action displays the about page of FreshRSS.
*/