mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 14:50: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_NOT_ACTIVE = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Объект маппера
|
||||
*
|
||||
|
|
|
@ -143,7 +143,8 @@ class ModuleTopic_EntityTopic extends Entity
|
|||
public function ValidatePublishDateCheck($aValue, $aParams)
|
||||
{
|
||||
$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'])) {
|
||||
$sDateFull = $aValue['date'] . ' ' . $aValue['time'];
|
||||
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();
|
||||
}
|
||||
|
||||
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() : ''}
|
||||
{/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())}
|
||||
{$iDatePublish = null}
|
||||
{if $topic}
|
||||
|
|
Loading…
Reference in a new issue