Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	Draw/Controller.js
#	Draw/Models/DrawType.enum.js
#	Draw/Models/Editor.js
#	Media/Models/UploadFile.php
This commit is contained in:
Dennis Eichhorn 2017-01-26 16:42:29 +01:00
commit dfaec66351
20 changed files with 195 additions and 115 deletions

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -16,7 +16,7 @@
namespace Modules\News\Admin; namespace Modules\News\Admin;
use phpOMS\DataStorage\Database\Pool; use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\ActivateAbstract; use phpOMS\Module\ActivateAbstract;
use phpOMS\Module\InfoManager; use phpOMS\Module\InfoManager;
@ -37,7 +37,7 @@ class Activate extends ActivateAbstract
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function activate(Pool $dbPool, InfoManager $info) public static function activate(DatabasePool $dbPool, InfoManager $info)
{ {
parent::activate($dbPool, $info); parent::activate($dbPool, $info);
} }

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -16,7 +16,7 @@
namespace Modules\News\Admin; namespace Modules\News\Admin;
use phpOMS\DataStorage\Database\Pool; use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\DeactivateAbstract; use phpOMS\Module\DeactivateAbstract;
use phpOMS\Module\InfoManager; use phpOMS\Module\InfoManager;
@ -37,7 +37,7 @@ class Deactivate extends DeactivateAbstract
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function deactivate(Pool $dbPool, InfoManager $info) public static function deactivate(DatabasePool $dbPool, InfoManager $info)
{ {
parent::deactivate($dbPool, $info); parent::deactivate($dbPool, $info);
} }

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -14,7 +14,7 @@
* @link http://orange-management.com * @link http://orange-management.com
*/ */
namespace Modules\News\Admin\Install; namespace Modules\News\Admin\Install;
use phpOMS\DataStorage\Database\Pool; use phpOMS\DataStorage\Database\DatabasePool;
/** /**
* Navigation class. * Navigation class.
@ -29,7 +29,7 @@ use phpOMS\DataStorage\Database\Pool;
*/ */
class Navigation class Navigation
{ {
public static function install(Pool $dbPool) public static function install(string $path, DatabasePool $dbPool)
{ {
$navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true); $navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true);

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -16,7 +16,7 @@
namespace Modules\News\Admin; namespace Modules\News\Admin;
use phpOMS\DataStorage\Database\DatabaseType; use phpOMS\DataStorage\Database\DatabaseType;
use phpOMS\DataStorage\Database\Pool; use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\InfoManager; use phpOMS\Module\InfoManager;
use phpOMS\Module\InstallerAbstract; use phpOMS\Module\InstallerAbstract;
@ -37,9 +37,9 @@ class Installer extends InstallerAbstract
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function install(Pool $dbPool, InfoManager $info) public static function install(string $path, DatabasePool $dbPool, InfoManager $info)
{ {
parent::install($dbPool, $info); parent::install($path, $dbPool, $info);
switch ($dbPool->get('core')->getType()) { switch ($dbPool->get('core')->getType()) {
case DatabaseType::MYSQL: case DatabaseType::MYSQL:
@ -49,6 +49,7 @@ class Installer extends InstallerAbstract
`news_title` varchar(250) NOT NULL, `news_title` varchar(250) NOT NULL,
`news_featured` tinyint(1) DEFAULT NULL, `news_featured` tinyint(1) DEFAULT NULL,
`news_content` text NOT NULL, `news_content` text NOT NULL,
`news_plain` text NOT NULL,
`news_type` tinyint(2) NOT NULL, `news_type` tinyint(2) NOT NULL,
`news_status` tinyint(1) NOT NULL, `news_status` tinyint(1) NOT NULL,
`news_lang` varchar(2) NOT NULL, `news_lang` varchar(2) NOT NULL,

12
Admin/Routes/Web/Api.php Normal file
View File

@ -0,0 +1,12 @@
<?php
use phpOMS\Router\RouteVerb;
return [
'^.*/api/news.*$' => [
[
'dest' => '\Modules\News\Controller:apiNewsCreate',
'verb' => RouteVerb::SET,
],
],
];

View File

@ -27,11 +27,4 @@ return [
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
], ],
], ],
'^.*/api/news.*$' => [
[
'dest' => '\Modules\News\Controller:apiNewsCreate',
'verb' => RouteVerb::SET,
],
],
]; ];

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -16,7 +16,7 @@
namespace Modules\News\Admin; namespace Modules\News\Admin;
use phpOMS\DataStorage\Database\Pool; use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\DataStorage\Database\Schema\Builder; use phpOMS\DataStorage\Database\Schema\Builder;
use phpOMS\Module\UninstallAbstract; use phpOMS\Module\UninstallAbstract;
@ -37,7 +37,7 @@ class Uninstall extends UninstallAbstract
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function uninstall(Pool $dbPool, InfoManager $info) public static function uninstall(DatabasePool $dbPool, InfoManager $info)
{ {
parent::uninstall($dbPool, $info); parent::uninstall($dbPool, $info);

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -16,7 +16,7 @@
namespace Modules\News\Admin; namespace Modules\News\Admin;
use phpOMS\DataStorage\Database\Pool; use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\UpdateAbstract; use phpOMS\Module\UpdateAbstract;
use phpOMS\System\File\Directory; use phpOMS\System\File\Directory;
@ -37,7 +37,7 @@ class Update extends UpdateAbstract
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function update(Pool $dbPool, array $info) public static function update(DatabasePool $dbPool, array $info)
{ {
Directory::deletePath(__DIR__ . '/Update'); Directory::deletePath(__DIR__ . '/Update');
mkdir('Update'); mkdir('Update');

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -15,13 +15,18 @@
*/ */
namespace Modules\News; namespace Modules\News;
use Model\Message\FormValidation;
use Modules\News\Models\NewsArticle; use Modules\News\Models\NewsArticle;
use Modules\News\Models\NewsArticleMapper; use Modules\News\Models\NewsArticleMapper;
use Modules\News\Models\NewsStatus;
use Modules\News\Models\NewsType;
use phpOMS\Account\Account; use phpOMS\Account\Account;
use phpOMS\Localization\ISO639Enum;
use phpOMS\Message\RequestAbstract; use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract; use phpOMS\Message\ResponseAbstract;
use phpOMS\Module\ModuleAbstract; use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\WebInterface; use phpOMS\Module\WebInterface;
use phpOMS\Utils\Parser\Markdown\Markdown;
use phpOMS\Views\View; use phpOMS\Views\View;
/** /**
@ -44,7 +49,7 @@ class Controller extends ModuleAbstract implements WebInterface
* @var string * @var string
* @since 1.0.0 * @since 1.0.0
*/ */
const MODULE_PATH = __DIR__; /* public */ const MODULE_PATH = __DIR__;
/** /**
* Module version. * Module version.
@ -52,7 +57,7 @@ class Controller extends ModuleAbstract implements WebInterface
* @var string * @var string
* @since 1.0.0 * @since 1.0.0
*/ */
const MODULE_VERSION = '1.0.0'; /* public */ const MODULE_VERSION = '1.0.0';
/** /**
* Module name. * Module name.
@ -60,7 +65,7 @@ class Controller extends ModuleAbstract implements WebInterface
* @var string * @var string
* @since 1.0.0 * @since 1.0.0
*/ */
const MODULE_NAME = 'News'; /* public */ const MODULE_NAME = 'News';
/** /**
* Providing. * Providing.
@ -161,6 +166,31 @@ class Controller extends ModuleAbstract implements WebInterface
return $view; return $view;
} }
private function validateNewsCreate(RequestAbstract $request) : array
{
$val = [];
if (
($val['title'] = empty($request->getData('title')))
|| ($val['plain'] = empty($request->getData('plain')))
|| ($val['lang'] = (
$request->getData('lang') !== null
&& !ISO639Enum::isValidValue(strtolower($request->getData('lang')))
))
|| ($val['type'] = (
$request->getData('type') === null
|| !NewsType::isValidValue((int) $request->getData('type'))
))
|| ($val['status'] = (
$request->getData('status') === null
|| !NewsStatus::isValidValue((int) $request->getData('status'))
))
) {
return $val;
}
return [];
}
/** /**
* @param RequestAbstract $request Request * @param RequestAbstract $request Request
* @param ResponseAbstract $response Response * @param ResponseAbstract $response Response
@ -171,15 +201,23 @@ class Controller extends ModuleAbstract implements WebInterface
*/ */
public function apiNewsCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) public function apiNewsCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
{ {
if (!empty($val = $this->validateNewsCreate($request))) {
$response->set('news_create', new FormValidation($val));
return;
}
$mardkownParser = new Markdown();
$newsArticle = new NewsArticle(); $newsArticle = new NewsArticle();
$newsArticle->setCreatedBy($requst->getAccount()->getId()); $newsArticle->setCreatedBy($request->getAccount());
$newsArticle->setCreatedAt(new \DateTime('now')); $newsArticle->setCreatedAt(new \DateTime('now'));
$newsArticle->setPublish((bool) ($request->getData('publish') ?? false)); $newsArticle->setPublish(new \DateTime($request->getData('publish') ?? false));
$newsArticle->setTitle($request->getData('title') ?? ''); $newsArticle->setTitle($request->getData('title') ?? '');
$newsArticle->setPlain($request->getData('plain') ?? ''); $newsArticle->setPlain($request->getData('plain') ?? '');
$newsArticle->setContent($request->getData('content') ?? ''); $newsArticle->setContent($mardkownParser->parse($request->getData('plain') ?? ''));
$newsArticle->setLanguage($request->getData('lang') ?? $request->getL11n()->getLanguage()); $newsArticle->setLanguage(strtolower($request->getData('lang') ?? $request->getL11n()->getLanguage()));
$newsArticle->setType((int) ($requst->getData('type') ?? 1)); $newsArticle->setType((int) ($request->getData('type') ?? 1));
$newsArticle->setStatus((int) ($request->getData('status') ?? 1)); $newsArticle->setStatus((int) ($request->getData('status') ?? 1));
$newsArticle->setFeatured((bool) ($request->getData('featured') ?? true)); $newsArticle->setFeatured((bool) ($request->getData('featured') ?? true));

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -15,6 +15,7 @@
*/ */
namespace Modules\News\Models; namespace Modules\News\Models;
use phpOMS\Contract\ArrayableInterface;
use phpOMS\Datatypes\Exception\InvalidEnumValue; use phpOMS\Datatypes\Exception\InvalidEnumValue;
use phpOMS\Localization\ISO639x1Enum; use phpOMS\Localization\ISO639x1Enum;
@ -56,6 +57,14 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
*/ */
private $content = ''; private $content = '';
/**
* Unparsed.
*
* @var string
* @since 1.0.0
*/
private $plain = '';
/** /**
* News type. * News type.
* *
@ -148,6 +157,30 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
$this->content = $content; $this->content = $content;
} }
/**
* @param string $plain
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setPlain(string $plain)
{
$this->plain = $plain;
}
/**
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getPlain() : string
{
return $this->plain;
}
/** /**
* @return \DateTime * @return \DateTime
* *
@ -325,7 +358,7 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
* *
* @return void * @return void
* *
* @throws * @throws InvalidEnumValue
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
@ -381,11 +414,11 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
public function __toString() public function __toString()
{ {
return $this->jsonSerialize(); return json_encode($this->toArray());
} }
public function jsonSerialize() public function jsonSerialize()
{ {
return json_encode($this->toArray()); return $this->toArray();
} }
} }

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -15,6 +15,7 @@
*/ */
namespace Modules\News\Models; namespace Modules\News\Models;
use Modules\Admin\Models\AccountMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column; use phpOMS\DataStorage\Database\Query\Column;
@ -26,7 +27,7 @@ class NewsArticleMapper extends DataMapperAbstract
/** /**
* Columns. * Columns.
* *
* @var array<string, array> * @var array
* @since 1.0.0 * @since 1.0.0
*/ */
static protected $columns = [ static protected $columns = [
@ -34,6 +35,7 @@ class NewsArticleMapper extends DataMapperAbstract
'news_created_by' => ['name' => 'news_created_by', 'type' => 'string', 'internal' => 'createdBy'], 'news_created_by' => ['name' => 'news_created_by', 'type' => 'string', 'internal' => 'createdBy'],
'news_publish' => ['name' => 'news_publish', 'type' => 'DateTime', 'internal' => 'publish'], 'news_publish' => ['name' => 'news_publish', 'type' => 'DateTime', 'internal' => 'publish'],
'news_title' => ['name' => 'news_title', 'type' => 'string', 'internal' => 'title'], 'news_title' => ['name' => 'news_title', 'type' => 'string', 'internal' => 'title'],
'news_plain' => ['name' => 'news_plain', 'type' => 'string', 'internal' => 'plain'],
'news_content' => ['name' => 'news_content', 'type' => 'string', 'internal' => 'content'], 'news_content' => ['name' => 'news_content', 'type' => 'string', 'internal' => 'content'],
'news_lang' => ['name' => 'news_lang', 'type' => 'string', 'internal' => 'language'], 'news_lang' => ['name' => 'news_lang', 'type' => 'string', 'internal' => 'language'],
'news_status' => ['name' => 'news_status', 'type' => 'int', 'internal' => 'status'], 'news_status' => ['name' => 'news_status', 'type' => 'int', 'internal' => 'status'],
@ -42,6 +44,13 @@ class NewsArticleMapper extends DataMapperAbstract
'news_created_at' => ['name' => 'news_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'], 'news_created_at' => ['name' => 'news_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
]; ];
static protected $belongsTo = [
'createdBy' => [
'mapper' => AccountMapper::class,
'src' => 'news_created_by',
],
];
/** /**
* Primary table. * Primary table.
* *
@ -83,20 +92,20 @@ class NewsArticleMapper extends DataMapperAbstract
$objId = parent::create($obj, $relations); $objId = parent::create($obj, $relations);
$query = new Builder(self::$db); $query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix()) $query->prefix(self::$db->getPrefix())
->insert( ->insert(
'account_permission_account', 'account_permission_account',
'account_permission_from', 'account_permission_from',
'account_permission_for', 'account_permission_for',
'account_permission_id1', 'account_permission_id1',
'account_permission_id2', 'account_permission_id2',
'account_permission_r', 'account_permission_r',
'account_permission_w', 'account_permission_w',
'account_permission_m', 'account_permission_m',
'account_permission_d', 'account_permission_d',
'account_permission_p' 'account_permission_p'
) )
->into('account_permission') ->into('account_permission')
->values($obj->getCreatedBy(), 'news', 'news', 1, $objId, 1, 1, 1, 1, 1); ->values($obj->getCreatedBy(), 'news', 'news', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute(); self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) { } catch (\Exception $e) {
@ -119,9 +128,9 @@ class NewsArticleMapper extends DataMapperAbstract
public static function find(...$columns) : Builder public static function find(...$columns) : Builder
{ {
return parent::find(...$columns)->from('account_permission') return parent::find(...$columns)->from('account_permission')
->where('account_permission.account_permission_for', '=', 'news') ->where('account_permission.account_permission_for', '=', 'news')
->where('account_permission.account_permission_id1', '=', 1) ->where('account_permission.account_permission_id1', '=', 1)
->where('news.news_id', '=', new Column('account_permission.account_permission_id2')) ->where('news.news_id', '=', new Column('account_permission.account_permission_id2'))
->where('account_permission.account_permission_r', '=', 1); ->where('account_permission.account_permission_r', '=', 1);
} }
} }

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -30,7 +30,7 @@ use phpOMS\Datatypes\Enum;
*/ */
abstract class NewsStatus extends Enum abstract class NewsStatus extends Enum
{ {
const VISIBLE = 0; /* public */ const VISIBLE = 0;
const DRAFT = 1; /* public */ const DRAFT = 1;
} }

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -30,9 +30,9 @@ use phpOMS\Datatypes\Enum;
*/ */
abstract class NewsType extends Enum abstract class NewsType extends Enum
{ {
const ARTICLE = 0; /* public */ const ARTICLE = 0;
const LINK = 1; /* public */ const LINK = 1;
const HEADLINE = 2; /* public */ const HEADLINE = 2;
} }

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD

View File

@ -1,3 +1,3 @@
<section> <section id="news-dashboard" draggable>
News News
</section> </section>

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -19,56 +19,50 @@
echo $this->getData('nav')->render(); ?> echo $this->getData('nav')->render(); ?>
<section class="wf-75 floatLeft"> <section class="wf-75 floatLeft">
<?php include __DIR__ . '../../../Editor/Theme/Backend/editor.tpl.php'; ?> <?php include __DIR__ . '/../../../Editor/Theme/Backend/editor.tpl.php'; ?>
</section> </section>
<section class="wf-25 floatLeft"> <section class="wf-25 floatLeft">
<section class="box w-100"> <section class="box w-100">
<div class="inner"> <div class="inner">
<form id="newsForm"> <form id="docForm" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/news?csrf={$CSRF}'); ?>">
<table class="layout wf-100"> <table class="layout wf-100">
<tr><td colspan="2"><label for="publish"><?= $this->getText('Status') ?></label> <tr><td colspan="2"><label for="publish"><?= $this->getText('Status') ?></label>
<tr><td colspan="2"><select> <tr><td colspan="2"><select name="status">
<option selected><?= $this->getText('Draft') ?> <option value="<?= Modules\News\Models\NewsStatus::DRAFT; ?>" selected><?= $this->getText('Draft') ?>
<option><?= $this->getText('Visible') ?> <option value="<?= Modules\News\Models\NewsStatus::VISIBLE; ?>"><?= $this->getText('Visible') ?>
<tr><td colspan="2"><label for="publish"><?= $this->getText('Publish') ?></label> <tr><td colspan="2"><label for="publish"><?= $this->getText('Publish') ?></label>
<tr><td colspan="2"><input type="datetime-local" id="publish" value="<?= (new \DateTime('NOW'))->format('Y-m-d\TH:i:s') ?>"> <tr><td colspan="2"><input type="datetime-local" id="publish" value="<?= (new \DateTime('NOW'))->format('Y-m-d\TH:i:s') ?>">
<tr><td><input type="submit" value="<?= $this->getText('Delete') ?>"><td class="rightText"><input type="submit" value="<?= $this->l11n->lang[0]['Save'] ?>"> <input type="submit" value="<?= $this->getText('Publish') ?>"> <tr><td><input type="submit" value="<?= $this->getText('Delete', 0) ?>"><td class="rightText"><input type="submit" value="<?= $this->getText('Save', 0) ?>"> <input type="submit" value="<?= $this->getText('Publish') ?>">
</table> </table>
</form> </form>
</div> </div>
</section> </section>
<section class="box w-100"> <section class="box w-100">
<div class="inner"> <div class="inner">
<form id="newsForm"> <table class="layout wf-100">
<table class="layout wf-100"> <tr><td colspan="2"><label><?= $this->getText('Type') ?></label>
<tr><td colspan="2"><label><?= $this->getText('Type') ?></label> <tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="docForm" value="<?= Modules\News\Models\NewsType::ARTICLE; ?>" id="news" checked><label for="news"><?= $this->getText('News') ?></label></span>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="newsForm" value="1" id="news" checked><label for="news"><?= $this->getText('News') ?></label></span> <tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="docForm" value="<?= Modules\News\Models\NewsType::HEADLINE; ?>" id="headline"><label for="headline"><?= $this->getText('Headline') ?></label></span>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="newsForm" value="2" id="headline"><label for="headline"><?= $this->getText('Headline') ?></label></span> <tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="docForm" value="<?= Modules\News\Models\NewsType::LINK; ?>" id="link"><label for="link"><?= $this->getText('Link') ?></label></span>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="newsForm" value="3" id="link"><label for="link"><?= $this->getText('Link') ?></label></span> </table>
</table>
</form>
</div> </div>
</section> </section>
<section class="box w-100"> <section class="box w-100">
<div class="inner"> <div class="inner">
<form id="newsForm"> <table class="layout wf-100">
<table class="layout wf-100"> <tr><td><label for="permission"><?= $this->getText('Permissions') ?></label>
<tr><td><label for="permission"><?= $this->getText('Permissions') ?></label> <tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" id="permission"><input type="hidden" form="docForm" name="permission"></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" id="permission"><input type="hidden" form="newsForm" name="permission"></span> <tr><td><button><?= $this->getText('Add', 0, 0) ?></button>
<tr><td><button><?= $this->getText('Add', 0, 0) ?></button> </table>
</table>
</form>
</div> </div>
</section> </section>
<section class="box w-100"> <section class="box w-100">
<div class="inner"> <div class="inner">
<form id="newsForm"> <table class="layout wf-100">
<table class="layout wf-100"> <tr><td colspan="2"><label for="groups"><?= $this->getText('Groups') ?></label>
<tr><td colspan="2"><label for="groups"><?= $this->getText('Groups') ?></label> <tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" id="groups"><input type="hidden" form="docForm" name="groups"></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" id="groups"><input type="hidden" form="newsForm" name="groups"></span> <tr><td><button><?= $this->getText('Add', 0, 0) ?></button>
<tr><td><button><?= $this->getText('Add', 0, 0) ?></button> </table>
</table>
</form>
</div> </div>
</section> </section>
</section> </section>

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD
@ -31,20 +31,20 @@ echo $this->getData('nav')->render(); ?>
<td class="wf-100"><?= $this->getText('Title'); ?> <td class="wf-100"><?= $this->getText('Title'); ?>
<td><?= $this->getText('Author'); ?> <td><?= $this->getText('Author'); ?>
<td><?= $this->getText('Date'); ?> <td><?= $this->getText('Date'); ?>
<tbody> <tbody>
<?php $count = 0; foreach($newsList as $key => $news) : $count++; <?php $count = 0; foreach($newsList as $key => $news) : $count++;
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/news/article?id=' . $news->getId()); $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/news/article?id=' . $news->getId());
$color = 'darkred'; $color = 'darkred';
if($news->getType() === \Modules\News\Models\NewsType::ARTICLE) { $color = 'green'; } if($news->getType() === \Modules\News\Models\NewsType::ARTICLE) { $color = 'green'; }
elseif($news->getType() === \Modules\News\Models\NewsType::HEADLINE) { $color = 'purple'; } elseif($news->getType() === \Modules\News\Models\NewsType::HEADLINE) { $color = 'purple'; }
elseif($news->getType() === \Modules\News\Models\NewsType::LINK) { $color = 'yellow'; } elseif($news->getType() === \Modules\News\Models\NewsType::LINK) { $color = 'yellow'; }
?> ?>
<tr> <tr>
<td data-label=""><a href="<?= $url; ?>"><?= $news->isFeatured() ? '<i class="fa fa-star favorite"></i>' : ''; ?></a> <td data-label=""><a href="<?= $url; ?>"><?= $news->isFeatured() ? '<i class="fa fa-star favorite"></i>' : ''; ?></a>
<td data-label="<?= $this->getText('News', 'Type'); ?>"><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->getText('TYPE' . $news->getType()); ?></span></a> <td data-label="<?= $this->getText('Type'); ?>"><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->getText('TYPE' . $news->getType()); ?></span></a>
<td data-label="<?= $this->getText('Title'); ?>"><a href="<?= $url; ?>"><?= $news->getTitle(); ?></a> <td data-label="<?= $this->getText('Title'); ?>"><a href="<?= $url; ?>"><?= $news->getTitle(); ?></a>
<td data-label="<?= $this->getText('Author'); ?>"><a href="<?= $url; ?>"><?= $news->getCreatedBy(); ?></a> <td data-label="<?= $this->getText('Author'); ?>"><a href="<?= $url; ?>"><?= $news->getCreatedBy(); ?></a>
<td data-label="<?= $this->getText('Date'); ?>"><a href="<?= $url; ?>"><?= $news->getPublish()->format('Y-m-d'); ?></a> <td data-label="<?= $this->getText('Date'); ?>"><a href="<?= $url; ?>"><?= $news->getPublish()->format('Y-m-d'); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($count === 0) : ?> <?php if($count === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getText('Empty', 0, 0); ?> <tr><td colspan="5" class="empty"><?= $this->getText('Empty', 0, 0); ?>

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD

View File

@ -2,7 +2,7 @@
/** /**
* Orange Management * Orange Management
* *
* PHP Version 7.0 * PHP Version 7.1
* *
* @category TBD * @category TBD
* @package TBD * @package TBD