]> _ Git - ccgm.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 9 Dec 2013 10:34:33 +0000 (10:34 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 9 Dec 2013 10:34:33 +0000 (10:34 +0000)
12 files changed:
framework/application/Bootstrap.php
framework/application/configs/application.ini
framework/application/controllers/AjaxController.php
framework/application/controllers/IndexController.php
framework/application/controllers/MaintenanceController.php
framework/application/forms/Askintranet.php
framework/application/forms/Askmedecin.php [new file with mode: 0644]
framework/application/forms/CMS/Intranetident.php
framework/application/forms/CMS/Medecinsident.php
framework/application/forms/LoginMedecins.php [new file with mode: 0644]
framework/application/views/scripts/templates/medecinsident.phtml
less/intranetident.less

index c8d254e361aa7159db673bf354a978ed86e7b23c..2e97844641ec27576c73fc6c64fd244fd346798a 100644 (file)
@@ -14,6 +14,17 @@ class Bootstrap extends CubeIT_Bootstrap {
                return $router;
        }
 
+       protected function _initSession() {
+               $session = parent::_initSession();
+               if (!isset($session->medecin)) {
+                       $session->medecin = false;
+               }
+               if (!isset($session->personnel)) {
+                       $session->personnel = false;
+               }
+               return $session;
+       }
+
        /**
         * 
         * @param \Doctrine\DBAL\Schema\Schema  $schema
@@ -33,8 +44,9 @@ class Bootstrap extends CubeIT_Bootstrap {
 
        protected function _initAcl() {
                $acl = parent::_initAcl();
-               $acl->addRole('medecin');
-               $acl->addRole('personnel');
+               $acl->addRole('personnel', 'guest');
+               $acl->addRole('medecin', 'guest');
+
 
                $acl->addResource('medecin');
                $acl->addResource('personnel');
@@ -68,6 +80,7 @@ class Bootstrap extends CubeIT_Bootstrap {
                        'rendezvous' => 'Demande de rendez-vous');
                $templates['Intranet'] = array('intranetident' => 'Identification',
                        'intranet' => 'Comptes rendus, actualités');
+               $templates['Médecins'] = array('medecinsident' => 'Identification');
                $templates['Redirections'] = array(
                        'externalredirection' => 'Redirection externe',
                        'nextredirection' => 'Redirection vers la première sous-rubrique',
index 40781655a19715086f3f447bb6ecc1a1418227f8..9f085fd18623388cf2228098cc58312e97203c40 100644 (file)
@@ -62,9 +62,6 @@ webhost = medecins.ccgm.fr
 seo.robots=false
 seo.universalAnalytics = UA-42799235-2
 
-httpauth.username = ccgm
-httpauth.password = 20ccgm13
-
 [testing : production]
 dev = true
 
index 0b30adf65d3d3d5af200524deec6eac49c7a3d75..595b6ec14839388787fdbbcc0e5b8b05c6fed7a8 100644 (file)
@@ -12,15 +12,27 @@ class AjaxController extends CubeIT_Controller_AjaxController {
                }
        }
 
+       public function loginmedecin() {
+               if ($this->isAllowed('medecin')) {
+                       $this->getSession()->medecin = true;
+                       $this->_datas->addReload();
+               } else {
+                       $this->_datas->addError('user');
+                       $this->_datas->addError('password');
+               }
+       }
+
        public function askintranet() {
+
                $form = new CCGM_Form_Askintranet();
                $form->setDefaults($_POST);
                if ($form->isValid($_POST)) {
+                       $datas = $this->getCMSDatasOfPage($form->getValue('currentPage'));
                        $this->_datas->addContent($form->getId(), '<p>Votre demande a bien été envoyée.</p>');
 
                        $mail = new CubeIT_Mail();
                        $mail->setFrom('intranet@ccgm.fr');
-                       $mail->addTo('test@cubedesigners.com');
+                       $mail->addTo($datas['destinataire']);
                        $mail->setSubject('[CCGM.fr] Demande d\'accès intranet');
                        $mail->setBodyText('Email du demandeur : ' . $form->getValue('email'));
                        $mail->send(new CubeIT_Mail_Transport_Mailjet());
@@ -29,6 +41,32 @@ class AjaxController extends CubeIT_Controller_AjaxController {
                }
        }
 
+       public function askmedecin() {
+               $form = new CCGM_Form_Askmedecin();
+               $form->setDefaults($_POST);
+               if ($form->isValid($_POST)) {
+                       $datas = $this->getCMSDatasOfPage($form->getValue('currentPage'));
+                       $this->_datas->addContent($form->getId(), '<p>Votre demande a bien été envoyée.</p>');
+
+                       $mail = new CubeIT_Mail();
+                       $mail->setFrom('medecins@ccgm.fr');
+                       $mail->addTo($datas['destinataire']);
+                       $mail->setSubject('[CCGM.fr] Demande d\'accès médecin');
+
+                       $body = '';
+
+                       $fields = array('nom' => 'Nom', 'prenom' => 'Prénom', 'lieu' => 'Lieu d\'exercice', 'email' => 'Adresse e-mail', 'telephone' => 'Téléphone');
+                       foreach ($fields as $f => $label) {
+                               $body.=$label . ' : ' . $form->getValue($f) . "\n";
+                       }
+
+                       $mail->setBodyText($body);
+                       $mail->send(new CubeIT_Mail_Transport_Mailjet());
+               } else {
+                       $this->_datas->refreshForm($form);
+               }
+       }
+
        public function rdv() {
                $data = $this->getCMSDatasOfPage($_POST['page']);
                $form = new CCGM_Form_Rendezvous();
index 684605073a8db02e38e918f6acfd1badcdc97774..1c01282cccf0a9a015549a919e9e3836eb1bc160 100644 (file)
@@ -8,7 +8,18 @@ class IndexController extends CubeIT_Controller_IndexController {
 
                $res = parent::pageAction();
 
-               if ($this->_currentPage->getTemplate() == 'intranetident') {
+               if ($this->getBootstrap()->getEnvironment() == 'medecins') {
+                       $session = $this->getSession();
+                       if (!isset($session->medecin) || !$session->medecin) {
+                               $this->redirect('http://www.ccgm.fr/Acces-medecin-externe');
+                       }
+               }
+
+               if ($this->_currentPage->getTemplate() == 'medecinsident') {
+                       if ($this->getSession()->medecin) {
+                               $this->redirect('http://medecins.ccgm.fr');
+                       }
+               } elseif ($this->_currentPage->getTemplate() == 'intranetident') {
                        if ($this->getSession()->intranet) {
                                $fc = $this->_currentPage->getFirstChild();
                                if (!is_null($fc)) {
@@ -16,7 +27,6 @@ class IndexController extends CubeIT_Controller_IndexController {
                                }
                        }
                } else if ($ident = $this->_currentPage->findInParents('template', 'intranetident')) {
-                       fb($ident);
                        if (!$this->getSession()->intranet) {
                                $this->redirect($ident->getHref());
                        }
index 24e83544946abc7f45b53584b3bfb9fe5712b133..9f5bb6c3050a5abbc8883d973bb5eb5e0213dcce 100644 (file)
@@ -1,6 +1,4 @@
 <?php
 
 class MaintenanceController extends CubeIT_Controller_MaintenanceController {
-}
-
-?>
+}
\ No newline at end of file
index a3c03562182e2f05fff84863625bd55e8a919338..eabfa83a951e30f6e7e0ab9cab06bd3c3bdab0c5 100644 (file)
@@ -12,6 +12,9 @@ class CCGM_Form_Askintranet extends CubeIT_Form {
                $validator = new Zend_Validate_EmailAddress();
                $validator->setMessage('E-mail invalide');
 
+               $page=new CubeIT_Form_Element_CurrentCMSPage('currentPage');
+               $this->addElement($page);
+               
                $email = new CubeIT_Form_Element_Email('email');
                $email->setAttrib('placeholder', 'Adresse e-mail');
                $email->setRequired();
@@ -22,6 +25,4 @@ class CCGM_Form_Askintranet extends CubeIT_Form {
                $this->addElement($submit);
        }
 
-}
-
-?>
+}
\ No newline at end of file
diff --git a/framework/application/forms/Askmedecin.php b/framework/application/forms/Askmedecin.php
new file mode 100644 (file)
index 0000000..41767d2
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+class CCGM_Form_Askmedecin extends CubeIT_Form {
+
+       public function init() {
+               parent::init();
+               $this->setId('askmedecin')
+                               ->setLegend('Demander un accès')
+                               ->setAjax()
+                               ->setAction('/ajax/askmedecin');
+
+               $evalidator = new Zend_Validate_EmailAddress();
+               $notempty = new Zend_Validate_NotEmpty();
+
+
+               $page = new CubeIT_Form_Element_CurrentCMSPage('currentPage');
+               $this->addElement($page);
+
+               $prenom = new Zend_Form_Element_Text('prenom');
+               $prenom->setAttrib('placeholder', 'Prénom');
+               $prenom->setRequired();
+               $prenom->addValidator($notempty);
+               $this->addElement($prenom);
+
+               $nom = new Zend_Form_Element_Text('nom');
+               $nom->setAttrib('placeholder', 'Nom');
+               $nom->setRequired();
+               $nom->addValidator($notempty);
+               $this->addElement($nom);
+
+               $lieu = new Zend_Form_Element_Text('lieu');
+               $lieu->setAttrib('placeholder', 'Lieu d\'exercice');
+               $lieu->setRequired();
+               $lieu->addValidator($notempty);
+               $this->addElement($lieu);
+
+               $email = new CubeIT_Form_Element_Email('email');
+               $email->setAttrib('placeholder', 'Adresse e-mail');
+               $email->setRequired();
+               $email->addValidator($evalidator);
+               $this->addElement($email);
+
+               $telephone = new CubeIT_Form_Element_Phone('telephone');
+               $telephone->setAttrib('placeholder', 'Téléphone');
+               $telephone->setRequired();
+               $telephone->addValidator($notempty);
+               $this->addElement($telephone);
+
+               $submit = new Zend_Form_Element_Submit('submit');
+               $this->addElement($submit);
+       }
+
+}
\ No newline at end of file
index d10f2a225b2d970c871a5abf1918e43f34105574..e3146559c98b5689d30a7afabc9dbe75dc63b61e 100644 (file)
@@ -4,11 +4,13 @@ class CCGM_Form_CMS_Intranetident extends CCGM_Form_CMS_Text {
 
        public function init() {
                parent::init();
-               
+
                $this->removeSubForm('sidebar');
                $this->getElement('text')->setAttrib('rows', 3);
-       }
 
-}
+               $destinataire = new CubeIT_Form_Element_Email('destinataire');
+               $destinataire->setLabel('Destinataire des demandes');
+               $this->addElement($destinataire);
+       }
 
-?>
+}
\ No newline at end of file
index 14e0d58857d8384c101c1b351114e2150ec17965..4c0a5241c934793b2e8ba9514419bf9757a3c0db 100644 (file)
@@ -4,6 +4,4 @@ class CCGM_Form_CMS_Medecinsident extends CCGM_Form_CMS_Intranetident{
        public function init() {
                parent::init();
        }
-}
-
-?>
+}
\ No newline at end of file
diff --git a/framework/application/forms/LoginMedecins.php b/framework/application/forms/LoginMedecins.php
new file mode 100644 (file)
index 0000000..028f951
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+class CCGM_Form_LoginMedecins extends CubeIT_Form {
+
+       public function init() {
+               parent::init();
+               $this->setLegend('Connexion')
+                               ->setId('loginmedecin')
+                               ->setAjax()
+                               ->setAction('/ajax/loginmedecin');
+
+               $login = new Zend_Form_Element_Hidden('login');
+               $login->setValue(1);
+               $this->addElement($login);
+
+               $email = new CubeIT_Form_Element_Email('user');
+               $email->setAttrib('placeholder', 'Adresse e-mail');
+               $this->addElement($email);
+
+               $password = new Zend_Form_Element_Password('password');
+               $password->setAttrib('placeholder', 'Mot de passe');
+               $this->addElement($password);
+
+               $forgot = new CubeIT_Form_Element_Html('forgot');
+               $forgot->setLabel('<a href="/ajaxpopup/forgot" class="popup">Mot de passe oublié ?</a>');
+               //$this->addElement($forgot);
+
+               $submit = new Zend_Form_Element_Submit('submit');
+               $this->addElement($submit);
+       }
+
+}
+
+?>
index 3fceb7bc9c909daf31f0bf3f68cfbf5173b5a46f..515e27be77dd9f8e0cda255b6bbacac0b2ad6b0f 100644 (file)
@@ -17,7 +17,7 @@ $this->showsidebar = false;
                echo '<div class="form fright">';
                $form = new CCGM_Form_Askmedecin();
                echo '<h3>' . $form->getLegend() . '</h3>';
-               echo '<p>Veuillez indiquer votre e-mail ci-dessous, nous vous enverrons vos paramètres d’accès dans les plus brefs délais.</p>';
+               echo '<p>Pour accéder à cet espace, veuillez remplir le formulaire ci-dessous.</p>';
                echo $form;
                echo '</div>';
 
index e1d0cb84231eea624a41dc89c311350436d4c630..e483542d44dd577a7f0024aef942cc3a75007629 100644 (file)
@@ -4,7 +4,7 @@
        .forms{
                .form{
                        padding:0 45px;
-                       height:154px;
+                       min-height:154px;
                        display:inline-block;
                        box-sizing:border-box;