Merge pull request #8793 from eileenmcnaughton/pledge
[civicrm-core.git] / CRM / Core / DAO / Note.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/Note.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:685b6d9d10917535fe9fdf3f63f4a559)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_Note extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_note';
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 = true;
51 /**
52 * Note ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Name of table where item being referenced is stored.
59 *
60 * @var string
61 */
62 public $entity_table;
63 /**
64 * Foreign key to the referenced item.
65 *
66 * @var int unsigned
67 */
68 public $entity_id;
69 /**
70 * Note and/or Comment.
71 *
72 * @var text
73 */
74 public $note;
75 /**
76 * FK to Contact ID creator
77 *
78 * @var int unsigned
79 */
80 public $contact_id;
81 /**
82 * When was this note last modified/edited
83 *
84 * @var date
85 */
86 public $modified_date;
87 /**
88 * subject of note description
89 *
90 * @var string
91 */
92 public $subject;
93 /**
94 * Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)
95 *
96 * @var string
97 */
98 public $privacy;
99 /**
100 * class constructor
101 *
102 * @return civicrm_note
103 */
104 function __construct() {
105 $this->__table = 'civicrm_note';
106 parent::__construct();
107 }
108 /**
109 * Returns foreign keys and entity references
110 *
111 * @return array
112 * [CRM_Core_Reference_Interface]
113 */
114 static function getReferenceColumns() {
115 if (!isset(Civi::$statics[__CLASS__]['links'])) {
116 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
117 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
118 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
119 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
120 }
121 return Civi::$statics[__CLASS__]['links'];
122 }
123 /**
124 * Returns all the column names of this table
125 *
126 * @return array
127 */
128 static function &fields() {
129 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
130 Civi::$statics[__CLASS__]['fields'] = array(
131 'id' => array(
132 'name' => 'id',
133 'type' => CRM_Utils_Type::T_INT,
134 'title' => ts('Note ID') ,
135 'description' => 'Note ID',
136 'required' => true,
137 ) ,
138 'entity_table' => array(
139 'name' => 'entity_table',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Note Entity') ,
142 'description' => 'Name of table where item being referenced is stored.',
143 'required' => true,
144 'maxlength' => 64,
145 'size' => CRM_Utils_Type::BIG,
146 'pseudoconstant' => array(
147 'callback' => 'CRM_Core_BAO_Note::entityTables',
148 )
149 ) ,
150 'entity_id' => array(
151 'name' => 'entity_id',
152 'type' => CRM_Utils_Type::T_INT,
153 'title' => ts('Note Entity ID') ,
154 'description' => 'Foreign key to the referenced item.',
155 'required' => true,
156 ) ,
157 'note' => array(
158 'name' => 'note',
159 'type' => CRM_Utils_Type::T_TEXT,
160 'title' => ts('Note') ,
161 'description' => 'Note and/or Comment.',
162 'rows' => 4,
163 'cols' => 60,
164 'import' => true,
165 'where' => 'civicrm_note.note',
166 'headerPattern' => '/Note|Comment/i',
167 'dataPattern' => '//',
168 'export' => true,
169 'html' => array(
170 'type' => 'TextArea',
171 ) ,
172 ) ,
173 'contact_id' => array(
174 'name' => 'contact_id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Note Created By') ,
177 'description' => 'FK to Contact ID creator',
178 'FKClassName' => 'CRM_Contact_DAO_Contact',
179 ) ,
180 'modified_date' => array(
181 'name' => 'modified_date',
182 'type' => CRM_Utils_Type::T_DATE,
183 'title' => ts('Note Modified By') ,
184 'description' => 'When was this note last modified/edited',
185 ) ,
186 'subject' => array(
187 'name' => 'subject',
188 'type' => CRM_Utils_Type::T_STRING,
189 'title' => ts('Subject') ,
190 'description' => 'subject of note description',
191 'maxlength' => 255,
192 'size' => 60,
193 'html' => array(
194 'type' => 'Text',
195 ) ,
196 ) ,
197 'privacy' => array(
198 'name' => 'privacy',
199 'type' => CRM_Utils_Type::T_STRING,
200 'title' => ts('Privacy') ,
201 'description' => 'Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)',
202 'maxlength' => 255,
203 'size' => CRM_Utils_Type::HUGE,
204 'pseudoconstant' => array(
205 'optionGroupName' => 'note_privacy',
206 'optionEditPath' => 'civicrm/admin/options/note_privacy',
207 )
208 ) ,
209 );
210 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
211 }
212 return Civi::$statics[__CLASS__]['fields'];
213 }
214 /**
215 * Return a mapping from field-name to the corresponding key (as used in fields()).
216 *
217 * @return array
218 * Array(string $name => string $uniqueName).
219 */
220 static function &fieldKeys() {
221 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
222 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
223 }
224 return Civi::$statics[__CLASS__]['fieldKeys'];
225 }
226 /**
227 * Returns the names of this table
228 *
229 * @return string
230 */
231 static function getTableName() {
232 return self::$_tableName;
233 }
234 /**
235 * Returns if this table needs to be logged
236 *
237 * @return boolean
238 */
239 function getLog() {
240 return self::$_log;
241 }
242 /**
243 * Returns the list of fields that can be imported
244 *
245 * @param bool $prefix
246 *
247 * @return array
248 */
249 static function &import($prefix = false) {
250 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'note', $prefix, array());
251 return $r;
252 }
253 /**
254 * Returns the list of fields that can be exported
255 *
256 * @param bool $prefix
257 *
258 * @return array
259 */
260 static function &export($prefix = false) {
261 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'note', $prefix, array());
262 return $r;
263 }
264 }