columns
3 years ago
column_picker.php
3 years ago
group_picker.php
3 years ago
index.php
3 years ago
index.php
142 lines
| 1 | <?php $this->start('rows') ?> |
| 2 | <div id="iawp-rows" class="iawp-rows" data-row-count="<?php esc_attr_e($row_count); ?>"> |
| 3 | <?php if ($row_count == 0): ?> |
| 4 | <!-- No rows --> |
| 5 | <?php if ($table_name == 'views'): ?> |
| 6 | <p id="data-error" |
| 7 | class="data-error"><?php esc_html_e('No views found', 'independent-analytics'); ?></p> |
| 8 | <?php elseif ($table_name == 'referrers'): ?> |
| 9 | <p id="data-error" |
| 10 | class="data-error"><?php esc_html_e('No referrers found', 'independent-analytics'); ?></p> |
| 11 | <?php elseif ($table_name == 'geo'): ?> |
| 12 | <p id="data-error" |
| 13 | class="data-error"><?php esc_html_e('No geographic data found', 'independent-analytics'); ?></p> |
| 14 | <?php elseif ($table_name == 'campaigns'): ?> |
| 15 | <div class="data-error"> |
| 16 | |
| 17 | <p> |
| 18 | <?php esc_html_e('No campaign data found', 'independent-analytics'); ?> |
| 19 | </p> |
| 20 | <?php if(!$has_campaigns): ?> |
| 21 | <p> |
| 22 | <a href="?page=independent-analytics&tab=campaign-builder" |
| 23 | class="iawp-button purple"> |
| 24 | <?php esc_html_e('Create your first campaign', 'independent-analytics'); ?> |
| 25 | </a> |
| 26 | </p> |
| 27 | <?php endif; ?> |
| 28 | </div> |
| 29 | <?php endif; ?> |
| 30 | |
| 31 | <?php else: ?> |
| 32 | <!-- Some rows --> |
| 33 | <?php foreach ($rows as $index => $row): ?> |
| 34 | <?php $class = $table_name == 'views' && $row->is_deleted() ? 'iawp-row deleted' : 'iawp-row'; ?> |
| 35 | <div class="<?php esc_attr_e($class); ?>" <?php echo $this->row_data_attributes($row); ?>> |
| 36 | <?php foreach ($all_columns as $column): ?> |
| 37 | <?php $class = $column->visible() ? 'cell' : 'cell hide'; ?> |
| 38 | <div class="<?php esc_attr_e($class); ?>" |
| 39 | data-column="<?php esc_attr_e($column->id()); ?>" |
| 40 | data-test-visibility="<?php echo $column->visible() ? 'visible' : 'hidden'; ?>" |
| 41 | > |
| 42 | <div class="row-number"><?php echo $index + 1; ?></div> |
| 43 | <span class="cell-content"><?php echo wp_kses_post($this->cell_content($row, $column)); ?></span> |
| 44 | <span class="animator"></span> |
| 45 | </div> |
| 46 | <?php endforeach ?> |
| 47 | </div> |
| 48 | <?php endforeach; ?> |
| 49 | <?php endif; ?> |
| 50 | </div> |
| 51 | <?php $this->stop() ?> |
| 52 | |
| 53 | <?php $this->start('table') ?> |
| 54 | <div class="data-table-container"> |
| 55 | <div id='data-table' |
| 56 | class='data-table' |
| 57 | data-table-name='<?php esc_attr_e($table_name); ?>' |
| 58 | data-columns='<?php echo \IAWP\Utils\Security::json_encode($all_columns) ?>' |
| 59 | data-column-count='<?php echo count($all_columns); ?>' |
| 60 | style="margin: 2px; --columns: <?php echo absint($visible_column_count); ?>; --columns-mobile: <?php echo absint($visible_column_count - 1); ?>" |
| 61 | > |
| 62 | |
| 63 | <!-- Header --> |
| 64 | <div id="iawp-columns" class="iawp-columns"> |
| 65 | <div class="iawp-row" |
| 66 | data-controller="sort" |
| 67 | > |
| 68 | <?php foreach ($all_columns as $column): ?> |
| 69 | <?php $cell_class = $column->visible() ? 'cell' : 'cell hide'; ?> |
| 70 | <div class="<?php esc_attr_e($cell_class); ?>" |
| 71 | data-column="<?php esc_attr_e($column->id()); ?>" |
| 72 | data-test-visibility="<?php echo $column->visible() ? 'visible' : 'hidden'; ?>" |
| 73 | > |
| 74 | <button class="sort-button" |
| 75 | data-sort-target="sortButton" |
| 76 | data-sort-direction="<?php echo $column->id() === esc_attr($sort_by) ? esc_attr($sort_direction) : '' ?>" |
| 77 | data-default-sort-direction="<?php esc_attr_e($column->sort_direction()); ?>" |
| 78 | data-sort-column="<?php esc_attr_e($column->id()); ?>" |
| 79 | data-action="sort#sortByColumn" |
| 80 | > |
| 81 | <div class="row-number"></div> |
| 82 | <span class="name"><?php esc_html_e($column->label()); ?></span> |
| 83 | <span class="dashicons dashicons-arrow-right"></span> |
| 84 | <span class="dashicons dashicons-arrow-up"></span> |
| 85 | <span class="dashicons dashicons-arrow-down"></span> |
| 86 | <div class="animator"></div> |
| 87 | </button> |
| 88 | </div> |
| 89 | <?php endforeach ?> |
| 90 | </div> |
| 91 | </div> |
| 92 | |
| 93 | <!-- Rows --> |
| 94 | <?php if ($render_skeleton) : ?> |
| 95 | <div id="iawp-rows" class="iawp-rows rendering"> |
| 96 | <?php foreach (range(1, $page_size) as $index): ?> |
| 97 | <div class="iawp-row"> |
| 98 | <?php foreach ($all_columns as $column): ?> |
| 99 | <?php $class = $column->visible() ? 'cell' : 'cell hide'; ?> |
| 100 | <div class="<?php esc_attr_e($class); ?>" |
| 101 | data-column="<?php esc_attr_e($column->id()); ?>" |
| 102 | data-test-visibility="<?php echo $column->visible() ? 'visible' : 'hidden'; ?>" |
| 103 | > |
| 104 | <div class="row-number"></div> |
| 105 | <span class="cell-content"> |
| 106 | <span class="skeleton-loader"></span> |
| 107 | </span> |
| 108 | <span class="animator"></span> |
| 109 | </div> |
| 110 | <?php endforeach ?> |
| 111 | </div> |
| 112 | <?php endforeach ?> |
| 113 | </div> |
| 114 | <?php else: ?> |
| 115 | <?php echo $this->section('rows') ?> |
| 116 | <?php endif; ?> |
| 117 | </div> |
| 118 | </div> |
| 119 | |
| 120 | <div class="pagination"> |
| 121 | <button id="pagination-button" class="iawp-button purple" |
| 122 | data-report-target="loadMore" |
| 123 | data-action="report#loadMore" |
| 124 | > |
| 125 | <span class="disabled-button-text"> |
| 126 | <?php esc_html_e('Showing All Rows', 'independent-analytics'); ?> |
| 127 | </span> |
| 128 | <span class="enabled-button-text"> |
| 129 | <?php printf(esc_html__('Load Next %d Rows', 'independent-analytics'), absint($page_size)); ?> |
| 130 | </span> |
| 131 | </button> |
| 132 | </div> |
| 133 | <?php $this->stop() ?> |
| 134 | |
| 135 | <?php if ($just_rows == true): ?> |
| 136 | <?php echo $this->section('rows') ?> |
| 137 | <?php else: ?> |
| 138 | <div id="iawp-table-wrapper"> |
| 139 | <?php echo $this->section('table') ?> |
| 140 | </div> |
| 141 | <?php endif; ?> |
| 142 |