<commit_before><?php

/**
 * Created by PhpStorm.
 * User: amttm
 * Date: 4/25/2016
 * Time: 4:17 PM
 */
class restaurant extends CI_Model
{
    function add()
    {
        $res_name = $this->input->post('res_name');
        $area = $this->input->post('est_area');
        $street = $this->input->post('est_street');
        $landmark = $this->input->post('est_landmark');
        $mobile1 = $this->input->post('res_mobile1');
        $mobile2 = $this->input->post('res_mobile2');
        $landline1 = $this->input->post('res_landline1');
        $landline2 = $this->input->post('res_landline2');
        $lat = $this->input->post('res_lat');
        $lon = $this->input->post('res_lon');
        $google_map = $this->input->post('res_map');
        $website = $this->input->post('res_website');
        $email = $this->input->post('res_email');
        $other = $this->input->post('res_remarks');
        $parking = $this->input->post('res_parking');
        $parking_two = $this->input->post('res_parking2');
        $parking_four = $this->input->post('res_parking4');

        $newtbl_restaurants = array(
            'res_name' => $res_name,
            'area' => $area,
            'street' => $street,
            'landmark' => $landmark,
            'mobile1' => $mobile1,
            'mobile2' => $mobile2,
            'landline1' => $landline1,
            'landline2' => $landline2,
            'lat' => $lat,
            'lon' => $lon,
            'google_map' => $google_map,
            'website' => $website,
            'email' => $email,
            'other' => $other,
            'parking' => $parking,
            'parking_two' => $parking_two,
            'parking_four' => $parking_four,
        );

        $this->db->insert('tbl_restaurants', $newtbl_restaurants);
        $res_id = $this->db->insert_id();

        $serves = $this->input->post('serves');
        if (is_array($serves)) {
            foreach ($serves as $val) {
                $newtbl_serves = array(
                    'res_id' => $res_id,
                    'serves_id' => $val,
                    'status' => 1,
                );
                $this->db->insert('tbl_res_serves', $newtbl_serves);
            }
        }

        $srv_time = $this->input->post('servtime');
        if (is_array($srv_time)) {
            foreach ($srv_time as $day => $serv) {
                $newtbl_service_time = array(
                    'res_id' => $res_id,
                    'day' => $day,
                    'opening_time' => $serv['open'],
                    'closing_time' => $serv['close'],
                    'status' => 1,
                );
                $this->db->insert('tbl_service_time', $newtbl_service_time);
            }
        }
        $estimate_cost_topic = $this->input->post('estimate_cost_topic');
        if (is_array($estimate_cost_topic)) {
            foreach ($estimate_cost_topic as $topic_id => $val) {
                $newtbl_res_estimate_cost = array(
                    'res_id' => $res_id,
                    'topic_id' => $topic_id,
                    'cost' => $val,
                    'status' => 1,
                );
                $this->db->insert('tbl_res_estimate_cost', $newtbl_res_estimate_cost);
            }
        }
//Owners
        $name = $this->input->post('owners_name');
        $designation = $this->input->post('owners_designation');
        $mobile1 = $this->input->post('owners_mobile1');
        $mobile2 = $this->input->post('owners_mobile2');
        $landline1 = $this->input->post('owners_landline1');
        $landline2 = $this->input->post('owners_landline2');

        $newtbl_owners = array(
            'name' => $name,
            'designation' => $designation,
            'mobile1' => $mobile1,
            'mobile2' => $mobile2,
            'landline1' => $landline1,
            'landline2' => $landline2,
            'res_id' => $res_id,
        );
        $this->db->insert('tbl_owners', $newtbl_owners);

        $establishment_type = $this->input->post('establishment_type');
        if (is_array($establishment_type)) {
            foreach ($establishment_type as $est_type) {
                $newtbl_res_estd_type = array(
                    'type_id' => $est_type,
                    'res_id' => $res_id,
                    'status' => 1,
                );
                $this->db->insert('tbl_res_estd_type', $newtbl_res_estd_type);
            }
        }
        $facilities = $this->input->post('facilities');
        if (is_array($facilities)) {
            foreach ($facilities as $fac) {
                $newtbl_res_facility = array(
                    'facility_id' => $fac,
                    'res_id' => $res_id,
                    'status' => 1,
                );
                $this->db->insert('tbl_res_facility', $newtbl_res_facility);
            }
        }

        $happyhours = $this->input->post('happyhours');
        if (is_array($happyhours)) {
            foreach ($happyhours as $day => $hours) {
                $newtbl_happy_hours = array(
                    'res_id' => $res_id,
                    'day' => $day,
                    'start_time' => $hours['start'],
                    'end_time' => $hours['end'],
                    'status' => 1,
                );
                $this->db->insert('tbl_happy_hours', $newtbl_happy_hours);
            }
        }
        $cousins = $this->input->post('cousins');
        if (is_array($cousins)) {
            foreach ($cousins as $cousin) {
                $newtbl_res_cousins= array(
                    'res_id'=> $res_id,
                    'cousin_id'=> $cousin,
                    'status'=> 1,
                );
                $this->db->insert('tbl_res_cousins', $newtbl_res_cousins);
            }
        }
        $foods = $this->input->post('foods');
        if (is_array($foods)) {
            foreach ($foods as $food) {
                $newtbl_res_foods= array(
                    'res_id'=> $res_id,
                    'food_id'=> $food,
                    'status'=> 1,
                );
                $this->db->insert('tbl_res_foods', $newtbl_res_foods);
            }
        }
        $pop_dishes = $this->input->post('pop_dishes');
        if (is_array($pop_dishes)) {
            foreach ($pop_dishes as $dishes) {
                $newtbl_res_pop_dishes= array(
                    'res_id'=> $res_id,
                    'pop_dishes_id'=> $dishes,
                    'status'=> 1,
                );
                $this->db->insert('tbl_res_pop_dishes', $newtbl_res_pop_dishes);
            }
        }
    }
}<commit_msg>added some functionality in restaurant model<commit_after><?php

