]> _ Git - fluidbook-v3.git/commitdiff
aditionnal refactoring on page intro | #509 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Jun 2016 16:07:09 +0000 (16:07 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Jun 2016 16:07:09 +0000 (16:07 +0000)
framework/application/forms/CMS/Base.php [new file with mode: 0644]
framework/application/forms/CMS/Contact.php
framework/application/forms/CMS/Sub/Intro.php [new file with mode: 0644]
framework/application/views/helpers/IntroBlock.php
framework/application/views/scripts/templates/contact.phtml

diff --git a/framework/application/forms/CMS/Base.php b/framework/application/forms/CMS/Base.php
new file mode 100644 (file)
index 0000000..6b6d8f7
--- /dev/null
@@ -0,0 +1,17 @@
+<?php\r
+\r
+/**\r
+ * Created by IntelliJ IDEA.\r
+ * User: Vincent\r
+ * Date: 29/06/2016\r
+ * Time: 17:48\r
+ */\r
+class Fluidbook_Form_CMS_Base extends Fluidbook_Form_CMS {\r
+       public function init() {\r
+               parent::init();\r
+\r
+               $intro = new Fluidbook_Form_CMS_Sub_Intro();\r
+               $intro->setLegend('Introduction');\r
+               $this->addSubForm($intro, 'intro');\r
+       }\r
+}
\ No newline at end of file
index 25e28d0092c6de0ab2f962a0f565feef56a3364b..48ec9354a7c350a601358c24bced6a5afdf0a82b 100644 (file)
@@ -1,23 +1,9 @@
 <?php\r
 \r
