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 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 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); }
private function build_coupon_form($coupon = array(), $id = 0) { $this->load->model('store/shipping_model'); $this->load->model('store/products_model'); $this->load->model('billing/subscription_plan_model'); // Get the required options $coupon_products = isset($coupon['products']) ? $coupon['products'] : array(); $coupon_plans = isset($coupon['plans']) ? $coupon['plans'] : array(); $coupon_shipping = isset($coupon['shipping']) ? $coupon['shipping'] : array(); $coupon_types = $this->coupon_model->get_coupon_types(); foreach ($coupon_types as $type) { $type_options[$type->coupon_type_id] = $type->coupon_type_name; } $reduction_options = array(0 => '%', 1 => setting('currency_symbol')); $products = $this->products_model->get_products(); $product_options = array(); $product_options['-1'] = 'not available for any products'; if (is_array($products)) { foreach ($products as $product) { $product_options[$product['id']] = $product['name']; } } $plans = $this->subscription_plan_model->get_plans(); $plan_options = array(); $plan_options['-1'] = 'not available for any subscriptions'; if (is_array($plans)) { foreach ($plans as $plan) { $plan_options[$plan['id']] = $plan['name']; } } $shipping = $this->shipping_model->get_rates(); $shipping_options = array(); if (is_array($shipping)) { foreach ($shipping as $rate) { $shipping_options[$rate['id']] = $rate['name']; } } // Build the form $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Coupon Information'); $form->hidden('coupon_id', $id); $form->text('Coupon Name', 'coupon_name', isset($coupon['coupon_name']) ? $coupon['coupon_name'] : null, 'Something for you to recognize the coupon by.', TRUE); $form->text('Coupon Code', 'coupon_code', isset($coupon['coupon_code']) ? $coupon['coupon_code'] : null, 'The code the customer must enter.', TRUE); $form->date('Start Date', 'coupon_start_date', isset($coupon['coupon_start_date']) ? $coupon['coupon_start_date'] : null, null, TRUE, FALSE, FALSE, '8em'); $form->date('Expiry Date', 'coupon_end_date', isset($coupon['coupon_end_date']) ? $coupon['coupon_end_date'] : null, null, TRUE, FALSE, FALSE, '8em'); $form->text('Maximum Uses', 'coupon_max_uses', (isset($coupon['coupon_max_uses']) and !empty($coupon['coupon_max_uses'])) ? $coupon['coupon_max_uses'] : null, 'The maximum number of customers that can use the coupon.', FALSE, FALSE, FALSE, '6em'); $form->checkbox('One Per Customer?', 'coupon_customer_limit', '1', isset($coupon['coupon_customer_limit']) && $coupon['coupon_customer_limit'] == 1 ? TRUE : FALSE, 'Check to limit each customer to a single use.'); $form->dropdown('Coupon Type', 'coupon_type_id', $type_options, isset($coupon['coupon_type_id']) ? $coupon['coupon_type_id'] : FALSE, FALSE, FALSE, FALSE, FALSE, 'coupon_type'); $form->fieldset('Price Reduction', array('coupon_reduction')); $form->dropdown('Reduction Type', 'coupon_reduction_type', $reduction_options, isset($coupon['coupon_reduction_type']) ? $coupon['coupon_reduction_type'] : FALSE); $form->text('Reduction Amount', 'coupon_reduction_amt', isset($coupon['coupon_reduction_amt']) ? $coupon['coupon_reduction_amt'] : null, 'The amount of the discount.', FALSE, FALSE, FALSE, '6em'); $form->dropdown('Products', 'products[]', $product_options, $coupon_products, TRUE, FALSE, 'Leave all unselected to make available for all products.'); $form->dropdown('Subscription Plans', 'plans[]', $plan_options, $coupon_plans, TRUE, FALSE, 'Leave all unselected to make available for all subscriptions.'); $form->fieldset('Free Trial', array('coupon_trial')); $form->text('Free Trial Length', 'coupon_trial_length', isset($coupon['coupon_trial_length']) ? $coupon['coupon_trial_length'] : null, null, FALSE, 'in days', FALSE, '6em'); $form->dropdown('Subscription Plans', 'trial_subs[]', $plan_options, $coupon_plans, TRUE, 'If left blank, will select ALL SUBSCRIPTION PLANS'); $form->fieldset('Free Shipping', array('coupon_shipping')); $form->text('Min. Cart Amount', 'coupon_min_cart_amt', isset($coupon['coupon_min_cart_amt']) ? $coupon['coupon_min_cart_amt'] : null, 'The minimum order amount before the coupon may be used.', FALSE, FALSE, FALSE, '6em'); $form->dropdown('Shipping Methods', 'ship_rates[]', $shipping_options, $coupon_shipping, TRUE, 'If left blank, will select ALL SHIPPING PLANS'); return $form; }
function subscription_edit($id) { $this->load->library('admin_form'); $form = new Admin_form(); $this->load->model('subscription_plan_model'); $plan = $this->subscription_plan_model->get_plan($id); if (!$plan) { die(show_error('No subscription plan with that ID.')); } $this->load->model('users/usergroup_model'); $usergroups = $this->usergroup_model->get_usergroups(); $options = array(); $options[0] = 'No member group move'; foreach ($usergroups as $group) { $options[$group['id']] = $group['name']; } $usergroups = $options; $form->fieldset('Membership Options'); $form->dropdown('Promotion', 'promotion', $usergroups, $plan['promotion'], FALSE, FALSE, 'Upon subscription, the member will be moved into this usergroup. They will be removed from this group upon expiration or cancellation.'); $form->dropdown('Demotion', 'demotion', $usergroups, $plan['demotion'], FALSE, FALSE, 'Upon expiration or cancellation, the member will be moved into this usergroup.'); $form->fieldset('Description'); $form->textarea('Description', 'description', $plan['description'], 'This text may be displayed to the user in a list of subscription packages.', FALSE, 'basic', TRUE, '100%', '100px'); $data = array('member_form' => $form->display(), 'form_title' => 'Edit Subscription Plan', 'form_action' => site_url('admincp/billing/post_subscription/edit/' . $plan['id']), 'action' => 'edit', 'form' => $plan); $this->load->view('subscription_form.php', $data); }
function type_edit($id) { $this->load->model('content_type_model'); $type = $this->content_type_model->get_content_type($id); if (empty($type)) { die(show_error('No content type exists by that ID.')); } $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('New Content Type'); $form->text('Name', 'name', $type['name'], 'Enter the name for this type of content.', TRUE, 'e.g., News Articles', TRUE); $form->fieldset('Options'); $form->checkbox('Standard page fields?', 'is_standard', '1', $type['is_standard'], 'If checked, each content item will have the following fields: "Title", "URL Path", and "Topic". These are standard items which allow ' . setting('app_name') . ' to display this content as an individual web page, include in blog/topic listings, etc.'); $form->checkbox('Restrict to certain member groups?', 'is_privileged', '1', $type['is_privileged'], 'If checked, you will be able to specify the member group(s) that have permissions to see this content (or make it public).'); $form->fieldset('Design'); $this->load->helper('template_files'); $template_files = template_files(); $form->dropdown('Output Template', 'template', $template_files, $type['template'], FALSE, TRUE, 'This template in your theme directory will be used to display content of this type. (Ignore this field if it\'s not applicable.)'); $form->text('Base URL Path', 'base_url', $type['base_url'], '(Optional) If this value is set, the URL Path box where you create the URL for each piece of content will be pre-loaded with a folder that will unify all content of this type. For example, setting this to "articles/" will help you make all URL\'s for content of this type like "articles/my_article", "articles/my_other_article", etc.'); $data = array('form' => $form->display(), 'form_title' => 'Edit Content Type', 'form_action' => site_url('admincp/publish/post_type/edit/' . $type['id']), 'action' => 'edit'); $this->load->view('type_form.php', $data); }
function group_edit($id) { $this->load->library('admin_form'); $this->load->model('usergroup_model'); $group = $this->usergroup_model->get_group($id); $form = new Admin_form(); $form->fieldset('Group Information'); $form->text('Name', 'name', $group['name'], FALSE, TRUE, FALSE, TRUE); $data = array('form' => $form->display(), 'form_title' => 'Edit Member Group', 'form_action' => site_url('admincp/users/post_group/edit/' . $id)); $this->load->view('group_form.php', $data); }
function edit($id) { $this->load->helper('form'); $this->load->model('rss_model'); $feed = $this->rss_model->get_feed($id); // get content types $this->load->model('publish/content_type_model'); $types = $this->content_type_model->get_content_types(array('is_standard' => '1')); $type_options = array(); foreach ($types as $type) { $type_options[$type['id']] = $type['name']; } // get users $users = $this->user_model->get_users(array('is_admin' => '1')); $user_options = array(); $user_options[0] = 'Any Author'; foreach ($users as $user) { $user_options[$user['id']] = $user['username'] . ' (' . $user['first_name'] . ' ' . $user['last_name'] . ')'; } // get topics $this->load->model('publish/topic_model'); $topics = $this->topic_model->get_tiered_topics(); $topic_options = array(); $topic_options[0] = 'Any Topic'; foreach ($topics as $topic) { $topic_options[$topic['id']] = $topic['name']; } // get field options $type = $this->content_type_model->get_content_type($feed['type']); $custom_fields = $this->custom_fields_model->get_custom_fields(array('group' => $type['custom_field_group_id'])); $field_options = array(); $field_options['0'] = 'Do not include a summary for each item in the RSS feed.'; $field_options['content_title'] = 'Title'; $field_options['content_date'] = 'Date Created'; $field_options['content_modified'] = 'Date Modified'; $field_options['link_url_path'] = 'URL Path'; foreach ($custom_fields as $field) { $field_options[$field['name']] = $field['friendly_name']; } // template $this->load->library('Admin_form'); $form = new Admin_form(); $form->fieldset('Design'); $this->load->helper('template_files'); $template_files = template_files(); $form->dropdown('Output Template', 'template', $template_files, $feed['template'], FALSE, TRUE, 'This template in your theme directory will be used to display this RSS feed.'); $data = array('types' => $type_options, 'users' => $user_options, 'topics' => $topic_options, 'field_options' => $field_options, 'feed' => $feed, 'form' => $form->display(), 'form_title' => 'Edit RSS Feed', 'form_action' => site_url('admincp/rss/post/edit/' . $feed['id'])); $this->load->view('feed_form', $data); }
function edit($id) { $this->load->model('publish/content_model'); $content = $this->content_model->get_content($id, TRUE); $this->load->model('publish/content_type_model'); $type = $this->content_type_model->get_content_type($content['type_id']); $this->load->library('admin_form'); $title = new Admin_form(); $title->fieldset('Standard Page Elements'); $title->text('Title', 'title', $content['title'], FALSE, TRUE, FALSE, TRUE); // if we are using the base_url in the current URL, chances are we want to keep it for future URL's if (isset($type['base_url']) and !empty($type['base_url']) and strpos($content['url_path'], $type['base_url']) === 0) { $title->hidden('base_url', $type['base_url']); } $title->text('URL Path', 'url_path', $content['url_path'], 'If you leave this blank, it will be auto-generated from the Title above.', FALSE, 'e.g., /about/contact_us', FALSE, '500px'); // we will build the rest of the sidebar form with form_builder because we want to use it's cool // fieldtypes and better API $this->load->model('publish/topic_model'); $topics = $this->topic_model->get_tiered_topics(); $options = array(); foreach ($topics as $data) { $options[] = array('name' => $data['name'], 'value' => $data['id']); } $this->load->library('custom_fields/form_builder'); $topics = $this->form_builder->add_field('multicheckbox'); $topics->options($options)->name('topics')->label('Topics'); $date = $this->form_builder->add_field('datetime'); $date->data('future_only', TRUE)->name('date')->label('Publish Date'); // editing, assign values $topics->value($content['topics']); $date->value($content['date']); $title = $title->display(); $standard = $this->form_builder->output_admin(); // we require a member group access privileges dropdown $this->load->model('users/usergroup_model'); $groups = $this->usergroup_model->get_usergroups(); $options = array(); $options[] = array('name' => 'Public / Any Member Group', 'value' => '0'); foreach ($groups as $group) { $options[] = array('name' => $group['name'], 'value' => $group['id']); } $this->load->library('custom_fields/form_builder'); $this->form_builder->reset(); $privileges = $this->form_builder->add_field('multicheckbox'); $privileges->name('privileges')->options($options)->default_value(0)->label('Allowed Membership Groups')->help('If a group or groups is selected, this content will require the user be in this group to view it. This enables you to charge for subscriptions and products that move the user to this group.')->value($content['privileges']); $privileges = $this->form_builder->output_admin(); // handle custom fields $this->load->model('custom_fields_model'); $custom_fieldset = new Admin_form(); $custom_fields = $this->custom_fields_model->get_custom_fields(array('group' => $type['custom_field_group_id'])); $custom_fieldset->fieldset('Custom Product Data'); $custom_fieldset->custom_fields($custom_fields, $content); $custom_fields = $custom_fieldset->display(); $data = array('title' => $title, 'standard' => $standard, 'privileges' => $privileges, 'custom_fields' => $custom_fields, 'type' => $type, 'form_title' => 'Edit Gallery', 'form_action' => site_url('admincp/gallery/post/edit/' . $content['id']), 'invalid' => $this->input->get('invalid') ? TRUE : FALSE, 'errors' => $this->session->flashdata('errors')); $this->load->view('create', $data); }
function product_option_add() { $data = array('form_action' => site_url('admincp/store/save_product_option')); $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Production Option Information'); $form->text('Name', 'name', '', FALSE, TRUE); $data = array('form' => $form->display(), 'form_action' => site_url('admincp/store/save_product_option')); $this->load->view('product_option_form', $data); }
function create() { $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('New Menu'); $form->text('Menu Name', 'name', '', 'This name is only used in the control panel and theme files to reference this menu. It will not be seen by your web site\'s visitors.', TRUE, 'e.g., main_menu', TRUE); $this->load->model('menu_model'); $menus = $this->menu_model->get_menus(); $is_first_menu = empty($menus) ? TRUE : FALSE; $data = array('form' => $form->display(), 'form_title' => $is_first_menu == TRUE ? 'Create Your First Site Menu' : 'Create New Menu', 'form_action' => site_url('admincp/menu_manager/post_menu/new')); $this->load->view('menu_form', $data); }
/** * Re-position a custom field group * * @param int $custom_field_group Custom field group ID * @param string $return_url A URL-encoded, base64_encoded, site_url() call (e.g., url_encode(base64_encode(site_url('admincp/')))) * * @return view */ function order($custom_field_group, $return_url) { $return_url = base64_decode(urldecode($return_url)); // load model $this->load->model('custom_fields_model'); $custom_fields = $this->custom_fields_model->get_custom_fields(array('group' => $custom_field_group)); if (empty($custom_fields)) { die(show_error('No custom fields in this group.')); } $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Custom Fields', array('sortable')); foreach ($custom_fields as $key => $field) { // get rid of required fields $custom_fields[$key]['required'] = '0'; // no wysiwygs if ($field['type'] == 'wysiwyg') { $custom_fields[$key]['type'] = 'textarea'; } } $form->custom_fields($custom_fields); $form = $form->display(); $data = array('form' => $form, 'return_url' => urlencode(base64_encode($return_url)), 'field_group_id' => $custom_field_group); $this->load->view('arrange_fields.php', $data); }
/** * Email layout */ function email_layout() { $this->load->helper('file'); $layout = read_file(setting('path_email_templates') . '/email_layout.thtml'); if ($layout === FALSE) { die(show_error('email_layout.thtml does not exist at ' . setting('path_email_templates') . '. Please create it and make sure that it is writeable.')); } $this->load->library('admin_form'); $form = new Admin_form(); $form->fieldset('Email Layout'); $form->textarea('Global Email Layout Template', 'html', htmlspecialchars($layout), 'This layout is used in all other email templates by default. It uses Smarty markup.', TRUE, FALSE, TRUE, '100%', '300px'); $data = array('form' => $form->display(), 'form_action' => site_url('admincp/emails/post_email_layout')); $this->load->view('email_layout', $data); }
function edit($id) { define('INCLUDE_CKEDITOR', 'TRUE'); $this->load->helper('form'); $this->load->model('blog_model'); $blog = $this->blog_model->get_blog($id); // get content types $this->load->model('publish/content_type_model'); $types = $this->content_type_model->get_content_types(array('is_standard' => '1')); $type_options = array(); foreach ($types as $type) { $type_options[$type['id']] = $type['name']; } // get users $users = $this->user_model->get_users(array('is_admin' => '1')); $user_options = array(); $user_options[0] = 'Any Author'; foreach ($users as $user) { $user_options[$user['id']] = $user['username'] . ' (' . $user['first_name'] . ' ' . $user['last_name'] . ')'; } // get topics $this->load->model('publish/topic_model'); $topics = $this->topic_model->get_tiered_topics(); $topic_options = array(); $topic_options[0] = 'Any Topic'; foreach ($topics as $topic) { $topic_options[$topic['id']] = $topic['name']; } // get field options $type = $this->content_type_model->get_content_type($blog['type']); $custom_fields = $this->custom_fields_model->get_custom_fields(array('group' => $type['custom_field_group_id'])); $field_options = array(); $field_options['content_title'] = 'Title'; $field_options['content_date'] = 'Date Created'; $field_options['content_modified'] = 'Date Modified'; $field_options['link_url_path'] = 'URL Path'; foreach ($custom_fields as $field) { $field_options[$field['name']] = $field['friendly_name']; } $this->load->library('Admin_form'); // privileges form $this->load->model('users/usergroup_model'); $groups = $this->usergroup_model->get_usergroups(); $privileges = new Admin_form(); $privileges->fieldset('Member Group Access'); $options = array(); $options[0] = 'Public / Any Member Group'; foreach ($groups as $group) { $options[$group['id']] = $group['name']; } $privileges->dropdown('Access Requires Membership to Group', 'privileges', $options, !empty($blog['privileges']) ? $blog['privileges'] : array(0), TRUE, FALSE, 'Select multiple member groups by holding the CTRL or CMD button and selecting multiple options.'); $privilege_form = $privileges->display(); // template form $form = new Admin_form(); $form->fieldset('Design'); $this->load->helper('template_files'); $template_files = template_files(); $form->dropdown('Output Template', 'template', $template_files, $blog['template'], FALSE, TRUE, 'This template in your theme directory will be used to display this blog/archive page.'); $form->text('Items per Page', 'per_page', $blog['per_page'], 'Automatic pagination will occur if the total number of content items is greater than this number.', TRUE, FALSE, FALSE, '70px', '', array('number')); $data = array('types' => $type_options, 'users' => $user_options, 'topics' => $topic_options, 'field_options' => $field_options, 'blog' => $blog, 'form' => $form->display(), 'privilege_form' => $privilege_form, 'form_title' => 'Edit Blog/Archive', 'form_action' => site_url('admincp/blogs/post/edit/' . $blog['id'])); $this->load->view('blog_form', $data); }
function edit($id) { define('INCLUDE_CKEDITOR', TRUE); $this->load->helper('form'); $this->load->model('form_model'); $form = $this->form_model->get_form($id); if (empty($form)) { die(show_error('No form exists with that ID.')); } // template $this->load->library('Admin_form'); $template_form = new Admin_form(); $template_form->fieldset('Design'); $this->load->helper('template_files'); $template_files = template_files(); $template_form->dropdown('Output Template', 'template', $template_files, $form['template'], FALSE, TRUE, 'This template in your theme directory will be used to display this form.'); // privileges $this->load->model('users/usergroup_model'); $groups = $this->usergroup_model->get_usergroups(); $privileges = new Admin_form(); $privileges->fieldset('Member Group Access'); $options = array(); $options[0] = 'Public / Any Member Group'; foreach ($groups as $group) { $options[$group['id']] = $group['name']; } $privileges->dropdown('Access Requires Membership to Group', 'privileges', $options, !empty($form['privileges']) ? $form['privileges'] : array(0), TRUE, FALSE, 'Select multiple member groups by holding the CTRL or CMD button and selecting multiple options.'); $privilege_form = $privileges->display(); $data = array('form' => $form, 'admin_form' => $template_form->display(), 'privilege_form' => $privilege_form, 'form_title' => 'Edit Form', 'form_action' => site_url('admincp/forms/post/edit/' . $form['id'])); $this->load->view('form', $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); }