Erweiterung der Funktionalität, erste Anbindung an Editoren, Einbinden von JS-Bibliotheken

This commit is contained in:
2016-10-05 15:27:09 +00:00
parent 5a1dd25023
commit f65b4db286
26 changed files with 31969 additions and 140 deletions

View File

@@ -78,6 +78,8 @@ define('PATH_TPL', PATH_ROOT . 'templates/');
*/ */
define('HTML_IMG', PATH_PREFIX . '/images/'); define('HTML_IMG', PATH_PREFIX . '/images/');
define('HTML_CSS', PATH_PREFIX . '/css/'); define('HTML_CSS', PATH_PREFIX . '/css/');
define('HTML_JS', PATH_PREFIX . '/js/');
define('HTML_MED', PATH_PREFIX . '/media/');
/** /**
@@ -94,4 +96,7 @@ define('DB_PASS', '2YcEOiFRUhk5ELeT9gZ3');
* Tabellennamen definieren * Tabellennamen definieren
*/ */
define('TBL_FRONT_NAVIGATION', 'ahd_navigation'); define('TBL_FRONT_NAVIGATION', 'ahd_navigation');
define('TBL_IMAGE_TEXT', 'ahd_image_text'); define('TBL_IMAGE_TEXT', 'ahd_image_text');
define('TBL_IMAGE', 'ahd_image');
require_once(PATH_CNF . 'config_version.php');

View File

@@ -1,9 +1,9 @@
<?php <?php
/* Portal - Definitionen */ /**
$vC['portal']['name'] = 'Bühler Kaffee'; * Portal - Definitionen
$vC['portal']['hostUrl'] = 'http://www.bühler-kaffee/admin'; */
$vC['portal']['arrHost'] = parse_url($vC['portal']['hostUrl']); $vC['portal']['name'] = 'AHD Allradhaus GmbH';
$vC['portal']['adminUserId'] = 3; $vC['portal']['adminUserId'] = 3;
$vC['portal']['languages'] = array('de'); $vC['portal']['languages'] = array('de');
$vC['portal']['address'] = 'informal'; /* formal || informal */ $vC['portal']['address'] = 'informal'; /* formal || informal */
@@ -11,26 +11,16 @@ $vC['portal']['layout'] = 'buehler';
$vC['portal']['tplElements'] = array('login', 'navi_main', 'content'); $vC['portal']['tplElements'] = array('login', 'navi_main', 'content');
$vC['portal']['imgQuality'] = 90; $vC['portal']['imgQuality'] = 90;
/* Website-Bearbeitung - Definitionen */
$vC['portal']['website']['navId'] = array(); /**
$vC['portal']['website']['prefix'] = array(); * E-Mail Versand
*/
foreach ($vC['portal']['website']['prefix'] as $config)
{
include_once(PATH_CNF . 'config_' . $config . '.php');
foreach ($$config as $key => $value)
{
$vC['portal']['website'][$key][] = $value;
}
}
/* E-Mail Versand */
$vC['portal']['mail']['type'] = 'smtp'; /* sendmail || smtp || mail */ $vC['portal']['mail']['type'] = 'smtp'; /* sendmail || smtp || mail */
/* Nur ausfüllen, falls 'type' === 'smtp' */ /**
* Nur ausfüllen, falls 'type' === 'smtp'
*/
$vC['portal']['mail']['smtpAuth'] = true; /* true || false */ $vC['portal']['mail']['smtpAuth'] = true; /* true || false */
$vC['portal']['mail']['smtpHost'] = 'mail.arcor.de'; $vC['portal']['mail']['smtpHost'] = 'mail.arcor.de';
$vC['portal']['mail']['smtpUser'] = 'christiansteinle'; $vC['portal']['mail']['smtpUser'] = 'christiansteinle';
@@ -41,9 +31,7 @@ $vC['portal']['mail']['fromName'] = 'Bühler Kaffee';
$vC['portal']['mail']['html'] = false; /* true || false */ $vC['portal']['mail']['html'] = false; /* true || false */
$vC['portal']['mail']['charset'] = 'UTF-8'; $vC['portal']['mail']['charset'] = 'UTF-8';
/* Wartezeiten in Sekunden */ /**
$vC['timeout']['error'] = 5; * Wartezeiten in Sekunden
*/
/* Bereich Kundenverwaltung */ $vC['timeout']['error'] = 5;
$vC['customer']['results'] = array(50, 100, 200, 500, 1000);
$vC['customer']['pagerBefore'] = 3;

View File

