function company_form($id = false) { $data['activemenu'] = $this->activemenu; $data['id'] = $id; $data['user_id'] = ''; $data['email'] = ''; $data['company_name'] = ''; $data['fax'] = ''; $data['phone'] = ''; $data['address'] = ''; $data['gps'] = ''; $data['company_details'] = ''; $data['website'] = ''; $data['logo'] = ''; $data['gst'] = ''; $data['ssm'] = ''; $data['active'] = ''; $data['page_title'] = lang('company_form'); if ($id) { $company = $this->Company_model->get_company_by_id($id); //fully escape the address form_decode($company); //merge the array $data = array_merge($data, $company); } $this->load->library('form_validation'); $this->form_validation->set_rules('company_name', 'lang:firstname', 'trim|required|max_length[255]'); $this->form_validation->set_rules('phone', 'lang:phone', 'trim|required|max_length[32]'); $this->form_validation->set_rules('address', 'lang:address', 'trim|required|max_length[255]'); $this->form_validation->set_rules('gps', 'lang:gps', 'trim|required|max_length[255]'); $this->form_validation->set_rules('email', 'lang:email', 'trim|valid_email|max_length[255]'); $this->form_validation->set_rules('fax', 'lang:fax', 'trim'); $this->form_validation->set_rules('company_details', 'lang:company_details', 'trim'); $this->form_validation->set_rules('website', 'lang:website', 'trim'); $this->form_validation->set_rules('logo', 'lang:logo', 'trim'); $this->form_validation->set_rules('gst', 'lang:gst', 'trim'); $this->form_validation->set_rules('ssm', 'lang:ssm', 'trim'); $this->form_validation->set_rules('active', 'lang:active', 'trim'); if ($this->form_validation->run() == FALSE) { $this->view($this->config->item('admin_folder') . '/company_form', $data); } else { $a['user_id'] = 0; $a['id'] = empty($id) ? '' : $id; $a['email'] = $this->input->post('email'); $a['company_name'] = $this->input->post('company_name'); $a['fax'] = $this->input->post('fax'); $a['phone'] = $this->input->post('phone'); $a['address'] = $this->input->post('address'); $a['gps'] = $this->input->post('gps'); $a['company_details'] = $this->input->post('company_details'); $a['website'] = $this->input->post('website'); $a['logo'] = $this->input->post('logo'); $a['gst'] = $this->input->post('gst'); $a['ssm'] = $this->input->post('ssm'); $a['active'] = 1; $this->Company_model->save_company($a); $this->session->set_flashdata('message', lang('message_saved_company')); redirect($this->config->item('admin_folder') . '/company/'); } }
function branch_form($id = false) { $data['activemenu'] = $this->activemenu; $data['id'] = $id; $data['name'] = ''; $data['active'] = ''; $data['page_title'] = lang('branch_form'); if ($id) { $branch = $this->Branch_model->get_branch_by_id($id); //fully escape the address form_decode($branch); //merge the array $data = array_merge($data, $branch); } $this->load->library('form_validation'); $this->form_validation->set_rules('name', 'lang:name', 'trim|required|max_length[255]'); $this->form_validation->set_rules('address', 'lang:address', 'trim'); $this->form_validation->set_rules('phone', 'lang:phone', 'trim'); $this->form_validation->set_rules('active', 'lang:active', 'trim'); if ($this->form_validation->run() == FALSE) { $this->view($this->config->item('admin_folder') . '/branch_form', $data); } else { $a['id'] = empty($id) ? '' : $id; $a['name'] = $this->input->post('name'); $a['address'] = $this->input->post('address'); $a['phone'] = $this->input->post('phone'); $a['active'] = 1; $this->Branch_model->save_branch($a); $this->session->set_flashdata('message', lang('message_saved_branch')); redirect($this->config->item('admin_folder') . '/branch/'); } }
function form_decode(&$x) { //loop through objects or arrays if (is_array($x) || is_object($x)) { foreach ($x as &$y) { $y = form_decode($y); } } if (is_string($x)) { $x = full_decode($x); } return $x; }
</tr> </thead> <tbody> <?php echo count($products) < 1 ? '<tr><td style="text-align:center;" colspan="7">' . lang('no_products') . '</td></tr>' : ''; ?> <?php foreach ($products as $product) { ?> <tr> <td><?php echo form_input(array('name' => 'product[' . $product->id . '][sku]', 'value' => form_decode($product->sku), 'class' => 'span1')); ?> </td> <td><?php echo form_input(array('name' => 'product[' . $product->id . '][name]', 'value' => form_decode($product->name), 'class' => 'span2')); ?> </td> <td><?php echo form_input(array('name' => 'product[' . $product->id . '][price]', 'value' => set_value('price', $product->price), 'class' => 'span1')); ?> </td> <td><?php echo form_input(array('name' => 'product[' . $product->id . '][saleprice]', 'value' => set_value('saleprice', $product->saleprice), 'class' => 'span1')); ?> </td> <td><?php echo (bool) $product->track_stock ? form_input(array('name' => 'product[' . $product->id . '][quantity]', 'value' => set_value('quantity', $product->quantity), 'class' => 'span1')) : 'N/A'; ?> </td> <td>
function address_form($customer_id, $id = false) { $data['id'] = $id; $data['company'] = ''; $data['firstname'] = ''; $data['lastname'] = ''; $data['email'] = ''; $data['phone'] = ''; $data['address1'] = ''; $data['address2'] = ''; $data['city'] = ''; $data['country_id'] = ''; $data['zone_id'] = ''; $data['zip'] = ''; $data['customer_id'] = $customer_id; $data['page_title'] = lang('address_form'); //get the countries list for the dropdown $data['countries_menu'] = $this->Location_model->get_countries_menu(); if ($id) { $address = $this->Customer_model->get_address($id); //fully escape the address form_decode($address); //merge the array $data = array_merge($data, $address); $data['zones_menu'] = $this->Location_model->get_zones_menu($data['country_id']); } else { //if there is no set ID, the get the zones of the first country in the countries menu $data['zones_menu'] = $this->Location_model->get_zones_menu(array_shift(array_keys($data['countries_menu']))); } $this->load->library('form_validation'); $this->form_validation->set_rules('company', 'lang:company', 'trim|max_length[128]'); $this->form_validation->set_rules('firstname', 'lang:firstname', 'trim|required|max_length[32]'); $this->form_validation->set_rules('lastname', 'lang:lastname', 'trim|required|max_length[32]'); $this->form_validation->set_rules('email', 'lang:email', 'trim|required|valid_email|max_length[128]'); $this->form_validation->set_rules('phone', 'lang:phone', 'trim|required|max_length[32]'); $this->form_validation->set_rules('address1', 'lang:address', 'trim|required|max_length[128]'); $this->form_validation->set_rules('address2', 'lang:address', 'trim|max_length[128]'); $this->form_validation->set_rules('city', 'lang:city', 'trim|required'); $this->form_validation->set_rules('country_id', 'lang:country', 'trim|required'); $this->form_validation->set_rules('zone_id', 'lang:state', 'trim|required'); $this->form_validation->set_rules('zip', 'lang:postcode', 'trim|required|max_length[32]'); if ($this->form_validation->run() == FALSE) { $this->load->view($this->config->item('admin_folder') . '/customer_address_form', $data); } else { $a['customer_id'] = $customer_id; // this is needed for new records $a['id'] = empty($id) ? '' : $id; $a['field_data']['company'] = $this->input->post('company'); $a['field_data']['firstname'] = $this->input->post('firstname'); $a['field_data']['lastname'] = $this->input->post('lastname'); $a['field_data']['email'] = $this->input->post('email'); $a['field_data']['phone'] = $this->input->post('phone'); $a['field_data']['address1'] = $this->input->post('address1'); $a['field_data']['address2'] = $this->input->post('address2'); $a['field_data']['city'] = $this->input->post('city'); $a['field_data']['zip'] = $this->input->post('zip'); $a['field_data']['zone_id'] = $this->input->post('zone_id'); $a['field_data']['country_id'] = $this->input->post('country_id'); $country = $this->Location_model->get_country($this->input->post('country_id')); $zone = $this->Location_model->get_zone($this->input->post('zone_id')); $a['field_data']['zone'] = $zone->code; // save the state for output formatted addresses $a['field_data']['country'] = $country->name; // some shipping libraries require country name $a['field_data']['country_code'] = $country->iso_code_2; // some shipping libraries require the code $this->Customer_model->save_address($a); $this->session->set_flashdata('message', lang('message_saved_address')); redirect($this->config->item('admin_folder') . '/customers/addresses/' . $customer_id); } }
?> </td> <td><?php echo form_decode($she->start_time); ?> </td> <td><?php echo form_decode($she->finish_time); ?> </td> <td><?php echo form_decode($she->price); ?> </td> <td><?php echo form_decode($she->saleprice); ?> </td> <td><a class="btn btn-danger" onclick="delete_schedule_admin(<?php echo $she->id; ?> );"><i class="icon-trash icon-white"></i> <?php echo lang('delete'); ?> </a></td> </tr> <?php } ?> </tbody> </table>
?> "> <td><?php echo form_decode($pkg->type_package) . " Months"; ?> </td> <td><?php echo form_decode($pkg->weekly_session); ?> </td> <td><?php echo form_decode($pkg->price); ?> </td> <td><?php echo form_decode($pkg->description1); ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div>
</tr> </thead> <tbody> <?php echo count($courses) < 1 ? '<tr><td style="text-align:center;" colspan="7">' . lang('no_courses') . '</td></tr>' : ''; ?> <?php foreach ($courses as $course) { ?> <tr> <td><?php echo form_input(array('name' => 'course[' . $course->id . '][name]', 'value' => form_decode($course->name), 'class' => 'span2')); ?> </td> <td><?php echo form_input(array('name' => 'course[' . $course->id . '][trainer]', 'value' => form_decode($course->id_trainner), 'class' => 'span2')); ?> </td> <td> <?php $options = array('1' => lang('enabled'), '0' => lang('disabled')); echo form_dropdown('course[' . $course->id . '][enabled]', $options, set_value('enabled', $course->enabled), 'class="span2"'); ?> </td> <td> <span class="btn-group pull-right"> <a class="btn" href="<?php echo site_url($this->config->item('admin_folder') . '/courses/form/' . $course->id); ?> "><i class="icon-pencil"></i> <?php echo lang('edit');