Merge pull request #22138 from eileenmcnaughton/cust_edit
[civicrm-core.git] / CRM / Core / DAO / Website.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Website.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:042da2fb78309555f5d4ecbe41d33cd0)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Website entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Website extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.2';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_website';
c3fc2621 25
449c4e6b
CW
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-desktop';
32
8ab43c93
CW
33 /**
34 * Field to show when displaying a record.
35 *
36 * @var string
37 */
38 public static $_labelField = 'url';
39
e501603b 40 /**
f41f0342 41 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 42 *
c3fc2621 43 * @var bool
e501603b 44 */
fa45b5b9 45 public static $_log = FALSE;
c3fc2621 46
e501603b
TO
47 /**
48 * Unique Website ID
49 *
e6ca0a57 50 * @var int
e501603b
TO
51 */
52 public $id;
c3fc2621 53
e501603b
TO
54 /**
55 * FK to Contact ID
56 *
e6ca0a57 57 * @var int
e501603b
TO
58 */
59 public $contact_id;
c3fc2621 60
e501603b
TO
61 /**
62 * Website
63 *
64 * @var string
65 */
66 public $url;
c3fc2621 67
e501603b
TO
68 /**
69 * Which Website type does this website belong to.
70 *
e6ca0a57 71 * @var int
e501603b
TO
72 */
73 public $website_type_id;
c3fc2621 74
e501603b 75 /**
f41f0342 76 * Class constructor.
e501603b 77 */
c3fc2621 78 public function __construct() {
e501603b
TO
79 $this->__table = 'civicrm_website';
80 parent::__construct();
81 }
c3fc2621 82
449c4e6b
CW
83 /**
84 * Returns localized title of this entity.
7b66c3b5
AH
85 *
86 * @param bool $plural
87 * Whether to return the plural version of the title.
449c4e6b 88 */
7b66c3b5
AH
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ? ts('Websites') : ts('Website');
449c4e6b
CW
91 }
92
e501603b 93 /**
f41f0342 94 * Returns foreign keys and entity references.
e501603b
TO
95 *
96 * @return array
97 * [CRM_Core_Reference_Interface]
98 */
c3fc2621 99 public static function getReferenceColumns() {
346aaaba 100 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 101 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 102 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 103 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 104 }
346aaaba 105 return Civi::$statics[__CLASS__]['links'];
e501603b 106 }
c3fc2621 107
e501603b
TO
108 /**
109 * Returns all the column names of this table
110 *
111 * @return array
112 */
c3fc2621 113 public static function &fields() {
346aaaba 114 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
115 Civi::$statics[__CLASS__]['fields'] = [
116 'id' => [
e501603b
TO
117 'name' => 'id',
118 'type' => CRM_Utils_Type::T_INT,
c3fc2621 119 'title' => ts('Website ID'),
215b423e 120 'description' => ts('Unique Website ID'),
c3fc2621 121 'required' => TRUE,
a36434b9 122 'where' => 'civicrm_website.id',
522a26c9 123 'table_name' => 'civicrm_website',
124 'entity' => 'Website',
125 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 126 'localizable' => 0,
2cbbebe8
A
127 'html' => [
128 'type' => 'Number',
129 ],
1fe423d6 130 'readonly' => TRUE,
a9d0587b 131 'add' => '3.2',
c3fc2621
CW
132 ],
133 'contact_id' => [
e501603b
TO
134 'name' => 'contact_id',
135 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 136 'title' => ts('Contact ID'),
215b423e 137 'description' => ts('FK to Contact ID'),
a36434b9 138 'where' => 'civicrm_website.contact_id',
522a26c9 139 'table_name' => 'civicrm_website',
140 'entity' => 'Website',
141 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 142 'localizable' => 0,
e501603b 143 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
144 'html' => [
145 'label' => ts("Contact"),
146 ],
a9d0587b 147 'add' => '3.2',
c3fc2621
CW
148 ],
149 'url' => [
e501603b
TO
150 'name' => 'url',
151 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 152 'title' => ts('Website'),
215b423e 153 'description' => ts('Website'),
e501603b
TO
154 'maxlength' => 128,
155 'size' => 30,
c3fc2621 156 'import' => TRUE,
e501603b
TO
157 'where' => 'civicrm_website.url',
158 'headerPattern' => '/Website/i',
159 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
c3fc2621 160 'export' => TRUE,
522a26c9 161 'table_name' => 'civicrm_website',
162 'entity' => 'Website',
163 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 164 'localizable' => 0,
c3fc2621 165 'html' => [
e501603b 166 'type' => 'Text',
c3fc2621 167 ],
a9d0587b 168 'add' => '3.2',
c3fc2621
CW
169 ],
170 'website_type_id' => [
e501603b
TO
171 'name' => 'website_type_id',
172 'type' => CRM_Utils_Type::T_INT,
c3fc2621 173 'title' => ts('Website Type'),
215b423e 174 'description' => ts('Which Website type does this website belong to.'),
a36434b9 175 'where' => 'civicrm_website.website_type_id',
522a26c9 176 'table_name' => 'civicrm_website',
177 'entity' => 'Website',
178 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 179 'localizable' => 0,
c3fc2621 180 'html' => [
e501603b 181 'type' => 'Select',
c3fc2621
CW
182 ],
183 'pseudoconstant' => [
e501603b
TO
184 'optionGroupName' => 'website_type',
185 'optionEditPath' => 'civicrm/admin/options/website_type',
e6ca0a57 186 ],
a9d0587b 187 'add' => '3.2',
c3fc2621
CW
188 ],
189 ];
346aaaba 190 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 191 }
346aaaba 192 return Civi::$statics[__CLASS__]['fields'];
e501603b 193 }
c3fc2621 194
e501603b 195 /**
bd8e0b14 196 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
197 *
198 * @return array
bd8e0b14 199 * Array(string $name => string $uniqueName).
e501603b 200 */
c3fc2621 201 public static function &fieldKeys() {
bd8e0b14
TO
202 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
203 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 204 }
bd8e0b14 205 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 206 }
c3fc2621 207
e501603b
TO
208 /**
209 * Returns the names of this table
210 *
211 * @return string
212 */
c3fc2621 213 public static function getTableName() {
e501603b
TO
214 return self::$_tableName;
215 }
c3fc2621 216
e501603b
TO
217 /**
218 * Returns if this table needs to be logged
219 *
c3fc2621 220 * @return bool
e501603b 221 */
c3fc2621 222 public function getLog() {
e501603b
TO
223 return self::$_log;
224 }
c3fc2621 225
e501603b
TO
226 /**
227 * Returns the list of fields that can be imported
228 *
229 * @param bool $prefix
230 *
231 * @return array
232 */
c3fc2621
CW
233 public static function &import($prefix = FALSE) {
234 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, []);
60808919 235 return $r;
e501603b 236 }
c3fc2621 237
e501603b
TO
238 /**
239 * Returns the list of fields that can be exported
240 *
241 * @param bool $prefix
242 *
243 * @return array
244 */
c3fc2621
CW
245 public static function &export($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, []);
60808919 247 return $r;
e501603b 248 }
c3fc2621 249
e7a6b91a
AS
250 /**
251 * Returns the list of indices
c3fc2621
CW
252 *
253 * @param bool $localize
254 *
255 * @return array
e7a6b91a
AS
256 */
257 public static function indices($localize = TRUE) {
c3fc2621
CW
258 $indices = [
259 'UI_website_type_id' => [
e7a6b91a 260 'name' => 'UI_website_type_id',
c3fc2621 261 'field' => [
e7a6b91a 262 0 => 'website_type_id',
c3fc2621
CW
263 ],
264 'localizable' => FALSE,
e7a6b91a 265 'sig' => 'civicrm_website::0::website_type_id',
c3fc2621
CW
266 ],
267 ];
e7a6b91a
AS
268 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
269 }
c3fc2621 270
e501603b 271}