1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 23:00:51 +03:00

Возможность отображения дополнительных полей в предпросмотре топика

This commit is contained in:
Mzhelskiy Maxim 2014-09-26 13:38:00 +07:00
parent 4950b92c5a
commit 16b52c78dc
2 changed files with 8 additions and 3 deletions

View file

@ -509,14 +509,19 @@ class ActionContent extends Action {
$oTopic->setUserId($this->oUserCurrent->getId());
$oTopic->setType($sType);
$oTopic->setPublish(1);
$oTopic->setProperties(getRequest('property'));
/**
* Валидируем необходимые поля топика
*/
$oTopic->_Validate(array('topic_title','topic_text','topic_tags','topic_type'),false);
$oTopic->_Validate(array('topic_title','topic_text','topic_tags','topic_type','properties'),false);
if ($oTopic->_hasValidateErrors()) {
$this->Message_AddErrorSingle($oTopic->_getValidateError());
return false;
}
/**
* Аттачим дополнительные поля к топику
*/
$this->Property_AttachPropertiesForTarget($oTopic,$oTopic->getPropertiesObject());
/**
* Формируем текст топика
*/

View file

@ -235,7 +235,7 @@ class ModuleProperty extends ModuleORM {
$oValueType->setValueForValidate($sValue);
if (true===($sRes=$oValueType->validate())) {
$oValueType->setValue($oValueType->getValueForValidate());
$aPropertiesResult[]=$oProperty;
$aPropertiesResult[$oProperty->getId()]=$oProperty;
} else {
return $sRes ? $sRes : 'Неверное значение аттрибута: '.$oProperty->getTitle();
}
@ -298,7 +298,7 @@ class ModuleProperty extends ModuleORM {
* @param Entity $oTarget Объект сущности
* @param array $aProperties Список свойств
*/
protected function AttachPropertiesForTarget($oTarget,$aProperties) {
public function AttachPropertiesForTarget($oTarget,$aProperties) {
$oTarget->setPropertyList($aProperties);
$oTarget->setPropertyIsLoadAll(true);
$aMapperCode=array();