D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
www
/
grievance
/
sys_admin
/
application
/
models
/
admin
/
Filename :
SystemAdminManagement.php
back
Copy
<?php /** * Model Class For Handling All DB Operations Related To System Admins * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class SystemAdminManagement extends CI_Model { function __construct() { parent::__construct(); $this->load->database(); } function createNewAdmin(array $newAdminInfo) { $this->db->insert('system_admin', $newAdminInfo); return $this->db->insert_id(); } function getAllAdmins(){ $this->db->select('*'); $this->db->from('system_admin'); $this->db->order_by('sa_added_on desc'); return $this->db->get(); } function getAdminInfoByUserName($admUserName) { $this->db->select("*"); $this->db->from('system_admin'); $this->db->where('sa_username', $admUserName); return $this->db->get(); } function getAdminInfoByMobileNumber($admMobile) { $this->db->select("*"); $this->db->from('system_admin'); $this->db->where('sa_mobile', $admMobile); return $this->db->get(); } function getAdminInfoByEmail($admEmail) { $this->db->select("*"); $this->db->from('system_admin'); $this->db->where('sa_email', $admEmail); return $this->db->get(); } function getAdminInfoById($admId) { $this->db->select("*"); $this->db->from('system_admin'); $this->db->where('sa_id', $admId); return $this->db->get(); } function isEmailSafeUpdate($admId,$admEmail){ $this->db->select("*"); $this->db->from('system_admin'); $this->db->where('sa_email', $admEmail); $this->db->where('sa_id != '.$admId); $result = $this->db->get()->result(); if(sizeof($result)){ return FALSE; }else{ return TRUE; } } function isMobileSafeUpdate($admId,$admMobile){ $this->db->select("*"); $this->db->from('system_admin'); $this->db->where('sa_mobile', $admMobile); $this->db->where('sa_id != '.$admId); $result = $this->db->get()->result(); if(sizeof($result)){ return FALSE; }else{ return TRUE; } } function updateAdminInfo(array $adminUpdatedInfo) { $this->db->where('sa_id', $adminUpdatedInfo['sa_id']); return $this->db->update('system_admin', $adminUpdatedInfo); } }