/** * Returns an array of blog entries associated with the tag string passed in. * * @param string $tagName * The name of the tag against which this method will try to find * associated blog entries. * * @return mixed * Returns an array of blog entries associated with the tag name * passed in, or null if there are no associated blog entries. */ public function getBlogEntriesByTagName($tagName) { $blogEntryTags = new Datasource_Cms_Connect_BlogEntryTags(); $tagId = $blogEntryTags->getID($tagName); //Now get all the blog entries associated with that tag id. $blogEntryTagMap = new Datasource_Cms_Connect_BlogEntryTagMap(); $blogEntryDetails = $blogEntryTagMap->getByTagId($tagId); $returnArray = array(); if (!empty($blogEntryDetails)) { $blogEntries = new Datasource_Cms_Connect_BlogEntries(); foreach ($blogEntryDetails as $currentBlogEntry) { $returnArray[] = $blogEntries->getByID($currentBlogEntry->blog_entry_id); } } //Provide a return value consistent with this function's contract. if (empty($returnArray)) { $returnVal = null; } else { $returnVal = $returnArray; } return $returnVal; }
/** * Returns a comma seperated list of possible tags for the admin system * * @return string */ public function getPossibleTags() { $blogTags = new Datasource_Cms_Connect_BlogEntryTags(); $currentTags = $blogTags->getAll(); $tagList = array(); foreach ($currentTags as $currentTag) { $tagList[] = '"' . $currentTag['tag'] . '"'; } return implode(',', $tagList); }