PluginProbe
CSS & JavaScript Toolbox / 9.3
CSS & JavaScript Toolbox v9.3
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
css-javascript-toolbox / framework / extensions / package / blocks.php

blocks.php in CSS & JavaScript Toolbox 9.3, at framework/extensions/package/blocks.php

67 lines 1.5 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 /**
7 *
8 */
9 class CJT_Framework_Extensions_Package_Blocks {
10
11 /**
12 *
13 */
14 const ACTIVE = 'active';
15
16 /**
17 *
18 */
19 const INACTIVE = 'inactive';
20
21 /**
22 * put your comment there...
23 *
24 * @var mixed
25 */
26 protected $statePackage;
27
28 /**
29 * put your comment there...
30 *
31 * @param CJT_Framework_Extensions_Package_State_Packages $statePackages
32 * @return {CJT_Framework_Extensions_Package_Blocks|CJT_Framework_Extensions_Package_State_Packages}
33 */
34 public function __construct(CJT_Framework_Extensions_Package_State_Packages & $statePackages) {
35 # INitialize
36 $this->statePackage =& $statePackages;
37 }
38
39 /**
40 * put your comment there...
41 *
42 * @param mixed $state
43 */
44 public function setState($state) {
45 # Initialize
46 $dbDriver = cssJSToolbox::getInstance()->getDBDriver();
47 $statePackages =& $this->statePackage;
48 # Build packages Id SQL IN-OPERATO list
49 $pcksSQLIdList = array();
50 foreach ($statePackages->getInstalledPackages() as $name => $pck) {
51 # Push Id.
52 $pcksSQLIdList[] = $pck['id'];
53 }
54 $pcksSQLIdList = implode(',', $pcksSQLIdList);
55 # Build query
56 $query = "UPDATE
57 (#__cjtoolbox_packages p RIGHT JOIN #__cjtoolbox_package_objects po ON p.id = po.packageId
58 LEFT JOIN #__cjtoolbox_blocks b ON po.objectId = b.id)
59 SET state = '{$state}'
60 WHERE p.id IN ({$pcksSQLIdList}) AND po.objectType = 'block';";
61 # Update state for all blocks associated with all installed packages
62 $dbDriver->exec($query);
63 # Chain
64 return $this;
65 }
66
67 } # End class