/**
 * Gets the << prev, next >> etc. link HTML for the current submission.
 */
function _ft_code_get_link_html($form_id, $view_id, $submission_id, $results_per_page)
{
    global $LANG;
    // defaults! As of 2.1.0, the navigation always appears. This is better for consistency's sake
    $previous_link_html = "<span class=\"light_grey\">{$LANG['word_previous_leftarrow']}</span>";
    $next_link_html = "<span class=\"light_grey\">{$LANG['word_next_rightarrow']}</span>";
    $search_results_link_html = "<a href=\"submissions.php?form_id={$form_id}\">{$LANG['phrase_back_to_search_results']}</a>";
    if (isset($_SESSION["ft"]["form_{$form_id}_view_{$view_id}_submissions"]) && !empty($_SESSION["ft"]["form_{$form_id}_view_{$view_id}_submissions"])) {
        $php_self = ft_get_clean_php_self();
        $submission_ids = $_SESSION["ft"]["form_{$form_id}_view_{$view_id}_submissions"];
        $current_sub_id_index = array_search($submission_id, $submission_ids);
        if (!empty($current_sub_id_index) || $current_sub_id_index === 0) {
            // PREVIOUS link
            if ($submission_ids[0] != $submission_id && $current_sub_id_index != 0) {
                $previous_submission_id = $submission_ids[$current_sub_id_index - 1];
                $previous_link_html = "<a href=\"{$php_self}?form_id={$form_id}&view_id={$view_id}&submission_id={$previous_submission_id}\">{$LANG['word_previous_leftarrow']}</a>";
            }
            $submission_ids_per_page = array_chunk($submission_ids, 10);
            $return_page = 1;
            for ($i = 0; $i < count($submission_ids_per_page); $i++) {
                if (in_array($submission_id, $submission_ids_per_page[$i])) {
                    $return_page = $i + 1;
                    break;
                }
            }
            // NEXT link
            if ($submission_ids[count($submission_ids) - 1] != $submission_id) {
                $next_submission_id = $submission_ids[$current_sub_id_index + 1];
                $next_link_html = "<a href=\"{$php_self}?form_id={$form_id}&view_id={$view_id}&submission_id={$next_submission_id}\">{$LANG['word_next_rightarrow']}</a>";
            }
        }
    }
    return array($previous_link_html, $search_results_link_html, $next_link_html);
}
function smarty_function_display_edit_submission_view_dropdown($params, &$smarty)
{
    global $LANG;
    if (empty($params["form_id"])) {
        $smarty->trigger_error("assign: missing 'form_id' parameter.");
        return;
    }
    if (empty($params["view_id"])) {
        $smarty->trigger_error("assign: missing 'view_id' parameter.");
        return;
    }
    if (empty($params["submission_id"])) {
        $smarty->trigger_error("assign: missing 'submission_id' parameter.");
        return;
    }
    if (empty($params["account_id"])) {
        $smarty->trigger_error("assign: missing 'account_id' parameter.");
        return;
    }
    $is_admin = $params["is_admin"] ? $params["is_admin"] : false;
    $form_id = $params["form_id"];
    $view_id = $params["view_id"];
    $submission_id = $params["submission_id"];
    $account_id = $params["account_id"];
    if ($is_admin) {
        $views = ft_get_form_views($form_id);
    } else {
        $views = ft_get_form_views($form_id, $account_id);
    }
    // loop through the Views assigned to this user and IFF the view contains the submission,
    // add it to the dropdown list
    if (count($views) > 1) {
        $same_page = ft_get_clean_php_self();
        $html = "<select onchange=\"window.location='{$same_page}?form_id={$form_id}&submission_id={$submission_id}&view_id=' + this.value\">\r\n\t    <optgroup label=\"Views\">\n";
        foreach ($views as $view_info) {
            $curr_view_id = $view_info["view_id"];
            $curr_view_name = $view_info["view_name"];
            if (ft_check_view_contains_submission($form_id, $curr_view_id, $submission_id)) {
                $selected = $curr_view_id == $view_id ? " selected" : "";
                $html .= "<option value=\"{$curr_view_id}\"{$selected}>{$curr_view_name}</option>";
            }
        }
        $html .= "</optgroup></select>\n";
    }
    return $html;
}
Beispiel #3
0
<?php

require_once "../../global/session_start.php";
ft_check_permission("client");
$request = array_merge($_POST, $_GET);
$account_id = $_SESSION["ft"]["account"]["account_id"];
// store the current selected tab in memory
$page = ft_load_field("page", "account_page", "main");
$same_page = ft_get_clean_php_self();
$tabs = array("main" => array("tab_label" => $LANG["word_main"], "tab_link" => "{$same_page}?page=main"), "settings" => array("tab_label" => $LANG["word_settings"], "tab_link" => "{$same_page}?page=settings"));
// ------------------------------------------------------------------------------------------
switch ($page) {
    case "main":
        include "page_main.php";
        break;
    case "settings":
        include "page_settings.php";
        break;
    default:
        include "page_main.php";
        break;
}
Beispiel #4
0
<?php

require "../../../global/library.php";
ft_init_module_page();
require_once "../library.php";
$request = array_merge($_POST, $_GET);
$export_group_type_id = "export_group_types";
$page = ft_load_module_field("export_manager", "page", "export_manager_tab", "main");
$export_group_id = ft_load_module_field("export_manager", "export_group_id", "export_manager_export_group_id", "export_group_id");
if (isset($request["add_export_type"])) {
    list($g_success, $g_message) = exp_add_export_type($request);
}
$php_self = ft_get_clean_php_self();
$tabs = array("main" => array("tab_label" => "Main", "tab_link" => "{$php_self}?page=main&export_group_id={$export_group_id}"), "permissions" => array("tab_label" => $LANG["word_permissions"], "tab_link" => "{$php_self}?page=permissions&export_group_id={$export_group_id}"), "export_types" => array("tab_label" => "Export Types", "tab_link" => "{$php_self}?page=export_types&export_group_id={$export_group_id}", "pages" => array("export_types", "add_export_type", "edit_export_type")));
$links = ft_get_export_group_prev_next_links($export_group_id);
$prev_tabset_link = !empty($links["prev_id"]) ? "edit.php?page={$page}&export_group_id={$links["prev_id"]}" : "";
$next_tabset_link = !empty($links["next_id"]) ? "edit.php?page={$page}&export_group_id={$links["next_id"]}" : "";
$page_vars = array();
$page_vars["tabs"] = $tabs;
$page_vars["show_tabset_nav_links"] = true;
$page_vars["prev_tabset_link"] = $prev_tabset_link;
$page_vars["next_tabset_link"] = $next_tabset_link;
$page_vars["head_string"] = <<<END
  <link type="text/css" rel="stylesheet" href="{$g_root_url}/modules/export_manager/global/css/styles.css?v=205">
  <script src="{$g_root_url}/global/scripts/sortable.js"></script>
  <script src="{$g_root_url}/modules/export_manager/global/scripts/admin.js"></script>
  <script src="{$g_root_url}/global/codemirror/js/codemirror.js"></script>
