mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Доработка дополнительных полей
This commit is contained in:
parent
7c03509f0e
commit
25665109b2
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]"
|
||||
|
|
|
@ -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[] = [
|
||||
|
|
|
@ -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}
|
|
@ -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}
|
|
@ -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
|
Loading…
Reference in a new issue