| 1 |
<?php |
| 2 |
/** |
| 3 |
* @version $ Id; blocks.php 21-03-2012 03:22:10 Ahmed Said $ |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
/** |
| 10 |
* Blocks page controller. |
| 11 |
* |
| 12 |
* @author Ahmed Said |
| 13 |
* @version 6 |
| 14 |
*/ |
| 15 |
class CJTBlocksController extends CJTController { |
| 16 |
|
| 17 |
/** |
| 18 |
* put your comment there... |
| 19 |
* |
| 20 |
* @var mixed |
| 21 |
*/ |
| 22 |
protected $controllerInfo = array('model' => 'blocks', 'view' => 'blocks/manager'); |
| 23 |
|
| 24 |
/** |
| 25 |
* Wordpress page id used to identify the page |
| 26 |
* and for associated meta data and some Wordpress options |
| 27 |
* to it. |
| 28 |
* |
| 29 |
* @var string |
| 30 |
*/ |
| 31 |
private $pageHookName = null; |
| 32 |
|
| 33 |
/** |
| 34 |
* put your comment there... |
| 35 |
* |
| 36 |
*/ |
| 37 |
public function extensionsAction() { |
| 38 |
parent::displayAction(); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Display blocks page content. |
| 43 |
* |
| 44 |
* The method directory output the content of the |
| 45 |
* blocks page into the output buffer. |
| 46 |
* |
| 47 |
* It doesn't nothing except getting the HTML template for |
| 48 |
* the blocks page and fill it with the exists blocks. |
| 49 |
* |
| 50 |
* @return void |
| 51 |
*/ |
| 52 |
public function indexAction() { |
| 53 |
// Prepare backupId in case backup is restored. |
| 54 |
$backupId = filter_input(INPUT_GET, 'backupId', FILTER_SANITIZE_NUMBER_INT); |
| 55 |
$blocks['filters']['type'] = 'block'; |
| 56 |
// If backupId is not provided it must be NULL in the filter, |
| 57 |
$blocks['filters']['backupId'] = $backupId ? $backupId : null; |
| 58 |
$blocks['filters']['returnCodeFile'] = true; |
| 59 |
// Push data to the view. |
| 60 |
$this->view->blocks = $this->model->getBlocks(null, $blocks['filters']); |
| 61 |
$this->view->order = $this->model->getOrder(); |
| 62 |
$this->view->backupId = $blocks['filters']['backupId']; |
| 63 |
$this->view->securityToken = $this->createSecurityToken(); |
| 64 |
// page hook is added later after this object is already created. |
| 65 |
// Get page hook directrly from controllers. |
| 66 |
$this->view->pageHook = CJTPlugin::PLUGIN_REQUEST_ID; |
| 67 |
// Output the view. |
| 68 |
echo $this->view->display(); |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* put your comment there... |
| 73 |
* |
| 74 |
*/ |
| 75 |
protected function installAction() { |
| 76 |
// Initialize. |
| 77 |
$model = $this->getModel('installer'); |
| 78 |
// Do fresh installation if the installed version and the |
| 79 |
// current version doesn't share the same release and edition signs. |
| 80 |
if ($model->isUpgrade() && $model->isCommonRelease()) { |
| 81 |
$this->request['layout'] = 'upgrade'; |
| 82 |
} |
| 83 |
echo parent::displayAction(); |
| 84 |
} |
| 85 |
|
| 86 |
/** |
| 87 |
* put your comment there... |
| 88 |
* |
| 89 |
*/ |
| 90 |
protected function notInstalledNoticeAction() { |
| 91 |
$model = $this->getModel('installer'); |
| 92 |
// Diplay notice only if not dismissed! |
| 93 |
if (!$model->dismissNotice()) { |
| 94 |
echo parent::displayAction(); |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* put your comment there... |
| 100 |
* |
| 101 |
*/ |
| 102 |
public function setupAction() { |
| 103 |
echo parent::displayAction(); |
| 104 |
} |
| 105 |
|
| 106 |
} // End class. |