index.php
11 years ago
page-campaigns.php
6 years ago
page-form.php
6 years ago
page-home.php
6 years ago
page-lists.php
6 years ago
page-scenarios.php
8 years ago
page-statistics.php
6 years ago
page-statistics.php
122 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Admin page : dashboard |
| 4 | * |
| 5 | * @package SIB_Page_Statistics |
| 6 | */ |
| 7 | |
| 8 | if ( ! class_exists( 'SIB_Page_Statistics' ) ) { |
| 9 | /** |
| 10 | * Page class that handles backend page <i>dashboard ( for admin )</i> with form generation and processing |
| 11 | * |
| 12 | * @package SIB_Page_Statistics |
| 13 | */ |
| 14 | class SIB_Page_Statistics { |
| 15 | |
| 16 | /** |
| 17 | * Page slug |
| 18 | */ |
| 19 | const PAGE_ID = 'sib_page_statistics'; |
| 20 | |
| 21 | /** |
| 22 | * Page hook |
| 23 | * |
| 24 | * @var string |
| 25 | */ |
| 26 | protected $page_hook; |
| 27 | |
| 28 | /** |
| 29 | * Page tabs |
| 30 | * |
| 31 | * @var mixed |
| 32 | */ |
| 33 | protected $tabs; |
| 34 | |
| 35 | /** |
| 36 | * Constructs new page object and adds entry to WordPress admin menu |
| 37 | */ |
| 38 | function __construct() { |
| 39 | $this->page_hook = add_submenu_page( SIB_Page_Home::PAGE_ID, __( 'Statistics', 'sib_lang' ), __( 'Statistics', 'sib_lang' ), 'manage_options', self::PAGE_ID, array( &$this, 'generate' ) ); |
| 40 | add_action( 'load-' . $this->page_hook, array( &$this, 'init' ) ); |
| 41 | add_action( 'admin_print_scripts-' . $this->page_hook, array( $this, 'enqueue_scripts' ) ); |
| 42 | add_action( 'admin_print_styles-' . $this->page_hook, array( $this, 'enqueue_styles' ) ); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Init Process |
| 47 | */ |
| 48 | function Init() { |
| 49 | add_action( 'admin_notices', array( 'SIB_Manager', 'language_admin_notice' ) ); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Enqueue scripts of plugin |
| 54 | */ |
| 55 | function enqueue_scripts() { |
| 56 | wp_enqueue_script( 'sib-admin-js' ); |
| 57 | wp_enqueue_script( 'sib-bootstrap-js' ); |
| 58 | wp_localize_script( |
| 59 | 'sib-admin-js', 'ajax_sib_object', |
| 60 | array( |
| 61 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 62 | ) |
| 63 | ); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Enqueue style sheets of plugin |
| 68 | */ |
| 69 | function enqueue_styles() { |
| 70 | wp_enqueue_style( 'sib-admin-css' ); |
| 71 | wp_enqueue_style( 'sib-bootstrap-css' ); |
| 72 | wp_enqueue_style( 'sib-fontawesome-css' ); |
| 73 | wp_enqueue_style( 'thickbox' ); |
| 74 | } |
| 75 | |
| 76 | /** Generate page script */ |
| 77 | function generate() { |
| 78 | ?> |
| 79 | <div id="wrap1" class="box-border-box container-fluid"> |
| 80 | <div id="main-content" class="row"> |
| 81 | <?php |
| 82 | if ( SIB_Manager::is_done_validation() ) { |
| 83 | $this->generate_main_page(); |
| 84 | } else { |
| 85 | $this->generate_welcome_page(); |
| 86 | } |
| 87 | ?> |
| 88 | </div> |
| 89 | </div> |
| 90 | <style> |
| 91 | #wpcontent { |
| 92 | margin-left: 160px !important; |
| 93 | } |
| 94 | |
| 95 | @media only screen and (max-width: 918px) { |
| 96 | #wpcontent { |
| 97 | margin-left: 40px !important; |
| 98 | } |
| 99 | } |
| 100 | </style> |
| 101 | <?php |
| 102 | } |
| 103 | |
| 104 | /** Generate main page */ |
| 105 | function generate_main_page() { |
| 106 | $access_token = SIB_API_Manager::update_access_token(); |
| 107 | $lang = substr( get_bloginfo( 'language' ),0,2 ); |
| 108 | ?> |
| 109 | <iframe id="datamain" src="https://my.sendinblue.com/camp/message/access_token/<?php echo esc_attr( $access_token ); ?>?lang=<?php echo esc_attr( $lang ); ?>" width="100%" height="750" scrolling="yes"></iframe> |
| 110 | <?php |
| 111 | } |
| 112 | |
| 113 | /** Generate welcome page */ |
| 114 | function generate_welcome_page() { |
| 115 | ?> |
| 116 | <img src="<?php echo esc_url( SIB_Manager::$plugin_url . '/img/background/statistics.png' ); ?>" style="width: 100%;"> |
| 117 | <?php |
| 118 | SIB_Page_Home::print_disable_popup(); |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 |