| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | CiviCRM version 5 | |
| 5 | +--------------------------------------------------------------------+ |
| 6 | | Copyright CiviCRM LLC (c) 2004-2019 | |
| 7 | +--------------------------------------------------------------------+ |
| 8 | | This file is a part of CiviCRM. | |
| 9 | | | |
| 10 | | CiviCRM is free software; you can copy, modify, and distribute it | |
| 11 | | under the terms of the GNU Affero General Public License | |
| 12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | |
| 13 | | | |
| 14 | | CiviCRM is distributed in the hope that it will be useful, but | |
| 15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 17 | | See the GNU Affero General Public License for more details. | |
| 18 | | | |
| 19 | | You should have received a copy of the GNU Affero General Public | |
| 20 | | License and the CiviCRM Licensing Exception along | |
| 21 | | with this program; if not, contact CiviCRM LLC | |
| 22 | | at info[AT]civicrm[DOT]org. If you have questions about the | |
| 23 | | GNU Affero General Public License or the licensing of CiviCRM, | |
| 24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | |
| 25 | +--------------------------------------------------------------------+ |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * |
| 30 | * @package CRM |
| 31 | * @copyright CiviCRM LLC (c) 2004-2019 |
| 32 | * |
| 33 | * Generated from {$smarty.template} |
| 34 | * {$generated} |
| 35 | */ |
| 36 | class CRM_Core_I18n_SchemaStructure {ldelim} |
| 37 | |
| 38 | /** |
| 39 | * Get translatable columns. |
| 40 | * |
| 41 | * @return array |
| 42 | * A table-indexed array of translatable columns. |
| 43 | */ |
| 44 | public static function &columns() {ldelim} |
| 45 | static $result = NULL; |
| 46 | if (!$result) {ldelim} |
| 47 | $result = [ |
| 48 | {foreach from=$columns key=table item=types} |
| 49 | '{$table}' => [ |
| 50 | {foreach from=$types key=column item=type} |
| 51 | '{$column}' => "{$type}", |
| 52 | {/foreach}{* /foreach from=$types item=type *} |
| 53 | ], |
| 54 | {/foreach}{* /foreach from=$columns item=types *} |
| 55 | ]; |
| 56 | {rdelim} |
| 57 | return $result; |
| 58 | {rdelim} |
| 59 | |
| 60 | /** |
| 61 | * Get a table indexed array of the indices for translatable fields. |
| 62 | * |
| 63 | * @return array |
| 64 | * Indices for translatable fields. |
| 65 | */ |
| 66 | public static function &indices() {ldelim} |
| 67 | static $result = NULL; |
| 68 | if (!$result) {ldelim} |
| 69 | $result = [ |
| 70 | {foreach from=$indices key=table item=tableIndices} |
| 71 | '{$table}' => [ |
| 72 | {foreach from=$tableIndices key=name item=info} |
| 73 | '{$name}' => [ |
| 74 | 'name' => '{$info.name}', |
| 75 | 'field' => [ |
| 76 | {foreach from=$info.field item=field} |
| 77 | '{$field}', |
| 78 | {/foreach}{* foreach from=$info.field item=field *} |
| 79 | ], |
| 80 | {if $info.unique}'unique' => 1,{/if} |
| 81 | |
| 82 | ], |
| 83 | {/foreach}{* /foreach from=$tableIndices item=info *} |
| 84 | ], |
| 85 | {/foreach}{* /foreach from=$indices item=tableIndices *} |
| 86 | ]; |
| 87 | {rdelim} |
| 88 | return $result; |
| 89 | {rdelim} |
| 90 | |
| 91 | /** |
| 92 | * Get tables with translatable fields. |
| 93 | * |
| 94 | * @return array |
| 95 | * Array of names of tables with fields that can be translated. |
| 96 | */ |
| 97 | public static function &tables() {ldelim} |
| 98 | static $result = NULL; |
| 99 | if (!$result) {ldelim} |
| 100 | $result = array_keys(self::columns()); |
| 101 | {rdelim} |
| 102 | return $result; |
| 103 | {rdelim} |
| 104 | |
| 105 | /** |
| 106 | * Get a list of widgets for editing translatable fields. |
| 107 | * |
| 108 | * @return array |
| 109 | * Array of the widgets for editing translatable fields. |
| 110 | */ |
| 111 | public static function &widgets() {ldelim} |
| 112 | static $result = NULL; |
| 113 | if (!$result) {ldelim} |
| 114 | $result = [ |
| 115 | {foreach from=$widgets key=table item=columns} |
| 116 | '{$table}' => [ |
| 117 | {foreach from=$columns key=column item=widget} |
| 118 | '{$column}' => [ |
| 119 | {foreach from=$widget key=name item=value} |
| 120 | '{$name}' => "{$value}", |
| 121 | {/foreach}{* /foreach from=$widget item=value *} |
| 122 | ], |
| 123 | {/foreach}{* /foreach from=$columns item=widget *} |
| 124 | ], |
| 125 | {/foreach}{* /foreach from=$widgets item=columns *} |
| 126 | ]; |
| 127 | {rdelim} |
| 128 | return $result; |
| 129 | {rdelim} |
| 130 | |
| 131 | {rdelim} |