273 lines
7.7 KiB
PHP
Executable File

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Mail_model extends CI_model {
function __construct() {
parent::__construct();
$this->load->database();
}
function getbasicInfo(){
$query = $this->db->get('website_settings')->row();
return $query;
}
function savebasicInfo($post){
if($post['title']!=""){ $data['title']=$post['title']; }
if($post['address']!=""){ $data['address']=$post['address']; }
if($post['phone']!=""){ $data['phone']=$post['phone']; }
if($post['emergency']!=""){ $data['emergency']=$post['emergency']; }
if($post['support']!=""){ $data['support']=$post['support']; }
if($post['email']!=""){ $data['email']=$post['email']; }
if($post['facebook_id']!=""){ $data['facebook_id']=$post['facebook_id']; }
if($post['twitter_id']!=""){ $data['twitter_id']=$post['twitter_id']; }
if($post['google_id']!=""){ $data['google_id']=$post['google_id']; }
if($post['youtube_id']!=""){ $data['youtube_id']=$post['youtube_id']; }
if($post['skype_id']!=""){ $data['skype_id']=$post['skype_id']; }
if($post['about_us']!=""){ $data['about_us']=$post['about_us']; }
//pre($data);die;
$this->db->where('id', '1');
$this->db->update('website_settings', $data);
return $this->db->affected_rows();
}
function getBannerList(){
$this->db->where('status', '1');
$query = $this->db->get('website_banner')->result();
return $query;
}
function getBannerByid($id){
$this->db->where('id', $id);
$this->db->where('status', '1');
$query = $this->db->get('website_banner')->row();
return $query;
}
function addBanner($data){
$this->db->insert('website_banner', $data);
return $this->db->insert_id();
}
function updateBanner($data,$id){
$this->db->where('id', $id);
$this->db->update('website_banner', $data);
return $this->db->affected_rows();
}
function addContent($data){
$this->db->insert('website_content', $data);
return $this->db->insert_id();
}
function getContentList(){
$this->db->where('status', '1');
$query = $this->db->get('website_content')->result();
return $query;
}
function getContentByid($id){
$this->db->where('id', $id);
$this->db->where('status', '1');
$query = $this->db->get('website_content')->row();
return $query;
}
function updateContent($data,$id){
$this->db->where('id', $id);
$this->db->update('website_content', $data);
return $this->db->affected_rows();
}
function saveContactMessage($data){
$this->db->insert('website_contact_message', $data);
return $this->db->insert_id();
}
/*
| our specialities section
*/
function getMailBodySettingsList(){
$this->db->where('status', '1');
$query = $this->db->get('mail_body_settings')->result();
return $query;
}
function getMailBodySettingsByid($id)
{
$this->db->where('id', $id);
$this->db->where('status', '1');
$query = $this->db->get('mail_body_settings')->row();
return $query;
}
function updateMailBodySettings($data,$id){
$this->db->where('id', $id);
$update=$this->db->update('mail_body_settings', $data);
if($update)
{
return true;
}
else
{
return false;
}
}
function getDocMailTemplateList(){
$this->db->where('status', '1');
$query = $this->db->get('document_mail_template')->result();
return $query;
}
function getDocMailTemplateByid($id)
{
$this->db->where('id', $id);
$this->db->where('status', '1');
$query = $this->db->get('document_mail_template')->row();
return $query;
}
function updateDocMailTemplate($data,$id){
$this->db->where('id', $id);
$update=$this->db->update('document_mail_template', $data);
if($update)
{
return true;
}
else
{
return false;
}
}
//______________________OLD______________________________//
/*
function name_list(){
$this->db->order_by('id', 'DESC');
$query = $this->db->get('master_icd');
return $query->result();
}
function save_name($post) {
$slot_name = $post['slot_name'];
$data = array(
'name' => $slot_name,
);
$this->db->insert('master_icd', $data);
}
function delete_name($id)
{
$this->db->where('id', $id);
$this->db->delete('master_icd');
}
function edit_name($post,$id){
$data = array(
'name' => $post['slotEditname'],
);
$this->db->where('id', $id);
$this->db->update('master_icd', $data);
}
function duplicate_entry($post)
{
$val = $post['val'];
if (isset($post['currId'])) {
$currId = $post['currId'];
$query1 = $this->db->get_where('master_icd', array('id' => $currId));
$exceptVal = $query1->result()[0]->name;
// SELECT * FROM `master_access_assessment` WHERE name='12Hours' AND name!='vatibra'
$this->db->where('name', $val);
$this->db->where('name !=', $exceptVal);
$query = $this->db->get('master_icd');
}
else{
$query = $this->db->get_where('master_icd', array('name' => $val));
}
if($query->num_rows() > 0)
{
return 'exist';
}
else{
return 'notexist';
}
}
function status_change($post){
$id = $post['id'];
$stat = $post['val'];
$this->db->set('status', $stat);
$this->db->where('id', $id);
$this->db->update('master_icd');
if($stat == '1')
{
return 'Status set active';
}
else{
return 'Status set deactive';
}
}
function getWherevalue($id){
$this->db->where('id', $id);
$query = $this->db->get('master_icd');
return $query->result();
}
function getNameBysearch($search,$orderColumn, $orderType) {
if($orderColumn==0)
$this->db->order_by('id', $orderType);
else if($orderColumn==1)
$this->db->order_by('name', $orderType);
else if($orderColumn==2)
$this->db->order_by('status', $orderType);
$this->db->like('id', $search);
$this->db->or_like('name', $search);
$this->db->or_like('status', $search);
$query = $this->db->get('master_icd');
return $query->result();
}
function getNameByLimit($limit, $start, $orderColumn, $orderType) {
if($orderColumn==0)
$this->db->order_by('id', $orderType);
else if($orderColumn==1)
$this->db->order_by('name', $orderType);
else if($orderColumn==2)
$this->db->order_by('status', $orderType);
$this->db->limit($limit, $start);
$query = $this->db->get('master_icd');
return $query->result();
}
function getNameByLimitBySearch($limit, $start, $search) {
$this->db->like('id', $search);
$this->db->order_by('id', 'desc');
$this->db->or_like('name', $search);
$this->db->or_like('status', $search);
$this->db->limit($limit, $start);
$query = $this->db->get('master_icd');
return $query->result();
}
*/
}