<?php
/**
 * Административный интерфейс модуля
 * @author chayn1k [3DaVinci]
 */

$NETCAT_FOLDER = join( strstr(__FILE__, "/") ? "/" : "\\", array_slice( preg_split("/[\/\\\]+/", __FILE__), 0, -4 ) ).( strstr(__FILE__, "/") ? "/" : "\\" );
include_once ($NETCAT_FOLDER."vars.inc.php");
require ($ADMIN_FOLDER."function.inc.php");

// UI config
require_once ($ADMIN_FOLDER."modules/ui.php");
require_once ($MODULE_FOLDER."3dvimoney/ui_config.php");
require_once ($MODULE_FOLDER."3dvimoney/3dv_imoney_admin.class.php");

$dv_imoney_admin = new dv_imoney_admin();

if ( !$view ) $view = 'info';
$Title1 = NETCAT_MODULES;
$Title2 = DV_IMONEY;

$AJAX_SAVER = !( $perm->isGuest() || $view == 'info' );

BeginHtml ($Title2, $Title1, "http://".$DOC_DOMAIN."/settings/modules/3dvimoney/", '3dvimoney');

$perm->ExitIfNotAccess(NC_PERM_MODULE, 0, 0, 0, 1);
$UI_CONFIG = new ui_config_module_dv_imoney($view, '');

// имена методов для сохранения и показа
$method_show = $view."_show";
$method_save = $view."_save";

if ( !is_callable( array($dv_imoney_admin, $method_show)) || !is_callable( array($dv_imoney_admin, $method_save)) ) {
	nc_print_status("Incorrect view: ".  htmlspecialchars($view), 'error');
	exit;
}

// сохранение информации
if ( $nc_core->input->fetch_get_post('act') === 'save' ) {
	try {
		$dv_imoney_admin->$method_save();
		nc_print_status(DV_IMONEY_ADMIN_SAVE_OK, 'ok');
	}
	catch ( Exception $e ) {
		nc_print_status($e->getMessage(), 'error');
	}
}

// показ какой-либо формы
$dv_imoney_admin->$method_show();

EndHtml();


