Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/symphony-solusi.co.id/public_html/application/models/ |
Upload File : |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Solution_m extends MY_Model { protected $_table_name = 'solution'; protected $_primary_key = 'id_solution'; protected $_order_by = 'id_solution'; public $rules = array( array( 'field' => 'title', 'label' => 'title', 'rules' => 'trim|required|callback__cek_existing_title' ) ); function __construct() { parent::__construct(); } //pagination included function get_all_solution($limit, $start) { $this->db->select('*'); $this->db->from('solution'); $this->db->order_by('priority', 'ASC'); $this->db->limit($limit, $start); $query = $this->db->get(); return $query->result(); } //function to display new solution, where all fields are empty public function get_new() { $solution = new stdClass(); $solution->title = ''; $solution->title_en = ''; $solution->description = ''; $solution->description_en = ''; $solution->text_thumbnail = ''; $solution->text_thumbnail_en = ''; $solution->image1 = ''; $solution->image2 = ''; $solution->image3 = ''; $solution->priority = ''; $solution->status = ''; return $solution; } //get all blog function get_solution() { $this->db->select('*'); $this->db->from('solution'); $this->db->order_by('priority', 'asc'); $query = $this->db->get(); return $query->result(); } //function add new blog function add_solution($data) { $this->db->insert('solution', $data); return $this->db->insert_id(); } //function edit solution function edit_solution($id, $data) { $this->db->where('id_solution', $id); $this->db->update('solution', $data); } //function count all record for solution public function record_count() { return $this->db->get('solution')->num_rows(); } //function count if existing record exist public function count_exist($id) { $this->db->select('*'); $this->db->from('solution'); $this->db->where('id_solution', $id); $query = $this->db->get(); return $query->num_rows(); } //FOR FRONT END REGISTRATION PAGE //get all solution to display at front registration page, with status display 1 only function get_solution_display_on() { $this->db->select('*'); $this->db->from('solution'); $this->db->where('status', '1'); $this->db->where('id_solution !=', '0'); $this->db->order_by('id_solution asc'); $query = $this->db->get(); return $query->result(); } //cek if blog title already exist public function cek_existing_title($str, $id) { $this->db->select('id_solution'); $this->db->from('solution'); $this->db->where('title', $str); if ($id != NULL) { $this->db->where('id_solution !=', $id); } $query = $this->db->get(); return $query->num_rows(); } }