?
Current Path : /home1/savoy/public_html/unova.in/test/application/models/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/unova.in/test/application/models/adminmodel.php |
<?php class Adminmodel extends CI_Model { function __construct() { parent::__construct(); } function authenticate($username,$password) { $passwordmd5=md5($password); $query= $this->db->query("select * from user where username='$username' and password='$passwordmd5'"); $data['numrows']=$query->num_rows(); if($query->num_rows()>0) { $result= $query->row(); $data['userid']= $result->user_id; $data['username']=$username; return $data; } else return 0; } function insert_reminder($postdata) { $tbl1Values=array('content'=>$postdata['rem_content']); $this->db->insert('reminder', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_quote($postdata) { $tbl1Values=array('quote_content'=>$postdata['quote_content']); $this->db->where('quote_id', '1'); $this->db->update('quote', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function add_programme($postdata) { $this->db->trans_begin(); $this->db->query("update programme set `order`=`order`+1 where `order`>=".$postdata['sort']); $tbl1Values=array('programme_title'=>$postdata['programme_title'], 'prgmdate'=>$postdata['prgmdate'], 'second_line'=>$postdata['second_line'], 'third_line'=>$postdata['third_line'], 'description'=>$postdata['description'], 'active'=>$postdata['active'], 'order'=>$postdata['sort'],); $this->db->insert('programme', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function add_training($postdata) { $this->db->trans_begin(); $this->db->query("update training set `order`=`order`+1 where `order`>=".$postdata['order']); $tbl1Values=array('training_title'=>$postdata['training_title'], 'training_content'=>$postdata['training_content'], 'training_contact'=>$postdata['training_contact'], 'active'=>$postdata['active'], 'order'=>$postdata['order'] ); $this->db->insert('training', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function add_coaching($postdata) { $this->db->trans_begin(); $this->db->query("update coaching set `order`=`order`+1 where `order`>=".$postdata['order']); $tbl1Values=array('coaching_title'=>$postdata['coaching_title'], 'coaching_content'=>$postdata['coaching_content'], 'coaching_contact'=>$postdata['coaching_contact'], 'active'=>$postdata['active'], 'order'=>$postdata['order'] ); $this->db->insert('coaching', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function add_testimonial($postdata) { $this->db->trans_begin(); $this->db->query("update testimonial set `sort`=`sort`+1 where `sort`>=".$postdata['order']); $tbl1Values=array('person'=>$postdata['person'], 'designation'=>$postdata['designation'], 'testimonial'=>$postdata['testimonial'], 'sort'=>$postdata['order'] ); $this->db->insert('testimonial', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_testimonial($postdata) { $this->db->trans_begin(); if($postdata['actsort']<$postdata['order']) { $this->db->query("update testimonial set `sort`=`sort`-1 where `sort`>".$postdata['actsort']." and `sort`<=".$postdata['order']); } else { $this->db->query("update testimonial set `sort`=`sort`+1 where `sort`<".$postdata['actsort']." and `sort`>=".$postdata['order']); } $tbl1Values=array('person'=>$postdata['person'], 'designation'=>$postdata['designation'], 'testimonial'=>$postdata['testimonial'], 'sort'=>$postdata['order'] ); $this->db->where('id', $postdata['id']); $this->db->update('testimonial', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function add_gallery($postdata) { $this->db->trans_begin(); $this->db->query("update gallery set `sort`=`sort`+1 where `sort`>=".$postdata['sort']); $tbl1Values=array('thumbnail'=>$postdata['filename'], 'image'=>$postdata['filename'], 'title'=>$postdata['title'], 'sort'=>$postdata['sort'], ); $this->db->insert('gallery', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_gallery($postdata) { $this->db->trans_begin(); if($postdata['actsort']<$postdata['sort']) { $this->db->query("update gallery set `sort`=`sort`-1 where `sort`>".$postdata['actsort']." and `sort`<=".$postdata['sort']); } else { $this->db->query("update gallery set `sort`=`sort`+1 where `sort`<".$postdata['actsort']." and `sort`>=".$postdata['sort']); } $tbl1Values=array( 'title'=>$postdata['title'], 'sort'=>$postdata['sort'], ); $this->db->where('id', $postdata['id']); $this->db->update('gallery', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_programme($postdata) { $this->db->trans_begin(); if($postdata['actsort']<$postdata['sort']) { $this->db->query("update programme set `order`=`order`-1 where `order`>".$postdata['actsort']." and `order`<=".$postdata['sort']); } else { $this->db->query("update programme set `order`=`order`+1 where `order`<".$postdata['actsort']." and `order`>=".$postdata['sort']); } $tbl1Values=array('programme_title'=>$postdata['programme_title'], 'prgmdate'=>$postdata['prgmdate'], 'second_line'=>$postdata['second_line'], 'third_line'=>$postdata['third_line'], 'description'=>$postdata['description'], 'active'=>$postdata['active'], 'order'=>$postdata['sort']); $this->db->where('programme_id', $postdata['id']); $this->db->update('programme', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_training($postdata) { $this->db->trans_begin(); if($postdata['actsort']<$postdata['order']) { $this->db->query("update training set `order`=`order`-1 where `order`>".$postdata['actsort']." and `order`<=".$postdata['order']); } else { $this->db->query("update training set `order`=`order`+1 where `order`<".$postdata['actsort']." and `order`>=".$postdata['order']); } $tbl1Values=array('training_title'=>$postdata['training_title'], 'training_content'=>$postdata['training_content'], 'training_contact'=>$postdata['training_contact'], 'active'=>$postdata['active'], 'order'=>$postdata['order'] ); $this->db->where('training_id', $postdata['id']); $this->db->update('training', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_coaching($postdata) { $this->db->trans_begin(); if($postdata['actsort']<$postdata['order']) { $this->db->query("update coaching set `order`=`order`-1 where `order`>".$postdata['actsort']." and `order`<=".$postdata['order']); } else { $this->db->query("update coaching set `order`=`order`+1 where `order`<".$postdata['actsort']." and `order`>=".$postdata['order']); } $tbl1Values=array('coaching_title'=>$postdata['coaching_title'], 'coaching_content'=>$postdata['coaching_content'], 'coaching_contact'=>$postdata['coaching_contact'], 'active'=>$postdata['active'], 'order'=>$postdata['order'] ); $this->db->where('coaching_id', $postdata['id']); $this->db->update('coaching', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $data['res']=0; return $data; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } function update_password($postdata) { $tbl1Values=array('password'=>md5($postdata['password'])); $this->db->where('user_id', '1'); $this->db->update('user', $tbl1Values); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return 0; } else { $this->db->trans_commit(); $data['res']=1; return $data; } } } ?>