load->library('form_validation');
$this->load->model('configmodel');
$this->isLoggedIn();
}
public function index()
{
$this->global['pageTitle'] = 'Siddharth : Supplier';
$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'] = 'Siddharth Industries : config Listing';
$this->loadViews("configlisting", $this->global, $data, NULL);
}
function addconfig()
{
$this->global['pageTitle'] = 'siddharth : AddNew Department';
$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);
$result = $this->configmodel->addconfigmaster($config);
if(count($config)>0)
{
for($i=1;$i<=$Rowcount;$i++)
{
$ConfigValue = $this->input->post('ConfigValue'.$i);
$configvalue = array('Config_ID'=>$Configid,'ConfigValue'=>$ConfigValue);
$result = $this->configmodel->addconfigdetails($configvalue);
}}//if closed
//echo "successfully created:".$ConfigID;
if($result > 0)
{
redirect('configurationctrl/configlisting','refresh');
echo "";
}
else
{
redirect('configurationctrl/configlisting','refresh');
echo "";
}
}
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'] = 'Siddharth : Edit Cost';
$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 "";
}
else
{
redirect('configlisting','refresh');
echo "";
}
}
}
?>