Erste lauffähige Umgebung
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
namespace Controller;
|
||||
|
||||
use Helper\Database;
|
||||
use Helper\Registry;
|
||||
use Model\NavigationModel;
|
||||
use View\NavigationView;
|
||||
use View\StandardView;
|
||||
@@ -45,19 +46,18 @@ class FrontendController
|
||||
$navigation->setEditable($this->isEditable);
|
||||
$navigation->init();
|
||||
|
||||
$registry = Registry::getInstance();
|
||||
$registry->navID = NavigationModel::getActiveNavID();
|
||||
$registry->navigationPath = NavigationModel::getNavigationPath();
|
||||
|
||||
$this->contents['title'] = NavigationModel::getTitle();
|
||||
$this->contents['navigation'] = $navigation->render();
|
||||
|
||||
$this->contents['headline'] = NavigationModel::getHeadline();
|
||||
$this->contents['navID'] = NavigationModel::getActiveNavID();
|
||||
$this->contents['content'] = '';
|
||||
$this->contents['keyVisual'] = '';
|
||||
|
||||
$tmpKeyVisual = NavigationModel::getKeyVisual();
|
||||
foreach ($tmpKeyVisual as $data)
|
||||
{
|
||||
$this->contents['keyVisual'] .= $this->buildContents($data);
|
||||
}
|
||||
$keyVisual = NavigationModel::getKeyVisual();
|
||||
$this->contents['keyVisual'] = $this->buildContents($keyVisual);
|
||||
|
||||
$tmpContents = NavigationModel::getContents();
|
||||
/**
|
||||
@@ -80,9 +80,18 @@ class FrontendController
|
||||
*/
|
||||
protected function buildContents(array $data)
|
||||
{
|
||||
/**
|
||||
* Abfangen von nicht behandelbaren Abfragen durch den mod_rewrite
|
||||
* z.B. nicht vorhandene Bilder
|
||||
*/
|
||||
if (!isset($data['Controller']))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
/**
|
||||
* @var Database $modelClass
|
||||
*/
|
||||
$modelData = array();
|
||||
$modelClass = 'Model\\' . $data['Controller'] . 'Model';
|
||||
$viewClass = 'View\\' . $data['Controller'] . 'View';
|
||||
if (class_exists($modelClass, true))
|
||||
@@ -99,7 +108,6 @@ class FrontendController
|
||||
$modelClass::setFilter($data['IDs']);
|
||||
$modelData = $modelClass::getIndex();
|
||||
$modelData = array_merge($modelData, $tmpModelData);
|
||||
$modelData['navID'] = $this->contents['navID'];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -109,6 +117,13 @@ class FrontendController
|
||||
*/
|
||||
return '';
|
||||
}
|
||||
if (empty($modelData))
|
||||
{
|
||||
/**
|
||||
* TODO: ErrorHandler bauen
|
||||
*/
|
||||
return '';
|
||||
}
|
||||
if (class_exists($viewClass, true))
|
||||
{
|
||||
$dataView = new $viewClass($modelData, $data['Controller']);
|
||||
|
||||
@@ -36,6 +36,19 @@ class Database
|
||||
*/
|
||||
static $filter = '1=1';
|
||||
|
||||
/**
|
||||
* Die Beziehung einer Datenbank-Tabelle zu einer anderen
|
||||
* $relations = array(
|
||||
* 0 => array(
|
||||
* 'ownKey' => 'Spaltenname der eigenen Tabelle',
|
||||
* 'foreignTable' => 'Tabellenname der "Fremd"-Tabelle',
|
||||
* 'foreignKey' => 'Spaltenname der "Fremd"-Tabelle
|
||||
* ),
|
||||
* );
|
||||
* @var array
|
||||
*/
|
||||
static $relations = array();
|
||||
|
||||
/**
|
||||
* Hier werden die Daten von getIndex() gespeichert
|
||||
* @var array
|
||||
@@ -48,18 +61,68 @@ class Database
|
||||
protected static $db = null;
|
||||
|
||||
|
||||
/**
|
||||
* Konstruktor schützen, weil Singleton
|
||||
* @author Christian Steinle
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected function __clone()
|
||||
/**
|
||||
* Liefert ein mehrdimensionales, assoziatives Array mit allen Datensätzen, die zum Filter passen
|
||||
* als Schlüssel der ersten Dimension dient der Wert des Primär-Schlüssels der Datenbank-Tabelle
|
||||
* Legt alle Daten in self::$data ab
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @see self::query()
|
||||
* @see self::$data
|
||||
*
|
||||
* TODO: getIndex für static::$relations analog zu getItem
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public static function getIndex()
|
||||
{
|
||||
static::setRelations();
|
||||
$sql = 'SELECT * FROM ' . static::TBL_NAME . ' WHERE ' . static::$filter . ' ' . static::ORDER_BY . ';';
|
||||
self::$data = self::query($sql);
|
||||
return self::$data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt die Variable zur Verbindung verschiedener Datenbank-Tabellen
|
||||
*/
|
||||
public static function setRelations()
|
||||
{
|
||||
static::$relations = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert ein mehrdimensionales, assoziatives Array mit allen Datensätzen, die zum SQL-Query passen
|
||||
* als Schlüssel der ersten Dimension dient der Wert des Primär-Schlüssels der Datenbank-Tabelle
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param string $sql
|
||||
* @return array
|
||||
*/
|
||||
final protected static function query($sql)
|
||||
{
|
||||
self::getInstance();
|
||||
$result = self::$db->query($sql);
|
||||
$data = array();
|
||||
|
||||
while ($tmpData = $result->fetch_assoc())
|
||||
{
|
||||
$data[$tmpData[static::PRIMARY_KEY]] = $tmpData;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stellt die Datenbank-Verbindung her
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
@@ -72,56 +135,254 @@ class Database
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Macht das Update für den Eintrag in einer Datenbank-Tabelle
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $request
|
||||
* @return int
|
||||
*/
|
||||
final public static function update(array $request)
|
||||
{
|
||||
static::beforeUpdate($request);
|
||||
static::setRelations();
|
||||
|
||||
/**
|
||||
* @var Database $class
|
||||
*/
|
||||
foreach (static::$relations as $relation)
|
||||
{
|
||||
$class = $relation['foreignModel'];
|
||||
$request[$relation['ownKey']] = $class::update($request);
|
||||
}
|
||||
|
||||
|
||||
$primaryKey = intval($request[static::PRIMARY_KEY]);
|
||||
unset($request[static::PRIMARY_KEY]);
|
||||
|
||||
$model = self::queryModel(static::TBL_NAME, true);
|
||||
$updateData = array();
|
||||
|
||||
foreach ($request as $fieldName => $fieldValue)
|
||||
{
|
||||
if (in_array($fieldName, $model))
|
||||
{
|
||||
$updateData[] = $fieldName . ' = "' . self::$db->real_escape_string($fieldValue) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($updateData))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . static::TBL_NAME . ' SET ' . implode(', ', $updateData) . ' WHERE ' . static::PRIMARY_KEY . ' = ' . $primaryKey . ' LIMIT 1;';
|
||||
$result = self::$db->query($sql);
|
||||
if ($result !== true)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $primaryKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die Spalten einer Datenbank-Tabelle
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param bool $fieldsOnly
|
||||
* @return array
|
||||
*/
|
||||
final protected static function queryModel($tableName, $fieldsOnly = false)
|
||||
{
|
||||
self::getInstance();
|
||||
$sql = 'SHOW COLUMNS FROM ' . $tableName . ';';
|
||||
$result = self::$db->query($sql);
|
||||
$data = array();
|
||||
|
||||
while ($tmpData = $result->fetch_assoc())
|
||||
{
|
||||
if ($fieldsOnly === true)
|
||||
{
|
||||
$data[] = $tmpData['Field'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data[] = $tmpData;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schreibt einen neuen Eintrag in einer Datenbank-Tabelle
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $request
|
||||
* @return int
|
||||
*/
|
||||
final public static function insert(array $request)
|
||||
{
|
||||
static::beforeInsert($request);
|
||||
static::setRelations();
|
||||
|
||||
/**
|
||||
* @var Database $class
|
||||
*/
|
||||
foreach (static::$relations as $relation)
|
||||
{
|
||||
$class = $relation['foreignModel'];
|
||||
$request[$relation['ownKey']] = $class::insert($request);
|
||||
}
|
||||
|
||||
$model = self::queryModel(static::TBL_NAME, true);
|
||||
$updateData = array();
|
||||
|
||||
foreach ($request as $fieldName => $fieldValue)
|
||||
{
|
||||
if (in_array($fieldName, $model))
|
||||
{
|
||||
$updateData[$fieldName] = '"' . self::$db->real_escape_string($fieldValue) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($updateData))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
$keys = implode(', ', array_keys($updateData));
|
||||
$values = implode(', ', $updateData);
|
||||
$sql = 'INSERT INTO ' . static::TBL_NAME . ' (' . $keys . ') VALUES (' . $values . ');';
|
||||
$result = self::$db->query($sql);
|
||||
|
||||
if ($result !== true)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return self::$db->insert_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entfernt einen Eintrag aus einer Datenbank-Tabelle
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param int $id
|
||||
* @return int
|
||||
*/
|
||||
final public static function delete($id)
|
||||
{
|
||||
static::beforeDelete($id);
|
||||
static::setRelations();
|
||||
|
||||
if (!empty(static::$relations))
|
||||
{
|
||||
$data = static::getItem($id);
|
||||
|
||||
/**
|
||||
* @var Database $class
|
||||
*/
|
||||
foreach (static::$relations as $relation)
|
||||
{
|
||||
$class = $relation['foreignModel'];
|
||||
$relationID = intval($data[$relation['foreignKey']]);
|
||||
$class::delete($relationID);
|
||||
}
|
||||
}
|
||||
|
||||
$query = 'DELETE FROM ' . static::TBL_NAME . ' WHERE ' . static::PRIMARY_KEY . ' = ' . $id . ' LIMIT 1;';
|
||||
$result = self::$db->query($query);
|
||||
|
||||
return (($result) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert ein assoziatives Array des Datensatzes mit der übergebenen ID
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
final public static function getItem($id)
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . static::TBL_NAME . ' WHERE ' . static::PRIMARY_KEY . ' = ' . $id . ';';
|
||||
static::setRelations();
|
||||
|
||||
if (empty(static::$relations))
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . static::TBL_NAME . ' WHERE ' . static::PRIMARY_KEY . ' = ' . $id . ';';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tables = array(static::TBL_NAME);
|
||||
$matches = array();
|
||||
foreach (static::$relations as $relation)
|
||||
{
|
||||
$class = $relation['foreignModel'];
|
||||
$tables[] = $class::TBL_NAME;
|
||||
$matches[] = static::TBL_NAME . '.' . $relation['ownKey'] . ' = ' . $class::TBL_NAME . '.' . $relation['foreignKey'];
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM ' . implode(', ', $tables) . ' WHERE ' . static::PRIMARY_KEY . ' = ' . $id . ' AND ' . implode(' AND ', $matches);
|
||||
}
|
||||
|
||||
$data = self::query($sql);
|
||||
return (!is_array($data) || empty($data)) ? array() : current($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liefert ein mehrdimensionales, assoziatives Array mit allen Datensätzen, die zum Filter passen
|
||||
* als Schlüssel der ersten Dimension dient der Wert des Primär-Schlüssels der Datenbank-Tabelle
|
||||
* Legt alle Daten in self::$data ab
|
||||
* Setzt den Filter für die Datenbank zur späteren Verwendung
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @see self::query()
|
||||
* @see self::$data
|
||||
*
|
||||
* @return array
|
||||
* @param string $filter
|
||||
*/
|
||||
final public static function getIndex()
|
||||
public static function setFilter($filter)
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . static::TBL_NAME . ' WHERE ' . static::$filter . ' ' . static::ORDER_BY . ';';
|
||||
self::$data = self::query($sql);
|
||||
return self::$data;
|
||||
static::$filter = $filter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liefert ein mehrdimensionales, assoziatives Array mit allen Datensätzen, die zum SQL-Query passen
|
||||
* als Schlüssel der ersten Dimension dient der Wert des Primär-Schlüssels der Datenbank-Tabelle
|
||||
* Funktion, die vor dem Erstellen eines Datenbank-Eintrags ausgeführt wird
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param string $sql
|
||||
* @return array
|
||||
* @param array $request
|
||||
*/
|
||||
final protected static function query($sql)
|
||||
protected static function beforeInsert(array &$request)
|
||||
{
|
||||
self::getInstance();
|
||||
$result = self::$db->query($sql);
|
||||
$data = array();
|
||||
while ($tmpData = $result->fetch_assoc())
|
||||
{
|
||||
$data[$tmpData[static::PRIMARY_KEY]] = $tmpData;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
/**
|
||||
* Funktion, die vor dem Löschen eines Datenbank-Eintrags ausgeführt wird
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
protected static function beforeDelete($id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Funktion, die vor dem Update eines Datenbank-Eintrags ausgeführt wird
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $request
|
||||
*/
|
||||
protected static function beforeUpdate(array &$request)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Schützen, um das Klonen des Singletons zu vermeiden
|
||||
* @author Christian Steinle
|
||||
*/
|
||||
final protected function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
23
rendering/Helper/Text.php
Normal file
23
rendering/Helper/Text.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by CS medien- & kommunikationssysteme.
|
||||
* @author Christian Steinle
|
||||
* @date 04.12.2016
|
||||
*
|
||||
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
|
||||
*/
|
||||
|
||||
namespace Helper;
|
||||
|
||||
|
||||
class Text
|
||||
{
|
||||
public static function prepareText($text)
|
||||
{
|
||||
$text = str_replace(array("\r\n", "\r", "\n"), '', $text);
|
||||
$text = trim(preg_replace('/<p>/', '', $text, 1));
|
||||
$text = preg_replace('/>p\/</', '', strrev($text), 1);
|
||||
$text = strrev($text);
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,359 @@ namespace Model;
|
||||
|
||||
|
||||
use Helper\Database;
|
||||
use Helper\Registry;
|
||||
|
||||
class ImageModel extends Database
|
||||
{
|
||||
const TBL_NAME = TBL_IMAGE;
|
||||
|
||||
const PRIMARY_KEY = 'ID';
|
||||
const PRIMARY_KEY = 'imageID';
|
||||
|
||||
const ORDER_BY = '';
|
||||
|
||||
/**
|
||||
* Erzeugt die benötigten Bilder im Medien-Pfad und bereitet den Request auf
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $request
|
||||
*/
|
||||
protected static function beforeInsert(array &$request)
|
||||
{
|
||||
if (isset($request['imageTextModel']) && $request['imageTextModel'] === true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$registry = Registry::getInstance();
|
||||
$navID = $request['navID'];
|
||||
unset($request['navID']);
|
||||
|
||||
$mediaPath = $registry->editorConfig['mediaPath'] . $navID . '/';
|
||||
if (!is_dir($mediaPath))
|
||||
{
|
||||
mkdir($mediaPath, 0775, true);
|
||||
}
|
||||
|
||||
ImageModel::createOrigImage($mediaPath, $request);
|
||||
ImageModel::createWebImage($mediaPath, $request, 'keyVisual');
|
||||
}
|
||||
|
||||
/**
|
||||
* Erzeugt einen Unique-Filename in einem vorgegebenen Pfad
|
||||
* @author Christian Steinle
|
||||
* @param string $path
|
||||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
public static function getUniqueFilename($path, $filename)
|
||||
{
|
||||
$filenameArray = self::filenameToArray($filename);
|
||||
$filesInPath = glob($path . $filenameArray['filename'] . '*_orig.' . $filenameArray['extension']);
|
||||
if (count($filesInPath) === 0)
|
||||
{
|
||||
return $filenameArray['filename'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$newFilename = $filenameArray['filename'] . '_' . count($filesInPath);
|
||||
return $newFilename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert ein Array zum übergebenen Dateinamen
|
||||
* - 'filename' => Dateiname ohne Erweiterung
|
||||
* - 'extension' => Datei-Erweiterung
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param string $filename
|
||||
* @return array
|
||||
*/
|
||||
public static function filenameToArray($filename)
|
||||
{
|
||||
$tmpData = explode('.', $filename, -1);
|
||||
$newFilename = implode('.', $tmpData);
|
||||
$extension = str_replace($newFilename . '.', '', $filename);
|
||||
return array('filename' => $newFilename, 'extension' => $extension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Kopiert das Standard-Bild oder -KeyVisual
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param string $newPath
|
||||
* @param string $filename
|
||||
* @param string $type
|
||||
*/
|
||||
public static function copyStandardImage($newPath, $filename, $type)
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
switch ($type)
|
||||
{
|
||||
case 'image':
|
||||
$imageData = $registry->editorConfig['imageDimension']['image'];
|
||||
break;
|
||||
|
||||
case 'keyVisual':
|
||||
$imageData = $registry->editorConfig['imageDimension']['keyVisual'];
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_dir($newPath))
|
||||
{
|
||||
mkdir($newPath, 0777, true);
|
||||
}
|
||||
|
||||
$standardImagePath = substr(str_replace(PATH_PREFIX, '', PATH_ROOT), 0, -1) . $imageData['standardImage'];
|
||||
$filenameArray = self::filenameToArray($filename);
|
||||
|
||||
copy($standardImagePath, $newPath . $filename);
|
||||
copy($standardImagePath, $newPath . $filenameArray['filename'] . '_orig.' . $filenameArray['extension']);
|
||||
self::createThumb($newPath, $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt ein Thumbnail von einem Bild
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $file
|
||||
*/
|
||||
public static function createThumb($path, $file)
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
$imageData = $registry->editorConfig['imageDimension']['thumb'];
|
||||
$newWidth = $imageData['width'];
|
||||
$newQuality = $imageData['quality'];
|
||||
$filenameArray = self::filenameToArray($file);
|
||||
|
||||
list($width, $height) = getimagesize($path . $file);
|
||||
$newHeight = $height * $newWidth / $width;
|
||||
|
||||
$newImage = imagecreatetruecolor($newWidth, $newHeight);
|
||||
switch ($filenameArray['extension'])
|
||||
{
|
||||
case 'jpg':
|
||||
$origImage = imagecreatefromjpeg($path . $file);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
imagejpeg($newImage, $path . $filenameArray['filename'] . '_thumb.jpg', $newQuality);
|
||||
break;
|
||||
|
||||
case 'png':
|
||||
$origImage = imagecreatefrompng($path . $file);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
imagepng($newImage, $path . $filenameArray['filename'] . '_thumb.png');
|
||||
break;
|
||||
|
||||
case 'gif':
|
||||
$origImage = imagecreatefromgif($path . $file);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
imagegif($newImage, $path . $filenameArray['filename'] . '_thumb.gif');
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht vorhandene Bilder vor entfernen aus der Datenbank
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
protected static function beforeDelete($id)
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
$data = self::getItem($id);
|
||||
|
||||
$mediaPath = $registry->editorConfig['mediaPath'] . $registry->navID . '/';
|
||||
ImageModel::deleteImages($mediaPath, $data['imageName'], $data['imageExtension']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht die Bilder aus dem Medienpfad
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param $mediaPath
|
||||
* @param $imageName
|
||||
* @param $imageExtension
|
||||
*/
|
||||
public static function deleteImages($mediaPath, $imageName, $imageExtension)
|
||||
{
|
||||
unlink($mediaPath . $imageName . '.' . $imageExtension);
|
||||
unlink($mediaPath . $imageName . '_orig.' . $imageExtension);
|
||||
unlink($mediaPath . $imageName . '_thumb.' . $imageExtension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verschiebt / Erzeugt Bilder und generiert Derivate
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $request
|
||||
*/
|
||||
protected static function beforeUpdate(array &$request)
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
$mediaPath = $registry->editorConfig['mediaPath'] . $registry->navID . '/';
|
||||
|
||||
$imageType = 'image';
|
||||
if (isset($request['keyVisualID']))
|
||||
{
|
||||
$imageType = 'keyVisual';
|
||||
}
|
||||
|
||||
$oldData = self::getItem($request[static::PRIMARY_KEY]);
|
||||
|
||||
if (isset($_FILES['changeUploadFile']) && $_FILES['changeUploadFile']['tmp_name'] !== '' && $_FILES['changeUploadFile']['error'] === 0)
|
||||
{
|
||||
ImageModel::deleteImages($mediaPath, $oldData['imageName'], $oldData['imageExtension']);
|
||||
$request['imageName'] = ImageModel::getUniqueFilename($mediaPath, $request['imageName'] . '.' . $request['imageExtension']);
|
||||
ImageModel::createOrigImage($mediaPath, $request);
|
||||
ImageModel::createWebImage($mediaPath, $request, $imageType);
|
||||
}
|
||||
elseif (isset($_FILES['changeUploadFile']) && $_FILES['changeUploadFile']['tmp_name'] === '' && $oldData['imageName'] !== $request['imageName'])
|
||||
{
|
||||
$request['imageName'] = ImageModel::getUniqueFilename($mediaPath, $request['imageName'] . '.' . $request['imageExtension']);
|
||||
rename($mediaPath . $oldData['imageName'] . '_orig.' . $oldData['imageExtension'], $mediaPath . $request['imageName'] . '_orig.' . $request['imageExtension']);
|
||||
rename($mediaPath . $oldData['imageName'] . '.' . $oldData['imageExtension'], $mediaPath . $request['imageName'] . '.' . $request['imageExtension']);
|
||||
rename($mediaPath . $oldData['imageName'] . '_thumb.' . $oldData['imageExtension'], $mediaPath . $request['imageName'] . '_thumb.' . $request['imageExtension']);
|
||||
}
|
||||
|
||||
if (isset($_FILES['changeUploadFile']) &&
|
||||
$_FILES['changeUploadFile']['tmp_name'] === '' &&
|
||||
(abs($oldData['imageTop'] - $request['imageTop']) > .5 ||
|
||||
abs($oldData['imageLeft'] - $request['imageLeft']) > .5 ||
|
||||
abs($oldData['imageHeight'] - $request['imageHeight']) > .5 ||
|
||||
abs($oldData['imageWidth'] - $request['imageWidth']) > .5)
|
||||
)
|
||||
{
|
||||
unlink($mediaPath . $request['imageName'] . '.' . $request['imageExtension']);
|
||||
unlink($mediaPath . $request['imageName'] . '_thumb.' . $request['imageExtension']);
|
||||
ImageModel::createWebImage($mediaPath, $request, $imageType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Legt ein hochgeladenes Bild im Medienpfad ab und verkleinert es, falls die Abmessungen zu groß sind
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param $mediaPath
|
||||
* @param $request
|
||||
*/
|
||||
public static function createOrigImage($mediaPath, &$request)
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
$origData = $registry->editorConfig['imageDimension']['orig'];
|
||||
|
||||
$tmpName = $request['imageName'] . '__tmp__.' . $request['imageExtension'];
|
||||
|
||||
if (!is_dir($mediaPath))
|
||||
{
|
||||
mkdir($mediaPath, 0777, true);
|
||||
}
|
||||
|
||||
move_uploaded_file($_FILES['changeUploadFile']['tmp_name'], $mediaPath . $tmpName);
|
||||
|
||||
list($width, $height) = getimagesize($mediaPath . $tmpName);
|
||||
if ($width > $origData['width'] || $height > $origData['height'])
|
||||
{
|
||||
$newWidth = $origData['width'];
|
||||
$newHeight = $height * $newWidth / $width;
|
||||
|
||||
$newImage = imagecreatetruecolor($newWidth, $newHeight);
|
||||
switch ($request['imageExtension'])
|
||||
{
|
||||
case 'jpg':
|
||||
$origImage = imagecreatefromjpeg($mediaPath . $tmpName);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
imagejpeg($newImage, $mediaPath . $request['imageName'] . '_orig.jpg', $origData['quality']);
|
||||
break;
|
||||
|
||||
case 'png':
|
||||
$origImage = imagecreatefrompng($mediaPath . $tmpName);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
imagepng($newImage, $mediaPath . $request['imageName'] . '_orig.png');
|
||||
break;
|
||||
|
||||
case 'gif':
|
||||
$origImage = imagecreatefromgif($mediaPath . $tmpName);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
imagegif($newImage, $mediaPath . $request['imageName'] . '_orig.gif');
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
unlink($mediaPath . $tmpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
rename($mediaPath . $tmpName, $mediaPath . $request['imageName'] . '_orig.' . $request['imageExtension']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Erzeugt das WebImage mit dem passenden Ausschnitt aus dem Original
|
||||
* @author Christian Steinle
|
||||
* TODO: Transparenz bei pngs
|
||||
*
|
||||
* @param $mediaPath
|
||||
* @param $request
|
||||
* @param $type
|
||||
*/
|
||||
public static function createWebImage($mediaPath, $request, $type)
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
switch ($type)
|
||||
{
|
||||
case 'image':
|
||||
$imageData = $registry->editorConfig['imageDimension']['image'];
|
||||
break;
|
||||
|
||||
case 'keyVisual':
|
||||
$imageData = $registry->editorConfig['imageDimension']['keyVisual'];
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
$origName = $request['imageName'] . '_orig.' . $request['imageExtension'];
|
||||
$webName = $request['imageName'] . '.' . $request['imageExtension'];
|
||||
list($width, $height) = getimagesize($mediaPath . $origName);
|
||||
$newWidth = $imageData['width'];
|
||||
$newHeight = $newWidth * $request['imageHeight'] / $request['imageWidth'];
|
||||
|
||||
$newImage = imagecreatetruecolor($newWidth, $newHeight);
|
||||
switch ($request['imageExtension'])
|
||||
{
|
||||
case 'jpg':
|
||||
$origImage = imagecreatefromjpeg($mediaPath . $origName);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, $request['imageLeft'] * $width / $newWidth, $request['imageTop'] * $width / $newWidth, $newWidth, $newHeight, $width * $request['imageWidth'] / $newWidth, $width * $request['imageWidth'] * $newHeight / ($newWidth * $newWidth));
|
||||
imagejpeg($newImage, $mediaPath . $webName, $imageData['quality']);
|
||||
break;
|
||||
|
||||
case 'png':
|
||||
$origImage = imagecreatefrompng($mediaPath . $origName);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
imagepng($newImage, $mediaPath . $webName);
|
||||
break;
|
||||
|
||||
case 'gif':
|
||||
$origImage = imagecreatefromgif($mediaPath . $origName);
|
||||
imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
imagegif($newImage, $mediaPath . $webName);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
self::createThumb($mediaPath, $webName);
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,65 @@ namespace Model;
|
||||
|
||||
|
||||
use Helper\Database;
|
||||
use Helper\Registry;
|
||||
|
||||
class ImageTextModel extends Database
|
||||
{
|
||||
const TBL_NAME = TBL_IMAGE_TEXT;
|
||||
|
||||
const PRIMARY_KEY = 'ID';
|
||||
const PRIMARY_KEY = 'imageTextID';
|
||||
|
||||
|
||||
/**
|
||||
* Setzt die Relationen zu anderen Modellen
|
||||
* @author Christian Steinle
|
||||
*/
|
||||
public static function setRelations()
|
||||
{
|
||||
static::$relations = array(
|
||||
0 => array(
|
||||
'ownKey' => 'imageID',
|
||||
'foreignModel' => 'Model\\ImageModel',
|
||||
'foreignKey' => 'imageID'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Erzeugt die benötigten Bilder im Medien-Pfad und bereitet den Request auf
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $request
|
||||
*/
|
||||
protected static function beforeInsert(array &$request)
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
$imageData = $registry->editorConfig['imageDimension']['image'];
|
||||
$standardImagePath = substr(str_replace(PATH_PREFIX, '', PATH_ROOT), 0, -1) . $imageData['standardImage'];
|
||||
$navID = $request['navID'];
|
||||
unset($request['navID']);
|
||||
|
||||
$mediaPath = $registry->editorConfig['mediaPath'] . $navID . '/';
|
||||
if (!is_dir($mediaPath))
|
||||
{
|
||||
mkdir($mediaPath, 0775, true);
|
||||
}
|
||||
|
||||
$filename = end(explode('/', $standardImagePath));
|
||||
$newFilename = ImageModel::getUniqueFilename($mediaPath, $filename);
|
||||
$fileArray = ImageModel::filenameToArray($filename);
|
||||
$request['imageOrigName'] = $fileArray['filename'];
|
||||
$request['imageExtension'] = $fileArray['extension'];
|
||||
$request['imageName'] = $newFilename;
|
||||
list($width, $height) = getimagesize($standardImagePath);
|
||||
$request['imageTop'] = 0;
|
||||
$request['imageLeft'] = 0;
|
||||
$request['imageHeight'] = $height;
|
||||
$request['imageWidth'] = $width;
|
||||
$request['imageTextModel'] = true;
|
||||
ImageModel::copyStandardImage($mediaPath, $newFilename . '.' . $fileArray['extension'], 'image');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace Model;
|
||||
|
||||
|
||||
use Helper\Database;
|
||||
use Helper\Registry;
|
||||
|
||||
class NavigationModel extends Database
|
||||
{
|
||||
@@ -39,6 +40,8 @@ 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
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $routeParts
|
||||
* @param bool $isEditable
|
||||
*/
|
||||
@@ -56,6 +59,13 @@ class NavigationModel extends Database
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialisierung für das Backend ohne ModRewrite
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param int $siteID
|
||||
* @param int $depth
|
||||
*/
|
||||
protected static function initBackend($siteID, $depth)
|
||||
{
|
||||
foreach (self::$data as $navID => $navItem)
|
||||
@@ -74,6 +84,9 @@ class NavigationModel extends Database
|
||||
}
|
||||
|
||||
/**
|
||||
* Umbau der Datenbank-Tabellenwerte in ein Mehrdimensionales Array
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param string $navKeyVisual
|
||||
*/
|
||||
protected static function initKeyVisual($navKeyVisual)
|
||||
@@ -89,6 +102,9 @@ class NavigationModel extends Database
|
||||
}
|
||||
|
||||
/**
|
||||
* Umbau der Datenbank-Tabellenwerte in ein Mehrdimensionales Array
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param string $navContents
|
||||
*/
|
||||
protected static function initContent($navContents)
|
||||
@@ -103,6 +119,11 @@ class NavigationModel extends Database
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Baut den Navigationspfad als Array
|
||||
* @author Christian Steinle
|
||||
*/
|
||||
protected static function buildNavigationPath()
|
||||
{
|
||||
$navStart = $navStartPath[] = self::$activeNavID;
|
||||
@@ -110,13 +131,22 @@ class NavigationModel extends Database
|
||||
{
|
||||
$navStart = $navStartPath[] = self::$data[$navStart]['navStart'];
|
||||
}
|
||||
$navStartPath[] = '0';
|
||||
array_pop($navStartPath);
|
||||
self::$navigationPath = array_reverse($navStartPath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialisiert das Frontend unter Verwendung des ModRewrites
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $routeParts
|
||||
*/
|
||||
protected static function initFrontend(array $routeParts)
|
||||
{
|
||||
$navStart = 0;
|
||||
self::$navigationPath[] = 0;
|
||||
foreach ($routeParts as $navLink)
|
||||
{
|
||||
foreach (self::$data as $navID => $navItem)
|
||||
@@ -134,7 +164,10 @@ class NavigationModel extends Database
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liefert den Navigationspfad als Array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getNavigationPath()
|
||||
@@ -144,6 +177,8 @@ class NavigationModel extends Database
|
||||
|
||||
|
||||
/**
|
||||
* Liefert die NavigationsID des aktuellen gewählten Menüpunkts
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function getActiveNavID()
|
||||
@@ -153,6 +188,7 @@ class NavigationModel extends Database
|
||||
|
||||
|
||||
/**
|
||||
* Liefert den Seiten-Titel
|
||||
* @return string
|
||||
*/
|
||||
public static function getTitle()
|
||||
@@ -162,6 +198,7 @@ class NavigationModel extends Database
|
||||
|
||||
|
||||
/**
|
||||
* Liefert das Array für das KeyVisual
|
||||
* @return array
|
||||
*/
|
||||
public static function getKeyVisual()
|
||||
@@ -171,6 +208,7 @@ class NavigationModel extends Database
|
||||
|
||||
|
||||
/**
|
||||
* Liefert die Überschrift der Seite
|
||||
* @return string
|
||||
*/
|
||||
public static function getHeadline()
|
||||
@@ -180,6 +218,7 @@ class NavigationModel extends Database
|
||||
|
||||
|
||||
/**
|
||||
* Liefert die Seiteninhalte
|
||||
* @return array
|
||||
*/
|
||||
public static function getContents()
|
||||
@@ -189,10 +228,145 @@ class NavigationModel extends Database
|
||||
|
||||
|
||||
/**
|
||||
* Liefert die Navigationsdaten als flaches Array
|
||||
* @return array
|
||||
*/
|
||||
public static function getData()
|
||||
{
|
||||
return self::$data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liefert die Navigationsdaten, sortiert nach ihrem Elternknoten
|
||||
* @return array
|
||||
*/
|
||||
public static function getStructuredIndex()
|
||||
{
|
||||
$tmpData = self::getIndex();
|
||||
$structuredData = array();
|
||||
foreach ($tmpData as $navID => $navData)
|
||||
{
|
||||
$structuredData['navStart_' . $navData['navStart']]['navID_' . $navID] = $navData;
|
||||
}
|
||||
return $structuredData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liefert einen Link, der innerhalb des NavStarts unique ist
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param int $navStart
|
||||
* @param string $navName
|
||||
* @return string
|
||||
*/
|
||||
public static function getUniqueNavLink($navStart, $navName)
|
||||
{
|
||||
$commonReplacements = array('ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue', 'ß' => 'ss', ' ' => '_', '"', '', '\'' => '');
|
||||
$registry = Registry::getInstance();
|
||||
$replacements = $registry->editorConfig['linkReplacements'];
|
||||
$navLink = trim(str_replace($replacements, '', $navName));
|
||||
$navLink = mb_convert_case($navLink, MB_CASE_LOWER);
|
||||
$navLink = str_replace(array_keys($commonReplacements), array_values($commonReplacements), $navLink);
|
||||
|
||||
self::$filter = 'navStart = ' . $navStart;
|
||||
$existingNavLinks = 0;
|
||||
$tmpData = self::getIndex();
|
||||
|
||||
foreach ($tmpData as $navPoint)
|
||||
{
|
||||
if ($navPoint['navLink'] == $navLink)
|
||||
{
|
||||
++$existingNavLinks;
|
||||
}
|
||||
}
|
||||
|
||||
if ($existingNavLinks === 0)
|
||||
{
|
||||
return $navLink;
|
||||
}
|
||||
return $navLink . '_' . $existingNavLinks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sortiert die Navigationspunkte eines übergebenen Elternelements
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $navPointData
|
||||
* @return int
|
||||
*/
|
||||
public static function updateSortAfterInsert(array $navPointData)
|
||||
{
|
||||
if (!isset($navPointData['navStart']) || $navPointData['navStart'] === '')
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
self::$filter = 'navStart = ' . $navPointData['navStart'];
|
||||
$sortOrder = $navPointData['navSort'];
|
||||
$tmpData = self::getIndex();
|
||||
unset($tmpData[$navPointData['navID']]);
|
||||
if ($sortOrder != 0)
|
||||
{
|
||||
array_splice($tmpData, 0, $sortOrder);
|
||||
}
|
||||
|
||||
foreach($tmpData as $navData)
|
||||
{
|
||||
++$sortOrder;
|
||||
self::update(array('navID' => $navData['navID'], 'navSort' => $sortOrder));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sortiert die Navigationspunkte eines Elternelements um
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param $sortData
|
||||
* @return int
|
||||
*/
|
||||
public static function updateSort($sortData)
|
||||
{
|
||||
foreach($sortData as $navSort => $navID)
|
||||
{
|
||||
self::update(array('navID' => $navID, 'navSort' => $navSort));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Legt die Bilddaten des Keyvisuals an, und liefert den passenden JSON-String für den Eintrag in die Datenbank-Tabelle
|
||||
* @author Christian Steinle
|
||||
*
|
||||
* @param array $request
|
||||
*/
|
||||
protected static function beforeInsert(&$request)
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
$imageData = $registry->editorConfig['imageDimension']['keyVisual'];
|
||||
$standardImagePath = substr(str_replace(PATH_PREFIX, '', PATH_ROOT), 0, -1) . $imageData['standardImage'];
|
||||
|
||||
$filename = end(explode('/', $standardImagePath));
|
||||
$fileArray = ImageModel::filenameToArray($filename);
|
||||
$imageData = array();
|
||||
$imageData['imageOrigName'] = $fileArray['filename'];
|
||||
$imageData['imageExtension'] = $fileArray['extension'];
|
||||
$imageData['imageName'] = $fileArray['filename'];
|
||||
$imageData['imageTitle'] = $fileArray['filename'];
|
||||
list($width, $height) = getimagesize($standardImagePath);
|
||||
$imageData['imageTop'] = 0;
|
||||
$imageData['imageLeft'] = 0;
|
||||
$imageData['imageHeight'] = $height;
|
||||
$imageData['imageWidth'] = $width;
|
||||
|
||||
$imageID = ImageModel::insert($imageData);
|
||||
$request['navKeyVisual'] = json_encode(array('Controller' => 'KeyVisual', 'Type' => 'Single', 'IDs' => array($imageID)));
|
||||
}
|
||||
}
|
||||
23
rendering/Model/SublineModel.php
Normal file
23
rendering/Model/SublineModel.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by CS medien- & kommunikationssysteme.
|
||||
* @author Christian Steinle
|
||||
* @date 15.10.2016
|
||||
*
|
||||
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
|
||||
*/
|
||||
|
||||
namespace Model;
|
||||
|
||||
|
||||
use Helper\Database;
|
||||
|
||||
class SublineModel extends Database
|
||||
{
|
||||
const TBL_NAME = TBL_SUBLINE;
|
||||
|
||||
const PRIMARY_KEY = 'sublineID';
|
||||
|
||||
const ORDER_BY = '';
|
||||
|
||||
}
|
||||
23
rendering/Model/TextModel.php
Normal file
23
rendering/Model/TextModel.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by CS medien- & kommunikationssysteme.
|
||||
* @author Christian Steinle
|
||||
* @date 12.10.2016
|
||||
*
|
||||
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
|
||||
*/
|
||||
|
||||
namespace Model;
|
||||
|
||||
|
||||
use Helper\Database;
|
||||
|
||||
class TextModel extends Database
|
||||
{
|
||||
const TBL_NAME = TBL_TEXT;
|
||||
|
||||
const PRIMARY_KEY = 'textID';
|
||||
|
||||
const ORDER_BY = '';
|
||||
|
||||
}
|
||||
@@ -129,11 +129,27 @@ class NavigationView
|
||||
|
||||
if ($this->isEditable)
|
||||
{
|
||||
$this->navigationHtml .= '<li' . $liClass . '><a ' . $aClass . 'href="' . $linkPrefix . '/index.php?siteID=' . $navItem['navID'] . '">' . $navItem['navName'] . $span . '</a>';
|
||||
$link = $linkPrefix . '/index.php?siteID=' . $navItem['navID'];
|
||||
$target = '';
|
||||
if($navItem['navType'] === 'material')
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
$link = $registry->editorConfig['mediaPrefix'] . $navItem['navID'] . '/' . $navItem['navLink'];
|
||||
$target = ' target="_blank"';
|
||||
}
|
||||
$this->navigationHtml .= '<li' . $liClass . '><a ' . $aClass . $target . 'href="' . $link . '">' . $navItem['navName'] . $span . '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->navigationHtml .= '<li' . $liClass . '><a ' . $aClass . 'href="' . $linkPrefix . '/' . $navItem['navLink'] . '">' . $navItem['navName'] . $span . '</a>';
|
||||
$link = $linkPrefix . '/' . $navItem['navLink'];
|
||||
$target = '';
|
||||
if($navItem['navType'] === 'material')
|
||||
{
|
||||
$registry = Registry::getInstance();
|
||||
$link = $registry->editorConfig['mediaPrefix'] . $navItem['navID'] . '/' . $navItem['navLink'];
|
||||
$target = ' target="_blank"';
|
||||
}
|
||||
$this->navigationHtml .= '<li' . $liClass . '><a ' . $aClass . $target . 'href="' . $link . '">' . $navItem['navName'] . $span . '</a>';
|
||||
}
|
||||
if (isset($this->orderedNavigation[$navItem['navID']]))
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ class StandardView
|
||||
public function render()
|
||||
{
|
||||
ob_start();
|
||||
include_once($this->template);
|
||||
include($this->template);
|
||||
|
||||
$templateContent = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
Reference in New Issue
Block a user