From 20ab73de5248b3418bbbad27850e3d3e093c473c Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 2 Jan 2012 12:45:16 -0500 Subject: added photo tagging - but not displaying or deleting tags yet --- actions/addtag.php | 105 ------------------------------------------- actions/photos/image/tag.php | 99 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 105 deletions(-) delete mode 100644 actions/addtag.php create mode 100644 actions/photos/image/tag.php (limited to 'actions') diff --git a/actions/addtag.php b/actions/addtag.php deleted file mode 100644 index 97418f495..000000000 --- a/actions/addtag.php +++ /dev/null @@ -1,105 +0,0 @@ -tags)) { - if ($image->tags != $word) { - $new_word_tag = true; - $tagarray = $image->tags . ',' . $word; - $tagarray = string_to_tag_array($tagarray); - } - } else { - if (!in_array($word, $image->tags)) { - $new_word_tag = true; - $tagarray = $image->tags; - $tagarray[] = $word; - } - } -} - -// add new tag now so it is available in search -if ($new_word_tag) { - $image->clearMetadata('tags'); - $image->tags = $tagarray; -} - -// create string for javascript tag object -$tag->coords = $coordinates_str; -$tag->type = $relationships_type; -$tag->value = $value; - -$access_id = $image->getAccessID(); -$owner_id = get_loggedin_userid(); -$tagger = get_loggedin_user(); - -//Save annotation -$annotation_id = $image->annotate('phototag', serialize($tag), $access_id, $owner_id); -if ($annotation_id) { - // if tag is a user id, add relationship for searching (find all images with user x) - if ($relationships_type === 'user') { - if (!check_entity_relationship($user_id, 'phototag', $image_guid)) { - add_entity_relationship($user_id, 'phototag', $image_guid); - - // also add this to the river - subject is image, object is the tagged user - add_to_river('river/object/image/tag', 'tag', $tagger->guid, $user_id, $access_id, 0, $annotation_id); - - // notify user of tagging as long as not self - if ($owner_id != $user_id) { - notify_user( - $user_id, - $owner_id, - elgg_echo('tidypics:tag:subject'), - sprintf( - elgg_echo('tidypics:tag:body'), - $image->title, - $tagger->name, - $image->getURL() - ) - ); - } - } - } - - system_message(elgg_echo("tidypics:phototagging:success")); -} - - -forward($_SERVER['HTTP_REFERER']); diff --git a/actions/photos/image/tag.php b/actions/photos/image/tag.php new file mode 100644 index 000000000..0c7ce06ae --- /dev/null +++ b/actions/photos/image/tag.php @@ -0,0 +1,99 @@ +tags)) { + if ($image->tags != $word) { + $new_word_tag = true; + $tagarray = $image->tags . ',' . $word; + $tagarray = string_to_tag_array($tagarray); + } + } else { + if (!in_array($word, $image->tags)) { + $new_word_tag = true; + $tagarray = $image->tags; + $tagarray[] = $word; + } + } +} + +// add new tag now so it is available in search +if ($new_word_tag) { + $image->clearMetadata('tags'); + $image->tags = $tagarray; +} +*/ + +$tag = new stdClass(); +$tag->coords = $coordinates_str; +$tag->type = 'user'; +$tag->value = get_user_by_username($username)->getGUID(); +$access_id = $image->getAccessID(); + +$annotation_id = $image->annotate('phototag', serialize($tag), $access_id); +if ($annotation_id) { + // if tag is a user id, add relationship for searching (find all images with user x) + if ($tag->type === 'user') { + if (!check_entity_relationship($tag->value, 'phototag', $image_guid)) { + add_entity_relationship($tag->value, 'phototag', $image_guid); +/* + // also add this to the river - subject is image, object is the tagged user + add_to_river('river/object/image/tag', 'tag', $tagger->guid, $user_id, $access_id, 0, $annotation_id); + + // notify user of tagging as long as not self + if ($owner_id != $user_id) { + notify_user( + $user_id, + $owner_id, + elgg_echo('tidypics:tag:subject'), + sprintf( + elgg_echo('tidypics:tag:body'), + $image->title, + $tagger->name, + $image->getURL() + ) + ); + } + * + */ + } + } + + system_message(elgg_echo("tidypics:phototagging:success")); +} + +forward(REFERER); -- cgit v1.2.3