@ -2,7 +2,6 @@
class indexController extends ActionController {
class indexController extends ActionController {
private $get = false;
private $get = false;
private $nb_not_read = 0;
private $nb_not_read_cat = 0;
private $nb_not_read_cat = 0;
public function indexAction () {
public function indexAction () {
@ -56,19 +55,12 @@ class indexController extends ActionController {
}
}
}
}
$nb_not_read = $this->view->nb_not_read;
if($nb_not_read > 0) {
View::appendTitle (' (' . $nb_not_read . ')');
}
View::prependTitle (' - ');
$entryDAO = new EntryDAO ();
$entryDAO = new EntryDAO ();
$feedDAO = new FeedDAO ();
$feedDAO = new FeedDAO ();
$catDAO = new CategoryDAO ();
$catDAO = new CategoryDAO ();
$this->view->cat_aside = $catDAO->listCategories ();
$this->view->cat_aside = $catDAO->listCategories ();
$this->view->nb_favorites = $entryDAO->countUnreadReadFavorites ();
$this->view->nb_favorites = $entryDAO->countUnreadReadFavorites ();
$this->view->nb_total = $entryDAO->count ();
$this->view->currentName = '';
$this->view->currentName = '';
$this->view->get_c = '';
$this->view->get_c = '';
@ -78,6 +70,12 @@ class indexController extends ActionController {
$error = $this->checkAndProcessType ($type);
$error = $this->checkAndProcessType ($type);
// mise à jour des titres
// mise à jour des titres
$this->view->nb_not_read = HelperCategory::CountUnreads($this->view->cat_aside, 1);
if ($this->view->nb_not_read > 0) {
View::appendTitle (' (' . $this->view->nb_not_read . ')');
}
View::prependTitle (' - ');
$this->view->rss_title = $this->view->currentName . ' - ' . $this->view->rss_title;
$this->view->rss_title = $this->view->currentName . ' - ' . $this->view->rss_title;
View::prependTitle (
View::prependTitle (
$this->view->currentName .
$this->view->currentName .
@ -166,8 +164,11 @@ class indexController extends ActionController {
$this->view->get_c = $type['type'];
$this->view->get_c = $type['type'];
return false;
return false;
} elseif ($type['type'] == 'c') {
} elseif ($type['type'] == 'c') {
$catDAO = new CategoryDAO ();
$cat = isset($this->view->cat_aside[$type['id']]) ? $this->view->cat_aside[$type['id']] : null;
$cat = $catDAO->searchById ($type['id']);
if ($cat === null) {
$catDAO = new CategoryDAO ();
$cat = $catDAO->searchById ($type['id']);
}
if ($cat) {
if ($cat) {
$this->view->currentName = $cat->name ();
$this->view->currentName = $cat->name ();
$this->nb_not_read_cat = $cat->nbNotRead ();
$this->nb_not_read_cat = $cat->nbNotRead ();
@ -177,8 +178,11 @@ class indexController extends ActionController {
return true;
return true;
}
}
} elseif ($type['type'] == 'f') {
} elseif ($type['type'] == 'f') {
$feedDAO = new FeedDAO ();
$feed = HelperCategory::findFeed($this->view->cat_aside, $type['id']);
$feed = $feedDAO->searchById ($type['id']);
if (empty($feed)) {
$feedDAO = new FeedDAO ();
$feed = $feedDAO->searchById ($type['id']);
}
if ($feed) {
if ($feed) {
$this->view->currentName = $feed->name ();
$this->view->currentName = $feed->name ();
$this->nb_not_read_cat = $feed->nbNotRead ();
$this->nb_not_read_cat = $feed->nbNotRead ();