ModuleTopic_EntityTopic

Package modules.topic
Inheritance class ModuleTopic_EntityTopic » Entity » LsObject
Since 1.0
Source Code /classes/modules/topic/entity/Topic.entity.class.php
Объект сущности топика

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
_aData array Данные сущности, на этот массив мапятся методы set* и get* Entity
aExtra array Массив объектов(не всегда) для дополнительных типов топиков(линки, опросы, подкасты и т.п.) ModuleTopic_EntityTopic
aValidateErrors array Список ошибок валидации в разрезе полей, например Entity
aValidateRules array Список правил валидации полей Entity
sPrimaryKey null|string Имя поля с первичным ключом в БД Entity
sValidateScenario string Сценарий валиадции полей Entity

Public Methods

Hide inherited methods

MethodDescriptionDefined By
Init() Определяем правила валидации ModuleTopic_EntityTopic
ValidateBlogId() Валидация ID блога ModuleTopic_EntityTopic
ValidateTopicType() Проверка типа топика ModuleTopic_EntityTopic
ValidateTopicUnique() Проверка топика на уникальность ModuleTopic_EntityTopic
_Validate() Выполняет валидацию данных сущности Entity
__call() Ставим хук на вызов неизвестного метода и считаем что хотели вызвать метод какого либо модуля Entity
__construct() Если передать в конструктор ассоциативный массив свойств и их значений, то они автоматом загрузятся в сущность Entity
_addValidateError() Добавляет для поля ошибку в список ошибок Entity
_clearValidateErrors() Очищает список всех ошибок или для конкретного поля Entity
_createValidators() Создает и возвращает список валидаторов для сущности Entity
_getData() Получает массив данных сущности Entity
_getDataArray() Рекурсивное преобразование объекта и вложенных объектов в массив Entity
_getDataOne() Возвращает данные по конкретному полю Entity
_getPrimaryKey() Получение первичного ключа сущности (ключ, а не значение!) Entity
_getPrimaryKeyValue() Возвращает значение первичного ключа/поля Entity
_getValidateError() Возвращает первую ошибку для поля или среди всех полей Entity
_getValidateErrors() Возвращает список ошибок для всех полей или одного поля Entity
_getValidateScenario() Возвращает текущий сценарий валидации Entity
_getValidators() Возвращает список валидаторов с учетом текущего сценария Entity
_hasValidateErrors() Проверяет есть ли ошибки валидации Entity
_setData() Устанавливает данные сущности Entity
_setValidateScenario() Устанавливает сценарий валидации Entity
addQuestionAnswer() Добавляет вариант ответа в топик-опрос ModuleTopic_EntityTopic
clearQuestionAnswer() Очищает варианты ответа в топике-опрос ModuleTopic_EntityTopic
getBlog() Возвращает объект блого, в котором находится топик ModuleTopic_EntityTopic
getBlogId() Возвращает ID блога ModuleTopic_EntityTopic
getCountComment() Возвращает количество комментариев к топику ModuleTopic_EntityTopic
getCountCommentNew() Возвращает количество новых комментариев в топике для текущего пользователя ModuleTopic_EntityTopic
getCountFavourite() Возвращает количество добавивших топик в избранное ModuleTopic_EntityTopic
getCountRead() Возвращает число прочтений топика ModuleTopic_EntityTopic
getCountVote() Возвращает число проголосовавших за топик ModuleTopic_EntityTopic
getCountVoteAbstain() Возвращает число воздержавшихся при голосовании за топик ModuleTopic_EntityTopic
getCountVoteDown() Возвращает число проголосовавших за топик отрицательно ModuleTopic_EntityTopic
getCountVoteUp() Возвращает число проголосовавших за топик положительно ModuleTopic_EntityTopic
getCutText() Возвращает текст ката ModuleTopic_EntityTopic
getDateAdd() Возвращает дату создания топика ModuleTopic_EntityTopic
getDateEdit() Возвращает дату редактирования топика ModuleTopic_EntityTopic
getDateRead() Возвращает дату прочтения топика для текущего пользователя ModuleTopic_EntityTopic
getExtra() Возвращает сериализованные строку дополнительный данных топика ModuleTopic_EntityTopic
getForbidComment() Возвращает статус запрета комментировать топик ModuleTopic_EntityTopic
getId() Возвращает ID топика ModuleTopic_EntityTopic
getIsFavourite() Проверяет находится ли данный топик в избранном у текущего пользователя ModuleTopic_EntityTopic
getLinkCountJump() Возвращает количество переходов по ссылке в топике-ссылке ModuleTopic_EntityTopic
getLinkUrl() Возвращает URL для топика-ссылки ModuleTopic_EntityTopic
getPhotosetCount() Возвращает количество фотографий в топике-фотосете ModuleTopic_EntityTopic
getPhotosetMainPhotoId() Возвращает ID главной фото в топике-фотосете ModuleTopic_EntityTopic
getPhotosetPhotos() Возвращает фотографии из топика-фотосета ModuleTopic_EntityTopic
getPublish() Возвращает статус опубликованности топика ModuleTopic_EntityTopic
getPublishDraft() Возвращает статус опубликованности черновика ModuleTopic_EntityTopic
getPublishIndex() Возвращает статус публикации топика на главной странице ModuleTopic_EntityTopic
getQuestionAnswerMax() Возвращает максимально количество ответов на вариант в топике-опросе ModuleTopic_EntityTopic
getQuestionAnswerPercent() Возвращает в процентах количество проголосовавших за конкретный вариант ModuleTopic_EntityTopic
getQuestionAnswers() Возвращает варианты ответа в топике-опрос ModuleTopic_EntityTopic
getQuestionCountVote() Возвращает общее число принявших участие в опросе в топике-опросе ModuleTopic_EntityTopic
getQuestionCountVoteAbstain() Возвращает число воздержавшихся от участия в опросе в топике-опросе ModuleTopic_EntityTopic
getRating() Возвращает рейтинг топика ModuleTopic_EntityTopic
getSubscribeNewComment() Возвращает объект подписки на новые комментарии к топику ModuleTopic_EntityTopic
getTags() Возвращает строку со списком тегов через запятую ModuleTopic_EntityTopic
getTagsArray() Возвращает массив тегов ModuleTopic_EntityTopic
getText() Возвращает текст топика ModuleTopic_EntityTopic
getTextHash() Возвращает хеш топика для проверки топика на уникальность ModuleTopic_EntityTopic
getTextShort() Возвращает короткий текст топика (до ката) ModuleTopic_EntityTopic
getTextSource() Возвращает исходный текст топика, без примененя парсера тегов ModuleTopic_EntityTopic
getTitle() Возвращает заголовок топика ModuleTopic_EntityTopic
getType() Возвращает тип топика ModuleTopic_EntityTopic
getUrl() Возвращает полный URL до топика ModuleTopic_EntityTopic
getUser() Возвращает объект пользователя, автора топик ModuleTopic_EntityTopic
getUserId() Возвращает ID пользователя ModuleTopic_EntityTopic
getUserIp() Возвращает IP пользователя ModuleTopic_EntityTopic
getUserQuestionIsVote() Возвращает статус голосовал ли пользователь в топике-опросе ModuleTopic_EntityTopic
getVote() Возвращает объект голосования за топик текущим пользователем ModuleTopic_EntityTopic
increaseQuestionAnswerVote() Увеличивает количество ответов на данный вариант в топике-опросе ModuleTopic_EntityTopic
setBlog() Устанавливает объект блога ModuleTopic_EntityTopic
setBlogId() Устанавливает ID блога ModuleTopic_EntityTopic
setCountComment() Устанавливает количество комментариев ModuleTopic_EntityTopic
setCountCommentNew() Устанавливает количество новых комментариев ModuleTopic_EntityTopic
setCountFavourite() Устанавливает количество пользователей, добавивших топик в избранное ModuleTopic_EntityTopic
setCountRead() Устанавливает число прочтения топика ModuleTopic_EntityTopic
setCountVote() Устанавливает количество проголосовавших ModuleTopic_EntityTopic
setCountVoteAbstain() Устанавливает число воздержавшихся ModuleTopic_EntityTopic
setCountVoteDown() Устанавливает количество проголосовавших в минус ModuleTopic_EntityTopic
setCountVoteUp() Устанавливает количество проголосовавших в плюс ModuleTopic_EntityTopic
setCutText() Устанавливает текст ката ModuleTopic_EntityTopic
setDateAdd() Устанавливает дату создания топика ModuleTopic_EntityTopic
setDateEdit() Устанавливает дату редактирования топика ModuleTopic_EntityTopic
setDateRead() Устанавливает дату прочтения топика текущим пользователем ModuleTopic_EntityTopic
setExtra() Устанавливает сериализованную строчку дополнительных данных ModuleTopic_EntityTopic
setForbidComment() Устанавливает флаг запрета коментирования топика ModuleTopic_EntityTopic
setId() Устанваливает ID топика ModuleTopic_EntityTopic
setLinkCountJump() Устанавливает количество переходов по ссылке в топике-ссылке ModuleTopic_EntityTopic
setLinkUrl() Устанавливает URL для топика-ссылки ModuleTopic_EntityTopic
setPhotosetCount() Устанавливает количество фотографий в топике-фотосете ModuleTopic_EntityTopic
setPhotosetMainPhotoId() Устанавливает ID главной фото в топике-фотосете ModuleTopic_EntityTopic
setPublish() Устанавливает флаг публикации топика ModuleTopic_EntityTopic
setPublishDraft() Устанавливает флаг публикации черновика ModuleTopic_EntityTopic
setPublishIndex() Устанавливает флаг публикации на главной странице ModuleTopic_EntityTopic
setQuestionCountVote() Устанавливает общее число принявших участие в опросе в топике-опросе ModuleTopic_EntityTopic
setQuestionCountVoteAbstain() Устанавливает число воздержавшихся от участия в опросе в топике-опросе ModuleTopic_EntityTopic
setRating() Устанавливает рейтинг топика ModuleTopic_EntityTopic
setTags() Устанавливает список тегов в виде строки ModuleTopic_EntityTopic
setText() Устанавливает текст топика ModuleTopic_EntityTopic
setTextHash() Устанавливает хеш топика ModuleTopic_EntityTopic
setTextShort() Устанавливает короткий текст топика до ката ModuleTopic_EntityTopic
setTextSource() Устаналивает исходный текст топика ModuleTopic_EntityTopic
setTitle() Устанавливает заголовок топика ModuleTopic_EntityTopic
setType() Устанавливает тип топика ModuleTopic_EntityTopic
setUser() Устанавливает объект пользователя ModuleTopic_EntityTopic
setUserId() Устанавливает ID пользователя ModuleTopic_EntityTopic
setUserIp() Устанавливает IP пользователя ModuleTopic_EntityTopic
setUserQuestionIsVote() Устанавливает факт голосования пользователя в топике-опросе ModuleTopic_EntityTopic
setVote() Устанавливает объект голосования за топик ModuleTopic_EntityTopic

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
extractExtra() Извлекает сериализованные данные топика ModuleTopic_EntityTopic
getExtraValue() Извлекает значение параметра ModuleTopic_EntityTopic
setExtraValue() Устанавливает значение нужного параметра ModuleTopic_EntityTopic

