mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Дополнительные поля: новый метод isEmpty
This commit is contained in:
parent
74028f4072
commit
2574199101
|
@ -328,4 +328,11 @@ class ModuleProperty_EntityProperty extends EntityORM
|
|||
return Config::Get('path.uploads.base') . '/property/' . $this->getTargetType() . '/' . $this->getType() . '/' . date('Y/m/d/H/') . ($sPostfix ? "{$sPostfix}/" : '');
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
if (!$oValue = $this->getValue()) {
|
||||
return true;
|
||||
}
|
||||
return $oValue->isEmpty();
|
||||
}
|
||||
}
|
|
@ -47,6 +47,12 @@ class ModuleProperty_EntityValue extends EntityORM
|
|||
return $oValueType->getValueForDisplay();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
$oValueType = $this->getValueTypeObject();
|
||||
return $oValueType->isEmpty();
|
||||
}
|
||||
|
||||
public function getValueForForm()
|
||||
{
|
||||
$oValueType = $this->getValueTypeObject();
|
||||
|
|
|
@ -41,6 +41,11 @@ class ModuleProperty_EntityValueType extends Entity
|
|||
return htmlspecialchars($this->getValueObject()->getValue());
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->getValueObject()->getValueVarchar() ? false : true;
|
||||
}
|
||||
|
||||
public function validate()
|
||||
{
|
||||
return 'Неверное значение';
|
||||
|
|
|
@ -40,6 +40,11 @@ class ModuleProperty_EntityValueTypeCheckbox extends ModuleProperty_EntityValueT
|
|||
return $oValue->_isNew() ? $oProperty->getParam('default') : $oValue->getValueInt();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function validate()
|
||||
{
|
||||
$sValue = $this->getValueForValidate();
|
||||
|
|
|
@ -40,6 +40,11 @@ class ModuleProperty_EntityValueTypeDate extends ModuleProperty_EntityValueType
|
|||
strtotime($oValue->getValueDate())) : '';
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->getValueObject()->getValueDate() ? false : true;
|
||||
}
|
||||
|
||||
public function getValueForForm()
|
||||
{
|
||||
$oValue = $this->getValueObject();
|
||||
|
|
|
@ -33,6 +33,11 @@ class ModuleProperty_EntityValueTypeFile extends ModuleProperty_EntityValueType
|
|||
return $this->getFileFullName();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->getFileFullName() ? false : true;
|
||||
}
|
||||
|
||||
public function validate()
|
||||
{
|
||||
$oValue = $this->getValueObject();
|
||||
|
|
|
@ -33,6 +33,11 @@ class ModuleProperty_EntityValueTypeFloat extends ModuleProperty_EntityValueType
|
|||
return $this->getValueObject()->getValueFloat();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return is_null($this->getValueObject()->getValueFloat()) ? true : false;
|
||||
}
|
||||
|
||||
public function getValueForForm()
|
||||
{
|
||||
$oValue = $this->getValueObject();
|
||||
|
|
|
@ -33,6 +33,11 @@ class ModuleProperty_EntityValueTypeInt extends ModuleProperty_EntityValueType
|
|||
return $this->getValueObject()->getValueInt();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return is_null($this->getValueObject()->getValueInt()) ? true : false;
|
||||
}
|
||||
|
||||
public function getValueForForm()
|
||||
{
|
||||
$oValue = $this->getValueObject();
|
||||
|
|
|
@ -35,6 +35,13 @@ class ModuleProperty_EntityValueTypeSelect extends ModuleProperty_EntityValueTyp
|
|||
return is_array($aValues) ? join(', ', $aValues) : '';
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
$oValue = $this->getValueObject();
|
||||
$aValues = $oValue->getDataOne('values');
|
||||
return $aValues ? false : true;
|
||||
}
|
||||
|
||||
public function getValueForForm()
|
||||
{
|
||||
$oValue = $this->getValueObject();
|
||||
|
|
|
@ -33,6 +33,11 @@ class ModuleProperty_EntityValueTypeText extends ModuleProperty_EntityValueType
|
|||
return $this->getValueObject()->getValueText();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->getValueObject()->getValueText() ? false : true;
|
||||
}
|
||||
|
||||
public function getValueForForm()
|
||||
{
|
||||
$oValue = $this->getValueObject();
|
||||
|
|
Loading…
Reference in a new issue