xml/templates/dao.tpl - Simplify fieldKeys()
[civicrm-core.git] / CRM / Core / DAO / OpenID.php
CommitLineData
e501603b
TO
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/OpenID.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:3efcaf2616702a4f0de774761beea36b)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_OpenID extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_openid';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
e501603b
TO
62 /**
63 * static value to see if we should log any modifications to
64 * this table in the civicrm_log table
65 *
66 * @var boolean
67 */
68 static $_log = false;
69 /**
70 * Unique OpenID ID
71 *
72 * @var int unsigned
73 */
74 public $id;
75 /**
76 * FK to Contact ID
77 *
78 * @var int unsigned
79 */
80 public $contact_id;
81 /**
82 * Which Location does this email belong to.
83 *
84 * @var int unsigned
85 */
86 public $location_type_id;
87 /**
88 * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
89 *
90 * @var string
91 */
92 public $openid;
93 /**
94 * Whether or not this user is allowed to login
95 *
96 * @var boolean
97 */
98 public $allowed_to_login;
99 /**
100 * Is this the primary email for this contact and location.
101 *
102 * @var boolean
103 */
104 public $is_primary;
105 /**
106 * class constructor
107 *
108 * @return civicrm_openid
109 */
110 function __construct() {
111 $this->__table = 'civicrm_openid';
112 parent::__construct();
113 }
114 /**
115 * Returns foreign keys and entity references
116 *
117 * @return array
118 * [CRM_Core_Reference_Interface]
119 */
120 static function getReferenceColumns() {
121 if (!self::$_links) {
122 self::$_links = static ::createReferenceColumns(__CLASS__);
123 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
124 }
125 return self::$_links;
126 }
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 static function &fields() {
133 if (!(self::$_fields)) {
134 self::$_fields = array(
135 'id' => array(
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Open ID identifier') ,
139 'description' => 'Unique OpenID ID',
140 'required' => true,
141 ) ,
142 'contact_id' => array(
143 'name' => 'contact_id',
144 'type' => CRM_Utils_Type::T_INT,
145 'title' => ts('OpenID Contact') ,
146 'description' => 'FK to Contact ID',
147 'FKClassName' => 'CRM_Contact_DAO_Contact',
148 ) ,
149 'location_type_id' => array(
150 'name' => 'location_type_id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('OpenID Location Type') ,
153 'description' => 'Which Location does this email belong to.',
154 ) ,
155 'openid' => array(
156 'name' => 'openid',
157 'type' => CRM_Utils_Type::T_STRING,
158 'title' => ts('OpenID') ,
159 'description' => 'the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM',
160 'maxlength' => 255,
161 'size' => CRM_Utils_Type::HUGE,
162 'import' => true,
163 'where' => 'civicrm_openid.openid',
164 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i',
165 'dataPattern' => '/^[\w\/\:\.]+$/',
166 'export' => true,
167 'rule' => 'url',
168 ) ,
169 'allowed_to_login' => array(
170 'name' => 'allowed_to_login',
171 'type' => CRM_Utils_Type::T_BOOLEAN,
172 'title' => ts('Allowed to login?') ,
173 'description' => 'Whether or not this user is allowed to login',
174 'required' => true,
175 ) ,
176 'is_primary' => array(
177 'name' => 'is_primary',
178 'type' => CRM_Utils_Type::T_BOOLEAN,
179 'title' => ts('Is OpenID Primary?') ,
180 'description' => 'Is this the primary email for this contact and location.',
181 ) ,
182 );
183 }
184 return self::$_fields;
185 }
186 /**
187 * Returns an array containing, for each field, the arary key used for that
188 * field in self::$_fields.
189 *
190 * @return array
191 */
192 static function &fieldKeys() {
193 if (!(self::$_fieldKeys)) {
194 self::$_fieldKeys = array(
195 'id' => 'id',
196 'contact_id' => 'contact_id',
197 'location_type_id' => 'location_type_id',
198 'openid' => 'openid',
199 'allowed_to_login' => 'allowed_to_login',
200 'is_primary' => 'is_primary',
201 );
202 }
203 return self::$_fieldKeys;
204 }
205 /**
206 * Returns the names of this table
207 *
208 * @return string
209 */
210 static function getTableName() {
211 return self::$_tableName;
212 }
213 /**
214 * Returns if this table needs to be logged
215 *
216 * @return boolean
217 */
218 function getLog() {
219 return self::$_log;
220 }
221 /**
222 * Returns the list of fields that can be imported
223 *
224 * @param bool $prefix
225 *
226 * @return array
227 */
228 static function &import($prefix = false) {
60808919
TO
229 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, array());
230 return $r;
e501603b
TO
231 }
232 /**
233 * Returns the list of fields that can be exported
234 *
235 * @param bool $prefix
236 *
237 * @return array
238 */
239 static function &export($prefix = false) {
60808919
TO
240 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, array());
241 return $r;
e501603b
TO
242 }
243}