<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Setting extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
      
        
        if(isset($_REQUEST['SUBMIT_SETTING'])){
            foreach($_REQUEST['setting'] as $singleSetting):
                $this->db->set('s_value', $singleSetting[$singleSetting['key_name']]);
                $this->db->where('s_key', $singleSetting['key_name']);
                $this->db->update('setting');
            endforeach;
        }

        $settingsDetails = $this->db->select('*')->from('setting')->order_by("display_order", "asc")->get()->result_array();

        $pageData = array(
            'header'=>array('pageTitle'=>'Menu'),
            'body'=>array(
                'settingParams'=>$settingsDetails
            ),
            'footer'=>array(),
        );
        loadView('setting/setting',$pageData);
    }


}

