[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 {* DO NOT EDIT THIS FILE! Use an override template instead. *} 2 <?php 3 /*! 4 \class {$full_class_name} {$file_name} 5 \ingroup eZTemplateOperators 6 \brief {$description_brief} 7 \version 1.0 8 \date {currentdate()|l10n(datetime)} 9 10 {section show=$creator_name} 11 \author {$creator_name} 12 {/section} 13 14 15 {$description_full|indent(2)} 16 17 {section show=$example_code} 18 19 {'Example'|i18n('design/admin/setup/operatorcode')}: 20 \code 21 {$example_code} 22 \endcode 23 {/section} 24 25 */ 26 27 /* 28 If you want to have autoloading of this operator you should create 29 a eztemplateautoload.php file and add the following code to it. 30 The autoload file must be placed somewhere specified in AutoloadPath 31 under the group TemplateSettings in settings/site.ini 32 33 $eZTemplateOperatorArray = array(); 34 $eZTemplateOperatorArray[] = array( 'script' => '{$file_name}', 35 'class' => '{$full_class_name}', 36 'operator_names' => array( '{$operator_name}' ) ); 37 38 If your template operator is in an extension, you need to add the following settings: 39 40 To extension/YOUREXTENSION/settings/site.ini.append: 41 --- 42 [TemplateSettings] 43 ExtensionAutoloadPath[]=YOUREXTENSION 44 --- 45 46 To extension/YOUREXTENSION/autoloads/eztemplateautoload.php: 47 ---- 48 $eZTemplateOperatorArray = array(); 49 $eZTemplateOperatorArray[] = array( 'script' => 'extension/YOUEXTENSION/YOURPATH/{$file_name}', 50 'class' => '{$full_class_name}', 51 'operator_names' => array( '{$operator_name}' ) ); 52 --- 53 54 Create the files if they don't exist, and replace YOUREXTENSION and YOURPATH with the correct values. 55 56 */ 57 58 59 class {$full_class_name} 60 {literal}{{/literal} 61 /*! 62 {'Constructor, does nothing by default.'|i18n('design/admin/setup/operatorcode')} 63 */ 64 function {$full_class_name}() 65 {literal}{{/literal} 66 {literal}}{/literal} 67 68 /*! 69 {'\return an array with the template operator name.'|i18n('design/admin/setup/operatorcode')} 70 */ 71 function operatorList() 72 {literal}{{/literal} 73 return array( '{$operator_name}' ); 74 {literal}}{/literal} 75 76 {section show=$single_operator|not} 77 /*! 78 \return true to tell the template engine that the parameter list exists per operator type, 79 this is needed for operator classes that have multiple operators. 80 */ 81 function namedParameterPerOperator() 82 {literal}{{/literal} 83 return true; 84 {literal}}{/literal} 85 {/section} 86 87 {section show=$parameter_check|eq(2)} 88 /*! 89 See eZTemplateOperator::namedParameterList 90 */ 91 function namedParameterList() 92 {literal}{{/literal} 93 return array( '{$operator_name}' => array( 'first_param' => array( 'type' => 'string', 94 {set-block variable=parameter_extra} 95 'required' => false, 96 'default' => 'default text' ), 97 'second_param' => array( 'type' => 'integer', 98 'required' => false, 99 'default' => 0 ) ) ); 100 {/set-block} 101 102 {$:parameter_extra|indent(sum(35,$operator_name|count))} 103 {literal}}{/literal} 104 {/section} 105 106 /*! 107 {'Executes the PHP function for the operator cleanup and modifies \a $operatorValue.'|i18n('design/admin/setup/operatorcode')} 108 */ 109 function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue{section show=$parameter_check|eq(2)}, &$namedParameters{/section} ) 110 {literal}{{/literal} 111 112 {section show=$parameter_check|eq(2)} 113 $firstParam = $namedParameters['first_param']; 114 $secondParam = $namedParameters['second_param']; 115 116 {/section} 117 118 {section show=$parameter_check|eq(3)} 119 for ( $i = 0; $i < count( $operatorParameters ); ++$i ) 120 {literal}{{/literal} 121 $operatorParameter =& $operatorParameters[$i]; 122 // Fetch the value of the parameter structure 123 $operatorParameterValue = $tpl->elementValue( $operatorParameter, $rootNamespace, $currentNamespace ); 124 {literal}}{/literal} 125 126 {/section} 127 128 {section show=$single_operator} 129 // {'Example code, this code must be modified to do what the operator should do, currently it only trims text.'|i18n('design/admin/setup/operatorcode')} 130 {section show=$use_output}$operatorValue = {/section}trim({section show=$use_input} $operatorValue {/section}); 131 {section-else} 132 // {'Example code, this code must be modified to do what the operator should do, currently it only trims text.'|i18n('design/admin/setup/operatorcode')} 133 switch ( $operatorName ) 134 {literal}{{/literal} 135 case '{$operator_name}': 136 {literal}{{/literal} 137 {section show=$use_output}$operatorValue = {/section}trim({section show=$use_input} $operatorValue {/section}); 138 {literal}}{/literal} break; 139 {literal}}{/literal} 140 {/section} 141 142 {literal}}{/literal} 143 {literal}}{/literal} 144 145 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |