示例#1
0
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html($_POST['search_value']) : '';
        $search_select_value = isset($_POST['search_select_value']) ? (int) $_POST['search_select_value'] : 0;
        $asc_or_desc = isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc' ? 'desc' : 'asc';
        $order_by_array = array('id', 'title', 'mail');
        $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to create, edit forms.
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form onkeypress="fm_doNothing(event)" class="wrap" id="manage_form" method="post" action="admin.php?page=manage_fm" style="float: left; width: 99%;">
      <?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
      <span class="form_maker_icon"></span>
      <h2>
        Form Maker
        <a href="" class="add-new-h2" onclick="fm_set_input_value('task', 'add');
                                               fm_form_submit(event, 'manage_form')">Add new</a>
      </h2>
      <div class="tablenav top">
        <?php 
        WDW_FM_Library::search('Title', $search_value, 'manage_form');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'manage_form');
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;"/></th>
          <th class="table_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
            <a onclick="fm_set_input_value('task', '');
              fm_set_input_value('order_by', 'id');
              fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
              fm_form_submit(event, 'manage_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="<?php 
        if ($order_by == 'title') {
            echo $order_class;
        }
        ?>
">
            <a onclick="fm_set_input_value('task', '');
              fm_set_input_value('order_by', 'title');
              fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'title' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
              fm_form_submit(event, 'manage_form')" href="">
              <span>Title</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="<?php 
        if ($order_by == 'mail') {
            echo $order_class;
        }
        ?>
">
            <a onclick="fm_set_input_value('task', '');
              fm_set_input_value('order_by', 'mail');
              fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'mail' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
              fm_form_submit(event, 'manage_form')" href="">
              <span>Email to send submissions to</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="table_big_col">Shortcode</th>
          <th class="table_large_col">PHP function</th>
          <th class="table_big_col">Edit</th>
          <th class="table_big_col"><a title="Delete selected items" href="" onclick="if (confirm('Do you want to delete selected items?')) {
                                                       fm_set_input_value('task', 'delete_all');
                                                       fm_form_submit(event, 'manage_form');
                                                     } else {
                                                       return false;
                                                     }">Delete</a></th>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                $old = '';
                if (isset($row_data->form) && $row_data->form != '') {
                    $old = '_old';
                }
                ?>
              <tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column">
                  <input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox"/>
                </td>
                <td class="table_small_col"><?php 
                echo $row_data->id;
                ?>
</td>
                <td>
                  <a onclick="fm_set_input_value('task', 'edit<?php 
                echo $old;
                ?>
');
                              fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              fm_form_submit(event, 'manage_form')" href="" title="Edit"><?php 
                echo $row_data->title;
                ?>
</a>
                </td>
                <td><?php 
                echo $row_data->mail;
                ?>
</td>
                <td class="table_big_col" style="padding-left: 0; padding-right: 0;">
                  <input type="text" value='[Form id="<?php 
                echo $row_data->id;
                ?>
"]' onclick="fm_select_value(this)" size="12" readonly="readonly" style="padding-left: 1px; padding-right: 1px;"/>
                </td>
                <td class="table_large_col" style="padding-left: 0; padding-right: 0;">
                  <input type="text" value='&#60;?php wd_form_maker(<?php 
                echo $row_data->id;
                ?>
); ?&#62;' onclick="fm_select_value(this)"  readonly="readonly" style="padding-left: 1px; padding-right: 1px;"/>
                </td>
                <td class="table_big_col">
                  <a onclick="fm_set_input_value('task', 'edit<?php 
                echo $old;
                ?>
');
                              fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              fm_form_submit(event, 'manage_form')" href="">Edit</a>
                </td>
                <td class="table_big_col">
                  <a onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete');
                    fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'manage_form'); } else { return false; }" href="">Delete</a>
                </td>
              </tr>
              <?php 
                $ids_string .= $row_data->id . ',';
            }
        }
        ?>
        </tbody>
      </table>
      <input id="task" name="task" type="hidden" value=""/>
      <input id="current_id" name="current_id" type="hidden" value=""/>
      <input id="ids_string" name="ids_string" type="hidden" value="<?php 
        echo $ids_string;
        ?>
"/>
      <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc"/>
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
"/>
    </form>
    <?php 
    }
    public function display($form_id)
    {
        global $wpdb;
        $forms = $this->model->get_form_titles();
        $statistics = $this->model->get_statistics($form_id);
        $labels_parameters = $this->model->get_labels_parameters($form_id);
        $sorted_labels_id = $labels_parameters[0];
        $sorted_label_types = $labels_parameters[1];
        $lists = $labels_parameters[2];
        $sorted_label_names = $labels_parameters[3];
        $sorted_label_names_original = $labels_parameters[4];
        $rows = isset($labels_parameters[5]) ? $labels_parameters[5] : NULL;
        $group_ids = isset($labels_parameters[6]) ? $labels_parameters[6] : NULL;
        $where_choices = $labels_parameters[7];
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'desc';
        $style_id = $this->model->hide_or_not($lists['hide_label_list'], '@submitid@');
        $style_date = $this->model->hide_or_not($lists['hide_label_list'], '@submitdate@');
        $style_ip = $this->model->hide_or_not($lists['hide_label_list'], '@submitterip@');
        $style_username = $this->model->hide_or_not($lists['hide_label_list'], '@submitterusername@');
        $style_useremail = $this->model->hide_or_not($lists['hide_label_list'], '@submitteremail@');
        $oder_class_default = "manage-column column-autor sortable desc";
        $oder_class = "manage-column column-title sorted " . $asc_or_desc;
        $ispaypal = FALSE;
        $temp = array();
        $m = count($sorted_label_names);
        $n = count($rows);
        $group_id_s = array();
        $group_id_s = $this->model->sort_group_ids(count($sorted_label_names), $group_ids);
        $ka_fielderov_search = $lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search'] ? TRUE : FALSE;
        $is_stats = false;
        $blocked_ips = $this->model->blocked_ips();
        ?>
    <script type="text/javascript">
      function clickLabChBAll(ChBAll) {
        <?php 
        if (isset($sorted_label_names)) {
            $templabels = array_merge(array('submitid', 'submitdate', 'submitterip', 'submitterusername', 'submitteremail'), $sorted_labels_id);
            $sorted_label_names_for_check = array_merge(array('ID', 'Submit date', "Submitter's IP", "Submitter's Username", "Submitter's Email Address"), $sorted_label_names_original);
        } else {
            $templabels = array('submitid', 'submitdate', 'submitterip', 'submitterusername', 'submitteremail');
            $sorted_label_names_for_check = array('ID', 'Submit date', "Submitter's IP", 'Submitter\'s Username', 'Submitter\'s Email Address');
        }
        ?>
        if (ChBAll.checked) {
          document.forms.admin_form.hide_label_list.value = '';
          for (i = 0; i <= ChBAll.form.length; i++) {
            if (typeof(ChBAll.form[i]) != "undefined") {
              if (ChBAll.form[i].type == "checkbox") {
                ChBAll.form[i].checked = true;
              }
            }
          }
        }
        else {
          document.forms.admin_form.hide_label_list.value = '@<?php 
        echo implode($templabels, '@@');
        ?>
@' + '@payment_info@';
          for (i = 0; i <= ChBAll.form.length; i++) {
            if (typeof(ChBAll.form[i]) != "undefined") {
              if (ChBAll.form[i].type == "checkbox") {
                ChBAll.form[i].checked = false;
              }
            }
          }
        }
        renderColumns();
      }
      function remove_all() {
        document.getElementById('startdate').value = '';
        document.getElementById('enddate').value = '';
        document.getElementById('ip_search').value = '';
		document.getElementById('username_search').value='';
		document.getElementById('useremail_search').value='';
        <?php 
        $n = count($rows);
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            if ($sorted_label_types[$i] != "type_mark_map") {
                ?>
            document.getElementById('<?php 
                echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                ?>
').value='';
            <?php 
            }
        }
        ?>
      }
      function show_hide_filter() {
        if (document.getElementById('fields_filter').style.display == "none") {
          document.getElementById('fields_filter').style.display = '';
          document.getElementById('filter_img').src = '<?php 
        echo WD_FM_URL . '/images/filter_hide.png';
        ?>
';
        }
        else {
          document.getElementById('fields_filter').style.display = "none";
          document.getElementById('filter_img').src = '<?php 
        echo WD_FM_URL . '/images/filter_show.png';
        ?>
';
        }
      }
      jQuery(document).ready(function () { 
        jQuery('.theme-detail').click(function () {
          jQuery(this).siblings('.themedetaildiv').toggle();
          return false;
        });
      });
    </script>
    <div id="sbox-overlay" onclick="toggleChBDiv(false)"
       style="z-index: 65555; position: fixed; top: 0px; left: 0px; visibility: visible; zoom: 1; background-color: #000000; opacity: 0.7; filter: alpha(opacity=70); display: none;">
    </div>
    <div style="background-color: #FFFFFF; width: 350px; max-height: 350px; overflow-y: auto; padding: 20px; position: fixed; top: 100px; display: none; border: 2px solid #AAAAAA;  z-index: 65556;" id="ChBDiv">
      <form action="#">
        <p style="font-weight: bold; font-size: 18px; margin-top: 0px;">Select Columns</p>
        <div class="fm_check_labels"><input type="checkbox" <?php 
        echo $lists['hide_label_list'] === '' ? 'checked="checked"' : '';
        ?>
 onclick="clickLabChBAll(this)" id="ChBAll"/><label for="ChBAll"> All</label></div>
        <?php 
        foreach ($templabels as $key => $curlabel) {
            if (strpos($lists['hide_label_list'], '@' . $curlabel . '@') === FALSE) {
                ?>
        <div class="fm_check_labels"><input type="checkbox" checked="checked" onclick="clickLabChB('<?php 
                echo $curlabel;
                ?>
', this)" id="fm_check_id_<?php 
                echo $curlabel;
                ?>
" /><label for="fm_check_id_<?php 
                echo $curlabel;
                ?>
"> <?php 
                echo stripslashes($sorted_label_names_for_check[$key]);
                ?>
</label></div>
            <?php 
            } else {
                ?>
        <div class="fm_check_labels"><input type="checkbox" onclick="clickLabChB('<?php 
                echo $curlabel;
                ?>
', this)" id="fm_check_id_<?php 
                echo $curlabel;
                ?>
"/><label for="fm_check_id_<?php 
                echo $curlabel;
                ?>
"> <?php 
                echo stripslashes($sorted_label_names_for_check[$key]);
                ?>
</label></div>
            <?php 
            }
        }
        $ispaypal = FALSE;
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
                $ispaypal = TRUE;
            }
        }
        if ($ispaypal) {
            ?>
        <div class="fm_check_labels">
          <input type="checkbox" onclick="clickLabChB('payment_info', this)" id="fm_check_payment_info" <?php 
            echo strpos($lists['hide_label_list'], '@payment_info@') === FALSE ? 'checked="checked"' : '';
            ?>
 />
          <label for="fm_check_payment_info"> Payment Info</label>
        </div>
	        <?php 
        }
        ?>
        <div style="text-align: center; padding: 20px;">
          <input type="button" class="button-secondary" onclick="toggleChBDiv(false);" value="Done" />
        </div>
      </form>
    </div>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to view and manage form submissions.
        <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-form-maker-guide-6.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="http://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form action="admin.php?page=submissions_fm" method="post" id="admin_form" name="admin_form">
      <input type="hidden" name="option" value="com_formmaker" />
      <input type="hidden" id="task" name="task" value="" />
      <input type="hidden" id="current_id" name="current_id" value="" />
      <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
        echo $asc_or_desc;
        ?>
" />
      <input type="hidden" name="order_by" id="order_by" value="<?php 
        echo $order_by;
        ?>
" />
      <br />
      <table width="99%">
        <tr style="line-height: inherit !important;">
          <td align="left" width="300">
            <select name="form_id" id="form_id" style="width:99%" onchange="document.admin_form.submit();">
              <option value="0" selected="selected"> - Select a Form - </option>
              <?php 
        if ($forms) {
            foreach ($forms as $form) {
                ?>
              <option value="<?php 
                echo $form->id;
                ?>
" <?php 
                if ($form_id == $form->id) {
                    $chosen_form_title = $form->title;
                    echo 'selected="selected"';
                }
                ?>
> <?php 
                echo $form->title;
                ?>
 </option>
                  <?php 
            }
        }
        ?>
            </select>
          </td>
          <?php 
        if ($form_id > 0) {
            ?>
          <td class="reports"><strong>Entries</strong><br /><?php 
            echo $statistics["total_entries"];
            ?>
</td>
          <td class="reports"><strong>Views</strong><br /><?php 
            echo $statistics["total_views"];
            ?>
</td>
          <td class="reports"><strong>Conversion Rate</strong><br/><?php 
            echo $statistics["conversion_rate"];
            ?>
</td>
          <td class="form_title">
            <span class="form_title_cont" title="<?php 
            echo $chosen_form_title;
            ?>
"><?php 
            echo $chosen_form_title;
            ?>
</span>
          </td>
          <td style="text-align: right;" width="300">
            <span class="exp_but_span">Export to</span>
            <input type="button" class="button-secondary" value="CSV" onclick="window.location='<?php 
            echo add_query_arg(array('action' => 'generete_csv', 'form_id' => $form_id), admin_url('admin-ajax.php'));
            ?>
'" />&nbsp;
            <input type="button" class="button-secondary" value="XML" onclick="window.location='<?php 
            echo add_query_arg(array('action' => 'generete_xml', 'form_id' => $form_id), admin_url('admin-ajax.php'));
            ?>
'" />
          </td>			
        </tr>       
        <tr>
          <td align="left" colspan="4">
            <input type="hidden" name="hide_label_list" value="<?php 
            echo $lists['hide_label_list'];
            ?>
" />
            <img src="<?php 
            echo WD_FM_URL . '/images/filter_show.png';
            ?>
" width="40" style="vertical-align: bottom; cursor: pointer;" onclick="show_hide_filter()" title="Search by fields" id="filter_img" />
            <input type="button" class="button-secondary" onclick="spider_form_submit(event, 'admin_form')" value="Go" />
            <input type="button" class="button-secondary" onclick="remove_all(); spider_form_submit(event, 'admin_form')" value="Reset" />
          </td>
          <td align="right" colspan="2">
            <br />
            <?php 
            if (isset($sorted_label_names)) {
                ?>
            <input type="button" class="button-secondary" onclick="toggleChBDiv(true)" value="Add/Remove Columns" />
              <?php 
            }
            ?>
            <input class="button-secondary" type="button" onclick="spider_set_input_value('task', 'block_ip'); spider_form_submit(event, 'admin_form')" value="Block IP" />
            <input class="button-secondary" type="button" onclick="spider_set_input_value('task', 'unblock_ip'); spider_form_submit(event, 'admin_form')" value="Unblock IP" />
            <input class="button-secondary" type="button" onclick="if (confirm('Do you want to delete selected items?')) {
                                                                     spider_set_input_value('task', 'delete_all');
                                                                     spider_form_submit(event, 'admin_form')
                                                                   } else {
                                                                     return false;
                                                                   }" value="Delete"/>
          </td>
        </tr>
          <?php 
        } else {
            ?>
          <td></td>
        </tr>
            <?php 
        }
        ?>
      </table>
      <div class="tablenav top" style="width: 99%;">
        <?php 
        WDW_FM_Library::html_page_nav($lists['total'], $lists['limit'], 'admin_form');
        ?>
      </div>    
      <div class="submit_content" style="width: 99%;">
        <table class="wp-list-table widefat fixed posts table_content">
          <thead>
            <tr>
              <th class="table_small_col count_col sub-align">#</th>
              <th scope="col" id="cb" class="manage-column column-cb check-column table_small_col sub-align form_check"><input id="check_all" type="checkbox"></th>
              <th scope="col" id="submitid_fc" class="table_small_col sub-align submitid_fc <?php 
        if ($order_by == "group_id") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_id;
        ?>
>
                <a href="" class="sub_id" onclick="spider_set_input_value('order_by', 'group_id');
                                                   spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'group_id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                                   spider_form_submit(event, 'admin_form')">
                  <span>ID</span>
                  <span class="sorting-indicator" style="margin-top: 8px;"></span>
                </a>
              </th>
              <th class="table_small_col sub-align">Edit</th>
              <th class="table_small_col sub-align">Delete</th>
              <th scope="col" id="submitdate_fc" class="table_large_col submitdate_fc <?php 
        if ($order_by == "date") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_date;
        ?>
>
                <a href="" onclick="spider_set_input_value('order_by', 'date');
                                    spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'date' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span>Submit date</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>
              <th scope="col" id="submitterip_fc" class="table_medium_col_uncenter submitterip_fc <?php 
        if ($order_by == "ip") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_ip;
        ?>
>
                <a href="" onclick="spider_set_input_value('order_by', 'ip');
                                    spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'ip' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span>Submitter's IP</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>	
			  
			   <th scope="col" id="submitterusername_fc" class="table_medium_col_uncenter submitterusername_fc <?php 
        if ($order_by == "display_name") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_username;
        ?>
>
                <a href="" onclick="spider_set_input_value('order_by', 'display_name');
                                    spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'display_name' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span>Submitter's Username</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>	
			  
			  <th scope="col" id="submitteremail_fc" class="table_medium_col_uncenter submitteremail_fc <?php 
        if ($order_by == "user_email") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_useremail;
        ?>
>
                <a href="" onclick="spider_set_input_value('order_by', 'user_email');
                                    spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'user_email' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span>Submitter's Email Address</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>	
			  
			
              <?php 
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
            $styleStr2 = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
            $field_title = $this->model->get_type_address($sorted_label_types[$i], $sorted_label_names_original[$i]);
            if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
                $ispaypal = TRUE;
                ?>
              <th <?php 
                echo $styleStr;
                ?>
 id="<?php 
                echo $sorted_labels_id[$i] . '_fc';
                ?>
" class="table_large_col <?php 
                echo $sorted_labels_id[$i] . '_fc';
                if ($order_by == $sorted_labels_id[$i] . "_field") {
                    echo $oder_class . '"';
                } else {
                    echo $oder_class_default . '"';
                }
                ?>
">
                <a href="" onclick="spider_set_input_value('order_by', '<?php 
                echo $sorted_labels_id[$i] . '_field';
                ?>
');
                                    spider_set_input_value('asc_or_desc', '<?php 
                echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == $sorted_labels_id[$i] . '_field' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
                ?>
');
                                    spider_form_submit(event, 'admin_form')">	
                  <span><?php 
                echo $field_title;
                ?>
</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>
              <th class="table_large_col payment_info_fc" <?php 
                echo $styleStr2;
                ?>
>Payment Info</th>
                  <?php 
            } else {
                ?>
              <th <?php 
                echo $styleStr;
                ?>
 id="<?php 
                echo $sorted_labels_id[$i] . '_fc';
                ?>
" class="<?php 
                echo $sorted_label_types[$i] == 'type_mark_map' || $sorted_label_types[$i] == 'type_matrix' ? 'table_large_col ' : '';
                echo $sorted_labels_id[$i] . '_fc';
                if ($order_by == $sorted_labels_id[$i] . "_field") {
                    echo $oder_class . '"';
                } else {
                    echo $oder_class_default . '"';
                }
                ?>
">
                <a href="" onclick="spider_set_input_value('order_by', '<?php 
                echo $sorted_labels_id[$i] . '_field';
                ?>
');
                                    spider_set_input_value('asc_or_desc', '<?php 
                echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == $sorted_labels_id[$i] . '_field' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
                ?>
');
                                    spider_form_submit(event, 'admin_form')">
                  <span><?php 
                echo $field_title;
                ?>
</span>
                  <span class="sorting-indicator"></span>
                </a>
              </th>
                  <?php 
            }
        }
        ?>
		           
            </tr>
            <tr id="fields_filter" style="display: none;">
              <th></th>
              <th></th>
              <th></th>
              <th></th>
              <th class="submitid_fc" <?php 
        echo $style_id;
        ?>
 ></th>
              <th width="150" class="submitdate_fc" <?php 
        echo $style_date;
        ?>
>
                <table align="center" style="margin:auto" class="simple_table">
                  <tr class="simple_table">
                    <td class="simple_table" style="text-align: left;">From:</td>
                    <td style="text-align: center;" class="simple_table">
                      <input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php 
        echo $lists['startdate'];
        ?>
" />
                    </td>
                    <td style="text-align: center;" class="simple_table">
                      <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');" />
                    </td>
                  </tr>
                  <tr class="simple_table">
                    <td style="text-align: left;" class="simple_table">To:</td>
                    <td style="text-align: center;" class="simple_table">
                      <input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php 
        echo $lists['enddate'];
        ?>
" />
                    </td>
                    <td style="text-align: center;" class="simple_table">
                      <input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('enddate','%Y-%m-%d');" />
                    </td>
                  </tr>
                </table>
              </th>
              <th class="table_medium_col_uncenter submitterip_fc" <?php 
        echo $style_ip;
        ?>
>
                <input type="text" name="ip_search" id="ip_search" value="<?php 
        echo $lists['ip_search'];
        ?>
" onChange="this.form.submit();" />
              </th>
			
			   </th>
              <th class="table_medium_col_uncenter submitterusername_fc" <?php 
        echo $style_username;
        ?>
>
                <input type="text" name="username_search" id="username_search" value="<?php 
        echo $lists['username_search'];
        ?>
" onChange="this.form.submit();" />
              </th>
			  
			  </th>
              <th class="table_medium_col_uncenter submitteremail_fc" <?php 
        echo $style_useremail;
        ?>
>
                <input type="text" name="useremail_search" id="useremail_search" value="<?php 
        echo $lists['useremail_search'];
        ?>
" onChange="this.form.submit();" />
              </th>
			  
              <?php 
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
            if (!$ka_fielderov_search) {
                if ($lists[$form_id . '_' . $sorted_labels_id[$i] . '_search']) {
                    $ka_fielderov_search = TRUE;
                }
            }
            switch ($sorted_label_types[$i]) {
                case 'type_mark_map':
                    ?>
                      <th class="table_large_col <?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
></th>
                      <?php 
                    break;
                case 'type_paypal_payment_status':
                    ?>
                      <th class="table_large_col <?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
>
                        <select style="font-size: 11px; margin: 0; padding: 0; height: inherit;" name="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search" id="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search" onChange="this.form.submit();" value="<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
" >
                          <option value="" ></option>
                          <option value="canceled" >Canceled</option>
                          <option value="cleared" >Cleared</option>
                          <option value="cleared by payment review" >Cleared by payment review</option>
                          <option value="completed" >Completed</option>
                          <option value="denied" >Denied</option>
                          <option value="failed" >Failed</option>
                          <option value="held" >Held</option>
                          <option value="in progress" >In progress</option>
                          <option value="on hold" >On hold</option>
                          <option value="paid" >Paid</option>
                          <option value="partially refunded" >Partially refunded</option>
                          <option value="pending verification" >Pending verification</option>
                          <option value="placed" >Placed</option>
                          <option value="processing" >Processing</option>
                          <option value="refunded" >Refunded</option>
                          <option value="refused" >Refused</option>
                          <option value="removed" >Removed</option>
                          <option value="returned" >Returned</option>
                          <option value="reversed" >Reversed</option>
                          <option value="temporary hold" >Temporary hold</option>
                          <option value="unclaimed" >Unclaimed</option>
                        </select>	
                        <script> 
                          var element = document.getElementById('<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search');
                          element.value = '<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
';
                        </script>
                      </th>
                      <th class="table_large_col  payment_info_fc" <?php 
                    echo $styleStr2;
                    ?>
></th>
                      <?php 
                    break;
                default:
                    ?>
                      <th class="<?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
>
                        <input name="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                    ?>
" id="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                    ?>
" type="text" value="<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
"  onChange="this.form.submit();" >
                      </th>
                      <?php 
                    break;
            }
        }
        ?>
            </tr>
          </thead>
          <?php 
        $k = 0;
        for ($www = 0, $qqq = count($group_id_s); $www < $qqq; $www++) {
            $i = $group_id_s[$www];
            $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
            $temp = $this->model->array_for_group_id($group_id_s[$www], $rows);
            $data = $temp[0];
            $userinfo = get_userdata($data->user_id_wd);
            $useremail = $userinfo ? $userinfo->user_email : "";
            $username = $userinfo ? $userinfo->display_name : "";
            ?>
            <tr <?php 
            echo $alternate;
            ?>
>
              <td class="table_small_col count_col sub-align"><?php 
            echo $www + 1;
            ?>
</td>
              <th class="check-column table_small_col sub-align" style="padding: 0;">
                <input type="checkbox" name="post[]" value="<?php 
            echo $data->group_id;
            ?>
">
              </th>   
              <td class="table_small_col sub-align submitid_fc" id="submitid_fc" <?php 
            echo $style_id;
            ?>
>
                <a href="" onclick="spider_set_input_value('task', 'edit');						  
                                    spider_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
);
                                    spider_form_submit(event, 'admin_form');" ><?php 
            echo $data->group_id;
            ?>
                </a>
              </td> 
              <td class="table_small_col sub-align">
                <a href="" onclick="spider_set_input_value('task', 'edit');						  
                                    spider_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
);
                                    spider_form_submit(event, 'admin_form');">Edit
                </a>
              </td>
              <td class="table_small_col sub-align">
                <a href="" onclick="spider_set_input_value('task', 'delete');						  
                                    spider_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
);
                                    spider_form_submit(event, 'admin_form');">Delete
                </a>
              </td>		 
              <td  class="table_large_col submitdate_fc sub-align" id="submitdate_fc" <?php 
            echo $style_date;
            ?>
>
                <a href="" onclick="spider_set_input_value('task', 'edit');						  
                                    spider_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
);
                                    spider_form_submit(event, 'admin_form');" ><?php 
            echo $data->date;
            ?>
                </a>
              </td>
              <td class="table_medium_col_uncenter submitterip_fc sub-align" id="submitterip_fc" <?php 
            echo $style_ip;
            ?>
>
                <a class="thickbox-preview" href="<?php 
            echo add_query_arg(array('action' => 'fromipinfoinpopup', 'data_ip' => $data->ip, 'width' => '400', 'height' => '300', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
            ?>
" title="Show submitter information" <?php 
            echo !in_array($data->ip, $blocked_ips) ? '' : 'style="color: #FF0000;"';
            ?>
><?php 
            echo $data->ip;
            ?>
</a>
              </td>
			  
			  
			  
			  <td  class="table_large_col submitterusername_fc sub-align" id="submitterusername_fc" <?php 
            echo $style_username;
            ?>
>
               <?php 
            echo $username;
            ?>
              </td>
			  
			  <td  class="table_large_col submitteremail_fc sub-align" id="submitteremail_fc" <?php 
            echo $style_useremail;
            ?>
>
                <?php 
            echo $useremail;
            ?>
              </td>
			  
			  
			  
              <?php 
            for ($h = 0; $h < $m; $h++) {
                $not_label = TRUE;
                for ($g = 0; $g < count($temp); $g++) {
                    $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$h]);
                    if ($temp[$g]->element_label == $sorted_labels_id[$h]) {
                        if (strpos($temp[$g]->element_value, "***map***")) {
                            $map_params = explode('***map***', $temp[$g]->element_value);
                            ?>
              <td class="table_large_col <?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <a class="thickbox-preview" href="<?php 
                            echo add_query_arg(array('action' => 'frommapeditinpopup', 'long' => $map_params[0], 'lat' => $map_params[1], 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                            ?>
" title="Show on Map">Show on Map</a>
              </td>
                    <?php 
                        } elseif (strpos($temp[$g]->element_value, "*@@url@@*")) {
                            ?>
              <td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                      <?php 
                            $new_files = explode("*@@url@@*", $temp[$g]->element_value);
                            foreach ($new_files as $new_file) {
                                if ($new_file) {
                                    $new_filename = explode('/', $new_file);
                                    $new_filename = $new_filename[count($new_filename) - 1];
                                    ?>
                <a target="_blank" class="fm_fancybox" rel="group_<?php 
                                    echo $www;
                                    ?>
" href="<?php 
                                    echo $new_file;
                                    ?>
"><?php 
                                    echo $new_filename;
                                    ?>
</a><br />
                          <?php 
                                }
                            }
                            ?>
              </td>
                      <?php 
                        } elseif (strpos($temp[$g]->element_value, "***star_rating***")) {
                            $view_star_rating_array = $this->model->view_for_star_rating($temp[$g]->element_value, $temp[$g]->element_label);
                            $stars = $view_star_rating_array[0];
                            ?>
              <td align="center" class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
><?php 
                            echo $stars;
                            ?>
</td>
                      <?php 
                        } elseif (strpos($temp[$g]->element_value, "***matrix***")) {
                            ?>
   
              <td class="table_large_col <?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <a class="thickbox-preview" href="<?php 
                            echo add_query_arg(array('action' => 'show_matrix', 'matrix_params' => $temp[$g]->element_value, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                            ?>
" title="Show Matrix">Show Matrix</a>
              </td>
                      <?php 
                        } elseif (strpos($temp[$g]->element_value, "@@@") !== FALSE || $temp[$g]->element_value == "@@@" || $temp[$g]->element_value == "@@@@@@@@@") {
                            ?>
              <td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <p><?php 
                            echo str_replace("@@@", " ", $temp[$g]->element_value);
                            ?>
</p>
              </td>
                      <?php 
                        } elseif (strpos($temp[$g]->element_value, "***grading***")) {
                            $view_grading_array = $this->model->view_for_grading($temp[$g]->element_value);
                            $items = $view_grading_array[0];
                            ?>
              <td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <p><?php 
                            echo $items;
                            ?>
</p>
              </td>
                      <?php 
                        } else {
                            if (strpos($temp[$g]->element_value, "***quantity***")) {
                                $temp[$g]->element_value = str_replace("***quantity***", " ", $temp[$g]->element_value);
                            }
                            if (strpos($temp[$g]->element_value, "***property***")) {
                                $temp[$g]->element_value = str_replace("***property***", " ", $temp[$g]->element_value);
                            }
                            ?>
              <td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
                <p><?php 
                            echo str_replace("***br***", '<br>', stripslashes($temp[$g]->element_value));
                            ?>
</p>
              </td>
                      <?php 
                        }
                        $not_label = FALSE;
                    }
                }
                if ($not_label) {
                    ?>
              <td class="<?php 
                    echo $sorted_labels_id[$h];
                    ?>
_fc sub-align" id="<?php 
                    echo $sorted_labels_id[$h];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
><p>&nbsp;</p></td>
                  <?php 
                }
            }
            if ($ispaypal) {
                $styleStr = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
                ?>
              <td class="table_large_col payment_info_fc sub-align" id="payment_info_fc" <?php 
                echo $styleStr;
                ?>
>
                <a class="thickbox-preview" href="<?php 
                echo add_query_arg(array('action' => 'paypal_info', 'id' => $i, 'width' => '600', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                ?>
">
                  <img src="<?php 
                echo WD_FM_URL . '/images/info.png';
                ?>
" />
                </a>
              </td>
                <?php 
            }
            ?>
            </tr>
            <?php 
            $k = 1 - $k;
        }
        ?>
        </table>
      </div>	 
      <?php 
        if ($sorted_label_types) {
            foreach ($sorted_label_types as $key => $sorted_label_type) {
                if ($this->model->check_radio_type($sorted_label_type)) {
                    $is_stats = true;
                    break;
                }
            }
            if ($is_stats) {
                ?>
		  <br /><br />
		  <h1 style="border-bottom: 1px solid; padding-bottom:7px; width:99%; color: hsl(197, 100%, 32%);">Statistics</h1>		
		  <table class="wp-list-table widefat fixed posts table_content" style="width: 99%;">
		    <tr>
          <td class="key" style="vertical-align: middle;width: 9%">
            <label for="sorted_label_key">Select a Field:</label>
          </td>
          <td width="330">
            <select id="sorted_label_key">
              <option value="">Select a Field</option>
                <?php 
                foreach ($sorted_label_types as $key => $sorted_label_type) {
                    if ($sorted_label_type == "type_checkbox" || $sorted_label_type == "type_radio" || $sorted_label_type == "type_own_select" || $sorted_label_type == "type_country" || $sorted_label_type == "type_paypal_select" || $sorted_label_type == "type_paypal_radio" || $sorted_label_type == "type_paypal_checkbox" || $sorted_label_type == "type_paypal_shipping") {
                        ?>
                    <option value="<?php 
                        echo $key;
                        ?>
"><?php 
                        echo $sorted_label_names_original[$key];
                        ?>
</option>
                    <?php 
                    }
                }
                ?>
            </select>
          </td>
          <td></td>
		    </tr>
		    <tr>
          <td class="key" style="vertical-align: middle;">
            <label>Select a Date:</label>
          </td>
          <td width="330">
            From: <input class="inputbox"  type="text" name="startstats" id="startstats" size="9" maxlength="9" />
                  <input type="reset" class="button" style="width: 22px; border-radius: 3px !important;"  value="..." name="startstats_but" id="startstats_but" onclick="return showCalendar('startstats','%Y-%m-%d');" /> 
                     
            To: <input class="inputbox" type="text" name="endstats" id="endstats" size="9" maxlength="9" />
                <input type="reset" class="button" style="width: 22px; border-radius: 3px !important;"  value="..." name="endstats_but" id="endstats_but" onclick="return showCalendar('endstats','%Y-%m-%d');" />
          </td>
          <td class="key" style="vertical-align: middle;">
            <input type="button" onclick="show_stats()" class="button-secondary" value="Show">
          </td>
		    </tr>
		  </table>
		  <div id="div_stats"></div>	
        <?php 
            }
        }
        ?>
    </form>	
    <script> 
      jQuery(window).load(function() {
        spider_popup();
        if (typeof jQuery().fancybox !== 'undefined' && jQuery.isFunction(jQuery().fancybox)) {
          jQuery(".fm_fancybox").fancybox({
            'maxWidth ' : 600,
            'maxHeight' : 500
          });
        }
      });
	  function show_stats() { 
		jQuery('#div_stats').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
		if(jQuery('#sorted_label_key').val()!="") {	 	  
		  jQuery('#div_stats').load('<?php 
        echo add_query_arg(array('action' => 'get_stats', 'page' => 'submissions_fm'), admin_url('admin-ajax.php'));
        ?>
', { 
		    'task': 'show_stats',
		    'form_id' : '<?php 
        echo $form_id;
        ?>
',
		    'sorted_label_key' : jQuery('#sorted_label_key').val(),
			'startdate' : jQuery('#startstats').val(), 
			'enddate' : jQuery('#endstats').val()
		    });
	    }		
		else
		  jQuery('#div_stats').html("Please select the field!")
	  }
      <?php 
        if ($ka_fielderov_search) {
            ?>
 
        document.getElementById('fields_filter').style.display = '';
        <?php 
        }
        ?>
    </script>
    <?php 
    }
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : '';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'desc';
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div id="fm_blocked_ips_message" style="width: 99%; display: none;"></div>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to block IPs.
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form onkeypress="spider_doNothing(event)" class="wrap" id="blocked_ips" method="post" action="admin.php?page=blocked_ips_fm" style="float: left; width: 99%;">
      <?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
      <span class="block_icon"></span>
      <h2>Blocked IPs</h2>
      <div class="buttons_div">
        <input class="button-primary" type="submit" value="Save" onclick="spider_set_input_value('task', 'save_all');" />
        <input class="button-secondary" type="submit" value="Delete" onclick="if (confirm('Do you want to unblock selected IPs?')) {
                                                                      spider_set_input_value('task', 'delete_all');
                                                                    } else {
                                                                      return false;
                                                                    }" />
      </div>
      <div class="tablenav top">
        <?php 
        WDW_FM_Library::search('IP', $search_value, 'blocked_ips');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'blocked_ips');
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <tr>
            <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin: 0;" /></th>
            <th class="table_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'id');
                          spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'blocked_ips')" href="">
                <span>ID</span><span class="sorting-indicator"></span></th>
              </a>
            <th class="<?php 
        if ($order_by == 'ip') {
            echo $order_class;
        }
        ?>
">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'ip');
                          spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'ip' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'blocked_ips')" href="">
                <span>IP</span><span class="sorting-indicator"></span>
              </a>
            </th>
            <th class="table_big_col">Edit</th>
            <th class="table_big_col">Delete</th>
          </tr>		  
          <tr id="tr">
            <th></th>
            <th></th>
            <th class="edit_input"><input type="text" class="input_th" id="ip" name="ip" onkeypress="return spider_check_isnum(event)"></th>
            <th class="table_big_col">
              <a class="add_tag_th button-primary button button-small" onclick="if (spider_check_required('ip', 'IP')) {return false;}
                                                                                spider_set_input_value('task', 'save');
                                                                                spider_set_input_value('current_id', '');
                                                                                spider_form_submit(event, 'blocked_ips')" href="">Add IP</a>
            </th>
            <th></th>
          </tr>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
              <tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column" id="td_check_<?php 
                echo $row_data->id;
                ?>
" >
                  <input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox" />
                </td>
                <td class="table_small_col" id="td_id_<?php 
                echo $row_data->id;
                ?>
" ><?php 
                echo $row_data->id;
                ?>
</td>
                <td id="td_ip_<?php 
                echo $row_data->id;
                ?>
" >
                  <a class="pointer" id="ip<?php 
                echo $row_data->id;
                ?>
"
                     onclick="spider_edit_ip(<?php 
                echo $row_data->id;
                ?>
)" 
                     title="Edit"><?php 
                echo $row_data->ip;
                ?>
</a>
                </td>
                <td class="table_big_col" id="td_edit_<?php 
                echo $row_data->id;
                ?>
">
                  <a onclick="spider_edit_ip(<?php 
                echo $row_data->id;
                ?>
)">Edit</a>
                </td>
                <td class="table_big_col" id="td_delete_<?php 
                echo $row_data->id;
                ?>
">
                  <a onclick="spider_set_input_value('task', 'delete');
                              spider_set_input_value('current_id', <?php 
                echo $row_data->id;
                ?>
);
                              spider_form_submit(event, 'blocked_ips')" href="">Delete</a>
                </td>
              </tr>
              <?php 
                $ids_string .= $row_data->id . ',';
            }
        }
        ?>
        </tbody>
      </table>
      <input id="task" name="task" type="hidden" value="" />
      <input id="current_id" name="current_id" type="hidden" value="" />
      <input id="ids_string" name="ids_string" type="hidden" value="<?php 
        echo $ids_string;
        ?>
" />
      <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="<?php 
        echo $asc_or_desc;
        ?>
" />
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
" />
    </form>
    <?php 
    }
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html($_POST['search_value']) : '';
        $search_select_value = isset($_POST['search_select_value']) ? (int) $_POST['search_select_value'] : 0;
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html($_POST['asc_or_desc']) : 'asc';
        $order_by = isset($_POST['order_by']) ? esc_html($_POST['order_by']) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to edit form themes.
        <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="http://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form class="wrap" id="themes_form" method="post" action="admin.php?page=themes_fm" style="float: left; width: 99%;">
      <span class="theme_icon"></span>
      <h2>
        Themes
        <a href="" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
                                               spider_form_submit(event, 'themes_form')">Add new</a>
      </h2>
      <div class="buttons_div">
        <input class="button-secondary" type="submit" onclick="if (confirm('Do you want to delete selected items?')) {
                                                       spider_set_input_value('task', 'delete_all');
                                                     } else {
                                                       return false;
                                                     }" value="Delete" />
      </div>
      <div class="tablenav top">
        <?php 
        WDW_FM_Library::search('Title', $search_value, 'themes_form');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'themes_form');
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;"/></th>
          <th class="table_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
              spider_set_input_value('order_by', 'id');
              spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html($_POST['order_by']) == 'id' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="<?php 
        if ($order_by == 'title') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
              spider_set_input_value('order_by', 'title');
              spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html($_POST['order_by']) == 'title' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>Title</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="table_big_col <?php 
        if ($order_by == 'default') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
              spider_set_input_value('order_by', 'default');
              spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html($_POST['order_by']) == 'default' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>Default</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="table_big_col">Edit</th>
          <th class="table_big_col">Delete</th>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                $default_image = $row_data->default ? 'default' : 'notdefault';
                $default = $row_data->default ? '' : 'setdefault';
                ?>
              <tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column">
                  <input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox"/>
                </td>
                <td class="table_small_col"><?php 
                echo $row_data->id;
                ?>
</td>
                <td>
                  <a onclick="spider_set_input_value('task', 'edit');
                              spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              spider_form_submit(event, 'themes_form')" href="" title="Edit"><?php 
                echo $row_data->title;
                ?>
</a>
                </td>
                <td class="table_big_col">
                  <?php 
                if ($default != '') {
                    ?>
                    <a onclick="spider_set_input_value('task', '<?php 
                    echo $default;
                    ?>
');
                                spider_set_input_value('current_id', '<?php 
                    echo $row_data->id;
                    ?>
');
                                spider_form_submit(event, 'themes_form')" href="">
                    <?php 
                }
                ?>
                  <img src="<?php 
                echo WD_FM_URL . '/images/' . $default_image . '.png';
                ?>
" />
                  <?php 
                if ($default != '') {
                    ?>
                    </a>
                    <?php 
                }
                ?>
                </td>
                <td class="table_big_col">
                  <a onclick="spider_set_input_value('task', 'edit');
                              spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              spider_form_submit(event, 'themes_form')" href="">Edit</a>
                </td>
                <td class="table_big_col">
                  <a onclick="spider_set_input_value('task', 'delete');
                              spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              spider_form_submit(event, 'themes_form')" href="">Delete</a>
                </td>
              </tr>
              <?php 
                $ids_string .= $row_data->id . ',';
            }
        }
        ?>
        </tbody>
      </table>
      <input id="task" name="task" type="hidden" value=""/>
      <input id="current_id" name="current_id" type="hidden" value=""/>
      <input id="ids_string" name="ids_string" type="hidden" value="<?php 
        echo $ids_string;
        ?>
"/>
      <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc"/>
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
"/>
    </form>
    <?php 
    }
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html($_POST['search_value']) : '';
        $search_select_value = isset($_POST['search_select_value']) ? (int) $_POST['search_select_value'] : 0;
        $asc_or_desc = isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc' ? 'desc' : 'asc';
        $order_by_array = array('id', 'title', 'default');
        $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div class="fm-user-manual">
		This section allows you to create, edit form themes.
		<a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
	</div>
	<div class="fm-upgrade-pro">
		<a target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
			<div class="fm-upgrade-img">
				UPGRADE TO PRO VERSION 
				<span></span>
			</div>
		</a>
	</div>
	<div class="fm-clear"></div>
    <form class="wrap" id="themes_form" method="post" action="admin.php?page=themes_fm" style="width:99%;">
		<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
		<div class="fm-page-banner themes-banner">
			<div class="theme_icon">
			</div>
			<div class="fm-logo-title">Themes</div>
			<button class="fm-button add-button medium" style="margin-left: 31px;" onclick="fm_set_input_value('task', 'add'); fm_form_submit(event, 'themes_form');">
				<span></span>
				Add New
			</button>
			<div class="fm-page-actions">
				<button class="fm-button delete-button small" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete_all'); } else { return false; }">
					<span></span>
					Delete
				</button>
			</div>
		</div>	
		<div class="fm-clear"></div>		
		<div class="tablenav top">
			<?php 
        WDW_FM_Library::search('Title', $search_value, 'themes_form');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'themes_form');
        ?>
		</div>
		<table class="wp-list-table widefat fixed pages">
			<thead>
				<th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;"/></th>
				<th class="table_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
					<a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'id'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>ID</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="<?php 
        if ($order_by == 'title') {
            echo $order_class;
        }
        ?>
">
					<a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'title'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'title' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>Title</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="table_big_col <?php 
        if ($order_by == 'default') {
            echo $order_class;
        }
        ?>
">
					<a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'default'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'default' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>Default</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="table_small_col">Edit</th>
				<th class="table_small_col">Delete</th>
			</thead>
			<tbody id="tbody_arr">
			<?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                $default_image = $row_data->default ? 'default' : 'notdefault';
                $default = $row_data->default ? '' : 'setdefault';
                ?>
						<tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
							<td class="table_small_col check-column">
								<input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox"/>
							</td>
							<td class="table_small_col"><?php 
                echo $row_data->id;
                ?>
</td>
							<td>
								<a onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form')" href="" title="Edit"><?php 
                echo $row_data->title;
                ?>
</a>
							</td>
							<td class="table_big_col">
								<?php 
                if ($default != '') {
                    ?>
									<a onclick="fm_set_input_value('task', '<?php 
                    echo $default;
                    ?>
'); fm_set_input_value('current_id', '<?php 
                    echo $row_data->id;
                    ?>
'); fm_form_submit(event, 'themes_form')" href="">
								<?php 
                }
                ?>
									<img src="<?php 
                echo WD_FM_URL . '/images/' . $default_image . '.png?ver=' . get_option("wd_form_maker_version") . '';
                ?>
" />
								<?php 
                if ($default != '') {
                    ?>
									</a>
								<?php 
                }
                ?>
							</td>
							<td class="table_small_col">
								<button class="fm-icon edit-icon" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form');">
									<span></span>
								</button>
							</td>
							<td class="table_small_col">
								<button class="fm-icon delete-icon" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form'); } else {return false;}">
									<span></span>
								</button>
							</td>
						</tr>
						<?php 
                $ids_string .= $row_data->id . ',';
            }
        }
        ?>
			</tbody>
		</table>
		<input id="task" name="task" type="hidden" value=""/>
		<input id="current_id" name="current_id" type="hidden" value=""/>
		<input id="ids_string" name="ids_string" type="hidden" value="<?php 
        echo $ids_string;
        ?>
"/>
		<input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc"/>
		<input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
"/>
    </form>
    <?php 
    }
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : '';
        $asc_or_desc = isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc' ? 'desc' : 'asc';
        $order_by_array = array('id', 'ip');
        $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
		<div id="fm_blocked_ips_message" style="width: 99%; display: none;"></div>
		<div class="fm-user-manual">
			This section allows you to block IPs.
			<a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
		</div>
		<div class="fm-upgrade-pro">
			<a target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
				<div class="fm-upgrade-img">
					UPGRADE TO PRO VERSION 
					<span></span>
				</div>
			</a>
		</div>
		<div class="fm-clear"></div>
		<form onkeypress="fm_doNothing(event)" class="wrap" id="blocked_ips" method="post" action="admin.php?page=blocked_ips_fm" style="width:99%;">
			<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
			<div class="fm-page-banner blocked-ips-banner">
				<div class="block_icon">
				</div>
				<div class="fm-logo-title">Blocked IPs</div>
				<div class="fm-page-actions">
					<button class="fm-button save-button small" onclick="fm_set_input_value('task', 'save_all');">
						<span></span>
						Save
					</button>
					<button class="fm-button delete-button small" onclick="if (confirm('Do you want to unblock selected IPs?')) { fm_set_input_value('task', 'delete_all'); } else { return false; }">
						<span></span>
						Delete
					</button>
				</div>
			</div>	 
			<div class="fm-clear"></div>
			<div class="tablenav top">
				<?php 
        WDW_FM_Library::search('IP', $search_value, 'blocked_ips');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'blocked_ips');
        ?>
			</div>
			<table class="wp-list-table widefat fixed pages fm-block-ip">
				<thead>
					<tr>
						<th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin: 0;" /></th>
						<th class="table_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
							<a onclick="fm_set_input_value('task', '');
                          fm_set_input_value('order_by', 'id');
                          fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
                          fm_form_submit(event, 'blocked_ips')" href="">
								<span>ID</span><span class="sorting-indicator"></span></th>
							</a>
						<th class="<?php 
        if ($order_by == 'ip') {
            echo $order_class;
        }
        ?>
">
							<a onclick="fm_set_input_value('task', '');
                          fm_set_input_value('order_by', 'ip');
                          fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'ip' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
                          fm_form_submit(event, 'blocked_ips')" href="">
							<span>IP</span><span class="sorting-indicator"></span>
							</a>
						</th>
						<th class="table_small_col">Edit</th>
						<th class="table_small_col">Delete</th>
					</tr>		  
					<tr id="tr" style="background-color: #f9f9f9;">
						<th></th>
						<th></th>
						<th>
							<input type="text" class="input_th" id="ip" name="ip" onkeypress="return fm_check_isnum(event)">
							<button class="fm-button add-button small" onclick="if (fm_check_required('ip', 'IP')) {return false;} fm_set_input_value('task', 'save'); fm_set_input_value('current_id', ''); fm_save_ip('blocked_ips');">
								Add IP
								<span></span>
							</button>
						</th>
						<th>
							
						</th>
						<th></th>
					</tr>
				</thead>
			<tbody id="tbody_arr">
			<?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
						<tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
						<td class="table_small_col check-column" id="td_check_<?php 
                echo $row_data->id;
                ?>
" >
								<input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox" />
							</td>
							<td class="table_small_col" id="td_id_<?php 
                echo $row_data->id;
                ?>
" ><?php 
                echo $row_data->id;
                ?>
</td>
							<td id="td_ip_<?php 
                echo $row_data->id;
                ?>
" >
								<a class="pointer" id="ip<?php 
                echo $row_data->id;
                ?>
"
							 onclick="fm_edit_ip(<?php 
                echo $row_data->id;
                ?>
)" 
							 title="Edit"><?php 
                echo $row_data->ip;
                ?>
</a>
							</td>
							<td class="table_small_col" id="td_edit_<?php 
                echo $row_data->id;
                ?>
">
								<button class="fm-icon edit-icon" onclick="fm_edit_ip(<?php 
                echo $row_data->id;
                ?>
);">
									<span></span>
								</button>
							</td>
							<td class="table_small_col" id="td_delete_<?php 
                echo $row_data->id;
                ?>
">
								<button class="fm-icon delete-icon" onclick="if (confirm('Do you want to unblock selected IP?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id', <?php 
                echo $row_data->id;
                ?>
); fm_form_submit(event, 'blocked_ips'); } else {return false;}">
									<span></span>
								</button>
							</td>
						</tr>
						<?php 
                $ids_string .= $row_data->id . ',';
            }
        }
        ?>
			</tbody>
		</table>
		<input id="task" name="task" type="hidden" value="" />
		<input id="current_id" name="current_id" type="hidden" value="" />
		<input id="ids_string" name="ids_string" type="hidden" value="<?php 
        echo $ids_string;
        ?>
" />
		<input id="asc_or_desc" name="asc_or_desc" type="hidden" value="<?php 
        echo $asc_or_desc;
        ?>
" />
		<input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
" />
    </form>
    <?php 
    }
    public function display($form_id, $startdate, $enddate, $submit_date, $submitter_ip, $username, $useremail, $form_fields, $csv, $xml, $title, $search, $ordering, $entries, $views, $conversion_rate, $pagination, $stats)
    {
        require_once WD_FM_DIR . '/framework/WDW_FM_Library.php';
        $get_data = $this->model->showsubmissions($form_id, $startdate, $enddate, $submit_date, $submitter_ip, $username, $useremail, $form_fields, $csv, $xml, $title, $search, $ordering, $entries, $views, $conversion_rate, $pagination, $stats);
        if ($get_data === false) {
            echo WDW_FM_Library::message(__('You have no permission to view submissions.', 'form_maker'), 'warning');
            return;
        }
        $rows = $get_data["rows"];
        $lists = $get_data["lists"];
        $pageNav = $get_data["pageNav"];
        $labels = $get_data["sorted_labels"];
        $label_titles = $get_data["label_titles"];
        $group_id_s = $get_data["rows_ord"];
        $labels_id = $get_data["sorted_labels_id"];
        $sorted_labels_type = $get_data["sorted_labels_type"];
        $total_entries = $get_data["total_entries"];
        $total_views = $get_data["total_views"];
        $join_count = $get_data["join_count"];
        $form_title = $get_data["form_title"];
        $checked_ids = $get_data["checked_ids"];
        $stats_fields = $get_data["stats_fields"];
        $current_url = htmlentities($_SERVER['REQUEST_URI']);
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'desc';
        $oder_class_default = "manage-column column-autor sortable desc";
        $oder_class = "manage-column column-title sorted " . $asc_or_desc;
        $other_fileds = array('submit_id', 'payment_info');
        foreach ($other_fileds as $other_filed) {
            ${$other_filed} = false;
        }
        if ($checked_ids) {
            $checked_ids = explode(',', $checked_ids);
            $checked_ids = array_slice($checked_ids, 0, count($checked_ids) - 1);
        } else {
            $checked_ids = array();
        }
        foreach ($other_fileds as $other_filed) {
            if (!in_array($other_filed, $checked_ids)) {
                ${$other_filed} = true;
            }
        }
        $is_paypal = $this->model->paypal_info($form_id);
        if (!$is_paypal) {
            $payment_info = false;
        }
        $label_titles_copy = $label_titles;
        $export_ids = "";
        if ($form_fields && $submit_id) {
            $export_ids .= "submit_id,";
        }
        if ($submit_date) {
            $export_ids .= "submit_date,";
        }
        if ($submitter_ip) {
            $export_ids .= "submitter_ip,";
        }
        if ($username) {
            $export_ids .= "username,";
        }
        if ($useremail) {
            $export_ids .= "useremail,";
        }
        for ($i = 0; $i < count($labels); $i++) {
            if ($form_fields && !in_array($labels_id[$i], $checked_ids)) {
                $export_ids .= $labels_id[$i] . ",";
            }
        }
        add_thickbox();
        ?>

  <script type="text/javascript">
    function fm_form_submit(event, form_id, task, id) {
      if (document.getElementById(form_id)) {
        document.getElementById(form_id).submit();
      }
      if (event.preventDefault) {
        event.preventDefault();
      }
      else {
        event.returnValue = false;
      }
    }
    function remove_all() {
      if(document.getElementById('startdate'))
        document.getElementById('startdate').value='';
      if(document.getElementById('enddate'))
        document.getElementById('enddate').value='';
      if(document.getElementById('ip_search'))
        document.getElementById('ip_search').value='';
      if(document.getElementById('username_search'))
        document.getElementById('username_search').value='';
      if(document.getElementById('useremail_search'))
        document.getElementById('useremail_search').value='';
      <?php 
        $n = count($rows);
        for ($i = 0; $i < count($labels); $i++) {
            echo "if(document.getElementById('" . $form_id . '_' . $labels_id[$i] . "_search'))\n          document.getElementById('" . $form_id . '_' . $labels_id[$i] . "_search').value='';";
        }
        ?>
    }
    function show_hide_filter() {
      if (document.getElementById('fields_filter').style.display == "none") {
        document.getElementById('fields_filter').style.display = '';
        document.getElementById('filter_img').src = '<?php 
        echo WD_FM_URL . '/images/filter_hide.png';
        ?>
';
      }
      else {
        document.getElementById('fields_filter').style.display = "none";
        document.getElementById('filter_img').src = '<?php 
        echo WD_FM_URL . '/images/filter_show.png';
        ?>
';
      }
    }
  </script>
    
    <form action="<?php 
        echo $current_url;
        ?>
" method="post" name="adminForm" id="adminForm">
      <input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
        echo $asc_or_desc;
        ?>
" />
      <input type="hidden" name="order_by" id="order_by" value="<?php 
        echo $order_by;
        ?>
" />
      <input type="hidden" id="task" name="task" value="" />
      <div class="submission_params"> 
      <?php 
        if (isset($form_id) and $form_id > 0) {
            ?>
	
      <?php 
            if ($title) {
                ?>
      <div class="form_title"><strong><?php 
                echo $form_title;
                ?>
</strong></div>
      <?php 
            }
            ?>
      <div>
        <?php 
            if ($entries) {
                ?>
          <div class="reports" style="width: 80px;"><strong><?php 
                echo __('Entries', 'form_maker');
                ?>
</strong><br /><?php 
                echo $total_entries;
                ?>
</div>
        <?php 
            }
            if ($views) {
                ?>
          <div class="reports" style="width: 80px;"><strong><?php 
                echo __('Views', 'form_maker');
                ?>
</strong><br /><?php 
                echo $total_views;
                ?>
</div>
        <?php 
            }
            if ($conversion_rate) {
                ?>
          <div class="reports" style="width: 130px;"><strong><?php 
                echo __('Conversion Rate', 'form_maker');
                ?>
</strong><br /><?php 
                if ($total_views) {
                    echo round($total_entries / $total_views * 100, 2) . '%';
                } else {
                    echo '0%';
                }
                ?>
</div>
        <?php 
            }
            if ($csv || $xml) {
                ?>
          <div <?php 
                echo $entries || $views || $conversion_rate ? 'class="csv_xml"' : '';
                ?>
>
          <?php 
                echo __('Export to', 'form_maker');
                ?>
          <?php 
                if ($csv) {
                    ?>
          <input type="button" value="CSV" onclick="window.location='<?php 
                    echo add_query_arg(array('action' => 'frontend_generate_csv', 'page' => 'form_submissions', 'id' => $form_id, 'checked_ids' => $export_ids, 'from' => $startdate, 'to' => $enddate), admin_url('admin-ajax.php'));
                    ?>
'" />&nbsp;
          <?php 
                }
                ?>
          <?php 
                if ($xml) {
                    ?>
          <input type="button" value="XML" onclick="window.location='<?php 
                    echo add_query_arg(array('action' => 'frontend_generate_xml', 'page' => 'form_submissions', 'id' => $form_id, 'checked_ids' => $export_ids, 'from' => $startdate, 'to' => $enddate), admin_url('admin-ajax.php'));
                    ?>
'" />&nbsp;
          <?php 
                }
                ?>
          </div>
        <?php 
            }
            ?>
	
      </div>
      <?php 
            if ($search || $pagination) {
                ?>
      <div class="search_and_pagination">
        <?php 
                if ($search) {
                    ?>
        <div>
          <input type="hidden" name="hide_label_list" value="<?php 
                    echo $lists['hide_label_list'];
                    ?>
" /> 
          <img id="filter_img" src="<?php 
                    echo WD_FM_URL . '/images/filter_show.png';
                    ?>
" width="40" style="vertical-align:middle; cursor:pointer" onclick="show_hide_filter()"  title="Search by fields" />
          <input type="button" onclick="this.form.submit();" style="vertical-align:middle; cursor:pointer" value="<?php 
                    echo __('GO', 'form_maker');
                    ?>
" />	
          <input type="button" onclick="remove_all();this.form.submit();" style="vertical-align:middle; cursor:pointer" value="<?php 
                    echo __('Reset', 'form_maker');
                    ?>
" />
        </div>
        <div>
        <?php 
                    if ($join_count) {
                        echo $total_entries - $join_count . ' ' . __('of', 'form_maker') . ' ' . $total_entries . ' ' . __('submissions are not shown, as the field you sorted by is missing in those submissions.', 'form_maker');
                    }
                    ?>
        </div>
        <?php 
                }
                ?>
        <?php 
                if ($pagination) {
                    ?>
        <div class="tablenav top">
          <?php 
                    WDW_FM_Library::html_page_nav($lists['total'], $lists['limit'], 'adminForm');
                    ?>
        </div>  
        <?php 
                }
                ?>
      </div>
      <?php 
            }
            ?>
      <?php 
        }
        ?>
      </div>

      <div style="overflow-x:scroll;">
        <table class="submissions" width="100%">
        <thead>
          <tr>
            <th width="3%"><?php 
        echo '#';
        ?>
</th>
            <?php 
        if ($form_fields && $submit_id) {
            echo '<th width="4%" class="submitid_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitid@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'group_id\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "group_id" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Id</span>
                  <span>' . ($order_by == "group_id" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Id';
            }
            echo '</th>';
        }
        if ($submit_date) {
            echo '<th width="150" align="center" class="submitdate_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitdate@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'date\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "date" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Submit date</span>
                  <span>' . ($order_by == "date" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Submit Date';
            }
            echo '</th>';
        }
        if ($submitter_ip) {
            echo '<th width="100" align="center" class="submitterip_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitterip@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'ip\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "ip" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Submitter\'s IP Address</span>
                  <span>' . ($order_by == "ip" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Submitter\'s IP Address';
            }
            echo '</th>';
        }
        if ($username) {
            echo '<th width="100" class="submitterusername_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitterusername@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'display_name\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "display_name" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Submitter\'s Username</span>
                  <span>' . ($order_by == "display_name" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Submitter\'s Username';
            }
            echo '</th>';
        }
        if ($useremail) {
            echo '<th width="100" class="submitteremail_fc"';
            if (!(strpos($lists['hide_label_list'], '@submitteremail@') === false)) {
                echo 'style="display:none;"';
            }
            echo '>';
            if ($ordering) {
                echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'user_email\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == "user_email" && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                  <span>Submitter\'s Email Address</span>
                  <span>' . ($order_by == "user_email" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                </a>';
            } else {
                echo 'Submitter\'s Email Address';
            }
            echo '</th>';
        }
        $n = count($rows);
        $ispaypal = false;
        for ($i = 0; $i < count($labels); $i++) {
            if ($form_fields && !in_array($labels_id[$i], $checked_ids)) {
                if (strpos($lists['hide_label_list'], '@' . $labels_id[$i] . '@') === false) {
                    $styleStr = '';
                } else {
                    $styleStr = 'style="display:none;"';
                }
                $field_title = $label_titles_copy[$i];
                if ($sorted_labels_type[$i] == 'type_paypal_payment_status') {
                    $ispaypal = true;
                }
                echo '<th align="center" class="' . $labels_id[$i] . '_fc" ' . $styleStr . '>';
                if ($ordering) {
                    echo '<a href="" onclick="document.getElementById(\'order_by\').value = \'' . $labels_id[$i] . '_field\'; document.getElementById(\'asc_or_desc\').value = \'' . ($order_by == $labels_id[$i] . '_field' && $asc_or_desc == 'asc' ? 'desc' : 'asc') . '\'; fm_form_submit(event, \'adminForm\');">
                    <span>' . $field_title . '</span>
                    <span>' . ($order_by == $labels_id[$i] . "_field" ? $asc_or_desc == "asc" ? "&#x25B2;" : "&#x25BC;" : "") . '</span>
                  </a>';
                } else {
                    echo $field_title;
                }
                echo '</th>';
            }
        }
        if ($form_fields && $payment_info) {
            if (strpos($lists['hide_label_list'], '@payment_info@') === false) {
                $styleStr2 = 'aa';
            } else {
                $styleStr2 = 'style="display:none;"';
            }
            echo '<th class="payment_info_fc" ' . $styleStr2 . '>Payment Info</th>';
        }
        ?>

          </tr>
          <tr id="fields_filter" style="display:none">
            <th width="3%"></th>
            <?php 
        if ($form_fields && $submit_id) {
            ?>
            <th width="4%" class="submitid_fc" <?php 
            if (!(strpos($lists['hide_label_list'], '@submitid@') === false)) {
                echo 'style="display:none;"';
            }
            ?>
 ></th>
            <?php 
        }
        if ($submit_date) {
            ?>
            <th class="submitdate_fc" style="text-align:left; <?php 
            if (!(strpos($lists['hide_label_list'], '@submitdate@') === false)) {
                echo 'display:none;';
            }
            ?>
" align="center"> 
            <table class="simple_table">
              <tr>
                <td><?php 
            echo __('From', 'form_maker');
            ?>
:</td>
                <td><input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php 
            echo $lists['startdate'];
            ?>
" /> </td>
                <td><input type="reset" class="button" value="..." name="startdate_but" id="startdate_but" onclick="return showCalendar('startdate','%Y-%m-%d');"/> </td>
              </tr>
              <tr>
                <td><?php 
            echo __('To', 'form_maker');
            ?>
:</td>
                <td><input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php 
            echo $lists['enddate'];
            ?>
" /> </td>
                <td><input type="reset" class="button" value="..." name="enddate_but" id="enddate_but" onclick="return showCalendar('enddate','%Y-%m-%d');"/></td>
              </tr>
            </table>
            
            </th>
            <?php 
        }
        if ($submitter_ip) {
            ?>
            <th class="submitterip_fc"  <?php 
            if (!(strpos($lists['hide_label_list'], '@submitterip@') === false)) {
                echo 'style="display:none;"';
            }
            ?>
>
             <input class="inputbox" type="text" name="ip_search" id="ip_search" value="<?php 
            echo $lists['ip_search'];
            ?>
" onChange="this.form.submit();" style="width:96%"/>
            </th>
            <?php 
        }
        if ($username) {
            ?>
		
            <th width="100"class="submitterusername_fc"  <?php 
            if (!(strpos($lists['hide_label_list'], '@submitterusername@') === false)) {
                echo 'style="display:none;"';
            }
            ?>
>
               <input class="inputbox" type="text" name="username_search" id="username_search" value="<?php 
            echo $lists['username_search'];
            ?>
" onChange="this.form.submit();" style="width:150px"/>
              </th>
            <?php 
        }
        if ($useremail) {
            ?>
		
              <th width="100"class="submitteremail_fc"  <?php 
            if (!(strpos($lists['hide_label_list'], '@submitteremail@') === false)) {
                echo 'style="display:none;"';
            }
            ?>
>
               <input class="inputbox" type="text" name="useremail_search" id="useremail_search" value="<?php 
            echo $lists['useremail_search'];
            ?>
" onChange="this.form.submit();" style="width:150px"/>
              </th>
            <?php 
        }
        $ka_fielderov_search = false;
        if ($lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search']) {
            $ka_fielderov_search = true;
        }
        for ($i = 0; $i < count($labels); $i++) {
            if (strpos($lists['hide_label_list'], '@' . $labels_id[$i] . '@') === false) {
                $styleStr = '';
            } else {
                $styleStr = 'style="display:none;"';
            }
            if (!$ka_fielderov_search) {
                if ($lists[$form_id . '_' . $labels_id[$i] . '_search']) {
                    $ka_fielderov_search = true;
                }
            }
            if ($form_fields && !in_array($labels_id[$i], $checked_ids)) {
                switch ($sorted_labels_type[$i]) {
                    case 'type_mark_map':
                        echo '<th class="' . $labels_id[$i] . '_fc" ' . $styleStr . '>' . '</th>';
                        break;
                    case 'type_paypal_payment_status':
                        echo '<th class="' . $labels_id[$i] . '_fc" ' . $styleStr . '>';
                        ?>
                  <select name="<?php 
                        echo $form_id . '_' . $labels_id[$i];
                        ?>
_search" id="<?php 
                        echo $form_id . '_' . $labels_id[$i];
                        ?>
_search" onChange="this.form.submit();" value="<?php 
                        echo $lists[$form_id . '_' . $labels_id[$i] . '_search'];
                        ?>
" >
                    <option value="" ></option>
                    <option value="canceled" ><?php 
                        echo __('Canceled', 'form_maker');
                        ?>
</option>
                    <option value="cleared" ><?php 
                        echo __('Cleared', 'form_maker');
                        ?>
</option>
                    <option value="cleared by payment review" ><?php 
                        echo __('Cleared by payment review', 'form_maker');
                        ?>
</option>
                    <option value="completed" ><?php 
                        echo __('Completed', 'form_maker');
                        ?>
</option>
                    <option value="denied" ><?php 
                        echo __('Denied', 'form_maker');
                        ?>
</option>
                    <option value="failed" ><?php 
                        echo __('Failed', 'form_maker');
                        ?>
</option>
                    <option value="held" ><?php 
                        echo __('Held', 'form_maker');
                        ?>
</option>
                    <option value="in progress" ><?php 
                        echo __('In progress', 'form_maker');
                        ?>
</option>
                    <option value="on hold" ><?php 
                        echo __('On hold', 'form_maker');
                        ?>
</option>
                    <option value="paid" ><?php 
                        echo __('Paid', 'form_maker');
                        ?>
</option>
                    <option value="partially refunded" ><?php 
                        echo __('Partially refunded', 'form_maker');
                        ?>
</option>
                    <option value="pending verification" ><?php 
                        echo __('Pending verification', 'form_maker');
                        ?>
</option>
                    <option value="placed" ><?php 
                        echo __('Placed', 'form_maker');
                        ?>
</option>
                    <option value="processing" ><?php 
                        echo __('Processing', 'form_maker');
                        ?>
</option>
                    <option value="refunded" ><?php 
                        echo __('Refunded', 'form_maker');
                        ?>
</option>
                    <option value="refused" ><?php 
                        echo __('Refused', 'form_maker');
                        ?>
</option>
                    <option value="removed" ><?php 
                        echo __('Removed', 'form_maker');
                        ?>
</option>
                    <option value="returned" ><?php 
                        echo __('Returned', 'form_maker');
                        ?>
</option>
                    <option value="reversed" ><?php 
                        echo __('Reversed', 'form_maker');
                        ?>
</option>
                    <option value="temporary hold" ><?php 
                        echo __('Temporary hold', 'form_maker');
                        ?>
</option>
                    <option value="unclaimed" ><?php 
                        echo __('Unclaimed', 'form_maker');
                        ?>
</option>
                  </select>	
                  <script> 
                    var element = document.getElementById('<?php 
                        echo $form_id . '_' . $labels_id[$i];
                        ?>
_search');
                    element.value = '<?php 
                        echo $lists[$form_id . '_' . $labels_id[$i] . '_search'];
                        ?>
';
                  </script>
                  <?php 
                        echo '</th>';
                        break;
                    default:
                        echo '<th class="' . $labels_id[$i] . '_fc" ' . $styleStr . '>' . '<input name="' . $form_id . '_' . $labels_id[$i] . '_search" id="' . $form_id . '_' . $labels_id[$i] . '_search" class="inputbox" type="text" value="' . $lists[$form_id . '_' . $labels_id[$i] . '_search'] . '"  onChange="this.form.submit();" style="width:96%">' . '</th>';
                        break;
                }
            }
        }
        if ($form_fields && $payment_info) {
            if (strpos($lists['hide_label_list'], '@payment_info@') === false) {
                $styleStr2 = '';
            } else {
                $styleStr2 = 'style="display:none;"';
            }
            echo '<th class="payment_info_fc" ' . $styleStr2 . '></th>';
        }
        ?>
          </tr>
        </thead>
        <?php 
        $k = 0;
        $m = count($labels);
        for ($www = 0, $qqq = count($group_id_s); $www < $qqq; $www++) {
            $i = $group_id_s[$www];
            $temp = array();
            for ($j = 0; $j < $n; $j++) {
                $row =& $rows[$j];
                if ($row->group_id == $i) {
                    array_push($temp, $row);
                }
            }
            $f = $temp[0];
            $date = $f->date;
            $ip = $f->ip;
            $user_id = get_userdata($f->user_id_wd);
            $user_name = $user_id ? $user_id->display_name : "";
            $user_email = $user_id ? $user_id->user_email : "";
            ?>
        
          <tr class="<?php 
            echo "row{$k}";
            ?>
">
            <td align="center"><?php 
            echo $www + 1 + ($lists['limit'] - 1) * 20;
            ?>
</td>		 
            <?php 
            if ($form_fields && $submit_id) {
                if (strpos($lists['hide_label_list'], '@submitid@') === false) {
                    echo '<td align="center" class="submitid_fc">' . $f->group_id . '</td>';
                } else {
                    echo '<td align="center" class="submitid_fc" style="display:none;">' . $f->group_id . '</td>';
                }
            }
            if ($submit_date) {
                if (strpos($lists['hide_label_list'], '@submitdate@') === false) {
                    echo '<td align="center" class="submitdate_fc">' . $date . '</td>';
                } else {
                    echo '<td align="center" class="submitdate_fc" style="display:none;">' . $date . '</td>';
                }
            }
            if ($submitter_ip) {
                if (strpos($lists['hide_label_list'], '@submitterip@') === false) {
                    echo '<td align="center" class="submitterip_fc">' . $ip . '</td>';
                } else {
                    echo '<td align="center" class="submitterip_fc" style="display:none;">' . $ip . '</td>';
                }
            }
            if ($username) {
                if (strpos($lists['hide_label_list'], '@submitterusername@') === false) {
                    echo '<td align="center" class="submitterusername_fc" style="display:table-cell;">' . $user_name . '</td>';
                } else {
                    echo '<td align="center" class="submitterusername_fc" style="display:none;">' . $user_name . '</td>';
                }
            }
            if ($useremail) {
                if (strpos($lists['hide_label_list'], '@submitteremail@') === false) {
                    echo '<td align="center" class="submitteremail_fc" style="display:table-cell;">' . $user_email . '</td>';
                } else {
                    echo '<td align="center" class="submitteremail_fc" style="display:none;">' . $user_email . '</td>';
                }
            }
            $ttt = count($temp);
            for ($h = 0; $h < $m; $h++) {
                if ($form_fields && !in_array($labels_id[$h], $checked_ids)) {
                    $not_label = true;
                    for ($g = 0; $g < $ttt; $g++) {
                        $t = $temp[$g];
                        if (strpos($lists['hide_label_list'], '@' . $labels_id[$h] . '@') === false) {
                            $styleStr = '';
                        } else {
                            $styleStr = 'style="display:none;"';
                        }
                        if ($t->element_label == $labels_id[$h]) {
                            if (strpos($t->element_value, "***map***")) {
                                $map_params = explode('***map***', $t->element_value);
                                $longit = $map_params[0];
                                $latit = $map_params[1];
                                echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><a class="thickbox-preview" href="' . add_query_arg(array('action' => 'frontend_show_map', 'page' => 'form_submissions', 'long' => $longit, 'lat' => $latit, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) . '" title="' . __('Show on Map', 'form_maker') . '">' . __('Show on Map', 'form_maker') . '</a></td>';
                            } else {
                                if (strpos($t->element_value, "*@@url@@*")) {
                                    echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '>';
                                    $new_files = explode("*@@url@@*", $t->element_value);
                                    foreach ($new_files as $new_file) {
                                        if ($new_file) {
                                            $new_filename = explode('/', $new_file);
                                            $new_filename = $new_filename[count($new_filename) - 1];
                                            if (strpos(strtolower($new_filename), 'jpg') !== false or strpos(strtolower($new_filename), 'png') !== false or strpos(strtolower($new_filename), 'gif') !== false or strpos(strtolower($new_filename), 'jpeg') !== false) {
                                                echo '<a href="' . $new_file . '" class="modal">' . $new_filename . "</a></br>";
                                            } else {
                                                echo '<a target="_blank" href="' . $new_file . '">' . $new_filename . "</a></br>";
                                            }
                                        }
                                    }
                                    echo "</td>";
                                } else {
                                    if (strpos($t->element_value, "@@@") > -1 || $t->element_value == "@@@" || $t->element_value == "@@@@@@@@@" || $t->element_value == "::" || $t->element_value == ":" || $t->element_value == "--") {
                                        echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><pre style="font-family:inherit">' . str_replace(array("@@@", ":", "-"), " ", $t->element_value) . '</pre></td>';
                                    } else {
                                        if (strpos($t->element_value, "***grading***")) {
                                            $new_filename = str_replace("***grading***", '', $t->element_value);
                                            $grading = explode(":", $new_filename);
                                            $items_count = sizeof($grading) - 1;
                                            $items = "";
                                            $total = "";
                                            for ($k = 0; $k < $items_count / 2; $k++) {
                                                $items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . "</br>";
                                                $total += $grading[$k];
                                            }
                                            $items .= __('Total', 'form_maker') . ": " . $total;
                                            echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><pre style="font-family:inherit">' . $items . '</pre></td>';
                                        } else {
                                            if (strpos($t->element_value, "***matrix***")) {
                                                echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><a class="thickbox-preview" href="' . add_query_arg(array('action' => 'frontend_show_matrix', 'page' => 'form_submissions', 'matrix_params' => $t->element_value, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) . '" title="' . __('Show Matrix', 'form_maker') . '">' . __('Show Matrix', 'form_maker') . '</a></td>';
                                            } else {
                                                if (strpos($t->element_value, "***quantity***")) {
                                                    $t->element_value = str_replace("***quantity***", " ", $t->element_value);
                                                }
                                                if (strpos($t->element_value, "***property***")) {
                                                    $t->element_value = str_replace("***property***", " ", $t->element_value);
                                                }
                                                echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '><pre style="font-family:inherit; white-space: pre;">' . str_replace("***br***", '<br>', $t->element_value) . '</pre></td>';
                                            }
                                        }
                                    }
                                }
                            }
                            $not_label = false;
                        }
                    }
                    if ($not_label) {
                        echo '<td align="center" class="' . $labels_id[$h] . '_fc" ' . $styleStr . '></td>';
                    }
                }
            }
            if ($form_fields && $payment_info) {
                if (strpos($lists['hide_label_list'], '@payment_info@') === false) {
                    $styleStr = '';
                } else {
                    $styleStr = 'style="display:none;"';
                }
                echo '<td align="center" class="payment_info_fc" ' . $styleStr . '>		
              <a class="thickbox-preview" href="' . add_query_arg(array('action' => 'frontend_paypal_info', 'page' => 'form_submissions', 'id' => $i, 'width' => '600', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) . '">
                  <img src="' . WD_FM_URL . '/images/info.png" />
                </a></td>';
            }
            ?>
          </tr>
          <?php 
            $k = 1 - $k;
        }
        ?>
        </table>
      </div>
      <?php 
        $is_stats = false;
        if ($stats) {
            foreach ($sorted_labels_type as $key => $label_type) {
                if ($label_type == "type_checkbox" || $label_type == "type_radio" || $label_type == "type_own_select" || $label_type == "type_country" || $label_type == "type_paypal_select" || $label_type == "type_paypal_radio" || $label_type == "type_paypal_checkbox" || $label_type == "type_paypal_shipping") {
                    $is_stats = true;
                    break;
                }
            }
            if ($is_stats) {
                ?>
          <br><br>
          <h1 style="border-bottom: 1px solid; color:#000 !important;"><?php 
                echo __('Statistics', 'form_maker');
                ?>
</h1>
          <table class="stats">
            <tr valign="top">
              <td class="key" style="vertical-align: middle;">
                <label> <?php 
                echo __('Select a Field', 'form_maker');
                ?>
: </label>
              </td>
              <td>
                <select id="stat_id">
                <option value=""><?php 
                echo __('Select a Field', 'form_maker');
                ?>
</option>;
                <?php 
                $stats_fields = explode(',', $stats_fields);
                $stats_fields = array_slice($stats_fields, 0, count($stats_fields) - 1);
                foreach ($sorted_labels_type as $key => $label_type) {
                    if (($label_type == "type_checkbox" || $label_type == "type_radio" || $label_type == "type_own_select" || $label_type == "type_country" || $label_type == "type_paypal_select" || $label_type == "type_paypal_radio" || $label_type == "type_paypal_checkbox" || $label_type == "type_paypal_shipping") && !in_array($labels_id[$key], $stats_fields)) {
                        echo '<option value="' . $labels_id[$key] . '">' . $label_titles_copy[$key] . '</option>';
                    }
                }
                ?>
                </select>
              </td>
            </tr>
            <tr valign="middle">
              <td class="key" style="vertical-align: middle;">
                <label> <?php 
                echo __('Select a Date', 'form_maker');
                ?>
: </label>
              </td>
              <td>
                <?php 
                echo __('From', 'form_maker');
                ?>
:<input class="inputbox" type="text" name="startstats" id="startstats" size="10" maxlength="10" />
                  <input type="reset" class="button" value="..." name="startstats_but" id="startstats_but" onclick="return showCalendar('startstats','%Y-%m-%d');"/> 
                <?php 
                echo __('To', 'form_maker');
                ?>
: <input class="inputbox" type="text" name="endstats" id="endstats" size="10" maxlength="10" />
                  <input type="reset" class="button" value="..." name="endstats_but" id="endstats_but" onclick="return showCalendar('endstats','%Y-%m-%d');"/>
              </td>
            </tr>
            <tr valign="top">
              <td class="key" style="vertical-align: middle;" colspan="2">
              <input type="button" onclick="show_stats()" style="vertical-align:middle; cursor:pointer" value="<?php 
                echo __('Show', 'form_maker');
                ?>
">
              </td>
            </tr>			
          </table>
          <div id="div_stats"></div>
          <?php 
            }
        }
        ?>
    </form>    
    
    <script> 
      jQuery(window).load(function() {
        fm_popup();
        if (typeof jQuery().fancybox !== 'undefined' && jQuery.isFunction(jQuery().fancybox)) {
          jQuery(".fm_fancybox").fancybox({
            'maxWidth ' : 600,
            'maxHeight' : 500
          });
        }
      });
      function show_stats() {
        jQuery('#div_stats').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
        if(jQuery('#stat_id').val() != "") {
          jQuery('#div_stats').load('<?php 
        echo add_query_arg(array('action' => 'get_frontend_stats', 'page' => 'form_submissions'), admin_url('admin-ajax.php'));
        ?>
', {
            'form_id' : '<?php 
        echo $form_id;
        ?>
',
            'stat_id' : jQuery('#stat_id').val(),
            'startdate' : jQuery('#startstats').val(), 
            'enddate' : jQuery('#endstats').val()
          });
        }		
        else
          jQuery('#div_stats').html("<?php 
        echo __('Please select the field!', 'form_maker');
        ?>
")
      }
      function fm_popup(id) {
        if (typeof id === 'undefined') {
          var id = '';
        }
        var thickDims, tbWidth, tbHeight;
            thickDims = function() {
              var tbWindow = jQuery('#TB_window'), H = jQuery(window).height(), W = jQuery(window).width(), w, h;
              w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 40;
              h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 40;
              if (tbWindow.size()) {
                tbWindow.width(w).height(h);
                jQuery('#TB_iframeContent').width(w).height(h - 27);
                tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
                if (typeof document.body.style.maxWidth != 'undefined') {
                  tbWindow.css({'top':(H-h)/2,'margin-top':'0'});
                }
              }
            };
        thickDims();
        jQuery(window).resize(function() { thickDims() });
        jQuery('a.thickbox-preview' + id).click( function() {
          tb_click.call(this);
          var alink = jQuery(this).parents('.available-theme').find('.activatelink'), link = '', href = jQuery(this).attr('href'), url, text;
          if (tbWidth = href.match(/&width=[0-9]+/)) {
            tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
          }
          else {
            tbWidth = jQuery(window).width() - 120;
          }
          
          if (tbHeight = href.match(/&height=[0-9]+/)) {
            tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
          }
          else {
            tbHeight = jQuery(window).height() - 120;
          }
          if (alink.length) {
            url = alink.attr('href') || '';
            text = alink.attr('title') || '';
            link = '&nbsp; <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>';
          }
          else {
            text = jQuery(this).attr('title') || '';
            link = '&nbsp; <span class="tb-theme-preview-link">' + text + '</span>';
          }
          jQuery('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
          jQuery('#TB_closeAjaxWindow').css({'float':'right'});
          jQuery('#TB_ajaxWindowTitle').css({'float':'left'}).html(link);
          jQuery('#TB_iframeContent').width('100%');
          thickDims();
          return false;
        });

        jQuery('.theme-detail').click(function () {
          jQuery(this).siblings('.themedetaildiv').toggle();
          return false;
        });
      }
      <?php 
        if ($ka_fielderov_search) {
            ?>
 
        document.getElementById('fields_filter').style.display = '';
        document.getElementById('filter_img').src = '<?php 
            echo WD_FM_URL . '/images/filter_hide.png';
            ?>
';
        <?php 
        }
        ?>
    </script>
    <?php 
    }
    public function display($form_id)
    {
        global $wpdb;
        $forms = $this->model->get_form_titles();
        $statistics = $this->model->get_statistics($form_id);
        $labels_parameters = $this->model->get_labels_parameters($form_id);
        $sorted_labels_id = $labels_parameters[0];
        $sorted_label_types = $labels_parameters[1];
        $lists = $labels_parameters[2];
        $sorted_label_names = $labels_parameters[3];
        $sorted_label_names_original = $labels_parameters[4];
        $rows = isset($labels_parameters[5]) ? $labels_parameters[5] : NULL;
        $group_ids = isset($labels_parameters[6]) ? $labels_parameters[6] : NULL;
        $where_choices = $labels_parameters[7];
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'group_id';
        $asc_or_desc = isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'asc' ? 'asc' : 'desc';
        $style_id = $this->model->hide_or_not($lists['hide_label_list'], '@submitid@');
        $style_date = $this->model->hide_or_not($lists['hide_label_list'], '@submitdate@');
        $style_ip = $this->model->hide_or_not($lists['hide_label_list'], '@submitterip@');
        $style_username = $this->model->hide_or_not($lists['hide_label_list'], '@submitterusername@');
        $style_useremail = $this->model->hide_or_not($lists['hide_label_list'], '@submitteremail@');
        $oder_class_default = "manage-column column-autor sortable desc";
        $oder_class = "manage-column column-title sorted " . $asc_or_desc;
        $ispaypal = FALSE;
        $temp = array();
        $m = count($sorted_label_names);
        $n = count($rows);
        $group_id_s = array();
        $group_id_s = $this->model->sort_group_ids(count($sorted_label_names), $group_ids);
        $ka_fielderov_search = $lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search'] || $lists['id_search'] ? TRUE : FALSE;
        $is_stats = false;
        $blocked_ips = $this->model->blocked_ips();
        if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
            require_once WD_FM_PDF_DIR . '/model.php';
            $pdf_data = WD_FM_PDF_model::get_pdf_data($form_id);
        }
        $subs_count = $this->model->get_subs_count($form_id);
        $chosen_form_title = '';
        if ($forms) {
            foreach ($forms as $form) {
                if ($form_id == $form->id) {
                    $chosen_form_title = $form->title;
                }
            }
        }
        ?>
		<script type="text/javascript">
			function export_submissions(type, limit) {
			var progressbar = jQuery( "#fm-progressbar" );
			var progressLabel = jQuery( ".fm-progress-label" );
		 
			progressbar.progressbar({
				max: <?php 
        echo $subs_count;
        ?>
			});
			
			jQuery.ajax({
			    type: "POST",  
				url:"<?php 
        echo add_query_arg(array('form_id' => $form_id, 'send_header' => 0), admin_url('admin-ajax.php'));
        ?>
&action=generete_"+type+"&limitstart="+limit,
				beforeSend: function() {
					if(<?php 
        echo $subs_count;
        ?>
 >= 1000 )
						jQuery('.fm_modal').show();
			    },
			    success: function(data) {
					if(limit < <?php 
        echo $subs_count;
        ?>
) {
						limit += 1000;
						export_submissions(type, limit);
						progressbar.progressbar( "value",  limit);
						loaded_percent = Math.round((progressbar.progressbar( "value" ) * 100)/ parseInt(<?php 
        echo $subs_count;
        ?>
));
						progressLabel.text( loaded_percent + ' %');
						progressbarValue = progressbar.find( ".fm-progress-label" );
						if( loaded_percent >= 46 ) {
							progressbarValue.css({
								"color": '#fff',
							});
						}
						else {
							progressbarValue.css({
								"color": '#444',
							});
						}
					}
					else{
						jQuery('.fm_modal').hide();
						progressbar.progressbar( "value",  0);
						progressLabel.text( 'Loading ...' );
						progressbarValue = progressbar.find( ".fm-progress-label" );
						progressbarValue.css({
							"color": '#444',
						});
						window.location = "<?php 
        echo add_query_arg(array('form_id' => $form_id, 'send_header' => 1), admin_url('admin-ajax.php'));
        ?>
&action=generete_"+type+"&limitstart="+limit;
					}
			    }
			});
		}
	
			function clickLabChBAll(ChBAll) {
				<?php 
        if (isset($sorted_label_names)) {
            $templabels = array_merge(array('submitid', 'submitdate', 'submitterip', 'submitterusername', 'submitteremail'), $sorted_labels_id);
            $sorted_label_names_for_check = array_merge(array('ID', 'Submit date', "Submitter's IP", "Submitter's Username", "Submitter's Email Address"), $sorted_label_names_original);
        } else {
            $templabels = array('submitid', 'submitdate', 'submitterip', 'submitterusername', 'submitteremail');
            $sorted_label_names_for_check = array('ID', 'Submit date', "Submitter's IP", 'Submitter\'s Username', 'Submitter\'s Email Address');
        }
        ?>
				if (ChBAll.checked) {
					document.forms.admin_form.hide_label_list.value = '';
					for (i = 0; i <= ChBAll.form.length; i++) {
						if (typeof(ChBAll.form[i]) != "undefined") {
							if (ChBAll.form[i].type == "checkbox") {
								ChBAll.form[i].checked = true;
							}
						}
					}
				}
				else {
					document.forms.admin_form.hide_label_list.value = '@<?php 
        echo implode($templabels, '@@');
        ?>
@' + '@payment_info@';
					for (i = 0; i <= ChBAll.form.length; i++) {
						if (typeof(ChBAll.form[i]) != "undefined") {
							if (ChBAll.form[i].type == "checkbox") {
								ChBAll.form[i].checked = false;
							}
						}
					}
				}
				renderColumns();
			}
			
			function remove_all() {
				if(document.getElementById('startdate'))
					document.getElementById('startdate').value='';
				if(document.getElementById('enddate'))
					document.getElementById('enddate').value='';
				if(document.getElementById('id_search'))
					document.getElementById('id_search').value='';
				if(document.getElementById('ip_search'))
					document.getElementById('ip_search').value='';
				if(document.getElementById('username_search'))
					document.getElementById('username_search').value='';
				if(document.getElementById('useremail_search'))
					document.getElementById('useremail_search').value='';
				<?php 
        $n = count($rows);
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            if ($sorted_label_types[$i] != "type_mark_map") {
                ?>
						document.getElementById('<?php 
                echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                ?>
').value='';
						<?php 
            }
        }
        ?>
			}
			function show_hide_filter() {
				if (document.getElementById('fields_filter').style.display == "none") {
					document.getElementById('fields_filter').style.display = '';
				}
				else {
					document.getElementById('fields_filter').style.display = "none";
				}
				return false;
			}
			jQuery(document).ready(function () { 
				jQuery('.theme-detail').click(function () {
					jQuery(this).siblings('.themedetaildiv').toggle();
					return false;
				});
			});
		</script>
		<div class="fm_modal"> 
			<div id="fm-progressbar" >
				<div class="fm-progress-label">Loading...</div>
			</div> 
		</div> 
		<div class="export_progress">
			<span class="exp_count"><?php 
        echo $subs_count;
        ?>
</span> left from <?php 
        echo $subs_count;
        ?>
		</div> 
		<div id="sbox-overlay" onclick="toggleChBDiv(false);">
		</div>
		<div id="ChBDiv">
			<form action="#">
				<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
				<p style="font-weight: bold; font-size: 18px; margin-top: 0px;">Select Columns</p>
				<div class="fm_check_labels"><input type="checkbox" <?php 
        echo $lists['hide_label_list'] === '' ? 'checked="checked"' : '';
        ?>
 onclick="clickLabChBAll(this)" id="ChBAll"/><label for="ChBAll"> All</label></div>
				<?php 
        foreach ($templabels as $key => $curlabel) {
            if (strpos($lists['hide_label_list'], '@' . $curlabel . '@') === FALSE) {
                ?>
						<div class="fm_check_labels"><input type="checkbox" checked="checked" onclick="clickLabChB('<?php 
                echo $curlabel;
                ?>
', this)" id="fm_check_id_<?php 
                echo $curlabel;
                ?>
" /><label for="fm_check_id_<?php 
                echo $curlabel;
                ?>
"> <?php 
                echo stripslashes($sorted_label_names_for_check[$key]);
                ?>
</label></div>
						<?php 
            } else {
                ?>
						<div class="fm_check_labels"><input type="checkbox" onclick="clickLabChB('<?php 
                echo $curlabel;
                ?>
', this)" id="fm_check_id_<?php 
                echo $curlabel;
                ?>
"/><label for="fm_check_id_<?php 
                echo $curlabel;
                ?>
"> <?php 
                echo stripslashes($sorted_label_names_for_check[$key]);
                ?>
</label></div>
						<?php 
            }
        }
        $ispaypal = FALSE;
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
                $ispaypal = TRUE;
            }
        }
        if ($ispaypal) {
            ?>
					<div class="fm_check_labels">
						<input type="checkbox" onclick="clickLabChB('payment_info', this)" id="fm_check_payment_info" <?php 
            echo strpos($lists['hide_label_list'], '@payment_info@') === FALSE ? 'checked="checked"' : '';
            ?>
 />
						<label for="fm_check_payment_info"> Payment Info</label>
					</div>
					<?php 
        }
        ?>
				<div style="text-align: center; padding-top: 20px;">
					<button onclick="toggleChBDiv(false); return false;" style="background: #4EC0D9; width: 78px; height: 32px; border: 1px solid #4EC0D9; border-radius: 0px; color: #fff; cursor: pointer;">Done</button>
				</div>
			</form>
		</div>
		<div class="fm-user-manual">
			This section allows you to view and manage form submissions.
			<a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-6.html">Read More in User Manual</a>
		</div>
		<div class="fm-upgrade-pro">
			<a target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
				<div class="fm-upgrade-img">
					UPGRADE TO PRO VERSION 
					<span></span>
				</div>
			</a>
		</div>
		<div class="fm-clear"></div>
		<form action="admin.php?page=submissions_fm" method="post" id="admin_form" name="admin_form">
			<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
			<input type="hidden" name="option" value="com_formmaker" />
			<input type="hidden" id="task" name="task" value="" />
			<input type="hidden" id="current_id" name="current_id" value="" />
			<input type="hidden" name="asc_or_desc" id="asc_or_desc" value="<?php 
        echo $asc_or_desc;
        ?>
" />
			<input type="hidden" name="order_by" id="order_by" value="<?php 
        echo $order_by;
        ?>
" />
			
			<div class="fm-submissions-page">
				<div class="submissions-actions">
					<div class="fm-form-title">
						<?php 
        echo $chosen_form_title;
        ?>
	
					</div>
					<div class="fm-page-actions">
						<button class="fm-button block-button small" onclick="fm_set_input_value('task', 'block_ip'); fm_form_submit(event, 'admin_form');">
							<span></span>
							Block IP
						</button>
						<button class="fm-button unblock-button medium" onclick="fm_set_input_value('task', 'unblock_ip'); fm_form_submit(event, 'admin_form');">
							<span></span>
							Unblock IP
						</button>
						<button class="fm-button delete-button small" onclick="if (confirm('Do you want to delete selected items?')) { fm_set_input_value('task', 'delete_all'); fm_form_submit(event, 'admin_form'); } else { return false; }">
							<span></span>
							Delete
						</button>
					</div>
				</div>
				<div class="submissions-toolbar">
					<div class="submissions-tools">
						<select name="form_id" id="form_id" onchange="document.admin_form.submit();">
							<option value="0" selected="selected"> - Select a Form - </option>
							<?php 
        if ($forms) {
            foreach ($forms as $form) {
                ?>
									<option value="<?php 
                echo $form->id;
                ?>
" <?php 
                if ($form_id == $form->id) {
                    echo 'selected="selected"';
                }
                ?>
> <?php 
                echo $form->title;
                ?>
 </option>
									<?php 
            }
        }
        ?>
						</select>
						<div class="fm-reports">
							<div class="fm-tools-button"><div class="fm-total_entries"><?php 
        echo $statistics["total_entries"];
        ?>
