$confirmJS = array('onclick' => "return confirmStatus( {$participantStatusId}, {$contributionStatusId} );");
}
+ // get the participant status names to build special status array which is used to show notification
+ // checkbox below participant status select
+ $participantStatusName = CRM_Event_PseudoConstant::participantStatus();
+ $notificationStatuses = array(
+ 'Cancelled',
+ 'Pending from waitlist',
+ 'Pending from approval',
+ 'Expired',
+ );
+
+ // get the required status and then implode only ids
+ $notificationStatusIds = implode(',', array_keys(array_intersect($participantStatusName, $notificationStatuses)));
+ $this->assign('notificationStatusIds', $notificationStatusIds);
+
$this->_participantStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
$this->add('select', 'status_id', ts('Participant Status'),
array(
{* include jscript to warn if unsaved form field changes *}
{include file="CRM/common/formNavigate.tpl"}
-{/if} {* end of eventshow condition*}
-
<script type="text/javascript">
{literal}
+
sendNotification();
- cj("#notify").hide();
- function sendNotification( ) {
- var status = cj("select#status_id option:selected").text();
- cj("#notify").hide();
-
- if ( status == 'Cancelled' ||
- status == 'Pending from waitlist' ||
- status == 'Pending from approval' ||
- status == 'Expired' ) {
+ function sendNotification() {
+ var notificationStatusIds = {/literal}"{$notificationStatusIds}"{literal};
+ notificationStatusIds = notificationStatusIds.split(',');
+ if (cj.inArray(cj('select#status_id option:selected').val(), notificationStatusIds) > -1) {
cj("#notify").show();
- cj("#is_notify").attr('checked',true);
+ cj("#is_notify").attr('checked', true);
+ }
+ else {
+ cj("#notify").hide();
+ cj("#is_notify").removeAttr('checked');
}
}
</script>
{/literal}
+{/if} {* end of main event block*}
+