/**
  *
  * @see Ai1ec_Connector_Plugin::render_tab_content()
  *
  */
 public function render_tab_content()
 {
     global $ai1ec_view_helper;
     $this->render_opening_div_of_tab();
     $file_input = Ai1ec_Helper_Factory::create_input_instance();
     $file_input->set_type('file');
     $file_input->set_id(self::NAME_OF_FILE_INPUT);
     $file_input->set_name(self::NAME_OF_FILE_INPUT);
     $submit = Ai1ec_Helper_Factory::create_input_instance();
     $submit->set_type('submit');
     $submit->add_class('button-primary');
     $submit->set_name(self::NAME_OF_SUBMIT);
     $submit->set_id(self::NAME_OF_SUBMIT);
     $submit->set_value(__('Submit Events', AI1EC_PLUGIN_NAME));
     $textarea = Ai1ec_Helper_Factory::create_generic_html_tag('textarea');
     $textarea->set_attribute('name', self::NAME_OF_TEXTAREA);
     $textarea->set_attribute('rows', 6);
     $textarea->set_id(self::NAME_OF_TEXTAREA);
     $facebook_tab = Ai1ec_Facebook_Factory::get_facebook_tab_instance();
     $category_select = $facebook_tab->create_select_category('ai1ec_file_upload_feed_category');
     $message = false;
     if (isset($this->count)) {
         $text = __('No events were found', AI1EC_PLUGIN_NAME);
         if ($this->count > 0) {
             $text = sprintf(_n('Imported %s event', 'Imported %s events', $this->count, AI1EC_PLUGIN_NAME), $this->count);
         }
         $message = Ai1ec_Helper_Factory::create_bootstrap_message_instance($text);
     }
     $args = array("category_select" => $category_select, "submit" => $submit, "file_input" => $file_input, "textarea" => $textarea);
     if (false !== $message) {
         $args['message'] = $message;
     }
     $ai1ec_view_helper->display_admin('plugins/file_upload/file_upload.php', $args);
     $this->render_closing_div_of_tab();
 }
 /**
  *
  * @see Ai1ec_Renderable::render()
  *
  */
 public function render()
 {
     $input = Ai1ec_Helper_Factory::create_input_instance();
     $input->set_name($this->id);
     $input->set_id($this->id);
     $input->add_class('input-mini');
     $input->add_class('ai1ec-less-variable-size');
     $input->set_value($this->value);
     $input->set_attribute('placeholder', __('Length', AI1EC_PLUGIN_NAME));
     echo $this->render_opening_of_control_group();
     $input->render();
     echo $this->render_closing_of_control_group();
 }
 /**
  *
  * @see Ai1ec_Renderable::render()
  *
  */
 public function render()
 {
     $label = Ai1ec_Helper_Factory::create_generic_html_tag('label');
     $label->set_attribute('for', $this->id);
     $label->add_class('radio');
     $label->set_text($this->label);
     $label->set_prepend_text(false);
     $radio = Ai1ec_Helper_Factory::create_input_instance();
     $radio->set_type('radio');
     $radio->set_id($this->id);
     $radio->set_value($this->id);
     $radio->set_name($this->name);
     if (isset($this->args['checked'])) {
         $radio->set_attribute('checked', 'checked');
     }
     $label->add_renderable_children($radio);
     $label->render();
 }
 /**
  * (non-PHPdoc)
  * @see Ai1ec_Less_Variable::render()
  */
 public function render()
 {
     $input = Ai1ec_Helper_Factory::create_input_instance();
     $input->set_name($this->id . self::CUSTOM_FONT_ID_SUFFIX);
     $input->set_id($this->id . self::CUSTOM_FONT_ID_SUFFIX);
     if ($this->value !== self::CUSTOM_FONT) {
         $input->add_class('hide');
     } else {
         $input->set_value($this->custom_value);
     }
     $input->add_class('ai1ec-custom-font');
     $input->set_attribute('placeholder', __("Enter custom font(s)", AI1EC_PLUGIN_NAME));
     echo $this->render_opening_of_control_group();
     $this->renderable->render();
     echo ' ';
     // Required for adequate spacing between <select> and <input>.
     $input->render();
     echo $this->render_closing_of_control_group();
 }
 /**
  * Adds al the elements to the page.
  * I took this out of the factory so that it's done only if the page is clicked
  */
 private function add_renderables_to_page()
 {
     // These are the tabs
     $tabs_ids_description = array('general' => __('General', AI1EC_PLUGIN_NAME), 'table' => __('Tables', AI1EC_PLUGIN_NAME), 'buttons' => __('Buttons', AI1EC_PLUGIN_NAME), 'forms' => __('Forms', AI1EC_PLUGIN_NAME), 'calendar' => __('Calendar general', AI1EC_PLUGIN_NAME), 'posterboard' => __('Posterboard view', AI1EC_PLUGIN_NAME), 'stream' => __('Stream view', AI1EC_PLUGIN_NAME), 'month' => __('Month/week/day view', AI1EC_PLUGIN_NAME), 'agenda' => __('Agenda view', AI1EC_PLUGIN_NAME));
     // Create the tab layout
     $bootstrap_tabs_layout = Ai1ec_Helper_Factory::create_bootstrap_tabs_layout_instance();
     $bootstrap_tabs_layout->set_layout('left');
     $less_variables = Ai1ec_Lessphp_Controller::get_saved_variables(Ai1ec_Adapters_Factory::create_db_adapter_instance());
     // Inizialize the array of tabs that will be added to the layout
     $bootstrap_tabs_to_add = array();
     // initialize the array of tab bodyes that will be added to the tabs
     $tabs_bodies = array();
     foreach ($tabs_ids_description as $id => $description) {
         $bootstrap_tabs_to_add["ai1ec-{$id}"] = Ai1ec_Helper_Factory::create_bootstrap_tab_instance($id, $description);
         $bootstrap_tabs_to_add["ai1ec-{$id}"]->add_class('form-horizontal');
         // create the main div that will hold all the variables
         $div = Ai1ec_Helper_Factory::create_generic_html_tag('div');
         $tabs_bodies["ai1ec-{$id}"] = $div;
     }
     foreach ($less_variables as $variable_id => $variable_attributes) {
         $variable_attributes['id'] = $variable_id;
         $less_variable = Ai1ec_Less_Factory::create_less_variable($variable_attributes['type'], $variable_attributes);
         $tabs_bodies["ai1ec-{$variable_attributes['tab']}"]->add_renderable_children($less_variable);
     }
     foreach ($tabs_bodies as $tab => $div) {
         $bootstrap_tabs_to_add[$tab]->add_renderable_children($div);
     }
     foreach ($bootstrap_tabs_to_add as $tab) {
         $bootstrap_tabs_layout->add_renderable_children($tab);
     }
     $this->add_renderable_children($bootstrap_tabs_layout);
     $input = Ai1ec_Helper_Factory::create_input_instance();
     $input->set_type('submit');
     $input->set_value(__('Save Options', AI1EC_PLUGIN_NAME));
     $input->set_name(Ai1ec_Less_Variables_Editing_Page::FORM_SUBMIT_NAME);
     $input->add_class("button-primary");
     $reset_theme = Ai1ec_Helper_Factory::create_input_instance();
     $reset_theme->set_type('submit');
     $reset_theme->set_value(__('Reset to defaults', AI1EC_PLUGIN_NAME));
     $reset_theme->set_name(Ai1ec_Less_Variables_Editing_Page::FORM_SUBMIT_RESET_THEME);
     $reset_theme->add_class("button");
     $reset_theme->set_id('ai1ec-reset-variables');
     $this->add_renderable_children($input);
     $this->add_renderable_children($reset_theme);
 }
 /**
  * Creates a tag selector using the Select2 widget.
  *
  * @return Ai1ec_Input
  */
 public static function create_select2_tags(array $args)
 {
     if (!isset($args['name'])) {
         $args['name'] = $args['id'];
     }
     // Get tags.
     $tags = get_terms('events_tags', array('orderby' => 'name', 'hide_empty' => 0));
     // Build tags array to pass as JSON.
     $tags_json = array();
     foreach ($tags as $term) {
         $tags_json[] = $term->name;
     }
     $tags_json = json_encode($tags_json);
     $tags_json = _wp_specialchars($tags_json, 'single', 'UTF-8');
     $input = Ai1ec_Helper_Factory::create_input_instance();
     $input->set_id($args['id']);
     $input->set_name($args['name']);
     $input->set_attribute("data-placeholder", __('Tags (optional)', AI1EC_PLUGIN_NAME));
     $input->set_attribute("data-ai1ec-tags", $tags_json);
     $input->add_class('ai1ec-tags-selector span12');
     return $input;
 }
 /**
  * Create the modal for the event subscription
  *
  * @param $event Ai1ec_Event
  */
 private function add_modal_for_email_subscription(Ai1ec_Event $event)
 {
     $current_user = wp_get_current_user();
     $user_email = $current_user->user_email;
     unset($current_user);
     // Create containing div
     $div = Ai1ec_Helper_Factory::create_generic_html_tag('div');
     $div->add_class('ai1ec_email_container form-horizontal');
     $div->set_attribute('data-event_id', $event->post_id);
     $div->set_attribute('data-event_instance', $event->instance_id);
     // Add alert container to containing div
     $div_alerts = Ai1ec_Helper_Factory::create_generic_html_tag('div');
     $div_alerts->add_class('alerts');
     // Add paragraph to containing div
     $paragraph = Ai1ec_Helper_Factory::create_generic_html_tag('p');
     $paragraph->set_text(__('Enter your email address below to receive a notification about the event 6 hours before it starts.', AI1EC_PLUGIN_NAME));
     $div->add_renderable_children($paragraph);
     // Add div.control-group to containing div
     $control_group = Ai1ec_Helper_Factory::create_generic_html_tag('div');
     $control_group->add_class('control-group');
     $div->add_renderable_children($control_group);
     // Add label to div.control-group
     $label = Ai1ec_Helper_Factory::create_generic_html_tag('label');
     $label->add_class('control-label');
     $label->set_attribute('for', 'ai1ec_email_subscribe');
     $label->set_text(__('Email:', AI1EC_PLUGIN_NAME));
     $control_group->add_renderable_children($label);
     // Add div.controls to div.control-group
     $controls = Ai1ec_Helper_Factory::create_generic_html_tag('div');
     $controls->add_class('controls');
     $control_group->add_renderable_children($controls);
     // Add input to div.controls
     $input = Ai1ec_Helper_Factory::create_input_instance();
     $input->set_id('ai1ec_email_subscribe');
     $input->set_name('ai1ec_email_subscribe');
     if (!empty($user_email)) {
         $input->set_value($user_email);
     }
     $input->set_attribute('placeholder', __('Email', AI1EC_PLUGIN_NAME));
     $controls->add_renderable_children($input);
     // Create modal and add our enclosing div to it
     $bootstrap_modal = Ai1ec_Helper_Factory::create_bootstrap_modal_instance($div_alerts->render_as_html() . $div->render_as_html());
     $bootstrap_modal->set_header_text(__('Get notified about this event', AI1EC_PLUGIN_NAME));
     $bootstrap_modal->set_id('ai1ec_subscribe_email_modal');
     $bootstrap_modal->add_class('fade');
     $bootstrap_modal->set_keep_button_text('<i class="icon-ok"></i> ' . __('Subscribe', AI1EC_PLUGIN_NAME));
     $bootstrap_modal->set_delete_button_text('<i class="icon-remove"></i> ' . __('Close', AI1EC_PLUGIN_NAME));
     $ai1ec_deferred_helper = Ai1ec_Deferred_Rendering_Helper::get_instance();
     $ai1ec_deferred_helper->add_renderable_children($bootstrap_modal);
 }