</div>Entries</div>
							<div class="fm-tools-button"><div class="fm-total_rate"><?php 
        echo $statistics["conversion_rate"];
        ?>
</div>Conversion Rate</div>
							<div class="fm-tools-button"><div class="fm-total_views"><?php 
        echo $statistics["total_views"] ? $statistics["total_views"] : 0;
        ?>
</div>Views</div>
						</div>
						
						<div class="fm-export-tools">
							<span class="exp_but_span">Export to</span>
							&nbsp;
							<button class="fm-tools-button" onclick="export_submissions('csv', 0); return false;">
								CSV
							</button>
							<button class="fm-tools-button" onclick="export_submissions('xml', 0); return false;">
								XML
							</button>
						</div>
					</div>
				</div>
				<div class="tablenav top">
					<div class="fm-filters">
						<div class="fm-search-tools">
							<input type="hidden" name="hide_label_list" value="<?php 
        echo $lists['hide_label_list'];
        ?>
"> 
							<button class="fm-icon show-filter-icon" onclick="show_hide_filter(); return false;" title="Show Filters">
								<span></span>
							</button>
							<button class="fm-icon search-icon" onclick="fm_form_submit(event, 'admin_form'); return false;" title="Search">
							</button>
							<button class="fm-icon reset-icon" onclick="remove_all(); fm_form_submit(event, 'admin_form'); return false;" title="Reset">
							</button>
						</div>
						<div class="fm-add-remove">
							<?php 
        if (isset($sorted_label_names)) {
            ?>
							<button class="fm-button" onclick="toggleChBDiv(true); return false;">
								Add/Remove Columns
							</button>
							<?php 
            WDW_FM_Library::html_page_nav($lists['total'], $lists['limit'], 'admin_form');
            ?>
							<?php 
        }
        ?>
							<input type="hidden" name="pagination_clicked" id="pagination_clicked" value=""/>
						</div>
					</div>
					<div class="fm-clear"></div>
				</div>
				
				<div class="fm-loading-container" style="display:none;">
					<div class="fm-loading-content">
					</div>
				</div>
				<div class="submit_content" id="fm-scroll" style="width: 100%;">
					<table class="wp-list-table widefat fixed posts table_content">
						<thead>
							<tr>
								<?php 
        if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
            ?>
 
								<th class="table_small_col count_col sub-align">PDF</th>
								<?php 
        }
        ?>
								<th class="table_small_col count_col sub-align">#</th>
								<th scope="col" id="cb" class="manage-column column-cb check-column table_small_col sub-align form_check"><input id="check_all" type="checkbox"></th>
								<th scope="col" id="submitid_fc" class="table_small_col sub-align submitid_fc <?php 
        if ($order_by == "group_id") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_id;
        ?>
>
									<a href="" class="sub_id" onclick="fm_set_input_value('order_by', 'group_id');
													   fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'group_id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
													   fm_form_submit(event, 'admin_form')">
										<span>ID</span>
										<span class="sorting-indicator" style="margin-top: 8px;"></span>
									</a>
								</th>
								<th class="table_small_col sub-align">Edit</th>
								<th class="table_small_col sub-align">Delete</th>
								<th scope="col" id="submitdate_fc" class="table_large_col submitdate_fc <?php 
        if ($order_by == "date") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_date;
        ?>
>
									<a href="" onclick="fm_set_input_value('order_by', 'date');
										fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'date' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
										fm_form_submit(event, 'admin_form')">
										<span>Submit date</span>
										<span class="sorting-indicator"></span>
									</a>
								</th>
								<th scope="col" id="submitterip_fc" class="table_medium_col_uncenter submitterip_fc <?php 
        if ($order_by == "ip") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_ip;
        ?>
>
									<a href="" onclick="fm_set_input_value('order_by', 'ip');
										fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'ip' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
										fm_form_submit(event, 'admin_form')">
										<span>Submitter's IP</span>
										<span class="sorting-indicator"></span>
									</a>
								</th>	
								<th scope="col" id="submitterusername_fc" class="table_medium_col_uncenter submitterusername_fc <?php 
        if ($order_by == "display_name") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_username;
        ?>
>
									<a href="" onclick="fm_set_input_value('order_by', 'display_name');
										fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'display_name' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
										fm_form_submit(event, 'admin_form')">
										<span>Submitter's Username</span>
										<span class="sorting-indicator"></span>
									</a>
								</th>	
								<th scope="col" id="submitteremail_fc" class="table_medium_col_uncenter submitteremail_fc <?php 
        if ($order_by == "user_email") {
            echo $oder_class;
        } else {
            echo $oder_class_default;
        }
        ?>
" <?php 
        echo $style_useremail;
        ?>
>
									<a href="" onclick="fm_set_input_value('order_by', 'user_email');
										fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'user_email' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
										fm_form_submit(event, 'admin_form')">
										<span>Submitter's Email Address</span>
										<span class="sorting-indicator"></span>
									</a>
								</th>	
								<?php 
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
            $styleStr2 = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
            $field_title = $this->model->get_type_address($sorted_label_types[$i], $sorted_label_names_original[$i]);
            if ($sorted_label_types[$i] == 'type_paypal_payment_status') {
                $ispaypal = TRUE;
                ?>
										<th <?php 
                echo $styleStr;
                ?>
 id="<?php 
                echo $sorted_labels_id[$i] . '_fc';
                ?>
" class="table_large_col <?php 
                echo $sorted_labels_id[$i] . '_fc';
                if ($order_by == $sorted_labels_id[$i] . "_field") {
                    echo $oder_class . '"';
                } else {
                    echo $oder_class_default . '"';
                }
                ?>
">
											<a href="" onclick="fm_set_input_value('order_by', '<?php 
                echo $sorted_labels_id[$i] . '_field';
                ?>
'); fm_set_input_value('asc_or_desc', '<?php 
                echo $order_by == $sorted_labels_id[$i] . '_field' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
                ?>
'); fm_form_submit(event, 'admin_form')">	
												<span><?php 
                echo $field_title;
                ?>
</span>
												<span class="sorting-indicator"></span>
											</a>
										</th>
										<th class="table_large_col payment_info_fc" <?php 
                echo $styleStr2;
                ?>
>Payment Info</th>
										<?php 
            } else {
                ?>
										<th <?php 
                echo $styleStr;
                ?>
 id="<?php 
                echo $sorted_labels_id[$i] . '_fc';
                ?>
" class="<?php 
                echo $sorted_label_types[$i] == 'type_mark_map' || $sorted_label_types[$i] == 'type_matrix' ? 'table_large_col ' : '';
                echo $sorted_labels_id[$i] . '_fc';
                if ($order_by == $sorted_labels_id[$i] . "_field") {
                    echo $oder_class . '"';
                } else {
                    echo $oder_class_default . '"';
                }
                ?>
">
											<a href="" onclick="fm_set_input_value('order_by', '<?php 
                echo $sorted_labels_id[$i] . '_field';
                ?>
'); fm_set_input_value('asc_or_desc', '<?php 
                echo $order_by == $sorted_labels_id[$i] . '_field' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
                ?>
'); fm_form_submit(event, 'admin_form')">
												<span><?php 
                echo $field_title;
                ?>
</span>
												<span class="sorting-indicator"></span>
											</a>
										</th>
										<?php 
            }
        }
        ?>
		           
							</tr>
							<tr id="fields_filter" style="display: none;">
								<th></th>
								<th></th> 
								<th class="submitid_fc" <?php 
        echo $style_id;
        ?>
 >
									<input type="text" name="id_search" id="id_search" value="<?php 
        echo $lists['id_search'];
        ?>
" onChange="this.form.submit();" style="width:30px"/>
								</th>
								<th></th>
								<th></th>
								<th width="150" class="submitdate_fc" <?php 
        echo $style_date;
        ?>
>
									<table align="center" style="margin:auto" class="simple_table">
										<tr class="simple_table">
											<td class="simple_table" style="text-align: left;">From:</td>
											<td style="text-align: center;" class="simple_table">
												<input class="inputbox" type="text" name="startdate" id="startdate" size="10" maxlength="10" value="<?php 
        echo $lists['startdate'];
        ?>
" />
											</td>
											<td style="text-align: center;" class="simple_table">
												<input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');" />
											</td>
										</tr>
										<tr class="simple_table">
											<td style="text-align: left;" class="simple_table">To:</td>
											<td style="text-align: center;" class="simple_table">
												<input class="inputbox" type="text" name="enddate" id="enddate" size="10" maxlength="10" value="<?php 
        echo $lists['enddate'];
        ?>
" />
											</td>
											<td style="text-align: center;" class="simple_table">
												<input type="reset" style="width: 22px; border-radius: 3px !important;" class="button" value="..." onclick="return showCalendar('enddate','%Y-%m-%d');" />
											</td>
										</tr>
									</table>
								</th>
								<th class="table_medium_col_uncenter submitterip_fc" <?php 
        echo $style_ip;
        ?>
>
									<input type="text" name="ip_search" id="ip_search" value="<?php 
        echo $lists['ip_search'];
        ?>
" onChange="this.form.submit();" />
								</th>
								<th class="table_medium_col_uncenter submitterusername_fc" <?php 
        echo $style_username;
        ?>
>
									<input type="text" name="username_search" id="username_search" value="<?php 
        echo $lists['username_search'];
        ?>
" onChange="this.form.submit();" />
								</th>
								<th class="table_medium_col_uncenter submitteremail_fc" <?php 
        echo $style_useremail;
        ?>
>
									<input type="text" name="useremail_search" id="useremail_search" value="<?php 
        echo $lists['useremail_search'];
        ?>
" onChange="this.form.submit();" />
								</th>
								<?php 
        for ($i = 0; $i < count($sorted_label_names); $i++) {
            $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$i]);
            if (!$ka_fielderov_search) {
                if ($lists[$form_id . '_' . $sorted_labels_id[$i] . '_search']) {
                    $ka_fielderov_search = TRUE;
                }
            }
            switch ($sorted_label_types[$i]) {
                case 'type_mark_map':
                    ?>
											<th class="table_large_col <?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
></th>
											<?php 
                    break;
                case 'type_paypal_payment_status':
                    ?>
											<th class="table_large_col <?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
>
												<select style="font-size: 11px; margin: 0; padding: 0; height: inherit;" name="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search" id="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search" onChange="this.form.submit();" value="<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
" >
													<option value="" ></option>
													<option value="canceled" >Canceled</option>
													<option value="cleared" >Cleared</option>
													<option value="cleared by payment review" >Cleared by payment review</option>
													<option value="completed" >Completed</option>
													<option value="denied" >Denied</option>
													<option value="failed" >Failed</option>
													<option value="held" >Held</option>
													<option value="in progress" >In progress</option>
													<option value="on hold" >On hold</option>
													<option value="paid" >Paid</option>
													<option value="partially refunded" >Partially refunded</option>
													<option value="pending verification" >Pending verification</option>
													<option value="placed" >Placed</option>
													<option value="processing" >Processing</option>
													<option value="refunded" >Refunded</option>
													<option value="refused" >Refused</option>
													<option value="removed" >Removed</option>
													<option value="returned" >Returned</option>
													<option value="reversed" >Reversed</option>
													<option value="temporary hold" >Temporary hold</option>
													<option value="unclaimed" >Unclaimed</option>
												</select>	
												<script> 
													var element = document.getElementById('<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i];
                    ?>
_search');
													element.value = '<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
';
												</script>
											</th>
											<th class="table_large_col  payment_info_fc" <?php 
                    echo $styleStr2;
                    ?>
></th>
											<?php 
                    break;
                default:
                    ?>
											<th class="<?php 
                    echo $sorted_labels_id[$i];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
>
												<input name="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                    ?>
" id="<?php 
                    echo $form_id . '_' . $sorted_labels_id[$i] . '_search';
                    ?>
" type="text" value="<?php 
                    echo $lists[$form_id . '_' . $sorted_labels_id[$i] . '_search'];
                    ?>
"  onChange="this.form.submit();" >
											</th>
											<?php 
                    break;
            }
        }
        ?>
							</tr>
						</thead>
						<?php 
        $k = 0;
        for ($www = 0, $qqq = count($group_id_s); $www < $qqq; $www++) {
            $i = $group_id_s[$www];
            $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
            $temp = $this->model->array_for_group_id($group_id_s[$www], $rows);
            $data = $temp[0];
            $userinfo = get_userdata($data->user_id_wd);
            $useremail = $userinfo ? $userinfo->user_email : "";
            $username = $userinfo ? $userinfo->display_name : "";
            ?>
							<tr <?php 
            echo $alternate;
            ?>
>
								<?php 
            if (defined('WD_FM_PDF') && is_plugin_active(constant('WD_FM_PDF'))) {
                ?>
 
								<td class="table_small_col pdf_col sub-align">
									<?php 
                if ($pdf_data && isset($pdf_data[$group_id_s[$www]])) {
                    ?>
 
									<a href="<?php 
                    echo site_url() . '/' . $pdf_data[$group_id_s[$www]];
                    ?>
" style="display: block;" download><img src="<?php 
                    echo WD_FM_PDF_URL . '/images/pdf-icon.png';
                    ?>
" /></a>
									<?php 
                }
                ?>
								</td>
								<?php 
            }
            ?>
								<td class="table_small_col count_col sub-align"><?php 
            echo $www + 1;
            ?>
</td>
								<td class="check-column table_small_col sub-align" style="padding: 0;">
									<input type="checkbox" name="post[]" value="<?php 
            echo $data->group_id;
            ?>
">
								</td>   
								<td class="table_small_col sub-align submitid_fc" id="submitid_fc" <?php 
            echo $style_id;
            ?>
>
									<a href="" onclick="fm_set_input_value('task', 'edit');						   fm_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
); fm_form_submit(event, 'admin_form');" >
										<?php 
            echo $data->group_id;
            ?>
									</a>
								</td> 
								<td class="table_small_col sub-align">
									<a href="" onclick="fm_set_input_value('task', 'edit');						   fm_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
); fm_form_submit(event, 'admin_form');">Edit
									</a>
								</td>
								<td class="table_small_col sub-align">
									<a href="" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
); fm_form_submit(event, 'admin_form'); } else { return false; }">Delete
									</a>
								</td>		 
								<td  class="table_large_col submitdate_fc sub-align" id="submitdate_fc" <?php 
            echo $style_date;
            ?>
>
									<a href="" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id',<?php 
            echo $data->group_id;
            ?>
); fm_form_submit(event, 'admin_form');" ><?php 
            echo $data->date;
            ?>
									</a>
								</td>
								<td class="table_medium_col_uncenter submitterip_fc sub-align" id="submitterip_fc" <?php 
            echo $style_ip;
            ?>
>
									<a class="thickbox-preview" href="<?php 
            echo add_query_arg(array('action' => 'fromipinfoinpopup', 'data_ip' => $data->ip, 'width' => '400', 'height' => '300', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
            ?>
" title="Show submitter information" <?php 
            echo !in_array($data->ip, $blocked_ips) ? '' : 'style="color: #FF0000;"';
            ?>
><?php 
            echo $data->ip;
            ?>
</a>
								</td>
								<td  class="table_large_col submitterusername_fc sub-align" id="submitterusername_fc" <?php 
            echo $style_username;
            ?>
>
									<?php 
            echo $username;
            ?>
								</td>
								<td  class="table_large_col submitteremail_fc sub-align" id="submitteremail_fc" <?php 
            echo $style_useremail;
            ?>
>
									<?php 
            echo $useremail;
            ?>
								</td>
								<?php 
            for ($h = 0; $h < $m; $h++) {
                $not_label = TRUE;
                for ($g = 0; $g < count($temp); $g++) {
                    $styleStr = $this->model->hide_or_not($lists['hide_label_list'], $sorted_labels_id[$h]);
                    if ($temp[$g]->element_label == $sorted_labels_id[$h]) {
                        if (strpos($temp[$g]->element_value, "***map***")) {
                            $map_params = explode('***map***', $temp[$g]->element_value);
                            ?>
												<td class="table_large_col <?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<a class="thickbox-preview" href="<?php 
                            echo add_query_arg(array('action' => 'frommapeditinpopup', 'long' => $map_params[0], 'lat' => $map_params[1], 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                            ?>
" title="Show on Map">Show on Map</a>
												</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "*@@url@@*")) {
                            ?>
												<td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<?php 
                            $new_files = explode("*@@url@@*", $temp[$g]->element_value);
                            foreach ($new_files as $new_file) {
                                if ($new_file) {
                                    $new_filename = explode('/', $new_file);
                                    $new_filename = $new_filename[count($new_filename) - 1];
                                    ?>
															<a target="_blank" class="fm_fancybox" rel="group_<?php 
                                    echo $www;
                                    ?>
" href="<?php 
                                    echo $new_file;
                                    ?>
"><?php 
                                    echo $new_filename;
                                    ?>
</a><br />
															<?php 
                                }
                            }
                            ?>
												</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "***star_rating***")) {
                            $view_star_rating_array = $this->model->view_for_star_rating($temp[$g]->element_value, $temp[$g]->element_label);
                            $stars = $view_star_rating_array[0];
                            ?>
												<td align="center" class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
><?php 
                            echo $stars;
                            ?>
</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "***matrix***")) {
                            ?>
   
												<td class="table_large_col <?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<a class="thickbox-preview" href="<?php 
                            echo add_query_arg(array('action' => 'show_matrix', 'matrix_params' => $temp[$g]->element_value, 'width' => '620', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                            ?>
" title="Show Matrix">Show Matrix</a>
												</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "@@@") !== FALSE || $temp[$g]->element_value == "@@@" || $temp[$g]->element_value == "@@@@@@@@@") {
                            ?>
												<td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<p><?php 
                            echo str_replace("@@@", " ", $temp[$g]->element_value);
                            ?>
</p>
												</td>
												<?php 
                        } elseif (strpos($temp[$g]->element_value, "***grading***")) {
                            $view_grading_array = $this->model->view_for_grading($temp[$g]->element_value);
                            $items = $view_grading_array[0];
                            ?>
												<td class="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc sub-align" id="<?php 
                            echo $sorted_labels_id[$h];
                            ?>
_fc" <?php 
                            echo $styleStr;
                            ?>
>
													<p><?php 
                            echo $items;
                            ?>
</p>
												</td>
												<?php 
                        } else {
                            if (strpos($temp[$g]->element_value, "***quantity***")) {
                                $temp[$g]->element_value = str_replace("***quantity***", " ", $temp[$g]->element_value);
                            }
                            if (strpos($temp[$g]->element_value, "***property***")) {
                                $temp[$g]->element_value = str_replace("***property***", " ", $temp[$g]->element_value);
                            }
                            if ($sorted_label_types[$h] == "type_submitter_mail") {
                                $query = $wpdb->prepare('SELECT id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id ="%d" AND group_id="%d" AND element_value="verified**%d"', $form_id, $i, $sorted_labels_id[$h]);
                                $isverified = $wpdb->get_var($query);
                                if ($isverified) {
                                    ?>
														<td class="<?php 
                                    echo $sorted_labels_id[$h];
                                    ?>
_fc" id="<?php 
                                    echo $sorted_labels_id[$h];
                                    ?>
_fc" <?php 
                                    echo $styleStr;
                                    ?>
>
															<p><?php 
                                    echo $temp[$g]->element_value;
                                    ?>
 <span style="color:#2DA068;">( Verified <img src="<?php 
                                    echo WD_FM_URL . '/images/verified.png';
                                    ?>
" /> )</span></p>
														</td>
													<?php 
                                } else {
                                    ?>
														<td class="<?php 
                                    echo $sorted_labels_id[$h];
                                    ?>
_fc" id="<?php 
                                    echo $sorted_labels_id[$h];
                                    ?>
_fc" <?php 
                                    echo $styleStr;
                                    ?>
>
															<p><?php 
                                    echo $temp[$g]->element_value;
                                    ?>
</p>
														</td>	
													<?php 
                                }
                            } else {
                                ?>
													<td class="<?php 
                                echo $sorted_labels_id[$h];
                                ?>
_fc sub-align" id="<?php 
                                echo $sorted_labels_id[$h];
                                ?>
_fc" <?php 
                                echo $styleStr;
                                ?>
>
														<p><?php 
                                echo str_replace("***br***", '<br>', stripslashes($temp[$g]->element_value));
                                ?>
</p>
													</td>
													<?php 
                            }
                        }
                        $not_label = FALSE;
                    }
                }
                if ($not_label) {
                    ?>
										<td class="<?php 
                    echo $sorted_labels_id[$h];
                    ?>
_fc sub-align" id="<?php 
                    echo $sorted_labels_id[$h];
                    ?>
_fc" <?php 
                    echo $styleStr;
                    ?>
><p>&nbsp;</p></td>
										<?php 
                }
            }
            if ($ispaypal) {
                $styleStr = $this->model->hide_or_not($lists['hide_label_list'], '@payment_info@');
                ?>
									<td class="table_large_col payment_info_fc sub-align" id="payment_info_fc" <?php 
                echo $styleStr;
                ?>
>
										<a class="thickbox-preview" href="<?php 
                echo add_query_arg(array('action' => 'paypal_info', 'id' => $i, 'width' => '600', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
                ?>
">
											<img src="<?php 
                echo WD_FM_URL . '/images/info.png';
                ?>
" />
										</a>
									</td>
									<?php 
            }
            ?>
							</tr>
							<?php 
            $k = 1 - $k;
        }
        ?>
					</table>
				</div>	 
				<?php 
        if ($sorted_label_types) {
            foreach ($sorted_label_types as $key => $sorted_label_type) {
                if ($this->model->check_radio_type($sorted_label_type)) {
                    $is_stats = true;
                    break;
                }
            }
            if ($is_stats) {
                $ajax_nonce = wp_create_nonce("nonce_fm_ajax");
                ?>
						<br/>
						<div class="fm-statistics">
							<h1>Statistics</h1>		
							<table class="stats">
								<tr>
									<td>
										<label for="sorted_label_key">Select a Field:</label>
									</td>
									<td>
										<select id="sorted_label_key">
											<option value="">Select a Field</option>
											<?php 
                foreach ($sorted_label_types as $key => $sorted_label_type) {
                    if ($sorted_label_type == "type_checkbox" || $sorted_label_type == "type_radio" || $sorted_label_type == "type_own_select" || $sorted_label_type == "type_country" || $sorted_label_type == "type_paypal_select" || $sorted_label_type == "type_paypal_radio" || $sorted_label_type == "type_paypal_checkbox" || $sorted_label_type == "type_paypal_shipping") {
                        ?>
													<option value="<?php 
                        echo $key;
                        ?>
"><?php 
                        echo $sorted_label_names_original[$key];
                        ?>
</option>
													<?php 
                    }
                }
                ?>
										</select>
									</td>
									<td></td>
								</tr>
								<tr>
									<td>
										<label>Select a Date:</label>
									</td>
									<td>
										From: <input class="inputbox"  type="text" name="startstats" id="startstats" size="9" maxlength="9" />
										  <input type="reset" class="button" style="width: 22px;"  value="..." name="startstats_but" id="startstats_but" onclick="return showCalendar('startstats','%Y-%m-%d');" /> 
											 
										To: <input class="inputbox" type="text" name="endstats" id="endstats" size="9" maxlength="9" />
										<input type="reset" class="button" style="width: 22px;"  value="..." name="endstats_but" id="endstats_but" onclick="return showCalendar('endstats','%Y-%m-%d');" />
									</td>
									<td>
										<button onclick="show_stats(); return false;">Show</button>
									</td>
								</tr>
							</table>
							
							<div id="div_stats"></div>	
						</div>
						<script>
						function show_stats() { 
							jQuery('#div_stats').html('<div class="fm-loading-container"><div class="fm-loading-content"></div></div>');
							if(jQuery('#sorted_label_key').val()!="") {	 	  
								jQuery('#div_stats').load('<?php 
                echo add_query_arg(array('action' => 'get_stats', 'page' => 'submissions_fm'), admin_url('admin-ajax.php'));
                ?>
', { 
									'task': 'show_stats',
									'form_id' : '<?php 
                echo $form_id;
                ?>
',
									'sorted_label_key' : jQuery('#sorted_label_key').val(),
									'startdate' : jQuery('#startstats').val(), 
									'enddate' : jQuery('#endstats').val(),
									'nonce_fm_ajax': '<?php 
                echo $ajax_nonce;
                ?>
'
								});
							}		
							else {
								jQuery('#div_stats').html("<div style='padding:10px 5px; color:red; font-size:14px;'>Please select the field!</div>");
							}	
							jQuery("#div_stats").removeClass("fm_loading");
						}
						</script>
						<?php 
            }
        }
        ?>
			</div>	
		</form>	
		<script> 
		function fm_scroll(element) {
			var scrollbar= document.createElement('div');
			scrollbar.appendChild(document.createElement('div'));
			scrollbar.style.overflow= 'auto';
			scrollbar.style.overflowY= 'hidden';
			scrollbar.firstChild.style.width= element.scrollWidth+'px';
			scrollbar.firstChild.style.paddingTop= '1px';
			scrollbar.firstChild.appendChild(document.createTextNode('\xA0'));
			scrollbar.onscroll= function() {
				element.scrollLeft= scrollbar.scrollLeft;
			};
			element.onscroll= function() {
				scrollbar.scrollLeft= element.scrollLeft;
			};
			element.parentNode.insertBefore(scrollbar, element);
		}
		jQuery(window).load(function() {
			fm_popup();
			fm_scroll(document.getElementById('fm-scroll'));
			if (typeof jQuery().fancybox !== 'undefined' && jQuery.isFunction(jQuery().fancybox)) {
				jQuery(".fm_fancybox").fancybox({
					'maxWidth ' : 600,
					'maxHeight' : 500
				});
			}
		});
		<?php 
        if ($ka_fielderov_search) {
            ?>
 
			document.getElementById('fields_filter').style.display = '';
        <?php 
        }
        ?>
		</script>
		<?php 
    }