/**
 * Created by PhpStorm.
 * User: amttm
 * Date: 4/25/2016
 * Time: 4:17 PM
 */
class restaurant extends CI_Model
{
    function add()
    {
        $res_name = $this->input->post('res_name');
        $area = $this->input->post('est_area');
        $street = $this->input->post('est_street');
        $landmark = $this->input->post('est_landmark');
        $mobile1 = '98'.$this->input->post('res_mobile1');
        $mobile2 = '98'.$this->input->post('res_mobile2');
        $landline1 = '01'.$this->input->post('res_landline1');
        $landline2 = '01'.$this->input->post('res_landline2');
        $lat = $this->input->post('res_lat');
        $lon = $this->input->post('res_lon');
        $google_map = $this->input->post('res_map');
        $website = $this->input->post('res_website');
        $email = $this->input->post('res_email');
        $other = $this->input->post('res_remarks');
        $parking = $this->input->post('res_parking');
        $parking_two = $this->input->post('res_parking2');
        $parking_four = $this->input->post('res_parking4');

        $newtbl_restaurants = array(
            'res_name' => $res_name,
            'area' => $area,
            'street' => $street,
            'landmark' => $landmark,
            'mobile1' => $mobile1,
            'mobile2' => $mobile2,
            'landline1' => $landline1,
            'landline2' => $landline2,
            'lat' => $lat,
            'lon' => $lon,
            'google_map' => $google_map,
            'website' => $website,
            'email' => $email,
            'other' => $other,
            'parking' => $parking,
            'parking_two' => $parking_two,
            'parking_four' => $parking_four,
        );

        $this->db->insert('tbl_restaurants', $newtbl_restaurants);
        $res_id = $this->db->insert_id();

        $serves = $this->input->post('serves');
        if (is_array($serves)) {
            foreach ($serves as $val) {
                $newtbl_serves = array(
                    'res_id' => $res_id,
                    'serves_id' => $val,
                    'status' => 1,
                );
                $this->db->insert('tbl_res_serves', $newtbl_serves);
            }
        }

        $srv_time = $this->input->post('servtime');
        if (is_array($srv_time)) {
            foreach ($srv_time as $day => $serv) {
                $newtbl_service_time = array(
                    'res_id' => $res_id,
                    'day' => $day,
                    'opening_time' => $serv['open'],
                    'closing_time' => $serv['close'],
                    'status' => 1,
                );
                $this->db->insert('tbl_service_time', $newtbl_service_time);
            }
        }
        $estimate_cost_topic = $this->input->post('estimate_cost_topic');
        if (is_array($estimate_cost_topic)) {
            foreach ($estimate_cost_topic as $topic_id => $val) {
                $newtbl_res_estimate_cost = array(
                    'res_id' => $res_id,
                    'topic_id' => $topic_id,
                    'cost' => $val,
                    'status' => 1,
                );
                $this->db->insert('tbl_res_estimate_cost', $newtbl_res_estimate_cost);
            }
        }
//Owners
        $name = $this->input->post('owners_name');
        $designation = $this->input->post('owners_designation');
        $mobile1 = '98'.$this->input->post('owners_mobile1');
        $mobile2 = '98'.$this->input->post('owners_mobile2');
        $landline1 = '01'.$this->input->post('owners_landline1');
        $landline2 = '01'.$this->input->post('owners_landline2');

        $newtbl_owners = array(
            'name' => $name,
            'designation' => $designation,
            'mobile1' => $mobile1,
            'mobile2' => $mobile2,
            'landline1' => $landline1,
            'landline2' => $landline2,
            'res_id' => $res_id,
        );
        $this->db->insert('tbl_owners', $newtbl_owners);

        $establishment_type = $this->input->post('establishment_type');
        if (is_array($establishment_type)) {
            foreach ($establishment_type as $est_type) {
                $newtbl_res_estd_type = array(
                    'type_id' => $est_type,
                    'res_id' => $res_id,
                    'status' => 1,
                );
                $this->db->insert('tbl_res_estd_type', $newtbl_res_estd_type);
            }
        }
        $facilities = $this->input->post('facilities');
        if (is_array($facilities)) {
            foreach ($facilities as $fac) {
                $newtbl_res_facility = array(
                    'facility_id' => $fac,
                    'res_id' => $res_id,
                    'status' => 1,
                );
                $this->db->insert('tbl_res_facility', $newtbl_res_facility);
            }
        }

        $happyhours = $this->input->post('happyhours');
        if (is_array($happyhours)) {
            foreach ($happyhours as $day => $hours) {
                $newtbl_happy_hours = array(
                    'res_id' => $res_id,
                    'day' => $day,
                    'start_time' => $hours['start'],
                    'end_time' => $hours['end'],
                    'status' => 1,
                );
                $this->db->insert('tbl_happy_hours', $newtbl_happy_hours);
            }
        }
        $cousins = $this->input->post('cousins');
        if (is_array($cousins)) {
            foreach ($cousins as $cousin) {
                $newtbl_res_cousins= array(
                    'res_id'=> $res_id,
                    'cousin_id'=> $cousin,
                    'status'=> 1,
                );
                $this->db->insert('tbl_res_cousins', $newtbl_res_cousins);
            }
        }
        $foods = $this->input->post('foods');
        if (is_array($foods)) {
            foreach ($foods as $food) {
                $newtbl_res_foods= array(
                    'res_id'=> $res_id,
                    'food_id'=> $food,
                    'status'=> 1,
                );
                $this->db->insert('tbl_res_foods', $newtbl_res_foods);
            }
        }
        $pop_dishes = $this->input->post('pop_dishes');
        if (is_array($pop_dishes)) {
            foreach ($pop_dishes as $dishes) {
                $newtbl_res_pop_dishes= array(
                    'res_id'=> $res_id,
                    'pop_dishes_id'=> $dishes,
                    'status'=> 1,
                );
                $this->db->insert('tbl_res_pop_dishes', $newtbl_res_pop_dishes);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.16348243050872854, 'fraction_numerical': 0.00914063085337529, 'mean_word_length': 1.5639646561659624, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 297, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3497028', 'n_tokens_mistral': 4326, 'n_tokens_neox': 4088, 'n_words': 599}