diff options
| author | 2013-03-16 22:19:27 +0100 | |
|---|---|---|
| committer | 2013-03-16 22:19:27 +0100 | |
| commit | 8c2b3bfc30caa22258b9569b8a228db0adc90618 (patch) | |
| tree | 9d4ea433e309bf5bb7a2275f365dcc28bf14f8df | |
| parent | 9daa4c14636ca6b70031344f812ac99947b3a2b0 (diff) | |
Fix bug #27 : le marquer comme lu s'adapte si on ne regarde qu'une catégorie ou qu'un flux
| -rwxr-xr-x | app/controllers/entryController.php | 28 | ||||
| -rwxr-xr-x | app/models/Entry.php | 37 | ||||
| -rw-r--r-- | app/views/index/index.phtml | 20 | ||||
| -rw-r--r-- | public/theme/icons/down.svg | 31 | ||||
| -rw-r--r-- | public/theme/icons/up.svg | 31 |
5 files changed, 136 insertions, 11 deletions
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php index ca702191f..cb309c567 100755 --- a/app/controllers/entryController.php +++ b/app/controllers/entryController.php @@ -17,7 +17,11 @@ class entryController extends ActionController { public function lastAction () { $ajax = Request::param ('ajax'); if (!$ajax) { - Request::forward (array (), true); + Request::forward (array ( + 'c' => 'index', + 'a' => 'index', + 'params' => $this->params + ), true); } else { Request::_param ('ajax'); } @@ -26,6 +30,7 @@ class entryController extends ActionController { public function readAction () { $id = Request::param ('id'); $is_read = Request::param ('is_read'); + $get = Request::param ('get'); if ($is_read) { $is_read = true; @@ -33,18 +38,27 @@ class entryController extends ActionController { $is_read = false; } - $values = array ( - 'is_read' => $is_read, - ); - $entryDAO = new EntryDAO (); if ($id == false) { - $entryDAO->updateEntries ($values); + if (!$get) { + $entryDAO->markReadEntries ($is_read); + } else { + $typeGet = $get[0]; + $get = substr ($get, 2); + + if ($typeGet == 'c') { + $entryDAO->markReadCat ($get, $is_read); + $this->params = array ('get' => 'c_' . $get); + } elseif ($typeGet == 'f') { + $entryDAO->markReadFeed ($get, $is_read); + $this->params = array ('get' => 'f_' . $get); + } + } // notif $notif = array ( 'type' => 'good', - 'content' => 'Tous les flux ont été marqués comme lu' + 'content' => 'Les flux ont été marqués comme lu' ); Session::_param ('notification', $notif); } else { diff --git a/app/models/Entry.php b/app/models/Entry.php index b1d7b8880..001f76b5a 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -171,6 +171,43 @@ class EntryDAO extends Model_pdo { } } + public function markReadEntries ($read) { + $sql = 'UPDATE entry SET is_read = ?'; + $stm = $this->bd->prepare ($sql); + + $values = array ($read); + + if ($stm && $stm->execute ($values)) { + return true; + } else { + return false; + } + } + public function markReadCat ($id, $read) { + $sql = 'UPDATE entry e INNER JOIN feed f ON e.id_feed = f.id SET is_read = ? WHERE category = ?'; + $stm = $this->bd->prepare ($sql); + + $values = array ($read, $id); + + if ($stm && $stm->execute ($values)) { + return true; + } else { + return false; + } + } + public function markReadFeed ($id, $read) { + $sql = 'UPDATE entry SET is_read = ? WHERE id_feed = ?'; + $stm = $this->bd->prepare ($sql); + + $values = array ($read, $id); + + if ($stm && $stm->execute ($values)) { + return true; + } else { + return false; + } + } + public function updateEntries ($valuesTmp) { if (isset ($valuesTmp['content'])) { $valuesTmp['content'] = base64_encode (gzdeflate (serialize ($valuesTmp['content']))); diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index df222b5d0..3e213d076 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -1,16 +1,28 @@ <?php $this->partial ('aside_flux'); ?> <div class="nav_menu stick"> - <a class="btn" href="<?php echo Url::display (array ('c' => 'feed', 'a' => 'actualize')); ?>"><i class="icon i_refresh"></i></a> + <a class="btn" href="<?php echo _url ('feed', 'actualize'); ?>"><i class="icon i_refresh"></i></a> + + <?php + $get = false; + $string_mark = 'Tout marquer comme lu'; + if ($this->get_f) { + $get = 'f_' . $this->get_f; + $string_mark = 'Marquer le flux comme lu'; + } elseif ($this->get_c) { + $get = 'c_' . $this->get_c; + $string_mark = 'Marquer la catégorie comme lue'; + } + ?> <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?> - <a class="read_all btn" href="<?php echo Url::display (array ('c' => 'entry', 'a' => 'read', 'params' => array ('is_read' => 1))); ?>">Tout marquer comme lu</a> + <a class="read_all btn" href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get); ?>"><?php echo $string_mark; ?></a> <?php } ?> <?php if ($this->mode == 'not_read') { ?> - <a class="print_all btn" href="<?php echo Url::display (array ('a' => 'changeMode', 'params' => array ('mode' => 'all'))); ?>">Tout afficher</a> + <a class="print_all btn" href="<?php echo _url ('index', 'changeMode', 'mode', 'all'); ?>">Tout afficher</a> <?php } else { ?> - <a class="print_non_read btn" href="<?php echo Url::display (array ('a' => 'changeMode', 'params' => array ('mode' => 'not_read'))); ?>">Afficher les non lus</a> + <a class="print_non_read btn" href="<?php echo _url ('index', 'changeMode', 'mode', 'not_read'); ?>">Afficher les non lus</a> <?php } ?> </div> diff --git a/public/theme/icons/down.svg b/public/theme/icons/down.svg new file mode 100644 index 000000000..06d031fae --- /dev/null +++ b/public/theme/icons/down.svg @@ -0,0 +1,31 @@ +<?xml version='1.0' encoding='UTF-8' standalone='no'?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' sodipodi:docname='go-down-symbolic.svg' height='16' id='svg7384' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:svg='http://www.w3.org/2000/svg' inkscape:version='0.48.4 r9939' version='1.1' width='16' xmlns='http://www.w3.org/2000/svg'> + <metadata id='metadata90'> + <rdf:RDF> + <cc:Work rdf:about=''> + <dc:format>image/svg+xml</dc:format> + <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/> + <dc:title>Gnome Symbolic Icon Theme</dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview inkscape:bbox-nodes='false' inkscape:bbox-paths='true' bordercolor='#666666' borderopacity='1' inkscape:current-layer='layer12' inkscape:cx='18.648774' inkscape:cy='9.99302' gridtolerance='10' inkscape:guide-bbox='true' guidetolerance='10' id='namedview88' inkscape:object-nodes='false' inkscape:object-paths='false' objecttolerance='10' pagecolor='#3a3b39' inkscape:pageopacity='1' inkscape:pageshadow='2' showborder='false' showgrid='false' showguides='true' inkscape:snap-bbox='true' inkscape:snap-bbox-midpoints='false' inkscape:snap-global='true' inkscape:snap-grids='true' inkscape:snap-nodes='false' inkscape:snap-others='false' inkscape:snap-to-guides='true' inkscape:window-height='1408' inkscape:window-maximized='1' inkscape:window-width='2560' inkscape:window-x='0' inkscape:window-y='0' inkscape:zoom='1'> + <inkscape:grid empspacing='2' enabled='true' id='grid4866' originx='60px' originy='530px' snapvisiblegridlinesonly='true' spacingx='1px' spacingy='1px' type='xygrid' visible='true'/> + </sodipodi:namedview> + <title id='title9167'>Gnome Symbolic Icon Theme</title> + <defs id='defs7386'/> + <g inkscape:groupmode='layer' id='layer9' inkscape:label='status' style='display:inline' transform='translate(-181.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer10' inkscape:label='devices' transform='translate(-181.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer11' inkscape:label='apps' transform='translate(-181.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer13' inkscape:label='places' transform='translate(-181.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer14' inkscape:label='mimetypes' transform='translate(-181.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer15' inkscape:label='emblems' style='display:inline' transform='translate(-181.0002,-747)'/> + <g inkscape:groupmode='layer' id='g71291' inkscape:label='emotes' style='display:inline' transform='translate(-181.0002,-747)'/> + <g inkscape:groupmode='layer' id='g4953' inkscape:label='categories' style='display:inline' transform='translate(-181.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer12' inkscape:label='actions' style='display:inline' transform='translate(-181.0002,-747)'> + + <path inkscape:connector-curvature='0' d='m 195.03152,751.00323 0,1.00001 c -9.1e-4,0.0111 5.9e-4,0.021 -9e-5,0.0312 -0.0112,0.25496 -0.12835,0.50994 -0.31251,0.6875 l -5.71875,6.29767 -5.71875,-6.29773 c -0.18821,-0.1881 -0.28121,-0.45346 -0.28122,-0.71875 l 0,-1.00001 1,0 c 0.26531,7e-5 0.53059,0.0931 0.71873,0.28131 l 4.28125,4.82896 4.28127,-4.82896 c 0.19464,-0.21073 0.46925,-0.30315 0.74998,-0.2813 z' id='path10839-9-9-5-9-1' sodipodi:nodetypes='ccsccccccccccc' style='font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#bebebe;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.78124988;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new;font-family:Andale Mono;-inkscape-font-specification:Andale Mono'/> + </g> +</svg> diff --git a/public/theme/icons/up.svg b/public/theme/icons/up.svg new file mode 100644 index 000000000..dab31a20d --- /dev/null +++ b/public/theme/icons/up.svg @@ -0,0 +1,31 @@ +<?xml version='1.0' encoding='UTF-8' standalone='no'?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' sodipodi:docname='go-up-symbolic.svg' height='16' id='svg7384' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:svg='http://www.w3.org/2000/svg' inkscape:version='0.48.4 r9939' version='1.1' width='16' xmlns='http://www.w3.org/2000/svg'> + <metadata id='metadata90'> + <rdf:RDF> + <cc:Work rdf:about=''> + <dc:format>image/svg+xml</dc:format> + <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/> + <dc:title>Gnome Symbolic Icon Theme</dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview inkscape:bbox-nodes='false' inkscape:bbox-paths='true' bordercolor='#666666' borderopacity='1' inkscape:current-layer='layer12' inkscape:cx='-1.351226' inkscape:cy='9.99302' gridtolerance='10' inkscape:guide-bbox='true' guidetolerance='10' id='namedview88' inkscape:object-nodes='false' inkscape:object-paths='false' objecttolerance='10' pagecolor='#3a3b39' inkscape:pageopacity='1' inkscape:pageshadow='2' showborder='false' showgrid='false' showguides='true' inkscape:snap-bbox='true' inkscape:snap-bbox-midpoints='false' inkscape:snap-global='true' inkscape:snap-grids='true' inkscape:snap-nodes='false' inkscape:snap-others='false' inkscape:snap-to-guides='true' inkscape:window-height='1408' inkscape:window-maximized='1' inkscape:window-width='2560' inkscape:window-x='0' inkscape:window-y='0' inkscape:zoom='1'> + <inkscape:grid empspacing='2' enabled='true' id='grid4866' originx='40px' originy='530px' snapvisiblegridlinesonly='true' spacingx='1px' spacingy='1px' type='xygrid' visible='true'/> + </sodipodi:namedview> + <title id='title9167'>Gnome Symbolic Icon Theme</title> + <defs id='defs7386'/> + <g inkscape:groupmode='layer' id='layer9' inkscape:label='status' style='display:inline' transform='translate(-201.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer10' inkscape:label='devices' transform='translate(-201.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer11' inkscape:label='apps' transform='translate(-201.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer13' inkscape:label='places' transform='translate(-201.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer14' inkscape:label='mimetypes' transform='translate(-201.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer15' inkscape:label='emblems' style='display:inline' transform='translate(-201.0002,-747)'/> + <g inkscape:groupmode='layer' id='g71291' inkscape:label='emotes' style='display:inline' transform='translate(-201.0002,-747)'/> + <g inkscape:groupmode='layer' id='g4953' inkscape:label='categories' style='display:inline' transform='translate(-201.0002,-747)'/> + <g inkscape:groupmode='layer' id='layer12' inkscape:label='actions' style='display:inline' transform='translate(-201.0002,-747)'> + + <path inkscape:connector-curvature='0' d='m 215.03152,758.99677 0,-1.00001 c -9.1e-4,-0.0111 5.9e-4,-0.021 -9e-5,-0.0312 -0.0112,-0.25496 -0.12835,-0.50994 -0.31251,-0.6875 l -5.71875,-6.29767 -5.71875,6.29773 c -0.18821,0.1881 -0.28121,0.45346 -0.28122,0.71875 l 0,1.00001 1,0 c 0.26531,-7e-5 0.53059,-0.0931 0.71873,-0.28131 l 4.28125,-4.82896 4.28127,4.82896 c 0.19464,0.21073 0.46925,0.30315 0.74998,0.2813 z' id='path10839-9-9-5-9-1-0' sodipodi:nodetypes='ccsccccccccccc' style='font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#bebebe;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.78124988;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new;font-family:Andale Mono;-inkscape-font-specification:Andale Mono'/> + </g> +</svg> |