@@ -0,0 +1,30 @@
<?php
/**
* Created by CS medien- & kommunikationssysteme.
* @author Christian Steinle
* @date 29.09.2016
*
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
*/
$editor['name'] = 'AHD Allradhaus GmbH';
if (ENVIRONMENT === 'local')
{
$editor['editorUrl'] = SCHEME . '://csteinle.ddns.net/rist-editors/';
$editor['editorVersion'] = '2.0.0';
}
elseif (ENVIRONMENT === 'production')
{
$editor['editorUrl'] = SCHEME . '://rist-editors.ri-st.de/';
$editor['editorVersion'] = '1.0.2';
}
$editor['webserviceUrl'] = HOST_URL . str_replace(PATH_ROOT, '', dirname(__DIR__)) . '/remote_data.php';
$editor['imageTypes'] = array('image/png', 'image/jpeg', 'image/gif');
$editor['imageDimension']['small'] = array('width' => 480, 'height' => 360, 'quality' => 95);
$editor['imageDimension']['keyVisual'] = array('width' => 1368, 'height' => 342, 'quality' => 95);
$editor['imageDimension']['orig'] = array('width' => 2560, 'height' => 2560, 'quality' => 99);
$editor['contentElements'] = array('subline', 'text', 'textimage');
$editor['backendPrefix'] = PATH_PREFIX . '/' . str_replace(PATH_ROOT, '', dirname(__DIR__));
$editor['backendUrl'] = HOST_URL . str_replace(PATH_ROOT, '', dirname(__DIR__)) . '/webservice/requestData.php';

24
backend/editor/index.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
/**
* Created by CS medien- & kommunikationssysteme.
* @author Christian Steinle
* @date 29.09.2016
*
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
*/
session_start();
$_SESSION['lang'] = 'de';
$siteID = (!isset($_GET['siteID']) || empty($_GET['siteID'])) ? '1' : $_GET['siteID'];
$pathRoot = dirname(dirname(__DIR__)) . '/';
require_once($pathRoot . '.config/config_global.php');
require_once(__DIR__ . '/.config/editor_config.php');
$loader = require PATH_ROOT . '/vendor/autoload.php';
$registry = \Helper\Registry::getInstance();
$registry->editorConfig = $editor;
$registry->editorConfig['token'] = session_id();
$route = new \Route\FrontendRoute($siteID, true);

View File

@@ -0,0 +1,11 @@
<?php
/**
* Created by CS medien- & kommunikationssysteme.
* @author Christian Steinle
* @date 05.10.2016
*
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
*/
file_put_contents(__DIR__ . '/request.log', var_export($_POST, true) . "\n\n", FILE_APPEND);
echo json_encode(1);

View File

@@ -1,22 +1,22 @@
body { body {
padding: 50px 0; padding: 50px 0;
font-family: Verdana; font-family: Verdana, Arial, sans-serif;
text-align: justify;
} }
li.dropdown-submenu { li.dropdown-submenu {
position:relative; position: relative;
} }
li.dropdown-submenu:hover >ul.dropdown-menu { li.dropdown-submenu:hover > ul.dropdown-menu {
display: block; display: block;
} }
li.dropdown:hover >ul.dropdown-menu { li.dropdown:hover > ul.dropdown-menu {
display: block; display: block;
} }
ul.dropdown-menu.pull-left ul.dropdown-menu.pull-left {
{
margin-top: -6px; margin-top: -6px;
border-top-left-radius: 0; border-top-left-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
@@ -38,6 +38,14 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
height: auto; height: auto;
} }
#footer .navbar-brand {
margin-left: 0;
}
#footer .navbar-brand p {
font-size: 14px;
}
.container-fluid { .container-fluid {
max-width: 1600px; max-width: 1600px;
} }
@@ -53,4 +61,65 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
.navbar-fixed-top .pull-right img { .navbar-fixed-top .pull-right img {
margin-top: 15px; margin-top: 15px;
margin-left: 30px; margin-left: 30px;
}
@media screen and (min-width: 768px) {
.subaru_logo {
margin-top: 12px;
width: 149px;
height: 25px;
background-image: url('../images/subaru/subaru_logo.png');
}
.daihatsu_logo {
width: 150px;
height: 25px;
margin-left: 15px;
margin-top: 12px;
background-image: url('../images/daihatsu/daihatsu_logo.png');
}
}
@media (max-width: 767px) {
#main-navbar {
position: absolute;
left: 80px;
}
.navbar-collapse.in {
overflow-y: visible;
}
#main-navbar a.dropdown-toggle {
display: block;
}
#main-navbar ul.dropdown-menu {
float: left;
}
.container > .navbar-header {
margin: 0;
}
.subaru_logo {
margin-top: 12px;
width: 48px;
height: 25px;
background-image: url('../images/subaru/subaru_logo.png');
}
.daihatsu_logo {
width: 42px;
height: 25px;
margin-left: 15px;
margin-top: 12px;
background-image: url('../images/daihatsu/daihatsu_logo.png');
}
}
@media (max-width: 642px) {
#footer .ahd {
display: none;
}
} }

