aboutsummaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-25 17:08:17 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-25 17:08:17 +0200
commit48a1aa7d52e712d5f64a33a003b31f23a00b99f5 (patch)
treeab6e6de44c007836edda8f0b2ded29c8d28ca1a1 /app/models
parent32ee8feccfb28aa3141469581cd04d4813fd6835 (diff)
ajout de la fonctionnalité pour paramétrer les raccourcis
Diffstat (limited to 'app/models')
-rw-r--r--app/models/Feed.php13
-rwxr-xr-xapp/models/RSSConfiguration.php26
2 files changed, 36 insertions, 3 deletions
diff --git a/app/models/Feed.php b/app/models/Feed.php
index 399c34d18..e28657612 100644
--- a/app/models/Feed.php
+++ b/app/models/Feed.php
@@ -146,6 +146,19 @@ class FeedDAO extends Model_pdo {
}
}
+ public function deleteFeed ($id) {
+ $sql = 'DELETE FROM feed WHERE id=?';
+ $stm = $this->bd->prepare ($sql);
+
+ $values = array ($id);
+
+ if ($stm && $stm->execute ($values)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
public function searchById ($id) {
$sql = 'SELECT * FROM feed WHERE id=?';
$stm = $this->bd->prepare ($sql);
diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php
index 8ee1717b3..f3e7f9d4a 100755
--- a/app/models/RSSConfiguration.php
+++ b/app/models/RSSConfiguration.php
@@ -6,6 +6,7 @@ class RSSConfiguration extends Model {
private $display_posts;
private $sort_order;
private $old_entries;
+ private $shortcuts = array ();
public function __construct () {
$confDAO = new RSSConfigurationDAO ();
@@ -14,6 +15,7 @@ class RSSConfiguration extends Model {
$this->_displayPosts ($confDAO->display_posts);
$this->_sortOrder ($confDAO->sort_order);
$this->_oldEntries ($confDAO->old_entries);
+ $this->_shortcuts ($confDAO->shortcuts);
}
public function postsPerPage () {
@@ -31,6 +33,9 @@ class RSSConfiguration extends Model {
public function oldEntries () {
return $this->old_entries;
}
+ public function shortcuts () {
+ return $this->shortcuts;
+ }
public function _postsPerPage ($value) {
if (is_int ($value)) {
@@ -67,6 +72,11 @@ class RSSConfiguration extends Model {
$this->old_entries = 3;
}
}
+ public function _shortcuts ($values) {
+ foreach ($values as $key => $value) {
+ $this->shortcuts[$key] = $value;
+ }
+ }
}
class RSSConfigurationDAO extends Model_array {
@@ -75,6 +85,15 @@ class RSSConfigurationDAO extends Model_array {
public $display_posts = 'no';
public $sort_order = 'low_to_high';
public $old_entries = 3;
+ public $shortcuts = array (
+ 'mark_read' => 'r',
+ 'mark_favorite' => 'f',
+ 'go_website' => 'enter',
+ 'next_entry' => 'page_down',
+ 'prev_entry' => 'page_up',
+ 'next_page' => 'right',
+ 'prev_page' => 'left',
+ );
public function __construct () {
parent::__construct (PUBLIC_PATH . '/data/db/Configuration.array.php');
@@ -94,11 +113,12 @@ class RSSConfigurationDAO extends Model_array {
if (isset ($this->array['old_entries'])) {
$this->old_entries = $this->array['old_entries'];
}
+ if (isset ($this->array['shortcuts'])) {
+ $this->shortcuts = $this->array['shortcuts'];
+ }
}
- public function save ($values) {
- $this->array[0] = array ();
-
+ public function update ($values) {
foreach ($values as $key => $value) {
$this->array[0][$key] = $value;
}