<?php

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

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

    public function save($table, $primery_key, $primery_key_value, $post_data = array()) {
        if (!empty($post_data)) {
            if ($primery_key_value == 0) {
                $this->db->insert($table, $post_data);
            } else {
                $this->db->
                        where($primery_key, $primery_key_value)->
                        update($table, $post_data);
            }
            
            return ($this->db->affected_rows() > 0);
        }
        
        return FALSE;
    }

}

