<?php
/*!! Structure.Extension.Comment:
Сервис, который позволяет вставить на страницу комментарии.
*/
class Service_Comment extends XcBase {

    var $_kernel;

    function Service_Comment($kernelLink) {
           $this->_localname = 'Comment';
           $this->XcBase($kernelLink);
           $this->_kernel = $this->srvMainKernel();
           //$this->advOnto = $this->_kernel->srvFactory("AdvOntology");
    }

    function onInstall($params) {
	   $this->_kernel->Query("CREATE TABLE `".$this->_db->config["mysql_database"]."`.`".$this->_db->config["table_prefix"]."comment` (`id` INT(10) NOT NULL AUTO_INCREMENT, `pid` INT(10) NOT NULL, `name` VARCHAR(200) NOT NULL, `text` VARCHAR(2000) NOT NULL,  `date` timestamp NOT NULL,  `ip` VARCHAR(20) NOT NULL, PRIMARY KEY (`id`)) ENGINE = MyISAM;");
	   return true;
    }

    function onUninstall($params) {
          $this->_kernel->Query("DROP TABLE  `".$this->_db->config["mysql_database"]."`.`".$this->_db->config["table_prefix"]."comment`");
          return true;
    }

    function NewSmarty()
	{
		$mythis = $this->_kernel;
		$sm = $mythis->NewSmarty();
		$def = $mythis->getSiteDataPath().'data/'.$this->_localname.'/';
		$sm->template_dir = $def.'templates/';
		$sm->compile_dir = $def.'templates_c/';
		$sm->config_dir = $def.'config/';
		$sm->cache_dir = $def.'cache/';
		$sm->plugins_dir[] = $def.'plugins/';
		return $sm;
	}



}



?>