Server : LiteSpeed
System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User : outerorb ( 1091)
PHP Version : 8.1.34
Disable Function : mail
Directory :  /home2/outerorb/crm.outerorbittech.com/application/models/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: Master_model.php

Path: /home2/outerorb/crm.outerorbittech.com/application/models/Master_model.php

Size: 8.35 KB

Permissions: 0664

<?php
class Master_model extends CI_Model
{

    function __construct()
    {
        parent::__construct();
        $this->db->db_debug = false;
    }

    public function get_users()
    {
        $this->db->select('*');
        $this->db->order_by('created_at', 'DESC');
        $res = $this->db->get('register');
        if ($res) {
            $data = $res->result_array();
        } else {
            $data = $this->db->error();
        }
        return $data;
    }
    public function get_post($user_id)
    {
        $this->db->select('*');
        $this->db->order_by('created_at', 'DESC');
        $this->db->where('user_id', $user_id);
        $res = $this->db->get('posts');
        if ($res) {
            $data = $res->result_array();
        } else {
            $data = $this->db->error();
        }
        return $data;
    }
    public function count_like($post_id)
    {
        $this->db->select('*');
        $this->db->where('post_id', $post_id);
        $this->db->where('status', 1);
        $res = $this->db->get('like')->num_rows();

        return $res;
    }
    public function count_comment($post_id)
    {
        $this->db->select('*');
        $this->db->where('post_id', $post_id);
        $this->db->where('status', 1);
        $res = $this->db->get('comment')->num_rows();

        return $res;
    }
    public function count_views($post_id)
    {
        $this->db->select('*');
        $this->db->where('post_id', $post_id);
        $this->db->where('status', 1);
        $res = $this->db->get('post_views')->num_rows();

        return $res;
    }
    public function count_downloads($post_id)
    {
        $this->db->select('*');
        $this->db->where('post_id', $post_id);
        $this->db->where('status', 1);
        $res = $this->db->get('download_post')->num_rows();

        return $res;
    }
    public  function thousandsCurrencyFormat($num)
    {

        if ($num > 1000) {

            $x = round($num);
            $x_number_format = number_format($x);
            $x_array = explode(',', $x_number_format);
            $x_parts = array('k', 'm', 'b', 't');
            $x_count_parts = count($x_array) - 1;
            $x_display = $x;
            $x_display = $x_array[0] . ((int) $x_array[1][0] !== 0 ? '.' . $x_array[1][0] : '');
            $x_display .= $x_parts[$x_count_parts - 1];

            return $x_display;
        }

        return $num;
    }
    public function get_employees()
    {
        $this->db->order_by('id', 'DESC');
        $data = $this->db->get('emp')->result_array();
        return ($data);
    }

