function user($id = null) { $this->load->library('form_validation'); $model = array(); if ($id) { $model = $this->commonmodel->getByPk($id, 'aauth_users'); } $this->form_validation->set_rules('name', 'Name', 'trim|required|callback_valid_login'); $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_email_check'); $this->form_validation->set_rules('pass', 'Password', 'trim|required'); $this->form_validation->set_rules('pass1', 'confirm Password', 'trim|required|matches[pass]'); $this->form_validation->set_error_delimiters('<li>', '</li>'); //Render View if ($this->form_validation->run() == FALSE) { $inner = $page = array(); if (!$id) { $model = $_POST; } $inner['user'] = $model; $page['content'] = $this->load->view('companyuser', $inner, true); $this->load->view($this->customer, $page); } else { $data = rSF('aauth_users'); $status = $this->commonmodel->insertRecord($data, 'aauth_users'); $this->session->set_flashdata('SUCCESS', 'user_added'); redirect(createUrl('company/user/')); exit; } }
function contactSave() { $response['success'] = false; $response['message'] = ''; $data = rSF('enquiry'); $data['ename'] = $this->input->post('event_name'); if (!arrIndex($_POST, 'name') || !arrIndex($_POST, 'email') || !arrIndex($_POST, 'message')) { $response['message'] = "All * fields are mandatory"; } else { if (!is_numeric($this->input->post('phone', TRUE))) { $response['message'] = "Phone must be numeric value"; echo json_encode($response); exit; } $email = $this->input->post('email', TRUE); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $response['message'] = "Email not valid"; echo json_encode($response); exit; } $data['date'] = date("d/m/Y"); // echo '<pre>'; // print_r($data);exit; self::sendMail($data); $result = $this->db->insert('enquiry', $data); if ($result) { $response['success'] = true; $response['message'] = 'We will contact you shortly'; // redirect('contact-us/thank-you'); } } echo json_encode($response); }
function complete() { // e($_REQUEST); $this->load->model('Calendermodel'); $arr = rSF('event_complete'); $this->Calendermodel->eventComplete($arr); }
function updateRecord($customer) { $data = array(); $data = rSF('customer'); $this->aauth->update_user($data['auth_user_id'], arrIndex($data, 'email'), arrIndex($data, 'passwd'), arrIndex($data, 'first_name'), FALSE); $this->db->where('auth_user_id', arrIndex($data, 'auth_user_id'))->update('customer', $data); return; }
function insertRecord($id = null) { $data = array(); $data = rSF('email_content'); if ($id) { $this->db->where('email_content_id', $id); $this->db->update('email_content', $data); } else { $this->db->insert('email_content', $data); } return true; }
function add() { $data = rSF('franchise_region'); if (arrIndex($data, 'name')) { if (arrIndex($data, 'id')) { $this->commonmodel->updateRecord($data, $data['id'], $this->table); $this->session->set_flashdata('SUCCESS', 'region_updated'); } else { $this->commonmodel->insertRecord($data, $this->table); $this->session->set_flashdata('SUCCESS', 'region_added'); } redirect($this->controllername . '/index'); } $this->loadView(); }
function contactSave() { $response['success'] = false; $response['message'] = ''; $data = rSF('enquiry'); if (!arrIndex($_POST, 'name') || !arrIndex($_POST, 'email') || !arrIndex($_POST, 'message')) { $response['message'] = "All * fields are mandatory"; } else { $data['date'] = date('Y-m-d'); self::sendMail($data); $result = $this->db->insert('enquiry', $data); if ($result) { $response['success'] = true; $response['message'] = 'We will contact you shortly'; } } echo json_encode($response); }
function add($id = null) { $table_name = 'franchise_testimonials'; if (gParam('content') && gParam('name')) { $data = rSF($table_name); $data['user_id'] = curUsrId(); if (!$id) { $result = $this->commonmodel->insertRecord($data, $table_name); } else { $result = $this->commonmodel->updateRecord($data, $id, $table_name); } if ($result) { redirect(createUrl('frontend/testimonials')); } } $model = $this->commonmodel->getByPk($id, $table_name); $inner = $page = array(); $inner['model'] = $model; $page['content'] = $this->load->view('addtestimonials', $inner, true); $this->load->view($this->default, $page); }
function save() { $data = rSF('units_attributes'); $id = gParam('id'); if ($id) { if (isset($_POST['deldrop'])) { $ids = array_filter($_POST['deldrop']); foreach ($ids as $delIds) { if (trim($delIds) != "") { $this->db->where('id', $delIds); $this->db->delete('units_attributes_dropdown'); } } } if (isset($_POST['drop'])) { foreach (array_filter($_POST['drop']) as $dropdwn) { if (trim($dropdwn) != "") { $this->db->insert('units_attributes_dropdown', array('dropdown_id' => $id, 'value' => $dropdwn, 'sort' => 0)); } } } //e($_POST); $this->db->where('id', $id); $this->db->update('units_attributes', $data); $this->session->set_flashdata('SUCCESS', 'attribute_updated'); } else { $this->db->insert('units_attributes', $data); $lastDrodown = $this->db->insert_id(); if ($data['type'] == "dropdown") { foreach (array_filter($_POST['drop']) as $dropdwn) { if (trim($dropdwn) != "") { $this->db->insert('units_attributes_dropdown', array('dropdown_id' => $lastDrodown, 'value' => $dropdwn, 'sort' => 0)); } } } $this->session->set_flashdata('SUCCESS', 'attribute_added'); } }
function addsidelinks($id = null) { $model = $this->commonmodel->getByPk($id, 'front_events'); $inner = $page = array(); if (gParam('color')) { // gAParams(); $data = rSF('front_events'); $data['user_id'] = curUsrId(); if (isset($_FILES['image']['name'])) { $data['pic'] = self::uploadImage(); } if (!$id) { $result = $this->commonmodel->insertRecord($data, 'front_events'); } else { $result = $this->commonmodel->updateRecord($data, $id, 'front_events'); } if ($result) { redirect(createUrl('frontend/sideEventsLinks')); } } $inner['model'] = $model; $page['content'] = $this->load->view('addsidelinks', $inner, true); $this->load->view($this->default, $page); }
function updateRecord($booking) { $data = array(); $data = rSF('eventbooking_bookings'); $this->db->where('booking_id', $booking['booking_id']); $this->db->update('eventbooking_bookings', $data); $ticket = array(); for ($i = 0; $i < $_POST['ctn']; $i++) { foreach ($_POST as $row) { $ticket[$i] = $_POST; } } $this->db->where('booking_id', $booking['booking_id']); $this->db->delete('eventbooking_bookings_tickets'); $no = 1; $ticket_data = array(); foreach ($ticket as $row) { $ticket_data['booking_id'] = $booking['booking_id']; $ticket_data['event_id'] = $row['event_id']; $ticket_data['ticket_id'] = $row['unique_id'] . '-' . $no; $this->db->insert('eventbooking_bookings_tickets', $ticket_data); $no++; } }
function add($id = null) { if (!$id) { return false; } if (gParam('auth_user_id')) { $image = $_FILES['image']['name']; if ($image) { $image = $this->usermodel->uploadImage(); } else { $image = false; } $data = rSF('customer'); $password = gParam('passwd'); $this->aauth->update_user($id, gParam('email'), $password, gParam('firstname'), false, $image); $this->commonmodel->updateRecord($data, gParam('auth_user_id'), 'customer', 'auth_user_id'); } $inner = array(); $inner['model'] = $this->commonmodel->getByPk($id, 'customer', 'auth_user_id'); $inner['model'] = (array) $inner['model']; $page['content'] = $this->load->view('customer/add', $inner, TRUE); // $this->load->view($this->dashboard, $page); $this->load->view('themes/default/templates/customerlogin', $page); }
function tenantPayment($tenant_id, $property_id) { // tenant_wallet // e($_POST); $data = rSF('tenant_wallet'); $application_id = gp('application_id'); $data['tenant_id'] = $tenant_id; $data['unit_id'] = $property_id; $this->db->from('tenant_wallet'); $this->db->where('tenant_id', $tenant_id); $this->db->where('unit_id', $property_id); $this->db->order_by('id', 'desc'); $this->db->limit(1); $rs = $this->db->get()->result_array(); $data['data'] = json_encode($_POST); $data['updated_by'] = curUsrId(); if (count($rs)) { $prev_wal_amt = $rs[0]['amount']; $data['amount'] += $prev_wal_amt; $this->db->insert('tenant_wallet', $data); } else { $this->db->insert('tenant_wallet', $data); } return self::clearTenantPendingInvoices($tenant_id, $property_id, $application_id); }
function insertRecord() { $data = array(); $data = rSF('units'); // echo "<pre>"; // print_r($data); // die(); $data['is_active'] = $this->input->post('active'); $data['description'] = $this->input->post('description'); $data['datetime'] = date('Y-m-d H:i:s'); $data['amount_type'] = $this->input->post('amount_type'); $data['is_featured'] = $this->input->post('is_featured'); // $data['property_type'] = $this->input->post('ptype'); $data['post_code'] = $this->input->post('post_code'); $data['county'] = $this->input->post('county'); // $data['country'] = $this->input->post('country'); $data['country'] = 'GB'; $data['ptenure'] = $this->input->post('ptenure'); $data['flat_no'] = $this->input->post('flat_no'); $config_slug = array('field' => 'uri', 'table' => 'units', 'id' => 'id'); $this->load->library('slug', $config_slug); $data_uri = array('title' => $this->input->post('unit_number')); $data['uri'] = $this->slug->create_uri($data_uri); if (!empty($_POST['features'])) { $data['features'] = implode($_POST['features'], '|'); } else { $data['features'] = ''; } $config['upload_path'] = $this->config->item('UNIT_IMAGE_PATH'); $config['allowed_types'] = 'gif|jpg|png'; $config['overwrite'] = FALSE; $this->load->library('upload', $config); $map_img = $_FILES['map_image']['name']; if ($map_img != '') { if ($_FILES['map_image']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['map_image']['tmp_name'])) { if (!$this->upload->do_upload('map_image')) { show_error($this->upload->display_errors('<p class="err">', '</p>')); return FALSE; } else { $upload_data = $this->upload->data(); $data['map_image'] = $upload_data['file_name']; } } } if (count($_FILES) > 0) { //e($_FILES); if ($_FILES['photo']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['photo']['tmp_name'])) { if (!$this->upload->do_upload('photo')) { show_error($this->upload->display_errors('<p class="err">', '</p>')); return FALSE; } else { $upload_data = $this->upload->data(); $data['unit_image'] = $upload_data['file_name']; } } } if ($this->aauth->isCompany()) { $data['company_id'] = curUsrId(); } elseif ($this->aauth->isUser()) { $data['company_id'] = curUsrPid(); } $status = $this->db->insert('units', $data); // echo $this->db->last_query(); if ($status) { $unit_id = $this->db->insert_id(); if ($unit_id) { $attributes = gParam('attributes') ? gParam('attributes') : array(); foreach ($attributes as $key => $value) { $data = array(); $data['unit_id'] = $unit_id; $data['attribute_id'] = $key; $data['value'] = $value; $this->db->insert('units_attributes_value', $data); } } } $unit_id = $this->db->insert_id(); $this->upload->initialize(array("upload_path" => $this->config->item('UNIT_IMAGE_PATH'), 'allowed_types' => 'gif|jpg|png')); if ($this->upload->do_multi_upload("galleryImages")) { //Print data for all uploaded files. foreach ($this->upload->get_multi_upload_data() as $images) { $this->db->insert('unit_image', array('image' => $images['file_name'], 'unit_id' => $unit_id)); } } }