aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggAnnotation.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-09-22 17:01:17 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-09-22 17:01:17 +0000
commit965cbe52f22809f19ca150feb585b0218aa89f85 (patch)
treefc1b59b44c5ecbaedf27cc8c71e7abc80a15305e /engine/classes/ElggAnnotation.php
parent56b3e3dcd833a8a9124581b536c69806962b9640 (diff)
downloadelgg-965cbe52f22809f19ca150feb585b0218aa89f85.tar.gz
elgg-965cbe52f22809f19ca150feb585b0218aa89f85.tar.bz2
Converted line endings to unix.
git-svn-id: http://code.elgg.org/elgg/trunk@6957 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggAnnotation.php')
-rw-r--r--engine/classes/ElggAnnotation.php218
1 files changed, 109 insertions, 109 deletions
diff --git a/engine/classes/ElggAnnotation.php b/engine/classes/ElggAnnotation.php
index 709e28433..ec2cedfe5 100644
--- a/engine/classes/ElggAnnotation.php
+++ b/engine/classes/ElggAnnotation.php
@@ -1,110 +1,110 @@
-<?php
-/**
- * Elgg Annotations
- *
- * Annotations allow you to attach bits of information to entities.
- * They are essentially the same as metadata, but with additional
- * helper functions.
- *
- * @internal Annotations are stored in the annotations table.
- *
- * @package Elgg.Core
- * @subpackage DataModel.Annotations
- * @link http://docs.elgg.org/DataModel/Annotations
- */
-class ElggAnnotation extends ElggExtender {
-
- /**
- * Construct a new annotation, optionally from a given id value or db object.
- *
- * @param mixed $id
- */
- function __construct($id = null) {
- $this->attributes = array();
-
- if (!empty($id)) {
- if ($id instanceof stdClass) {
- $annotation = $id;
- } else {
- $annotation = get_annotation($id);
- }
-
- if ($annotation) {
- $objarray = (array) $annotation;
-
- foreach($objarray as $key => $value) {
- $this->attributes[$key] = $value;
- }
-
- $this->attributes['type'] = "annotation";
- }
- }
- }
-
- /**
- * Class member get overloading
- *
- * @param string $name
- * @return mixed
- */
- function __get($name) {
- return $this->get($name);
- }
-
- /**
- * Class member set overloading
- *
- * @param string $name
- * @param mixed $value
- * @return void
- */
- function __set($name, $value) {
- return $this->set($name, $value);
- }
-
- /**
- * Save this instance
- *
- * @return int an object id
- */
- function save() {
- if ($this->id > 0) {
- return update_annotation($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
- } else {
- $this->id = create_annotation($this->entity_guid, $this->name, $this->value,
- $this->value_type, $this->owner_guid, $this->access_id);
-
- if (!$this->id) {
- throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
- }
- return $this->id;
- }
- }
-
- /**
- * Delete the annotation.
- */
- function delete() {
- return delete_annotation($this->id);
- }
-
- /**
- * Get a url for this annotation.
- *
- * @return string
- */
- public function getURL() {
- return get_annotation_url($this->id);
- }
-
- // SYSTEM LOG INTERFACE ////////////////////////////////////////////////////////////
-
- /**
- * For a given ID, return the object associated with it.
- * This is used by the river functionality primarily.
- * This is useful for checking access permissions etc on objects.
- */
- public function getObjectFromID($id) {
- return get_annotation($id);
- }
+<?php
+/**
+ * Elgg Annotations
+ *
+ * Annotations allow you to attach bits of information to entities.
+ * They are essentially the same as metadata, but with additional
+ * helper functions.
+ *
+ * @internal Annotations are stored in the annotations table.
+ *
+ * @package Elgg.Core
+ * @subpackage DataModel.Annotations
+ * @link http://docs.elgg.org/DataModel/Annotations
+ */
+class ElggAnnotation extends ElggExtender {
+
+ /**
+ * Construct a new annotation, optionally from a given id value or db object.
+ *
+ * @param mixed $id
+ */
+ function __construct($id = null) {
+ $this->attributes = array();
+
+ if (!empty($id)) {
+ if ($id instanceof stdClass) {
+ $annotation = $id;
+ } else {
+ $annotation = get_annotation($id);
+ }
+
+ if ($annotation) {
+ $objarray = (array) $annotation;
+
+ foreach($objarray as $key => $value) {
+ $this->attributes[$key] = $value;
+ }
+
+ $this->attributes['type'] = "annotation";
+ }
+ }
+ }
+
+ /**
+ * Class member get overloading
+ *
+ * @param string $name
+ * @return mixed
+ */
+ function __get($name) {
+ return $this->get($name);
+ }
+
+ /**
+ * Class member set overloading
+ *
+ * @param string $name
+ * @param mixed $value
+ * @return void
+ */
+ function __set($name, $value) {
+ return $this->set($name, $value);
+ }
+
+ /**
+ * Save this instance
+ *
+ * @return int an object id
+ */
+ function save() {
+ if ($this->id > 0) {
+ return update_annotation($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
+ } else {
+ $this->id = create_annotation($this->entity_guid, $this->name, $this->value,
+ $this->value_type, $this->owner_guid, $this->access_id);
+
+ if (!$this->id) {
+ throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
+ }
+ return $this->id;
+ }
+ }
+
+ /**
+ * Delete the annotation.
+ */
+ function delete() {
+ return delete_annotation($this->id);
+ }
+
+ /**
+ * Get a url for this annotation.
+ *
+ * @return string
+ */
+ public function getURL() {
+ return get_annotation_url($this->id);
+ }
+
+ // SYSTEM LOG INTERFACE ////////////////////////////////////////////////////////////
+
+ /**
+ * For a given ID, return the object associated with it.
+ * This is used by the river functionality primarily.
+ * This is useful for checking access permissions etc on objects.
+ */
+ public function getObjectFromID($id) {
+ return get_annotation($id);
+ }
} \ No newline at end of file