<?php

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

class Website_Model extends CI_Model {

    var $tableName = 'tbl_website_settings';

    function website_list() {
        $query = $this->db->get($this->tableName);
        $result = $query->result_array();
        return $result;
    }

    function update($settingId, $logo) {

        if ($this->input->post('site_email'))
            $this->db->set('site_email', $this->input->post('site_email'));    
        if ($this->input->post('contact_no'))
            $this->db->set('contact_no', $this->input->post('contact_no'));
        if ($this->input->post('contact_address'))
            $this->db->set('contact_address', $this->input->post('contact_address'));  
        if ($this->input->post('facebook'))
            $this->db->set('facebook', $this->input->post('facebook'));
        if ($this->input->post('twitter'))
            $this->db->set('twitter', $this->input->post('twitter'));
        if ($this->input->post('google'))
            $this->db->set('google', $this->input->post('google'));
          if($this->input->post('youtube'))
            $this->db->set('youtube', $this->input->post('youtube'));
           if($this->input->post('linkedin'))
           $this->db->set('linkedin', $this->input->post('linkedin'));         
        if ($this->input->post('site_title'))
            $this->db->set('site_title', $this->input->post('site_title'));
        if ($this->input->post('meta_keywords'))
            $this->db->set('meta_keywords', $this->input->post('meta_keywords'));
        if ($this->input->post('meta_description'))
            $this->db->set('meta_description', $this->input->post('meta_description'));
        if ($this->input->post('google_code'))
            $this->db->set('google_code', $this->input->post('google_code'));
        if ($this->input->post('delivery_note'))
            $this->db->set('delivery_note', $this->input->post('delivery_note'));
         if ($this->input->post('delivery_charges'))
            $this->db->set('delivery_charges', $this->input->post('delivery_charges'));
         if ($this->input->post('minimum_order_amount'))
            $this->db->set('minimum_order_amount', $this->input->post('minimum_order_amount'));
           $this->db->set('google_indexing',$this->input->post('google_indexing')); 
           if($this->input->post('google_analytic_code'))
           $this->db->set('google_analytic_code', $this->input->post('google_analytic_code'));  
        if ($logo)
            $this->db->set('logo', $logo);
              

        $this->db->set('status', 'yes');
        $this->db->set('updated_time', time());

        $this->db->where('id', $settingId);
        $query = $this->db->update($this->tableName);
        return $response;
    }

}
