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-01-12 00:17:40 +07:00
parent cc12a13be2
commit c6c2a0a166
3 changed files with 18 additions and 8 deletions

View file

@ -26,7 +26,7 @@ class ModuleProperty_EntityProperty extends EntityORM {
array('code','regexp','allowEmpty'=>false,'pattern'=>'#^[a-z0-9\_]+$#i','on'=>array('create','update')),
array('title','string','allowEmpty'=>false,'min'=>1,'max'=>250,'on'=>array('create','update')),
array('sort','number','allowEmpty'=>false,'integerOnly'=>true,'min'=>0,'on'=>array('update')),
array('validate_rules_raw','check_validate_rules_raw','on'=>array('update')),
array('validate_rules_raw','check_validate_rules_raw','on'=>array('create','update')),
array('params_raw','check_params_raw','on'=>array('update')),
array('title','check_title','on'=>array('create','update')),
);

View file

@ -88,7 +88,7 @@ class ModuleTopic extends Module {
*/
public function GetTopicsAdditionalData($aTopicId,$aAllowData=null) {
if (is_null($aAllowData)) {
$aAllowData=array('user'=>array(),'blog'=>array('owner'=>array(),'relation_user'),'vote','favourite','comment_new');
$aAllowData=array('user'=>array(),'blog'=>array('owner'=>array(),'relation_user'),'vote','favourite','comment_new','properties');
}
func_array_simpleflip($aAllowData);
if (!is_array($aTopicId)) {
@ -171,6 +171,12 @@ class ModuleTopic extends Module {
$oTopic->setDateRead(date("Y-m-d H:i:s"));
}
}
/**
* Цепляем дополнительные поля
*/
if (isset($aAllowData['properties'])) {
$this->Property_RewriteGetItemsByFilter($aTopics,array('#properties'=>true));
}
return $aTopics;
}
/**

View file

@ -91,13 +91,17 @@
{/if}
{/block}
{$aProperties = $oTopic->getPropertyList()}
{foreach $aProperties as $oProperty}
<br/>
{$mValue = $oProperty->getValue()->getValueForDisplay()}
{block name='topic_content_properties'}
{if !$bTopicList}
{$aProperties = $oTopic->getPropertyList()}
{foreach $aProperties as $oProperty}
<br/>
{$mValue = $oProperty->getValue()->getValueForDisplay()}
<b>{$oProperty->getTitle()}</b>: {$mValue}
{/foreach}
<b>{$oProperty->getTitle()}</b>: {$mValue}
{/foreach}
{/if}
{/block}
{hook run='topic_content_end' topic=$oTopic bTopicList=$bTopicList}
</div>