<?php
Class Report extends Controller{

	function __construct(){
		parent::__construct();
	}
	function index(){
		$this->view->render('views/index/login.php',true);
	}
	
	function report(){
		$this->view->render('views/report/show_db_form.php');
	}
	function submit_db(){
		$this->model->submit_db();
	}
	function create(){
		$this->view->listAll = $this->model->getDbVersion();
		$this->view->data = $this->model->getDbVersion();
		$this->view->render('views/report/create_db.php');
	}
	function logs(){
		$this->view->data = $this->model->getLogs();
		$this->view->render('views/report/logs.php');
	}
	function searchDb(){
		$this->view->data = $this->model->searchDatabase();
		$this->view->listAll = $this->model->searchDatabaseListAll();
		$this->view->render('views/report/search_db_form.php',true);
	}
	function dbVersions()
	{
		$this->view->getDbVersion = $this->model->getDbVersion();
		$this->view->listAll = $this->model->getDbVersionList();
		$this->view->render('views/report/db_versions.php',true);
	}
	function dbUpdates()
	{
		$this->model->dbUpdates();
	}
	function modifyDb()
	{
		$this->model->modifyDb();
	}
	function saveDBversion()
	{
		$this->model->saveDBversion();
	}
	function getFileContent()
	{
		$this->view->getFileContent = $this->model->getFileContent();
		$this->view->render('views/report/show_file_content.php',true);
	}
	function responseToUpload()
	{
		$this->model->responseToUpload();
	}
	function getDatabaseFiles()
	{
		$folder = isset($_POST['databaseFile']) ? isset($_POST['databaseFile']) : '';
		if($folder != '')
		{
			Session::setSession('getDatabaseFile',isset($_POST['databaseFile']) ?  $_POST['databaseFile'] : '');
		}
		$this->view->pathLocation = Session::getSession('getDatabaseFile');
		// echo $this->view->pathLocation;
		$this->view->render('views/report/database_files.php',true);
	}
	function modifyAllDb()
	{
		$this->model->modifyAllDb();
	}
	function getSqlContent()
	{
		$this->model->getSqlContent();
	}
	function clientLogs()
	{
		$this->view->render('views/report/client_logs.php');
	}
	function searchClientLogs(){
		$this->view->data = $this->model->searchClient();
		$this->view->listAll = $this->model->searchClientCount();
		$this->view->render('views/report/search_client_logs.php',true);
	}
	function clientLogContent()
	{
		// $this->view->dbName = $_REQUEST['dbName'];
		// define('DATABASE_HOST2','192.168.2.243');
		// define('DATABASE_USER2','root');
		// define('DATABASE_PASS2','');
		// define('DATABASE_NAME2',$_REQUEST['dbName']);
		
		// require_once 'client_acc/include_dao2.php';
		
		$this->view->data = $this->model->getClientLogContent();
		
		$this->view->render('views/report/viewClientLogs.php',true);
	}
	function countSummary()
	{
		$this->model->countSummary();
	}

	function countDbVersion()
	{
		$this->model->countDbVersion();
	}

}