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 | |
437fafcf | 33 | * (GenCodeChecksum:1972403bedc8ca79674ce1b7f6f3760c) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_saved_search'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = false; | |
51 | /** | |
52 | * Saved Search ID | |
53 | * | |
54 | * @var int unsigned | |
55 | */ | |
56 | public $id; | |
57 | /** | |
58 | * Submitted form values for this search | |
59 | * | |
60 | * @var text | |
61 | */ | |
62 | public $form_values; | |
63 | /** | |
64 | * Foreign key to civicrm_mapping used for saved search-builder searches. | |
65 | * | |
66 | * @var int unsigned | |
67 | */ | |
68 | public $mapping_id; | |
69 | /** | |
70 | * Foreign key to civicrm_option value table used for saved custom searches. | |
71 | * | |
72 | * @var int unsigned | |
73 | */ | |
74 | public $search_custom_id; | |
75 | /** | |
76 | * the sql where clause if a saved search acl | |
77 | * | |
78 | * @var text | |
79 | */ | |
80 | public $where_clause; | |
81 | /** | |
82 | * the tables to be included in a select data | |
83 | * | |
84 | * @var text | |
85 | */ | |
86 | public $select_tables; | |
87 | /** | |
88 | * the tables to be included in the count statement | |
89 | * | |
90 | * @var text | |
91 | */ | |
92 | public $where_tables; | |
93 | /** | |
94 | * class constructor | |
95 | * | |
96 | * @return civicrm_saved_search | |
97 | */ | |
98 | function __construct() { | |
99 | $this->__table = 'civicrm_saved_search'; | |
100 | parent::__construct(); | |
101 | } | |
102 | /** | |
103 | * Returns foreign keys and entity references | |
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, | |
130 | ) , | |
131 | 'form_values' => array( | |
132 | 'name' => 'form_values', | |
133 | 'type' => CRM_Utils_Type::T_TEXT, | |
134 | 'title' => ts('Submitted Form Values') , | |
135 | 'description' => 'Submitted form values for this search', | |
136 | 'import' => true, | |
137 | 'where' => 'civicrm_saved_search.form_values', | |
138 | 'headerPattern' => '', | |
139 | 'dataPattern' => '', | |
140 | 'export' => true, | |
141 | ) , | |
142 | 'mapping_id' => array( | |
143 | 'name' => 'mapping_id', | |
144 | 'type' => CRM_Utils_Type::T_INT, | |
145 | 'title' => ts('Mapping ID') , | |
146 | 'description' => 'Foreign key to civicrm_mapping used for saved search-builder searches.', | |
147 | 'FKClassName' => 'CRM_Core_DAO_Mapping', | |
148 | ) , | |
149 | 'search_custom_id' => array( | |
150 | 'name' => 'search_custom_id', | |
151 | 'type' => CRM_Utils_Type::T_INT, | |
152 | 'title' => ts('Option Value ID') , | |
153 | 'description' => 'Foreign key to civicrm_option value table used for saved custom searches.', | |
154 | ) , | |
155 | 'where_clause' => array( | |
156 | 'name' => 'where_clause', | |
157 | 'type' => CRM_Utils_Type::T_TEXT, | |
158 | 'title' => ts('Where Clause') , | |
159 | 'description' => 'the sql where clause if a saved search acl', | |
160 | ) , | |
161 | 'select_tables' => array( | |
162 | 'name' => 'select_tables', | |
163 | 'type' => CRM_Utils_Type::T_TEXT, | |
164 | 'title' => ts('Select Tables') , | |
165 | 'description' => 'the tables to be included in a select data', | |
166 | ) , | |
167 | 'where_tables' => array( | |
168 | 'name' => 'where_tables', | |
169 | 'type' => CRM_Utils_Type::T_TEXT, | |
170 | 'title' => ts('Where Tables') , | |
171 | 'description' => 'the tables to be included in the count statement', | |
172 | ) , | |
173 | ); | |
346aaaba | 174 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 175 | } |
346aaaba | 176 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
177 | } |
178 | /** | |
bd8e0b14 | 179 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
180 | * |
181 | * @return array | |
bd8e0b14 | 182 | * Array(string $name => string $uniqueName). |
e501603b TO |
183 | */ |
184 | static function &fieldKeys() { | |
bd8e0b14 TO |
185 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
186 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 187 | } |
bd8e0b14 | 188 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
189 | } |
190 | /** | |
191 | * Returns the names of this table | |
192 | * | |
193 | * @return string | |
194 | */ | |
195 | static function getTableName() { | |
196 | return self::$_tableName; | |
197 | } | |
198 | /** | |
199 | * Returns if this table needs to be logged | |
200 | * | |
201 | * @return boolean | |
202 | */ | |
203 | function getLog() { | |
204 | return self::$_log; | |
205 | } | |
206 | /** | |
207 | * Returns the list of fields that can be imported | |
208 | * | |
209 | * @param bool $prefix | |
210 | * | |
211 | * @return array | |
212 | */ | |
213 | static function &import($prefix = false) { | |
60808919 TO |
214 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'saved_search', $prefix, array()); |
215 | return $r; | |
e501603b TO |
216 | } |
217 | /** | |
218 | * Returns the list of fields that can be exported | |
219 | * | |
220 | * @param bool $prefix | |
221 | * | |
222 | * @return array | |
223 | */ | |
224 | static function &export($prefix = false) { | |
60808919 TO |
225 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'saved_search', $prefix, array()); |
226 | return $r; | |
e501603b TO |
227 | } |
228 | } |