1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Доработка дополнительных полей

This commit is contained in:
Mzhelskiy Maxim 2015-03-27 16:29:35 +07:00
parent 7c03509f0e
commit 25665109b2
8 changed files with 42 additions and 25 deletions

View file

@ -30,7 +30,7 @@ class ModuleProperty_EntityValueTypeCheckbox extends ModuleProperty_EntityValueT
public function getValueForDisplay()
{
return (bool)$this->getValueObject()->getValueInt();
return $this->getValueObject()->getValueInt() ? 'да' : 'нет';
}
public function getValueForForm()

View file

@ -255,6 +255,12 @@ class ModuleProperty_EntityValueTypeFile extends ModuleProperty_EntityValueType
return null;
}
public function getCountDownloads()
{
$aStats=$this->oValue->getDataOne('stats');
return isset($aStats['count_download']) ? $aStats['count_download'] : 0;
}
/**
* Сохраняет(копирует) файл на сервер
* Если переопределить данный метод, то можно сохранять файл, например, на Amazon S3

View file

@ -1,6 +1,6 @@
{* TODO: Добавить поля datetime и time *}
{$template = ($property->getParam( 'use_time' )) ? 'datetime' : 'time'}
{$template = ($property->getParam( 'use_time' )) ? 'datetime' : 'date'}
{component 'field' template=$template
name = "property[{$property->getId()}][date]"

View file

@ -6,10 +6,13 @@
{/foreach}
{* Формируем значения для селекта *}
{$items = [[
'value' => 0,
'text' => '—'
]]}
{$items = []}
{if !$property->getValidateRuleOne('allowMany')}
{$items[] = [
'value' => 0,
'text' => '—'
]}
{/if}
{foreach $property->getSelects() as $item}
{$items[] = [

View file

@ -1,6 +1,15 @@
{component 'field' template='textarea'
name = "property[{$property->getId()}]"
value = $property->getValue()->getValueForForm()
rows = 10
note = $property->getDescription()
label = $property->getTitle()}
{if $property->getParam( 'use_html' )}
{component 'editor'
name = "property[{$property->getId()}]"
value = $property->getValue()->getValueForForm()
label = $property->getTitle()
inputClasses = 'js-editor-default' }
{else}
{component 'field' template='textarea'
name = "property[{$property->getId()}]"
value = $property->getValue()->getValueForForm()
rows = 10
note = $property->getDescription()
label = $property->getTitle()}
{/if}

View file

@ -2,19 +2,14 @@
{if $property}
{* Проверяем наличие кастомного шаблона item.[type].[target_type].tpl *}
{$template = $smarty.current_dir|cat:"/property.{$property->getType()}.{$property->getTargetType()}.tpl"}
{$template = $LS->Component_GetTemplatePath('property', "output/property.{$property->getType()}.{$property->getTargetType()}" )}
{if $LS->Viewer_TemplateExists( $template )}
{include "{$template}" property=$property}
{else}
{* Проверяем наличие кастомного шаблона item.[type].tpl *}
{$template = $smarty.current_dir|cat:"/property.{$property->getType()}.tpl"}
{if $LS->Viewer_TemplateExists( $template )}
{include "{$template}" property=$property}
{else}
{* Показываем стандартный шаблон *}
{include "./property.default.tpl"}
{if !$template}
{$template = $LS->Component_GetTemplatePath('property', "output/property.{$property->getType()}" )}
{if !$template}
{$template = $LS->Component_GetTemplatePath('property', "output/property.default" )}
{/if}
{/if}
{include "{$template}" property=$property}
{/if}

View file

@ -1,4 +1,5 @@
{$value = $property->getValue()}
{$valueType = $value->getValueTypeObject()}
<div class="property">
<div class="property-list-item-label">
@ -8,6 +9,9 @@
{if $value->getValueVarchar()}
{if $oUserCurrent || ! $property->getParam('access_only_auth')}
<a href="{router page="property/download"}{$value->getValueVarchar()}/">{$value->getValueForDisplay()}</a>
{if $valueType->getCountDownloads()}
<br/>Загрузок: {$valueType->getCountDownloads()}
{/if}
{else}
Для доступа к файлу <a href="#" class="js-modal-toggle-login">необходимо авторизоваться</a>
{/if}

@ -1 +1 @@
Subproject commit 20d3747a40f9a59210208effc4ce748f0f63c57b
Subproject commit 661a71ba2295fe2f0e70aef5e7eb6d8bae0a249e