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