mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
рефакторинг
This commit is contained in:
parent
c66ccf5ded
commit
0ee6da5c81
|
@ -30,7 +30,7 @@ class ModuleTopic extends Module
|
||||||
|
|
||||||
const TOPIC_TYPE_STATE_ACTIVE = 1;
|
const TOPIC_TYPE_STATE_ACTIVE = 1;
|
||||||
const TOPIC_TYPE_STATE_NOT_ACTIVE = 0;
|
const TOPIC_TYPE_STATE_NOT_ACTIVE = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Объект маппера
|
* Объект маппера
|
||||||
*
|
*
|
||||||
|
|
|
@ -143,7 +143,8 @@ class ModuleTopic_EntityTopic extends Entity
|
||||||
public function ValidatePublishDateCheck($aValue, $aParams)
|
public function ValidatePublishDateCheck($aValue, $aParams)
|
||||||
{
|
{
|
||||||
$oTopicType = $this->getTypeObject();
|
$oTopicType = $this->getTypeObject();
|
||||||
if ($oTopicType and ($oTopicType->getParam('allow_deferred_all') or ($oTopicType->getParam('allow_deferred_admin') and $oUser = $this->getUserCreator() and $oUser->isAdministrator()))) {
|
$oUser = $this->getUserCreator();
|
||||||
|
if ($oTopicType and $oTopicType->isAllowCreateDeferredTopic($oUser)) {
|
||||||
if ((!$this->getId() or !$this->getPublishDraft()) and isset($aValue['date']) and is_string($aValue['date']) and isset($aValue['time']) and is_string($aValue['time'])) {
|
if ((!$this->getId() or !$this->getPublishDraft()) and isset($aValue['date']) and is_string($aValue['date']) and isset($aValue['time']) and is_string($aValue['time'])) {
|
||||||
$sDateFull = $aValue['date'] . ' ' . $aValue['time'];
|
$sDateFull = $aValue['date'] . ' ' . $aValue['time'];
|
||||||
if ($this->Validate_Validate('date', $sDateFull, array('format' => 'dd.MM.yyyy HH:mm', 'allowEmpty' => true))) {
|
if ($this->Validate_Validate('date', $sDateFull, array('format' => 'dd.MM.yyyy HH:mm', 'allowEmpty' => true))) {
|
||||||
|
|
|
@ -135,4 +135,12 @@ class ModuleTopic_EntityTopicType extends Entity
|
||||||
{
|
{
|
||||||
return 'topic_' . $this->getCode();
|
return 'topic_' . $this->getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isAllowCreateDeferredTopic($oUser)
|
||||||
|
{
|
||||||
|
if (!$oUser) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $this->getParam('allow_deferred_all') or ($this->getParam('allow_deferred_admin') and $oUser->isAdministrator());
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -132,7 +132,7 @@
|
||||||
targetId = ( $topic ) ? $topic->getId() : ''}
|
targetId = ( $topic ) ? $topic->getId() : ''}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if $type->getParam('allow_deferred_all') or ($type->getParam('allow_deferred_admin') and $oUserCurrent->isAdministrator())}
|
{if $type->isAllowCreateDeferredTopic($oUserCurrent)}
|
||||||
{if !$topic or !$topic->getPublishDraft() or ($topic->getDatePublish() and strtotime($topic->getDatePublish()) > time())}
|
{if !$topic or !$topic->getPublishDraft() or ($topic->getDatePublish() and strtotime($topic->getDatePublish()) > time())}
|
||||||
{$iDatePublish = null}
|
{$iDatePublish = null}
|
||||||
{if $topic}
|
{if $topic}
|
||||||
|
|
Loading…
Reference in a new issue