Code comment cleanup
[civicrm-core.git] / CRM / ACL / BAO / EntityRole.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
232624b1 4 | CiviCRM version 4.4 |
6a488035
TO
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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/**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2013
32 * $Id$
33 *
34 */
35
36/**
37 * Access Control EntityRole
38 */
39class CRM_ACL_BAO_EntityRole extends CRM_ACL_DAO_EntityRole {
40 static $_entityTable = NULL;
41
42 static function entityTable() {
43 if (!self::$_entityTable) {
44 self::$_entityTable = array(
45 'civicrm_contact' => ts('Contact'),
46 'civicrm_group' => ts('Group'),
47 );
48 }
49 return self::$_entityTable;
50 }
51
52 static function create(&$params) {
53 $dao = new CRM_ACL_DAO_EntityRole();
54 $dao->copyValues($params);
55
56 $dao->save();
57 }
58
59 static function retrieve(&$params, &$defaults) {
60 CRM_Core_DAO::commonRetrieve('CRM_ACL_DAO_EntityRole', $params, $defaults);
61 }
62
63 /**
64 * update the is_active flag in the db
65 *
66 * @param int $id id of the database record
67 * @param boolean $is_active value we want to set the is_active field
68 *
69 * @return Object DAO object on sucess, null otherwise
70 * @static
71 */
72 static function setIsActive($id, $is_active) {
73 return CRM_Core_DAO::setFieldValue('CRM_ACL_DAO_EntityRole', $id, 'is_active', $is_active);
74 }
75
76 /**
77 * Function to delete Entity Role records
78 *
79 * @param int $entityRoleId ID of the EntityRole record to be deleted.
80 *
81 * @access public
82 * @static
83 */
84 static function del($entityRoleId) {
85 $entityDAO = new CRM_ACL_DAO_EntityRole();
86 $entityDAO->id = $entityRoleId;
87 $entityDAO->find(TRUE);
88 $entityDAO->delete();
89 }
90}
91