1
css/ahd.min.css vendored Normal file
View File

@@ -0,0 +1 @@
body{padding:50px 0;font-family:Verdana,Arial,sans-serif;text-align:justify}li.dropdown-submenu{position:relative}li.dropdown-submenu:hover>ul.dropdown-menu{display:block}li.dropdown:hover>ul.dropdown-menu{display:block}ul.dropdown-menu.pull-left{margin-top:-6px;border-top-left-radius:0;border-bottom-left-radius:0;border-left:0;top:0;left:100%}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-weight:bold}#footer h3{text-decoration:underline}#footer:hover .navbar-brand{height:auto}#footer .navbar-brand{margin-left:0}#footer .navbar-brand p{font-size:14px}.container-fluid{max-width:1600px}.container-fluid .img-responsive{margin:0 auto}.caret.rotate-left{transform:rotate(270deg)}.navbar-fixed-top .pull-right img{margin-top:15px;margin-left:30px}@media screen and (min-width:768px){.subaru_logo{margin-top:12px;width:149px;height:25px;background-image:url('../images/subaru/subaru_logo.png')}.daihatsu_logo{width:150px;height:25px;margin-left:15px;margin-top:12px;background-image:url('../images/daihatsu/daihatsu_logo.png')}}@media(max-width:767px){#main-navbar{position:absolute;left:80px}.navbar-collapse.in{overflow-y:visible}#main-navbar a.dropdown-toggle{display:block}#main-navbar ul.dropdown-menu{float:left}.container>.navbar-header{margin:0}.subaru_logo{margin-top:12px;width:48px;height:25px;background-image:url('../images/subaru/subaru_logo.png')}.daihatsu_logo{width:42px;height:25px;margin-left:15px;margin-top:12px;background-image:url('../images/daihatsu/daihatsu_logo.png')}}@media(max-width:642px){#footer .ahd{display:none}}

View File

@@ -7,7 +7,7 @@
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de) * @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
*/ */
$url = (!isset($_GET['url']) || empty($_GET['url'])) ? 'allradhaus' : '/' . $_GET['url'] . ' '; $url = (!isset($_GET['url']) || empty($_GET['url'])) ? 'allradhaus' : '/' . $_GET['url'];
$pathRoot = __DIR__ . '/'; $pathRoot = __DIR__ . '/';
require_once($pathRoot . '.config/config_global.php'); require_once($pathRoot . '.config/config_global.php');

2377
js/bootstrap.js vendored Normal file

File diff suppressed because it is too large Load Diff

7
js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

10220
js/jquery-3.1.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

4
js/jquery-3.1.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
js/jquery-3.1.1.min.map Normal file

File diff suppressed because one or more lines are too long

18706
js/jquery-ui-1.12.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

13
js/jquery-ui-1.12.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

13
js/npm.js Normal file
View File

@@ -0,0 +1,13 @@
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')

View File

