<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Apps model class
 */

class Apps_model extends MY_Model
{

    /**
     * 테이블명
     */
    public $_table = 'apps';

    /**
     * 사용되는 테이블의 프라이머리키
     */
    public $primary_key = 'app_id'; // 사용되는 테이블의 프라이머리키

    function __construct()
    {
        parent::__construct();
    }


    public function get_admin_list($limit = '', $offset = '', $where = '', $like = '', $findex = '', $forder = '', $sfield = '', $skeyword = '', $sop = 'OR')
    {
        $result = $this->_get_list_common('', '', $limit, $offset, $where, $like, $findex, $forder, $sfield, $skeyword, $sop);
		return $result;
    }

	public function select_max_sort()
	{
		$this->db->select_max('app_sort');
		$qry = $this->db->get($this->_table);
		$result = $qry->row_array();
		return $result['app_sort'];
	}

	public function app_list()
	{
		$this->db->order_by('app_sort', 'desc');
		$qry = $this->db->get($this->_table);
		$result = $qry->result_array();
		$data = array();
		if ($result) {
			foreach ($result as $value) {
				$data[element('app_id', $value)] = $value;
			}
		}
		return $data;
	}


}