3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
35 class CRM_Admin_Page_ParticipantStatus
extends CRM_Core_Page_Basic
{
37 public $useLivePageJS = TRUE;
42 function getBAOName() {
43 return 'CRM_Event_BAO_ParticipantStatusType';
51 if ($links === NULL) {
53 CRM_Core_Action
::UPDATE
=> array(
55 'url' => 'civicrm/admin/participant_status',
56 'qs' => 'action=update&id=%%id%%&reset=1',
57 'title' => ts('Edit Status'),
59 CRM_Core_Action
::DELETE
=> array(
60 'name' => ts('Delete'),
61 'url' => 'civicrm/admin/participant_status',
62 'qs' => 'action=delete&id=%%id%%',
63 'title' => ts('Delete Status'),
65 CRM_Core_Action
::DISABLE
=> array(
66 'name' => ts('Disable'),
67 'ref' => 'crm-enable-disable',
68 'title' => ts('Disable Status'),
70 CRM_Core_Action
::ENABLE
=> array(
71 'name' => ts('Enable'),
72 'ref' => 'crm-enable-disable',
73 'title' => ts('Enable Status'),
81 $statusTypes = array();
83 $dao = new CRM_Event_DAO_ParticipantStatusType
;
84 $dao->orderBy('weight');
87 $visibilities = CRM_Core_PseudoConstant
::visibility();
89 // these statuses are reserved, but disabled by default - so should be disablable after being enabled
90 $disablable = array('On waitlist', 'Awaiting approval', 'Pending from waitlist', 'Pending from approval', 'Rejected');
92 while ($dao->fetch()) {
93 CRM_Core_DAO
::storeValues($dao, $statusTypes[$dao->id
]);
94 $action = array_sum(array_keys($this->links()));
95 if ($dao->is_reserved
) {
96 $action -= CRM_Core_Action
::DELETE
;
97 if (!in_array($dao->name
, $disablable)) {
98 $action -= CRM_Core_Action
::DISABLE
;
101 $action -= $dao->is_active ? CRM_Core_Action
::ENABLE
: CRM_Core_Action
::DISABLE
;
102 $statusTypes[$dao->id
]['action'] = CRM_Core_Action
::formLink(
105 array('id' => $dao->id
),
108 'participantStatusType.manage.action',
109 'ParticipantStatusType',
112 $statusTypes[$dao->id
]['visibility'] = $visibilities[$dao->visibility_id
];
114 $this->assign('rows', $statusTypes);
120 function editForm() {
121 return 'CRM_Admin_Form_ParticipantStatus';
127 function editName() {
128 return 'Participant Status';
136 function userContext($mode = NULL) {
137 return 'civicrm/admin/participant_status';