Correction

This commit is contained in:
Michael RICOIS 2013-10-10 11:49:08 +00:00
parent f95a5f0927
commit 4d32d30a14
7 changed files with 218 additions and 18 deletions

View File

@ -3,8 +3,12 @@ class DashboardController extends Zend_Controller_Action
{
public function init()
{
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
$this->view->headLink()
->appendStylesheet('/themes/default/styles/dashboard.css', 'all')
->appendStylesheet('/libs/jqpagination/jqpagination.css', 'all');
$this->view->headScript()
->appendFile('/libs/jqpagination/jquery.jqpagination.min.js', 'text/javascript')
->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
}
public function indexAction()
@ -129,6 +133,8 @@ class DashboardController extends Zend_Controller_Action
$this->view->ciblages = $results;
$this->view->nbCiblage = $nbCiblage;
$this->view->page = $page;
$this->view->nbPages = ceil($nbCiblage/$offset);
}
public function ciblageAction()
@ -253,8 +259,6 @@ class DashboardController extends Zend_Controller_Action
$encours = $enrichissementsM->fetchAll($sql);
$this->view->encours = $encours;
// Impossible de copie la varible issu d'un select car sinon elle conserve les meme propriété que sont parent
// donc les selects... donc obliger de faire deux requetes pour le moment.
$sql = $enrichissementsM->select()
->setIntegrityCheck(false)
->from(

View File

@ -10,12 +10,12 @@
</li>
</ul>
<div id="dashboard">
<div id="dashboard" class="clearfix">
<div style="margin:5px 0;">
<h2>Liste de vos ciblages</h2>
<?php if(count($this->ciblages)>0):?>
<?php if(count($this->ciblages)>0) {?>
<table class="ciblage">
<thead>
@ -28,7 +28,7 @@
</tr>
</thead>
<tbody>
<?php foreach($this->ciblages as $item):?>
<?php foreach($this->ciblages as $item) {?>
<tr>
<td class="reference"><?=$item['reference']?></td>
<td class="update resultat"><?=number_format($item['resultat'], 0, ',', ' ')?></td>
@ -37,13 +37,33 @@
<td><a href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblage', 'id'=>$item['id']))?>">Detail</a></td>
<td><a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Charger les critères de ciblage dans l'interface</a></td>
</tr>
<?php endforeach;?>
<?php }?>
</tbody>
</table>
<?php else:?>
<div style="margin:5px auto;width:333px;">
<div class="pagination">
<a href="#" class="first" data-action="first">&laquo;</a>
<a href="#" class="previous" data-action="previous">&lsaquo;</a>
<input type="text" readonly="readonly" data-current-page="<?=$this->page?>" data-max-page="<?=$this->nbPages?>" />
<a href="#" class="next" data-action="next">&rsaquo;</a>
<a href="#" class="last" data-action="last">&raquo;</a>
</div>
<script>
$('.pagination').jqPagination({
page_string: "Page {current_page} sur {max_page}",
paged: function(page) {
window.location.href = window.location.href + '/page/'+page;
}
});
</script>
</div>
<?php } else {?>
<p>Aucun ciblage.<p>
<?php endif;?>
<?php }?>
</div>

View File

@ -639,6 +639,26 @@ class Ciblage
}
}
protected function bilAnnee($value)
{
if ( array_key_exists('in', $value) ) {
$this->setFilter('bilAnnee', $value['in']);
}
if ( array_key_exists('ex', $value) ) {
$this->setFilter('bilAnnee', $value['ex'], true);
}
}
protected function bilCloture($value)
{
if ( array_key_exists('in', $value) ) {
$this->setFilter('bilCloture', $value['in']);
}
if ( array_key_exists('ex', $value) ) {
$this->setFilter('bilCloture', $value['ex'], true);
}
}
protected function bilDuree($value)
{
if ( array_key_exists('in', $value) ) {

View File

@ -621,7 +621,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
'bilAnnee' => array(
'label' => 'Dernière année de bilan',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
'interval' => array('value' => array('0', '3000'))
),
'famille' => 'financier',
'activated' => true,
@ -630,7 +630,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
'bilCloture' => array(
'label' => 'Dernière date de clôture du bilan',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
'interval' => array('value' => array('0', '3000'))
),
'famille' => 'financier',
'activated' => true,

View File

@ -0,0 +1,135 @@
.pagination {
float: left;
border: 1px solid #CDCDCD;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
.pagination a {
display: block;
float: left;
height: 20px;
width: 20px;
background-color: rgb(0,50,75);
color: #555555;
text-align: center;
text-decoration: none;
font-family: Times, 'Times New Roman', Georgia, Palatino; /* ATTN: need a better font stack */
font-weight: bold;
font-size: 16px;
outline: none;
vertical-align: middle;
background: #F3F3F3; /* Old browsers */
background: -moz-linear-gradient(top, #F3F3F3 0%, #D3D3D3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F3F3F3), color-stop(100%,#D3D3D3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #F3F3F3 0%,#D3D3D3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #F3F3F3 0%,#D3D3D3 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #F3F3F3 0%,#D3D3D3 100%); /* IE10+ */
background: linear-gradient(top, #F3F3F3 0%,#D3D3D3 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F3F3F3', endColorstr='#D3D3D3',GradientType=0 ); /* IE6-9 */
}
.pagination a:hover, .pagination a:focus, .pagination a:active {
background: #CECECE; /* Old browsers */
background: -moz-linear-gradient(top, #E4E4E4 0%, #CECECE 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#E4E4E4), color-stop(100%,#CECECE)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #E4E4E4 0%,#CECECE 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #E4E4E4 0%,#CECECE 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #E4E4E4 0%,#CECECE 100%); /* IE10+ */
background: linear-gradient(top, #E4E4E4 0%,#CECECE 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#E4E4E4', endColorstr='#CECECE',GradientType=0 ); /* IE6-9 */
}
.pagination a.disabled, .pagination a.disabled:hover, .pagination a.disabled:focus, .pagination a.disabled:active {
background: #F3F3F3; /* Old browsers */
background: -moz-linear-gradient(top, #F3F3F3 0%, #D3D3D3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F3F3F3), color-stop(100%,#D3D3D3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #F3F3F3 0%,#D3D3D3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #F3F3F3 0%,#D3D3D3 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #F3F3F3 0%,#D3D3D3 100%); /* IE10+ */
background: linear-gradient(top, #F3F3F3 0%,#D3D3D3 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F3F3F3', endColorstr='#D3D3D3',GradientType=0 ); /* IE6-9 */
color: #A8A8A8;
}
.pagination a:first-child {
border-radius: 2px 0 0 2px;
-moz-border-radius: 2px 0 0 2px;
-webkit-border-radius: 2px 0 0 2px;
}
.pagination a:last-child {
border-radius: 0 2px 2px 0;
-moz-border-radius: 0 2px 2px 0;
-webkit-border-radius: 0 2px 2px 0;
}
.pagination a {
border-right: 1px solid #CDCDCD;
border-left: 1px solid #CDCDCD;
}
.pagination a:first-child {
border: none;
}
.pagination a:last-child {
border: none;
}
.pagination input {
border: none;
float: left;
text-align: center;
height: 20px;
outline: none;
vertical-align: middle;
width: 120px;
padding: 0;
margin: 0;
}
/* gigantic class for demo purposes */
.gigantic.pagination {
margin: 30px 0;
}
.gigantic.pagination a {
height: 60px;
width: 60px;
font-size: 50px;
line-height: 50px;
}
.gigantic.pagination input {
width: 300px;
height: 60px;
font-size: 30px;
}
/* log element for demo purposes */
.log {
display: none;
background-color: #EDEDED;
border: 1px solid #B4B4B4;
height: 300px;
width: 524px;
overflow: auto;
margin-left: 0;
list-style: none;
padding: 10px;
li {
margin-top: 0;
margin-bottom: 5px;
}
}

View File

@ -0,0 +1,21 @@
/*!
* jqPagination, a jQuery pagination plugin (obviously)
*
* Copyright (C) 2011 Ben Everard
*
* http://beneverard.github.com/jqPagination
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/(function(e){"use strict";e.jqPagination=function(t,n){var r=this;r.$el=e(t);r.el=t;r.$input=r.$el.find("input");r.$el.data("jqPagination",r);r.init=function(){r.options=e.extend({},e.jqPagination.defaultOptions,n);r.options.max_page===null&&(r.$input.data("max-page")!==undefined?r.options.max_page=r.$input.data("max-page"):r.options.max_page=1);r.$input.data("current-page")!==undefined&&r.isNumber(r.$input.data("current-page"))&&(r.options.current_page=r.$input.data("current-page"));r.$input.removeAttr("readonly");r.updateInput(!0);r.$input.on("focus.jqPagination mouseup.jqPagination",function(t){if(t.type==="focus"){var n=parseInt(r.options.current_page,10);e(this).val(n).select()}if(t.type==="mouseup")return!1});r.$input.on("blur.jqPagination keydown.jqPagination",function(t){var n=e(this),i=parseInt(r.options.current_page,10);if(t.keyCode===27){n.val(i);n.blur()}t.keyCode===13&&n.blur();t.type==="blur"&&r.setPage(n.val())});r.$el.on("click.jqPagination","a",function(t){var n=e(this);if(n.hasClass("disabled"))return!1;if(!t.metaKey&&!t.ctrlKey){t.preventDefault();r.setPage(n.data("action"))}})};r.setPage=function(e){if(e===undefined)return r.options.current_page;var t=parseInt(r.options.current_page,10),n=parseInt(r.options.max_page,10);if(isNaN(parseInt(e,10)))switch(e){case"first":e=1;break;case"prev":case"previous":e=t-1;break;case"next":e=t+1;break;case"last":e=n}e=parseInt(e,10);if(isNaN(e)||e<1||e>n||e===t){r.setInputValue(t);return!1}r.options.current_page=e;r.$input.data("current-page",e);r.updateInput()};r.setMaxPage=function(e){if(e===undefined)return r.options.max_page;if(!r.isNumber(e)){console.error("jqPagination: max_page is not a number");return!1}if(e<r.options.current_page){console.error("jqPagination: max_page lower than current_page");return!1}r.options.max_page=e;r.$input.data("max-page",e);r.updateInput()};r.updateInput=function(e){var t=parseInt(r.options.current_page,10);r.setInputValue(t);r.setLinks(t);e!==!0&&r.options.paged(t)};r.setInputValue=function(e){var t=r.options.page_string,n=r.options.max_page;t=t.replace("{current_page}",e).replace("{max_page}",n);r.$input.val(t)};r.isNumber=function(e){return!isNaN(parseFloat(e))&&isFinite(e)};r.setLinks=function(e){var t=r.options.link_string,n=parseInt(r.options.current_page,10),i=parseInt(r.options.max_page,10);if(t!==""){var s=n-1;s<1&&(s=1);var o=n+1;o>i&&(o=i);r.$el.find("a.first").attr("href",t.replace("{page_number}","1"));r.$el.find("a.prev, a.previous").attr("href",t.replace("{page_number}",s));r.$el.find("a.next").attr("href",t.replace("{page_number}",o));r.$el.find("a.last").attr("href",t.replace("{page_number}",i))}r.$el.find("a").removeClass("disabled");n===i&&r.$el.find(".next, .last").addClass("disabled");n===1&&r.$el.find(".previous, .first").addClass("disabled")};r.callMethod=function(e,t,n){switch(e.toLowerCase()){case"option":switch(t.toLowerCase()){case"current_page":return r.setPage(n);case"max_page":return r.setMaxPage(n)}console.error("jqPagination: cannot get / set option "+t);return!1;case"destroy":r.$el.off(".jqPagination").find("*").off(".jqPagination");break;default:console.error('jqPagination: method "'+e+'" does not exist');return!1}};r.init()};e.jqPagination.defaultOptions={current_page:1,link_string:"",max_page:null,page_string:"Page {current_page} of {max_page}",paged:function(){}};e.fn.jqPagination=function(){var t=this,n=Array.prototype.slice.call(arguments);if(typeof n[0]=="string"){t.length>1&&(t=t.eq(0));var r=e(t).data("jqPagination");return r.callMethod(n[0],n[1],n[2])}t.each(function(){new e.jqPagination(this,n[0])})}})(jQuery);if(!console){var console={},func=function(){return!1};console.log=func;console.info=func;console.warn=func;console.error=func};

View File

@ -88,7 +88,7 @@ foreach($keys as $key) {
//Lecture
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM jo.etablissements_act';
$stmt = $dbMetier->query($sql);
$stmt = $db->query($sql);
$result = $stmt->fetchObject();
//Insertion