visa_app/application/controllers/Dashboard_Controller.php
venbatechnologies@gmail.com f34ad5968f listing changes
2018-08-01 15:45:30 +05:30

215 lines
6.7 KiB
PHP
Executable File

<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : Dashboard_Controller
* Dashboard_Controller class to control the Master Data.
* @author : Surendiran.M
* @version : 1.1
* @since : 27/07/2018
*/
class Dashboard_Controller extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct(){
parent::__construct();
$this->load->model('Dashboard_Model');
}
/**
* Index Page for this controller.
*/
public function index()
{
$this->Dashboard();
}
/**
* This function used to load the Dashboard page
*/
function Dashboard()
{
$this->global['pageTitle'] = 'Visa : Dashboard';
$this->loadViews('Dashboard', $this->global,NULL , NULL);
}
/**
* This function used to load the Country Master page
*/
function country_master(){
$this->global['pageTitle'] = 'Visa : Country Master';
$data['getcountry']= $this->Dashboard_Model->Get_CountryMaster();
$this->loadViews('country_master', $this->global,$data , NULL);
}
/**
* To Store Country Master Values
*/
function Add_country_master(){
$CountryMasterDatas =
array( 'CountryName'=>$this->input->post('CountryName'),
'CapitalCity'=>$this->input->post('CapitalCity'),
'CountryDescription'=>$this->input->post('Editor'),
'IsActive'=>$this->input->post('IsActive') != '' ? 1 : 0);
$Added = $this->Dashboard_Model->Add_CountryMaster($CountryMasterDatas);
if( $Added != "" ){
echo "<script>alert('Created Successfully ! Country Code:$Added'); window.location.href='country_master';</script>";
}
else
{
echo "<script>alert('Sorry Not Created ! Try Again '); window.location.href='country_master';</script>";
}
}
/**
* This function used to load the City Master page
*/
function city_master(){
$this->global['pageTitle'] = 'Visa : Country Master';
$data['getcity']= $this->Dashboard_Model->Get_CityMaster();
$this->loadViews('city_master', $this->global,$data , NULL);
}
/**
* To Store City Master Values
*/
function Add_city_master(){
$CityMasterDatas =
array( 'CityName'=>$this->input->post('CityName'),
'CityDescription'=>$this->input->post('CitiesDescription'),
'IsActive'=>$this->input->post('IsActive') != '' ? 1 : 0);
$Added = $this->Dashboard_Model->Add_CityMaster($CityMasterDatas);
if( $Added != "" ){
echo "<script>alert('Created Successfully ! City Code:$Added'); window.location.href='city_master';</script>";
}
else
{
echo "<script>alert('Sorry Not Created ! Try Again '); window.location.href='city_master';</script>";
}
}
/**
* This function used to load the Visa Type Master page
*/
function visa_type_master(){
$this->global['pageTitle'] = 'Visa : Visa Type Master';
$data['getvisatype']= $this->Dashboard_Model->Get_VisaTypeMaster();
$this->loadViews('visa_type_master', $this->global,$data , NULL);
}
/**
* To Store Visa Type Master Values
*/
function Add_visa_type_master(){
$VisaTypeMasterDatas =
array( 'VisaName'=>$this->input->post('VisaName'),
'VisaDescription'=>$this->input->post('VisaDescription'),
'IsActive'=>$this->input->post('IsActive') != '' ? 1 : 0);
$Added = $this->Dashboard_Model->Add_VisaType($VisaTypeMasterDatas);
if( $Added != "" ){
echo "<script>alert('Created Successfully ! Visa NO :$Added'); window.location.href='visa_type_master';</script>";
}
else
{
echo "<script>alert('Sorry Not Created ! Try Again '); window.location.href='visa_type_master';</script>";
}
}
/**
* This function used to load the Document page
*/
function document_master(){
$this->global['pageTitle'] = 'Visa : Upload Document';
$data['getdocument'] =$this->Dashboard_Model->Get_DocumentMaster();
$this->loadViews('document_upload', $this->global,$data , NULL);
}
/**
* To Store Visa's File & Documents Datas
*/
function Add_document_master(){
$DocumentMasterDatas =
array( 'DocumentName'=>$this->input->post('DocumentName'),
'Document'=>$this->uploadFile(),
'DocumentDescription'=>$this->input->post('Description'),
'IsActive'=>$this->input->post('IsActive') != '' ? 1 : 0);
$Added = $this->Dashboard_Model->Add_Document($DocumentMasterDatas);
if( $Added != "" ){
echo "<script>alert('Created Successfully ! Document NO :$Added'); window.location.href='document_master';</script>";
}
else
{
echo "<script>alert('Sorry Not Created ! Try Again '); window.location.href='document_master';</script>";
}
}
/**
* To upload IGR files
*/
function uploadFile()
{
$config['upload_path'] = 'assets/dist/img/Uploads';
$config['allowed_types'] = 'png|jpg|jpeg|pdf|docx';
$config['file_name'] = $_FILES['DocumentFile']['name'];
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload('DocumentFile'))
{
$uploadData = $this->upload->data();
$uploadfilename = $uploadData['file_name'];
return $uploadfilename;
}
else
{
$error = array('error' => $this->upload->display_errors());
$uploadfilename = '';
return 0;
}
}
/**
* This function used to load the Dashboard page
*/
function country_visa_details(){
$this->global['pageTitle'] = 'Visa : CountryWise Visa Details';
$data['records'] = $this->Dashboard_Model->Get_CountryMaster();
$this->loadViews('country_visa_details',$this->global,$data, NULL);
}
}
?>