BBnepal-Accounts/account/application/controllers/master/Translations.php

61 lines
2.2 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Translations extends CI_Controller
{
function __construct()
{
parent::__construct();
checkLogin();
}
public function _remap($alias = "", $params = array())
{
$data['dataValue'] = $this->session;
$data['pageTitle'] = "English to Nepali Translations";
switch ($alias) {
case 'add':
if (isset($_POST['submit'])) {
$TableData = array(
'english' => filter_var($_POST['english']),
'nepali' => filter_var($_POST['nepali']),
'created_by' => 'admin',
'created_on' => date('Y-m-d H:i:s'),
'remarks' => filter_var($_POST['remarks']),
'status' => 1,
);
$this->db->insert('tbl_translations', $TableData);
redirect("master/translations");
}
loadView("translations/add", $data);
break;
case 'edit':
if (isset($_POST['submit'])) {
$id = $this->uri->segment(4);
$TableData = array(
'english' => filter_var($_POST['english']),
'nepali' => filter_var($_POST['nepali']),
'created_by' => 'admin',
'created_on' => date('Y-m-d H:i:s'),
'remarks' => filter_var($_POST['remarks']),
'status' => 1,
);
$this->db->where('translation_id', $id);
$this->db->update('tbl_translations', $TableData);
redirect("master/translations");
}
loadView("translations/edit", $data);
break;
case 'delete':
$id = $this->uri->segment(4);
$this->db->where('translation_id', $id);
$this->db->delete('tbl_translations');
redirect("master/translations");
break;
default:
loadView("translations/list", $data);
}
}
}