| 1 |
<?php |
| 2 |
/** |
| 3 |
* @version $ Id; view.php 21-03-2012 03:22:10 Ahmed Said $ |
| 4 |
*/ |
| 5 |
|
| 6 |
// Diallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
/** |
| 10 |
* Get Add-New-Block view markups. |
| 11 |
* |
| 12 |
* The method is resposible for selecting the correct template |
| 13 |
* and initialize template vars. |
| 14 |
* |
| 15 |
* @author Ahmed Said |
| 16 |
* @version 6 |
| 17 |
*/ |
| 18 |
class CJTBlocksNewView extends CJTView { |
| 19 |
|
| 20 |
/** |
| 21 |
* put your comment there... |
| 22 |
* |
| 23 |
* @var mixed |
| 24 |
*/ |
| 25 |
public $position; |
| 26 |
|
| 27 |
/** |
| 28 |
* Initialize view object. |
| 29 |
* |
| 30 |
* @see CJTView for more details |
| 31 |
* @return void |
| 32 |
*/ |
| 33 |
public function __construct($parameters) { |
| 34 |
parent::__construct($parameters); |
| 35 |
// Enqueue Styles & Scripts. |
| 36 |
add_action('admin_print_styles', array(__CLASS__, 'enququeStyles')); |
| 37 |
add_action('admin_print_scripts', array(__CLASS__, 'enququeScripts')); |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Output Add New Block markups. |
| 42 |
* |
| 43 |
* @return void |
| 44 |
*/ |
| 45 |
public function display() { |
| 46 |
$defaultValues = array('position'); |
| 47 |
// Get form fields default values. |
| 48 |
foreach ($defaultValues as $name) { |
| 49 |
if (array_key_exists($name, $_GET)) { |
| 50 |
$this->$name = $_GET[$name]; |
| 51 |
} |
| 52 |
} |
| 53 |
echo $this->getTemplate('default'); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Output Javascript files requirred to Add-New-Block view to run. |
| 58 |
* |
| 59 |
* @return void |
| 60 |
*/ |
| 61 |
public static function enququeScripts() { |
| 62 |
// Use related scripts. |
| 63 |
self::useScripts(__CLASS__, |
| 64 |
'jquery', |
| 65 |
'thickbox', |
| 66 |
'jquery-serialize-object', |
| 67 |
'framework:js:misc:{CJT-}simple-error-dialog', |
| 68 |
'views:blocks:new:public:js:{CJT-}add-new-block' |
| 69 |
); |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Output CSS files required to Add-New-Block view. |
| 74 |
* |
| 75 |
* @return void |
| 76 |
*/ |
| 77 |
public static function enququeStyles() { |
| 78 |
// Use related styles. |
| 79 |
self::useStyles(__CLASS__, |
| 80 |
'thickbox', |
| 81 |
'framework:css:{CJT-}error-dialog', |
| 82 |
'framework:css:{CJT-}forms' |
| 83 |
); |
| 84 |
} |
| 85 |
|
| 86 |
} // End class. |
| 87 |
|
| 88 |
// Hookable!! |
| 89 |
CJTBlocksNewView::define('CJTBlocksNewView'); |