Modification du mode edition en ajax
This commit is contained in:
parent
b808d85063
commit
d819567d59
@ -391,5 +391,30 @@ class UserController extends Zend_Controller_Action
|
||||
$this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url);
|
||||
$this->render('logout');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mettre à jour le mode edition en session sans refresh de la page
|
||||
*/
|
||||
public function editionsessionAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$request = $this->getRequest();
|
||||
$mode = $request->getParam('mode', 'false');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
if ($identity->idClient == 1) {
|
||||
if ($mode == 'false') {
|
||||
$identity->modeEdition = false;
|
||||
echo 0;
|
||||
} else {
|
||||
$identity->modeEdition = true;
|
||||
echo 1;
|
||||
}
|
||||
$auth->getStorage()->write($identity);
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -201,6 +201,7 @@ if ( $this->options->modeEdition==true ) {
|
||||
}
|
||||
?>
|
||||
<input type="checkbox" name="modeEdition" value="1"<?=$check?> class="noborder"/>
|
||||
<span id="msgModeEdition"></span>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
|
@ -27,4 +27,21 @@ $(document).ready(function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
$('input[name=modeEdition]').click(function(e){
|
||||
var mode = $(this).is(':checked');
|
||||
var bouton = $('input[type=submit]');
|
||||
bouton.attr('disabled', true);
|
||||
$('#msgModeEdition').text('Mise à jour en cours.');
|
||||
$.post('/user/editionsession', { mode: mode}, function(data, status){
|
||||
if (data=='0'){
|
||||
$('input[name=modeEdition]').attr('checked',false);
|
||||
} else if (data=='1'){
|
||||
$('input[name=modeEdition]').attr('checked',true);
|
||||
}
|
||||
});
|
||||
$('#msgModeEdition').text('Mode Edition modifier en session.');
|
||||
bouton.removeAttr('disabled');
|
||||
});
|
||||
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user