]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #5052 using name for annotations and using correct class for export
authorCash Costello <cash.costello@gmail.com>
Sat, 9 Feb 2013 13:43:52 +0000 (08:43 -0500)
committerCash Costello <cash.costello@gmail.com>
Sat, 9 Feb 2013 13:43:52 +0000 (08:43 -0500)
engine/classes/ElggExtender.php
engine/lib/annotations.php

index d94bad83701cfd8195e92db40bc8dc4c2eefab6d..25aba354f1e50b515b71c2cf98bf1cfd956f14b1 100644 (file)
@@ -171,7 +171,7 @@ abstract class ElggExtender extends ElggData {
        public function export() {
                $uuid = get_uuid_from_object($this);
 
-               $meta = new ODDMetadata($uuid, guid_to_uuid($this->entity_guid), $this->attributes['name'],
+               $meta = new ODDMetaData($uuid, guid_to_uuid($this->entity_guid), $this->attributes['name'],
                        $this->attributes['value'], $this->attributes['type'], guid_to_uuid($this->owner_guid));
                $meta->setAttribute('published', date("r", $this->time_created));
 
index e5566a00ab84be00a1ab7d819a1dfad1ac5b5de4..41a736aa11883d4463f0a39bdc39f1a2c0a7489d 100644 (file)
@@ -441,20 +441,20 @@ function elgg_list_entities_from_annotation_calculation($options) {
 }
 
 /**
- * Handler called by trigger_plugin_hook on the "export" event.
+ * Export the annotations for the specified entity
  *
  * @param string $hook        'export'
- * @param string $entity_type 'all'
+ * @param string $type        'all'
  * @param mixed  $returnvalue Default return value
- * @param mixed  $params      List of params to export
+ * @param mixed  $params      Parameters determining what annotations to export
  *
  * @elgg_plugin_hook export all
  *
- * @return mixed
+ * @return array
  * @throws InvalidParameterException
  * @access private
  */
-function export_annotation_plugin_hook($hook, $entity_type, $returnvalue, $params) {
+function export_annotation_plugin_hook($hook, $type, $returnvalue, $params) {
        // Sanity check values
        if ((!is_array($params)) && (!isset($params['guid']))) {
                throw new InvalidParameterException(elgg_echo('InvalidParameterException:GUIDNotForExport'));
@@ -465,11 +465,12 @@ function export_annotation_plugin_hook($hook, $entity_type, $returnvalue, $param
        }
 
        $guid = (int)$params['guid'];
+       $options = array('guid' => $guid, 'limit' => 0);
+       if (isset($params['name'])) {
+               $options['annotation_name'] = $params['name'];
+       }
 
-       $result = elgg_get_annotations(array(
-               'guid' => $guid,
-               'limit' => 0,
-       ));
+       $result = elgg_get_annotations($options);
 
        if ($result) {
                foreach ($result as $r) {