Ejemplo n.º 1
0
 public function getHTML(Property $property, Specification $specification)
 {
     $out = $specification->getAttribute('value');
     $unit = $specification->getUnit();
     if ($unit) {
         $out .= ' ' . $unit->getAbbreviation();
     }
     echo $out;
 }
Ejemplo n.º 2
0
 /**
  * Validate Specification.
  *
  * @param Specification $specification
  *
  * @return Result
  */
 public function validateSpecification(Specification $specification)
 {
     $result = new Result();
     if (empty($specification->getAttribute('value'))) {
         return $result->setError(Result::ERROR_VALIDATION_FAILED, 'Specification value empty');
     }
     if ($specification->getAttribute('unit_id') !== null && $specification->getUnit() === null) {
         return $result->setError(Result::ERROR_VALIDATION_FAILED, 'Specification unit invalid');
     }
     return $result;
 }
Ejemplo n.º 3
0
 public function getHTML(Property $property, Specification $specification)
 {
     $out = '';
     $value = $specification->getAttribute('value');
     if (!empty($value['start'])) {
         $out .= ' от ' . $value['start'];
     }
     if (!empty($value['finish'])) {
         $out .= ' до ' . $value['finish'];
     }
     $unit = $specification->getUnit();
     if ($unit) {
         $out .= ' ' . $unit->getAbbreviation();
     }
     echo $out;
 }