mirror of
https://github.com/Karaka-Management/oms-News.git
synced 2026-02-18 09:28:41 +00:00
autofixes
This commit is contained in:
parent
cb209644dc
commit
db24662cf1
|
|
@ -29,7 +29,7 @@ use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class NewsArticle implements ArrayableInterface, \JsonSerializable
|
class NewsArticle implements \JsonSerializable, ArrayableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Article ID.
|
* Article ID.
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,6 @@ use phpOMS\Stdlib\Base\Enum;
|
||||||
abstract class NewsStatus extends Enum
|
abstract class NewsStatus extends Enum
|
||||||
{
|
{
|
||||||
public const VISIBLE = 0;
|
public const VISIBLE = 0;
|
||||||
|
|
||||||
public const DRAFT = 1;
|
public const DRAFT = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ use phpOMS\Stdlib\Base\Enum;
|
||||||
abstract class NewsType extends Enum
|
abstract class NewsType extends Enum
|
||||||
{
|
{
|
||||||
public const ARTICLE = 0;
|
public const ARTICLE = 0;
|
||||||
|
|
||||||
public const LINK = 1;
|
public const LINK = 1;
|
||||||
|
|
||||||
public const HEADLINE = 2;
|
public const HEADLINE = 2;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ $newsList = $this->getData('news') ?? [];
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<td><?= $this->getHtml('Type', 'News') ?>
|
<td><?= $this->getHtml('Type', 'News'); ?>
|
||||||
<td class="wf-100"><?= $this->getHtml('Title', 'News') ?>
|
<td class="wf-100"><?= $this->getHtml('Title', 'News'); ?>
|
||||||
<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('{/prefix}news/article?{?}&id=' . $news->getId());
|
$url = \phpOMS\Uri\UriFactory::build('{/prefix}news/article?{?}&id=' . $news->getId());
|
||||||
|
|
@ -42,13 +42,13 @@ $newsList = $this->getData('news') ?? [];
|
||||||
<i class="fa fa-star favorite"></i>
|
<i class="fa fa-star favorite"></i>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<td data-label="<?= $this->getHtml('Type', 'News') ?>">
|
<td data-label="<?= $this->getHtml('Type', 'News'); ?>">
|
||||||
<a href="<?= $url; ?>">
|
<a href="<?= $url; ?>">
|
||||||
<span class="tag <?= $this->printHtml($color); ?>">
|
<span class="tag <?= $this->printHtml($color); ?>">
|
||||||
<?= $this->getHtml('TYPE' . $news->getType(), 'News') ?>
|
<?= $this->getHtml('TYPE' . $news->getType(), 'News'); ?>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<td data-label="<?= $this->getHtml('Title', 'News') ?>">
|
<td data-label="<?= $this->getHtml('Title', 'News'); ?>">
|
||||||
<a href="<?= $url; ?>">
|
<a href="<?= $url; ?>">
|
||||||
<?= $this->printHtml($news->getTitle()); ?>
|
<?= $this->printHtml($news->getTitle()); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,14 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<section class="portlet">
|
<section class="portlet">
|
||||||
<div class="portlet-head"><?= $this->getHtml('Archive') ?><i class="fa fa-download floatRight download btn"></i></div>
|
<div class="portlet-head"><?= $this->getHtml('Archive'); ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||||
<table id="newsArchiveList" class="default">
|
<table id="newsArchiveList" class="default">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $this->getHtml('Type') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td><?= $this->getHtml('Type'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td class="wf-100"><?= $this->getHtml('Title') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td class="wf-100"><?= $this->getHtml('Title'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td><?= $this->getHtml('Author') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td><?= $this->getHtml('Author'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td><?= $this->getHtml('Date') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td><?= $this->getHtml('Date'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $count = 0; foreach ($articles as $key => $news) : ++$count; $url = UriFactory::build('{/prefix}news/article?{?}&id=' . $news->getId());
|
<?php $count = 0; foreach ($articles as $key => $news) : ++$count; $url = UriFactory::build('{/prefix}news/article?{?}&id=' . $news->getId());
|
||||||
$color = 'darkred';
|
$color = 'darkred';
|
||||||
|
|
@ -43,7 +43,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
elseif ($news->getType() === NewsType::LINK) { $color = 'yellow'; }
|
elseif ($news->getType() === NewsType::LINK) { $color = 'yellow'; }
|
||||||
?>
|
?>
|
||||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||||
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()) ?></span></a>
|
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName1()); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName1()); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a>
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,14 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<section class="portlet">
|
<section class="portlet">
|
||||||
<div class="portlet-head"><?= $this->getHtml('Draft') ?><i class="fa fa-download floatRight download btn"></i></div>
|
<div class="portlet-head"><?= $this->getHtml('Draft'); ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||||
<table id="newsDraftList" class="default">
|
<table id="newsDraftList" class="default">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $this->getHtml('Type') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td><?= $this->getHtml('Type'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td class="wf-100"><?= $this->getHtml('Title') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td class="wf-100"><?= $this->getHtml('Title'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td><?= $this->getHtml('Author') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td><?= $this->getHtml('Author'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<td><?= $this->getHtml('Date') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
<td><?= $this->getHtml('Date'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php $count = 0; foreach ($articles as $key => $news) : ++$count; $url = UriFactory::build('{/prefix}news/edit?{?}&id=' . $news->getId());
|
<?php $count = 0; foreach ($articles as $key => $news) : ++$count; $url = UriFactory::build('{/prefix}news/edit?{?}&id=' . $news->getId());
|
||||||
$color = 'darkred';
|
$color = 'darkred';
|
||||||
|
|
@ -43,7 +43,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
elseif ($news->getType() === NewsType::LINK) { $color = 'yellow'; }
|
elseif ($news->getType() === NewsType::LINK) { $color = 'yellow'; }
|
||||||
?>
|
?>
|
||||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||||
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()) ?></span></a>
|
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName1()); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName1()); ?></a>
|
||||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a>
|
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a>
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ namespace Modules\News\tests\Admin;
|
||||||
class AdminTest extends \PHPUnit\Framework\TestCase
|
class AdminTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
protected const MODULE_NAME = 'News';
|
protected const MODULE_NAME = 'News';
|
||||||
|
|
||||||
protected const URI_LOAD = 'http://127.0.0.1/en/backend/news';
|
protected const URI_LOAD = 'http://127.0.0.1/en/backend/news';
|
||||||
|
|
||||||
use \Modules\tests\ModuleTestTrait;
|
use \Modules\tests\ModuleTestTrait;
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ use phpOMS\Uri\HttpUri;
|
||||||
trait ApiControllerNewsArticleTrait
|
trait ApiControllerNewsArticleTrait
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @testdox A news article can be created
|
* @testdox A news article can be created
|
||||||
* @covers Modules\News\Controller\ApiController
|
* @covers Modules\News\Controller\ApiController
|
||||||
* @group module
|
* @group module
|
||||||
*/
|
*/
|
||||||
public function testApiNewsCreate() : void
|
public function testApiNewsCreate() : void
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ use phpOMS\Utils\TestUtils;
|
||||||
class ControllerTest extends \PHPUnit\Framework\TestCase
|
class ControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
protected $app = null;
|
protected $app = null;
|
||||||
|
|
||||||
protected $module = null;
|
protected $module = null;
|
||||||
|
|
||||||
protected function setUp() : void
|
protected function setUp() : void
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ class NewsArticleTest extends \PHPUnit\Framework\TestCase
|
||||||
* @testdox A invalid status throws a InvalidEnumValue exception
|
* @testdox A invalid status throws a InvalidEnumValue exception
|
||||||
* @covers Modules\News\Models\NewsArticle
|
* @covers Modules\News\Models\NewsArticle
|
||||||
* @group module
|
* @group module
|
||||||
*/
|
*/
|
||||||
public function testInvalidStatus() : void
|
public function testInvalidStatus() : void
|
||||||
{
|
{
|
||||||
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||||
|
|
@ -205,7 +205,7 @@ class NewsArticleTest extends \PHPUnit\Framework\TestCase
|
||||||
* @testdox A invalid type throws a InvalidEnumValue exception
|
* @testdox A invalid type throws a InvalidEnumValue exception
|
||||||
* @covers Modules\News\Models\NewsArticle
|
* @covers Modules\News\Models\NewsArticle
|
||||||
* @group module
|
* @group module
|
||||||
*/
|
*/
|
||||||
public function testInvalidType() : void
|
public function testInvalidType() : void
|
||||||
{
|
{
|
||||||
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||||
|
|
@ -218,7 +218,7 @@ class NewsArticleTest extends \PHPUnit\Framework\TestCase
|
||||||
* @testdox A invalid language throws a InvalidEnumValue exception
|
* @testdox A invalid language throws a InvalidEnumValue exception
|
||||||
* @covers Modules\News\Models\NewsArticle
|
* @covers Modules\News\Models\NewsArticle
|
||||||
* @group module
|
* @group module
|
||||||
*/
|
*/
|
||||||
public function testInvalidLanguage() : void
|
public function testInvalidLanguage() : void
|
||||||
{
|
{
|
||||||
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user