-class Fluidbook_Form_CMS_Contact extends Fluidbook_Form_CMS {\r
+class Fluidbook_Form_CMS_Contact extends Fluidbook_Form_CMS_Base {\r
 \r
     public function init() {\r
         parent::init();\r
-\r
-        $intro_title = new Zend_Form_Element_Textarea('intro_title');\r
-        $intro_title->setLabel('Intro Titre');\r
-        $intro_title->setAttrib('rows', 3);\r
-        $this->addElement($intro_title);\r
-\r
-        $intro_content = new CubeIT_Form_Element_Markitup('intro_content');\r
-        $intro_content->setLabel('Intro Content');\r
-        $this->addElement($intro_content);\r
-\r
-        $intro_bg = new CubeIT_Form_Element_File_Image('intro_bg_image');\r
-        $intro_bg->setLabel('Background Image');\r
-        $intro_bg->setMaxItems(1);\r
-        $this->addElement($intro_bg);\r
     }\r
 \r
 }
\ No newline at end of file
diff --git a/framework/application/forms/CMS/Sub/Intro.php b/framework/application/forms/CMS/Sub/Intro.php
new file mode 100644 (file)
index 0000000..18f68be
--- /dev/null
@@ -0,0 +1,40 @@
+<?php\r
+\r
+/**\r
+ * Created by IntelliJ IDEA.\r
+ * User: Vincent\r
+ * Date: 29/06/2016\r
+ * Time: 17:44\r
+ */\r
+class Fluidbook_Form_CMS_Sub_Intro extends CubeIT_Form_SubForm {\r
+       public function init() {\r
+               parent::init();\r
+\r
+               $intro_title = new Zend_Form_Element_Textarea('title');\r
+               $intro_title->setLabel('Titre');\r
+               $intro_title->setAttrib('rows', 3);\r
+               $this->addElement($intro_title);\r
+\r
+               $intro_content = new CubeIT_Form_Element_Markitup('content');\r
+               $intro_content->setLabel('Contenu');\r
+               $this->addElement($intro_content);\r
+\r
+               $button = new CubeIT_Form_Element_Link();\r
+               $button->setLabel('Bouton');\r
+               $this->addSubForm($button, 'button');\r
+\r
+               $color = new CubeIT_Form_Element_Color('bg_color');\r
+               $color->setLabel('Couleur de fond');\r
+               $color->setValue('#ffffff');\r
+               $this->addElement($color);\r
+\r
+               $intro_bg = new CubeIT_Form_Element_File_Image('bg_image');\r
+               $intro_bg->setLabel('Image de fond');\r
+               $intro_bg->setMaxItems(1);\r
+               $this->addElement($intro_bg);\r
+\r
+               $chapo = new CubeIT_Form_Element_Markitup('chapo');\r
+               $chapo->setLabel('Chapo');\r
+               $this->addElement($chapo);\r
+       }\r
+}
\ No newline at end of file
index 381402c593fad8f3f5753fd4ac066e69798090f0..4b05ea0d71b9503756e78450fc0ba6ed772eeb45 100644 (file)
@@ -2,39 +2,42 @@
 
 class Fluidbook_View_Helper_IntroBlock extends CubeIT_View_Helper_Abstract {
 
-    public function introBlock($title, $content, $bg_image = null, $bg_color = null) {
-
-        $style = '';
-        $extra_attributes = '';
-
-        if ($bg_image) {
-            $image_path = CubeIT_View_Helper_ImageCms::getPath($bg_image);
-
-            // Work out the ratio of the background image
-            CubeIT_Image::getDimensions($image_path, $image_width, $image_height);
-            $image_ratio = $image_height / $image_width;
-
-            $style = "background-image: url($image_path);";
-            $extra_attributes = 'data-bg-ratio="'. $image_ratio .'"';
-        }
-        
-        if ($bg_color) {
-            $style .= "background-color: $bg_color";
-        }
-        
-
-        $res = '<div class="content-wrapper no-shrink" style="'. $style .'"'. $extra_attributes .'>';
-
-        $res .= '<div class="grid">';
-        $res .= '<div class="col-2">';
-
-        $res .= '<h1 class="title">'. nl2br($title) .'</h1>';
-        $res .= $content;
-        
-        $res .= '</div>'; // .col-2
-        $res .= '</div>'; // .grid
-        $res .= '</div>'; // .content-wrapper
-        
-        return $res;
-    }
+       public function introBlock($intro, $additionnalContent) {
+
+               $style = '';
+               $extra_attributes = '';
+
+               if ($intro['bg_image']) {
+                       $image_path = CubeIT_View_Helper_ImageCms::getPath($intro['bg_image']);
+
+                       // Work out the ratio of the background image
+                       CubeIT_Image::getDimensions($image_path, $image_width, $image_height);
+                       $image_ratio = $image_height / $image_width;
+
+                       $style = "background-image: url($image_path);";
+                       $extra_attributes = 'data-bg-ratio="' . $image_ratio . '"';
+               }
+
+               if ($intro['bg_color']) {
+                       $style .= "background-color:" . $intro['bg_color'] . ";";
+               }
+
+
+               $res = '<div class="content-wrapper no-shrink" style="' . $style . '"' . $extra_attributes . '>';
+
+               $res .= '<div class="grid">';
+               $res .= '<div class="col-2">';
+
+               $res .= '<h1 class="title">' . nl2br($intro['title']) . '</h1>';
+               $res .= $this->markupDotclear($intro['content']);
+               if ($additionnalContent) {
+                       $res .= $additionnalContent;
+               }
+
+               $res .= '</div>'; // .col-2
+               $res .= '</div>'; // .grid
+               $res .= '</div>'; // .content-wrapper
+
+               return $res;
+       }
 }
\ No newline at end of file
index 236bfcea325f20972b89d8e17a68cace6339aca9..28daf2c05043884aac0fd631892cb018fd646713 100644 (file)
@@ -2,53 +2,27 @@
 \r
 $this->headScript()->addScriptAndStyle('310-contact');\r
 \r
-$intro_image_path = CubeIT_View_Helper_ImageCms::getPath($this->intro_bg_image);\r
-\r
-// Work out the ratio of the background image\r
-CubeIT_Image::getDimensions($intro_image_path, $intro_image_width, $intro_image_height);\r
-$intro_ratio = $intro_image_height / $intro_image_width;\r
-\r
-$res .= '<div class="contact-intro content-wrapper no-shrink" \r
-              style="background-image: url('. $intro_image_path .');"\r
-              data-bg-ratio="'. $intro_ratio .'">';\r
-\r
-$res .= '<div class="grid">';\r
-$res .= '<div class="col-2">';\r
-\r
-$res .= '<h1 class="title">'. nl2br($this->intro_title) .'</h1>';\r
-$res .= $this->markupDotclear($this->intro_content);\r
-\r
-// Address\r
 $address = $this->option('address');\r
 $locale = new Zend_Locale();\r
 $country = strtoupper($locale->getTranslation($address['pays'], 'Territory'));\r
-$res .= '<address>';\r
-$res .= '<h4>'. $address['company'] .'</h4>';\r
-$res .= $address['adresse'];\r
-$res .= '<br>';\r
-$res .= "{$address['code_postal']} {$address['ville']} - $country";\r
-$res .= '<br>';\r
-$res .= __('Tél :') . ' ' . $this->linkPhone($address['phone']);\r
-$res .= '<br>';\r
-$res .= __('email :') . ' ' . $this->linkEmail($address['email']);\r
-$res .= '</address>';\r
-\r
-$res .= '</div>'; // .col-2\r
-$res .= '</div>'; // .grid\r
+$content = '<address>';\r
+$content .= '<h4>'. $address['company'] .'</h4>';\r
+$content .= $address['adresse'];\r
+$content .= '<br>';\r
+$content .= "{$address['code_postal']} {$address['ville']} - $country";\r
+$content .= '<br>';\r
+$content .= __('Tél :') . ' ' . $this->linkPhone($address['phone']);\r
+$content .= '<br>';\r
+$content .= __('email :') . ' ' . $this->linkEmail($address['email']);\r
+$content .= '</address>';\r
+\r
+$res  = '<div class="contact-intro">';\r
+$res .= $this->introBlock($this->intro, $content);\r
 $res .= '</div>'; // .contact-intro\r
 \r
+\r
 // Request Quote form\r
-$res .= '<div class="request-quote content-wrapper grid">';\r
-$res .= '<div class="text col-2">';\r
-$res .= '<h1 class="title">'. nl2br($this->option('quote_heading')) .'</h1>';\r
-$res .= $this->markupDotclear($this->option('quote_description'));\r
-$res .= '</div>'; // .col-2\r
-$res .= '<div class="form col-4">';\r
-$form = new Fluidbook_Form_RequestQuote();\r
-$res .= $form;\r
-$res .= $this->markupDotclear($this->option('quote_form_tips'));\r
-$res .= '</div>'; // .col-4\r
-$res .= '</div>'; // .request-quote\r
+$res .= $this->quoteForm();\r
 \r
 // Resellers\r
 \r