diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-09-06 02:42:09 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-09-06 02:42:09 +0000 |
commit | 76dac45ebaf104b312a8527a05424601ca9d520a (patch) | |
tree | 7440558a893ebf1d3816829ecbb96c3b0df9b4f0 /engine/lib/annotations.php | |
parent | 9e8baf614938dfd1687ddce39b409c3c0e5c5753 (diff) | |
download | elgg-76dac45ebaf104b312a8527a05424601ca9d520a.tar.gz elgg-76dac45ebaf104b312a8527a05424601ca9d520a.tar.bz2 |
Refs #2220: Pulled most classes / interfaces out of lib files (except query.php and exception.php) into "classes" folder. Replaced inline classes with "require_once" statements for now. Ran unit tests to verify functionality before committing.
git-svn-id: http://code.elgg.org/elgg/trunk@6908 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r-- | engine/lib/annotations.php | 113 |
1 files changed, 2 insertions, 111 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 806e3699f..3c8bb2aad 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -9,118 +9,9 @@ * @link http://elgg.org/ */ -/** - * Include the ElggExtender superclass - * - */ -require_once('extender.php'); - -/** - * ElggAnnotation - * - * An annotation is similar to metadata. - * Each entity can have more than one of each type of annotation. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd <info@elgg.com> - */ -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 //////////////////////////////////////////////////////////// +require_once 'extender.php'; - /** - * 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); - } -} +require_once dirname(dirname(__FILE__)).'/classes/ElggAnnotation.php'; /** * Convert a database row to a new ElggAnnotation |