<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

class lc_comments_api extends ModuleAPI
{
	public $module='forum';
	protected $implemented=array('getCommentsItem', 'deleteItem', 'getCommentsCounters');
	
	public function getCommentsItem($key, $url, $title, $type=1)
	{
		$obj=$this->_getMain();
		return $obj->getCommentsItem($key, $url, $title, $type);
	}
	
	public function deleteItem($key, $type=1)
	{
		$obj=$this->_getItem();
		$obj->loadDataByKey($key, null, null, $type);
		$obj->delete();
	}

	public function getCommentsCounters($keys, $type=1)
	{
		$obj=$this->_getList();
		return $obj->getCommentsCounters($keys, $type);
	}
	
	private function _getMain()
	{
		return Factory::create('lc_comments.main');;
	}
	
	private function _getList()
	{
		return Factory::create('lc_comments.list');
	}
	
	private function _getItem()
	{
		return Factory::create('lc_comments.item');
	}
}