<?php
/* BlogManager class. Loganc3.0 - Oct 2014.   
*/

class BlogManager {
	
	var $oDbCall;

	function __construct($oDbCall) {
		$this->oDbCall = $oDbCall;
	}
	
	// Get blog
	function GetBlog($id) {
		return $this->oDbCall->GetBlog($id);
	}
	
	// Get all blogs
	function GetBlogs() {
		return $this->oDbCall->GetBlogs();
	}
	
	function GetBlogSearchLimited($id) {
		return $this->oDbCall->GetBlogSearchLimited($id);
	}
	
	// Insert new blog.
	function InsertBlog($name, $description, $blog_date, $blog_year, $blog_country, $blog_region, $set_image, $set_background, $url, $auth) {
		$this->oDbCall->InsertBlog($name, $description, $blog_date, $blog_year, $blog_country, $blog_region, $set_image, $set_background, $url, $auth);
		return true;
	}
	
	// Update blog
	function UpdateBlog($id, $name, $description, $blog_date, $blog_year, $blog_country, $blog_region, $set_image, $set_background, $url, $auth) {		
		$this->oDbCall->UpdateBlog($id, $name, $description, $blog_date, $blog_year, $blog_country, $blog_region, $set_image, $set_background, $url, $auth);
		$this->oDbCall->UpdateBlogEntryAuth($id, $auth);
		
		return true;
	}
	
	// Delete blog
	function DeleteBlog($id) {
		$this->oDbCall->DeleteBlog($id);
		$this->oDbCall->DeleteAllBlogEntry($id);
	}
	
	// Get blog entry
	function GetBlogEntry($id) {
		return $this->oDbCall->GetBlogEntry($id);
	}
	
	// Get blog entry URL from entry ID. 
	function GetBlogEntryUrl($id) {
		return $this->oDbCall->GetBlogEntryUrl($id);
	}
	
	// Get all blog entries
	function GetBlogEntries($blog_id) {
		return $this->oDbCall->GetBlogEntries($blog_id);
	}	
	
	// Insert new blog entry.
	function InsertBlogEntry($blog_id, $entry_date, $name, $description, $set_image, $comments_id, $url, $auth) {
		$this->oDbCall->InsertBlogEntry($blog_id, $entry_date, $name, $description, $set_image, $comments_id, $url, $auth);
		return true;
	}
	
	// Update blog entry
	function UpdateBlogEntry($id, $blog_id, $entry_date, $name, $description, $set_image, $comments_id, $url, $auth) {		
		$this->oDbCall->UpdateBlogEntry($id, $blog_id, $entry_date, $name, $description, $set_image, $comments_id, $url, $auth);
		return true;
	}
	
	// Update blog entry set image.
	function SetBlogEntryImage($id, $set_image) {
		$this->oDbCall->SetBlogEntryImage($id, $set_image);
		return true;
	}
	
	// Delete blog entry
	function DeleteBlogEntry($id) {
		return $this->oDbCall->DeleteBlogEntry($id);
	}
}
?>