@@ -11,13 +11,15 @@ namespace Controller;
use Helper\Database; use Helper\Database;
use Model\NavigationModel; use Model\NavigationModel;
use View\StandardView;
use View\NavigationView; use View\NavigationView;
use View\StandardView;
class FrontendController class FrontendController
{ {
protected $route = ''; protected $route = '';
protected $isEditable = false;
protected $request = array(); protected $request = array();
protected $contents = array(); protected $contents = array();
@@ -27,52 +29,96 @@ class FrontendController
$this->route = $route; $this->route = $route;
$this->routeParts = explode('/', $route); $this->routeParts = explode('/', $route);
$this->request = $request; $this->request = $request;
$this->init();
} }
private function init() public function setEditable($isEditable)
{ {
NavigationModel::init($this->routeParts); $this->isEditable = $isEditable;
$navigation = new NavigationView(NavigationModel::getData(), $this->routeParts); }
$this->contents['title'] = 'AHD Allradhaus';
$this->contents['navigation'] = $navigation->getHtml(); public function init()
{
NavigationModel::init($this->routeParts, $this->isEditable);
$navigation = new NavigationView(NavigationModel::getData(), NavigationModel::getNavigationPath());
$navigation->setEditable($this->isEditable);
$navigation->init();
$this->contents['title'] = NavigationModel::getTitle();
$this->contents['navigation'] = $navigation->render();
$this->contents['headline'] = NavigationModel::getHeadline(); $this->contents['headline'] = NavigationModel::getHeadline();
$this->contents['navID'] = NavigationModel::getActiveNavID();
$this->contents['content'] = ''; $this->contents['content'] = '';
$tmpContents = NavigationModel::getContents(); $this->contents['keyVisual'] = '';
$tmpKeyVisual = NavigationModel::getKeyVisual();
foreach ($tmpKeyVisual as $data)
{
$this->contents['keyVisual'] .= $this->buildContents($data);
}
$tmpContents = NavigationModel::getContents();
/** /**
* @var Database $modelClass * @var Database $modelClass
*/ */
foreach ($tmpContents as $key => $data) foreach ($tmpContents as $data)
{ {
$modelClass = 'Model\\' . $data['Controller'] . 'Model'; $this->contents['content'] .= $this->buildContents($data);
$viewClass = 'View\\' . $data['Controller'] . 'View';
if (class_exists($modelClass, true))
{
$modelData = $modelClass::getItem($data['ID']);
}
else
{
/**
* TODO: ErrorHandler bauen
*/
return;
}
if (class_exists($viewClass, true))
{
$dataView = new $viewClass($modelData, $data['Controller']);
}
else
{
$dataView = new StandardView($modelData, $data['Controller']);
}
$this->contents['content'] .= $dataView->render();
} }
$pageView = new StandardView($this->contents, 'index'); $pageView = new StandardView($this->contents, 'index');
$pageView->setEditable($this->isEditable);
echo $pageView->render(); echo $pageView->render();
} }
/**
* @param array $data
* @return string
*/
protected function buildContents(array $data)
{
/**
* @var Database $modelClass
*/
$modelClass = 'Model\\' . $data['Controller'] . 'Model';
$viewClass = 'View\\' . $data['Controller'] . 'View';
if (class_exists($modelClass, true))
{
if (isset($data['ID']))
{
$modelData = $modelClass::getItem($data['ID']);
}
if (isset($data['IDs']))
{
$tmpModelData = $data;
unset($tmpModelData['Controller']);
unset($tmpModelData['IDs']);
$modelClass::setFilter($data['IDs']);
$modelData = $modelClass::getIndex();
$modelData = array_merge($modelData, $tmpModelData);
$modelData['navID'] = $this->contents['navID'];
}
}
else
{
/**
* TODO: ErrorHandler bauen
*/
return '';
}
if (class_exists($viewClass, true))
{
$dataView = new $viewClass($modelData, $data['Controller']);
}
else
{
$dataView = new StandardView($modelData, $data['Controller']);
}
$dataView->setEditable($this->isEditable);
return $dataView->render();
}
} }

View File

@@ -0,0 +1,23 @@
<?php
/**
* Created by CS medien- & kommunikationssysteme.
* @author Christian Steinle
* @date 05.10.2016
*
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
*/
namespace Model;
use Helper\Database;
class ImageModel extends Database
{
const TBL_NAME = TBL_IMAGE;
const PRIMARY_KEY = 'ID';
const ORDER_BY = '';
}

View File

@@ -0,0 +1,20 @@
<?php
/**
* Created by CS medien- & kommunikationssysteme.
* @author Christian Steinle
* @date 05.10.2016
*
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
*/
namespace Model;
class KeyVisualModel extends ImageModel
{
public static function setFilter(array $IDs)
{
$filter = static::PRIMARY_KEY . ' = ' . implode(' OR ' . static::PRIMARY_KEY . ' = ', $IDs);
static::$filter = $filter;
}
}

View File

@@ -28,7 +28,9 @@ class NavigationModel extends Database
protected static $activeNavID = 0; protected static $activeNavID = 0;
protected static $header = ''; protected static $title = '';
protected static $keyVisual = array();
protected static $headline = ''; protected static $headline = '';
@@ -38,28 +40,53 @@ class NavigationModel extends Database
/** /**
* Setzt später benötigte Variablen für den FrontendController, so dass die Datenmodelle und die Views instanziiert werden können * Setzt später benötigte Variablen für den FrontendController, so dass die Datenmodelle und die Views instanziiert werden können
* @param array $routeParts * @param array $routeParts
* @param bool $isEditable
*/ */
public static function init(array $routeParts) public static function init(array $routeParts, $isEditable = false)
{ {
self::getIndex(); self::getIndex();
$nav = self::$data; if ($isEditable)
$navStart = 0;
foreach ($routeParts as $navLink)
{ {
foreach ($nav as $navID => $navItem) self::initBackend($routeParts[0], false);
}
else
{
self::initFrontend($routeParts);
}
}
protected static function initBackend($siteID, $depth)
{
foreach (self::$data as $navID => $navItem)
{
if ($navID == $siteID && $depth === false)
{ {
if ($navItem['navStart'] == $navStart && $navItem['navLink'] == $navLink) self::$activeNavID = $navItem['navID'];
{ self::$title = $navItem['navTitle'];
$navStart = $navItem['navID']; self::$headline = $navItem['navHeadline'];
self::$navigationPath[] = self::$activeNavID = $navItem['navID']; self::initKeyVisual($navItem['navKeyVisual']);
self::$header = $navItem['navHeader']; self::initContent($navItem['navContent']);
self::$headline = $navItem['navHeadline']; self::buildNavigationPath();
self::initContent($navItem['navContent']); break;
}
} }
} }
} }
/**
* @param string $navKeyVisual
*/
protected static function initKeyVisual($navKeyVisual)
{
if (is_null($navKeyVisual))
{
return;
}
if (is_array(json_decode($navKeyVisual, true)))
{
self::$keyVisual = json_decode($navKeyVisual, true);
}
}
/** /**
* @param string $navContents * @param string $navContents
@@ -76,6 +103,36 @@ class NavigationModel extends Database
} }
} }
protected static function buildNavigationPath()
{
$navStart = $navStartPath[] = self::$activeNavID;
while ($navStart !== '0' && !is_null($navStart))
{
$navStart = $navStartPath[] = self::$data[$navStart]['navStart'];
}
array_pop($navStartPath);
self::$navigationPath = array_reverse($navStartPath);
}
protected static function initFrontend(array $routeParts)
{
$navStart = 0;
foreach ($routeParts as $navLink)
{
foreach (self::$data as $navID => $navItem)
{
if ($navItem['navStart'] == $navStart && $navItem['navLink'] == $navLink)
{
$navStart = $navItem['navID'];
self::$navigationPath[] = self::$activeNavID = $navItem['navID'];
self::$title = $navItem['navTitle'];
self::initKeyVisual($navItem['navKeyVisual']);
self::$headline = $navItem['navHeadline'];
self::initContent($navItem['navContent']);
}
}
}
}
/** /**
* @return array * @return array
@@ -98,9 +155,18 @@ class NavigationModel extends Database
/** /**
* @return string * @return string
*/ */
public static function getHeader() public static function getTitle()
{ {
return self::$header; return self::$title;
}
/**
* @return array
*/
public static function getKeyVisual()
{
return self::$keyVisual;
} }

