| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Core/StatusPreference.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:b30c850f5621be00f3a7e828c7fe7c61) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the StatusPreference entity. |
| 14 | */ |
| 15 | class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO { |
| 16 | |
| 17 | /** |
| 18 | * Static instance to hold the table name. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | public static $_tableName = 'civicrm_status_pref'; |
| 23 | |
| 24 | /** |
| 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | public static $_log = FALSE; |
| 30 | |
| 31 | /** |
| 32 | * Unique Status Preference ID |
| 33 | * |
| 34 | * @var int unsigned |
| 35 | */ |
| 36 | public $id; |
| 37 | |
| 38 | /** |
| 39 | * Which Domain is this Status Preference for |
| 40 | * |
| 41 | * @var int unsigned |
| 42 | */ |
| 43 | public $domain_id; |
| 44 | |
| 45 | /** |
| 46 | * Name of the status check this preference references. |
| 47 | * |
| 48 | * @var string |
| 49 | */ |
| 50 | public $name; |
| 51 | |
| 52 | /** |
| 53 | * expires ignore_severity. NULL never hushes. |
| 54 | * |
| 55 | * @var date |
| 56 | */ |
| 57 | public $hush_until; |
| 58 | |
| 59 | /** |
| 60 | * Hush messages up to and including this severity. |
| 61 | * |
| 62 | * @var int unsigned |
| 63 | */ |
| 64 | public $ignore_severity; |
| 65 | |
| 66 | /** |
| 67 | * These settings are per-check, and can't be compared across checks. |
| 68 | * |
| 69 | * @var string |
| 70 | */ |
| 71 | public $prefs; |
| 72 | |
| 73 | /** |
| 74 | * These values are per-check, and can't be compared across checks. |
| 75 | * |
| 76 | * @var string |
| 77 | */ |
| 78 | public $check_info; |
| 79 | |
| 80 | /** |
| 81 | * Class constructor. |
| 82 | */ |
| 83 | public function __construct() { |
| 84 | $this->__table = 'civicrm_status_pref'; |
| 85 | parent::__construct(); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Returns foreign keys and entity references. |
| 90 | * |
| 91 | * @return array |
| 92 | * [CRM_Core_Reference_Interface] |
| 93 | */ |
| 94 | public static function getReferenceColumns() { |
| 95 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
| 96 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
| 97 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
| 98 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
| 99 | } |
| 100 | return Civi::$statics[__CLASS__]['links']; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Returns all the column names of this table |
| 105 | * |
| 106 | * @return array |
| 107 | */ |
| 108 | public static function &fields() { |
| 109 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 110 | Civi::$statics[__CLASS__]['fields'] = [ |
| 111 | 'id' => [ |
| 112 | 'name' => 'id', |
| 113 | 'type' => CRM_Utils_Type::T_INT, |
| 114 | 'title' => ts('Status Preference ID'), |
| 115 | 'description' => ts('Unique Status Preference ID'), |
| 116 | 'required' => TRUE, |
| 117 | 'where' => 'civicrm_status_pref.id', |
| 118 | 'table_name' => 'civicrm_status_pref', |
| 119 | 'entity' => 'StatusPreference', |
| 120 | 'bao' => 'CRM_Core_BAO_StatusPreference', |
| 121 | 'localizable' => 0, |
| 122 | ], |
| 123 | 'domain_id' => [ |
| 124 | 'name' => 'domain_id', |
| 125 | 'type' => CRM_Utils_Type::T_INT, |
| 126 | 'title' => ts('Setting Domain'), |
| 127 | 'description' => ts('Which Domain is this Status Preference for'), |
| 128 | 'required' => TRUE, |
| 129 | 'where' => 'civicrm_status_pref.domain_id', |
| 130 | 'table_name' => 'civicrm_status_pref', |
| 131 | 'entity' => 'StatusPreference', |
| 132 | 'bao' => 'CRM_Core_BAO_StatusPreference', |
| 133 | 'localizable' => 0, |
| 134 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
| 135 | 'pseudoconstant' => [ |
| 136 | 'table' => 'civicrm_domain', |
| 137 | 'keyColumn' => 'id', |
| 138 | 'labelColumn' => 'name', |
| 139 | ] |
| 140 | ], |
| 141 | 'name' => [ |
| 142 | 'name' => 'name', |
| 143 | 'type' => CRM_Utils_Type::T_STRING, |
| 144 | 'title' => ts('Status Check Name'), |
| 145 | 'description' => ts('Name of the status check this preference references.'), |
| 146 | 'required' => TRUE, |
| 147 | 'maxlength' => 255, |
| 148 | 'size' => CRM_Utils_Type::HUGE, |
| 149 | 'import' => TRUE, |
| 150 | 'where' => 'civicrm_status_pref.name', |
| 151 | 'export' => TRUE, |
| 152 | 'table_name' => 'civicrm_status_pref', |
| 153 | 'entity' => 'StatusPreference', |
| 154 | 'bao' => 'CRM_Core_BAO_StatusPreference', |
| 155 | 'localizable' => 0, |
| 156 | ], |
| 157 | 'hush_until' => [ |
| 158 | 'name' => 'hush_until', |
| 159 | 'type' => CRM_Utils_Type::T_DATE, |
| 160 | 'title' => ts('Snooze Status Notifications Until'), |
| 161 | 'description' => ts('expires ignore_severity. NULL never hushes.'), |
| 162 | 'import' => TRUE, |
| 163 | 'where' => 'civicrm_status_pref.hush_until', |
| 164 | 'export' => TRUE, |
| 165 | 'default' => 'NULL', |
| 166 | 'table_name' => 'civicrm_status_pref', |
| 167 | 'entity' => 'StatusPreference', |
| 168 | 'bao' => 'CRM_Core_BAO_StatusPreference', |
| 169 | 'localizable' => 0, |
| 170 | ], |
| 171 | 'ignore_severity' => [ |
| 172 | 'name' => 'ignore_severity', |
| 173 | 'type' => CRM_Utils_Type::T_INT, |
| 174 | 'title' => ts('Ignore Severity'), |
| 175 | 'description' => ts('Hush messages up to and including this severity.'), |
| 176 | 'import' => TRUE, |
| 177 | 'where' => 'civicrm_status_pref.ignore_severity', |
| 178 | 'export' => TRUE, |
| 179 | 'default' => '1', |
| 180 | 'table_name' => 'civicrm_status_pref', |
| 181 | 'entity' => 'StatusPreference', |
| 182 | 'bao' => 'CRM_Core_BAO_StatusPreference', |
| 183 | 'localizable' => 0, |
| 184 | 'pseudoconstant' => [ |
| 185 | 'callback' => 'CRM_Utils_Check::getSeverityList', |
| 186 | ] |
| 187 | ], |
| 188 | 'prefs' => [ |
| 189 | 'name' => 'prefs', |
| 190 | 'type' => CRM_Utils_Type::T_STRING, |
| 191 | 'title' => ts('Status Preferences'), |
| 192 | 'description' => ts('These settings are per-check, and can\'t be compared across checks.'), |
| 193 | 'maxlength' => 255, |
| 194 | 'size' => CRM_Utils_Type::HUGE, |
| 195 | 'where' => 'civicrm_status_pref.prefs', |
| 196 | 'table_name' => 'civicrm_status_pref', |
| 197 | 'entity' => 'StatusPreference', |
| 198 | 'bao' => 'CRM_Core_BAO_StatusPreference', |
| 199 | 'localizable' => 0, |
| 200 | ], |
| 201 | 'check_info' => [ |
| 202 | 'name' => 'check_info', |
| 203 | 'type' => CRM_Utils_Type::T_STRING, |
| 204 | 'title' => ts('Check Info'), |
| 205 | 'description' => ts('These values are per-check, and can\'t be compared across checks.'), |
| 206 | 'maxlength' => 255, |
| 207 | 'size' => CRM_Utils_Type::HUGE, |
| 208 | 'where' => 'civicrm_status_pref.check_info', |
| 209 | 'table_name' => 'civicrm_status_pref', |
| 210 | 'entity' => 'StatusPreference', |
| 211 | 'bao' => 'CRM_Core_BAO_StatusPreference', |
| 212 | 'localizable' => 0, |
| 213 | ], |
| 214 | ]; |
| 215 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 216 | } |
| 217 | return Civi::$statics[__CLASS__]['fields']; |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 222 | * |
| 223 | * @return array |
| 224 | * Array(string $name => string $uniqueName). |
| 225 | */ |
| 226 | public static function &fieldKeys() { |
| 227 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 228 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 229 | } |
| 230 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Returns the names of this table |
| 235 | * |
| 236 | * @return string |
| 237 | */ |
| 238 | public static function getTableName() { |
| 239 | return self::$_tableName; |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Returns if this table needs to be logged |
| 244 | * |
| 245 | * @return bool |
| 246 | */ |
| 247 | public function getLog() { |
| 248 | return self::$_log; |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Returns the list of fields that can be imported |
| 253 | * |
| 254 | * @param bool $prefix |
| 255 | * |
| 256 | * @return array |
| 257 | */ |
| 258 | public static function &import($prefix = FALSE) { |
| 259 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'status_pref', $prefix, []); |
| 260 | return $r; |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * Returns the list of fields that can be exported |
| 265 | * |
| 266 | * @param bool $prefix |
| 267 | * |
| 268 | * @return array |
| 269 | */ |
| 270 | public static function &export($prefix = FALSE) { |
| 271 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'status_pref', $prefix, []); |
| 272 | return $r; |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * Returns the list of indices |
| 277 | * |
| 278 | * @param bool $localize |
| 279 | * |
| 280 | * @return array |
| 281 | */ |
| 282 | public static function indices($localize = TRUE) { |
| 283 | $indices = [ |
| 284 | 'UI_status_pref_name' => [ |
| 285 | 'name' => 'UI_status_pref_name', |
| 286 | 'field' => [ |
| 287 | 0 => 'name', |
| 288 | ], |
| 289 | 'localizable' => FALSE, |
| 290 | 'sig' => 'civicrm_status_pref::0::name', |
| 291 | ], |
| 292 | ]; |
| 293 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 294 | } |
| 295 | |
| 296 | } |