--- /dev/null
+<?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
<?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
--- /dev/null
+<?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
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
\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