Skip to content
Snippets Groups Projects
Commit 1d8510bf authored by Ghislain Loas's avatar Ghislain Loas
Browse files

migrate user-controller to full plugin manager

parent f3141033
Branches
Tags
5 merge requests!2080Sandbox detach zf from storm,!2061Master,!1989Dev#45275 3155 contractuel application nouvelle methode d edition par lot des articles aux collections,!1968full plugin mod for multiselection,!1959Dev#45275 3155 contractuel application nouvelle methode d edition par lot des articles aux collections
Pipeline #128 failed with stage
in 8 minutes and 40 seconds
......@@ -21,6 +21,11 @@
class Admin_UsersController extends ZendAfi_Controller_Action {
public function getPlugins() {
return ['ZendAfi_Controller_Plugin_Manager_User'];
}
public function getRessourceDefinitions() {
return ['model' => ['class' => 'Class_Users',
'name' => 'user',
......@@ -44,37 +49,6 @@ class Admin_UsersController extends ZendAfi_Controller_Action {
}
protected function _getPost() {
$post = $this->_request->getPost();
$post['user_groups'] = array_filter(
array_map(function($id) { return Class_UserGroup::find((int)$id);},
explode('-', $this->_getParam('user_group_ids','')))
);
unset($post['id_categories']);
return $post;
}
protected function _getFormValues($model) {
$array_model=parent::_getFormValues($model);
$array_model['user_group_ids']=implode('-',array_map(function($group) { return $group->getId();},$model->getUserGroups()));
return $array_model;
}
protected function _setupFormAndSave($model) {
if ($this->_request->isPost())
$model->updateSIGBOnSave();
try {
return parent::_setupFormAndSave($model);
} catch (Exception $e) {
$this->_helper->notify($e->getMessage());
}
}
public function changeAdminSkinAction() {
......
<?php
/**
* Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_Controller_Plugin_Manager_User extends ZendAfi_Controller_Plugin_Manager_Manager {
protected function _getPost() {
$post = $this->_request->getPost();
$post['user_groups'] = array_filter(
array_map(function($id) { return Class_UserGroup::find((int)$id);},
explode('-', $this->_getParam('user_group_ids','')))
);
unset($post['id_categories']);
return $post;
}
protected function _getFormValues($model) {
$array_model=parent::_getFormValues($model);
$array_model['user_group_ids']=implode('-',array_map(function($group) { return $group->getId();},$model->getUserGroups()));
return $array_model;
}
protected function _setupFormAndSave($model) {
if ($this->_request->isPost())
$model->updateSIGBOnSave();
try {
return parent::_setupFormAndSave($model);
} catch (Exception $e) {
$this->_helper->notify($e->getMessage());
}
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment