Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezextensionpackagecreator.php
Go to the documentation of this file.
1 <?php
18 class eZExtensionPackageCreator extends eZPackageCreationHandler
19 {
20 public function __construct( $id )
21 {
22 $steps = array();
23 $steps[] = array( 'id' => 'extensionlist',
24 'name' => ezpI18n::tr( 'kernel/package', 'Extensions to include' ),
25 'methods' => array( 'initialize' => 'initializeExtensionName',
26 'load' => 'loadExtensionName',
27 'validate' => 'validateExtensionName',
28 'commit' => 'commitExtensionName' ),
29 'template' => 'extension.tpl' );
30 $steps[] = $this->packageInformationStep();
31 $steps[] = $this->packageMaintainerStep();
32 $steps[] = $this->packageChangelogStep();
33 parent::__construct( $id, ezpI18n::tr( 'kernel/package', 'Extension export' ), $steps );
34 }
35
36 function finalize( &$package, $http, &$persistentData )
37 {
38 $this->createPackage( $package, $http, $persistentData, $cleanupFiles, false );
39
40 $extensionHandler = eZPackage::packageHandler( 'ezextension' );
41
42 $extensionList = $persistentData['extensionlist'];
43 foreach ( $extensionList as $extensionName )
44 {
45 $extensionHandler->addExtension( $package, $extensionName );
46 }
47
48 $package->setAttribute( 'is_active', true );
49 $package->store();
50 }
51
55 function packageInstallType( $package, &$persistentData )
56 {
57 return 'install';
58 }
59
63 function packageInitialState( $package, &$persistentData )
64 {
65 return 'stable';
66 }
67
71 function packageType( $package, &$persistentData )
72 {
73 return 'extension';
74 }
75
76 function initializeExtensionName( $package, $http, $step, &$persistentData, $tpl )
77 {
78 }
79
80 function loadExtensionName( $package, $http, $step, &$persistentData, $tpl )
81 {
82 $extensionList = eZDir::findSubItems( eZExtension::baseDirectory(), 'dl' );
83 $tpl->setVariable( 'extension_list', $extensionList );
84 }
85
86 function validateExtensionName( $package, $http, $currentStepID, &$stepMap, &$persistentData, &$errorList )
87 {
88 $extensionList = array();
89
90 if ( !$http->hasPostVariable( 'PackageExtensionNames' ) ||
91 count( $http->postVariable( 'PackageExtensionNames' ) ) == 0 )
92 {
93 $errorList[] = array( 'field' => ezpI18n::tr( 'kernel/package', 'Extension list' ),
94 'description' => ezpI18n::tr( 'kernel/package', 'You must select at least one extension' ) );
95 return false;
96 }
97 return true;
98 }
99
100 function commitExtensionName( $package, $http, $step, &$persistentData, $tpl )
101 {
102 $persistentData['extensionlist'] = $http->postVariable( 'PackageExtensionNames' );
103 }
104
108 function generatePackageInformation( &$packageInformation, $package, $http, $step, &$persistentData )
109 {
110 $extensionList = $persistentData['extensionlist'];
111 $extensionCount = count( $extensionList );
112
113 if ( $extensionCount == 1 )
114 {
115 $extensionName = $extensionList[0];
116 $packageInformation['name'] = $extensionName;
117 $packageInformation['summary'] = "$extensionName extension";
118 $packageInformation['description'] = "This package contains the $extensionName eZ Publish extension";
119 }
120 else if ( $extensionCount > 1 )
121 {
122 $packageInformation['name'] = "$extensionCount Extensions";
123 $packageInformation['summary'] = "Export of $extensionCount extensions";
124 $description = "This package contains the following eZ Publish extensions: \n";
125 foreach ( $extensionList as $extensionName )
126 {
127 $description .= "- $extensionName\n";
128 }
129 $packageInformation['description'] = $description;
130 }
131 }
132 }
133
134 ?>
eZExtensionPackageCreator
Definition: ezextensionpackagecreator.php:19
eZExtensionPackageCreator\finalize
finalize(&$package, $http, &$persistentData)
Definition: ezextensionpackagecreator.php:36
eZExtensionPackageCreator\commitExtensionName
commitExtensionName( $package, $http, $step, &$persistentData, $tpl)
Definition: ezextensionpackagecreator.php:100
eZExtensionPackageCreator\generatePackageInformation
generatePackageInformation(&$packageInformation, $package, $http, $step, &$persistentData)
Definition: ezextensionpackagecreator.php:108
eZExtensionPackageCreator\initializeExtensionName
initializeExtensionName( $package, $http, $step, &$persistentData, $tpl)
Definition: ezextensionpackagecreator.php:76
eZExtensionPackageCreator\loadExtensionName
loadExtensionName( $package, $http, $step, &$persistentData, $tpl)
Definition: ezextensionpackagecreator.php:80
eZExtensionPackageCreator\packageInitialState
packageInitialState( $package, &$persistentData)
Definition: ezextensionpackagecreator.php:63
eZExtensionPackageCreator\packageType
packageType( $package, &$persistentData)
Definition: ezextensionpackagecreator.php:71
eZExtensionPackageCreator\validateExtensionName
validateExtensionName( $package, $http, $currentStepID, &$stepMap, &$persistentData, &$errorList)
Definition: ezextensionpackagecreator.php:86
eZExtensionPackageCreator\__construct
__construct( $id)
Definition: ezextensionpackagecreator.php:20
eZExtensionPackageCreator\packageInstallType
packageInstallType( $package, &$persistentData)
Definition: ezextensionpackagecreator.php:55
eZExtension\baseDirectory
static baseDirectory(eZINI|null $siteINI=null)
Definition: ezextension.php:39
eZPackageCreationHandler
The class eZPackageCreationHandler does.
Definition: ezpackagecreationhandler.php:19
eZPackageCreationHandler\packageInformationStep
packageInformationStep()
Definition: ezpackagecreationhandler.php:378
eZPackageCreationHandler\packageChangelogStep
packageChangelogStep()
Definition: ezpackagecreationhandler.php:409
eZPackageCreationHandler\createPackage
createPackage(&$package, $http, &$persistentData, &$cleanupFiles, $storePackage=true)
Definition: ezpackagecreationhandler.php:493
eZPackageCreationHandler\packageMaintainerStep
packageMaintainerStep()
Definition: ezpackagecreationhandler.php:393
eZPackage\packageHandler
static packageHandler( $handlerName)
Definition: ezpackage.php:2806
ezpI18n\tr
static tr( $context, $source, $comment=null, $arguments=null)
Definition: ezpi18n.php:86
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.