173 lines
5.3 KiB
PHP
173 lines
5.3 KiB
PHP
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
require APPPATH . '/libraries/BaseController.php';
|
|
|
|
/**
|
|
* Class : configurationctrl (Configuration Details - Controller)
|
|
* User Class to control all user related operations.
|
|
* @author :Venba Info Tech - Surendar
|
|
* @version : 1.1
|
|
* @since : 18 November 2017
|
|
*/
|
|
class configurationctrl extends BaseController
|
|
{
|
|
/**
|
|
* This is default constructor of the class
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->load->library('form_validation');
|
|
$this->load->model('configmodel');
|
|
|
|
$this->isLoggedIn();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
|
|
$this->global['pageTitle'] = 'Resico : Config Details';
|
|
|
|
$this->loadViews("configlisting", $this->global, NULL , NULL);
|
|
}
|
|
|
|
|
|
function configlisting()
|
|
{
|
|
|
|
$this->load->model('configmodel');
|
|
|
|
$searchText = $this->input->post('searchText');
|
|
$data['searchText'] = $searchText;
|
|
|
|
|
|
//$count = $this->configmodel->departmentListingCount($searchText);
|
|
|
|
//$returns = $this->paginationCompress ( "configlisting/", $count, 20 );
|
|
|
|
$data['userRecords'] = $this->configmodel->configlisting();
|
|
|
|
$this->global['pageTitle'] = 'Resico : Config Listing';
|
|
|
|
$this->loadViews("configlisting", $this->global, $data, NULL);
|
|
|
|
}
|
|
function addconfig()
|
|
{
|
|
$this->global['pageTitle'] = 'Resico : Add New Config';
|
|
$this->loadViews("addconfig", $this->global,NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
function addNewconfig()
|
|
{
|
|
// $Configid = $this->input->post('Configid');
|
|
$ConfigName = $this->input->post('configurationname');
|
|
$Rowcount = $this->input->post('txtRowCount');
|
|
$Comments = $this->input->post('Comments');
|
|
$Createdby = $this->session->userdata ( 'userId' );
|
|
$chked = $this->input->post('IsActive');
|
|
|
|
if( $chked != '')
|
|
{
|
|
$IsActive = '1';
|
|
}
|
|
else
|
|
{
|
|
$IsActive = '0';
|
|
}
|
|
|
|
//$config = array('Config_ID'=>$Configid,'ConfigName'=>$ConfigName, 'Comments'=>$Comments);
|
|
$config = array('ConfigName'=>$ConfigName, 'Comments'=>$Comments);
|
|
$result = $this->configmodel->addconfigmaster($config);
|
|
//print_r($result);
|
|
|
|
//echo $id;die();
|
|
if(count($config)>0)
|
|
{
|
|
$id=$result[0]['Config_ID'];
|
|
for($i=1;$i<=$Rowcount;$i++)
|
|
{
|
|
$ConfigValue = $this->input->post('ConfigValue'.$i);
|
|
$configvalue = array('Config_ID'=>$id,'ConfigValue'=>$ConfigValue);
|
|
$result = $this->configmodel->addconfigdetails($configvalue);
|
|
|
|
}}//if closed
|
|
//echo "successfully created:".$ConfigID;
|
|
|
|
|
|
if($result > 0)
|
|
{
|
|
redirect('configurationctrl/configlisting','refresh');
|
|
echo "<script>alert('Config Value Created successfully!');</script>";
|
|
}
|
|
|
|
else
|
|
{
|
|
redirect('configurationctrl/configlisting','refresh');
|
|
echo "<script>alert('Config Value Not Created!');</script>";
|
|
}
|
|
}
|
|
|
|
function editOldconfig($ConfigID = '')
|
|
{
|
|
$ConfigID = $_GET['ConfigID'];
|
|
$data['master'] = $this->configmodel->GetConfigCenterMaster($ConfigID);
|
|
$data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID);
|
|
|
|
$index = 1;
|
|
// $index = $index + 1;
|
|
$this->global['pageTitle'] = 'Resico : Edit Config';
|
|
$this->loadViews("editconfig", $this->global, $data,NULL);
|
|
//}
|
|
}
|
|
|
|
function configedit()
|
|
{
|
|
|
|
$Configid = $this->input->post('Configid');
|
|
$ConfigName = $this->input->post('ConfigName');
|
|
$Comments = $this->input->post('Remarks');
|
|
$Rowcount = $this->input->post('txtRowCount');
|
|
//echo $Rowcount;die();
|
|
//$ConfigValue = $this->input->post('ConfigValue');
|
|
|
|
$config = array('Config_ID'=>$Configid,'ConfigName'=>$ConfigName, 'Comments'=>$Comments);
|
|
//print_r($config);die();
|
|
$result = $this->configmodel->updateconfig($config,$Configid);
|
|
|
|
// if(count($config)>0)
|
|
// {
|
|
for($i=1;$i<=$Rowcount;$i++)
|
|
{
|
|
// echo $i;
|
|
$Key = $this->input->post('DbKey'.$i);
|
|
$conid = $this->input->post('configID'.$i);
|
|
$ConfigValue = $this->input->post('configVal'.$i);
|
|
|
|
//print_r($Key);die();
|
|
// echo $conid . "-" . $ConfigValue;
|
|
$configval = array('ConfigValue'=>$ConfigValue);
|
|
// print_r($configval);die();
|
|
$result = $this->configmodel->updateconfigvalue($configval,$Key);
|
|
|
|
}
|
|
//}
|
|
//$print_r($result);die();
|
|
if($result == True)
|
|
{
|
|
redirect('configlisting','refresh');
|
|
echo "<script>alert('Config Value Successfully Updated!');</script>";
|
|
}
|
|
|
|
else
|
|
{
|
|
redirect('configlisting','refresh');
|
|
echo "<script>alert('Config Value Not Updated!');</script>";
|
|
}
|
|
}
|
|
}
|
|
?>
|