Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
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 | * @package CRM | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Contact/SavedSearch.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
522a26c9 | 33 | * (GenCodeChecksum:80289cbf6e37633b88e216f1c456ed45) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Contact_DAO_SavedSearch constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_saved_search'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = false; | |
53 | /** | |
54 | * Saved Search ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * Submitted form values for this search | |
61 | * | |
62 | * @var text | |
63 | */ | |
64 | public $form_values; | |
65 | /** | |
66 | * Foreign key to civicrm_mapping used for saved search-builder searches. | |
67 | * | |
68 | * @var int unsigned | |
69 | */ | |
70 | public $mapping_id; | |
71 | /** | |
72 | * Foreign key to civicrm_option value table used for saved custom searches. | |
73 | * | |
74 | * @var int unsigned | |
75 | */ | |
76 | public $search_custom_id; | |
77 | /** | |
78 | * the sql where clause if a saved search acl | |
79 | * | |
80 | * @var text | |
81 | */ | |
82 | public $where_clause; | |
83 | /** | |
84 | * the tables to be included in a select data | |
85 | * | |
86 | * @var text | |
87 | */ | |
88 | public $select_tables; | |
89 | /** | |
90 | * the tables to be included in the count statement | |
91 | * | |
92 | * @var text | |
93 | */ | |
94 | public $where_tables; | |
95 | /** | |
f41f0342 | 96 | * Class constructor. |
e501603b TO |
97 | */ |
98 | function __construct() { | |
99 | $this->__table = 'civicrm_saved_search'; | |
100 | parent::__construct(); | |
101 | } | |
102 | /** | |
f41f0342 | 103 | * Returns foreign keys and entity references. |
e501603b TO |
104 | * |
105 | * @return array | |
106 | * [CRM_Core_Reference_Interface] | |
107 | */ | |
108 | static function getReferenceColumns() { | |
346aaaba TO |
109 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
110 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
111 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mapping_id', 'civicrm_mapping', 'id'); | |
112 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 113 | } |
346aaaba | 114 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
115 | } |
116 | /** | |
117 | * Returns all the column names of this table | |
118 | * | |
119 | * @return array | |
120 | */ | |
121 | static function &fields() { | |
346aaaba TO |
122 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
123 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
124 | 'id' => array( |
125 | 'name' => 'id', | |
126 | 'type' => CRM_Utils_Type::T_INT, | |
127 | 'title' => ts('Saved Search ID') , | |
128 | 'description' => 'Saved Search ID', | |
129 | 'required' => true, | |
522a26c9 | 130 | 'table_name' => 'civicrm_saved_search', |
131 | 'entity' => 'SavedSearch', | |
132 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
e501603b TO |
133 | ) , |
134 | 'form_values' => array( | |
135 | 'name' => 'form_values', | |
136 | 'type' => CRM_Utils_Type::T_TEXT, | |
137 | 'title' => ts('Submitted Form Values') , | |
138 | 'description' => 'Submitted form values for this search', | |
139 | 'import' => true, | |
140 | 'where' => 'civicrm_saved_search.form_values', | |
141 | 'headerPattern' => '', | |
142 | 'dataPattern' => '', | |
143 | 'export' => true, | |
522a26c9 | 144 | 'table_name' => 'civicrm_saved_search', |
145 | 'entity' => 'SavedSearch', | |
146 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
e501603b TO |
147 | ) , |
148 | 'mapping_id' => array( | |
149 | 'name' => 'mapping_id', | |
150 | 'type' => CRM_Utils_Type::T_INT, | |
151 | 'title' => ts('Mapping ID') , | |
152 | 'description' => 'Foreign key to civicrm_mapping used for saved search-builder searches.', | |
522a26c9 | 153 | 'table_name' => 'civicrm_saved_search', |
154 | 'entity' => 'SavedSearch', | |
155 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
e501603b TO |
156 | 'FKClassName' => 'CRM_Core_DAO_Mapping', |
157 | ) , | |
158 | 'search_custom_id' => array( | |
159 | 'name' => 'search_custom_id', | |
160 | 'type' => CRM_Utils_Type::T_INT, | |
161 | 'title' => ts('Option Value ID') , | |
162 | 'description' => 'Foreign key to civicrm_option value table used for saved custom searches.', | |
522a26c9 | 163 | 'table_name' => 'civicrm_saved_search', |
164 | 'entity' => 'SavedSearch', | |
165 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
e501603b TO |
166 | ) , |
167 | 'where_clause' => array( | |
168 | 'name' => 'where_clause', | |
169 | 'type' => CRM_Utils_Type::T_TEXT, | |
170 | 'title' => ts('Where Clause') , | |
171 | 'description' => 'the sql where clause if a saved search acl', | |
522a26c9 | 172 | 'table_name' => 'civicrm_saved_search', |
173 | 'entity' => 'SavedSearch', | |
174 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
e501603b TO |
175 | ) , |
176 | 'select_tables' => array( | |
177 | 'name' => 'select_tables', | |
178 | 'type' => CRM_Utils_Type::T_TEXT, | |
179 | 'title' => ts('Select Tables') , | |
180 | 'description' => 'the tables to be included in a select data', | |
522a26c9 | 181 | 'table_name' => 'civicrm_saved_search', |
182 | 'entity' => 'SavedSearch', | |
183 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
e501603b TO |
184 | ) , |
185 | 'where_tables' => array( | |
186 | 'name' => 'where_tables', | |
187 | 'type' => CRM_Utils_Type::T_TEXT, | |
188 | 'title' => ts('Where Tables') , | |
189 | 'description' => 'the tables to be included in the count statement', | |
522a26c9 | 190 | 'table_name' => 'civicrm_saved_search', |
191 | 'entity' => 'SavedSearch', | |
192 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
e501603b TO |
193 | ) , |
194 | ); | |
346aaaba | 195 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 196 | } |
346aaaba | 197 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
198 | } |
199 | /** | |
bd8e0b14 | 200 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
201 | * |
202 | * @return array | |
bd8e0b14 | 203 | * Array(string $name => string $uniqueName). |
e501603b TO |
204 | */ |
205 | static function &fieldKeys() { | |
bd8e0b14 TO |
206 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
207 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 208 | } |
bd8e0b14 | 209 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
210 | } |
211 | /** | |
212 | * Returns the names of this table | |
213 | * | |
214 | * @return string | |
215 | */ | |
216 | static function getTableName() { | |
217 | return self::$_tableName; | |
218 | } | |
219 | /** | |
220 | * Returns if this table needs to be logged | |
221 | * | |
222 | * @return boolean | |
223 | */ | |
224 | function getLog() { | |
225 | return self::$_log; | |
226 | } | |
227 | /** | |
228 | * Returns the list of fields that can be imported | |
229 | * | |
230 | * @param bool $prefix | |
231 | * | |
232 | * @return array | |
233 | */ | |
234 | static function &import($prefix = false) { | |
60808919 TO |
235 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'saved_search', $prefix, array()); |
236 | return $r; | |
e501603b TO |
237 | } |
238 | /** | |
239 | * Returns the list of fields that can be exported | |
240 | * | |
241 | * @param bool $prefix | |
242 | * | |
243 | * @return array | |
244 | */ | |
245 | static function &export($prefix = false) { | |
60808919 TO |
246 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'saved_search', $prefix, array()); |
247 | return $r; | |
e501603b TO |
248 | } |
249 | } |