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/Core/File.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
022785d8 | 33 | * (GenCodeChecksum:996b2702471b24fb13c740ef104ea1f9) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_File constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Core_DAO_File 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_file'; | |
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 = true; | |
53 | /** | |
54 | * Unique ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value. | |
61 | * | |
62 | * @var int unsigned | |
63 | */ | |
64 | public $file_type_id; | |
65 | /** | |
66 | * mime type of the document | |
67 | * | |
68 | * @var string | |
69 | */ | |
70 | public $mime_type; | |
71 | /** | |
72 | * uri of the file on disk | |
73 | * | |
74 | * @var string | |
75 | */ | |
76 | public $uri; | |
77 | /** | |
78 | * contents of the document | |
79 | * | |
80 | * @var mediumblob | |
81 | */ | |
82 | public $document; | |
83 | /** | |
84 | * Additional descriptive text regarding this attachment (optional). | |
85 | * | |
86 | * @var string | |
87 | */ | |
88 | public $description; | |
89 | /** | |
90 | * Date and time that this attachment was uploaded or written to server. | |
91 | * | |
92 | * @var datetime | |
93 | */ | |
94 | public $upload_date; | |
95 | /** | |
f41f0342 | 96 | * Class constructor. |
e501603b TO |
97 | */ |
98 | function __construct() { | |
99 | $this->__table = 'civicrm_file'; | |
100 | parent::__construct(); | |
101 | } | |
102 | /** | |
103 | * Returns all the column names of this table | |
104 | * | |
105 | * @return array | |
106 | */ | |
107 | static function &fields() { | |
346aaaba TO |
108 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
109 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
110 | 'id' => array( |
111 | 'name' => 'id', | |
112 | 'type' => CRM_Utils_Type::T_INT, | |
113 | 'title' => ts('File ID') , | |
114 | 'description' => 'Unique ID', | |
115 | 'required' => true, | |
522a26c9 | 116 | 'table_name' => 'civicrm_file', |
117 | 'entity' => 'File', | |
118 | 'bao' => 'CRM_Core_BAO_File', | |
e501603b TO |
119 | ) , |
120 | 'file_type_id' => array( | |
121 | 'name' => 'file_type_id', | |
122 | 'type' => CRM_Utils_Type::T_INT, | |
123 | 'title' => ts('File Type') , | |
124 | 'description' => 'Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.', | |
522a26c9 | 125 | 'table_name' => 'civicrm_file', |
126 | 'entity' => 'File', | |
127 | 'bao' => 'CRM_Core_BAO_File', | |
e501603b TO |
128 | ) , |
129 | 'mime_type' => array( | |
130 | 'name' => 'mime_type', | |
131 | 'type' => CRM_Utils_Type::T_STRING, | |
132 | 'title' => ts('Mime Type') , | |
133 | 'description' => 'mime type of the document', | |
134 | 'maxlength' => 255, | |
135 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 136 | 'table_name' => 'civicrm_file', |
137 | 'entity' => 'File', | |
138 | 'bao' => 'CRM_Core_BAO_File', | |
e501603b TO |
139 | ) , |
140 | 'uri' => array( | |
141 | 'name' => 'uri', | |
142 | 'type' => CRM_Utils_Type::T_STRING, | |
143 | 'title' => ts('Path') , | |
144 | 'description' => 'uri of the file on disk', | |
145 | 'maxlength' => 255, | |
146 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 147 | 'table_name' => 'civicrm_file', |
148 | 'entity' => 'File', | |
149 | 'bao' => 'CRM_Core_BAO_File', | |
e501603b TO |
150 | ) , |
151 | 'document' => array( | |
152 | 'name' => 'document', | |
153 | 'type' => CRM_Utils_Type::T_MEDIUMBLOB, | |
154 | 'title' => ts('File Contents') , | |
155 | 'description' => 'contents of the document', | |
522a26c9 | 156 | 'table_name' => 'civicrm_file', |
157 | 'entity' => 'File', | |
158 | 'bao' => 'CRM_Core_BAO_File', | |
e501603b TO |
159 | ) , |
160 | 'description' => array( | |
161 | 'name' => 'description', | |
162 | 'type' => CRM_Utils_Type::T_STRING, | |
163 | 'title' => ts('File Description') , | |
164 | 'description' => 'Additional descriptive text regarding this attachment (optional).', | |
165 | 'maxlength' => 255, | |
166 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 167 | 'table_name' => 'civicrm_file', |
168 | 'entity' => 'File', | |
169 | 'bao' => 'CRM_Core_BAO_File', | |
e501603b TO |
170 | ) , |
171 | 'upload_date' => array( | |
172 | 'name' => 'upload_date', | |
173 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
174 | 'title' => ts('File Upload Date') , | |
175 | 'description' => 'Date and time that this attachment was uploaded or written to server.', | |
522a26c9 | 176 | 'table_name' => 'civicrm_file', |
177 | 'entity' => 'File', | |
178 | 'bao' => 'CRM_Core_BAO_File', | |
e501603b TO |
179 | ) , |
180 | ); | |
346aaaba | 181 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 182 | } |
346aaaba | 183 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
184 | } |
185 | /** | |
bd8e0b14 | 186 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
187 | * |
188 | * @return array | |
bd8e0b14 | 189 | * Array(string $name => string $uniqueName). |
e501603b TO |
190 | */ |
191 | static function &fieldKeys() { | |
bd8e0b14 TO |
192 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
193 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 194 | } |
bd8e0b14 | 195 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
196 | } |
197 | /** | |
198 | * Returns the names of this table | |
199 | * | |
200 | * @return string | |
201 | */ | |
202 | static function getTableName() { | |
203 | return self::$_tableName; | |
204 | } | |
205 | /** | |
206 | * Returns if this table needs to be logged | |
207 | * | |
208 | * @return boolean | |
209 | */ | |
210 | function getLog() { | |
211 | return self::$_log; | |
212 | } | |
213 | /** | |
214 | * Returns the list of fields that can be imported | |
215 | * | |
216 | * @param bool $prefix | |
217 | * | |
218 | * @return array | |
219 | */ | |
220 | static function &import($prefix = false) { | |
60808919 TO |
221 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'file', $prefix, array()); |
222 | return $r; | |
e501603b TO |
223 | } |
224 | /** | |
225 | * Returns the list of fields that can be exported | |
226 | * | |
227 | * @param bool $prefix | |
228 | * | |
229 | * @return array | |
230 | */ | |
231 | static function &export($prefix = false) { | |
60808919 TO |
232 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'file', $prefix, array()); |
233 | return $r; | |
e501603b TO |
234 | } |
235 | } |