    public function country()
    {
        $cn = $this->db->get_where('countries')->result();

        $ar = array();
        $ar['0'] = 'Select Countries';
        foreach ($cn as $c) {
            $tname = $c->country_name;
            $ar[$c->id] = $tname;
        }

        return $ar;
    }
    public function employee()
    {
        $cn = $this->db->select('id,fname,mname,lname,id')->order_by('emp_code', 'ASC')->get_where('emp')->result();

        $ar = array();
        $ar['0'] = 'Select Employee';
        foreach ($cn as $c) {
            $tname = $c->fname . ' ' . $c->mname . ' ' . $c->lname;
            $ar[$c->id] = $tname;
        }

        return $ar;
    }
    public function state($id = false)
    {
        $cn = $this->db->get_where('states', array('country_id' => $id))->result();


        return $cn;
    }
    public function cities($id = false)
    {
        $cn = $this->db->get_where('cities', array('state_id' => $id))->result();

        return $cn;
    }
    public function state_id($id = false)
    {
        $state = $this->db->get_where('states', array('id' => $id))->row_array();
        return $state;
    }
    public function country_id($id = false)
    {
        $cn = $this->db->get_where('countries', array('id' => $id))->row_array();
        return $cn;
    }
    public function city_id($id = false)
    {
        $city = $this->db->get_where('cities', array('id' => $id))->row_array();
        return $city;
    }
    public function holiday_list()
    {
        $res = $this->db->get_where('holidays')->result_array();
        return $res;
    }
    public function assign($emp_id = false)
    {
        if ($emp_id != '') {
            // $this->db->where('emp_id', $emp_id);
            // $this->db->where('status', 1);
            // $emp =  $this->db->get('permission')->row_array();

            // $ar = json_decode($emp['permission'], true);
            // if (!empty($ar)) {
            $role = json_encode("3");

            $this->db->select('*');
            //$this->db->where_in('id', $ar);
            $this->db->where('status', 1);
            $this->db->where('role_id', $role);
            $sidebar = $this->db->get('sidebar')->result_array();

            //}
            return $sidebar;
        }
    }
    public function device()
    {
        $this->db->select('id,device');
        $this->db->order_by('device', "ASC");
        $rest = $this->db->get_where('device', array('status' => '1'));
        $data = array();
        $data[0] = "Select Device";
        if ($rest->num_rows() > 0) {
            foreach ($rest->result() as $r) {
                $tname = ucwords(strtolower($r->device));
                $data[$r->id] = $tname;
            }
        }

        return $data;
    }
    public function brand()
    {
        $this->db->select('id,brand');
        $this->db->order_by('brand', "ASC");
        $rest = $this->db->get_where('brand', array('status' => '1'));
        $data = array();
        $data[0] = "Select Brand";
        if ($rest->num_rows() > 0) {
            foreach ($rest->result() as $r) {
                $tname = ucwords(strtolower($r->brand));
                $data[$r->id] = $tname;
            }
        }

        return $data;
    }
    public function isp()
    {
        $this->db->select('id,isp');
        $this->db->order_by('isp', "ASC");
        $rest = $this->db->get_where('isp', array('status' => '1'));
        $data = array();
        $data[0] = "Select ISP";
        if ($rest->num_rows() > 0) {
            foreach ($rest->result() as $r) {
                $tname = ucwords(strtolower($r->isp));
                $data[$r->id] = $tname;
            }
        }

        return $data;
    }
    public function os()
    {
        $this->db->select('id,os');
        $this->db->order_by('os', "ASC");
        $rest = $this->db->get_where('os', array('status' => '1'));
        $data = array();
        $data[0] = "Select OS";
        if ($rest->num_rows() > 0) {
            foreach ($rest->result() as $r) {
                $tname = ucwords(strtolower($r->os));
                $data[$r->id] = $tname;
            }
        }

        return $data;
    }
    public function wired()
    {
        $this->db->select('id,wired');
        $this->db->order_by('wired', "ASC");
        $rest = $this->db->get_where('wired', array('status' => '1'));
        $data = array();
        $data[0] = "Select wired";
        if ($rest->num_rows() > 0) {
            foreach ($rest->result() as $r) {
                $tname = ucwords(strtolower($r->wired));
                $data[$r->id] = $tname;
            }
        }

        return $data;
    }
    public function security()
    {
        $this->db->select('id,security');
        $this->db->order_by('security', "ASC");
        $rest = $this->db->get_where('security', array('status' => '1'));
        $data = array();
        $data[0] = "Select security";
        if ($rest->num_rows() > 0) {
            foreach ($rest->result() as $r) {
                $tname = ucwords(strtolower($r->security));
                $data[$r->id] = $tname;
            }
        }

        return $data;
    }
    public function brand_name($id)
    {
        $brand = $this->db->get_where('brand', array('id' => $id))->row_array();
        return $brand['brand'];

    }
    public function isp_name($id)
    {
        $isp = $this->db->get_where('isp', array('id' => $id))->row_array();
        return $isp['isp'];

    }
    public function os_name($id)
    {
        $isp = $this->db->get_where('os', array('id' => $id))->row_array();
        return $isp['os'];

    }
    public function wired_name($id)
    {
        $isp = $this->db->get_where('wired', array('id' => $id))->row_array();
        return $isp['wired'];

    }
    public function security_name($id)
    {
        $isp = $this->db->get_where('security', array('id' => $id))->row_array();
        return $isp['security'];

    }
}

← Back to Directory Edit File 🔒 Chmod

WP File Manager