PluginProbe
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager / 1.1
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager v1.1
10.56 1.2.1 10 10.1 10.2 10.3 10.31 10.32 10.33 10.34 10.50 10.51 10.52 10.53 10.55 9.0 9.0.1 9.4 trunk 1.0.0 1.1 1.2
easy-code-manager / controllers / block.php

block.php in FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager 1.1, at controllers/block.php

104 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 // import dependencies.
10 cssJSToolbox::import('framework:mvc:controller-ajax.inc.php');
11
12 /**
13 * This class should replace any other controllers that
14 * has methods for interacting with a single Block (e.g block-ajax!)
15 *
16 * All single Block actions (e.g edit, new and save) should be placed/moved here
17 * in the future!
18 */
19 class CJTBlockController extends CJTAjaxController {
20
21 /**
22 * put your comment there...
23 *
24 * @var mixed
25 */
26 protected $controllerInfo = array('model' => 'x-block', 'model_file' => 'xblock');
27
28 /**
29 * put your comment there...
30 *
31 */
32 public function __construct() {
33 parent::__construct();
34 // Actions!
35 $this->registryAction('getBlockBy');
36 $this->registryAction('getAPOP');
37 $this->registryAction('getCode');
38 }
39
40 /**
41 * Query single block based on the provided criteria!
42 *
43 */
44 public function getBlockByAction()
45 {
46 // Initialize.
47 $returns = array_flip($_GET['returns']);
48 // Set inputs.
49 $inputs =& $this->model->inputs;
50 $inputs['filter'] = $_GET['filter'];
51 // Query Block.
52 $this->response = array_intersect_key((array) $this->model->getBlockBy(), $returns);
53 }
54
55 /**
56 * Get assigment panel objects page.
57 *
58 */
59 public function getAPOPAction()
60 {
61 // Read inputs.
62 $iPerPage = (int) $_GET['iPerPage'];
63 $blockId = (int) $_GET['block'];
64 $oTypeParams = $_GET['typeParams'];
65 $offset = $_GET['index'];
66 $assignedOnly = ($_GET['assignedOnly'] == 'false') ? false : true;
67 $initialize = ($_GET['initialize'] == 'false') ? false : true;
68
69 // Get the corresponding type object
70 // for handling the request.
71 $typeName = $oTypeParams['targetType'];
72
73 /**
74 * put your comment there...
75 *
76 * @var CJT_Models_Block_Assignmentpanel_Base
77 */
78 $typeObject = CJT_Models_Block_Assignmentpanel_Base::getInstance(
79 $assignedOnly,
80 $typeName,
81 $offset,
82 $iPerPage,
83 $blockId,
84 $oTypeParams
85 );
86
87 // Fetch next page.
88 $items = $typeObject->getItems();
89
90 // Return result
91 $this->response['count'] = count($items);
92 $this->response['items'] = $items;
93
94 // Return count only when the list is activated for
95 // the first time.
96 if ($initialize)
97 {
98 $this->response['total'] = $typeObject->getTotalCount();
99 }
100
101 }
102
103 } // End class.
104