PageRenderTime 24ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/sites/all/modules/contrib/civicrm/CRM/PCP/DAO/PCPBlock.php

https://gitlab.com/virtualrealms/d7civicrm
PHP | 397 lines | 235 code | 27 blank | 135 comment | 4 complexity | 4cdece73f95209ead1d6c5c417c452e7 MD5 | raw file
  1. <?php
  2. /**
  3. * @package CRM
  4. * @copyright CiviCRM LLC (c) 2004-2019
  5. *
  6. * Generated from xml/schema/CRM/PCP/PCPBlock.xml
  7. * DO NOT EDIT. Generated by CRM_Core_CodeGen
  8. * (GenCodeChecksum:540832625ac42de5f986853162733eb3)
  9. */
  10. /**
  11. * Database access object for the PCPBlock entity.
  12. */
  13. class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
  14. /**
  15. * Static instance to hold the table name.
  16. *
  17. * @var string
  18. */
  19. public static $_tableName = 'civicrm_pcp_block';
  20. /**
  21. * Should CiviCRM log any modifications to this table in the civicrm_log table.
  22. *
  23. * @var bool
  24. */
  25. public static $_log = TRUE;
  26. /**
  27. * PCP block Id
  28. *
  29. * @var int
  30. */
  31. public $id;
  32. /**
  33. * @var string
  34. */
  35. public $entity_table;
  36. /**
  37. * FK to civicrm_contribution_page.id OR civicrm_event.id
  38. *
  39. * @var int
  40. */
  41. public $entity_id;
  42. /**
  43. * The type of entity that this pcp targets
  44. *
  45. * @var string
  46. */
  47. public $target_entity_type;
  48. /**
  49. * The entity that this pcp targets
  50. *
  51. * @var int
  52. */
  53. public $target_entity_id;
  54. /**
  55. * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
  56. *
  57. * @var int
  58. */
  59. public $supporter_profile_id;
  60. /**
  61. * FK to civicrm_option_group with name = PCP owner notifications
  62. *
  63. * @var int
  64. */
  65. public $owner_notify_id;
  66. /**
  67. * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
  68. *
  69. * @var bool
  70. */
  71. public $is_approval_needed;
  72. /**
  73. * Does Personal Campaign Page allow using tell a friend?
  74. *
  75. * @var bool
  76. */
  77. public $is_tellfriend_enabled;
  78. /**
  79. * Maximum recipient fields allowed in tell a friend
  80. *
  81. * @var int
  82. */
  83. public $tellfriend_limit;
  84. /**
  85. * Link text for PCP.
  86. *
  87. * @var string
  88. */
  89. public $link_text;
  90. /**
  91. * Is Personal Campaign Page Block enabled/active?
  92. *
  93. * @var bool
  94. */
  95. public $is_active;
  96. /**
  97. * If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page
  98. *
  99. * @var string
  100. */
  101. public $notify_email;
  102. /**
  103. * Class constructor.
  104. */
  105. public function __construct() {
  106. $this->__table = 'civicrm_pcp_block';
  107. parent::__construct();
  108. }
  109. /**
  110. * Returns foreign keys and entity references.
  111. *
  112. * @return array
  113. * [CRM_Core_Reference_Interface]
  114. */
  115. public static function getReferenceColumns() {
  116. if (!isset(Civi::$statics[__CLASS__]['links'])) {
  117. Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
  118. Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id');
  119. Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
  120. Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type');
  121. CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
  122. }
  123. return Civi::$statics[__CLASS__]['links'];
  124. }
  125. /**
  126. * Returns all the column names of this table
  127. *
  128. * @return array
  129. */
  130. public static function &fields() {
  131. if (!isset(Civi::$statics[__CLASS__]['fields'])) {
  132. Civi::$statics[__CLASS__]['fields'] = [
  133. 'id' => [
  134. 'name' => 'id',
  135. 'type' => CRM_Utils_Type::T_INT,
  136. 'title' => ts('PCP Block ID'),
  137. 'description' => ts('PCP block Id'),
  138. 'required' => TRUE,
  139. 'where' => 'civicrm_pcp_block.id',
  140. 'table_name' => 'civicrm_pcp_block',
  141. 'entity' => 'PCPBlock',
  142. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  143. 'localizable' => 0,
  144. ],
  145. 'entity_table' => [
  146. 'name' => 'entity_table',
  147. 'type' => CRM_Utils_Type::T_STRING,
  148. 'title' => ts('Entity Table'),
  149. 'maxlength' => 64,
  150. 'size' => CRM_Utils_Type::BIG,
  151. 'where' => 'civicrm_pcp_block.entity_table',
  152. 'table_name' => 'civicrm_pcp_block',
  153. 'entity' => 'PCPBlock',
  154. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  155. 'localizable' => 0,
  156. ],
  157. 'entity_id' => [
  158. 'name' => 'entity_id',
  159. 'type' => CRM_Utils_Type::T_INT,
  160. 'title' => ts('Entity'),
  161. 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
  162. 'required' => TRUE,
  163. 'where' => 'civicrm_pcp_block.entity_id',
  164. 'table_name' => 'civicrm_pcp_block',
  165. 'entity' => 'PCPBlock',
  166. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  167. 'localizable' => 0,
  168. ],
  169. 'target_entity_type' => [
  170. 'name' => 'target_entity_type',
  171. 'type' => CRM_Utils_Type::T_STRING,
  172. 'title' => ts('Target Entity'),
  173. 'description' => ts('The type of entity that this pcp targets'),
  174. 'required' => TRUE,
  175. 'maxlength' => 255,
  176. 'size' => CRM_Utils_Type::HUGE,
  177. 'where' => 'civicrm_pcp_block.target_entity_type',
  178. 'default' => 'contribute',
  179. 'table_name' => 'civicrm_pcp_block',
  180. 'entity' => 'PCPBlock',
  181. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  182. 'localizable' => 0,
  183. ],
  184. 'target_entity_id' => [
  185. 'name' => 'target_entity_id',
  186. 'type' => CRM_Utils_Type::T_INT,
  187. 'title' => ts('Target Entity ID'),
  188. 'description' => ts('The entity that this pcp targets'),
  189. 'required' => TRUE,
  190. 'where' => 'civicrm_pcp_block.target_entity_id',
  191. 'table_name' => 'civicrm_pcp_block',
  192. 'entity' => 'PCPBlock',
  193. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  194. 'localizable' => 0,
  195. ],
  196. 'supporter_profile_id' => [
  197. 'name' => 'supporter_profile_id',
  198. 'type' => CRM_Utils_Type::T_INT,
  199. 'title' => ts('Supporter Profile'),
  200. 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
  201. 'where' => 'civicrm_pcp_block.supporter_profile_id',
  202. 'default' => 'NULL',
  203. 'table_name' => 'civicrm_pcp_block',
  204. 'entity' => 'PCPBlock',
  205. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  206. 'localizable' => 0,
  207. 'FKClassName' => 'CRM_Core_DAO_UFGroup',
  208. ],
  209. 'owner_notify_id' => [
  210. 'name' => 'owner_notify_id',
  211. 'type' => CRM_Utils_Type::T_INT,
  212. 'title' => ts('Owner Notification'),
  213. 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
  214. 'where' => 'civicrm_pcp_block.owner_notify_id',
  215. 'default' => '0',
  216. 'table_name' => 'civicrm_pcp_block',
  217. 'entity' => 'PCPBlock',
  218. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  219. 'localizable' => 0,
  220. 'html' => [
  221. 'type' => 'Radio',
  222. ],
  223. 'pseudoconstant' => [
  224. 'optionGroupName' => 'pcp_owner_notify',
  225. 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
  226. ],
  227. ],
  228. 'is_approval_needed' => [
  229. 'name' => 'is_approval_needed',
  230. 'type' => CRM_Utils_Type::T_BOOLEAN,
  231. 'title' => ts('Approval Required?'),
  232. 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
  233. 'where' => 'civicrm_pcp_block.is_approval_needed',
  234. 'default' => 'NULL',
  235. 'table_name' => 'civicrm_pcp_block',
  236. 'entity' => 'PCPBlock',
  237. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  238. 'localizable' => 0,
  239. ],
  240. 'is_tellfriend_enabled' => [
  241. 'name' => 'is_tellfriend_enabled',
  242. 'type' => CRM_Utils_Type::T_BOOLEAN,
  243. 'title' => ts('Tell a Friend Enabled?'),
  244. 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
  245. 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
  246. 'default' => 'NULL',
  247. 'table_name' => 'civicrm_pcp_block',
  248. 'entity' => 'PCPBlock',
  249. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  250. 'localizable' => 0,
  251. ],
  252. 'tellfriend_limit' => [
  253. 'name' => 'tellfriend_limit',
  254. 'type' => CRM_Utils_Type::T_INT,
  255. 'title' => ts('Tell A Friend Limit'),
  256. 'description' => ts('Maximum recipient fields allowed in tell a friend'),
  257. 'where' => 'civicrm_pcp_block.tellfriend_limit',
  258. 'default' => 'NULL',
  259. 'table_name' => 'civicrm_pcp_block',
  260. 'entity' => 'PCPBlock',
  261. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  262. 'localizable' => 0,
  263. ],
  264. 'link_text' => [
  265. 'name' => 'link_text',
  266. 'type' => CRM_Utils_Type::T_STRING,
  267. 'title' => ts('Link Text'),
  268. 'description' => ts('Link text for PCP.'),
  269. 'maxlength' => 255,
  270. 'size' => CRM_Utils_Type::HUGE,
  271. 'where' => 'civicrm_pcp_block.link_text',
  272. 'default' => 'NULL',
  273. 'table_name' => 'civicrm_pcp_block',
  274. 'entity' => 'PCPBlock',
  275. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  276. 'localizable' => 1,
  277. ],
  278. 'is_active' => [
  279. 'name' => 'is_active',
  280. 'type' => CRM_Utils_Type::T_BOOLEAN,
  281. 'title' => ts('Enabled?'),
  282. 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
  283. 'where' => 'civicrm_pcp_block.is_active',
  284. 'default' => '1',
  285. 'table_name' => 'civicrm_pcp_block',
  286. 'entity' => 'PCPBlock',
  287. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  288. 'localizable' => 0,
  289. ],
  290. 'notify_email' => [
  291. 'name' => 'notify_email',
  292. 'type' => CRM_Utils_Type::T_STRING,
  293. 'title' => ts('Notification Email'),
  294. 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
  295. 'maxlength' => 255,
  296. 'size' => CRM_Utils_Type::HUGE,
  297. 'where' => 'civicrm_pcp_block.notify_email',
  298. 'default' => 'NULL',
  299. 'table_name' => 'civicrm_pcp_block',
  300. 'entity' => 'PCPBlock',
  301. 'bao' => 'CRM_PCP_BAO_PCPBlock',
  302. 'localizable' => 0,
  303. ],
  304. ];
  305. CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
  306. }
  307. return Civi::$statics[__CLASS__]['fields'];
  308. }
  309. /**
  310. * Return a mapping from field-name to the corresponding key (as used in fields()).
  311. *
  312. * @return array
  313. * Array(string $name => string $uniqueName).
  314. */
  315. public static function &fieldKeys() {
  316. if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
  317. Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
  318. }
  319. return Civi::$statics[__CLASS__]['fieldKeys'];
  320. }
  321. /**
  322. * Returns the names of this table
  323. *
  324. * @return string
  325. */
  326. public static function getTableName() {
  327. return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
  328. }
  329. /**
  330. * Returns if this table needs to be logged
  331. *
  332. * @return bool
  333. */
  334. public function getLog() {
  335. return self::$_log;
  336. }
  337. /**
  338. * Returns the list of fields that can be imported
  339. *
  340. * @param bool $prefix
  341. *
  342. * @return array
  343. */
  344. public static function &import($prefix = FALSE) {
  345. $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, []);
  346. return $r;
  347. }
  348. /**
  349. * Returns the list of fields that can be exported
  350. *
  351. * @param bool $prefix
  352. *
  353. * @return array
  354. */
  355. public static function &export($prefix = FALSE) {
  356. $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, []);
  357. return $r;
  358. }
  359. /**
  360. * Returns the list of indices
  361. *
  362. * @param bool $localize
  363. *
  364. * @return array
  365. */
  366. public static function indices($localize = TRUE) {
  367. $indices = [];
  368. return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
  369. }
  370. }