X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=xml%2Ftemplates%2Fdao.tpl;h=222ffbb30928f9bc2f9d2e44398349db0003f6c8;hb=57143973f6f5e9b0914f5840811131217e5d9dbf;hp=4d7174d7ed4020f11bf3e424cb4e0dc93c0db7d9;hpb=f560523ac9f59426f8d607cdad5955c713f24565;p=civicrm-core.git diff --git a/xml/templates/dao.tpl b/xml/templates/dao.tpl index 4d7174d7ed..222ffbb309 100644 --- a/xml/templates/dao.tpl +++ b/xml/templates/dao.tpl @@ -1,44 +1,15 @@ __table = '{$table.name}'; parent::__construct( ); @@ -84,7 +55,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() {ldelim} + public static function getReferenceColumns() {ldelim} if (!isset(Civi::$statics[__CLASS__]['links'])) {ldelim} Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); {foreach from=$table.foreignKey item=foreign} @@ -105,9 +76,9 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * * @return array */ - static function &fields( ) {ldelim} + public static function &fields( ) {ldelim} if ( ! isset(Civi::$statics[__CLASS__]['fields']) ) {ldelim} - Civi::$statics[__CLASS__]['fields'] = array ( + Civi::$statics[__CLASS__]['fields'] = array( {foreach from=$table.fields item=field} {if $field.uniqueName} @@ -125,7 +96,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} 'description' => '{$field.comment|replace:"'":"\'"}', {/if} {if $field.required} - 'required' => {$field.required}, + 'required' => {$field.required|strtoupper}, {/if} {* field.required *} {if $field.length} 'maxlength' => {$field.length}, @@ -144,13 +115,13 @@ class {$table.className} extends CRM_Core_DAO {ldelim} {/if} {* field.cols *} {if $field.import} - 'import' => {$field.import}, + 'import' => {$field.import|strtoupper}, 'where' => '{$table.name}.{$field.name}', 'headerPattern' => '{$field.headerPattern}', 'dataPattern' => '{$field.dataPattern}', {/if} {* field.import *} {if $field.export} - 'export' => {$field.export}, + 'export' => {$field.export|strtoupper}, {if ! $field.import} 'where' => '{$table.name}.{$field.name}', 'headerPattern' => '{$field.headerPattern}', @@ -175,22 +146,10 @@ class {$table.className} extends CRM_Core_DAO {ldelim} 'serialize' => self::SERIALIZE_{$field.serialize|strtoupper}, {/if} {if $field.html} - {assign var=htmlOptions value=$field.html} - 'html' => array( -{*{$htmlOptions|@print_array}*} - {foreach from=$htmlOptions key=optionKey item=optionValue} - '{$optionKey}' => '{$optionValue}', - {/foreach} - ), + 'html' => {$field.html|@print_array}, {/if} {* field.html *} {if $field.pseudoconstant} -{assign var=pseudoOptions value=$field.pseudoconstant} -'pseudoconstant' => array( -{*{$pseudoOptions|@print_array}*} -{foreach from=$pseudoOptions key=optionKey item=optionValue} - '{$optionKey}' => '{$optionValue}', -{/foreach} - ) + 'pseudoconstant' => {$field.pseudoconstant|@print_array} {/if} {* field.pseudoconstant *} ), {/foreach} {* table.fields *} ); @@ -205,7 +164,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys( ) {ldelim} + public static function &fieldKeys( ) {ldelim} if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {ldelim} Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); {rdelim} @@ -217,7 +176,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * * @return string */ - static function getTableName( ) {ldelim} + public static function getTableName( ) {ldelim} {if $table.localizable} return CRM_Core_DAO::getLocaleTableName( self::$_tableName ); {else} @@ -228,9 +187,9 @@ class {$table.className} extends CRM_Core_DAO {ldelim} /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog( ) {ldelim} + public function getLog( ) {ldelim} return self::$_log; {rdelim} @@ -241,7 +200,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * * @return array */ - static function &import( $prefix = false ) {ldelim} + public static function &import( $prefix = FALSE ) {ldelim} $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, '{$table.labelName}', $prefix, array( {if $table.foreignKey}{foreach from=$table.foreignKey item=foreign} {if $foreign.import}'{$foreign.className}',{/if} @@ -257,7 +216,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * * @return array */ - static function &export( $prefix = false ) {ldelim} + public static function &export( $prefix = FALSE ) {ldelim} $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, '{$table.labelName}', $prefix, array( {if $table.foreignKey}{foreach from=$table.foreignKey item=foreign} {if $foreign.export}'{$foreign.className}',{/if} @@ -268,9 +227,14 @@ class {$table.className} extends CRM_Core_DAO {ldelim} /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) {ldelim} $indices = {$indicesPhp}; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; {rdelim} + {rdelim}