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-13 13:13:27 +07:00
parent 567c5a63f9
commit 32d3f990be
13 changed files with 146 additions and 1 deletions

View file

@ -0,0 +1,38 @@
<?php
/*-------------------------------------------------------
*
* LiveStreet Engine Social Networking
* Copyright © 2008 Mzhelskiy Maxim
*
*--------------------------------------------------------
*
* Official site: www.livestreet.ru
* Contact e-mail: rus.engine@gmail.com
*
* GNU General Public License, version 2:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
---------------------------------------------------------
*/
/**
* Обработка блока с редактированием свойств объекта
*
* @package blocks
* @since 1.0
*/
class BlockPropertyUpdate extends Block {
/**
* Запуск обработки
*/
public function Exec() {
$sTargetType=$this->GetParam('target_type');
$iTargetId=$this->GetParam('target_id');
/**
* Получаем набор свойств
*/
$aProperties=$this->Property_GetPropertyItemsByFilter(array('target_type'=>$sTargetType,'#order'=>array('sort'=>'desc')));
$this->Property_AttachValueForProperties($aProperties,$sTargetType,$iTargetId);
$this->Viewer_Assign('aProperties',$aProperties);
}
}

View file

@ -0,0 +1,10 @@
{*
Вывод дополнительных полей для ввода данных на странице создания нового объекта
*}
{if $aProperties}
{foreach $aProperties as $oProperty}
{include file="forms/property/form.field_render.tpl" oProperty=$oProperty}
{/foreach}
{/if}

View file

@ -104,7 +104,6 @@
{* Показывает дополнительные поля *}
{$aBlockParams = []}
{$aBlockParams.plugin = 'admin'}
{$aBlockParams.target_type = 'topic_'|cat:$sTopicType}
{if $oTopicEdit}
{$aBlockParams.target_id = $oTopicEdit->getId()}

View file

@ -0,0 +1,6 @@
{$oValue = $oProperty->getValue()}
{include file="forms/fields/form.field.checkbox.tpl"
sFieldName = "property[{$oProperty->getId()}]"
bFieldChecked = $oValue->getValueInt()
sFieldLabel = $oProperty->getTitle()}

View file

@ -0,0 +1,7 @@
{$oValue = $oProperty->getValue()}
{include file="forms/fields/form.field.text.tpl"
sFieldName = "property[{$oProperty->getId()}]"
sFieldValue = $oValue->getValueFloat()
sFieldClasses = 'width-150'
sFieldLabel = $oProperty->getTitle()}

View file

@ -0,0 +1,7 @@
{$oValue = $oProperty->getValue()}
{include file="forms/fields/form.field.text.tpl"
sFieldName = "property[{$oProperty->getId()}]"
sFieldValue = $oValue->getValueInt()
sFieldClasses = 'width-150'
sFieldLabel = $oProperty->getTitle()}

View file

@ -0,0 +1,20 @@
{* TODO: Форма с селектом не отправляется (аякс ошибка) *}
{$oValue=$oProperty->getValue()}
{$aValues=$oValue->getValueForForm()}
{$aSelectItems=$oProperty->getSelects()}
{$oProperty->getTitle()}:
<br>
<select name="property[{$oProperty->getId()}][]" {if $oProperty->getValidateRuleOne('allowMany')}multiple="multiple" class="select-multiple" {/if}>
{if $oProperty->getValidateRuleOne('allowEmpty')}
<option value=""></option>
{/if}
{foreach $aSelectItems as $oSelectItem}
<option value="{$oSelectItem->getId()}" {if isset($aValues[$oSelectItem->getId()])}selected="selected"{/if}>{$oSelectItem->getValue()}</option>
{/foreach}
</select>
<br/><br/>

View file

@ -0,0 +1,13 @@
{$oValue = $oProperty->getValue()}
{include file="forms/fields/form.field.text.tpl"
sFieldName = "property[{$oProperty->getId()}]"
sFieldValue = $oValue->getValueVarchar()
sFieldId = "property-value-tags-{$oProperty->getId()}"
sFieldLabel = $oProperty->getTitle()}
<script>
jQuery(function($){
ls.autocomplete.add($("#property-value-tags-{$oProperty->getId()}"), aRouter['ajax']+'property/tags/autocompleter/', true, { property_id: '{$oValue->getPropertyId()}' });
});
</script>

View file

@ -0,0 +1,7 @@
{$oValue = $oProperty->getValue()}
{include file="forms/fields/form.field.textarea.tpl"
sFieldName = "property[{$oProperty->getId()}]"
sFieldValue = $oValue->getValueForForm()
iFieldRows = 10
sFieldLabel = $oProperty->getTitle()}

View file

@ -0,0 +1,6 @@
{$oValue = $oProperty->getValue()}
{include file="forms/fields/form.field.text.tpl"
sFieldName = "property[{$oProperty->getId()}]"
sFieldValue = $oValue->getValueVarchar()
sFieldLabel = $oProperty->getTitle()}

View file

@ -0,0 +1,10 @@
{$oValue = $oProperty->getValue()}
{include file="forms/fields/form.field.text.tpl"
sFieldName = "property[{$oProperty->getId()}]"
sFieldValue = $oValue->getValueVarchar()
sFieldClasses = 'width-300'
sFieldLabel = $oProperty->getTitle()}
{include file="modals/modal.property_type_video.tpl" oValue=$oValue}
<p class="mb-20"><a href="#" class="link-dotted" data-modal-target="modal-property-type-video-{$oValue->getId()}">Смотреть</a></p>

View file

@ -0,0 +1,3 @@
{$sType = $oProperty->getType()}
{include file="forms/property/form.field.{$sType}.tpl" oProperty=$oProperty}

View file

@ -0,0 +1,19 @@
{**
* Модальное окно с предпросмотром видео для свойства с типом video
*
* @styles css/modals.css
*}
{extends file='modals/modal_base.tpl'}
{block name='modal_id'}modal-property-type-video-{$oValue->getId()}{/block}
{block name='modal_class'}modal-property js-modal-default{/block}
{block name='modal_title'}Предпросмотр видео{/block}
{block name='modal_content'}
<div>
{$oValue->getValueTypeObject()->getVideoCodeFrame()}
</div>
{/block}
{block name='modal_footer'}{/block}