diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/annotations.php | 5 | ||||
-rw-r--r-- | engine/lib/entities.php | 25 | ||||
-rw-r--r-- | engine/lib/extender.php | 5 | ||||
-rw-r--r-- | engine/lib/metadata.php | 5 |
4 files changed, 32 insertions, 8 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index e76254acb..4302d27a6 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -110,7 +110,10 @@ $type = "annotation"; $uuid = guid_to_uuid($this->entity_guid). $type . "/{$this->id}/"; - return new ODDMetadata($uuid, guid_to_uuid($this->entity_guid), $this->attributes[$name], $this->attributes['value'], $type, guid_to_uuid($this->owner_guid)); + $meta = new ODDMetadata($uuid, guid_to_uuid($this->entity_guid), $this->attributes[$name], $this->attributes['value'], $type, guid_to_uuid($this->owner_guid)); + $meta->setAttribute('published', date("r", $this->time_created)); + + return $meta; } } diff --git a/engine/lib/entities.php b/engine/lib/entities.php index e2624132d..2e330042c 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -402,36 +402,49 @@ // Generate uuid $uuid = guid_to_uuid($this->getGUID()); - // Create entity - $tmp[] = new ODDEntity( + // Create entity + $odd = new ODDEntity( $uuid, $this->attributes['type'], get_subtype_from_id($this->attributes['subtype']) ); + $tmp[] = $odd; + // Now add its attributes foreach ($this->attributes as $k => $v) { + $meta = NULL; + switch ($k) { case 'guid' : // Dont use guid case 'subtype' : // The subtype case 'type' : // Don't use type case 'access_id' : // Don't use access - if can export then its public for you, then importer decides what access to give this object. - case 'time_created' : // Don't use date in export case 'time_updated' : // Don't use date in export break; + + case 'time_created' : // Created = published + $odd->setAttribute('published', date("r", $v)); + break; case 'owner_guid' : // Convert owner guid to uuid, this will be stored in metadata $k = 'owner_uuid'; $v = guid_to_uuid($v); - $tmp[] = new ODDMetadata($uuid . "attr/$k/", $uuid, $k, $v); + $meta = new ODDMetadata($uuid . "attr/$k/", $uuid, $k, $v); break; default : - $tmp[] = new ODDMetadata($uuid . "attr/$k/", $uuid, $k, $v); + $meta = new ODDMetadata($uuid . "attr/$k/", $uuid, $k, $v); + } + + if ($meta) + { + $meta->setAttribute('published', date("r",$this->time_created)); + $tmp[] = $meta; } } @@ -460,7 +473,7 @@ $this->attributes['owner_guid'] = $_SESSION['id']; // Import as belonging to importer. // Set time - $this->attributes['time_created'] = strtotime($data->getAttribute('generated')); + $this->attributes['time_created'] = strtotime($data->getAttribute('published')); $this->attributes['time_updated'] = time(); return true; diff --git a/engine/lib/extender.php b/engine/lib/extender.php index abf4f087d..88542a494 100644 --- a/engine/lib/extender.php +++ b/engine/lib/extender.php @@ -157,6 +157,11 @@ default : // Anything else assume attribute $entity->set($attr_name, $attr_val); } + + // Set time if appropriate + $attr_time = $element->getAttribute('published'); + if ($attr_time) + $entity->set('time_created', $attr_time); // Save if (!$entity->save()) diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 06c187a70..d05688ea3 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -105,7 +105,10 @@ $type = "metadata"; $uuid = guid_to_uuid($this->entity_guid). $type . "/{$this->id}/"; - return new ODDMetadata($uuid, guid_to_uuid($this->entity_guid), $this->attributes[$name], $this->attributes['value'], $type, guid_to_uuid($this->owner_guid)); + $meta = new ODDMetadata($uuid, guid_to_uuid($this->entity_guid), $this->attributes[$name], $this->attributes['value'], $type, guid_to_uuid($this->owner_guid)); + $meta->setAttribute('published', date("r", $this->time_created)); + + return $meta; } }
|