151 lines
5.0 KiB
PHP
Executable File
151 lines
5.0 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Date: 11/9/17
|
|
* Time: 5:28 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class University_model extends CI_Model
|
|
{
|
|
|
|
/*
|
|
* get university details
|
|
* params:
|
|
* created by kdk
|
|
* */
|
|
|
|
/*
|
|
* get University Details
|
|
*/
|
|
|
|
// get university list
|
|
public function get_university_list() {
|
|
$this->db->select('*');
|
|
$this->db->order_by('CreatedOn', 'DESC');
|
|
$this->db->from(UNIVERSITY);
|
|
$univDetails = $this->db->get();
|
|
$universityDetails = $univDetails->result();
|
|
if (count($universityDetails) > 0) {
|
|
$results['univList'] = true;
|
|
$results['university_details'] = $universityDetails;
|
|
} else {
|
|
$results['univList'] = false;
|
|
$results['message'] = 'No record found';
|
|
}
|
|
return $results;
|
|
}
|
|
|
|
// update univesity details
|
|
public function update_university_details($updateFor, $Arr) {
|
|
$this->db->where('UniversityID', $updateFor);
|
|
$this->db->update(UNIVERSITY, $Arr);
|
|
if ($this->db->affected_rows() == '1') {
|
|
$result['updateUniversityStatus'] = true;
|
|
$result['message'] = "Successfully University details Updated";
|
|
} else {
|
|
$result['updateUniversityStatus'] = false;
|
|
$result['message'] = "Successfully University details Updated";
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
// check exist details
|
|
public function check_Univ_Exist($data, $check) {
|
|
// check update for mobile number
|
|
$this->db->select('*');
|
|
$this->db->from(UNIVERSITY);
|
|
$this->db->where('UniversityID', $data);
|
|
if ($this->db->get()->first_row()) {
|
|
$result['existUniv'] = true;
|
|
$result['message'] = "This University Id is already exist!";
|
|
} else {
|
|
$result['existUniv'] = false;
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
// add university details
|
|
public function insert_Univ($arr) {
|
|
$this->db->insert(UNIVERSITY, $arr);
|
|
if ($this->db->affected_rows() == '1') {
|
|
$result['addUniv'] = true;
|
|
$result['message'] = "Successfully University details added";
|
|
} else {
|
|
$result['addUniv'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
public function addactivity($arrayDetails=null)
|
|
{
|
|
$this->db->select('ListName,ListCode,Description');
|
|
$this->db->where('ListGroup', '2');
|
|
$this->db->where('ListName', $arrayDetails['ListName']);
|
|
// $this->db->where('ListCode', $arrayDetails['ListCode']);
|
|
// $this->db->where('Description', $arrayDetails['Description']);
|
|
$checkExistActivity = $this->db->get(PICK_LIST_DETAILS);
|
|
|
|
// if($checkExistActivity->result()){
|
|
// $result['activityStatus'] = false;
|
|
// $result['details'] = "This activity is already added";
|
|
// }
|
|
// else{
|
|
$this->db->insert(PICK_LIST_DETAILS, $arrayDetails);
|
|
if($this->db->affected_rows() == '1'){
|
|
$result['activityStatus'] = true;
|
|
$result['message'] = "Successfully activity is added";
|
|
}
|
|
else {
|
|
$result['activityStatus'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
// }
|
|
return $result;
|
|
|
|
}
|
|
|
|
/*
|
|
* get Activity details
|
|
* parama id
|
|
* created by Surendiran
|
|
* */
|
|
|
|
public function getActivity()
|
|
{
|
|
$this->db->select('ListCode,ListName,Description,IsActive');
|
|
$this->db->where('ListGroup','2');
|
|
$this->db->order_by('ListCode','DESC');
|
|
$activityDetails = $this->db->get(PICK_LIST_DETAILS);
|
|
if($activityDetails->result()){
|
|
$result['activityStatus'] = true;
|
|
$result['details'] = $activityDetails->result();
|
|
}
|
|
else {
|
|
$result['activityStatus'] = false;
|
|
$result['message'] = "No records found!";
|
|
}
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
* update announcement details
|
|
* created by Surendiran
|
|
* */
|
|
public function updateActivity($arrayDetails=null,$ListCode=null) {
|
|
|
|
$this->db->where('ListCode',$ListCode);
|
|
$updateStatus=$this->db->update(PICK_LIST_DETAILS, $arrayDetails);
|
|
if($updateStatus){
|
|
$result['activityStatus'] = true;
|
|
$result['message'] = "Successfully Activity details updated";
|
|
}
|
|
else {
|
|
$result['activityStatus'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
return $result;
|
|
}
|
|
} |