function index() { $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Settings'); $form->value_row(' ', '<div style="float:left; width: 600px">Enter your Google Analytics site id (e.g., UA-1234567-1) to automatically begin sending site analytics information to your Google Analytics account.</div>'); $form->text('Site ID', 'analytics_id', $this->config->item('googleanalytics_id')); $data = array('form_title' => 'Google Analytics', 'form_action' => site_url('admincp/googleanalytics/post_configure'), 'form' => $form->display(), 'form_button' => 'Save Configuration'); $this->load->view('generic', $data); }
function index() { $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Settings'); $form->value_row(' ', '<div style="float:left; width: 600px">Enter your Recaptcha Keys (e.g., 6Ldr1gwTAAAAAPhx68fHH4xxxxxxxxxxxxxxxxxx). <br />Edit your form.thtml form to post to {url path="recaptcha/form/submit"} <br />Then enter {recaptcha} in the form template before the submit button to begin protecting your forms with ReCaptcha 2.</div>'); $form->text('Site Key', 'recaptcha_site_key', $this->config->item('recaptcha_site_key')); $form->text('Secret Key', 'recaptcha_secret_key', $this->config->item('recaptcha_secret_key')); $data = array('form_title' => 'Recaptcha Spam Protection', 'form_action' => site_url('admincp/recaptcha/post_configure'), 'form' => $form->display(), 'form_button' => 'Save Configuration'); $this->load->view('generic', $data); }
function display() { $CI =& get_instance(); $CI->load->library('Admin_form'); $form = new Admin_form(); $form->fieldset($this->label); $upload_now = $this->show_upload_button == TRUE ? ' <input type="submit" id="' . $this->name . '_upload" class="button" name="' . $this->name . '_upload" value="Upload Images Now" />' : ''; $form->value_row($this->label, '<div class="image_gallery_form" id="' . $this->name . '_box"> <div class="uploader"> <input type="file" name="' . $this->name . '_image[]" rel="1" /> <input type="button" id="' . $this->name . '_add" class="image_gallery_form button" name="' . $this->name . '_add" value="+ Add Image to Upload Queue" />' . $upload_now . ' </div> <div class="images"> <span id="no_images">No images have been selected for upload.</span> <ul> </ul> </div> </div>'); return $form->display(); }
function new_subscription($user_id = 0, $subscription_id = 0) { $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Subscription Details'); // we can't show a dropdown of all users if we have 5000+ members $result = $this->db->select('COUNT(user_id) AS `user_count`', FALSE)->from('users')->get()->row_array(); if ($result['user_count'] > 5000) { $members = $this->user_model->get_users(array('id' => $user_id)); } else { $members = $this->user_model->get_users(); } $options = array(); foreach ($members as $member) { $options[$member['id']] = $member['last_name'] . ', ' . $member['first_name'] . ' (' . $member['username'] . ')'; } $form->dropdown('Member', 'member', $options, $user_id); $this->load->model('subscription_plan_model'); $subscriptions = $this->subscription_plan_model->get_plans(); if (is_array($subscriptions)) { $options = array(); foreach ($subscriptions as $subscription) { $options[$subscription['id']] = $subscription['name'] . ' (' . setting('currency_symbol') . $subscription['amount'] . ' every ' . $subscription['interval'] . ' days)'; } $form->dropdown('Subscription', 'subscription', $options, $subscription_id); } else { $form->value_row('Subscription', 'You don\'t have any subscription plans created. <a href="' . site_url('admincp/billing/subscription_add') . '">Add a subscription plan</a>'); } $data = array('form' => $form->display(), 'form_title' => 'Create New Subscription (Step 1 of 2)', 'form_action' => site_url('admincp/billing/new_subscription_details')); $this->load->view('new_subscription.php', $data); }
function edit($product_id) { $this->load->helper('form'); // get product $this->load->model('products_model'); $product = $this->products_model->get_product($product_id); // first part of form is generated by Admin_form $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Basic Information'); $form->text('Product Name', 'name', $product['name'], 'e.g, "Adidas Cross Trainers", or "CRBO2010 Conference Tickets"', TRUE, FALSE, TRUE); $form->textarea('Description', 'description', $product['description'], 'This description will appear on the product page.', TRUE, 'basic', TRUE); $this->load->model('collections_model'); $collections = $this->collections_model->get_tiered_collections(); $options = array(); $options[0] = 'No collections'; foreach ($collections as $data) { $options[$data['id']] = $data['name']; } $form->dropdown('Collection(s)', 'collections[]', $options, is_array($product['collections']) ? $product['collections'] : array(), TRUE, FALSE, 'Select multiple collections by holding the CTRL or CMD button and selecting multiple options.', TRUE); $form->fieldset('Product Properties'); $form->text('Price (' . setting('currency_symbol') . ')', 'price', $product['price'], FALSE, TRUE, '9.95', FALSE, '60px', 'price'); $form->text('Weight (' . setting('weight_unit') . ')', 'weight', $product['weight'], FALSE, TRUE, '0', FALSE, '60px', 'weight'); $tax = form_checkbox('taxable', '1', $product['is_taxable'] == TRUE ? TRUE : FALSE); $form->value_row(' ', $tax . ' <b><a target="_blank" href="' . site_url('admincp/store/taxes') . '">Tax rules</a> apply to this product</b>'); $require_shipping = form_checkbox('requires_shipping', '1', $product['requires_shipping'] == TRUE ? TRUE : FALSE); $form->value_row(' ', $require_shipping . ' <b>Require a shipping address for this product</b> (not necessary for digital products or services)'); $form->fieldset('Inventory Management'); $form->text('SKU Number', 'sku', $product['sku'], '(Optional) Enter a unique identifier of the product for inventory management.', FALSE, FALSE, FALSE, '200px', 'sku'); $inventory = form_checkbox(array('name' => 'track_inventory', 'value' => '1', 'checked' => $product['track_inventory'] == FALSE ? FALSE : TRUE, 'id' => 'track_inventory')); $form->value_row(' ', $inventory . ' <b>Track inventory for this product?</b>'); $form->text('Quantity in Stock', 'inventory', $product['inventory'], FALSE, FALSE, FALSE, FALSE, '60px', 'inventory'); $options = array('0' => 'Don\'t sell at zero inventory', '1' => 'Sell at zero inventory'); $form->radio(' ', 'inventory_allow_oversell', $options, $product['track_inventory'] == TRUE ? $product['inventory_allow_oversell'] : '1', FALSE, FALSE, FALSE, 'inventory_allow_at_zero'); // custom fields if (setting('products_custom_field_group') != '') { $this->load->library('custom_fields/form_builder'); $this->form_builder->build_form_from_group(setting('products_custom_field_group')); $this->form_builder->set_values($product); $this->form_builder->clear_defaults(); $custom_fields = $this->form_builder->output_admin(); } else { $custom_fields = FALSE; } // load usergroups for membership tiers $this->load->model('users/usergroup_model'); $usergroups = $this->usergroup_model->get_usergroups(); $options = array(); $options[0] = ''; foreach ($usergroups as $group) { $options[$group['id']] = $group['name']; } $usergroups = $options; // get files from product_files $files = $this->map_product_files(); // get product options that might be re-used $this->load->model('store/product_option_model'); $shared_product_options = $this->product_option_model->get_options(array('shared' => '1')); // also, get all product options $product_options = $this->product_option_model->get_options(); $data = array('form' => $form->display(), 'form_action' => site_url('admincp/store/post_product/edit/' . $product['id']), 'form_title' => 'Edit Product', 'usergroups' => $usergroups, 'files' => $files, 'shared_product_options' => $shared_product_options, 'product_options' => $product_options, 'custom_fields' => $custom_fields, 'product' => $product); $this->load->view('product_edit.php', $data); }
function register_application() { $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Introduction'); $form->value_row(' ', '<div style="float:left; width: 600px">Before you connect your ' . setting('app_name') . ' installation to Twitter, you must register an application at Twitter. This sounds more complex than it really is: All you have to do is go and complete a form telling them about your website and you\'ll instantly receive a Consumer Key and a Consumer Secret that you will then enter below.<br /><br /> <b>Be sure to specify that your app is a BROWSER app and enter a Callback URL of "' . site_url() . '".</b></div>'); $form->value_row(' ', '<a href="http://dev.twitter.com/apps/new" target="_blank">Click here to register your application at Twitter</a>.'); $form->text('Consumer Key', 'consumer_key'); $form->text('Consumer Secret', 'consumer_secret'); $data = array('form_title' => 'Twitter: Register Your Application', 'form_action' => site_url('admincp/twitter/post_register_application'), 'form' => $form->display(), 'form_button' => 'Save Application Credentials'); $this->load->view('generic', $data); }