Beispiel #1
0
 function index()
 {
     // we'll show varying levels of blank state screens
     // do we have a consumer key and secret?
     if (setting('twitter_consumer_key') == '' or setting('twitter_consumer_secret') == '') {
         return redirect('admincp/twitter/register_application');
     }
     // we have an app setup, but we may need the OAuth token...
     if (setting('twitter_oauth_token') == '' or setting('twitter_oauth_token_secret') == '') {
         return redirect('admincp/twitter/update_oauth');
     }
     // we have oauth tokens, but let's make sure they are up-to-date
     require APPPATH . 'modules/twitter/libraries/twitteroauth.php';
     $connection = new TwitterOAuth(setting('twitter_consumer_key'), setting('twitter_consumer_secret'), setting('twitter_oauth_token'), setting('twitter_oauth_token_secret'));
     $test = $connection->get('account/verify_credentials');
     if ($connection->http_code != 200) {
         // connection failed
         $this->notices->SetError('Your Twitter OAuth tokens are out of date!  Please re-authorize.');
         return redirect('admincp/twitter/update_oauth');
     }
     // Twitter credentials are solid!
     $this->admin_navigation->module_link('Update Application Credentials', site_url('admincp/twitter/register_application'));
     $this->admin_navigation->module_link('Update Authorization Tokens', site_url('admincp/twitter/update_oauth'));
     $this->load->library('admin_form');
     $form = new Admin_form();
     $form->fieldset('Twitter Configuration');
     // 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 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'];
     }
     $form->value_row(' ', 'Configure ' . setting('app_name') . ' to automatically tweet your latest content with the options below.');
     $checked = setting('twitter_enabled') == '1' ? TRUE : FALSE;
     $form->checkbox('Enable Tweeting?', 'enabled', '1', $checked);
     $selected = setting('twitter_content_types') != '' ? unserialize(setting('twitter_content_types')) : array();
     $form->dropdown('Content Types', 'content_types', $type_options, $selected, TRUE, FALSE, 'Only posts of these content types will be tweeted.');
     $selected = setting('twitter_topics') != '' ? unserialize(setting('twitter_topics')) : array();
     $form->dropdown('Topics', 'topics', $topic_options, $selected, TRUE, FALSE, 'Only posts in these topics will be tweeted.');
     //$value = (setting('twitter_template') == '') ? '[TITLE]: [URL]' : setting('twitter_template');
     //$form->textarea('Tweet Template','template',$value,'Specify the format of the Tweet.  You may use the tags: [SITE_NAME], [TITLE], and [URL].');
     $data = array('form_title' => 'Twitter: Configuration', 'form_action' => site_url('admincp/twitter/post_config'), 'form' => $form->display(), 'form_button' => 'Save Configuration');
     $this->load->view('generic', $data);
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 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);
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 function edit($id)
 {
     $this->load->model('usergroup_model');
     $usergroups = $this->usergroup_model->get_usergroups();
     $usergroup_options = array();
     foreach ($usergroups as $group) {
         $usergroup_options[$group['id']] = $group['name'];
     }
     $user = $this->user_model->get_user($id);
     if (!$user) {
         die(show_error('No user found with that ID.'));
     }
     $this->load->library('admin_form');
     $form = new Admin_form();
     $form->fieldset('System Information');
     $form->text('Username', 'username', $user['username'], FALSE, TRUE, FALSE, TRUE);
     $form->text('Email', 'email', $user['email'], FALSE, TRUE, '*****@*****.**', TRUE);
     $form->password('Password', 'password', '', FALSE, TRUE);
     $form->password('Repeat Password', 'password2', 'Leave blank to keep current password. Passwords must be at least 6 characters in length.', FALSE, TRUE);
     $form->fieldset('Usergroup');
     $form->dropdown('Usergroups', 'usergroups', $usergroup_options, $user['usergroups'], TRUE, TRUE);
     $form->checkbox('Administrator', 'is_admin', '1', $user['is_admin']);
     $form->fieldset('Profile Information');
     $form->names('Name', $user['first_name'], $user['last_name'], FALSE, TRUE);
     $form->custom_fields($this->user_model->get_custom_fields(), $user, TRUE);
     $data = array('user' => array(), 'usergroups' => $usergroup_options, 'default_usergroup' => $this->usergroup_model->get_default(), 'form' => $form->display(), 'form_title' => 'Edit Member Account', 'form_action' => site_url('admincp/users/post_user/edit/' . $user['id']));
     $this->load->view('user_form.php', $data);
 }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 function collection_edit($id)
 {
     $this->load->library('admin_form');
     $form = new Admin_form();
     $form->fieldset('Collection Information');
     $this->load->model('collections_model');
     $collections = $this->collections_model->get_tiered_collections();
     $collection = $this->collections_model->get_collection($id);
     $options = array();
     $options[0] = 'No parent';
     foreach ($collections as $data) {
         $options[$data['id']] = $data['name'];
     }
     $form->dropdown('Parent', 'parent', $options, $collection['parent'], FALSE, FALSE, 'If a parent is selected, this collection will act as a sub-collection of its parent.', TRUE);
     $form->text('Collection Name', 'name', $collection['name'], FALSE, TRUE, 'e.g., Men\'s Shoes', TRUE);
     $form->textarea('Description', 'description', $collection['description'], FALSE, FALSE, 'complete', TRUE);
     // custom fields
     if (setting('collections_custom_field_group') != '') {
         $collection_data = $this->custom_fields_model->get_custom_fields(array('group' => setting('collections_custom_field_group')));
         if (!empty($collection_data)) {
             $form->fieldset('Custom Product Data');
             $form->custom_fields($collection_data, $collection);
         }
     }
     $data = array('form' => $form->display(), 'form_action' => site_url('admincp/store/post_collection/edit/' . $collection['id']), 'form_title' => 'Edit Collection');
     $this->load->view('collection_form', $data);
 }
Beispiel #8
0
 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);
 }
Beispiel #9
0
 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);
 }