3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
31 * Generated from xml/schema/CRM/Core/IM.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:fe754a68bdda23ca881ac6425750eeba)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Core_DAO_IM constructor.
40 class CRM_Core_DAO_IM
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_im';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
66 * Which Location does this email belong to.
70 public $location_type_id;
78 * Which IM Provider does this screen name belong to.
84 * Is this the primary IM for this contact and location.
90 * Is this the billing?
98 function __construct() {
99 $this->__table
= 'civicrm_im';
100 parent
::__construct();
103 * Returns foreign keys and entity references.
106 * [CRM_Core_Reference_Interface]
108 static function getReferenceColumns() {
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() , 'contact_id', 'civicrm_contact', 'id');
112 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
114 return Civi
::$statics[__CLASS__
]['links'];
117 * Returns all the column names of this table
121 static function &fields() {
122 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
123 Civi
::$statics[__CLASS__
]['fields'] = array(
126 'type' => CRM_Utils_Type
::T_INT
,
127 'title' => ts('Instant Messenger ID') ,
128 'description' => 'Unique IM ID',
130 'table_name' => 'civicrm_im',
132 'bao' => 'CRM_Core_BAO_IM',
135 'contact_id' => array(
136 'name' => 'contact_id',
137 'type' => CRM_Utils_Type
::T_INT
,
138 'title' => ts('IM Contact') ,
139 'description' => 'FK to Contact ID',
140 'table_name' => 'civicrm_im',
142 'bao' => 'CRM_Core_BAO_IM',
144 'FKClassName' => 'CRM_Contact_DAO_Contact',
146 'location_type_id' => array(
147 'name' => 'location_type_id',
148 'type' => CRM_Utils_Type
::T_INT
,
149 'title' => ts('IM Location Type') ,
150 'description' => 'Which Location does this email belong to.',
151 'table_name' => 'civicrm_im',
153 'bao' => 'CRM_Core_BAO_IM',
158 'pseudoconstant' => array(
159 'table' => 'civicrm_location_type',
161 'labelColumn' => 'display_name',
166 'type' => CRM_Utils_Type
::T_STRING
,
167 'title' => ts('IM Screen Name') ,
168 'description' => 'IM screen name',
170 'size' => CRM_Utils_Type
::BIG
,
172 'where' => 'civicrm_im.name',
173 'headerPattern' => '/I(nstant )?M(ess.*)?|screen(\s+)?name/i',
174 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
176 'table_name' => 'civicrm_im',
178 'bao' => 'CRM_Core_BAO_IM',
184 'provider_id' => array(
185 'name' => 'provider_id',
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('IM Provider') ,
188 'description' => 'Which IM Provider does this screen name belong to.',
189 'table_name' => 'civicrm_im',
191 'bao' => 'CRM_Core_BAO_IM',
196 'pseudoconstant' => array(
197 'optionGroupName' => 'instant_messenger_service',
198 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
201 'is_primary' => array(
202 'name' => 'is_primary',
203 'type' => CRM_Utils_Type
::T_BOOLEAN
,
204 'title' => ts('Is IM Primary?') ,
205 'description' => 'Is this the primary IM for this contact and location.',
206 'table_name' => 'civicrm_im',
208 'bao' => 'CRM_Core_BAO_IM',
211 'is_billing' => array(
212 'name' => 'is_billing',
213 'type' => CRM_Utils_Type
::T_BOOLEAN
,
214 'title' => ts('Is IM Billing?') ,
215 'description' => 'Is this the billing?',
216 'table_name' => 'civicrm_im',
218 'bao' => 'CRM_Core_BAO_IM',
222 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
224 return Civi
::$statics[__CLASS__
]['fields'];
227 * Return a mapping from field-name to the corresponding key (as used in fields()).
230 * Array(string $name => string $uniqueName).
232 static function &fieldKeys() {
233 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
234 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
236 return Civi
::$statics[__CLASS__
]['fieldKeys'];
239 * Returns the names of this table
243 static function getTableName() {
244 return self
::$_tableName;
247 * Returns if this table needs to be logged
255 * Returns the list of fields that can be imported
257 * @param bool $prefix
261 static function &import($prefix = false) {
262 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'im', $prefix, array());
266 * Returns the list of fields that can be exported
268 * @param bool $prefix
272 static function &export($prefix = false) {
273 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'im', $prefix, array());
277 * Returns the list of indices
279 public static function indices($localize = TRUE) {
281 'index_location_type' => array(
282 'name' => 'index_location_type',
284 0 => 'location_type_id',
286 'localizable' => false,
287 'sig' => 'civicrm_im::0::location_type_id',
289 'UI_provider_id' => array(
290 'name' => 'UI_provider_id',
294 'localizable' => false,
295 'sig' => 'civicrm_im::0::provider_id',
297 'index_is_primary' => array(
298 'name' => 'index_is_primary',
302 'localizable' => false,
303 'sig' => 'civicrm_im::0::is_primary',
305 'index_is_billing' => array(
306 'name' => 'index_is_billing',
310 'localizable' => false,
311 'sig' => 'civicrm_im::0::is_billing',
314 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;