widget-modules.php
154 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Template for the widgets that display the modules of each module type. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.0.0 |
| 7 | */ |
| 8 | |
| 9 | ?> |
| 10 | <div class="sui-box"> |
| 11 | |
| 12 | <div class="sui-box-header"> |
| 13 | |
| 14 | <h2 class="sui-box-title"> |
| 15 | <span class="sui-icon-<?php echo esc_attr( $widget_type ); ?>" aria-hidden="true"></span> |
| 16 | <?php echo esc_html( $widget_name ); ?> |
| 17 | </h2> |
| 18 | |
| 19 | </div> |
| 20 | |
| 21 | <div class="sui-box-body"> |
| 22 | |
| 23 | <p><?php echo esc_html( $description ); ?></p> |
| 24 | |
| 25 | <?php if ( count( $modules ) ) { ?> |
| 26 | |
| 27 | </div> |
| 28 | |
| 29 | <table class="sui-table sui-table-flushed hui-table-dashboard"> |
| 30 | |
| 31 | <thead> |
| 32 | |
| 33 | <tr> |
| 34 | |
| 35 | <th><?php esc_html_e( 'Name', 'hustle' ); ?></th> |
| 36 | <th class="hui-status"><?php esc_html_e( 'Status', 'hustle' ); ?></th> |
| 37 | |
| 38 | </tr> |
| 39 | |
| 40 | </thead> |
| 41 | |
| 42 | <tbody> |
| 43 | |
| 44 | <?php |
| 45 | foreach ( $modules as $module ) { |
| 46 | |
| 47 | $status_class = 'draft'; |
| 48 | $status_name = esc_html__( 'Draft', 'hustle' ); |
| 49 | |
| 50 | if ( $module->active ) { |
| 51 | $status_class = 'published'; |
| 52 | $status_name = esc_html__( 'Published', 'hustle' ); |
| 53 | } |
| 54 | ?> |
| 55 | |
| 56 | <tr> |
| 57 | |
| 58 | <td class="sui-table-item-title"><?php echo esc_attr( $module->module_name ); ?></td> |
| 59 | |
| 60 | <td class="hui-status"> |
| 61 | |
| 62 | <div class="hui-status-elements"> |
| 63 | |
| 64 | <span class="sui-status-dot sui-<?php echo esc_attr( $status_class ); ?> sui-tooltip" |
| 65 | data-tooltip="<?php echo esc_html( $status_name ); ?>"> |
| 66 | <span aria-hidden="true"></span> |
| 67 | </span> |
| 68 | |
| 69 | <a href=" |
| 70 | <?php |
| 71 | echo esc_url( |
| 72 | add_query_arg( |
| 73 | array( |
| 74 | 'page' => $module->get_listing_page(), |
| 75 | 'view-stats' => $module->module_id, |
| 76 | ) |
| 77 | ), |
| 78 | 'admin.php' |
| 79 | ); |
| 80 | ?> |
| 81 | " class="sui-button-icon sui-tooltip" |
| 82 | data-tooltip="<?php esc_html_e( 'View Stats', 'hustle' ); ?>"> |
| 83 | <span class="sui-icon-graph-line" aria-hidden="true"></span> |
| 84 | </a> |
| 85 | |
| 86 | <div class="sui-dropdown"> |
| 87 | <?php |
| 88 | // Actions. |
| 89 | $this->render( |
| 90 | 'admin/commons/sui-listing/elements/actions', |
| 91 | array( |
| 92 | 'module' => $module, |
| 93 | 'dashboard' => true, |
| 94 | 'smallcaps_singular' => $smallcaps_singular, |
| 95 | 'capitalize_singular' => $capitalize_singular, |
| 96 | ) |
| 97 | ); |
| 98 | ?> |
| 99 | </div> |
| 100 | |
| 101 | </div> |
| 102 | |
| 103 | </td> |
| 104 | |
| 105 | </tr> |
| 106 | |
| 107 | <?php } ?> |
| 108 | |
| 109 | </tbody> |
| 110 | |
| 111 | </table> |
| 112 | |
| 113 | <div class="sui-box-footer"> |
| 114 | |
| 115 | <?php } ?> |
| 116 | |
| 117 | <?php $query_array = array( 'page' => Hustle_Data::get_listing_page_by_module_type( $widget_type ) ); ?> |
| 118 | |
| 119 | <?php if ( $capability['hustle_create'] ) { ?> |
| 120 | <a |
| 121 | href=" |
| 122 | <?php |
| 123 | if ( ! Hustle_Data::was_free_limit_reached( $widget_type ) ) { |
| 124 | $args = array_merge( $query_array, array( 'create-module' => 'true' ) ); |
| 125 | } else { |
| 126 | $args = array_merge( $query_array, array( 'requires-pro' => 'true' ) ); |
| 127 | } |
| 128 | echo esc_url( add_query_arg( $args, 'admin.php' ) ); |
| 129 | ?> |
| 130 | " |
| 131 | class="sui-button sui-button-blue" |
| 132 | > |
| 133 | <span class="sui-icon-plus" aria-hidden="true"></span> |
| 134 | <?php esc_html_e( 'Create', 'hustle' ); ?> |
| 135 | </a> |
| 136 | <?php } ?> |
| 137 | |
| 138 | <?php if ( count( $modules ) ) : ?> |
| 139 | |
| 140 | <div class="sui-actions-right"> |
| 141 | <p><small><strong> |
| 142 | <a href="<?php echo esc_url( add_query_arg( $query_array, 'admin.php' ) ); ?>" style="color: #888888;"> |
| 143 | <?php /* translators: widget's module type */ ?> |
| 144 | <?php printf( esc_html__( 'View all %s', 'hustle' ), esc_html( strtolower( $widget_name ) ) ); ?> |
| 145 | </a> |
| 146 | </strong></small></p> |
| 147 | </div> |
| 148 | |
| 149 | <?php endif; ?> |
| 150 | |
| 151 | </div> |
| 152 | |
| 153 | </div> |
| 154 |