Location: PHPKode > scripts > phpFlickrSynch > phpflickrsynch/_publicApi/class_Tag.php
<?php
	/**
	  * To build a tag-oriented navigation
	  */
	class Tag {
	
		private $tagId = 0;
		private $tagName = NULL;
		private $nbPhotos = NULL;
		private $DB = NULL;
		private $groupId = 0;

		/**
		  * Constructor.
		  * @param $tagId Tag ID
		  * @param $groupName Restrict the properties of this tag to the given group name
		  */
		public function __construct($tagId, $groupName = NULL) {
			$this->tagId = $tagId;		
			$this->DB = new TableFlickrTag();
			
			$this->groupId = ($groupName == NULL) ? 0 : Group::getId($groupName);
			$res = $this->DB->checkTag($tagId, $this->groupId);
						
			if ($res == NULL) { 
				throw new Exception('Tag ' . $tagId . ' not found in local database');
			} else {
				$this->tagName = $res['name'];
				$this->nbPhotos = $res['nb'];
			}			
		}

		/**
		  * @param $tagName Tag name
		  * @return the internal ID for this tag ; 0 if no tag with this name
		  */
		public static function getId($tagName) {
			$DB = new TableFlickrTag();
			return $DB->getTagId($tagName);
		}

		/**
		  * @return the name of the tag
		  */
		public function getName() {
			return $this->tagName;
		}

		/**
		  * @return the number of photos tagged with this tag
		  */
		public function getNbPhotos() {
			return $this->nbPhotos;
		}
		
		/**
		  * Returns the list of photos in this photo album
		  * @param $limit Max number of photos to be retrieved
		  * @param $size Size of photos to be returned ; default is 'Thumbnail'		  
		  * @return An array containing list of photos
		  */		
		public function getPhotos($limit = 50, $size = 'Thumbnail') {
			$P = new TableFlickrPhoto();
			$res = $P->getPhotosTaggedWith($this->tagId, $limit, $size, $this->groupId);
			return $res;
		}	
	}
?>
Return current item: phpFlickrSynch