Welcome Guest, Not a member yet? Register   Sign In
failed to upload image file and save data
#24

[eluser]cestaz18[/eluser]
MODEL

Code:
<?

class At_reports_db extends Model {

    function At_reports_db()
    {
        parent::Model();
    }

    function getList()
    {
        $sortname = $this->input->post('sortname');
        $sortorder = $this->input->post('sortorder');
        $page = $this->input->post('page');
        $rp = $this->input->post('rp');

        $query = $this->input->post('query');
        $qtype = $this->input->post('qtype');

        $stype = $this->input->post('s_type');
        $otype = $this->input->post('o_type');
        $skey = $this->input->post('s_key');

        if (!$sortname) $sortname = 'module_id';
        if (!$sortorder) $sortorder = 'DESC';

        if (!$page) $page = 1;
        if (!$rp) $rp = 25;

        $start = (($page-1) * $rp);

        $this->db->start_cache();

        if ($stype)
        {
            foreach ($stype as $key => $value)
            {
                if ($skey[$key])
                {
                    if ($stype[$key]=='so_date')  $match = convertDate($skey[$key]);
                    else $match = $skey[$key];
                    
                    switch ($otype[$key])
                    {
                        case "=":
                            $this->db->where($stype[$key],$match);
                            break;
                        case "!=":
                            $this->db->where($stype[$key]." !=",$match);
                            break;
                        case "like":
                            $this->db->like($stype[$key],$match);
                            break;
                        case ">":
                            $this->db->where($stype[$key]." >",$match);
                            break;
                        case "<":
                            $this->db->where($stype[$key]." <",$match);
                            break;
                    }
                }
            }
            
        }


        $this->db->from('sec_reports');
        $this->db->select('module_id as pkey, module_name');
        
        $num = $this->db->count_all_results();

        $this->db->order_by($sortname,$sortorder);

        $this->db->limit($rp, $start);
        $query = $this->db->get("sec_reports");

        $this->db->flush_cache();

        $data['db'] = $query;
        $data['page'] = $page;
        $data['num'] = $num;
        return $data;

    }

    function countDetailList($data)
    {
        $this->db->where($data);
        $this->db->from('sec_reports_parameters');
        $count['detFlex1'] = $this->db->count_all_results();

        return $count;
    }

    function getDetails($cond) {
        $data['module_id'] = $cond['module_id'];
        $this->db->select("*");
        $this->db->from("sec_reports");
        $this->db->where($data);
        
        return $this->db->get('sec_reports')->row_array();
    }

function getDetailsByName($cond) {
        $data['module_name'] = $cond['module_name'];
        $this->db->select("*");
        $this->db->from("sec_reports");
        $this->db->where($data);

        return $this->db->get('sec_reports')->row_array();
    }
function getParameters() {
        $item = $this->input->post('item');
        $sortname = $this->input->post('sortname');
        $sortorder = $this->input->post('sortorder');

        if (!$sortname) $sortname = 'parameter_id';
        if (!$sortorder) $sortorder = 'ASC';

        $page = 1;

        $this->db->start_cache();

        $this->db->from('sec_reports_parameters');
        //$this->db->where('sec_reports_parameters.parameter_id',$item);
        $num = $this->db->count_all_results();

        $this->db->select("parameter_id as pkey,parameter_id, parameter_label, parameter_name, parameter_type");
        $this->db->order_by($sortname,$sortorder);
        $query = $this->db->get("sec_reports_parameters");

        $this->db->flush_cache();

        $data['db'] = $query;
        $data['page'] = $page;
        $data['num'] = $num;
        return $data;
        //return $num;
    }


Messages In This Thread
failed to upload image file and save data - by El Forum - 01-18-2010, 09:41 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 09:53 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 09:57 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 10:05 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 10:10 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 11:23 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 11:30 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 11:35 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 12:09 AM
failed to upload image file and save data - by El Forum - 01-19-2010, 12:22 AM
failed to upload image file and save data - by El Forum - 01-19-2010, 03:34 AM
failed to upload image file and save data - by El Forum - 01-19-2010, 06:50 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 07:23 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 07:39 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 07:43 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:08 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:17 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:22 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:33 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:37 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:43 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:46 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:48 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:50 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:51 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:56 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 10:40 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:04 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:06 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:07 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:11 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:18 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:26 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:38 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:56 PM
failed to upload image file and save data - by El Forum - 01-20-2010, 12:01 AM
failed to upload image file and save data - by El Forum - 01-20-2010, 12:09 AM
failed to upload image file and save data - by El Forum - 01-20-2010, 12:17 AM
failed to upload image file and save data - by El Forum - 01-20-2010, 12:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB