From f1d8740efb633c62fbfc773a07484b064257dd97 Mon Sep 17 00:00:00 2001
From: Michael <michael.danielczok@gmail.com>
Date: Mon, 26 Oct 2015 16:16:17 +0100
Subject: [PATCH] Neuer Brick - Image (halbfertig).

---
 bricks.xml                         | 22 ++++++++--
 lib/QUI/Bricks/Controls/Image.css  |  1 +
 lib/QUI/Bricks/Controls/Image.html |  6 +++
 lib/QUI/Bricks/Controls/Image.php  | 66 ++++++++++++++++++++++++++++++
 locale.xml                         | 24 ++++++++++-
 5 files changed, 114 insertions(+), 5 deletions(-)
 create mode 100644 lib/QUI/Bricks/Controls/Image.css
 create mode 100644 lib/QUI/Bricks/Controls/Image.html
 create mode 100644 lib/QUI/Bricks/Controls/Image.php

diff --git a/bricks.xml b/bricks.xml
index a5b41b5..c4bad31 100644
--- a/bricks.xml
+++ b/bricks.xml
@@ -82,8 +82,6 @@
         </brick>
 
 
-
-
         <!-- Content Switcher -->
         <brick control="\QUI\Bricks\Controls\ContentSwitcher">
             <title>
@@ -105,9 +103,25 @@
         </brick>
 
 
+        <!-- Image Brick -->
+        <brick control="\QUI\Bricks\Controls\Image">
+            <title>
+                <locale group="quiqqer/bricks" var="bricks.Image.title"/>
+            </title>
+            <description>
+                <locale group="quiqqer/bricks" var="bricks.Image.description"/>
+            </description>
 
+            <settings>
+                <setting name="link" class="project-site">
+                    <locale group="quiqqer/bricks" var="Image.link"/>
+                </setting>
 
-
+                <setting name="picture" class="media-image">
+                    <locale group="quiqqer/bricks" var="Image.picture"/>
+                </setting>
+            </settings>
+        </brick>
 
 
 
@@ -129,7 +143,7 @@
             </settings>
         </brick>
 
-        /* Maps */
+        <!-- Maps -->
 
         <brick control="\QUI\Bricks\Controls\GoogleMaps">
             <title>
diff --git a/lib/QUI/Bricks/Controls/Image.css b/lib/QUI/Bricks/Controls/Image.css
new file mode 100644
index 0000000..7068cde
--- /dev/null
+++ b/lib/QUI/Bricks/Controls/Image.css
@@ -0,0 +1 @@
+/**/
\ No newline at end of file
diff --git a/lib/QUI/Bricks/Controls/Image.html b/lib/QUI/Bricks/Controls/Image.html
new file mode 100644
index 0000000..e442680
--- /dev/null
+++ b/lib/QUI/Bricks/Controls/Image.html
@@ -0,0 +1,6 @@
+{assign var=img value=$brickImage}
+<section>
+
+    {image src=$brickImage}
+
+</section>
\ No newline at end of file
diff --git a/lib/QUI/Bricks/Controls/Image.php b/lib/QUI/Bricks/Controls/Image.php
new file mode 100644
index 0000000..4b4469b
--- /dev/null
+++ b/lib/QUI/Bricks/Controls/Image.php
@@ -0,0 +1,66 @@
+<?php
+
+/**
+ * This file contains QUI\Bricks\Controls\Image
+ */
+
+namespace QUI\Bricks\Controls;
+
+use QUI;
+
+/**
+ * Class Image
+ *
+ * @package quiqqer/bricks
+ */
+
+
+class Image extends QUI\Control
+{
+    /**
+     * constructor
+     *
+     * @param Array $attributes
+     */
+    public function __construct($attributes = array())
+    {
+        // default options
+        $this->setAttributes(array(
+            'title'       => 'Image Brick',
+            'contentList' => false,
+            'entries'     => array()
+        ));
+
+        parent::__construct($attributes);
+
+        $this->addCSSFile(
+            dirname(__FILE__) . '/Image.css'
+        );
+    }
+
+
+    /**
+     * (non-PHPdoc)
+     *
+     * @see \QUI\Control::create()
+     */
+    public function getBody()
+    {
+        $Engine = QUI::getTemplateManager()->getEngine();
+        $entries = $this->getAttribute('entries');
+        $brickImage = $this->getAttribute('picture');
+
+        $Engine->assign(array(
+            'this'      => $this,
+            'entries'   => $entries,
+            'brickImag' => $brickImage
+        ));
+
+
+        return $Engine->fetch(dirname(__FILE__).'/Image.html');
+    }
+}
+
+
+
+
diff --git a/locale.xml b/locale.xml
index 349a946..435553c 100644
--- a/locale.xml
+++ b/locale.xml
@@ -457,13 +457,35 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de>
         </locale>
 
         <!-- Content Switcher -->
+        <locale name="brick.ContentSwitcher.title">
+            <de><![CDATA[Baustein: Content Switcher]]></de>
+            <en><![CDATA[Brick: Content Switcher]]></en>
+        </locale>
         <locale name="ContentSwitcher.title">
             <de><![CDATA[Baustein-Überschrift]]></de>
             <en><![CDATA[]]></en>
         </locale>
-        <locale name="ContentSwitcher.socialList">
+        <locale name="ContentSwitcher.entries">
             <de><![CDATA[Einträge]]></de>
             <en><![CDATA[]]></en>
         </locale>
+
+        <!-- Image Brick -->
+        <locale name="bricks.Image.link">
+            <de><![CDATA[Baustein: Bild]]></de>
+            <en><![CDATA[Brick: Image]]></en>
+        </locale>
+        <locale name="Image.link">
+            <de><![CDATA[Link]]></de>
+            <en><![CDATA[Hyperlink]]></en>
+        </locale>
+        <locale name="Image.title">
+            <de><![CDATA[Baustein-Überschrift]]></de>
+            <en><![CDATA[]]></en>
+        </locale>
+        <locale name="Image.picture">
+            <de><![CDATA[Bild auswählen]]></de>
+            <en><![CDATA[]]></en>
+        </locale>
     </groups>
 </locales>
\ No newline at end of file
-- 
GitLab