From 728e25ed8dc836bab372de65014e7a943eca37ce Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 22 Nov 2013 09:27:58 +0000 Subject: [PATCH] --- framework/application/configs/application.ini | 4 +- .../controllers/AjaxController.php | 11 +- .../application/forms/CMS/Rendezvous.php | 20 +++ framework/application/forms/Rendezvous.php | 115 +++++++++++++++++ .../views/scripts/templates/rendezvous.phtml | 17 +++ .../views/scripts/templates/text.phtml | 4 +- images/radio.png | Bin 0 -> 1696 bytes less/common.less | 10 +- less/constants.less | 1 + less/rendezvous.less | 117 ++++++++++++++++++ 10 files changed, 294 insertions(+), 5 deletions(-) create mode 100644 framework/application/forms/CMS/Rendezvous.php create mode 100644 framework/application/forms/Rendezvous.php create mode 100644 images/radio.png create mode 100644 less/constants.less create mode 100644 less/rendezvous.less diff --git a/framework/application/configs/application.ini b/framework/application/configs/application.ini index 3a92dd0..c67c3e0 100644 --- a/framework/application/configs/application.ini +++ b/framework/application/configs/application.ini @@ -1,5 +1,5 @@ [production] -dev = false +dev = true minify.js = true minify.css = true @@ -17,7 +17,7 @@ appnamespace = "CCGM" timezone = 'Europe/Paris' session.lifetime = 31536000 ;1 year -session.adapter = mysql +session.adapter = cache webhost = www.ccgm.fr diff --git a/framework/application/controllers/AjaxController.php b/framework/application/controllers/AjaxController.php index 7cef670..981ceb1 100644 --- a/framework/application/controllers/AjaxController.php +++ b/framework/application/controllers/AjaxController.php @@ -2,7 +2,16 @@ class AjaxController extends CubeIT_Controller_AjaxController { - + public function rdv() { + $data = $this->getCMSDatasOfPage($_POST['page']); + $form = new CCGM_Form_Rendezvous(); + $form->setMedecins($data['medecins']); + if (!$form->isValid($_POST)) { + $this->_datas->refreshForm($form); + } else { + $this->_datas->addAlert('ok!'); + } + } } diff --git a/framework/application/forms/CMS/Rendezvous.php b/framework/application/forms/CMS/Rendezvous.php new file mode 100644 index 0000000..af3bf0b --- /dev/null +++ b/framework/application/forms/CMS/Rendezvous.php @@ -0,0 +1,20 @@ +getElement('text')->setAttrib('rows', 4); + + $medecins = new Zend_Form_Element_Textarea('medecins'); + $medecins->setLabel('Liste des médecins proposés pour la prise de rendez-vous'); + $medecins->setAttrib('rows', 10); + $this->addElement($medecins); + + $dest = new CubeIT_Form_Element_Email('destinataire'); + $dest->setLabel('E-mail destinataire de la demande'); + $this->addElement($dest); + } + +} diff --git a/framework/application/forms/Rendezvous.php b/framework/application/forms/Rendezvous.php new file mode 100644 index 0000000..5a30f12 --- /dev/null +++ b/framework/application/forms/Rendezvous.php @@ -0,0 +1,115 @@ +setId('formRDV') + ->setAjax() + ->setAction('/ajax/rdv'); + + $page = new Zend_Form_Element_Hidden('page'); + $this->addElement($page); + + $notempty = new Zend_Validate_NotEmpty(); + $notempty->setMessage('Ce champ ne peut être vide'); + + $datevalidator = new Zend_Validate_Regex('|\d{2}\/\d{2}\/\d{4}|'); + $datevalidator->setMessage('Format de date invalide'); + + $nom = new Zend_Form_Element_Text('nom'); + $nom->setLabel('Nom de naissance'); + $nom->setAttrib('placeholder', 'Nom de naissance *'); + $nom->setRequired(); + $nom->addValidator($notempty); + $this->addElement($nom); + + $nom_usage = new Zend_Form_Element_Text('nom_usage'); + $nom_usage->setLabel("Nom d'épouse (si applicable)"); + $nom_usage->setAttrib('placeholder', "Nom d'épouse (si applicable)"); + $this->addElement($nom_usage); + + $prenom = new Zend_Form_Element_Text('prenom'); + $prenom->setAttrib('placeholder', 'Prénom *'); + $prenom->setLabel('Prénom'); + $prenom->setRequired(); + $prenom->addValidator($notempty); + $this->addElement($prenom); + + $naissance = new Zend_Form_Element_Text('naissance'); + $naissance->setAttrib('placeholder', 'Date de naissance (JJ/MM/AAAA) *'); + $naissance->setLabel('Date de naissance'); + $naissance->addValidator($notempty); + $naissance->addValidator($datevalidator); + $naissance->setRequired(); + $this->addElement($naissance); + + $telephone = new CubeIT_Form_Element_Phone('telephone'); + $telephone->setAttrib('placeholder', 'Votre téléphone *'); + $telephone->setLabel('Votre téléphone'); + $telephone->addValidator($notempty); + + $telephone->setRequired(); + $this->addElement($telephone); + + $email = new CubeIT_Form_Element_Email('email'); + $email->setAttrib('placeholder', 'Votre email'); + $email->setLabel('Votre email'); + $this->addElement($email); + + $this->addDisplayGroup(array('nom', 'nom_usage', 'prenom', 'naissance', 'telephone', 'email'), 'perso'); + $group = $this->getDisplayGroup('perso'); + $group->setLegend('Vos coordonnées'); + + $type = new Zend_Form_Element_Radio('type'); + $type->setMultiOptions(array('premier' => 'Premier rendez-vous', 'suivi' => 'Consultation de suivi')); + $type->setValue('premier'); + $this->addElement($type); + + $medecin = new Zend_Form_Element_Select('medecin'); + $this->addElement($medecin); + + $motif = new Zend_Form_Element_Text('motif'); + $motif->setAttrib('placeholder', 'Motif'); + $this->addElement($motif); + + $this->addDisplayGroup(array('type', 'medecin', 'motif'), 'rdv'); + $group = $this->getDisplayGroup('rdv'); + $group->setLegend('Rendez-vous'); + + $date = new Zend_Form_Element_Text('date'); + $date->setAttrib('placeholder', 'Merci de noter plusieurs créneaux possibles'); + $date->addValidator($datevalidator); + $this->addElement($date); + + $info = new CubeIT_Form_Element_Html('info'); + $info->setLabel('

Les champs marqués * sont obligatoires.

Le secrétariat prendra contact avec vous pour vous communiquer dans les plus brefs délais la date et l’horaire de votre prochain rendez-vous.

'); + $this->addElement($info); + + $this->addDisplayGroup(array('date', 'info'), 'creneau'); + $group = $this->getDisplayGroup('creneau'); + $group->setLegend('Date et plage horaire'); + + $submit = new Zend_Form_Element_Submit('submit'); + $submit->setLabel('Envoyer'); + $this->addElement($submit); + } + + public function setMedecins($list) { + $e = explode("\n", $list); + $options = array('' => 'Médecin *'); + foreach ($e as $m) { + $m = trim($m); + if ($m == '') { + continue; + } + $options[$m] = $m; + } + + $this->getElement('medecin')->setMultiOptions($options); + } + +} + +?> diff --git a/framework/application/views/scripts/templates/rendezvous.phtml b/framework/application/views/scripts/templates/rendezvous.phtml index b3d9bbc..83f2173 100644 --- a/framework/application/views/scripts/templates/rendezvous.phtml +++ b/framework/application/views/scripts/templates/rendezvous.phtml @@ -1 +1,18 @@ headScript() + ->addPolyfill('placeholder') + ->addScriptAndStyle('rendezvous') + ->addCheckbox(); +?> +
+
+ markupDotclear($this->text); + $form = new CCGM_Form_Rendezvous(); + $form->getElement('page')->setValue($this->currentPage->getId()); + $form->setMedecins($this->medecins); + echo $form; + ?> +
+ rightbar() ?> +
\ No newline at end of file diff --git a/framework/application/views/scripts/templates/text.phtml b/framework/application/views/scripts/templates/text.phtml index ac63c8a..33716e7 100644 --- a/framework/application/views/scripts/templates/text.phtml +++ b/framework/application/views/scripts/templates/text.phtml @@ -1,6 +1,8 @@
- markupDotclear($this->text); ?> + markupDotclear($this->text); + ?>
rightbar() ?>
\ No newline at end of file diff --git a/images/radio.png b/images/radio.png new file mode 100644 index 0000000000000000000000000000000000000000..e0e724e0027e22c2335725022d192b275cb43e1d GIT binary patch literal 1696 zcmaJ?Yfuws6pfP-k&0TY^3Y+{Ky9!ln*E&?h=@Q)Hn2dlakG$+0p!uD zC}L4ii4H|Y)Unh@tCSI}fM}rz0=1%a6ntQ9L8T}YRA@H{*dL`kv->^foO92;-~DFu zrD1Cw9b6qqB$A^uwJ*xZolM9*$~oqY{HjL25J}1|(W#0xW}- z>hvwmurG;3UXI8WxB^~sPD*=->MQ7lf{HPPUd}40f2C2XV z1W)#(zB8qOq<{d$V1UEm&{a&9H?W$=U~yR9KCD#$o5}J5nO-2vi_T*6nLIv=157?t zA{wUF@MXe~$ymh7kD7?%dOipmjYfvii-BSZAdAQ2flM~YX444--H@)sl_t8*;69}w zgbgYT(c=iJ18j=Qcr+FFqY_TvrJ&VM%jyi1Wg-d&nv{Bw#bDY}ngT-5|3kIfX|w^C z!SDV4r?5euu7^PxY(P^n6>)GHcUveuUx2|%9L3})nle>IX(EcFhD1~k2m}Bv649wq zqrr0m4ncg0&VVa*Dp(@)qY?rP1X1&u94Ma#dP1pI-=PzqN|&8Jct`bUMvv?$xU}_OMXsrRW7=|ho9u_ zy4fSB{-AwP_vaTsIlZ@YH7)JHfJ0_ZOj$V+TmGl`(wxlP{riLGd?_Pu zOKBc~`{wpWGu95Ky`c+Y3ud{DSeAqCMfMx3A}md>$NV=(N0YLy+>8_ejUy&_dq-k% z3U}!ZRdscBap>{0otfKKtO_XHL$^A|>8cMsi{Bk02)uLko}0Pu-kQd^9d_hZq=)`r z?`gHP?jZm0Sr=5=+HI%5K|m=j1sqaOUVZj>$t>%MoR`pYo#d z)vF6gd8=uD?}?-fp_+(%1+&|KQ;lO^$cR^I0qt12BkNAel7J0na)+I>r8mk~e4^`U zZvw|kt-O_Vgy%80C(>tGS=7$%6=`tyW%*6NvUx?Lv`<^bQIA&2$eCwlr)UWm&wSIm zfF|h3aT_uf*bq)bxxJfGGF987ealOiiTT@OKKKYx@7e3auz@c z_mI4t!E6Ko90yax3bbb`^O@wlQn- z=4V{6P)~8}M!%?yij8#|TkmnP|JpgW2REZQX+!eP&cbrf#?B8Zc@I*g8nI*Q)2cs; z%c8<7xw9XY?sc{9z%*T!M)4c=aZlIs-+e2+MYCyT?MFR*wpM-cc5xi(!0ROotK0KU Pwtt316ej#OI4<`eiItub literal 0 HcmV?d00001 diff --git a/less/common.less b/less/common.less index be7e301..98d0d98 100644 --- a/less/common.less +++ b/less/common.less @@ -1,9 +1,11 @@ +@import "constants.less"; + *{ max-height: 1000000px; } html{background-color:#f1eeee;} body { margin:0; color:#5e5e5e; - font:300 16px/20px 'Ubuntu', Arial, Helvetica, sans-serif; + font:300 16px/20px @Ubuntu; background-color:#fff; min-width:990px; -webkit-text-size-adjust: 100%; @@ -416,5 +418,11 @@ q:after{content:"";} } } +div.radio, +div.checkbox{ + width:20px !important; + height:20px !important; +} + diff --git a/less/constants.less b/less/constants.less new file mode 100644 index 0000000..3152c20 --- /dev/null +++ b/less/constants.less @@ -0,0 +1 @@ +@Ubuntu: 'Ubuntu', Arial, Helvetica, sans-serif; \ No newline at end of file diff --git a/less/rendezvous.less b/less/rendezvous.less new file mode 100644 index 0000000..db5a09b --- /dev/null +++ b/less/rendezvous.less @@ -0,0 +1,117 @@ +@import "constants.less"; + +#formRDV{ + width:540px; + fieldset{ + dt{ + display: none; + } + .elementwrap{ + display:inline-block; + margin:0; + } + .errormessage{ + display: none; + } + + border:0px; + margin:25px 0 25px 0; + legend{ + font-size: 16px; + font-weight: 500; + color:#5e5e5e; + margin:0 0 25px; + } + + .error{ + input,select{ + border-color:#C91818; + } + } + + input,select{ + + .field; + } + + select{ + width: 260px; + } + + em{ + font-size: 13px; + } + + &#fieldset-perso{ + + dd{ + width:260px; + display:inline-block; + margin-right:15px; + &#nom_usage-element,&#naissance-element,&#email-element{ + margin-right: 0; + } + input{ + height:38px; + } + } + } + + #type-element{ + margin:0 0 15px 0; + br{ + display:none; + } + label{ + margin:0 30px 0 0; + } + } + } + + a.button.submit{ + background-color:#0ea6db; + text-transform: none; + padding:15px 25px; + border-radius: 5px; + font-size: 20px; + font-weight: 500; + float: none; + text-decoration: none; + } +} + +.field(){ + color:#c7c5c5; + font-family: @Ubuntu; + font-weight: 300; + font-size:13px; + color:#696969; + border:1px solid #c7c5c5; + border-radius: 5px; + background-color:#f6f4f4; + height:38px; + padding:10px; + margin-bottom: 15px; + font-style: italic; + + &::-webkit-input-placeholder { + .placeholderstyle; + } + + &:-moz-placeholder { /* Firefox 18- */ + .placeholderstyle; + } + + &::-moz-placeholder { /* Firefox 19+ */ + .placeholderstyle; + } + + &:-ms-input-placeholder { + .placeholderstyle; + } +} + +.placeholderstyle(){ + color:#696969; + font-style: italic; +} \ No newline at end of file -- 2.39.5