load->library('form_validation'); $this->load->model('configmodel'); $this->CompanyName = "RESICO"; $this->isLoggedIn(); } public function index() { $this->global['pageTitle'] = $this->CompanyName.' : 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'] = 'RESICO : config Listing'; $this->loadViews("configlisting", $this->global, $data, NULL); } function addconfig() { $this->global['pageTitle'] = $this->CompanyName.' : 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); $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 ""; } 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'] = $this->CompanyName.' : 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 ""; } } } ?>