Elgg  Version 3.0
ElggMetadata.php
Go to the documentation of this file.
1 <?php
2 
11 class ElggMetadata extends ElggExtender {
12 
16  protected function initializeAttributes() {
17  parent::initializeAttributes();
18 
19  $this->attributes['type'] = "metadata";
20  }
21 
27  public function __construct(stdClass $row = null) {
28  $this->initializeAttributes();
29 
30  if ($row) {
31  foreach ((array) $row as $key => $value) {
32  $this->$key = $value;
33  }
34  }
35 
36  $this->access_id = ACCESS_PUBLIC;
37  }
38 
47  public function canEdit($user_guid = 0) {
48  if ($entity = get_entity($this->entity_guid)) {
49  return $entity->canEditMetadata($this, $user_guid);
50  }
51 
52  return false;
53  }
54 
62  public function save() {
63  if (!$this->id) {
64  return _elgg_services()->metadataTable->create($this);
65  }
66 
67  return _elgg_services()->metadataTable->update($this);
68  }
69 
75  public function delete() {
76  return _elgg_services()->metadataTable->delete($this);
77  }
78 
82  public function getObjectFromID($id) {
84  }
85 }
canEdit($user_guid=0)
Determines whether or not the user can edit this piece of metadata.
save()
Save metadata object.
getObjectFromID($id)
{}
initializeAttributes()
{}
elgg_get_metadata_from_id($id)
Get a specific metadata object by its id.
Definition: metadata.php:19
$user_guid
Validate a user.
Definition: validate.php:6
$id
River item delete action.
Definition: delete.php:6
$entity
Definition: reset.php:8
__construct(stdClass $row=null)
Constructor.
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:55
$comment access_id
Definition: save.php:47
$value
Definition: debugging.php:7
_elgg_services()
Get the global service provider.
Definition: elgglib.php:1292
const ACCESS_PUBLIC
Definition: constants.php:14
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:87