| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
/** |
| 10 |
* |
| 11 |
*/ |
| 12 |
class CJTPackagesManagerView extends CJTView { |
| 13 |
|
| 14 |
/** |
| 15 |
* put your comment there... |
| 16 |
* |
| 17 |
* @var mixed |
| 18 |
*/ |
| 19 |
protected $items; |
| 20 |
|
| 21 |
/** |
| 22 |
* put your comment there... |
| 23 |
* |
| 24 |
* @var mixed |
| 25 |
*/ |
| 26 |
protected $itemsPerPage; |
| 27 |
|
| 28 |
/** |
| 29 |
* put your comment there... |
| 30 |
* |
| 31 |
* @var mixed |
| 32 |
*/ |
| 33 |
protected $itemsTotal; |
| 34 |
|
| 35 |
/** |
| 36 |
* put your comment there... |
| 37 |
* |
| 38 |
* @var mixed |
| 39 |
*/ |
| 40 |
protected $securityToken; |
| 41 |
|
| 42 |
/** |
| 43 |
* put your comment there... |
| 44 |
* |
| 45 |
* @param mixed $info |
| 46 |
* @return CJTInstallerNoticeView |
| 47 |
*/ |
| 48 |
public function __construct($info) { |
| 49 |
// CJTView class! |
| 50 |
parent::__construct($info); |
| 51 |
// register callback to show styles needed for the admin page |
| 52 |
add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles')); |
| 53 |
// Load scripts for admin panel working |
| 54 |
add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts')); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* put your comment there... |
| 59 |
* |
| 60 |
* @param mixed $tpl |
| 61 |
*/ |
| 62 |
public function display($tpl = null) { |
| 63 |
// Initialize. |
| 64 |
$model = $this->getModel('packages'); |
| 65 |
// Cache view vars. |
| 66 |
$this->itemsTotal = $model->getItemsTotal(); |
| 67 |
$this->itemsPerPage = $model->getItemsPerPage(); |
| 68 |
$this->items = $model->getItems(); |
| 69 |
$this->securityToken = cssJSToolbox::getSecurityToken(); |
| 70 |
// Display view. |
| 71 |
echo $this->getTemplate($tpl); |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* put your comment there... |
| 76 |
* |
| 77 |
*/ |
| 78 |
public static function enqueueScripts() { |
| 79 |
// Import dependencies scripts! |
| 80 |
self::useScripts(__CLASS__, |
| 81 |
'jquery', |
| 82 |
'jquery-serialize-object', |
| 83 |
'framework:js:ajax:{CJT-}cjt-server', |
| 84 |
'thickbox', |
| 85 |
'views:packages:manager:public:js:{CJT_PACKAGES-}manager' |
| 86 |
); |
| 87 |
} |
| 88 |
|
| 89 |
/** |
| 90 |
* put your comment there... |
| 91 |
* |
| 92 |
*/ |
| 93 |
public static function enqueueStyles() { |
| 94 |
// Import dependencies styles! |
| 95 |
self::useStyles(__CLASS__, |
| 96 |
'wp-admin', |
| 97 |
'colors-fresh', |
| 98 |
'thickbox', |
| 99 |
'views:packages:manager:public:css:{CJT-}default' |
| 100 |
); |
| 101 |
} |
| 102 |
|
| 103 |
} // End class. |
| 104 |
|
| 105 |
// Hookable!! |
| 106 |
CJTPackagesManagerView::define('CJTPackagesManagerView'); |