PluginProbe
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager / 1.2.1
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager v1.2.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 / framework / extensions / package / blocks.php

blocks.php in FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager 1.2.1, 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