예제 #1
0
 function getSQLValue()
 {
     $properties = $this->complex->getProperties();
     foreach ($properties as $field) {
         if ($field->type->getType() === 'date') {
             $field->type->setConvertToDBDate(true);
             $i18n = SJB_I18N::getInstance();
             $values = $field->value;
             if (empty($values) || !is_array($values)) {
                 continue;
             }
             foreach ($values as $key => $value) {
                 $this->property_info['value'][$field->id][$key] = $i18n->getInput('date', $value);
             }
         }
         if ($field->type->getType() === 'file') {
             $file_id = $this->property_info['id'] . "_" . $this->object_sid;
             $upload_manager = new SJB_UploadFileManager();
             $upload_manager->setFileGroup("files");
             $upload_manager->setUploadedFileID($file_id);
             $uploadFilesResults = $upload_manager->uploadFiles($this->property_info['id'], $field->id);
             $oldVals = isset($this->property_info['value'][$field->id]) && is_array($this->property_info['value'][$field->id]) ? $this->property_info['value'][$field->id] : array();
             $this->property_info['value'][$field->id] = array();
             foreach ($uploadFilesResults as $key => $value) {
                 if (empty($value) && !empty($oldVals[$key])) {
                     $this->property_info['value'][$field->id][$key] = $oldVals[$key];
                 } else {
                     $this->property_info['value'][$field->id][$key] = $value;
                 }
             }
             $field->setValue($this->property_info['value'][$field->id]);
         }
     }
     return serialize($this->property_info['value']);
 }