<?
global $MESS;
$PathInstall = str_replace("\\", "/", __FILE__);
$PathInstall = substr($PathInstall, 0, strlen($PathInstall)-strlen("/index.php"));
IncludeModuleLangFile($PathInstall."/install.php");
include($PathInstall."/version.php");

if(class_exists("#part#_#modul#")) return;
Class #part#_#modul# extends CModule{
	var $MODULE_ID = "#part#.#modul#";
	var $MODULE_VERSION;
	var $MODULE_VERSION_DATE;
	var $MODULE_NAME;
	var $MODULE_DESCRIPTION;
	var $PARTNER_NAME;
	var $PARTNER_URI;
	var $MODULE_GROUP_RIGHTS = "Y";
	
	function __construct(){
        $arModuleVersion = array();
		$path = str_replace("\\", "/", __FILE__);
		$path = substr($path, 0, strlen($path) - strlen("/index.php"));
		include($path."/version.php");
		if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)){
			$this->MODULE_VERSION = $arModuleVersion["VERSION"];
			$this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
		}else{
			$this->MODULE_VERSION = #modul_upper_full#_VERSION;
			$this->MODULE_VERSION_DATE = #modul_upper_full#_VERSION_DATE;
		}
		$this->PARTNER_NAME = GetMessage("#modul_upper_full#_PARTNER_NAME");
		$this->PARTNER_URI = "#part_uri#";
		$this->MODULE_NAME = GetMessage("#modul_upper_full#_MODULE_NAME");
		$this->MODULE_DESCRIPTION = GetMessage("#modul_upper_full#_DESCRIPTION");
	}
	
	function InstallDB(){
        	return true;
   	}
	function UnInstallDB(){
        return true;
    }

	function DoInstall(){
		global $APPLICATION;
		$#modul_upper_full#_RIGHT = $APPLICATION->GetGroupRight("#part#.#modul#");
		if ($#modul_upper_full#_RIGHT == "W"){
			$this->InstallDB();
			$APPLICATION->IncludeAdminFile(GetMessage("#modul_upper_full#_INSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/#part#.#modul#/install/step1.php");
		}
	}

	function DoUninstall(){
		global $APPLICATION, $step, $DB;
		$#modul_upper_full#_RIGHT = $APPLICATION->GetGroupRight("#part#.#modul#");
		if ($#modul_upper_full#_RIGHT == "W"){
			$this->UnInstallDB();
			$step = intval($step);
			if ($step < 2){
				$APPLICATION->IncludeAdminFile(GetMessage("#modul_upper_full#_UNINSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/#part#.#modul#/install/unstep1.php");
			}elseif ($step == 2){
				$APPLICATION->IncludeAdminFile(GetMessage("#modul_upper_full#_UNINSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/#part#.#modul#/install/unstep2.php");
			}
		}
	}

	function GetModuleRightList(){
		$arr = array(
			"reference_id" => array("D", "R", "W"),
			"reference" => array(
				"[D] ".GetMessage("#modul_upper_full#_DENIED"),
				"[R] ".GetMessage("#modul_upper_full#_VIEW"),
				"[W] ".GetMessage("#modul_upper_full#_WRITE"))
			);
		return $arr;
	}
}
?>