From e130a76dd69737c9d56054585fcdd3fd8e2399f1 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Fri, 27 May 2016 10:09:01 +0200 Subject: [PATCH] Module admin --- .../admin/controllers/ServiceController.php | 4 +- .../admin/controllers/UserController.php | 60 +++++++++++- .../views/default/scripts/service/index.phtml | 2 +- .../views/default/scripts/user/detail.phtml | 11 +++ .../views/default/scripts/user/form.phtml | 94 +++++++++++++++++++ .../views/default/scripts/user/index.phtml | 55 +++++++++++ 6 files changed, 220 insertions(+), 6 deletions(-) create mode 100644 application/modules/admin/views/default/scripts/user/detail.phtml create mode 100644 application/modules/admin/views/default/scripts/user/form.phtml create mode 100644 application/modules/admin/views/default/scripts/user/index.phtml diff --git a/application/modules/admin/controllers/ServiceController.php b/application/modules/admin/controllers/ServiceController.php index b18c10f1c..1c5b8ae76 100644 --- a/application/modules/admin/controllers/ServiceController.php +++ b/application/modules/admin/controllers/ServiceController.php @@ -11,11 +11,11 @@ class Admin_ServiceController extends Zend_Controller_Action public function detailAction() { $request = $this->getRequest(); - $id = $request->getParam('id'); + $code = $request->getParam('code'); $ws = new Scores_Ws_Client('gestion', '0.4'); $params = new stdClass(); - $params->id = $id; + $params->code = $code; $responses = $ws->getService($params); $this->view->Info = $responses; diff --git a/application/modules/admin/controllers/UserController.php b/application/modules/admin/controllers/UserController.php index 29645bf81..055e1dd9b 100644 --- a/application/modules/admin/controllers/UserController.php +++ b/application/modules/admin/controllers/UserController.php @@ -1,7 +1,61 @@ getRequest(); + $code = $request->getParam('code'); + + // Get Service Name + // Ne pas créer d'utilisateur lorsque Service Editable = 0 + $ws = new Scores_Ws_Client('gestion', '0.4'); + $params = new stdClass(); + $params->code = $code; + $serviceResponse = $ws->getService($params); + $this->view->Service = $serviceResponse; + + // Get Users + $ws = new Scores_Ws_Client('gestion', '0.4'); + $params = new stdClass(); + $params->actif = 1; + $params->service = $code; + $responses = $ws->getUserList($params); + $this->view->List = $responses->item; + } + + public function detailAction(){} + + public function formAction() + { + $request = $this->getRequest(); + + if ( $request->isPost() ) { + $this->view->FormIsPost = true; + $this->_helper->layout()->disableLayout(); + + $data = array(); + $data['status'] = 0; + + $values = $request->getPost(); + + if ( $values['id']===null ) { + $data['dateInsert'] = date('Y-m-d H:i:s'); + try { + + $data['status'] = 1; + $data['login'] = $values['login']; + $data['email'] = $values['email']; + $data['civilite'] = $values['civilite']; + $data['nom'] = $values['nom']; + $data['prenom'] = $values['prenom']; + } catch(Zend_Db_Exception $e) { + $data['status'] = 0; + $data['msg'] = "Erreur lors de la création de l'utilisateur ! ".$e->getMessage(); + } + } + + $this->view->data = $data; + } + + } } \ No newline at end of file diff --git a/application/modules/admin/views/default/scripts/service/index.phtml b/application/modules/admin/views/default/scripts/service/index.phtml index d3b9b1c25..5460cb0ea 100644 --- a/application/modules/admin/views/default/scripts/service/index.phtml +++ b/application/modules/admin/views/default/scripts/service/index.phtml @@ -28,7 +28,7 @@ if ($l->Editable == 0) { $class = ''; } ?> aria-expanded="false">Action