View File

@@ -30,21 +30,25 @@ class FrontendRoute
*/ */
protected $request = array(); protected $request = array();
/**
* @var FrontendController|null
*/
protected $controller = null; protected $controller = null;
protected $action = '';
/** /**
* FrontendRoute constructor. * FrontendRoute constructor.
* @param string $route * @param string $route
* @param bool $editable
* @param array $request * @param array $request
*/ */
public function __construct($route, array $request = array()) public function __construct($route, $editable = false, array $request = array())
{ {
$this->setRoute($route); $this->setRoute($route);
$this->request = $request; $this->request = $request;
$this->controller = new FrontendController($this->route, $request); $this->controller = new FrontendController($this->route, $request);
$this->controller->setEditable($editable);
$this->controller->init();
} }
@@ -56,7 +60,4 @@ class FrontendRoute
$this->route = trim($route, " \t\n\r\0\x0B/"); $this->route = trim($route, " \t\n\r\0\x0B/");
$this->routeParts = explode('/', $this->route); $this->routeParts = explode('/', $this->route);
} }
} }

View File

@@ -10,6 +10,8 @@
namespace View; namespace View;
use Helper\Registry;
class NavigationView class NavigationView
{ {
/** /**
@@ -30,6 +32,12 @@ class NavigationView
*/ */
protected $orderedNavigation = array(); protected $orderedNavigation = array();
/**
* Ist die Navigation editierbar oder nicht
* @var bool
*/
protected $isEditable = false;
/** /**
* Das Html der kompletten Navigation * Das Html der kompletten Navigation
* @var string * @var string
@@ -37,12 +45,42 @@ class NavigationView
protected $navigationHtml = ''; protected $navigationHtml = '';
/**
* NavigationView constructor.
*
* @param array $navigationParts
* @param array $navigationPath
*/
public function __construct(array $navigationParts, array $navigationPath) public function __construct(array $navigationParts, array $navigationPath)
{ {
$this->navigationParts = $navigationParts; $this->navigationParts = $navigationParts;
$this->navigationPath = $navigationPath; $this->navigationPath = $navigationPath;
}
/**
* Setter für die Editierbarkeit des Inhalts
*
* @param bool $isEditable
*/
public function setEditable($isEditable)
{
$this->isEditable = $isEditable;
}
public function init()
{
$this->buildOrderedNavigation(); $this->buildOrderedNavigation();
$this->buildNavigation(0); if ($this->isEditable)
{
$registry = Registry::getInstance();
$this->buildNavigation(0, $registry->editorConfig['backendPrefix']);
}
else
{
$this->buildNavigation(0);
}
} }
@@ -60,11 +98,12 @@ class NavigationView
private function buildNavigation($navStart, $linkPrefix = PATH_PREFIX, $depth = 0) private function buildNavigation($navStart, $linkPrefix = PATH_PREFIX, $depth = 0)
{ {
$tmpNavigation = $this->orderedNavigation[$navStart]; $tmpNavigation = $this->orderedNavigation[$navStart];
$activePath = PATH_PREFIX . '/' . implode('/', $this->navigationPath);
if ($depth === 0) if ($depth === 0)
{ {
$this->navigationHtml .= '<div class="" id="bs-example-navbar-collapse-1"><ul class="nav navbar-nav">'; $editableHtml = ($this->isEditable) ? ' data-editor="navigation" data-id="' . end($this->navigationPath) . '" data-element="navigation_' . end($this->navigationPath) . '"' : '';
//$this->navigationHtml .= '<nav class="navbar-collapse collapse" id="main-navbar" aria-expanded="false">';
$this->navigationHtml .= '<ul class="nav navbar-nav navbar-inverse navbar-collapse collapse" id="main-navbar" aria-expanded="false"' . $editableHtml . '>';
} }
else else
{ {
@@ -77,7 +116,7 @@ class NavigationView
$aClass = ''; $aClass = '';
$span = ''; $span = '';
if (strpos($activePath, $linkPrefix . '/' . $navItem['navLink']) === 0) if (in_array($navItem['navID'], $this->navigationPath))
{ {
$liClasses[] = 'active'; $liClasses[] = 'active';
} }
@@ -89,10 +128,24 @@ class NavigationView
} }
$liClass = (empty($liClasses)) ? '' : ' class="' . implode(' ', $liClasses) . '"'; $liClass = (empty($liClasses)) ? '' : ' class="' . implode(' ', $liClasses) . '"';
$this->navigationHtml .= '<li' . $liClass . '><a ' . $aClass . 'href="' . $linkPrefix . '/' . $navItem['navLink'] . '">' . $navItem['navName'] . $span . '</a>'; if ($this->isEditable)
{
$this->navigationHtml .= '<li' . $liClass . '><a ' . $aClass . 'href="' . $linkPrefix . '/index.php?siteID=' . $navItem['navID'] . '">' . $navItem['navName'] . $span . '</a>';
}
else
{
$this->navigationHtml .= '<li' . $liClass . '><a ' . $aClass . 'href="' . $linkPrefix . '/' . $navItem['navLink'] . '">' . $navItem['navName'] . $span . '</a>';
}
if (isset($this->orderedNavigation[$navItem['navID']])) if (isset($this->orderedNavigation[$navItem['navID']]))
{ {
$this->buildNavigation($navItem['navID'], $linkPrefix . '/' . $navItem['navLink'], ($depth + 1)); if ($this->isEditable)
{
$this->buildNavigation($navItem['navID'], $linkPrefix, ($depth + 1));
}
else
{
$this->buildNavigation($navItem['navID'], $linkPrefix . '/' . $navItem['navLink'], ($depth + 1));
}
} }
$this->navigationHtml .= '</li>'; $this->navigationHtml .= '</li>';
} }
@@ -100,12 +153,12 @@ class NavigationView
$this->navigationHtml .= '</ul>'; $this->navigationHtml .= '</ul>';
if ($depth === 0) if ($depth === 0)
{ {
$this->navigationHtml .= '</div>'; //$this->navigationHtml .= '</nav>';
} }
} }
public function getHtml() public function render()
{ {
return $this->navigationHtml; return $this->navigationHtml;
} }

