Affichage des profils
This commit is contained in:
parent
a2c26500ea
commit
ad36ad7f1e
@ -46,5 +46,18 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
|
||||
}
|
||||
|
||||
protected function _initCache()
|
||||
{
|
||||
//MetadataCache pour la base de données
|
||||
$frontendOptions = array(
|
||||
'lifetime' => 14400,
|
||||
'automatic_serialization' => true
|
||||
);
|
||||
$backendOptions = array();
|
||||
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
|
||||
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
|
||||
//Cache pour les données de la base à stocker
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,13 @@ class ProfilController extends Zend_Controller_Action
|
||||
if ( $id != null ) {
|
||||
$profilM = new Application_Model_Profil();
|
||||
$profil = $profilM->find($id);
|
||||
}
|
||||
|
||||
$criteres = json_decode($profil->current()->criteres, true);
|
||||
$tmp = array();
|
||||
foreach ($criteres as $critere) {
|
||||
$tmp[] = $data->getDicoLib($critere);
|
||||
}
|
||||
$this->view->assign('profil', $tmp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,125 +1,7 @@
|
||||
<style>
|
||||
div#entete {
|
||||
width:45%;
|
||||
float:left;
|
||||
border:1px solid #bebebe;
|
||||
height:400px;
|
||||
overflow:auto;
|
||||
margin:5px 0;
|
||||
}
|
||||
|
||||
div#entete li {
|
||||
background-color:#4D90FE;
|
||||
border-top:2px solid #ffffff;
|
||||
border-bottom:2px solid #ffffff;
|
||||
line-height:20px;
|
||||
font-weight:bold;
|
||||
color:#000000;
|
||||
margin-left:30px;
|
||||
padding-left:10px;
|
||||
}
|
||||
|
||||
div#dico {
|
||||
width:45%;
|
||||
height:400px;
|
||||
float:right;
|
||||
border:1px solid #bebebe;
|
||||
overflow:auto;
|
||||
margin:5px 0;
|
||||
}
|
||||
|
||||
div#dico li {
|
||||
list-style-type:none;
|
||||
padding-left:10px;
|
||||
background-color:#4D90FE;
|
||||
border-top:2px solid #ffffff;
|
||||
border-bottom:2px solid #ffffff;
|
||||
line-height:20px;
|
||||
font-weight:bold;
|
||||
color:#000000;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="entete">
|
||||
<h1 class="ui-widget-header">Entete</h1>
|
||||
<div class="ui-widget-content">
|
||||
<ol>
|
||||
<span class="placeholder">Placer les elements ici</span>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="dico">
|
||||
<h1 class="ui-widget-header">Elements disponibles</h1>
|
||||
<ul>
|
||||
<?php foreach($this->elements as $key => $element) {?>
|
||||
<li id="<?=$key?>">
|
||||
<?php if (isset($element['lib'])) { echo $element['lib']; } else { echo $key; }?>
|
||||
<?php if (isset($element['values'])) { echo "<input type=\"text\" name=\"".$key."\" value=\"\"/>"; }?>
|
||||
</li>
|
||||
<div>
|
||||
<ol>
|
||||
<?php foreach ($this->profil as $item) {?>
|
||||
<li><?=$item?></li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div style="clear:both;">
|
||||
Référence <input type="text" name="profil" value="" />
|
||||
<a id="save" href="<?=$this->url(array('controller'=>'profil', 'action'=>'save'))?>">Sauvegarder</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#dico li").draggable({
|
||||
appendTo: "body",
|
||||
helper: "clone"
|
||||
});
|
||||
$("#entete ol").droppable({
|
||||
activeClass: "ui-state-default",
|
||||
hoverClass: "ui-state-hover",
|
||||
accept: ":not(.ui-sortable-helper)",
|
||||
drop: function( event, ui ) {
|
||||
$( this ).find( ".placeholder" ).remove();
|
||||
var id = ui.draggable.attr('id');
|
||||
$('<li id="'+id+'"></li>').html( ui.draggable.html() ).appendTo( this );
|
||||
}
|
||||
}).sortable({
|
||||
items: "li:not(.placeholder)",
|
||||
sort: function() {
|
||||
$( this ).removeClass( "ui-state-default" );
|
||||
}
|
||||
});
|
||||
|
||||
$("#entete").delegate("a.delete","click", function(){
|
||||
$(this).parent().remove();
|
||||
});
|
||||
|
||||
$("#entete ol").delegate("li" , "hover", function(e) {
|
||||
if (e.type === 'mouseenter') {
|
||||
var html = $(this).html();
|
||||
$(this).html(html+'<a href="#" class="delete">Supprimer</a>');
|
||||
} else {
|
||||
$( this ).find( ".delete" ).remove();
|
||||
}
|
||||
});
|
||||
|
||||
$('#save').click(function(e){
|
||||
e.preventDefault();
|
||||
var url = $(this).attr('href');
|
||||
var list = new Array();
|
||||
$('#entete ol li').each(function(index){
|
||||
var id = $(this).attr('id');
|
||||
if($('input[name='+id+']', this).length>0){
|
||||
id = id + '(' + $('input[name='+id+']', this).val() + ')';
|
||||
}
|
||||
list.push(id);
|
||||
});
|
||||
var ref = $('input[name=profil]').val();
|
||||
if (ref!='') {
|
||||
$.post(url, { reference: ref, criteres: list }, function(data){
|
||||
if (data!='Erreur'){ window.location.href = '/'; }
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</ol>
|
||||
</div>
|
@ -11,7 +11,7 @@
|
||||
<tbody>
|
||||
<?php foreach($this->profils as $profil) {?>
|
||||
<tr>
|
||||
<td><?=$profil->reference?></td>
|
||||
<td><a href="<?=$this->url(array('controller'=>'profil', 'action'=>'detail', 'id'=>$profil->id))?>"><?=$profil->reference?></a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
|
Loading…
Reference in New Issue
Block a user