Property Details

aExtra property
protected array $aExtra;

Массив объектов(не всегда) для дополнительных типов топиков(линки, опросы, подкасты и т.п.)

Method Details

Init() method
public void Init()
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#35 (show)
public function Init() {
    
parent::Init();
    
$this->aValidateRules[]=array('topic_title','string','max'=>200,'min'=>2,'allowEmpty'=>false,'label'=>$this->Lang_Get('topic_create_title'),'on'=>array('topic','link','photoset'));
    
$this->aValidateRules[]=array('topic_title','string','max'=>200,'min'=>2,'allowEmpty'=>false,'label'=>$this->Lang_Get('topic_question_create_title'),'on'=>array('question'));
    
$this->aValidateRules[]=array('topic_text_source','string','max'=>Config::Get('module.topic.max_length'),'min'=>2,'allowEmpty'=>false,'label'=>$this->Lang_Get('topic_create_text'),'on'=>array('topic','photoset'));
    
$this->aValidateRules[]=array('topic_text_source','string','max'=>500,'min'=>10,'allowEmpty'=>false,'label'=>$this->Lang_Get('topic_create_text'),'on'=>array('link'));
    
$this->aValidateRules[]=array('topic_text_source','string','max'=>500,'allowEmpty'=>true,'label'=>$this->Lang_Get('topic_create_text'),'on'=>array('question'));
    
$this->aValidateRules[]=array('topic_tags','tags','count'=>15,'label'=>$this->Lang_Get('topic_create_tags'),'allowEmpty'=>Config::Get('module.topic.allow_empty_tags'),'on'=>array('topic','link','question','photoset'));
    
$this->aValidateRules[]=array('blog_id','blog_id','on'=>array('topic','link','question','photoset'));
    
$this->aValidateRules[]=array('topic_text_source','topic_unique','on'=>array('topic','link','question','photoset'));
    
$this->aValidateRules[]=array('topic_type','topic_type','on'=>array('topic','link','question','photoset'));
    
$this->aValidateRules[]=array('link_url','url','allowEmpty'=>false,'label'=>$this->Lang_Get('topic_link_create_url'),'on'=>array('link'));
}