View File

@@ -9,15 +9,37 @@
namespace View; namespace View;
use \Helper\Registry;
class StandardView class StandardView
{ {
const TPL_PATH = PATH_TPL; /**
* Pfad zur Template Datei
* @var string
*/
protected $template = ''; protected $template = '';
/**
* Das Daten-Array, das in die Inhaltsbereiche des Templates gerendert wird
* @var array
*/
protected $data = array(); protected $data = array();
/**
* Ist der Inhalt bearbeitbar
* @var bool
*/
protected $isEditable = false;
/**
* StandardView constructor.
* Setzt den Pfad zum Template und die Daten
*
* @param array $data
* @param $template
*/
public function __construct(array $data, $template) public function __construct(array $data, $template)
{ {
$this->setTemplate($template); $this->setTemplate($template);
@@ -25,22 +47,46 @@ class StandardView
} }
private function setTemplate($template) /**
* @param $isEditable
*/
public function setEditable($isEditable)
{ {
if (file_exists(static::TPL_PATH . mb_strtolower($template) . '.phtml')) $this->isEditable = $isEditable;
{
$this->template = static::TPL_PATH . mb_strtolower($template) . '.phtml';
}
} }
/**
* Setzt den Pfad zum Template
*
* @param $template
* @throws \Exception
*/
private function setTemplate($template)
{
$templateFile = PATH_TPL . mb_strtolower($template) . '.phtml';
if (!file_exists($templateFile))
{
throw new \Exception('Template file "' . $templateFile . '" does not exist!');
}
$this->template = $templateFile;
}
/**
* Gibt das befüllte Template als HTML zurück
*
* @return string
*/
public function render() public function render()
{ {
ob_start(); ob_start();
include($this->template); include_once($this->template);
$pageContent = ob_get_contents();
$templateContent = ob_get_contents();
ob_end_clean(); ob_end_clean();
return $pageContent; return $templateContent;
} }
} }

