관리-도구
편집 파일: Homemodel.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Homemodel extends CI_Model { function __construct() { parent::__construct(); $this->load->library('session'); } public function get_mission(){ $this->db->select("*"); $this->db->from("mission"); $this->db->where(["mission_id"=>1]); $result = $this->db->get(); return $result->result(); } public function get_homepageslider(){ $this->db->select("*"); $this->db->from("homepageslider"); $this->db->where(["homepageslider_status"=>1]); $this->db->order_by("homepageslider_displayorder","DESC"); $result = $this->db->get(); return $result->result(); } public function get_news($limit){ $today_date = date("d-F-Y"); $today_datetime_stamp = strtotime($today_date); $this->db->select("*"); $this->db->from("news"); $this->db->where(["news_status"=>1,"news_datetime_stamp>="=>$today_datetime_stamp]); $this->db->order_by("news_datetime_stamp","DESC"); $this->db->order_by("news_displayorder,news_id","DESC"); $this->db->limit($limit); $result = $this->db->get(); return $result->result(); } public function get_news_count(){ $today_date = date("d-F-Y"); $today_datetime_stamp = strtotime($today_date); $this->db->select("*"); $this->db->from("news"); $this->db->where(["news_status"=>1,"news_datetime_stamp>="=>$today_datetime_stamp]); $result = $this->db->count_all_results(); return $result; } public function get_events($limit){ $today_date = date("d-F-Y"); $today_datetime_stamp = strtotime($today_date); $this->db->select("*"); $this->db->from("events"); $this->db->where(array("events_status" => 1,"events_is_deleted"=>0,"events_start_datetime_stamp>="=>$today_datetime_stamp)); $this->db->order_by("events_displayorder","DESC"); $this->db->limit($limit); $result = $this->db->get(); return $result->result(); } public function get_events_count(){ $today_date = date("d-F-Y"); $today_datetime_stamp = strtotime($today_date); $this->db->select("*"); $this->db->from("events"); $this->db->where(array("events_status" => 1,"events_is_deleted"=>0,"events_start_datetime_stamp>="=>$today_datetime_stamp)); $this->db->order_by("events_displayorder","DESC"); $result = $this->db->count_all_results(); return $result; } }