| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
abstract class Qi_Blocks_Admin_Sub_Pages { |
| 8 |
private $base; |
| 9 |
private $menu_slag; |
| 10 |
private $title; |
| 11 |
private $position; |
| 12 |
private $atts = array(); |
| 13 |
|
| 14 |
public function __construct() { |
| 15 |
$this->add_sub_page(); |
| 16 |
} |
| 17 |
|
| 18 |
abstract public function add_sub_page(); |
| 19 |
|
| 20 |
function get_base() { |
| 21 |
return $this->base; |
| 22 |
} |
| 23 |
|
| 24 |
function set_base( $base ) { |
| 25 |
$this->base = $base; |
| 26 |
} |
| 27 |
|
| 28 |
function get_menu_slug() { |
| 29 |
return $this->menu_slag; |
| 30 |
} |
| 31 |
|
| 32 |
function set_menu_slug( $menu_slag ) { |
| 33 |
$this->menu_slag = $menu_slag; |
| 34 |
} |
| 35 |
|
| 36 |
function get_title() { |
| 37 |
return $this->title; |
| 38 |
} |
| 39 |
|
| 40 |
function set_title( $title ) { |
| 41 |
$this->title = $title; |
| 42 |
} |
| 43 |
|
| 44 |
function get_position() { |
| 45 |
return $this->position; |
| 46 |
} |
| 47 |
|
| 48 |
function set_position( $position ) { |
| 49 |
$this->position = $position; |
| 50 |
} |
| 51 |
|
| 52 |
function get_atts() { |
| 53 |
return $this->atts; |
| 54 |
} |
| 55 |
|
| 56 |
function set_atts( $atts ) { |
| 57 |
$this->atts = $atts; |
| 58 |
} |
| 59 |
|
| 60 |
function render() { |
| 61 |
$args = $this->get_atts(); |
| 62 |
$args['this_object'] = $this; |
| 63 |
|
| 64 |
qi_blocks_template_part( 'admin/admin-pages', 'templates/holder', '', $args ); |
| 65 |
} |
| 66 |
|
| 67 |
function get_header() { |
| 68 |
Qi_Blocks_Admin_General_Page::get_instance()->get_header( $this ); |
| 69 |
} |
| 70 |
|
| 71 |
function get_footer() { |
| 72 |
Qi_Blocks_Admin_General_Page::get_instance()->get_footer(); |
| 73 |
} |
| 74 |
|
| 75 |
function get_sidebar() { |
| 76 |
Qi_Blocks_Admin_General_Page::get_instance()->get_sidebar(); |
| 77 |
} |
| 78 |
|
| 79 |
function get_content() { |
| 80 |
qi_blocks_template_part( 'admin/admin-pages/sub-pages/' . $this->get_base(), 'templates/' . $this->get_base(), '', $this->get_atts() ); |
| 81 |
} |
| 82 |
} |
| 83 |
|