View File

@@ -1,5 +1,5 @@
<?php <?php
if ($this->data['type'] === 'imageSmall') if ($this->data['type'] === 'small')
{ {
$imageClass = 'col-md-4'; $imageClass = 'col-md-4';
$textClass = 'col-md-8'; $textClass = 'col-md-8';
@@ -9,10 +9,18 @@
$imageClass = 'col-md-8'; $imageClass = 'col-md-8';
$textClass = 'col-md-4'; $textClass = 'col-md-4';
} }
$editorData = '';
if ($this->isEditable === true)
{
$editorData = ' data-editor="imageText" data-id="' . $this->data['ID'] . '" data-element="imageText_' . $this->data['ID'] . '"';
}
?> ?>
<div class="row">
<div class="<?php echo $imageClass; ?>"><img class="img-responsive" src="<?php echo HTML_IMG . $this->data['image']; ?>"/></div> <div class="row"<?php echo $editorData; ?>>
<div class="<?php echo $textClass; ?>"><?php echo nl2br($this->data['text']); ?></div> <div class="col-md-4 col-sm-6 col-xs-8 col-xs-offset-2 col-sm-offset-0"><img class="img-responsive" src="<?php echo HTML_IMG . $this->data['image']; ?>"/></div>
<div class="col-md-8 col-sm-6 col-xs-12">
<p><?php echo nl2br($this->data['text']); ?></p>
</div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="row">&nbsp;</div>

View File

@@ -1,57 +1,81 @@
<?php
if (strpos($this->data['headline'], "\n") !== false)
{
$headline = explode("\n", $this->data['headline']);
$headline[1] = '</h1><h3 class="col-md-offset-4 col-md-8">' . $headline[1] . '';
$this->data['headline'] = implode('', $headline);
}
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="de">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title><?php echo $this->data['title']; ?></title> <title><?php echo $this->data['title']; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php echo HTML_CSS; ?>bootstrap.min.css"> <link rel="stylesheet" href="<?php echo HTML_CSS; ?>bootstrap.min.css">
<link rel="stylesheet" href="<?php echo HTML_CSS; ?>bootstrap.min.css">
<link rel="stylesheet" href="<?php echo HTML_CSS; ?>bootstrap-theme.min.css"> <link rel="stylesheet" href="<?php echo HTML_CSS; ?>bootstrap-theme.min.css">
<link rel="stylesheet" href="<?php echo HTML_CSS; ?>ahd.css"> <link rel="stylesheet" href="<?php echo HTML_CSS; ?>ahd.min.css">
<script type="text/javascript" src="<?php echo HTML_JS; ?>jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="<?php echo HTML_JS; ?>jquery-ui-1.12.1.min.js"></script>
<script type="text/javascript" src="<?php echo HTML_JS; ?>bootstrap.min.js"></script>
<?php
if ($this->isEditable)
{
$registry = \Helper\Registry::getInstance();
$registry->editorConfig['navID'] = $this->data['navID'];
?>
<link rel="stylesheet" href="<?php echo $registry->editorConfig['editorUrl'] . $registry->editorConfig['editorVersion']; ?>/css/editor.min.css">
<script type="text/javascript">var csEditorParams = <?php echo json_encode($registry->editorConfig, JSON_UNESCAPED_UNICODE); ?>;</script>
<script type="text/javascript" src="<?php echo $registry->editorConfig['editorUrl'] . $registry->editorConfig['editorVersion']; ?>/editor.js.php?lang=<?php echo $_SESSION['lang']; ?>"></script>
<?php
}
?>
</head> </head>
<body> <body>
<nav class="navbar navbar-inverse navbar-fixed-top"> <header class="navbar navbar-fixed-top navbar-inverse">
<div class="container"> <div class="container">
<div class="navbar-header pull-left">
<button aria-controls="main-navbar" aria-expanded="false" class="navbar-toggle collapsed" data-target="#main-navbar" data-toggle="collapse" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<?php echo $this->data['navigation']; ?> <?php echo $this->data['navigation']; ?>
<div class="pull-right"> <div class="navbar-header pull-right">
<img src="<?php echo HTML_IMG; ?>subaru/subaru_logo.png"/> <div class="pull-right">
<img src="<?php echo HTML_IMG; ?>daihatsu/daihatsu_logo.png"/> <div class="subaru_logo pull-left"></div>
<div class="daihatsu_logo pull-right"></div>
</div>
</div> </div>
</div> </div>
</nav> </header>
<div class="container">
<div class="row">
<div class="col-md-12">
<img class="img-responsive" src="<?php echo HTML_IMG; ?>allradhaus/header/allradhaus_01.jpg"/>
</div>
</div>
</div>
<div class="container" id="content"> <div class="container" id="content">
<div class="row"><h1><span class="col-md-12"><?php echo nl2br($this->data['headline']); ?></span></h1></div> <?php
<div class="row">&nbsp;</div> echo $this->data['keyVisual'];
<?php echo $this->data['content']; ?> $editorData = '';
if ($this->isEditable === true)
{
$editorData = ' data-editor="headline" data-id="' . $this->data['navID'] . '" data-element="headline_' . $this->data['navID'] . '"';
}
?>
<div class="row"<?php echo $editorData; ?>><h1 class="col-md-12"><?php echo $this->data['headline']; ?></h1></div>
<div class="sortable">
<?php echo $this->data['content']; ?>
</div>
</div> </div>
<nav class="navbar navbar-inverse navbar-fixed-bottom"> <nav class="navbar navbar-inverse navbar-fixed-bottom">
<div class="container" id="footer"> <div class="container" id="footer">
<div class="row col-md-12"> <div class="row">
<div class="navbar-brand"> <div class="navbar-brand">
Kontakt <span class="caret"></span><br/>&nbsp;<br/>
<p> <p>
Kontakt <span class="caret"></span><br/>&nbsp;<br/>AHD Allradhaus GmbH<br/>Hauptstraße 45<br/>87466 Oy-Mittelberg<br/>Telefon 08366 / 232<br/>Telefax 08366 / 286 AHD Allradhaus GmbH<br/>Hauptstraße 45<br/>87466 Oy-Mittelberg<br/>Telefon 08366 / 232<br/>Telefax 08366 / 286
</p> </p>
</div> </div>
<div class="navbar-brand"> <div class="navbar-brand">
Öffnungszeiten <span class="caret"></span><br/>&nbsp;<br/>
<p> <p>
Öffnungszeiten <span class="caret"></span><br/>&nbsp;<br/>Montag - Freitag:<br/>8-12 Uhr und 13-17 Uhr<br/>Samstag:<br/>9-12 Uhr Montag - Freitag:<br/>8-12 Uhr und 13-17 Uhr<br/>&nbsp;<br/>Samstag:<br/>9-12 Uhr
</p> </p>
</div> </div>
<div class="navbar-brand pull-right"> <div class="navbar-brand ahd pull-right">
<img src="<?php echo HTML_IMG; ?>allradhaus/ahd_allradhaus_logo.png"><br/> <img src="<?php echo HTML_IMG; ?>allradhaus/ahd_allradhaus_logo.png"><br/>
<img class="center-block" src="<?php echo HTML_IMG; ?>allradhaus/ahd_allradhaus_raeder_gross.png"/> <img class="center-block" src="<?php echo HTML_IMG; ?>allradhaus/ahd_allradhaus_raeder_gross.png"/>
</div> </div>

