1
0

Add more tag support.

This commit is contained in:
Bharat Mediratta 2010-01-05 13:42:45 -08:00
parent 82fed14c3c
commit cbcbe30dba

View File

@ -15,38 +15,53 @@ $root = $gallery3->get("gallery");
$tags = $gallery3->get("tags");
print "Create a tag <br/>";
$tag = $tags->create()
$tag = $tags->add()
->set_value("name", "My Tag")
->save();
print "Create a new album <br/>";
$album = $root->create()
$album = $root->add()
->set_value("type", "album")
->set_value("name", "Sample Album")
->set_value("title", "This is my Sample Album")
->save();
print "Upload a photo <br/>";
$photo = $album->create()
$photo = $album->add()
->set_value("type", "photo")
->set_value("name", "Sample Photo")
->set_value("title", "Sample Photo")
->set_file("/tmp/foo.jpg")
->save();
print "Added: " . $album->members[0] . " <br/>";
print "Tag the photo <br/>";
$tag->create()
->set_value("url", $photo->url)
print "Tag the album <br/>";
$tag->add()
->set_value("url", $album->url)
->save();
print "Modify the album <br/>";
print "Tag the photo <br/>";
$tag->add()
->set_value("url", $photo->url)
->save();
print "Tagged items: " . join($tag->members, " ") . "<br/>";
print "Un-tag the photo <br/>";
$tag->remove($photo->url);
print "Tagged items: " . join($tag->members, " ") . "<br/>";
print "Find and modify the album <br/>";
$album = $root->get("Sample-Album")
->set_value("title", "This is my title")
->save();
print "New title: $album->title <br/>";
// Now delete the album
print "Delete the album <br/>";
$album->delete();
// Delete the tag
$tag->delete();
print "Done! <br/>";
?>