Esempio n. 1
0
 /**
  * Задает значение атрибута
  * @param mixed $value
  */
 public function setValue($value)
 {
     parent::setValue($value);
     $val = $this->getValue();
     $val = (double) str_replace(array(' ', ','), array('', '.'), $val);
     parent::setValue($val);
 }
Esempio n. 2
0
 /**
  * Задает значение атрибута
  * @param mixed $value
  */
 public function setValue($value)
 {
     $toSet = null;
     if ($value !== null && $value !== '') {
         $list = $this->getListItems();
         //перебираем все id
         foreach ($list as $item) {
             if ($item['ID'] == $value) {
                 $toSet = $item['ID'];
                 break;
             }
         }
         //перебираем все xml_id
         if ($toSet === null) {
             foreach ($list as $item) {
                 if ($item['XML_ID'] == $value) {
                     $toSet = $item['ID'];
                     break;
                 }
             }
         }
         //перебираем все значения
         if ($toSet === null) {
             foreach ($list as $item) {
                 if ($item['VALUE'] == $value) {
                     $toSet = $item['ID'];
                     break;
                 }
             }
         }
     }
     parent::setValue($toSet);
 }
Esempio n. 3
0
 /**
  * Задает значение атрибута
  * @param mixed $value
  */
 public function setValue($value)
 {
     if (is_array($value)) {
         $value = array_diff(array_map('intval', $value), array(0));
     } elseif (($id = intval($value)) !== 0) {
         $value = array($id);
     }
     parent::setValue($value);
 }
Esempio n. 4
0
 /**
  * Задает значение атрибута
  * @param mixed $value
  */
 public function setValue($value)
 {
     /* fix at multiply property */
     if (is_array($value) && isset($value['VALUE'])) {
         $value = $value['VALUE'];
     }
     /* fix end */
     $toSet = null;
     if ($value !== null && $value !== '') {
         $list = $this->getListItems();
         //перебираем все id
         foreach ($list as $item) {
             if ($item['ID'] == $value) {
                 $toSet = $item['ID'];
                 break;
             }
         }
         //перебираем все xml_id
         if ($toSet === null) {
             foreach ($list as $item) {
                 if ($item['XML_ID'] == $value) {
                     $toSet = $item['ID'];
                     break;
                 }
             }
         }
         //перебираем все значения
         if ($toSet === null) {
             foreach ($list as $item) {
                 if ($item['VALUE'] == $value) {
                     $toSet = $item['ID'];
                     break;
                 }
             }
         }
     }
     parent::setValue($toSet);
 }
Esempio n. 5
0
 /**
  * Задает значение атрибута
  * @param mixed $value
  */
 public function setValue($value)
 {
     if ($value === null || $value === array()) {
         return parent::setValue(array());
     }
     $values = parent::getValue();
     $values = is_array($values) ? $values : array();
     $value = is_array($value) ? array_values($value) : array($value);
     foreach ($values as $key => $element) {
         if (array_key_exists($key, $value)) {
             $element->setValue($value[$key]);
         } else {
             unset($values[$key]);
         }
     }
     foreach ($value as $key => $val) {
         if (!isset($values[$key])) {
             $values[$key] = $this->initValueItem($key);
             $values[$key]->setValue($val);
         }
     }
     return parent::setValue($values);
 }
Esempio n. 6
0
 public function setValue($value)
 {
     $value = rawurldecode($value);
     return parent::setValue($value);
 }
Esempio n. 7
0
 /**
  * Задает значение атрибута
  * @param mixed $value
  */
 public function setValue($value)
 {
     $this->_path = null;
     parent::setValue($value);
 }
Esempio n. 8
0
 public function parseNode()
 {
     $this->next();
     if ($this->current() == "!") {
         $node = $this->parseComment();
     } else {
         $this->skipWhiteSpaces();
         $nodeName = $this->parseName();
         $this->skipWhiteSpaces();
         $node = new Element($nodeName);
         while ($this->current() != ">" && $this->current() != "/") {
             $this->skipWhiteSpaces();
             $attrName = $this->parseName();
             $attr = new Attribute($attrName);
             $this->skipWhiteSpaces();
             if ($this->current() == "=") {
                 $this->next();
                 $this->skipWhiteSpaces();
                 $value = $this->parseQuoted();
                 $attr->setValue($value);
             }
             $node->addAttribute($attr);
         }
         $this->skipWhiteSpaces();
         if ($this->current() == "/") {
             $this->next();
             if ($this->current() == ">") {
                 $this->next();
             }
         } else {
             $this->next();
             if (!in_array(strtolower($nodeName), $this->noEndNodes)) {
                 $this->parseBody($node);
             }
         }
     }
     return $node;
 }
Esempio n. 9
0
 /**
  * Задает значение атрибута
  * @param mixed $value
  */
 public function setValue($value)
 {
     $this->_related = null;
     parent::setValue($value);
 }
Esempio n. 10
0
 /**
  * Задает значение атрибута
  * @param mixed $value
  */
 public function setValue($value)
 {
     $value = $value && $value !== 'N' ? 'Y' : 'N';
     parent::setValue($value);
 }