PluginProbe
CSS & JavaScript Toolbox / 11.5
CSS & JavaScript Toolbox v11.5
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
← All changes | views/blocks/block/view.php +79 -39 1011.5 View file →
@@ -9,50 +9,57 @@
9 9 /**
10 10 * Blocks view
11 11 */
12 12 class CJTBlocksBlockView extends CJTView {
13 -
13 +
14 14 /** */
15 15 const META_BOX_PREFIX = 'cjtoolbox';
16 -
16 +
17 17 /**
18 18 * put your comment there...
19 - *
19 + *
20 20 * @var mixed
21 21 */
22 22 public $block = null;
23 -
23 +
24 24 /**
25 25 * put your comment there...
26 - *
26 + *
27 27 * @var mixed
28 28 */
29 29 public $isClosed;
30 -
30 +
31 31 /**
32 32 * put your comment there...
33 - *
33 + *
34 34 * @var mixed
35 35 */
36 36 protected $localization;
37 -
37 +
38 + /**
39 + * put your comment there...
40 + *
41 + * @var mixed
42 + */
43 + protected $ontoolbox = array('parameters' => array('block'));
44 +
38 45 /**
39 46 * put your comment there...
40 - *
47 + *
41 48 * @var mixed
42 49 */
43 50 protected $params = array();
44 -
51 +
45 52 /**
46 53 * put your comment there...
47 - *
54 + *
48 55 * @var mixed
49 56 */
50 57 public $templateName = 'edit';
51 -
58 +
52 59 /**
53 60 * put your comment there...
54 - *
61 + *
55 62 */
56 63 public function __construct($viewInfo) {
57 64 parent::__construct($viewInfo);
58 65 // Enqueue Styles & Scripts.
@@ -62,29 +69,29 @@
62 69 $this->params = (object) $this->params;
63 70 // Load localization text.
64 71 $this->localization = require($this->getPath('public/js/jquery.block/jquery.block.localization.php'));
65 72 }
66 -
73 +
67 74 /**
68 75 * put your comment there...
69 - *
76 + *
70 77 */
71 78 public function display($template = null) {
72 79 // Import template.
73 80 echo $this->getTemplate($template ? $template : $this->templateName);
74 81 }
75 -
82 +
76 83 /**
77 84 * put your comment there...
78 - *
85 + *
79 86 */
80 87 public static function enqueueScripts() {
81 88 // Use related scripts.
82 89 self::useScripts(__CLASS__,
83 90 'jquery',
84 - 'common',
85 - 'wp-lists',
86 - 'postbox',
91 + 'common',
92 + 'wp-lists',
93 + 'postbox',
87 94 'thickbox',
88 95 'framework:js:hash:{CJT-}md5',
89 96 'framework:js:cookies:{CJT-}jquery.cookies.2.2.0',
90 97 'framework:js:ajax:{CJT-}cjt-server',
@@ -98,15 +105,15 @@
98 105 'views:blocks:block:public:js:{CJT-}codefile-manager',
99 106 'views:blocks:block:public:js:{CJT-}codefile',
100 107 'views:blocks:block:public:js:{CJT-}block',
101 108 'views:blocks:block:public:js:plugins:{CJT-}_dockmodule',
102 - 'views:blocks:block:public:js:{CJT-}jquery.block'
109 + 'views:blocks:block:public:js:{CJT-}jquery.block'
103 110 );
104 111 }
105 -
112 +
106 113 /**
107 114 * put your comment there...
108 - *
115 + *
109 116 */
110 117 public static function enqueueStyles() {
111 118 // Initialize style.
112 119 $styles = array(
@@ -121,47 +128,80 @@
121 128 }
122 129 // Include styles.
123 130 self::useStyles(__CLASS__, $styles);
124 131 }
125 -
132 +
133 + /**
134 + * put your comment there...
135 + *
136 + * @param mixed $block
137 + */
138 + public function getAllAssignments() {
139 +
140 + return CJTBlocksModel::getAllAssignments($this->block);
141 + }
142 +
126 143 /**
127 144 * put your comment there...
128 - *
145 + *
129 146 */
130 147 public function getBlock() {
131 - return $this->block;
148 + return $this->block;
132 149 }
133 -
150 +
151 + /**
152 + * put your comment there...
153 + *
154 + */
155 + public function getHookStatus() {
156 +
157 + $hooksAttacher =& CJTBlocksCouplingController::theInstance()->getHooksAttacher();
158 +
159 + $locationText = $hooksAttacher->getHookText($this->block->location);
160 + $locationTitle = $hooksAttacher->getHookText($this->block->location, 'title');
161 + $badLocationClass = '';
162 +
163 + if(!$locationText) {
164 +
165 + $badLocationClass = 'bad-location-specified';
166 + $locationText = cssJSToolbox::getText('Hook is not supported, it might be assigned by some kind of CJT hooks extensions. You either need to re-enable/re-install that extension or change the hook value to one of the supported hooks');
167 + }
168 +
169 + $text = compact('badLocationClass', 'locationText', 'locationTitle');
170 +
171 + return $text;
172 + }
173 +
134 174 /**
135 175 * put your comment there...
136 - *
176 + *
137 177 */
138 178 public function getMetaboxName() {
139 179 $tip = cssJSToolbox::getText('Click to update Block name');
140 - return "<span class='block-name' title='{$tip}'>{$this->block->name}</span>";
180 + return "<input name='cjtoolbox[{$this->block->id}][name]' type='text' class='block-name' value='{$this->block->name}' title='{$tip}' maxlength='50' />";
141 181 }
142 -
182 +
143 183 /**
144 184 * put your comment there...
145 - *
185 + *
146 186 * @param mixed $id
147 187 */
148 188 public function getMetaboxId() {
149 189 return self::META_BOX_PREFIX ."-{$this->block->id}";
150 190 }
151 -
191 +
152 192 /**
153 193 * put your comment there...
154 - *
194 + *
155 195 * @param mixed $name
156 196 */
157 197 public function getOption($name) {
158 198 return $this->params->{$name};
159 199 }
160 -
200 +
161 201 /**
162 - *
163 - *
202 + *
203 + *
164 204 */
165 205 public function setBlock($block) {
166 206 // Set block.
167 207 $this->block = $block;
@@ -169,12 +209,12 @@
169 209 $closedBlockId = "cjtoolbox-{$this->block->id}";
170 210 $closedMetaboxes = get_user_meta(get_current_user_id(), 'closedpostboxes_cjtoolbox', true);
171 211 $this->isClosed = in_array($closedBlockId, ((array) $closedMetaboxes));
172 212 }
173 -
213 +
174 214 /**
175 215 * put your comment there...
176 - *
216 + *
177 217 * @param mixed $name
178 218 * @param mixed $value
179 219 */
180 220 public function setOption($name, $value) {
@@ -181,9 +221,9 @@
181 221 $this->params->{$name} = $value;
182 222 // Chains!
183 223 return $this;
184 224 }
185 -
225 +
186 226 } // End class.
187 227
188 228 // Hookable!
189 229 CJTBlocksBlockView::define('CJTBlocksBlockView');