END;
// load the appropriate code pages
switch ($page) {
    case "main":
Beispiel #5
0
/**
 * Loads a theme opening page for a module. This should be used loaded for every page in a
 * module. It serves the same function as ft_display_page, except that it sets the appropriate root
 * folder for the module and loads the
 *
 * @param array $page_vars a hash of information to display / provide to the template.
 * @param string $theme
 */
function ft_display_module_page($template, $page_vars = array(), $theme = "", $swatch = "")
{
    global $g_root_dir, $g_root_url, $g_success, $g_message, $g_link, $g_smarty_debug, $g_language, $LANG, $g_smarty, $L, $g_smarty_use_sub_dirs, $g_js_debug, $g_benchmark_start, $g_enable_benchmarking, $g_hide_upgrade_link;
    $module_folder = _ft_get_current_module_folder();
    // $module_id = ft_get_module_id_from_module_folder($module_folder);
    $default_module_language = "en_us";
    if (empty($theme) && isset($_SESSION["ft"]["account"]["theme"])) {
        $theme = $_SESSION["ft"]["account"]["theme"];
        $swatch = isset($_SESSION["ft"]["account"]["swatch"]) ? $_SESSION["ft"]["account"]["swatch"] : "";
    } elseif (empty($theme)) {
        $settings = ft_get_settings(array("default_theme", "default_client_swatch"));
        $theme = $settings["default_theme"];
        $swatch = $settings["default_client_swatch"];
    }
    if (!isset($_SESSION["ft"]["account"]["is_logged_in"])) {
        $_SESSION["ft"]["account"]["is_logged_in"] = false;
    }
    if (!isset($_SESSION["ft"]["account"]["account_type"])) {
        $_SESSION["ft"]["account"]["account_type"] = "";
    }
    // common variables. These are sent to EVERY template
    $g_smarty->template_dir = "{$g_root_dir}/themes/{$theme}";
    $g_smarty->compile_dir = "{$g_root_dir}/themes/{$theme}/cache/";
    $g_smarty->use_sub_dirs = $g_smarty_use_sub_dirs;
    $g_smarty->assign("LANG", $LANG);
    // this contains the custom language content of the module, in the language required. It's populated by
    // ft_init_module_page(), called on every module page
    $g_smarty->assign("L", $L);
    $g_smarty->assign("SESSION", $_SESSION["ft"]);
    $settings = isset($_SESSION["ft"]["settings"]) ? $_SESSION["ft"]["settings"] : array();
    $g_smarty->assign("settings", $settings);
    $g_smarty->assign("account", $_SESSION["ft"]["account"]);
    $g_smarty->assign("g_root_dir", $g_root_dir);
    $g_smarty->assign("g_root_url", $g_root_url);
    $g_smarty->assign("g_js_debug", $g_js_debug ? "true" : "false");
    $g_smarty->assign("g_hide_upgrade_link", $g_hide_upgrade_link);
    $g_smarty->assign("same_page", ft_get_clean_php_self());
    $g_smarty->assign("query_string", $_SERVER["QUERY_STRING"]);
    // TODO FIX
    $g_smarty->assign("dir", $LANG["special_text_direction"]);
    $g_smarty->assign("g_enable_benchmarking", $g_enable_benchmarking);
    $g_smarty->assign("swatch", $swatch);
    // if this page has been told to dislay a custom message, override g_success and g_message
    if (isset($_GET["message"])) {
        list($g_success, $g_message) = ft_display_custom_page_message($_GET["message"]);
    }
    $g_smarty->assign("g_success", $g_success);
    $g_smarty->assign("g_message", $g_message);
    $module_id = ft_get_module_id_from_module_folder($module_folder);
    $module_nav = ft_get_module_menu_items($module_id, $module_folder);
    $g_smarty->assign("module_nav", $module_nav);
    // if there's no module title, display the module name. TODO not compatible with languages...
    if (!isset($page_vars["head_title"])) {
        $module_id = ft_get_module_id_from_module_folder($module_folder);
        $module_info = ft_get_module($module_id);
        $page_vars["head_title"] = $module_info["module_name"];
    }
    // check the "required" vars are at least set so they don't produce warnings when smarty debug is enabled
    if (!isset($page_vars["head_css"])) {
        $page_vars["head_css"] = "";
    }
    if (!isset($page_vars["head_js"])) {
        $page_vars["head_js"] = "";
    }
    if (!isset($page_vars["page"])) {
        $page_vars["page"] = "";
    }
    // if we need to include custom JS messages in the page, add it to the generated JS. Note: even if the js_messages
    // key is defined but still empty, the ft_generate_js_messages function is called, returning the "base" JS - like
    // the JS version of g_root_url. Only if it is not defined will that info not be included. This feature was hacked
    // in 2.1 to support js_messages from a single module file
    $js_messages = "";
    if (isset($page_vars["js_messages"]) || isset($page_vars["module_js_messages"])) {
        $core_js_messages = isset($page_vars["js_messages"]) ? $page_vars["js_messages"] : "";
        $module_js_messages = isset($page_vars["module_js_messages"]) ? $page_vars["module_js_messages"] : "";
        $js_messages = ft_generate_js_messages($core_js_messages, $module_js_messages);
    }
    if (!empty($page_vars["head_js"]) || !empty($js_messages)) {
        $page_vars["head_js"] = "<script type=\"text/javascript\">\n//<![CDATA[\n{$page_vars["head_js"]}\n{$js_messages}\n//]]>\n</script>";
    }
    if (!isset($page_vars["head_css"])) {
        $page_vars["head_css"] = "";
    } else {
        if (!empty($page_vars["head_css"])) {
            $page_vars["head_css"] = "<style type=\"text/css\">\n{$page_vars["head_css"]}\n</style>";
        }
    }
    // theme-specific vars
    $g_smarty->assign("images_url", "{$g_root_url}/themes/{$theme}/images");
    $g_smarty->assign("theme_url", "{$g_root_url}/themes/{$theme}");
    $g_smarty->assign("theme_dir", "{$g_root_dir}/themes/{$theme}");
    // if there's a Smarty folder, import any of its resources
    if (is_dir("{$g_root_dir}/modules/{$module_folder}/smarty")) {
        $g_smarty->plugins_dir[] = "{$g_root_dir}/modules/{$module_folder}/smarty";
    }
    // now add the custom variables for this template, as defined in $page_vars
    foreach ($page_vars as $key => $value) {
        $g_smarty->assign($key, $value);
    }
    // if smarty debug is on, enable Smarty debugging
    if ($g_smarty_debug) {
        $g_smarty->debugging = true;
    }
    extract(ft_process_hook_calls("main", compact("g_smarty", "template", "page_vars"), array("g_smarty")), EXTR_OVERWRITE);
    $g_smarty->display("{$g_root_dir}/modules/{$module_folder}/{$template}");
    ft_db_disconnect($g_link);
}
Beispiel #6
0
foreach ($view_info["fields"] as $view_field_info) {
    $curr_field_id = $view_field_info["field_id"];
    foreach ($form_fields as $form_field_info) {
        if ($form_field_info["field_id"] != $curr_field_id) {
            continue;
        }
        $display_fields[] = array_merge($form_field_info, $view_field_info);
    }
}
// first, build the list of information we're going to send to the export type smarty template
$placeholders = exp_get_export_filename_placeholder_hash();
$placeholders["export_group_id"] = $export_group_id;
$placeholders["export_type_id"] = $export_type_id;
$placeholders["export_group_results"] = $results;
$placeholders["field_types"] = $field_types;
$placeholders["same_page"] = ft_get_clean_php_self();
$placeholders["display_fields"] = $display_fields;
$placeholders["submissions"] = $results_info["search_rows"];
$placeholders["num_results"] = $results_info["search_num_results"];
$placeholders["view_num_results"] = $results_info["view_num_results"];
$placeholders["form_info"] = $form_info;
$placeholders["view_info"] = $view_info;
$placeholders["timezone_offset"] = $_SESSION["ft"]["account"]["timezone_offset"];
// pull out a few things into top level placeholders for easy use
$placeholders["form_id"] = $form_id;
$placeholders["form_name"] = $form_info["form_name"];
$placeholders["form_url"] = $form_info["form_url"];
$placeholders["view_id"] = $view_id;
$placeholders["view_name"] = $view_info["view_name"];
$placeholders["settings"] = ft_get_settings();
$export_group_info = exp_get_export_group($export_group_id);
Beispiel #7
0
/**
 * Displays basic << 1 2 3 >> navigation for lists, each linking to the current page.
 *
 * This function has exactly the same purpose as display_page_nav, except that the pages are
 * hidden/shown with DHTML instead of separate server-side calls per page. This technique is better
 * for lists that contain a smaller number of items, e.g. the client and forms listing pages.
 *
 * ASSUMPTION: the JS counterpart function with the same function is defined in the calling page.
 * That function does all the work of hiding/showing pages, updating the "viewing X-Y"
 * text, enabling disabling the << and >> arrows, and storing the current page in sessions. This
 * function merely sets up the base HTML + JS.
 *
 * This function uses a dhtml_pagination.tpl Smarty template file, found in the current theme's root
 * folder.
 *
 * @param integer $num_results The total number of results found.
 * @param integer $num_per_page The max number of results to list per page.
 * @param integer $current_page The current page number being examined (defaults to 1).
 */
function ft_get_dhtml_page_nav($num_results, $num_per_page, $current_page = 1)
{
    global $g_smarty, $g_smarty_debug, $g_root_dir, $g_root_url, $LANG, $g_smarty_use_sub_dirs;
    $theme = $_SESSION["ft"]["account"]["theme"];
    $smarty = $g_smarty;
    // new Smarty();
    $smarty->template_dir = "{$g_root_dir}/themes/{$theme}";
    $smarty->compile_dir = "{$g_root_dir}/themes/{$theme}/cache/";
    $smarty->use_sub_dirs = $g_smarty_use_sub_dirs;
    $smarty->assign("LANG", $LANG);
    $smarty->assign("SESSION", $_SESSION["ft"]);
    $smarty->assign("g_root_dir", $g_root_dir);
    $smarty->assign("g_root_url", $g_root_url);
    $smarty->assign("samepage", ft_get_clean_php_self());
    $smarty->assign("num_results", $num_results);
    $smarty->assign("num_per_page", $num_per_page);
    $smarty->assign("current_page", $current_page);
    // find the range that's being displayed (e.g 11 to 20)
    $range_start = ($current_page - 1) * $num_per_page + 1;
    $range_end = $range_start + $num_per_page - 1;
    $range_end = $range_end > $num_results ? $num_results : $range_end;
    $smarty->assign("range_start", $range_start);
    $smarty->assign("range_end", $range_end);
    $viewing_range = "";
    if ($num_results > $num_per_page) {
        $replacement_info = array("startnum" => "<span id='nav_viewing_num_start'>{$range_start}</span>", "endnum" => "<span id='nav_viewing_num_end'>{$range_end}</span>");
        $viewing_range = ft_eval_smarty_string($LANG["phrase_viewing_range"], $replacement_info);
    }
    $smarty->assign("viewing_range", $viewing_range);
    $smarty->assign("total_pages", ceil($num_results / $num_per_page));
    // now process the template and return the HTML
    return $smarty->fetch(ft_get_smarty_template_with_fallback($theme, "dhtml_pagination.tpl"));
}
Beispiel #8
0
/**
 * This function lets you display the content generated from an export type into a webpage. You can
 * use this function on any export type in the database - even the ones that have been marked as "hidden". Note:
 * this function requires the Export Manager to be installed and enabled.
 *
 * @param integer $form_id
 * @param integer $view_id
 * @param integer $export_type_id
 * @param integer $page_num (defaults to 1)
 * @param array $options optional parameter that lets you configure the appearance of the data in a variety of ways.
 *
 *         num_per_page              - (integer) by default, it returns the number of results per page specified by
 *                                     the View. This setting overrides that.
 *         submission_ids            - (integer or array of integers) this limits the results returned to the submission ID
 *                                     or submission IDs specified in this field
 *         order                     - (string) the database column name with a -DESC or -ASC suffix (e.g. col_1-ASC).
 *         page_num_identifier       - (string) passed via the query string to denote what page it's on (default: "page")
 *         show_columns_only         - (boolean) limits the fields that are displayed to those fields marked as "Column"
 *                                     in the View. Defaults to false.
 *         return_as_string          - (boolean) if this value is set to true, instead of outputting the result it returns
 *                                     the HTML as a string.
 *         pagination_theme          - (string) the pagination links (<< 1 2 3 ...) HTML is generated by the pagination.tpl
 *                                     template, found in each of the theme folders. Generally this file is the same for
 *                                     all themes, but in case it isn't, this setting lets you choose the theme folder with
 *                                     which to render the HTML.
 *         pagination_location       - (string) accepts the values "top" (the default), "bottom", "both" or "none". This
 *                                     determines where (if anywhere) the pagination links should appear. By default it only
 *                                     appears at the top of the page, but you can set this value to either "both" or "bottom"
 *                                     to have it appear there instead / as well.
 *
 * @return mixed the return value of this function depends on the API settings & the options passed to it. Namely:
 *
 *     If error:
 *        if $g_api_debug == true, the error page will be displayed displaying the error code.
 *        if $g_api_debug == false, it returns an array with two indexes:
 *                   [0] false
 *                   [1] the API error code
 *     If successful:
 *        if "return_as_string" option key is set, it returns an array with two indexes:
 *                   [0] true
 *                   [1] the HTML content
 *        if "return_as_string" not set, it just prints the HTML to the page (the default behaviour)
 */
function ft_api_show_submissions($form_id, $view_id, $export_type_id, $page_num = 1, $options = array())
{
    global $g_table_prefix, $LANG, $g_api_debug, $g_smarty;
    // sanitize all incoming data
    $form_id = ft_sanitize($form_id);
    $view_id = ft_sanitize($view_id);
    $export_type_id = ft_sanitize($export_type_id);
    $page_num = ft_sanitize($page_num);
    $options = ft_sanitize($options);
    // check the Export Manager module is enabled
    if (ft_check_module_enabled("export_manager")) {
        ft_include_module("export_manager");
    } else {
        if ($g_api_debug) {
            $page_vars = array("message_type" => "error", "error_code" => 400, "error_type" => "user");
            ft_display_page("error.tpl", $page_vars);
            exit;
        } else {
            return array(false, 400);
        }
    }
    // check the form ID, View ID and export ID are valid
    $form_query = mysql_query("SELECT count(*) as c FROM {$g_table_prefix}forms WHERE form_id = {$form_id}");
    $result = mysql_fetch_assoc($form_query);
    $form_found = $result["c"] == 1 ? true : false;
    if (!$form_found) {
        if ($g_api_debug) {
            $page_vars = array("message_type" => "error", "error_code" => 401, "error_type" => "user");
            ft_display_page("error.tpl", $page_vars);
            exit;
        } else {
            return array(false, 401);
        }
    }
    $view_query = mysql_query("SELECT count(*) as c FROM {$g_table_prefix}views WHERE form_id = {$form_id} AND view_id = {$view_id}");
    $result = mysql_fetch_assoc($view_query);
    $view_found = $result["c"] == 1 ? true : false;
    if (!$view_found) {
        if ($g_api_debug) {
            $page_vars = array("message_type" => "error", "error_code" => 402, "error_type" => "user");
            ft_display_page("error.tpl", $page_vars);
            exit;
        } else {
            return array(false, 402);
        }
    }
    $export_type_query = mysql_query("SELECT count(*) as c FROM {$g_table_prefix}module_export_types WHERE export_type_id = {$export_type_id}");
    $result = mysql_fetch_assoc($export_type_query);
    $export_type_found = $result["c"] == 1 ? true : false;
    if (!$export_type_found) {
        if ($g_api_debug) {
            $page_vars = array("message_type" => "error", "error_code" => 403, "error_type" => "user");
            ft_display_page("error.tpl", $page_vars);
            exit;
        } else {
            return array(false, 403);
        }
    }
    // okay, now lets figure out what needs to be displayed & rendered
    $form_info = ft_get_form($form_id);
    $form_fields = ft_get_form_fields($form_id, array("include_field_type_info" => true, "include_field_settings" => true));
    $view_info = ft_get_view($view_id);
    $export_type_info = exp_get_export_type($export_type_id);
    $export_group_id = $export_type_info["export_group_id"];
    $export_group_info = exp_get_export_group($export_group_id);
    // number of submissions per page (an integer or "all")
    $num_per_page = $view_info["num_submissions_per_page"];
    if (isset($options["num_per_page"])) {
        $num_per_page = $options["num_per_page"];
    }
    $order = "{$view_info["default_sort_field"]}-{$view_info["default_sort_field_order"]}";
    if (isset($options["order"])) {
        $order = $options["order"];
    }
    $display_fields = array();
    $columns = "all";
    if (isset($options["show_columns_only"]) && $options["show_columns_only"]) {
        $columns = array();
        foreach ($view_info["columns"] as $view_field_info) {
            $curr_field_id = $view_field_info["field_id"];
            foreach ($form_fields as $form_field_info) {
                if ($form_field_info["field_id"] != $curr_field_id) {
                    continue;
                }
                $display_fields[] = array_merge($form_field_info, $view_field_info);
                $columns[] = $form_field_info["col_name"];
            }
        }
    } else {
        foreach ($view_info["fields"] as $view_field_info) {
            $curr_field_id = $view_field_info["field_id"];
            foreach ($form_fields as $form_field_info) {
                if ($form_field_info["field_id"] != $curr_field_id) {
                    continue;
                }
                $display_fields[] = array_merge($form_field_info, $view_field_info);
            }
        }
    }
    /*
    $columns = "all";
    if (isset($options["show_columns_only"]) && $options["show_columns_only"])
    {
      $columns = array();
      foreach ($view_info["columns"] as $view_col_info)
      {
        foreach ($display_fields as $field_info)
        {
          if ($field_info["field_id"] == $view_col_info["field_id"])
          {
            $columns[] = $field_info["col_name"];
          }
        }
      }
    }
    */
    $submission_ids = array();
    if (isset($options["submission_ids"])) {
        if (is_numeric($options["submission_ids"])) {
            $submission_ids[] = $options["submission_ids"];
        } else {
            if (is_array($submission_ids)) {
                $submission_ids = $options["submission_ids"];
            }
        }
    }
    // perform the almighty search query
    $results_info = ft_search_submissions($form_id, $view_id, $num_per_page, $page_num, $order, $columns, array(), $submission_ids);
    $search_num_results = $results_info["search_num_results"];
    $settings = ft_get_settings();
    // now build the list of information we're going to send to the export type smarty template
    $placeholders = exp_get_export_filename_placeholder_hash();
    $placeholders["export_group_id"] = $export_group_id;
    $placeholders["export_type_id"] = $export_type_id;
    $placeholders["export_group_results"] = "all";
    $placeholders["same_page"] = ft_get_clean_php_self();
    $placeholders["display_fields"] = $display_fields;
    $placeholders["submissions"] = $results_info["search_rows"];
    $placeholders["num_results"] = $results_info["search_num_results"];
    $placeholders["view_num_results"] = $results_info["view_num_results"];
    $placeholders["form_info"] = $form_info;
    $placeholders["view_info"] = $view_info;
    $placeholders["field_types"] = ft_get_field_types(true);
    $placeholders["settings"] = $settings;
    // ...
    $placeholders["date_format"] = $settings["default_date_format"];
    $placeholders["timezone_offset"] = $settings["timezone_offset"];
    // pull out a few things into top level placeholders for easy use
    $placeholders["form_name"] = $form_info["form_name"];
    $placeholders["form_id"] = $form_id;
    $placeholders["form_url"] = $form_info["form_url"];
    $placeholders["view_name"] = $view_info["view_name"];
    $placeholders["view_id"] = $view_id;
    $placeholders["export_group_name"] = ft_create_slug(ft_eval_smarty_string($export_group_info["group_name"]));
    $placeholders["export_group_type"] = ft_create_slug(ft_eval_smarty_string($export_type_info["export_type_name"]));
    $placeholders["filename"] = ft_eval_smarty_string($export_type_info["filename"], $placeholders, "", $g_smarty->plugins_dir);
    $template = $export_type_info["export_type_smarty_template"];
    $placeholders["export_type_name"] = $export_type_info["export_type_name"];
    $export_type_smarty_template = ft_eval_smarty_string($template, $placeholders, "", $g_smarty->plugins_dir);
    // if we're not displaying all results on the single page, generate the pagination HTML
    $pagination = "";
    if ($num_per_page != "all") {
        $page_num_identifier = isset($options["page_num_identifier"]) ? $options["page_num_identifier"] : "page";
        $theme = isset($options["pagination_theme"]) ? $options["pagination_theme"] : $settings["default_theme"];
        $pagination = ft_get_page_nav($search_num_results, $num_per_page, $page_num, "", $page_num_identifier, $theme);
    }
    $pagination_location = isset($options["pagination_location"]) ? $options["pagination_location"] : "top";
    switch ($pagination_location) {
        case "top":
            $html = $pagination . $export_type_smarty_template;
            break;
        case "both":
            $html = $pagination . $export_type_smarty_template . $pagination;
            break;
        case "bottom":
            $html = $export_type_smarty_template . $pagination;
            break;
        case "none":
            $html = $export_type_smarty_template;
            break;
            // this is in case the user entered an invalid value
        // this is in case the user entered an invalid value
        default:
            if ($g_api_debug) {
                $page_vars = array("message_type" => "error", "error_code" => 404, "error_type" => "user");
                ft_display_page("error.tpl", $page_vars);
                exit;
            } else {
                return array(false, 404);
            }
            break;
    }
    if (isset($options["return_as_string"]) && $options["return_as_string"]) {
        return array(true, $html);
    } else {
        echo $html;
    }
}