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 2014-04-11 18:45:25 +07:00
parent 752de765bf
commit 7bb0552e6a

View file

@ -758,6 +758,48 @@ class ModuleProperty extends ModuleORM {
return false;
}
/**
* Используется для создания дефолтных дополнительных полей при активации плагина
*
* @param array $aProperties Список полей
* <pre>
* array(
* array(
* 'data'=>array(
* 'type'=>ModuleProperty::PROPERTY_TYPE_INT,
* 'title'=>'Номер',
* 'code'=>'number',
* 'sort'=>100
* ),
* 'validate_rule'=>array(
* 'min'=>10
* ),
* 'params'=>array(),
* 'additional'=>array()
* )
* );
* </pre>
* @param string $sTargetType Тип объекта
*
* @return bool
*/
public function CreateDefaultTargetPropertyFromPlugin($aProperties,$sTargetType) {
foreach($aProperties as $aProperty) {
$sResultMsg=$this->CreateTargetProperty($sTargetType,$aProperty['data'],true,$aProperty['validate_rule'],$aProperty['params'],$aProperty['additional']);
if ($sResultMsg!==true and !is_object($sResultMsg)) {
if (is_string($sResultMsg)) {
$this->Message_AddErrorSingle($sResultMsg, $this->Lang_Get('error'), true);
}
/**
* Отменяем добавление типа
*/
$this->RemoveTargetType($sTargetType,ModuleProperty::TARGET_STATE_NOT_ACTIVE);
return false;
}
}
return true;
}
public function RemoveValueByPropertyId($iPropertyId) {
$bRes=$this->oMapper->RemoveValueByPropertyId($iPropertyId);
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('ModuleProperty_EntityValue_delete'));