| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 6 | | This work is published under the GNU AGPLv3 license with some | |
| 7 | | permitted exceptions and without any warranty. For full license | |
| 8 | | and copyright information, see https://civicrm.org/licensing | |
| 9 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * |
| 14 | * @package CRM |
| 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 16 | * |
| 17 | * Generated from {$smarty.template} |
| 18 | * {$generated} |
| 19 | */ |
| 20 | class CRM_Core_I18n_SchemaStructure {ldelim} |
| 21 | |
| 22 | /** |
| 23 | * Get translatable columns. |
| 24 | * |
| 25 | * @return array |
| 26 | * A table-indexed array of translatable columns. |
| 27 | */ |
| 28 | public static function &columns() {ldelim} |
| 29 | static $result = NULL; |
| 30 | if (!$result) {ldelim} |
| 31 | $result = [ |
| 32 | {foreach from=$columns key=table item=types} |
| 33 | '{$table}' => [ |
| 34 | {foreach from=$types key=column item=type} |
| 35 | '{$column}' => "{$type}", |
| 36 | {/foreach}{* /foreach from=$types item=type *} |
| 37 | ], |
| 38 | {/foreach}{* /foreach from=$columns item=types *} |
| 39 | ]; |
| 40 | {rdelim} |
| 41 | return $result; |
| 42 | {rdelim} |
| 43 | |
| 44 | /** |
| 45 | * Get a table indexed array of the indices for translatable fields. |
| 46 | * |
| 47 | * @return array |
| 48 | * Indices for translatable fields. |
| 49 | */ |
| 50 | public static function &indices() {ldelim} |
| 51 | static $result = NULL; |
| 52 | if (!$result) {ldelim} |
| 53 | $result = [ |
| 54 | {foreach from=$indices key=table item=tableIndices} |
| 55 | '{$table}' => [ |
| 56 | {foreach from=$tableIndices key=name item=info} |
| 57 | '{$name}' => [ |
| 58 | 'name' => '{$info.name}', |
| 59 | 'field' => [ |
| 60 | {foreach from=$info.field item=field} |
| 61 | '{$field}', |
| 62 | {/foreach}{* foreach from=$info.field item=field *} |
| 63 | ], |
| 64 | {if $info.unique}'unique' => 1,{/if} |
| 65 | |
| 66 | ], |
| 67 | {/foreach}{* /foreach from=$tableIndices item=info *} |
| 68 | ], |
| 69 | {/foreach}{* /foreach from=$indices item=tableIndices *} |
| 70 | ]; |
| 71 | {rdelim} |
| 72 | return $result; |
| 73 | {rdelim} |
| 74 | |
| 75 | /** |
| 76 | * Get tables with translatable fields. |
| 77 | * |
| 78 | * @return array |
| 79 | * Array of names of tables with fields that can be translated. |
| 80 | */ |
| 81 | public static function &tables() {ldelim} |
| 82 | static $result = NULL; |
| 83 | if (!$result) {ldelim} |
| 84 | $result = array_keys(self::columns()); |
| 85 | {rdelim} |
| 86 | return $result; |
| 87 | {rdelim} |
| 88 | |
| 89 | /** |
| 90 | * Get a list of widgets for editing translatable fields. |
| 91 | * |
| 92 | * @return array |
| 93 | * Array of the widgets for editing translatable fields. |
| 94 | */ |
| 95 | public static function &widgets() {ldelim} |
| 96 | static $result = NULL; |
| 97 | if (!$result) {ldelim} |
| 98 | $result = [ |
| 99 | {foreach from=$widgets key=table item=columns} |
| 100 | '{$table}' => [ |
| 101 | {foreach from=$columns key=column item=widget} |
| 102 | '{$column}' => [ |
| 103 | {foreach from=$widget key=name item=value} |
| 104 | '{$name}' => "{$value}", |
| 105 | {/foreach}{* /foreach from=$widget item=value *} |
| 106 | ], |
| 107 | {/foreach}{* /foreach from=$columns item=widget *} |
| 108 | ], |
| 109 | {/foreach}{* /foreach from=$widgets item=columns *} |
| 110 | ]; |
| 111 | {rdelim} |
| 112 | return $result; |
| 113 | {rdelim} |
| 114 | |
| 115 | {rdelim} |