* $Id$
*
*/
-class CRM_Admin_Form_ParticipantStatus extends CRM_Admin_Form {
+class CRM_Admin_Form_ParticipantStatusType extends CRM_Admin_Form {
public function buildQuickForm() {
parent::buildQuickForm();
$this->add('text', 'label', ts('Label'), $attributes['label'], TRUE);
- $classes = array(
- 'Positive' => ts('Positive'),
- 'Pending' => ts('Pending'),
- 'Waiting' => ts('Waiting'),
- 'Negative' => ts('Negative'),
- );
-
- $this->add('select', 'class', ts('Class'), $classes, TRUE);
+ $this->addSelect('class', array('required' => TRUE));
$this->add('checkbox', 'is_active', ts('Active?'));
$this->add('checkbox', 'is_counted', ts('Counted?'));
$this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE);
- $this->add('select', 'visibility_id', ts('Visibility'), CRM_Core_PseudoConstant::visibility(), TRUE);
+ $this->addSelect('visibility_id', array('label' => ts('Visibility'), 'required' => TRUE));
}
/**
* $Id$
*
*/
-class CRM_Admin_Page_ParticipantStatus extends CRM_Core_Page_Basic {
+class CRM_Admin_Page_ParticipantStatusType extends CRM_Core_Page_Basic {
public $useLivePageJS = TRUE;
* @return string
*/
public function editForm() {
- return 'CRM_Admin_Form_ParticipantStatus';
+ return 'CRM_Admin_Form_ParticipantStatusType';
}
/**
return self::$participantStatus[$index];
}
+ public static function participantStatusClassOptions() {
+ return array(
+ 'Positive' => ts('Positive'),
+ 'Pending' => ts('Pending'),
+ 'Waiting' => ts('Waiting'),
+ 'Negative' => ts('Negative'),
+ );
+ }
+
/**
* Return a status-type-keyed array of status classes
*
<item>
<path>civicrm/admin/participant_status</path>
<title>Participant Status</title>
- <page_callback>CRM_Admin_Page_ParticipantStatus</page_callback>
+ <page_callback>CRM_Admin_Page_ParticipantStatusType</page_callback>
<desc>Define statuses for event participants here (e.g. Registered, Attended, Cancelled...). You can then assign statuses and search for participants by status.</desc>
<access_arguments>administer CiviCRM,access CiviEvent</access_arguments>
<adminGroup>CiviEvent</adminGroup>
class CRM_Utils_Api {
/**
* Attempts to retrieve the API entity name from any calling class.
+ * FIXME: This is a bit hackish but the naming convention for forms is not very strict
*
* @param string|object $classNameOrObject
*
$daoName = "CRM_Core_DAO_$child";
$shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
}
+
+ // If that didn't work, try using just the trailing name
+ if (!$shortName) {
+ $shortName = CRM_Core_DAO_AllCoreTables::getFullName($child) ? $child : NULL;
+ }
+
+ // If that didn't work, try using just the leading name
+ if (!$shortName) {
+ $shortName = CRM_Core_DAO_AllCoreTables::getFullName($parent) ? $parent : NULL;
+ }
+
if (!$shortName) {
throw new CRM_Core_Exception('Could not find api name for supplied class');
}
+--------------------------------------------------------------------+
*}
{if $action eq 1 or $action eq 2 or $action eq 8}
- {include file="CRM/Admin/Form/ParticipantStatus.tpl"}
+ {include file="CRM/Admin/Form/ParticipantStatusType.tpl"}
{else}
- <div id="help">{ts}Manage event participant statuses below. Enable selected statuses to allow event waitlisting and/or participant approval.{/ts} {help id="id-disabled_statuses" file="CRM/Admin/Page/ParticipantStatus.hlp"}</div>
+ <div id="help">{ts}Manage event participant statuses below. Enable selected statuses to allow event waitlisting and/or participant approval.{/ts} {help id="id-disabled_statuses"}</div>
<div class="crm-section participant-status">
{strip}
<length>8</length>
<comment>the general group of status type this one belongs to</comment>
<pseudoconstant>
- <callback>CRM_Event_PseudoConstant::participantStatusClass</callback>
+ <callback>CRM_Event_PseudoConstant::participantStatusClassOptions</callback>
</pseudoconstant>
<add>3.0</add>
<html>