Example #1
0
 /**
  * Export this class into an array of ODD Elements containing all necessary fields.
  * Override if you wish to return more information than can be found in
  * $this->attributes (shouldn't happen)
  *
  * @return array
  * @deprecated 1.9
  */
 public function export()
 {
     elgg_deprecated_notice(__METHOD__ . ' has been deprecated', 1.9);
     $tmp = array();
     // Generate uuid
     $uuid = guid_to_uuid($this->getGUID());
     // Create entity
     $odd = new ODDEntity($uuid, $this->attributes['type'], get_subtype_from_id($this->attributes['subtype']));
     $tmp[] = $odd;
     $exportable_values = $this->getExportableValues();
     // Now add its attributes
     foreach ($this->attributes as $k => $v) {
         $meta = null;
         if (in_array($k, $exportable_values)) {
             switch ($k) {
                 case 'guid':
                     // Dont use guid in OpenDD
                 // Dont use guid in OpenDD
                 case 'type':
                     // Type and subtype already taken care of
                 // Type and subtype already taken care of
                 case 'subtype':
                     break;
                 case 'time_created':
                     // Created = published
                     $odd->setAttribute('published', date("r", $v));
                     break;
                 case 'site_guid':
                     // Container
                     $k = 'site_uuid';
                     $v = guid_to_uuid($v);
                     $meta = new ODDMetaData($uuid . "attr/{$k}/", $uuid, $k, $v);
                     break;
                 case 'container_guid':
                     // Container
                     $k = 'container_uuid';
                     $v = guid_to_uuid($v);
                     $meta = new ODDMetaData($uuid . "attr/{$k}/", $uuid, $k, $v);
                     break;
                 case 'owner_guid':
                     // Convert owner guid to uuid, this will be stored in metadata
                     $k = 'owner_uuid';
                     $v = guid_to_uuid($v);
                     $meta = new ODDMetaData($uuid . "attr/{$k}/", $uuid, $k, $v);
                     break;
                 default:
                     $meta = new ODDMetaData($uuid . "attr/{$k}/", $uuid, $k, $v);
             }
             // set the time of any metadata created
             if ($meta) {
                 $meta->setAttribute('published', date("r", $this->time_created));
                 $tmp[] = $meta;
             }
         }
     }
     // Now we do something a bit special.
     /*
      * This provides a rendered view of the entity to foreign sites.
      */
     elgg_set_viewtype('default');
     $view = elgg_view_entity($this, array('full_view' => true));
     elgg_set_viewtype();
     $tmp[] = new ODDMetaData($uuid . "volatile/renderedentity/", $uuid, 'renderedentity', $view, 'volatile');
     return $tmp;
 }
Example #2
0
 /**
  * Export this object
  *
  * @return array
  * @deprecated 1.9 Use toObject()
  */
 public function export()
 {
     elgg_deprecated_notice(__METHOD__ . ' has been deprecated', 1.9);
     $uuid = get_uuid_from_object($this);
     $meta = new ODDMetaData($uuid, guid_to_uuid($this->entity_guid), $this->attributes['name'], $this->attributes['value'], $this->attributes['type'], guid_to_uuid($this->owner_guid));
     $meta->setAttribute('published', date("r", $this->time_created));
     return $meta;
 }
Example #3
0
 /**
  * Export this object
  *
  * @return array
  */
 public function export()
 {
     $uuid = get_uuid_from_object($this);
     $meta = new ODDMetaData($uuid, guid_to_uuid($this->entity_guid), $this->attributes['name'], $this->attributes['value'], $this->attributes['type'], guid_to_uuid($this->owner_guid));
     $meta->setAttribute('published', date("r", $this->time_created));
     return $meta;
 }