/**
     * Creates the HTML to display on the "Add new event" page so that the user can choose to export the event to Facebook.
     *
     * @return string an empty string or the html to show
     */
    public function render_export_box()
    {
        global $post;
        // We only want this for events.
        if ($post->post_type !== AI1EC_POST_TYPE) {
            return;
        }
        try {
            $event = new Ai1ec_Event($post->ID);
        } catch (Ai1ec_Event_Not_Found $e) {
            // Post exists, but event data hasn't been saved yet. Create new event
            // object.
            $event = NULL;
        }
        // If we have an event end the event was imported from facebook, return, we can't export it.
        if ($event !== NULL && $event->facebook_status === Ai1ecFacebookConnectorPlugin::FB_IMPORTED_EVENT) {
            return;
        }
        // Let's check if we have a user in session
        if ($this->get_current_facebook_user_from_cache() === NULL) {
            // No user in session, let's see if we have a token and the user can login.
            $facebook = $this->facebook_instance_factory();
            $current_user = Ai1ec_Facebook_Factory::get_facebook_user_instance($facebook);
            $logged_in = $current_user->do_login();
            // If the user couldn't login, do not print anything but return an hidden inpsave_current_facebook_user_in_sessionut, in this way the
            // plugin save post handler simply returns.
            if ($logged_in === FALSE) {
                $hidden_input_name = self::FB_HIDDEN_INPUT_NO_ACTIVE_TOKEN;
                echo "<input type='hidden' name='{$hidden_input_name}' value='1' />";
                return;
            }
            // Save it in session.
            $this->save_facebook_user_in_cache($current_user);
        }
        $checked = '';
        if ($event !== NULL && $event->facebook_status === Ai1ecFacebookConnectorPlugin::FB_EXPORTED_EVENT) {
            $checked = 'checked';
        }
        $link = '';
        $modal_html = '';
        if (isset($event->facebook_eid) && (int) $event->facebook_eid !== 0) {
            $link_label = __("Linked Facebook event", AI1EC_PLUGIN_NAME);
            $link = "<div id='ai1ec-facebook-linked-event'><a href='https://www.facebook.com/events/{$event->facebook_eid}'>{$link_label}</a></div>";
            // We include the modal only when the event has been exported to facebook
            $twitter_bootstrap_modal = new Ai1ec_Bootstrap_Modal(__("Would you like to delete the linked Facebook event or keep it? If you choose to keep it and later you export this event again, a new one will be created.", AI1EC_PLUGIN_NAME));
            $twitter_bootstrap_modal->set_header_text(__("Unpublish Facebook event?", AI1EC_PLUGIN_NAME));
            $twitter_bootstrap_modal->set_id("ai1ec-facebook-export-modal");
            $twitter_bootstrap_modal->set_delete_button_text(__("Delete event", AI1EC_PLUGIN_NAME));
            $twitter_bootstrap_modal->set_keep_button_text(__("Keep event", AI1EC_PLUGIN_NAME));
            $modal_html = $twitter_bootstrap_modal->render_modal_and_return_html();
        }
        $label = __('Export event to Facebook?', AI1EC_PLUGIN_NAME);
        $name = self::FB_EXPORT_CHKBX_NAME;
        $html = <<<HTML
<div id="ai1ec-facebook-publish" class="misc-pub-section">
\t<div id="ai1ec-facebook-small-logo"></div>
\t<label for="{$name}">
\t\t{$label}
\t</label>
\t<input type="checkbox" {$checked} name="{$name}" id="{$name}" value="1" />
\t{$link}
</div>
<div class="timely">
{$modal_html}
</div>
HTML;
        echo $html;
    }