aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ODDEntity.php
blob: acdfe2f717769a6d6a84d29583308c064f31baeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php

/**
 * ODD Entity class.
 *
 * @package    Elgg.Core
 * @subpackage ODD
 */
class ODDEntity extends ODD {

	/**
	 * 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);
	}

	/**
	 * Returns entity.
	 *
	 * @return 'entity'
	 */
	protected function getTagName() {
		return "entity";
	}
}

/**
 * ODD Metadata class.
 *
 * @package    Elgg.Core
 * @subpackage ODD
 */
class ODDMetaData extends ODD {

	/**
	 * New ODD metadata
	 *
	 * @param unknown_type $uuid        Unique ID
	 * @param unknown_type $entity_uuid Another unique ID
	 * @param unknown_type $name        Name
	 * @param unknown_type $value       Value
	 * @param unknown_type $type        Type
	 * @param unknown_type $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);
	}

	/**
	 * Returns 'metadata'
	 *
	 * @return 'metadata'
	 */
	protected function getTagName() {
		return "metadata";
	}
}

/**
 * ODD Relationship class.
 *
 * @package    Elgg
 * @subpackage Core
 */
class ODDRelationship extends ODD {

	/**
	 * 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);
	}

	/**
	 * Returns 'relationship'
	 *
	 * @return 'relationship'
	 */
	protected function getTagName() {
		return "relationship";
	}
}