当前位置: 首页>>代码示例>>PHP>>正文


PHP CI::input方法代码示例

本文整理汇总了PHP中CI::input方法的典型用法代码示例。如果您正苦于以下问题:PHP CI::input方法的具体用法?PHP CI::input怎么用?PHP CI::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CI的用法示例。


在下文中一共展示了CI::input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: form

 public function form()
 {
     \CI::form_validation()->set_rules('to_email', 'lang:recipient_email', 'trim|required');
     \CI::form_validation()->set_rules('to_name', 'lang:recipient_name', 'trim|required');
     \CI::form_validation()->set_rules('from', 'lang:sender_name', 'trim|required');
     \CI::form_validation()->set_rules('personal_message', 'lang:personal_message', 'trim');
     \CI::form_validation()->set_rules('beginning_amount', 'lang:amount', 'trim|required|numeric');
     $data['page_title'] = lang('add_gift_card');
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('gift_card_form', $data);
     } else {
         $save['code'] = generate_code();
         // from the string helper
         $save['to_email'] = \CI::input()->post('to_email');
         $save['to_name'] = \CI::input()->post('to_name');
         $save['from'] = \CI::input()->post('from');
         $save['personal_message'] = \CI::input()->post('personal_message');
         $save['beginning_amount'] = \CI::input()->post('beginning_amount');
         \CI::GiftCards()->saveCard($save);
         if (\CI::input()->post('sendNotification')) {
             \GoCart\Emails::giftCardNotification($save);
         }
         \CI::session()->set_flashdata('message', lang('message_saved_gift_card'));
         redirect('admin/gift-cards');
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:26,代码来源:AdminGiftCards.php

示例2: login

 public function login()
 {
     $redirect = \CI::auth()->isLoggedIn(false, false);
     if ($redirect) {
         redirect('admin/dashboard');
     }
     \CI::load()->helper('form');
     $data['redirect'] = \CI::session()->flashdata('redirect');
     $submitted = \CI::input()->post('submitted');
     if ($submitted) {
         $username = \CI::input()->post('username');
         $password = \CI::input()->post('password');
         $remember = \CI::input()->post('remember');
         $redirect = \CI::input()->post('redirect');
         $login = \CI::auth()->login_admin($username, $password, $remember);
         if ($login) {
             if ($redirect == '') {
                 $redirect = 'admin/dashboard';
             }
             redirect($redirect);
         } else {
             //this adds the redirect back to flash data if they provide an incorrect credentials
             \CI::session()->set_flashdata('redirect', $redirect);
             \CI::session()->set_flashdata('error', lang('error_authentication_failed'));
             redirect('admin/login');
         }
     }
     $this->views->show('admin/header', $data);
     $this->views->show('admin/login', $data);
     $this->views->show('admin/footer', $data);
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:31,代码来源:AdminLogin.php

示例3: form

 public function form($direction = false, $id = false)
 {
     $data = array();
     if ($direction == 'coefficients') {
         $data = array('code' => \CI::input()->post('code'), 'value' => \CI::input()->post('value'), 'description' => \CI::input()->post('description'), 'group' => \CI::input()->post('group'));
     }
     if ($direction == 'constants') {
         $data = array('code' => \CI::input()->post('code'), 'value' => \CI::input()->post('value'), 'description' => \CI::input()->post('description'), 'group' => \CI::input()->post('group'));
     }
     if ($direction == 'febrifuge') {
         $data = array('kVA' => \CI::input()->post('kVA'), 'width' => \CI::input()->post('width'), 'height' => \CI::input()->post('height'), 'value_vtp' => \CI::input()->post('value_vtp'), 'note' => \CI::input()->post('note'));
     }
     if ($direction == 'basic') {
         $data = array('code' => \CI::input()->post('code'), 'description' => \CI::input()->post('description'), 'value' => \CI::input()->post('value'), 'condition' => \CI::input()->post('condition'), 'condition_value' => \CI::input()->post('condition_value'), 'unit' => \CI::input()->post('unit'), 'group' => \CI::input()->post('group'));
     }
     if ($direction == 'funnel') {
         $data = array('phi' => \CI::input()->post('phi'), 'value_mabi' => \CI::input()->post('value_mabi'), 'value_coha' => \CI::input()->post('value_coha'), 'value_vtp' => \CI::input()->post('value_vtp'), 'value_noch' => \CI::input()->post('value_noch'), 'value_onnh' => \CI::input()->post('value_onnh'), 'description' => \CI::input()->post('description'), 'group' => \CI::input()->post('group'), 'note' => \CI::input()->post('note'));
     }
     if ($direction == 'cable') {
         $data = array('kVA' => \CI::input()->post('kVA'), 'ampe' => \CI::input()->post('ampe'), 'section' => \CI::input()->post('section'), 'trademark' => \CI::input()->post('trademark'), 'symbol' => \CI::input()->post('symbol'), 'unit' => \CI::input()->post('unit'), 'value' => \CI::input()->post('value'), 'description' => \CI::input()->post('description'), 'note' => \CI::input()->post('note'));
     }
     if (!empty($_POST)) {
         if ($id) {
             \CI::db()->where('id', $id)->update($this->_db_table[$direction], $data);
             return;
         } else {
             \CI::db()->insert($this->_db_table[$direction], $data);
             redirect('admin/materials/' . $direction);
         }
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:31,代码来源:AdminMaterials.php

示例4: generateProducts

 public function generateProducts()
 {
     $limit = \CI::input()->post('limit');
     $offset = \CI::input()->post('col-md-offset-');
     $products = \CI::Products()->products(['rows' => $limit, 'page' => $offset]);
     $xml = $this->partial('product_xml', ['products' => $products], true);
     echo $xml;
     $file = fopen('sitemap.xml', 'a');
     fwrite($file, $xml);
     fclose($file);
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:11,代码来源:AdminSitemap.php

示例5: index

 public function index($code = false, $page = 0)
 {
     $pagination_base_url = site_url('search/' . $code);
     //how many products do we want to display per page?
     //this is configurable from the admin settings page.
     $per_page = config_item('products_per_page');
     \CI::load()->model('Search');
     //check to see if we have a search term
     if (!$code) {
         //if the term is in post, save it to the db and give me a reference
         $term = \CI::input()->post('term', true);
         if (empty($term)) {
             //if there is still no search term throw an error
             $data['error'] = lang('search_error');
             $this->view('search_error', $data);
             return;
         } else {
             $code = \CI::Search()->recordTerm($term);
             // no code? redirect so we can have the code in place for the sorting.
             // I know this isn't the best way...
             redirect('search/' . $code . '/' . $page);
         }
     } else {
         //if we have the md5 string, get the term
         $term = \CI::Search()->getTerm($code);
     }
     //fix for the category view page.
     $data['base_url'] = [];
     $sortArray = array('name/asc' => array('by' => 'name', 'sort' => 'ASC'), 'name/desc' => array('by' => 'name', 'sort' => 'DESC'), 'price/asc' => array('by' => 'price', 'sort' => 'ASC'), 'price/desc' => array('by' => 'price', 'sort' => 'DESC'));
     $sortBy = array('by' => false, 'sort' => false);
     if (isset($_GET['by'])) {
         if (isset($sortArray[$_GET['by']])) {
             $sortBy = $sortArray[$_GET['by']];
         }
     }
     if (empty($term)) {
         //if there is still no search term throw an error
         $this->view('search_error', $data);
         return;
     } else {
         $result = \CI::Products()->search_products($term, $per_page, $page, $sortBy['by'], $sortBy['sort']);
         $config['total_rows'] = $result['count'];
         \CI::load()->library('pagination');
         $config['base_url'] = $pagination_base_url;
         $config['uri_segment'] = 3;
         $config['per_page'] = $per_page;
         $config['num_links'] = 3;
         $config['total_rows'] = $result['count'];
         \CI::pagination()->initialize($config);
         $data['products'] = $result['products'];
         $data['category'] = (object) ['name' => str_replace('{term}', $term, lang('search_title'))];
         $this->view('categories/category', $data);
     }
 }
开发者ID:buzkall,项目名称:GoCart3,代码行数:54,代码来源:Search.php

示例6: form

 public function form()
 {
     //this same function processes the form
     \CI::load()->helper('form');
     \CI::load()->library('form_validation');
     \CI::form_validation()->set_rules('enabled', 'lang:enabled', 'trim|numeric');
     \CI::form_validation()->set_rules('rate', 'lang:rate', 'trim|floatval');
     if (\CI::form_validation()->run() == FALSE) {
         $settings = \CI::Settings()->get_settings('FlatRate');
         $this->view('flat_rate_form', $settings);
     } else {
         \CI::Settings()->save_settings('FlatRate', \CI::input()->post());
         redirect('admin/shipping');
     }
 }
开发者ID:thijmenvenus,项目名称:GoCart3,代码行数:15,代码来源:AdminFlatRate.php

示例7: form

 public function form($id = 0)
 {
     \CI::load()->helper('form_helper');
     \CI::load()->library('form_validation');
     \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>');
     $data = ['id' => '', 'filename' => '', 'max_downloads' => '', 'title' => '', 'size' => ''];
     if ($id) {
         $data = array_merge($data, (array) \CI::DigitalProducts()->getFileInfo($id));
     }
     $data['page_title'] = lang('digital_products_form');
     \CI::form_validation()->set_rules('max_downloads', 'lang:max_downloads', 'numeric');
     \CI::form_validation()->set_rules('title', 'lang:title', 'trim|required');
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('digital_product_form', $data);
     } else {
         if ($id == 0) {
             $data['file_name'] = false;
             $data['error'] = false;
             $config['allowed_types'] = '*';
             $config['upload_path'] = 'uploads/digital_products';
             //config_item('digital_products_path');
             $config['remove_spaces'] = true;
             \CI::load()->library('upload', $config);
             if (\CI::upload()->do_upload()) {
                 $upload_data = \CI::upload()->data();
             } else {
                 $data['error'] = \CI::upload()->display_errors();
                 $this->view('digital_product_form', $data);
                 return;
             }
             $save['filename'] = $upload_data['file_name'];
             $save['size'] = $upload_data['file_size'];
         } else {
             $save['id'] = $id;
         }
         $save['max_downloads'] = \CI::input()->post('max_downloads');
         $save['title'] = \CI::input()->post('title');
         \CI::DigitalProducts()->save($save);
         redirect('admin/digital_products');
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:41,代码来源:AdminDigitalProducts.php

示例8: forgotPassword

 public function forgotPassword()
 {
     $data['page_title'] = lang('forgot_password');
     $submitted = \CI::input()->post('submitted');
     \CI::form_validation()->set_rules('email', 'lang:address_email', ['trim', 'required', 'valid_email', ['email_callable', function ($str) {
         $reset = \CI::Customers()->reset_password($str);
         if (!$reset) {
             \CI::form_validation()->set_message('email_callable', lang('error_no_account_record'));
             return FALSE;
         } else {
             //user does exist. and the password is reset.
             return TRUE;
         }
     }]]);
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('forgot_password', $data);
     } else {
         \CI::session()->set_flashdata('message', lang('message_new_password'));
         redirect('login');
     }
 }
开发者ID:haouach,项目名称:GoCart3,代码行数:21,代码来源:Login.php

示例9: submitGiftCard

 public function submitGiftCard()
 {
     //get the giftcards from the database
     $giftCard = \CI::GiftCards()->getGiftCard(\CI::input()->post('gift_card'));
     if (!$giftCard) {
         echo json_encode(['error' => lang('gift_card_not_exist')]);
     } else {
         //does the giftcard have any value left?
         if (\CI::GiftCards()->isValid($giftCard)) {
             $message = \GC::addGiftCard($giftCard);
             if ($message['success']) {
                 \GC::saveCart();
                 echo json_encode(['message' => lang('gift_card_balance_applied')]);
             } else {
                 echo json_encode($message);
             }
         } else {
             echo json_encode(['error' => lang('gift_card_zero_balance')]);
         }
     }
 }
开发者ID:alextoshinov,项目名称:musymeshop,代码行数:21,代码来源:Cart.php

示例10: index

 public function index()
 {
     $redirect = \CI::Login()->isLoggedIn(false, false);
     //if they are logged in, we send them back to the my_account by default
     if ($redirect) {
         redirect('my-account');
     }
     \CI::load()->library('form_validation');
     //default values are empty if the customer is new
     $data = ['company' => '', 'firstname' => '', 'lastname' => '', 'email' => '', 'phone' => '', 'address1' => '', 'address2' => '', 'city' => '', 'state' => '', 'zip' => '', 'redirect' => \CI::session()->flashdata('redirect')];
     \CI::form_validation()->set_rules('company', 'lang:address_company', 'trim|max_length[128]');
     \CI::form_validation()->set_rules('firstname', 'lang:address_firstname', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('lastname', 'lang:address_lastname', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('email', 'lang:address_email', ['trim', 'required', 'valid_email', 'max_length[128]', ['check_email_callable', function ($str) {
         return $this->check_email($str);
     }]]);
     \CI::form_validation()->set_rules('phone', 'lang:address_phone', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('email_subscribe', 'lang:account_newsletter_subscribe', 'trim|numeric|max_length[1]');
     \CI::form_validation()->set_rules('password', 'Password', 'required|min_length[6]');
     \CI::form_validation()->set_rules('confirm', 'Confirm Password', 'required|matches[password]');
     if (\CI::form_validation()->run() == FALSE) {
         //if they have submitted the form already and it has returned with errors, reset the redirect
         if (\CI::input()->post('submitted')) {
             $data['redirect'] = \CI::input()->post('redirect');
         }
         // load other page content
         //\CI::load()->model('banner_model');
         \CI::load()->helper('directory');
         $this->view('register', $data);
     } else {
         $save['id'] = false;
         $save['firstname'] = \CI::input()->post('firstname');
         $save['lastname'] = \CI::input()->post('lastname');
         $save['email'] = \CI::input()->post('email');
         $save['phone'] = \CI::input()->post('phone');
         $save['company'] = \CI::input()->post('company');
         $save['active'] = config_item('new_customer_status');
         $save['email_subscribe'] = intval((bool) \CI::input()->post('email_subscribe'));
         $save['password'] = \CI::input()->post('password');
         $redirect = \CI::input()->post('redirect');
         //if we don't have a value for redirect
         if ($redirect == '') {
             $redirect = 'my-account';
         }
         // save the customer info and get their new id
         $id = \CI::Customers()->save($save);
         /* send an email */
         // get the email template
         $row = \CI::db()->where('id', '6')->get('canned_messages')->row_array();
         // set replacement values for subject & body
         // {customer_name}
         $row['subject'] = str_replace('{customer_name}', \CI::input()->post('firstname') . ' ' . \CI::input()->post('lastname'), $row['subject']);
         $row['content'] = str_replace('{customer_name}', \CI::input()->post('firstname') . ' ' . \CI::input()->post('lastname'), $row['content']);
         // {url}
         $row['subject'] = str_replace('{url}', config_item('base_url'), $row['subject']);
         $row['content'] = str_replace('{url}', config_item('base_url'), $row['content']);
         // {site_name}
         $row['subject'] = str_replace('{site_name}', config_item('company_name'), $row['subject']);
         $row['content'] = str_replace('{site_name}', config_item('company_name'), $row['content']);
         \CI::load()->library('email');
         $config['mailtype'] = 'html';
         \CI::email()->initialize($config);
         \CI::email()->from(config_item('email'), config_item('company_name'));
         \CI::email()->to($save['email']);
         \CI::email()->bcc(config_item('email'));
         \CI::email()->subject($row['subject']);
         \CI::email()->message(html_entity_decode($row['content']));
         \CI::email()->send();
         \CI::session()->set_flashdata('message', sprintf(lang('registration_thanks'), \CI::input()->post('firstname')));
         //lets automatically log them in
         \CI::Login()->loginCustomer($save['email'], \CI::input()->post('confirm'));
         //we're just going to make this secure regardless, because we don't know if they are
         //wanting to redirect to an insecure location, if it needs to be secured then we can use the secure redirect in the controller
         //to redirect them, if there is no redirect, the it should redirect to the homepage.
         redirect($redirect);
     }
 }
开发者ID:haouach,项目名称:GoCart3,代码行数:77,代码来源:Register.php

示例11: zone_area_form

 public function zone_area_form($zone_id, $area_id = false)
 {
     \CI::load()->helper('form');
     \CI::load()->library('form_validation');
     \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>');
     $zone = \CI::Locations()->get_zone($zone_id);
     $data['zone'] = $zone;
     //default values are empty if the product is new
     $data['id'] = '';
     $data['code'] = '';
     $data['zone_id'] = $zone_id;
     $data['tax'] = 0;
     if ($area_id) {
         $area = (array) \CI::Locations()->get_zone_area($area_id);
         //if the country does not exist, redirect them to the country list with an error
         if (!$area) {
             \CI::session()->set_flashdata('error', lang('error_zone_area_not_found'));
             redirect('admin/locations/zone_areas/' . $zone_id);
         }
         $data = array_merge($data, $area);
     }
     \CI::form_validation()->set_rules('code', 'lang:code', 'trim|required');
     \CI::form_validation()->set_rules('tax', 'lang:tax', 'trim|numeric');
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('country_zone_area_form', $data);
     } else {
         $save['id'] = $area_id;
         $save['zone_id'] = $zone_id;
         $save['code'] = \CI::input()->post('code');
         $save['tax'] = \CI::input()->post('tax');
         \CI::Locations()->save_zone_area($save);
         \CI::session()->set_flashdata('message', lang('message_saved_zone_area'));
         //go back to the product list
         redirect('admin/locations/zone_areas/' . $save['zone_id']);
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:36,代码来源:AdminLocations.php

示例12: index

 public function index($offset = 0)
 {
     //make sure they're logged in
     \CI::Login()->isLoggedIn('my-account');
     $data['customer'] = (array) \CI::Customers()->get_customer($this->customer->id);
     $data['addresses'] = \CI::Customers()->get_address_list($this->customer->id);
     $data['customer_addresses'] = \CI::Customers()->get_address_list($this->customer->id);
     // load other page content
     //\CI::load()->model('banner_model');
     \CI::load()->helper('directory');
     \CI::load()->helper('date');
     // paginate the orders
     \CI::load()->library('pagination');
     $config['base_url'] = site_url('my_account');
     $config['total_rows'] = \CI::Orders()->countCustomerOrders($this->customer->id);
     $config['per_page'] = '15';
     $config['first_link'] = 'First';
     $config['first_tag_open'] = '<li>';
     $config['first_tag_close'] = '</li>';
     $config['last_link'] = 'Last';
     $config['last_tag_open'] = '<li>';
     $config['last_tag_close'] = '</li>';
     $config['full_tag_open'] = '<div class="pagination"><ul>';
     $config['full_tag_close'] = '</ul></div>';
     $config['cur_tag_open'] = '<li class="active"><a href="#">';
     $config['cur_tag_close'] = '</a></li>';
     $config['num_tag_open'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['prev_link'] = '&laquo;';
     $config['prev_tag_open'] = '<li>';
     $config['prev_tag_close'] = '</li>';
     $config['next_link'] = '&raquo;';
     $config['next_tag_open'] = '<li>';
     $config['next_tag_close'] = '</li>';
     \CI::pagination()->initialize($config);
     $data['orders_pagination'] = \CI::pagination()->create_links();
     $data['orders'] = \CI::Orders()->getCustomerOrders($this->customer->id, $offset);
     //print_r($offset);
     \CI::load()->library('form_validation');
     //        \CI::form_validation()->set_rules('company', 'lang:address_company', 'trim|max_length[128]');
     \CI::form_validation()->set_rules('firstname', 'lang:address_firstname', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('lastname', 'lang:address_lastname', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('email', 'lang:address_email', ['trim', 'required', 'valid_email', 'max_length[128]', ['check_email_callable', function ($str) {
         return $this->check_email($str);
     }]]);
     \CI::form_validation()->set_rules('phone', 'lang:address_phone', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('email_subscribe', 'lang:account_newsletter_subscribe', 'trim|numeric|max_length[1]');
     if (\CI::input()->post('password') != '' || \CI::input()->post('confirm') != '') {
         \CI::form_validation()->set_rules('password', 'Password', 'required|min_length[6]|sha1');
         \CI::form_validation()->set_rules('confirm', 'Confirm Password', 'required|matches[password]');
     } else {
         \CI::form_validation()->set_rules('password', 'Password');
         \CI::form_validation()->set_rules('confirm', 'Confirm Password');
     }
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('my_account', $data);
     } else {
         $customer = [];
         $customer['id'] = $this->customer->id;
         //            $customer['company'] = \CI::input()->post('company');
         $customer['firstname'] = \CI::input()->post('firstname');
         $customer['lastname'] = \CI::input()->post('lastname');
         $customer['email'] = \CI::input()->post('email');
         $customer['phone'] = \CI::input()->post('phone');
         $customer['email_subscribe'] = intval((bool) \CI::input()->post('email_subscribe'));
         if (\CI::input()->post('password') != '') {
             $customer['password'] = \CI::input()->post('password');
         }
         \GC::save_customer($this->customer);
         \CI::Customers()->save($customer);
         \CI::session()->set_flashdata('message', lang('message_account_updated'));
         redirect('my-account');
     }
 }
开发者ID:alextoshinov,项目名称:musymeshop,代码行数:74,代码来源:MyAccount.php

示例13: form

 public function form($id = false)
 {
     \CI::load()->helper(array('form', 'date'));
     \CI::load()->library('form_validation');
     \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>');
     $this->coupon_id = $id;
     $data['page_title'] = lang('coupon_form');
     //default values are empty if the product is new
     $data['id'] = '';
     $data['code'] = '';
     $data['start_date'] = '';
     $data['whole_order_coupon'] = 0;
     $data['max_product_instances'] = '';
     $data['end_date'] = '';
     $data['max_uses'] = '';
     $data['reduction_type'] = '';
     $data['reduction_amount'] = '';
     $data['products'] = [];
     if ($id) {
         $coupon = \CI::Coupons()->getCoupon($id);
         //if the product does not exist, redirect them to the product list with an error
         if (!$coupon) {
             \CI::session()->set_flashdata('message', lang('error_not_found'));
             redirect('admin/product');
         }
         //set values to db values
         $data['id'] = $coupon->id;
         $data['code'] = $coupon->code;
         $data['start_date'] = $coupon->start_date;
         $data['end_date'] = $coupon->end_date;
         $data['whole_order_coupon'] = $coupon->whole_order_coupon;
         $data['max_product_instances'] = $coupon->max_product_instances;
         $data['num_uses'] = $coupon->num_uses;
         $data['max_uses'] = $coupon->max_uses;
         $data['reduction_type'] = $coupon->reduction_type;
         $data['reduction_amount'] = $coupon->reduction_amount;
         $data['products'] = \CI::Coupons()->getProducts($id);
     }
     \CI::form_validation()->set_rules('code', 'lang:code', ['trim', 'required', ['code_callable', function ($str) {
         $code = \CI::Coupons()->checkCode($str, $this->coupon_id);
         if ($code) {
             \CI::form_validation()->set_message('code_callable', lang('error_already_used'));
             return FALSE;
         } else {
             return TRUE;
         }
     }]]);
     \CI::form_validation()->set_rules('max_uses', 'lang:max_uses', 'trim|numeric');
     \CI::form_validation()->set_rules('max_product_instances', 'lang:limit_per_order', 'trim|numeric');
     \CI::form_validation()->set_rules('whole_order_coupon', 'lang:whole_order_discount');
     \CI::form_validation()->set_rules('reduction_type', 'lang:reduction_type', 'trim');
     \CI::form_validation()->set_rules('reduction_amount', 'lang:reduction_amount', 'trim|numeric');
     \CI::form_validation()->set_rules('start_date', 'lang:start_date');
     \CI::form_validation()->set_rules('end_date', 'lang:end_date');
     if (\CI::form_validation()->run() == FALSE) {
         if (\CI::input()->post()) {
             $data['products'] = json_decode(json_encode(\CI::input()->post('product')));
         }
         $this->view('coupon_form', $data);
     } else {
         $save['id'] = $id;
         $save['code'] = \CI::input()->post('code');
         $save['start_date'] = \CI::input()->post('start_date');
         $save['end_date'] = \CI::input()->post('end_date');
         $save['max_uses'] = \CI::input()->post('max_uses');
         $save['whole_order_coupon'] = \CI::input()->post('whole_order_coupon');
         $save['max_product_instances'] = \CI::input()->post('max_product_instances');
         $save['reduction_type'] = \CI::input()->post('reduction_type');
         $save['reduction_amount'] = \CI::input()->post('reduction_amount');
         if ($save['start_date'] == '') {
             $save['start_date'] = null;
         }
         if ($save['end_date'] == '') {
             $save['end_date'] = null;
         }
         $products = \CI::input()->post('product');
         // save coupon
         $id = \CI::Coupons()->save($save);
         \CI::Coupons()->removeProduct($id);
         if (!$save['whole_order_coupon'] && $products) {
             \CI::Coupons()->addProducts($id, $products);
         }
         // We're done
         \CI::session()->set_flashdata('message', lang('message_saved_coupon'));
         //go back to the product list
         redirect('admin/coupons');
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:88,代码来源:AdminCoupons.php

示例14:

<?php

include 'header.php';
?>

<script type="text/javascript">

<?php 
if (CI::input()->post('submit')) {
    ?>
$(window).ready(function(){
    $('#iframe_uploader', window.parent.document).height($('body').height());
});
<?php 
}
?>

<?php 
if ($file_name) {
    ?>
    var filename = '<?php 
    echo $file_name;
    ?>
';
    var uploaded = filename.split('.');
    parent.addProductImage(uploaded[0], filename, '', '', '');
<?php 
}
?>

</script>
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:31,代码来源:product_image_uploader.php

示例15: giftCardForm

 public function giftCardForm($id = false, $duplicate = false)
 {
     $this->product_id = $id;
     \CI::load()->library('form_validation');
     \CI::load()->model(array('ProductOptions', 'Categories'));
     \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>');
     $data['categories'] = \CI::Categories()->get_categories_tiered();
     $data['page_title'] = lang('giftcard_product_form');
     $data['groups'] = \CI::Customers()->get_groups();
     //default values are empty if the product is new
     $data['id'] = '';
     $data['sku'] = '';
     $data['primary_category'] = '';
     $data['name'] = '';
     $data['slug'] = '';
     $data['description'] = '';
     $data['excerpt'] = '';
     $data['track_stock'] = '';
     $data['seo_title'] = '';
     $data['meta'] = '';
     $data['is_giftcard'] = 1;
     $data['taxable'] = '';
     $data['images'] = [];
     $data['product_categories'] = [];
     $data['product_files'] = [];
     foreach ($data['groups'] as $group) {
         $data['enabled_' . $group->id] = '';
     }
     //create the photos array for later use
     $data['photos'] = [];
     if ($id) {
         // get product & options data
         $data['ProductOptions'] = \CI::ProductOptions()->getProductOptions($id);
         $product = \CI::Products()->find($id, true);
         //if the product does not exist, redirect them to the product list with an error
         if (!$product) {
             \CI::session()->set_flashdata('error', lang('error_not_found'));
             redirect('admin/products');
         }
         //helps us with the slug generation
         $this->product_name = \CI::input()->post('slug', $product->slug);
         //set values to db values
         $data['id'] = $id;
         $data['sku'] = $product->sku;
         $data['primary_category'] = $product->primary_category;
         $data['name'] = $product->name;
         $data['seo_title'] = $product->seo_title;
         $data['meta'] = $product->meta;
         $data['slug'] = $product->slug;
         $data['description'] = $product->description;
         $data['excerpt'] = $product->excerpt;
         $data['quantity'] = $product->quantity;
         $data['taxable'] = $product->taxable;
         $data['fixed_quantity'] = $product->fixed_quantity;
         $data['is_giftcard'] = $product->is_giftcard;
         foreach ($data['groups'] as $group) {
             $data['enabled_' . $group->id] = $product->{'enabled_' . $group->id};
         }
         //make sure we haven't submitted the form yet before we pull in the images/related products from the database
         if (!\CI::input()->post('submit')) {
             $data['product_categories'] = [];
             foreach ($product->categories as $product_category) {
                 $data['product_categories'][] = $product_category->id;
             }
             $data['related_products'] = $product->related_products;
             $data['images'] = (array) json_decode($product->images);
         }
     }
     if (!is_array($data['product_categories'])) {
         $data['product_categories'] = [];
     }
     //no error checking on these
     \CI::form_validation()->set_rules('caption', 'Caption');
     \CI::form_validation()->set_rules('primary_photo', 'Primary');
     \CI::form_validation()->set_rules('sku', 'lang:sku', 'trim');
     \CI::form_validation()->set_rules('seo_title', 'lang:seo_title', 'trim');
     \CI::form_validation()->set_rules('meta', 'lang:meta_data', 'trim');
     \CI::form_validation()->set_rules('name', 'lang:name', 'trim|required|max_length[64]');
     \CI::form_validation()->set_rules('slug', 'lang:slug', 'trim');
     \CI::form_validation()->set_rules('description', 'lang:description', 'trim');
     \CI::form_validation()->set_rules('excerpt', 'lang:excerpt', 'trim');
     \CI::form_validation()->set_rules('taxable', 'lang:taxable', 'trim|numeric');
     \CI::form_validation()->set_rules('fixed_quantity', 'lang:fixed_quantity', 'trim|numeric');
     \CI::form_validation()->set_rules('option[giftcard_values]', 'lang:giftcard_values', 'required');
     foreach ($data['groups'] as $group) {
         \CI::form_validation()->set_rules('enabled_' . $group->id, lang('enabled') . '(' . $group->name . ')', 'trim|numeric');
     }
     /*
     if we've posted already, get the photo stuff and organize it
     if validation comes back negative, we feed this info back into the system
     if it comes back good, then we send it with the save item
     
     submit button has a value, so we can see when it's posted
     */
     if ($duplicate) {
         $data['id'] = false;
     }
     if (\CI::input()->post('submit')) {
         //reset the product options that were submitted in the post
         $data['ProductOptions'] = \CI::input()->post('option');
//.........这里部分代码省略.........
开发者ID:vandona,项目名称:v3,代码行数:101,代码来源:AdminProducts.php


注:本文中的CI::input方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。