73
templates/keyvisual.phtml Normal file
View File

@@ -0,0 +1,73 @@
<?php
if (isset($this->data['Type']))
{
$editorData = '';
if ($this->isEditable === true)
{
$editorData = ' data-editor="' . $this->data['Type'] . '" data-id="' . $this->data['navID'] . '" data-element="' . $this->data['Type'] . '_' . $this->data['navID'] . '"';
}
if ($this->data['Type'] === 'slider')
{
?>
<div class="row slider"<?php echo $editorData; ?>>
<div class="col-md-12">
<?php
foreach ($this->data as $key => $data)
{
if (!is_numeric($key))
{
continue;
}
else
{
?>
<img class="img-responsive" src="<?php echo HTML_MED . $this->data['navID'] . '/' . $data['imageName'] . '.' . $data['imageExtension']; ?>"/>
<?php
}
}
?>
</div>
</div>
<?php
}
elseif ($this->data['Type'] === 'kenburns')
{
?>
<div class="row kenburns"<?php echo $editorData; ?>>
<div class="col-md-12">
<?php
foreach ($this->data as $key => $data)
{
if (!is_numeric($key))
{
continue;
}
else
{
?>
<img class="img-responsive" src="<?php echo HTML_MED . $this->data['navID'] . '/' . $data['imageName'] . '.' . $data['imageExtension']; ?>" data-zoom="<?php echo $data['imageZoom']; ?>" data-direction="<?php echo $data['imageZoomDirection']; ?>"/>
<?php
}
}
?>
</div>
</div>
<?php
}
elseif ($this->data['Type'] === 'single')
{
?>
<div class="row"<?php echo $editorData; ?>>
<div class="col-md-12">
<img class="img-responsive" src="<?php echo HTML_MED . $this->data['navID'] . '/' . $this->data[0]['imageName'] . '.' . $this->data[0]['imageExtension']; ?>"/>
</div>
</div>
<?php
}
}