Определяем правила валидации

ValidateBlogId() method
public bool|string ValidateBlogId(string $sValue, array $aParams)
$sValue string Проверяемое значение
$aParams array Параметры
{return} bool|string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#85 (show)
public function ValidateBlogId($sValue,$aParams) {
    if (
$sValue==0) {
        return 
true// персональный блог
    
}
    if (
$this->Blog_GetBlogById((string)$sValue)) {
        return 
true;
    }
    return 
$this->Lang_Get('topic_create_blog_error_unknown');
}

Валидация ID блога

ValidateTopicType() method
public bool|string ValidateTopicType(string $sValue, array $aParams)
$sValue string Проверяемое значение
$aParams array Параметры
{return} bool|string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#55 (show)
public function ValidateTopicType($sValue,$aParams) {
    if (
$this->Topic_IsAllowTopicType($sValue)) {
        return 
true;
    }
    return 
$this->Lang_Get('topic_create_type_error');
}

Проверка типа топика

ValidateTopicUnique() method
public bool|string ValidateTopicUnique(string $sValue, array $aParams)
$sValue string Проверяемое значение
$aParams array Параметры
{return} bool|string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#68 (show)
public function ValidateTopicUnique($sValue,$aParams) {
    
$this->setTextHash(md5($this->getType().$sValue.$this->getTitle()));
    if (
$oTopicEquivalent=$this->Topic_GetTopicUnique($this->getUserId(),$this->getTextHash())) {
        if (
$iId=$this->getId() and $oTopicEquivalent->getId()==$iId) {
            return 
true;
        }
        return 
$this->Lang_Get('topic_create_text_error_unique');
    }
    return 
true;
}

