<?php

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

/**
 * Description of configuration_model
 *
 * @author Igor Ratsun
 */
class configuration_model extends CI_Model {

    public function get_languages() {
        $data = $this->db->
                        select('id_lan, name, active')->
                        get('lan')->result_array();

        foreach ($data as &$v) {
            $v['active'] = ($v['active']) ? 'active' : '';
        }
        unset($v);
        
        return $data;
    }
    
    public function upd_lang($id_lan, $active) {
        $this->db->update('lan', array('active' => intval($active)), array('id_lan' => intval($id_lan)));
        
        return $this->db->affected_rows();
    }

}

