D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
cas
/
application
/
models
/
admin
/
Filename :
UniversityManagement.php
back
Copy
<?php /** * Model For Handling All DB Operations Related To Universities * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class UniversityManagement extends CI_Model { function createNewUniversity(array $newUniversityInfo) { $this->db->insert('tbl_university_master', $newUniversityInfo); return $this->db->insert_id(); } function getAllUniversities() { $this->db->select("TUM.univ_id,TUM.univ_name,TUM.univ_short_name,TUM.univ_tel_no,TUM.univ_mob_no,TUM.univ_email," . "TUM.univ_website_url,TUM.univ_state,TUM.univ_city,TUM.univ_active_status,TUM.univ_delete_status,TUM.univ_added_by,TUM.univ_added_on," . "TUM.univ_updated_on,TUM.univ_updated_by,CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin,TCM.city_name,TSM.state_name"); $this->db->from('tbl_university_master TUM'); $this->db->join('tbl_city_master TCM', 'TUM.univ_city = TCM.city_id'); $this->db->join('tbl_states_master TSM', 'TCM.state_id = TSM.state_id'); $this->db->join('tbl_staff_members TSMA', 'TUM.univ_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TUM.univ_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TUM.univ_updated_on", "desc"); return $this->db->get(); } function getUniversityInfoBy($univ_id) { $this->db->select("TUM.univ_id,TUM.univ_name,TUM.univ_short_name,TUM.univ_full_address,TUM.univ_tel_no,TUM.univ_mob_no,TUM.univ_email," . "TUM.univ_full_address,TUM.univ_state,TUM.univ_city,TUM.univ_active_status,TUM.univ_delete_status,TUM.univ_added_by,TUM.univ_added_on," . "TUM.univ_website_url,TUM.univ_updated_on,TUM.univ_updated_by,TUM.univ_fax,TUM.univ_tel_no_alt,TUM.univ_mob_no_alt," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,TDDI.tddi_id,TDDI.tddi_doc_file_path univ_logo," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin,TCM.city_name,TSM.state_name"); $this->db->from('tbl_university_master TUM'); $this->db->join('tbl_document_document_info TDDI', 'TUM.univ_id = TDDI.tddi_mapping_id'); $this->db->join('tbl_city_master TCM', 'TUM.univ_city = TCM.city_id'); $this->db->join('tbl_states_master TSM', 'TCM.state_id = TSM.state_id'); $this->db->join('tbl_staff_members TSMA', 'TUM.univ_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TUM.univ_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TDDI.tddi_user_type_flag", "UL"); $this->db->where("TUM.univ_id", $univ_id); return $this->db->get(); } function getAllNonDeletedUniversities() { $this->db->select('*'); $this->db->from('tbl_university_master'); $this->db->where('univ_delete_status', "F"); return $this->db->get(); } function getUniversityByName($univ_name) { $this->db->select('*'); $this->db->from('tbl_university_master'); $this->db->where('univ_name', $univ_name); return $this->db->get(); } function getUniversityByEmail($univ_email) { $this->db->select('*'); $this->db->from('tbl_university_master'); $this->db->where('univ_email', $univ_email); return $this->db->get(); } function getUniversityByMobile($univ_mobile) { $this->db->select('*'); $this->db->from('tbl_university_master'); $this->db->where('univ_mob_no', $univ_mobile); return $this->db->get(); } function isUniversityNameSafeUpdate($univ_id, $univ_name) { $this->db->select("*"); $this->db->from('tbl_university_master'); $this->db->where('univ_name', $univ_name); $this->db->where('univ_id != ' . $univ_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isUniversityMobileSafeUpdate($univ_id, $univ_mobile) { $this->db->select("*"); $this->db->from('tbl_university_master'); $this->db->where('univ_mob_no', $univ_mobile); $this->db->where('univ_id != ' . $univ_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isUniversityEmailSafeUpdate($univ_id, $univ_email) { $this->db->select("*"); $this->db->from('tbl_university_master'); $this->db->where('univ_email', $univ_email); $this->db->where('univ_id != ' . $univ_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updateUniversityInfo(array $universityUpdatedInfo) { $this->db->where('univ_id', $universityUpdatedInfo['univ_id']); return $this->db->update('tbl_university_master', $universityUpdatedInfo); } }