/**
  * New ODD Relationship
  *
  * @param unknown_type $uuid1 First UUID
  * @param unknown_type $type  Type of telationship
  * @param unknown_type $uuid2 Second UUId
  */
 function __construct($uuid1, $type, $uuid2)
 {
     parent::__construct();
     $this->setAttribute('uuid1', $uuid1);
     $this->setAttribute('type', $type);
     $this->setAttribute('uuid2', $uuid2);
 }
Пример #2
0
 /**
  * New ODD Entity
  *
  * @param string $uuid     A universally unique ID
  * @param string $class    Class
  * @param string $subclass Subclass
  */
 function __construct($uuid, $class, $subclass = "")
 {
     parent::__construct();
     $this->setAttribute('uuid', $uuid);
     $this->setAttribute('class', $class);
     $this->setAttribute('subclass', $subclass);
 }
 /**
  * New ODD metadata
  *
  * @param string $uuid        Unique ID
  * @param string $entity_uuid Another unique ID
  * @param string $name        Name
  * @param string $value       Value
  * @param string $type        Type
  * @param string $owner_uuid  Owner ID
  */
 function __construct($uuid, $entity_uuid, $name, $value, $type = "", $owner_uuid = "")
 {
     parent::__construct();
     $this->setAttribute('uuid', $uuid);
     $this->setAttribute('entity_uuid', $entity_uuid);
     $this->setAttribute('name', $name);
     $this->setAttribute('type', $type);
     $this->setAttribute('owner_uuid', $owner_uuid);
     $this->setBody($value);
 }
Пример #4
0
 /**
  * Import data from an parsed ODD xml data array.
  *
  * @param ODD $data XML data
  *
  * @return true
  *
  * @throws InvalidParameterException
  * @deprecated 1.9 Use toObject()
  */
 public function import(ODD $data)
 {
     elgg_deprecated_notice(__METHOD__ . ' has been deprecated', 1.9);
     if (!$data instanceof ODDEntity) {
         throw new \InvalidParameterException("import() passed an unexpected ODD class");
     }
     // Set type and subtype
     $this->attributes['type'] = $data->getAttribute('class');
     $this->attributes['subtype'] = $data->getAttribute('subclass');
     // Set owner
     $this->attributes['owner_guid'] = _elgg_services()->session->getLoggedInUserGuid();
     // Import as belonging to importer.
     // Set time
     $this->attributes['time_created'] = strtotime($data->getAttribute('published'));
     $this->attributes['time_updated'] = time();
     return true;
 }
Пример #5
0
 /**
  * Import data from an parsed ODD xml data array.
  *
  * @param array $data XML data
  *
  * @return true
  */
 public function import(ODD $data)
 {
     if (!$data instanceof ODDEntity) {
         throw new InvalidParameterException(elgg_echo('InvalidParameterException:UnexpectedODDClass'));
     }
     // Set type and subtype
     $this->attributes['type'] = $data->getAttribute('class');
     $this->attributes['subtype'] = $data->getAttribute('subclass');
     // Set owner
     $this->attributes['owner_guid'] = elgg_get_logged_in_user_guid();
     // Import as belonging to importer.
     // Set time
     $this->attributes['time_created'] = strtotime($data->getAttribute('published'));
     $this->attributes['time_updated'] = time();
     return true;
 }
Пример #6
0
 /**
  * Import a relationship
  *
  * @param ODD $data ODD data
  * @return bool
  * @throws ImportException
  */
 public function import(ODD $data)
 {
     if (!$data instanceof ODDRelationship) {
         throw new InvalidParameterException(elgg_echo('InvalidParameterException:UnexpectedODDClass'));
     }
     $uuid_one = $data->getAttribute('uuid1');
     $uuid_two = $data->getAttribute('uuid2');
     // See if this entity has already been imported, if so then we need to link to it
     $entity1 = get_entity_from_uuid($uuid_one);
     $entity2 = get_entity_from_uuid($uuid_two);
     if ($entity1 && $entity2) {
         // Set the item ID
         $this->attributes['guid_one'] = $entity1->getGUID();
         $this->attributes['guid_two'] = $entity2->getGUID();
         // Map verb to relationship
         //$verb = $data->getAttribute('verb');
         //$relationship = get_relationship_from_verb($verb);
         $relationship = $data->getAttribute('type');
         if ($relationship) {
             $this->attributes['relationship'] = $relationship;
             // save
             $result = $this->save();
             if (!$result) {
                 throw new ImportException(elgg_echo('ImportException:ProblemSaving', array(get_class())));
             }
             return true;
         }
     }
 }
Пример #7
0
 /**
  * Import a relationship
  *
  * @param ODD $data ODD data
  * @return bool
  * @throws ImportException|InvalidParameterException
  * @deprecated 1.9
  */
 public function import(ODD $data)
 {
     elgg_deprecated_notice(__METHOD__ . ' has been deprecated', 1.9);
     if (!$data instanceof ODDRelationship) {
         throw new \InvalidParameterException("import() passed an unexpected ODD class");
     }
     $uuid_one = $data->getAttribute('uuid1');
     $uuid_two = $data->getAttribute('uuid2');
     // See if this entity has already been imported, if so then we need to link to it
     $entity1 = get_entity_from_uuid($uuid_one);
     $entity2 = get_entity_from_uuid($uuid_two);
     if ($entity1 && $entity2) {
         // Set the item ID
         $this->attributes['guid_one'] = $entity1->getGUID();
         $this->attributes['guid_two'] = $entity2->getGUID();
         // Map verb to relationship
         //$verb = $data->getAttribute('verb');
         //$relationship = get_relationship_from_verb($verb);
         $relationship = $data->getAttribute('type');
         if ($relationship) {
             $this->attributes['relationship'] = $relationship;
             // save
             $result = $this->save();
             if (!$result) {
                 throw new \ImportException("There was a problem saving " . get_class());
             }
             return true;
         }
     }
     return false;
 }