104 lines
2.8 KiB
PHP
Executable File
104 lines
2.8 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by Visual studio code.
|
|
* User: Surendiran
|
|
* Date: 11/27/17
|
|
* Time: 3:40 pm
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Announcement_model extends CI_Model {
|
|
|
|
/*
|
|
* add announcement details
|
|
* params:heading,description,active
|
|
* created by Surendiran
|
|
* */
|
|
|
|
|
|
|
|
|
|
public function addAnnouncement($arrayDetails=null)
|
|
{
|
|
$this->db->insert(ANNOUNCEMENT, $arrayDetails);
|
|
if($this->db->affected_rows() == '1'){
|
|
|
|
$result['AnnouncementStatus'] = true;
|
|
$result['message'] = "Successfully Announcement details added";
|
|
}
|
|
|
|
else {
|
|
$result['AnnouncementStatus'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
return $result;
|
|
|
|
}
|
|
public function getAnnouncement()
|
|
{
|
|
$this->db->select('Heading,description,CreatedOn,IsActive,ID');
|
|
$this->db->order_by('CreatedOn','DESC');
|
|
$announcementDetails = $this->db->get(ANNOUNCEMENT);
|
|
|
|
if($announcementDetails->result()){
|
|
|
|
$result['AnnouncementStatus'] = true;
|
|
$result['details'] = $announcementDetails->result();
|
|
}
|
|
else {
|
|
$result['AnnouncementStatus'] = false;
|
|
$result['message'] = "No records found!";
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
/*
|
|
* update announcement details
|
|
* created by Surendiran
|
|
* */
|
|
|
|
public function updateAnnouncement($arrayDetails=null,$updateID=null)
|
|
{
|
|
$this->db->where('ID',$updateID);
|
|
$updateStatus=$this->db->update(ANNOUNCEMENT, $arrayDetails);
|
|
|
|
if($updateStatus){
|
|
|
|
$result['AnnouncementStatus'] = true;
|
|
$result['message'] = "Successfully Announcement details updated";
|
|
}
|
|
|
|
else {
|
|
$result['AnnouncementStatus'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
|
|
}
|
|
return $result;
|
|
|
|
}
|
|
|
|
/*
|
|
* get announcement details
|
|
* created by Surendiran
|
|
* */
|
|
public function getLoginAnnouncement()
|
|
{
|
|
$this->db->select('Heading,description');
|
|
$this->db->from(ANNOUNCEMENT);
|
|
$this->db->where('IsActive',1);
|
|
$this->db->order_by('CreatedOn','DESC');
|
|
$announcementDetails = $this->db->get();
|
|
if($announcementDetails->result()){
|
|
$result['AnnouncementStatus'] = true;
|
|
$result['details'] = $announcementDetails->result();
|
|
}
|
|
else {
|
|
$result['AnnouncementStatus'] = false;
|
|
$result['message'] = "No records found!";
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
} |