3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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-2013
35 class CRM_Admin_Page_ParticipantStatus
extends CRM_Core_Page_Basic
{
37 public $useLivePageJS = TRUE;
38 function getBAOName() {
39 return 'CRM_Event_BAO_ParticipantStatusType';
44 if ($links === NULL) {
46 CRM_Core_Action
::UPDATE
=> array(
48 'url' => 'civicrm/admin/participant_status',
49 'qs' => 'action=update&id=%%id%%&reset=1',
50 'title' => ts('Edit Status'),
52 CRM_Core_Action
::DELETE
=> array(
53 'name' => ts('Delete'),
54 'url' => 'civicrm/admin/participant_status',
55 'qs' => 'action=delete&id=%%id%%',
56 'title' => ts('Delete Status'),
58 CRM_Core_Action
::DISABLE
=> array(
59 'name' => ts('Disable'),
60 'ref' => 'crm-enable-disable',
61 'title' => ts('Disable Status'),
63 CRM_Core_Action
::ENABLE
=> array(
64 'name' => ts('Enable'),
65 'ref' => 'crm-enable-disable',
66 'title' => ts('Enable Status'),
74 $statusTypes = array();
76 $dao = new CRM_Event_DAO_ParticipantStatusType
;
77 $dao->orderBy('weight');
80 $visibilities = CRM_Core_PseudoConstant
::visibility();
82 // these statuses are reserved, but disabled by default - so should be disablable after being enabled
83 $disablable = array('On waitlist', 'Awaiting approval', 'Pending from waitlist', 'Pending from approval', 'Rejected');
85 while ($dao->fetch()) {
86 CRM_Core_DAO
::storeValues($dao, $statusTypes[$dao->id
]);
87 $action = array_sum(array_keys($this->links()));
88 if ($dao->is_reserved
) {
89 $action -= CRM_Core_Action
::DELETE
;
90 if (!in_array($dao->name
, $disablable)) {
91 $action -= CRM_Core_Action
::DISABLE
;
94 $action -= $dao->is_active ? CRM_Core_Action
::ENABLE
: CRM_Core_Action
::DISABLE
;
95 $statusTypes[$dao->id
]['action'] = CRM_Core_Action
::formLink(
98 array('id' => $dao->id
),
101 'participantStatusType.manage.action',
102 'ParticipantStatusType',
105 $statusTypes[$dao->id
]['visibility'] = $visibilities[$dao->visibility_id
];
107 $this->assign('rows', $statusTypes);
110 function editForm() {
111 return 'CRM_Admin_Form_ParticipantStatus';
114 function editName() {
115 return 'Participant Status';
118 function userContext($mode = NULL) {
119 return 'civicrm/admin/participant_status';