3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2016
31 * Generated from xml/schema/CRM/Core/IM.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:1f7e266130e31dbdaf5e2021c5ba09ea)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_IM
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_im';
45 * static instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the keys used in $_fields for each field.
55 static $_fieldKeys = null;
57 * static instance to hold the FK relationships
61 static $_links = null;
63 * static instance to hold the values that can
68 static $_import = null;
70 * static instance to hold the values that can
75 static $_export = null;
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
96 * Which Location does this email belong to.
100 public $location_type_id;
108 * Which IM Provider does this screen name belong to.
114 * Is this the primary IM for this contact and location.
120 * Is this the billing?
130 function __construct() {
131 $this->__table
= 'civicrm_im';
132 parent
::__construct();
135 * Returns foreign keys and entity references
138 * [CRM_Core_Reference_Interface]
140 static function getReferenceColumns() {
141 if (!self
::$_links) {
142 self
::$_links = static ::createReferenceColumns(__CLASS__
);
143 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
145 return self
::$_links;
148 * Returns all the column names of this table
152 static function &fields() {
153 if (!(self
::$_fields)) {
154 self
::$_fields = array(
157 'type' => CRM_Utils_Type
::T_INT
,
158 'title' => ts('Instant Messenger ID') ,
159 'description' => 'Unique IM ID',
162 'contact_id' => array(
163 'name' => 'contact_id',
164 'type' => CRM_Utils_Type
::T_INT
,
165 'title' => ts('IM Contact') ,
166 'description' => 'FK to Contact ID',
167 'FKClassName' => 'CRM_Contact_DAO_Contact',
169 'location_type_id' => array(
170 'name' => 'location_type_id',
171 'type' => CRM_Utils_Type
::T_INT
,
172 'title' => ts('IM Location Type') ,
173 'description' => 'Which Location does this email belong to.',
177 'pseudoconstant' => array(
178 'table' => 'civicrm_location_type',
180 'labelColumn' => 'display_name',
185 'type' => CRM_Utils_Type
::T_STRING
,
186 'title' => ts('IM Screen Name') ,
187 'description' => 'IM screen name',
189 'size' => CRM_Utils_Type
::BIG
,
191 'where' => 'civicrm_im.name',
192 'headerPattern' => '/I(nstant )?M(ess.*)?|screen(\s+)?name/i',
193 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
199 'provider_id' => array(
200 'name' => 'provider_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('IM Provider') ,
203 'description' => 'Which IM Provider does this screen name belong to.',
207 'pseudoconstant' => array(
208 'optionGroupName' => 'instant_messenger_service',
209 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
212 'is_primary' => array(
213 'name' => 'is_primary',
214 'type' => CRM_Utils_Type
::T_BOOLEAN
,
215 'title' => ts('Is IM Primary?') ,
216 'description' => 'Is this the primary IM for this contact and location.',
218 'is_billing' => array(
219 'name' => 'is_billing',
220 'type' => CRM_Utils_Type
::T_BOOLEAN
,
221 'title' => ts('Is IM Billing?') ,
222 'description' => 'Is this the billing?',
226 return self
::$_fields;
229 * Returns an array containing, for each field, the arary key used for that
230 * field in self::$_fields.
234 static function &fieldKeys() {
235 if (!(self
::$_fieldKeys)) {
236 self
::$_fieldKeys = array(
238 'contact_id' => 'contact_id',
239 'location_type_id' => 'location_type_id',
241 'provider_id' => 'provider_id',
242 'is_primary' => 'is_primary',
243 'is_billing' => 'is_billing',
246 return self
::$_fieldKeys;
249 * Returns the names of this table
253 static function getTableName() {
254 return self
::$_tableName;
257 * Returns if this table needs to be logged
265 * Returns the list of fields that can be imported
267 * @param bool $prefix
271 static function &import($prefix = false) {
272 if (!(self
::$_import)) {
273 self
::$_import = array();
274 $fields = self
::fields();
275 foreach($fields as $name => $field) {
276 if (CRM_Utils_Array
::value('import', $field)) {
278 self
::$_import['im'] = & $fields[$name];
280 self
::$_import[$name] = & $fields[$name];
285 return self
::$_import;
288 * Returns the list of fields that can be exported
290 * @param bool $prefix
294 static function &export($prefix = false) {
295 if (!(self
::$_export)) {
296 self
::$_export = array();
297 $fields = self
::fields();
298 foreach($fields as $name => $field) {
299 if (CRM_Utils_Array
::value('export', $field)) {
301 self
::$_export['im'] = & $fields[$name];
303 self
::$_export[$name] = & $fields[$name];
308 return self
::$_export;