Проверка топика на уникальность

addQuestionAnswer() method
public void addQuestionAnswer(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#517 (show)
public function addQuestionAnswer($data) {
    if (
$this->getType()!='question') {
        return;
    }
    
$this->extractExtra();
    
$this->aExtra['answers'][]=array('text'=>$data,'count'=>0);
    
$this->setExtra($this->aExtra);
}

Добавляет вариант ответа в топик-опрос

clearQuestionAnswer() method
public void clearQuestionAnswer()
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#528 (show)
public function clearQuestionAnswer() {
    if (
$this->getType()!='question') {
        return;
    }
    
$this->setExtraValue('answers',array());
}

Очищает варианты ответа в топике-опрос

extractExtra() method
protected void extractExtra()
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#417 (show)
protected function extractExtra() {
    if (
is_null($this->aExtra)) {
        
$this->aExtra=@unserialize($this->getExtra());
    }
}

Извлекает сериализованные данные топика

getBlog() method
public ModuleBlog_EntityBlog|null getBlog()
{return} ModuleBlog_EntityBlog|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#347 (show)
public function getBlog() {
    return 
$this->_getDataOne('blog');
}

Возвращает объект блого, в котором находится топик

getBlogId() method
public int|null getBlogId()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#108 (show)
public function getBlogId() {
    return 
$this->_getDataOne('blog_id');
}

Возвращает ID блога

getCountComment() method
public int|null getCountComment()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#276 (show)
public function getCountComment() {
    return 
$this->_getDataOne('topic_count_comment');
}

Возвращает количество комментариев к топику

getCountCommentNew() method
public int|null getCountCommentNew()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#320 (show)
public function getCountCommentNew() {
    return 
$this->_getDataOne('count_comment_new');
}

Возвращает количество новых комментариев в топике для текущего пользователя

getCountFavourite() method
public int|null getCountFavourite()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#394 (show)
public function getCountFavourite() {
    return 
$this->_getDataOne('topic_count_favourite');
}

Возвращает количество добавивших топик в избранное

getCountRead() method
public int|null getCountRead()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#268 (show)
public function getCountRead() {
    return 
$this->_getDataOne('topic_count_read');
}

Возвращает число прочтений топика

getCountVote() method
public int|null getCountVote()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#236 (show)
public function getCountVote() {
    return 
$this->_getDataOne('topic_count_vote');
}

Возвращает число проголосовавших за топик

getCountVoteAbstain() method
public int|null getCountVoteAbstain()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#260 (show)
public function getCountVoteAbstain() {
    return 
$this->_getDataOne('topic_count_vote_abstain');
}

Возвращает число воздержавшихся при голосовании за топик

getCountVoteDown() method
public int|null getCountVoteDown()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#252 (show)
public function getCountVoteDown() {
    return 
$this->_getDataOne('topic_count_vote_down');
}

Возвращает число проголосовавших за топик отрицательно

getCountVoteUp() method
public int|null getCountVoteUp()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#244 (show)
public function getCountVoteUp() {
    return 
$this->_getDataOne('topic_count_vote_up');
}

Возвращает число проголосовавших за топик положительно

getCutText() method
public string|null getCutText()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#284 (show)
public function getCutText() {
    return 
$this->_getDataOne('topic_cut_text');
}

Возвращает текст ката

getDateAdd() method
public string|null getDateAdd()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#180 (show)
public function getDateAdd() {
    return 
$this->_getDataOne('topic_date_add');
}

Возвращает дату создания топика

getDateEdit() method
public string|null getDateEdit()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#188 (show)
public function getDateEdit() {
    return 
$this->_getDataOne('topic_date_edit');
}

Возвращает дату редактирования топика

getDateRead() method
public string|null getDateRead()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#328 (show)
public function getDateRead() {
    return 
$this->_getDataOne('date_read');
}

Возвращает дату прочтения топика для текущего пользователя

getExtra() method
public string getExtra()
{return} string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#164 (show)
public function getExtra() {
    return 
$this->_getDataOne('topic_extra') ? $this->_getDataOne('topic_extra') : serialize('');
}

Возвращает сериализованные строку дополнительный данных топика

getExtraValue() method
protected null|mixed getExtraValue(string $sName)
$sName string Название параметра
{return} null|mixed
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#439 (show)
protected function getExtraValue($sName) {
    
$this->extractExtra();
    if (isset(
$this->aExtra[$sName])) {
        return 
$this->aExtra[$sName];
    }
    return 
null;
}

Извлекает значение параметра

getForbidComment() method
public int|null getForbidComment()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#292 (show)
public function getForbidComment() {
    return 
$this->_getDataOne('topic_forbid_comment');
}

Возвращает статус запрета комментировать топик

getId() method
public int|null getId()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#100 (show)
public function getId() {
    return 
$this->_getDataOne('topic_id');
}

Возвращает ID топика

getIsFavourite() method
public bool getIsFavourite()
{return} bool
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#383 (show)
public function getIsFavourite() {
    if (
$this->getFavourite()) {
        return 
true;
    }
    return 
false;
}

Проверяет находится ли данный топик в избранном у текущего пользователя

getLinkCountJump() method
public int|null getLinkCountJump()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#494 (show)
public function getLinkCountJump() {
    if (
$this->getType()!='link') {
        return 
null;
    }
    return (int)
$this->getExtraValue('count_jump');
}

Возвращает количество переходов по ссылке в топике-ссылке

getLinkUrl() method
public null|string getLinkUrl(bool $bShort=false)
$bShort bool Укарачивать урл или нет
{return} null|string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#453 (show)
public function getLinkUrl($bShort=false) {
    if (
$this->getType()!='link') {
        return 
null;
    }

    if (
$this->getExtraValue('url')) {
        if (
$bShort) {
            
$sUrl=htmlspecialchars($this->getExtraValue('url'));
            if (
preg_match("/^https?:\/\/(.*)$/i",$sUrl,$aMatch)) {
                
$sUrl=$aMatch[1];
            }
            
$sUrlShort=substr($sUrl,0,30);
            if (
strlen($sUrlShort)!=strlen($sUrl)) {
                return 
$sUrlShort.'...';
            }
            return 
$sUrl;
        }
        
$sUrl=$this->getExtraValue('url');
        if (!
preg_match("/^https?:\/\/(.*)$/i",$sUrl,$aMatch)) {
            
$sUrl='http://'.$sUrl;
        }
        return 
$sUrl;
    }
    return 
null;
}

Возвращает URL для топика-ссылки

getPhotosetCount() method
public int|null getPhotosetCount()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#662 (show)
public function getPhotosetCount() {
    return 
$this->getExtraValue('count_photo');
}

Возвращает количество фотографий в топике-фотосете

getPhotosetMainPhotoId() method
public int|null getPhotosetMainPhotoId()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#670 (show)
public function getPhotosetMainPhotoId() {
    return 
$this->getExtraValue('main_photo_id');
}

Возвращает ID главной фото в топике-фотосете

getPhotosetPhotos() method
public array getPhotosetPhotos(int|null $iFromId=NULL, int|null $iCount=NULL)
$iFromId int|null ID с которого начинать выборку
$iCount int|null Количество
{return} array
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#654 (show)
public function getPhotosetPhotos($iFromId null$iCount null) {
    return 
$this->Topic_getPhotosByTopicId($this->getId(), $iFromId$iCount);
}

Возвращает фотографии из топика-фотосета

getPublish() method
public int|null getPublish()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#204 (show)
public function getPublish() {
    return 
$this->_getDataOne('topic_publish');
}

Возвращает статус опубликованности топика

getPublishDraft() method
public int|null getPublishDraft()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#212 (show)
public function getPublishDraft() {
    return 
$this->_getDataOne('topic_publish_draft');
}

Возвращает статус опубликованности черновика

getPublishIndex() method
public int|null getPublishIndex()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#220 (show)
public function getPublishIndex() {
    return 
$this->_getDataOne('topic_publish_index');
}

Возвращает статус публикации топика на главной странице

getQuestionAnswerMax() method
public int getQuestionAnswerMax()
{return} int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#573 (show)
public function getQuestionAnswerMax() {
    
$aAnswers=$this->getQuestionAnswers();
    
$iMax=0;
    foreach (
$aAnswers as $aAns) {
        if (
$aAns['count']>$iMax) {
            
$iMax=$aAns['count'];
        }
    }
    return 
$iMax;
}

Возвращает максимально количество ответов на вариант в топике-опросе

getQuestionAnswerPercent() method
public int|string getQuestionAnswerPercent(int $sIdAnswer)
$sIdAnswer int ID варианта
{return} int|string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#589 (show)
public function getQuestionAnswerPercent($sIdAnswer) {
    if (
$aAnswers=$this->getQuestionAnswers()) {
        if (isset(
$aAnswers[$sIdAnswer])) {
            
$iCountAll=$this->getQuestionCountVote()-$this->getQuestionCountVoteAbstain();
            if (
$iCountAll==0) {
                return 
0;
            } else {
                return 
number_format(round($aAnswers[$sIdAnswer]['count']*100/$iCountAll,1), 1'.''');
            }
        }
    }
}

Возвращает в процентах количество проголосовавших за конкретный вариант

getQuestionAnswers() method
public array|null getQuestionAnswers(bool $bSortVote=false)
$bSortVote bool
{return} array|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#540 (show)
public function getQuestionAnswers($bSortVote=false) {
    if (
$this->getType()!='question') {
        return 
null;
    }

    if (
$this->getExtraValue('answers')) {
        
$aAnswers=$this->getExtraValue('answers');
        if (
$bSortVote) {
            
uasort($aAnswerscreate_function('$a,$b',"if (\$a['count'] == \$b['count']) { return 0; } return (\$a['count'] < \$b['count']) ? 1 : -1;"));
        }
        return 
$aAnswers;
    }
    return array();
}

Возвращает варианты ответа в топике-опрос

getQuestionCountVote() method
public int|null getQuestionCountVote()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#606 (show)
public function getQuestionCountVote() {
    if (
$this->getType()!='question') {
        return 
null;
    }
    return (int)
$this->getExtraValue('count_vote');
}

Возвращает общее число принявших участие в опросе в топике-опросе

getQuestionCountVoteAbstain() method
public int|null getQuestionCountVoteAbstain()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#628 (show)
public function getQuestionCountVoteAbstain() {
    if (
$this->getType()!='question') {
        return 
null;
    }
    return (int)
$this->getExtraValue('count_vote_abstain');
}

Возвращает число воздержавшихся от участия в опросе в топике-опросе

getRating() method
public string getRating()
{return} string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#228 (show)
public function getRating() {
    return 
number_format(round($this->_getDataOne('topic_rating'),2), 0'.''');
}

Возвращает рейтинг топика

getSubscribeNewComment() method
public ModuleSubscribe_EntitySubscribe|null getSubscribeNewComment()
{return} ModuleSubscribe_EntitySubscribe|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#402 (show)
public function getSubscribeNewComment() {
    if (!(
$oUserCurrent=$this->User_GetUserCurrent())) {
        return 
null;
    }
    return 
$this->Subscribe_GetSubscribeByTargetAndMail('topic_new_comment',$this->getId(),$oUserCurrent->getMail());
}

Возвращает объект подписки на новые комментарии к топику

getTags() method
public string|null getTags()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#172 (show)
public function getTags() {
    return 
$this->_getDataOne('topic_tags');
}

Возвращает строку со списком тегов через запятую

getTagsArray() method
public array getTagsArray()
{return} array
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#309 (show)
public function getTagsArray() {
    if (
$this->getTags()) {
        return 
explode(',',$this->getTags());
    }
    return array();
}

Возвращает массив тегов

getText() method
public string|null getText()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#140 (show)
public function getText() {
    return 
$this->_getDataOne('topic_text');
}

Возвращает текст топика

getTextHash() method
public string|null getTextHash()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#300 (show)
public function getTextHash() {
    return 
$this->_getDataOne('topic_text_hash');
}

Возвращает хеш топика для проверки топика на уникальность

getTextShort() method
public string|null getTextShort()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#148 (show)
public function getTextShort() {
    return 
$this->_getDataOne('topic_text_short');
}

Возвращает короткий текст топика (до ката)

getTextSource() method
public string|null getTextSource()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#156 (show)
public function getTextSource() {
    return 
$this->_getDataOne('topic_text_source');
}

Возвращает исходный текст топика, без примененя парсера тегов

getTitle() method
public string|null getTitle()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#132 (show)
public function getTitle() {
    return 
$this->_getDataOne('topic_title');
}

Возвращает заголовок топика

getType() method
public string|null getType()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#124 (show)
public function getType() {
    return 
$this->_getDataOne('topic_type');
}

Возвращает тип топика

getUrl() method
public string getUrl()
{return} string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#355 (show)
public function getUrl() {
    if (
$this->getBlog()->getType()=='personal') {
        return 
Router::GetPath('blog').$this->getId().'.html';
    } else {
        return 
Router::GetPath('blog').$this->getBlog()->getUrl().'/'.$this->getId().'.html';
    }
}

Возвращает полный URL до топика

getUser() method
public ModuleUser_EntityUser|null getUser()
{return} ModuleUser_EntityUser|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#336 (show)
public function getUser() {
    if (!
$this->_getDataOne('user')) {
        
$this->_aData['user']=$this->User_GetUserById($this->getUserId());
    }
    return 
$this->_getDataOne('user');
}

Возвращает объект пользователя, автора топик

getUserId() method
public int|null getUserId()
{return} int|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#116 (show)
public function getUserId() {
    return 
$this->_getDataOne('user_id');
}

Возвращает ID пользователя

getUserIp() method
public string|null getUserIp()
{return} string|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#196 (show)
public function getUserIp() {
    return 
$this->_getDataOne('topic_user_ip');
}

Возвращает IP пользователя

getUserQuestionIsVote() method
public bool|null getUserQuestionIsVote()
{return} bool|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#375 (show)
public function getUserQuestionIsVote() {
    return 
$this->_getDataOne('user_question_is_vote');
}

Возвращает статус голосовал ли пользователь в топике-опросе

getVote() method
public ModuleVote_EntityVote|null getVote()
{return} ModuleVote_EntityVote|null
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#367 (show)
public function getVote() {
    return 
$this->_getDataOne('vote');
}

Возвращает объект голосования за топик текущим пользователем

increaseQuestionAnswerVote() method
public void increaseQuestionAnswerVote(int $sIdAnswer)
$sIdAnswer int ID варианта ответа
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#559 (show)
public function increaseQuestionAnswerVote($sIdAnswer) {
    if (
$aAnswers=$this->getQuestionAnswers()) {
        if (isset(
$aAnswers[$sIdAnswer])) {
            
$aAnswers[$sIdAnswer]['count']++;
            
$this->aExtra['answers']=$aAnswers;
            
$this->setExtra($this->aExtra);
        }
    }
}

Увеличивает количество ответов на данный вариант в топике-опросе

setBlog() method
public void setBlog(ModuleBlog_EntityBlog $data)
$data ModuleBlog_EntityBlog
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#914 (show)
public function setBlog($data) {
    
$this->_aData['blog']=$data;
}

Устанавливает объект блога

setBlogId() method
public void setBlogId(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#706 (show)
public function setBlogId($data) {
    
$this->_aData['blog_id']=$data;
}

Устанавливает ID блога

setCountComment() method
public void setCountComment(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#874 (show)
public function setCountComment($data) {
    
$this->_aData['topic_count_comment']=$data;
}

Устанавливает количество комментариев

setCountCommentNew() method
public void setCountCommentNew(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#938 (show)
public function setCountCommentNew($data) {
    
$this->_aData['count_comment_new']=$data;
}

Устанавливает количество новых комментариев

setCountFavourite() method
public void setCountFavourite(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#954 (show)
public function setCountFavourite($data) {
    
$this->_aData['topic_count_favourite']=$data;
}

Устанавливает количество пользователей, добавивших топик в избранное

setCountRead() method
public void setCountRead(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#866 (show)
public function setCountRead($data) {
    
$this->_aData['topic_count_read']=$data;
}

Устанавливает число прочтения топика

setCountVote() method
public void setCountVote(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#834 (show)
public function setCountVote($data) {
    
$this->_aData['topic_count_vote']=$data;
}

Устанавливает количество проголосовавших

setCountVoteAbstain() method
public void setCountVoteAbstain(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#858 (show)
public function setCountVoteAbstain($data) {
    
$this->_aData['topic_count_vote_abstain']=$data;
}

Устанавливает число воздержавшихся

setCountVoteDown() method
public void setCountVoteDown(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#850 (show)
public function setCountVoteDown($data) {
    
$this->_aData['topic_count_vote_down']=$data;
}

Устанавливает количество проголосовавших в минус

setCountVoteUp() method
public void setCountVoteUp(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#842 (show)
public function setCountVoteUp($data) {
    
$this->_aData['topic_count_vote_up']=$data;
}

Устанавливает количество проголосовавших в плюс

setCutText() method
public void setCutText(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#882 (show)
public function setCutText($data) {
    
$this->_aData['topic_cut_text']=$data;
}

Устанавливает текст ката

setDateAdd() method
public void setDateAdd(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#778 (show)
public function setDateAdd($data) {
    
$this->_aData['topic_date_add']=$data;
}

Устанавливает дату создания топика

setDateEdit() method
public void setDateEdit(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#786 (show)
public function setDateEdit($data) {
    
$this->_aData['topic_date_edit']=$data;
}

Устанавливает дату редактирования топика

setDateRead() method
public void setDateRead(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#946 (show)
public function setDateRead($data) {
    
$this->_aData['date_read']=$data;
}

Устанавливает дату прочтения топика текущим пользователем

setExtra() method
public void setExtra(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#746 (show)
public function setExtra($data) {
    
$this->_aData['topic_extra']=serialize($data);
}

Устанавливает сериализованную строчку дополнительных данных

setExtraValue() method
protected void setExtraValue(string $sName, mixed $data)
$sName string Название параметра/данных
$data mixed Данные
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#428 (show)
protected function setExtraValue($sName,$data) {
    
$this->extractExtra();
    
$this->aExtra[$sName]=$data;
    
$this->setExtra($this->aExtra);
}

Устанавливает значение нужного параметра

setForbidComment() method
public void setForbidComment(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#890 (show)
public function setForbidComment($data) {
    
$this->_aData['topic_forbid_comment']=$data;
}

Устанавливает флаг запрета коментирования топика

setId() method
public void setId(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#698 (show)
public function setId($data) {
    
$this->_aData['topic_id']=$data;
}

Устанваливает ID топика

setLinkCountJump() method
public void setLinkCountJump(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#505 (show)
public function setLinkCountJump($data) {
    if (
$this->getType()!='link') {
        return;
    }
    
$this->setExtraValue('count_jump',$data);
}

Устанавливает количество переходов по ссылке в топике-ссылке

setLinkUrl() method
public void setLinkUrl(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#483 (show)
public function setLinkUrl($data) {
    if (
$this->getType()!='link') {
        return;
    }
    
$this->setExtraValue('url',$data);
}

Устанавливает URL для топика-ссылки

setPhotosetCount() method
public void setPhotosetCount(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#686 (show)
public function setPhotosetCount($data) {
    
$this->setExtraValue('count_photo',$data);
}

Устанавливает количество фотографий в топике-фотосете

setPhotosetMainPhotoId() method
public void setPhotosetMainPhotoId(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#678 (show)
public function setPhotosetMainPhotoId($data) {
    
$this->setExtraValue('main_photo_id',$data);
}

Устанавливает ID главной фото в топике-фотосете

setPublish() method
public void setPublish(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#802 (show)
public function setPublish($data) {
    
$this->_aData['topic_publish']=$data;
}

Устанавливает флаг публикации топика

setPublishDraft() method
public void setPublishDraft(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#810 (show)
public function setPublishDraft($data) {
    
$this->_aData['topic_publish_draft']=$data;
}

Устанавливает флаг публикации черновика

setPublishIndex() method
public void setPublishIndex(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#818 (show)
public function setPublishIndex($data) {
    
$this->_aData['topic_publish_index']=$data;
}

Устанавливает флаг публикации на главной странице

setQuestionCountVote() method
public void setQuestionCountVote(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#617 (show)
public function setQuestionCountVote($data) {
    if (
$this->getType()!='question') {
        return;
    }
    
$this->setExtraValue('count_vote',$data);
}

Устанавливает общее число принявших участие в опросе в топике-опросе

setQuestionCountVoteAbstain() method
public mixed setQuestionCountVoteAbstain(int $data)
$data int
{return} mixed
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#640 (show)
public function setQuestionCountVoteAbstain($data) {
    if (
$this->getType()!='question') {
        return;
    }
    
$this->setExtraValue('count_vote_abstain',$data);
}

Устанавливает число воздержавшихся от участия в опросе в топике-опросе

setRating() method
public void setRating(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#826 (show)
public function setRating($data) {
    
$this->_aData['topic_rating']=$data;
}

Устанавливает рейтинг топика

setTags() method
public void setTags(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#770 (show)
public function setTags($data) {
    
$this->_aData['topic_tags']=$data;
}

Устанавливает список тегов в виде строки

setText() method
public void setText(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#738 (show)
public function setText($data) {
    
$this->_aData['topic_text']=$data;
}

Устанавливает текст топика

setTextHash() method
public void setTextHash(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#898 (show)
public function setTextHash($data) {
    
$this->_aData['topic_text_hash']=$data;
}

Устанавливает хеш топика

setTextShort() method
public void setTextShort(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#754 (show)
public function setTextShort($data) {
    
$this->_aData['topic_text_short']=$data;
}

Устанавливает короткий текст топика до ката

setTextSource() method
public void setTextSource(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#762 (show)
public function setTextSource($data) {
    
$this->_aData['topic_text_source']=$data;
}

Устаналивает исходный текст топика

setTitle() method
public void setTitle(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#730 (show)
public function setTitle($data) {
    
$this->_aData['topic_title']=$data;
}

Устанавливает заголовок топика

setType() method
public void setType(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#722 (show)
public function setType($data) {
    
$this->_aData['topic_type']=$data;
}

Устанавливает тип топика

setUser() method
public void setUser(ModuleUser_EntityUser $data)
$data ModuleUser_EntityUser
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#906 (show)
public function setUser($data) {
    
$this->_aData['user']=$data;
}

Устанавливает объект пользователя

setUserId() method
public void setUserId(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#714 (show)
public function setUserId($data) {
    
$this->_aData['user_id']=$data;
}

Устанавливает ID пользователя

setUserIp() method
public void setUserIp(string $data)
$data string
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#794 (show)
public function setUserIp($data) {
    
$this->_aData['topic_user_ip']=$data;
}

Устанавливает IP пользователя

setUserQuestionIsVote() method
public void setUserQuestionIsVote(int $data)
$data int
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#922 (show)
public function setUserQuestionIsVote($data) {
    
$this->_aData['user_question_is_vote']=$data;
}

Устанавливает факт голосования пользователя в топике-опросе

setVote() method
public void setVote(ModuleVote_EntityVote $data)
$data ModuleVote_EntityVote
Source Code: /classes/modules/topic/entity/Topic.entity.class.php#930 (show)
public function setVote($data) {
    
$this->_aData['vote']=$data;
}

Устанавливает объект голосования за топик