From: vincent@cubedesigners.com Date: Mon, 9 Dec 2013 10:34:33 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=dd190b7cd383ce5527eaf1e2138dc14925527533;p=ccgm.git --- diff --git a/framework/application/Bootstrap.php b/framework/application/Bootstrap.php index c8d254e..2e97844 100644 --- a/framework/application/Bootstrap.php +++ b/framework/application/Bootstrap.php @@ -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', diff --git a/framework/application/configs/application.ini b/framework/application/configs/application.ini index 4078165..9f085fd 100644 --- a/framework/application/configs/application.ini +++ b/framework/application/configs/application.ini @@ -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 diff --git a/framework/application/controllers/AjaxController.php b/framework/application/controllers/AjaxController.php index 0b30adf..595b6ec 100644 --- a/framework/application/controllers/AjaxController.php +++ b/framework/application/controllers/AjaxController.php @@ -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(), '

Votre demande a bien été envoyée.

'); $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(), '

Votre demande a bien été envoyée.

'); + + $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(); diff --git a/framework/application/controllers/IndexController.php b/framework/application/controllers/IndexController.php index 6846050..1c01282 100644 --- a/framework/application/controllers/IndexController.php +++ b/framework/application/controllers/IndexController.php @@ -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()); } diff --git a/framework/application/controllers/MaintenanceController.php b/framework/application/controllers/MaintenanceController.php index 24e8354..9f5bb6c 100644 --- a/framework/application/controllers/MaintenanceController.php +++ b/framework/application/controllers/MaintenanceController.php @@ -1,6 +1,4 @@ +} \ No newline at end of file diff --git a/framework/application/forms/Askintranet.php b/framework/application/forms/Askintranet.php index a3c0356..eabfa83 100644 --- a/framework/application/forms/Askintranet.php +++ b/framework/application/forms/Askintranet.php @@ -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 index 0000000..41767d2 --- /dev/null +++ b/framework/application/forms/Askmedecin.php @@ -0,0 +1,53 @@ +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 diff --git a/framework/application/forms/CMS/Intranetident.php b/framework/application/forms/CMS/Intranetident.php index d10f2a2..e314655 100644 --- a/framework/application/forms/CMS/Intranetident.php +++ b/framework/application/forms/CMS/Intranetident.php @@ -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 diff --git a/framework/application/forms/CMS/Medecinsident.php b/framework/application/forms/CMS/Medecinsident.php index 14e0d58..4c0a524 100644 --- a/framework/application/forms/CMS/Medecinsident.php +++ b/framework/application/forms/CMS/Medecinsident.php @@ -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 index 0000000..028f951 --- /dev/null +++ b/framework/application/forms/LoginMedecins.php @@ -0,0 +1,34 @@ +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('Mot de passe oublié ?'); + //$this->addElement($forgot); + + $submit = new Zend_Form_Element_Submit('submit'); + $this->addElement($submit); + } + +} + +?> diff --git a/framework/application/views/scripts/templates/medecinsident.phtml b/framework/application/views/scripts/templates/medecinsident.phtml index 3fceb7b..515e27b 100644 --- a/framework/application/views/scripts/templates/medecinsident.phtml +++ b/framework/application/views/scripts/templates/medecinsident.phtml @@ -17,7 +17,7 @@ $this->showsidebar = false; echo '
'; $form = new CCGM_Form_Askmedecin(); echo '

' . $form->getLegend() . '

'; - echo '

Veuillez indiquer votre e-mail ci-dessous, nous vous enverrons vos paramètres d’accès dans les plus brefs délais.

'; + echo '

Pour accéder à cet espace, veuillez remplir le formulaire ci-dessous.

'; echo $form; echo '
'; diff --git a/less/intranetident.less b/less/intranetident.less index e1d0cb8..e483542 100644 --- a/less/intranetident.less +++ b/less/intranetident.less @@ -4,7 +4,7 @@ .forms{ .form{ padding:0 45px; - height:154px; + min-height:154px; display:inline-block; box-sizing:border-box;