mirror of
https://github.com/Karaka-Management/oms-News.git
synced 2026-01-25 14:48:40 +00:00
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:
commit
dfaec66351
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\News\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\ActivateAbstract;
|
||||
use phpOMS\Module\InfoManager;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Activate extends ActivateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function activate(Pool $dbPool, InfoManager $info)
|
||||
public static function activate(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::activate($dbPool, $info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\News\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\DeactivateAbstract;
|
||||
use phpOMS\Module\InfoManager;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Deactivate extends DeactivateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function deactivate(Pool $dbPool, InfoManager $info)
|
||||
public static function deactivate(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::deactivate($dbPool, $info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace Modules\News\Admin\Install;
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
|
||||
/**
|
||||
* Navigation class.
|
||||
|
|
@ -29,7 +29,7 @@ use phpOMS\DataStorage\Database\Pool;
|
|||
*/
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\News\Admin;
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabaseType;
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\InfoManager;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
|
||||
|
|
@ -37,9 +37,9 @@ class Installer extends InstallerAbstract
|
|||
/**
|
||||
* {@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()) {
|
||||
case DatabaseType::MYSQL:
|
||||
|
|
@ -49,6 +49,7 @@ class Installer extends InstallerAbstract
|
|||
`news_title` varchar(250) NOT NULL,
|
||||
`news_featured` tinyint(1) DEFAULT NULL,
|
||||
`news_content` text NOT NULL,
|
||||
`news_plain` text NOT NULL,
|
||||
`news_type` tinyint(2) NOT NULL,
|
||||
`news_status` tinyint(1) NOT NULL,
|
||||
`news_lang` varchar(2) NOT NULL,
|
||||
|
|
|
|||
12
Admin/Routes/Web/Api.php
Normal file
12
Admin/Routes/Web/Api.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/api/news.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\News\Controller:apiNewsCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -27,11 +27,4 @@ return [
|
|||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/api/news.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\News\Controller:apiNewsCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\News\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\Schema\Builder;
|
||||
use phpOMS\Module\UninstallAbstract;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Uninstall extends UninstallAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function uninstall(Pool $dbPool, InfoManager $info)
|
||||
public static function uninstall(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::uninstall($dbPool, $info);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\News\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\UpdateAbstract;
|
||||
use phpOMS\System\File\Directory;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Update extends UpdateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function update(Pool $dbPool, array $info)
|
||||
public static function update(DatabasePool $dbPool, array $info)
|
||||
{
|
||||
Directory::deletePath(__DIR__ . '/Update');
|
||||
mkdir('Update');
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -15,13 +15,18 @@
|
|||
*/
|
||||
namespace Modules\News;
|
||||
|
||||
use Model\Message\FormValidation;
|
||||
use Modules\News\Models\NewsArticle;
|
||||
use Modules\News\Models\NewsArticleMapper;
|
||||
use Modules\News\Models\NewsStatus;
|
||||
use Modules\News\Models\NewsType;
|
||||
use phpOMS\Account\Account;
|
||||
use phpOMS\Localization\ISO639Enum;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\WebInterface;
|
||||
use phpOMS\Utils\Parser\Markdown\Markdown;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
/**
|
||||
|
|
@ -44,7 +49,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_PATH = __DIR__;
|
||||
/* public */ const MODULE_PATH = __DIR__;
|
||||
|
||||
/**
|
||||
* Module version.
|
||||
|
|
@ -52,7 +57,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_VERSION = '1.0.0';
|
||||
/* public */ const MODULE_VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* Module name.
|
||||
|
|
@ -60,7 +65,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_NAME = 'News';
|
||||
/* public */ const MODULE_NAME = 'News';
|
||||
|
||||
/**
|
||||
* Providing.
|
||||
|
|
@ -161,6 +166,31 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
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 ResponseAbstract $response Response
|
||||
|
|
@ -171,15 +201,23 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
*/
|
||||
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->setCreatedBy($requst->getAccount()->getId());
|
||||
$newsArticle->setCreatedBy($request->getAccount());
|
||||
$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->setPlain($request->getData('plain') ?? '');
|
||||
$newsArticle->setContent($request->getData('content') ?? '');
|
||||
$newsArticle->setLanguage($request->getData('lang') ?? $request->getL11n()->getLanguage());
|
||||
$newsArticle->setType((int) ($requst->getData('type') ?? 1));
|
||||
$newsArticle->setContent($mardkownParser->parse($request->getData('plain') ?? ''));
|
||||
$newsArticle->setLanguage(strtolower($request->getData('lang') ?? $request->getL11n()->getLanguage()));
|
||||
$newsArticle->setType((int) ($request->getData('type') ?? 1));
|
||||
$newsArticle->setStatus((int) ($request->getData('status') ?? 1));
|
||||
$newsArticle->setFeatured((bool) ($request->getData('featured') ?? true));
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
namespace Modules\News\Models;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
use phpOMS\Datatypes\Exception\InvalidEnumValue;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
|
|
@ -56,6 +57,14 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
private $content = '';
|
||||
|
||||
/**
|
||||
* Unparsed.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $plain = '';
|
||||
|
||||
/**
|
||||
* News type.
|
||||
*
|
||||
|
|
@ -148,6 +157,30 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
|
|||
$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
|
||||
*
|
||||
|
|
@ -325,7 +358,7 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
|
|||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws
|
||||
* @throws InvalidEnumValue
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -381,11 +414,11 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
|
|||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
namespace Modules\News\Models;
|
||||
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\DataStorage\Database\Query\Column;
|
||||
|
|
@ -26,7 +27,7 @@ class NewsArticleMapper extends DataMapperAbstract
|
|||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array>
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
static protected $columns = [
|
||||
|
|
@ -34,6 +35,7 @@ class NewsArticleMapper extends DataMapperAbstract
|
|||
'news_created_by' => ['name' => 'news_created_by', 'type' => 'string', 'internal' => 'createdBy'],
|
||||
'news_publish' => ['name' => 'news_publish', 'type' => 'DateTime', 'internal' => 'publish'],
|
||||
'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_lang' => ['name' => 'news_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
'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'],
|
||||
];
|
||||
|
||||
static protected $belongsTo = [
|
||||
'createdBy' => [
|
||||
'mapper' => AccountMapper::class,
|
||||
'src' => 'news_created_by',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
|
|
@ -83,20 +92,20 @@ class NewsArticleMapper extends DataMapperAbstract
|
|||
$objId = parent::create($obj, $relations);
|
||||
$query = new Builder(self::$db);
|
||||
$query->prefix(self::$db->getPrefix())
|
||||
->insert(
|
||||
'account_permission_account',
|
||||
'account_permission_from',
|
||||
'account_permission_for',
|
||||
'account_permission_id1',
|
||||
'account_permission_id2',
|
||||
'account_permission_r',
|
||||
'account_permission_w',
|
||||
'account_permission_m',
|
||||
'account_permission_d',
|
||||
'account_permission_p'
|
||||
)
|
||||
->into('account_permission')
|
||||
->values($obj->getCreatedBy(), 'news', 'news', 1, $objId, 1, 1, 1, 1, 1);
|
||||
->insert(
|
||||
'account_permission_account',
|
||||
'account_permission_from',
|
||||
'account_permission_for',
|
||||
'account_permission_id1',
|
||||
'account_permission_id2',
|
||||
'account_permission_r',
|
||||
'account_permission_w',
|
||||
'account_permission_m',
|
||||
'account_permission_d',
|
||||
'account_permission_p'
|
||||
)
|
||||
->into('account_permission')
|
||||
->values($obj->getCreatedBy(), 'news', 'news', 1, $objId, 1, 1, 1, 1, 1);
|
||||
|
||||
self::$db->con->prepare($query->toSql())->execute();
|
||||
} catch (\Exception $e) {
|
||||
|
|
@ -119,9 +128,9 @@ class NewsArticleMapper extends DataMapperAbstract
|
|||
public static function find(...$columns) : Builder
|
||||
{
|
||||
return parent::find(...$columns)->from('account_permission')
|
||||
->where('account_permission.account_permission_for', '=', 'news')
|
||||
->where('account_permission.account_permission_id1', '=', 1)
|
||||
->where('news.news_id', '=', new Column('account_permission.account_permission_id2'))
|
||||
->where('account_permission.account_permission_r', '=', 1);
|
||||
->where('account_permission.account_permission_for', '=', 'news')
|
||||
->where('account_permission.account_permission_id1', '=', 1)
|
||||
->where('news.news_id', '=', new Column('account_permission.account_permission_id2'))
|
||||
->where('account_permission.account_permission_r', '=', 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -30,7 +30,7 @@ use phpOMS\Datatypes\Enum;
|
|||
*/
|
||||
abstract class NewsStatus extends Enum
|
||||
{
|
||||
const VISIBLE = 0;
|
||||
/* public */ const VISIBLE = 0;
|
||||
|
||||
const DRAFT = 1;
|
||||
/* public */ const DRAFT = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -30,9 +30,9 @@ use phpOMS\Datatypes\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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
<section>
|
||||
<section id="news-dashboard" draggable>
|
||||
News
|
||||
</section>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -19,56 +19,50 @@
|
|||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<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 class="wf-25 floatLeft">
|
||||
<section class="box w-100">
|
||||
<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">
|
||||
<tr><td colspan="2"><label for="publish"><?= $this->getText('Status') ?></label>
|
||||
<tr><td colspan="2"><select>
|
||||
<option selected><?= $this->getText('Draft') ?>
|
||||
<option><?= $this->getText('Visible') ?>
|
||||
<tr><td colspan="2"><select name="status">
|
||||
<option value="<?= Modules\News\Models\NewsStatus::DRAFT; ?>" selected><?= $this->getText('Draft') ?>
|
||||
<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"><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>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
<section class="box w-100">
|
||||
<div class="inner">
|
||||
<form id="newsForm">
|
||||
<table class="layout wf-100">
|
||||
<tr><td colspan="2"><label><?= $this->getText('Type') ?></label>
|
||||
<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="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="newsForm" value="3" id="link"><label for="link"><?= $this->getText('Link') ?></label></span>
|
||||
</table>
|
||||
</form>
|
||||
<table class="layout wf-100">
|
||||
<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="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="docForm" value="<?= Modules\News\Models\NewsType::LINK; ?>" id="link"><label for="link"><?= $this->getText('Link') ?></label></span>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<section class="box w-100">
|
||||
<div class="inner">
|
||||
<form id="newsForm">
|
||||
<table class="layout wf-100">
|
||||
<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="newsForm" name="permission"></span>
|
||||
<tr><td><button><?= $this->getText('Add', 0, 0) ?></button>
|
||||
</table>
|
||||
</form>
|
||||
<table class="layout wf-100">
|
||||
<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><button><?= $this->getText('Add', 0, 0) ?></button>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<section class="box w-100">
|
||||
<div class="inner">
|
||||
<form id="newsForm">
|
||||
<table class="layout wf-100">
|
||||
<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="newsForm" name="groups"></span>
|
||||
<tr><td><button><?= $this->getText('Add', 0, 0) ?></button>
|
||||
</table>
|
||||
</form>
|
||||
<table class="layout wf-100">
|
||||
<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><button><?= $this->getText('Add', 0, 0) ?></button>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -31,20 +31,20 @@ echo $this->getData('nav')->render(); ?>
|
|||
<td class="wf-100"><?= $this->getText('Title'); ?>
|
||||
<td><?= $this->getText('Author'); ?>
|
||||
<td><?= $this->getText('Date'); ?>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach($newsList as $key => $news) : $count++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/news/article?id=' . $news->getId());
|
||||
$color = 'darkred';
|
||||
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::LINK) { $color = 'yellow'; }
|
||||
?>
|
||||
<tr>
|
||||
<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('Title'); ?>"><a href="<?= $url; ?>"><?= $news->getTitle(); ?></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>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach($newsList as $key => $news) : $count++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/news/article?id=' . $news->getId());
|
||||
$color = 'darkred';
|
||||
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::LINK) { $color = 'yellow'; }
|
||||
?>
|
||||
<tr>
|
||||
<td data-label=""><a href="<?= $url; ?>"><?= $news->isFeatured() ? '<i class="fa fa-star favorite"></i>' : ''; ?></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('Author'); ?>"><a href="<?= $url; ?>"><?= $news->getCreatedBy(); ?></a>
|
||||
<td data-label="<?= $this->getText('Date'); ?>"><a href="<?= $url; ?>"><?= $news->getPublish()->format('Y-m-d'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if($count === 0) : ?>
|
||||
<tr><td colspan="5" class="empty"><?= $this->getText('Empty', 0, 0); ?>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user