public function prepareSave($row, $postData) { Kwf_Form_Field_Abstract::prepareSave($row, $postData); $value = $this->_getValueFromPostData($postData); if (is_string($value)) { $value = Zend_Json::decode($value); } if (!is_array($value)) { $value = array(); } $row->{$this->_fieldPrefix . 'dimension'} = isset($value['dimension']) ? $value['dimension'] : null; $row->{$this->_fieldPrefix . 'width'} = isset($value['width']) && $value['width'] ? $value['width'] : null; $row->{$this->_fieldPrefix . 'height'} = isset($value['height']) && $value['height'] ? $value['height'] : null; if (isset($value['cropData'])) { $row->{$this->_fieldPrefix . 'crop_x'} = isset($value['cropData']['x']) && $value['cropData']['x'] !== null ? $value['cropData']['x'] : null; $row->{$this->_fieldPrefix . 'crop_y'} = isset($value['cropData']['y']) && $value['cropData']['y'] !== null ? $value['cropData']['y'] : null; $row->{$this->_fieldPrefix . 'crop_width'} = isset($value['cropData']['width']) && $value['cropData']['width'] ? $value['cropData']['width'] : null; $row->{$this->_fieldPrefix . 'crop_height'} = isset($value['cropData']['height']) && $value['cropData']['height'] ? $value['cropData']['height'] : null; } else { $row->{$this->_fieldPrefix . 'crop_x'} = null; $row->{$this->_fieldPrefix . 'crop_y'} = null; $row->{$this->_fieldPrefix . 'crop_width'} = null; $row->{$this->_fieldPrefix . 'crop_height'} = null; } }
public function prepareSave(Kwf_Model_Row_Interface $row, $postData) { Kwf_Form_Field_Abstract::prepareSave($row, $postData); $value = $this->_getValueFromPostData($postData); if (is_string($value)) { $value = Zend_Json::decode($value); } if (!is_array($value)) { $value = array(); } $row->dimension = isset($value['dimension']) ? $value['dimension'] : null; $row->width = isset($value['width']) && $value['width'] ? $value['width'] : null; $row->height = isset($value['height']) && $value['height'] ? $value['height'] : null; if (isset($value['cropData'])) { $row->crop_x = isset($value['cropData']['x']) && $value['cropData']['x'] !== null ? $value['cropData']['x'] : null; $row->crop_y = isset($value['cropData']['y']) && $value['cropData']['y'] !== null ? $value['cropData']['y'] : null; $row->crop_width = isset($value['cropData']['width']) && $value['cropData']['width'] ? $value['cropData']['width'] : null; $row->crop_height = isset($value['cropData']['height']) && $value['cropData']['height'] ? $value['cropData']['height'] : null; if ($row->getParentRow('Image')) { $scaleFactor = Kwf_Media_Image::getHandyScaleFactor($row->getParentRow('Image')->getFileSource()); if ($scaleFactor != 1) { $row->crop_x = $row->crop_x * $scaleFactor; $row->crop_y = $row->crop_y * $scaleFactor; $row->crop_width = $row->crop_width * $scaleFactor; $row->crop_height = $row->crop_height * $scaleFactor; } } } else { $row->crop_x = null; $row->crop_y = null; $row->crop_width = null; $row->crop_height = null; } }
public function prepareSave(Kwf_Model_Row_Interface $row, $postData) { parent::prepareSave($row, $postData); if ($this->getSave() !== false) { $save = false; if (array_key_exists($this->getFieldName(), $postData)) { //wenn postData gesetzt, speichern $save = true; } else { $pk = $row->getModel()->getPrimaryKey(); if (!$row->{$pk}) { //wenn postData nicht gesetzt, aber die row neu eingefügt wird, //auch speichern - mit DefaultValue (kommt von _getValueFromPostData) $save = true; } } if ($save) { $this->getData()->save($row, $this->_getValueToSaveFromPostData($postData)); } } }
public function prepareSave($parentRow, $postData) { $row = $this->_getRowByParentRow($parentRow); parent::prepareSave($row, $postData); }
public function prepareSave(Kwf_Model_Row_Interface $row, $postData) { Kwf_Form_Field_Abstract::prepareSave($row, $postData); }