]> _ Git - fluidbook-v3.git/commitdiff
Refactor introduction block and quote form into view helpers. Done #509 @0:45
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Jun 2016 15:12:37 +0000 (15:12 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Jun 2016 15:12:37 +0000 (15:12 +0000)
framework/application/forms/RequestQuote.php
framework/application/views/helpers/IntroBlock.php [new file with mode: 0644]
framework/application/views/helpers/QuoteForm.php [new file with mode: 0644]

index bb1b23e9311df37fe98879230f99dfa8fb6f8a6e..5c4aace56d586c3d701be946a204e10e14cb51d0 100644 (file)
@@ -26,7 +26,11 @@ class Fluidbook_Form_RequestQuote extends CubeIT_Form {
         $contact_type = new Zend_Form_Element_Select('contact_type');
         $contact_type->setLabel(__('Vous êtes'));
         $contact_type->setMultiOptions(array(
-            '' => __("???"), // Todo: set options
+            '' => '',
+            'agency' => 'Une agence de communication',
+            'freelancer' => 'Un créatif freelance',
+            'company' => 'Une société',
+            'other' => 'Autre',
         ));
         $contact_type->setAttrib('required', 'required'); // Needed so we can style the first element when nothing selected
         $contact_type->setRequired(true);
@@ -49,6 +53,10 @@ class Fluidbook_Form_RequestQuote extends CubeIT_Form {
         $comments->setLabel(__('Commentaires sur votre projet'));
         $this->addElement($comments);
 
+        $tips = new CubeIT_Form_Element_Html('tips');
+        $tips->setContent('<!-- TIPS -->'); // Just a placeholder for CMS content
+        $this->addElement($tips);
+
         $submit = new Zend_Form_Element_Button('submit');
         $submit->setLabel(__('Envoyer la demande'));
         $submit->setAttrib('class', 'submit-button');
diff --git a/framework/application/views/helpers/IntroBlock.php b/framework/application/views/helpers/IntroBlock.php
new file mode 100644 (file)
index 0000000..381402c
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+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;
+    }
+}
\ No newline at end of file
diff --git a/framework/application/views/helpers/QuoteForm.php b/framework/application/views/helpers/QuoteForm.php
new file mode 100644 (file)
index 0000000..5104436
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+class Fluidbook_View_Helper_QuoteForm extends CubeIT_View_Helper_Abstract {
+
+    public function quoteForm() {
+        
+        $res  = '<div class="request-quote content-wrapper grid">';
+        $res .= '<div class="text col-2">';
+        $res .= '<h1 class="title">'. nl2br($this->option('quote_heading')) .'</h1>';
+        $res .= $this->markupDotclear($this->option('quote_description'));
+        $res .= '</div>'; // .col-2
+        $res .= '<div class="form col-4">';
+        $form = new Fluidbook_Form_RequestQuote();
+        $tips = $this->markupDotclear($this->option('quote_form_tips'), [], ['class' => 'tips']);
+        $res .= str_replace('<!-- TIPS -->', '<div id="wrap-tips">'. $tips .'</div>', $form); // Inject tips HTML into form via placeholder
+        $res .= '</div>'; // .col-4
+        $res .= '</div>'; // .request-quote
+        
+        return $res;
+    }
+}
\ No newline at end of file