<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* One place to store frequently used values in Select Elements. Note that
class CRM_Core_SelectValues {
/**
- * preferred mail format
- * @static
+ * Preferred mail format
+ *
+ * @return array
*/
- static function pmf() {
+ public static function pmf() {
return array(
'Both' => ts('Both'),
'HTML' => ts('HTML'),
}
/**
- * privacy options
- * @static
+ * Privacy options
+ *
+ * @return array
*/
- static function privacy() {
+ public static function privacy() {
return array(
'do_not_phone' => ts('Do not phone'),
'do_not_email' => ts('Do not email'),
}
/**
- * various pre defined contact super types
- * @static
+ * Various pre defined contact super types
+ *
+ * @return array
*/
- static function contactType() {
+ public static function contactType() {
static $contactType = NULL;
if (!$contactType) {
$contactType = CRM_Contact_BAO_ContactType::basicTypePairs();
}
/**
- * various pre defined unit list
- * @static
+ * Various pre defined unit list
+ *
+ * @param string $unitType
+ * @return array
*/
- static function unitList($unitType = NULL) {
+ public static function unitList($unitType = NULL) {
$unitList = array(
'day' => ts('day'),
'month' => ts('month'),
}
/**
- * membership type unit
- * @static
+ * Membership type unit
+ *
+ * @return array
*/
- static function membershipTypeUnitList( ) {
+ public static function membershipTypeUnitList() {
return self::unitList('duration');
}
/**
- * various pre defined period types
- * @static
+ * Various pre defined period types
+ *
+ * @return array
*/
- static function periodType() {
+ public static function periodType() {
return array(
'rolling' => ts('Rolling'),
'fixed' => ts('Fixed'),
}
/**
- * various pre defined email selection methods
- * @static
+ * Various pre defined email selection methods
+ *
+ * @return array
*/
- static function emailSelectMethods() {
+ public static function emailSelectMethods() {
return array(
'automatic' => ts("Automatic"),
'location-only' => ts("Only send to email addresses assigned to the specified location"),
'location-prefer' => ts("Prefer email addresses assigned to the specified location"),
- 'location-exclude' => ts("Exclude email addresses assigned to the specified location")
+ 'location-exclude' => ts("Exclude email addresses assigned to the specified location"),
);
}
/**
- * various pre defined member visibility options
- * @static
+ * Various pre defined member visibility options
+ *
+ * @return array
*/
- static function memberVisibility() {
+ public static function memberVisibility() {
return array(
'Public' => ts('Public'),
'Admin' => ts('Admin'),
}
/**
- * various pre defined event dates
- * @static
+ * Member auto-renew options
+ *
+ * @return array
*/
- static function eventDate() {
+ public static function memberAutoRenew() {
+ return array(
+ ts('No auto-renew option'),
+ ts('Give option, but not required'),
+ ts('Auto-renew required'),
+ );
+ }
+
+ /**
+ * Various pre defined event dates
+ *
+ * @return array
+ */
+ public static function eventDate() {
return array(
'start_date' => ts('start date'),
'end_date' => ts('end date'),
/**
* Custom form field types
- * @static
+ *
+ * @return array
*/
- static function customHtmlType() {
+ public static function customHtmlType() {
return array(
'Text' => ts('Single-line input field (text or numeric)'),
'TextArea' => ts('Multi-line text box (textarea)'),
}
/**
- * various pre defined extensions for dynamic properties and groups
+ * Various pre defined extensions for dynamic properties and groups
+ *
+ * @return array
*
- * @static
*/
- static function customGroupExtends() {
+ public static function customGroupExtends() {
$customGroupExtends = array(
'Activity' => ts('Activities'),
'Relationship' => ts('Relationships'),
}
/**
- * styles for displaying the custom data group
+ * Styles for displaying the custom data group
+ *
+ * @return array
*
- * @static
*/
- static function customGroupStyle() {
+ public static function customGroupStyle() {
return array(
'Tab' => ts('Tab'),
'Inline' => ts('Inline'),
}
/**
- * for displaying the uf group types
+ * For displaying the uf group types
*
- * @static
+ * @return array
*/
- static function ufGroupTypes() {
+ public static function ufGroupTypes() {
$ufGroupType = array(
'Profile' => ts('Standalone Form or Directory'),
'Search Profile' => ts('Search Views'),
}
/**
- * the status of a contact within a group
+ * The status of a contact within a group
+ *
+ * @return array
*
- * @static
*/
- static function groupContactStatus() {
+ public static function groupContactStatus() {
return array(
'Added' => ts('Added'),
'Removed' => ts('Removed'),
}
/**
- * list of Group Types
- * @static
+ * List of Group Types
+ *
+ * @return array
*/
- static function groupType() {
+ public static function groupType() {
return array(
'query' => ts('Dynamic'),
'static' => ts('Static'),
}
/**
- * compose the parameters for a date select object
- *
- * @param string|NULL $type the type of date
- * @param string|NULL $format date format ( QF format)
+ * Compose the parameters for a date select object
*
+ * @param string|NULL $type
+ * the type of date
+ * @param string|NULL $format
+ * date format (QF format)
* @param null $minOffset
* @param null $maxOffset
*
- * @return array the date array
- * @static
+ * @return array
+ * the date array
*/
- static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL) {
-
+ public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL) {
$date = array(
'addEmptyOption' => TRUE,
'emptyOptionText' => ts('- select -'),
}
/**
- * values for UF form visibility options
+ * Values for UF form visibility options
*
- * @static
+ * @return array
*/
- static function ufVisibility() {
+ public static function ufVisibility() {
return array(
'User and User Admin Only' => ts('User and User Admin Only'),
'Public Pages' => ts('Public Pages'),
}
/**
- * values for group form visibility options
+ * Values for group form visibility options
*
- * @static
+ * @return array
*/
- static function groupVisibility() {
+ public static function groupVisibility() {
return array(
'User and User Admin Only' => ts('User and User Admin Only'),
'Public Pages' => ts('Public Pages'),
}
/**
- * different type of Mailing Components
+ * Different type of Mailing Components
*
- * @static
- * return array
+ * @return array
*/
- static function mailingComponents() {
- return array('Header' => ts('Header'),
+ public static function mailingComponents() {
+ return array(
+ 'Header' => ts('Header'),
'Footer' => ts('Footer'),
'Reply' => ts('Reply Auto-responder'),
'OptOut' => ts('Opt-out Message'),
}
/**
- * get hours
+ * Get hours
*
- *
- * @static
+ * @return array
*/
- function getHours() {
+ public function getHours() {
$hours = array();
for ($i = 0; $i <= 6; $i++) {
$hours[$i] = $i;
}
/**
- * get minutes
- *
+ * Get minutes
*
- * @static
+ * @return array
*/
- function getMinutes() {
+ public function getMinutes() {
$minutes = array();
for ($i = 0; $i < 60; $i = $i + 15) {
$minutes[$i] = $i;
}
/**
- * get the Map Provider
+ * Get the Map Provider
*
- * @return array $map array of map providers
- * @static
+ * @return array
+ * array of map providers
*/
- static function mapProvider() {
+ public static function mapProvider() {
static $map = NULL;
if (!$map) {
$map = CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
}
/**
- * Function to get the Geocoding Providers from available plugins
+ * Get the Geocoding Providers from available plugins
*
- * @return array $geo array of geocoder providers
- * @static
+ * @return array
+ * array of geocoder providers
*/
- static function geoProvider() {
+ public static function geoProvider() {
static $geo = NULL;
if (!$geo) {
$geo = CRM_Utils_System::getPluginList('CRM/Utils/Geocode');
}
/**
- * Function to get the Address Standardization Providers from available
- * plugins
+ * Get the Address Standardization Providers from available plugins
*
- * @return array $addr array of address standardization providers
- * @static
+ * @return array
+ * array of address standardization providers
*/
- static function addressProvider() {
+ public static function addressProvider() {
static $addr = NULL;
if (!$addr) {
$addr = CRM_Utils_System::getPluginList('CRM/Utils/Address', '.php', array('BatchUpdate'));
}
/**
- * different type of Mailing Tokens
+ * Different type of Mailing Tokens
*
- * @static
- * return array
+ * @return array
*/
- static function mailingTokens() {
+ public static function mailingTokens() {
return array(
'{action.unsubscribe}' => ts('Unsubscribe via email'),
'{action.unsubscribeUrl}' => ts('Unsubscribe via web page'),
}
/**
- * different type of Activity Tokens
+ * Different type of Activity Tokens
*
- * @static
- * return array
+ * @return array
*/
- static function activityTokens() {
+ public static function activityTokens() {
return array(
'{activity.activity_id}' => ts('Activity ID'),
'{activity.subject}' => ts('Activity Subject'),
}
/**
- * different type of Membership Tokens
+ * Different type of Membership Tokens
*
- * @static
- * return array
+ * @return array
*/
- static function membershipTokens() {
+ public static function membershipTokens() {
return array(
'{membership.id}' => ts('Membership ID'),
'{membership.status}' => ts('Membership Status'),
}
/**
- * different type of Event Tokens
+ * Different type of Event Tokens
*
- * @static
- * return array
+ * @return array
*/
- static function eventTokens() {
+ public static function eventTokens() {
return array(
'{event.event_id}' => ts('Event ID'),
'{event.title}' => ts('Event Title'),
'{event.fee_amount}' => ts('Event Fees'),
'{event.info_url}' => ts('Event Info URL'),
'{event.registration_url}' => ts('Event Registration URL'),
- '{event.balance}' => ts('Event Balance')
+ '{event.balance}' => ts('Event Balance'),
);
}
/**
- * different type of Event Tokens
+ * Different type of Event Tokens
*
- * @static
- * return array
+ * @return array
*/
- static function contributionTokens() {
+ public static function contributionTokens() {
return array(
'{contribution.contribution_id}' => ts('Contribution ID'),
'{contribution.total_amount}' => ts('Total Amount'),
}
/**
- * different type of Contact Tokens
+ * Different type of Contact Tokens
*
- * @static
- * return array
+ * @return array
*/
- static function contactTokens() {
+ public static function contactTokens() {
static $tokens = NULL;
if (!$tokens) {
- $additionalFields = array('checksum' => array('title' => ts('Checksum')),
+ $additionalFields = array(
+ 'checksum' => array('title' => ts('Checksum')),
'contact_id' => array('title' => ts('Internal Contact ID')),
);
$exportFields = array_merge(CRM_Contact_BAO_Contact::exportableFields(), $additionalFields);
//FIXME:skipping some tokens for time being.
$skipTokens = array(
- 'is_bulkmail', 'group', 'tag', 'contact_sub_type', 'note',
- 'is_deceased', 'deceased_date', 'legal_identifier', 'contact_sub_type', 'user_unique_id',
+ 'is_bulkmail',
+ 'group',
+ 'tag',
+ 'contact_sub_type',
+ 'note',
+ 'is_deceased',
+ 'deceased_date',
+ 'legal_identifier',
+ 'contact_sub_type',
+ 'user_unique_id',
);
$customFields = CRM_Core_BAO_CustomField::getFields(array('Individual', 'Address'));
}
/**
- * different type of Participant Tokens
+ * Different type of Participant Tokens
*
- * @static
- * return array
+ * @return array
*/
- static function participantTokens() {
+ public static function participantTokens() {
static $tokens = NULL;
if (!$tokens) {
$exportFields = CRM_Event_BAO_Participant::exportableFields();
// skipping some tokens for time being.
$skipTokens = array(
- 'event_id', 'participant_is_pay_later', 'participant_is_test', 'participant_contact_id',
- 'participant_fee_currency', 'participant_campaign_id', 'participant_status', 'participant_discount_name',
+ 'event_id',
+ 'participant_is_pay_later',
+ 'participant_is_test',
+ 'participant_contact_id',
+ 'participant_fee_currency',
+ 'participant_campaign_id',
+ 'participant_status',
+ 'participant_discount_name',
);
$customFields = CRM_Core_BAO_CustomField::getFields('Participant');
}
/**
- * CiviCRM supported date input formats
+ * CiviCRM supported date input formats
+ *
+ * @return array
*/
- static function getDatePluginInputFormats() {
+ public static function getDatePluginInputFormats() {
$dateInputFormats = array(
"mm/dd/yy" => ts('mm/dd/yyyy (12/31/2009)'),
"dd/mm/yy" => ts('dd/mm/yyyy (31/12/2009)'),
);
/*
- Year greater than 2000 get wrong result for following format
- echo date( 'Y-m-d', strtotime( '7 Nov, 2001') );
- echo date( 'Y-m-d', strtotime( '7 November, 2001') );
- Return current year
- expected :: 2001-11-07
- output :: 2009-11-07
- However
- echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') );
- echo date( 'Y-m-d', strtotime( 'November 7, 2001') );
- gives proper result
- */
-
+ Year greater than 2000 get wrong result for following format
+ echo date( 'Y-m-d', strtotime( '7 Nov, 2001') );
+ echo date( 'Y-m-d', strtotime( '7 November, 2001') );
+ Return current year
+ expected :: 2001-11-07
+ output :: 2009-11-07
+ However
+ echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') );
+ echo date( 'Y-m-d', strtotime( 'November 7, 2001') );
+ gives proper result
+ */
return $dateInputFormats;
}
/**
* Map date plugin and actual format that is used by PHP
+ *
+ * @return array
*/
- static function datePluginToPHPFormats() {
+ public static function datePluginToPHPFormats() {
$dateInputFormats = array(
"mm/dd/yy" => 'm/d/Y',
"dd/mm/yy" => 'd/m/Y',
/**
* Time formats
+ *
+ * @return array
*/
- static function getTimeFormats() {
+ public static function getTimeFormats() {
return array(
'1' => ts('12 Hours'),
'2' => ts('24 Hours'),
}
/**
- * Function to get numeric options
+ * Get numeric options
*
+ * @param int $start
+ * @param int $end
*
- * @static
+ * @return array
*/
public static function getNumericOptions($start = 0, $end = 10) {
$numericOptions = array();
for ($i = $start; $i <= $end; $i++) {
- $numericOptions[$i] = $i;
+ $numericOptions[$i] = $i;
}
return $numericOptions;
}
/**
- * barcode types
- * @static
+ * Barcode types
+ *
+ * @return array
*/
- static function getBarcodeTypes() {
+ public static function getBarcodeTypes() {
return array(
'barcode' => ts('Linear (1D)'),
'qrcode' => ts('QR code'),
}
/**
- * dedupe rule types
+ * Dedupe rule types
+ *
+ * @return array
*/
- static function getDedupeRuleTypes() {
+ public static function getDedupeRuleTypes() {
return array(
'Unsupervised' => ts('Unsupervised'),
'Supervised' => ts('Supervised'),
}
/**
- * campaign group types
+ * Campaign group types
+ *
+ * @return array
*/
- static function getCampaignGroupTypes() {
+ public static function getCampaignGroupTypes() {
return array(
'Include' => ts('Include'),
'Exclude' => ts('Exclude'),
}
/**
- * subscription history method
+ * Subscription history method
+ *
+ * @return array
*/
- static function getSubscriptionHistoryMethods() {
+ public static function getSubscriptionHistoryMethods() {
return array(
'Admin' => ts('Admin'),
'Email' => ts('Email'),
}
/**
- * premium units
+ * Premium units
+ *
+ * @return array
*/
- static function getPremiumUnits() {
+ public static function getPremiumUnits() {
return array(
'day' => ts('Day'),
'week' => ts('Week'),
}
/**
- * extension types
+ * Extension types
+ *
+ * @return array
*/
- static function getExtensionTypes() {
- return array(
+ public static function getExtensionTypes() {
+ return array(
'payment' => ts('Payment'),
'search' => ts('Search'),
'report' => ts('Report'),
}
/**
- * job frequency
+ * Job frequency
+ *
+ * @return array
*/
- static function getJobFrequency() {
+ public static function getJobFrequency() {
return array(
'Daily' => ts('Daily'),
'Hourly' => ts('Hourly'),
/**
* Search builder operators
+ *
+ * @return array
*/
- static function getSearchBuilderOperators() {
+ public static function getSearchBuilderOperators() {
return array(
'=' => '=',
'!=' => '≠',
'>=' => '≥',
'<=' => '≤',
'IN' => ts('In'),
+ 'NOT IN' => ts('Not In'),
'LIKE' => ts('Like'),
+ 'NOT LIKE' => ts('Not Like'),
'RLIKE' => ts('Regex'),
'IS EMPTY' => ts('Is Empty'),
'IS NOT EMPTY' => ts('Not Empty'),
}
/**
- * profile group types
+ * Profile group types
*
- * @static
+ * @return array
*/
- static function getProfileGroupType() {
+ public static function getProfileGroupType() {
$profileGroupType = array(
'Activity' => ts('Activities'),
'Contribution' => ts('Contributions'),
);
$contactTypes = self::contactType();
$contactTypes = !empty($contactTypes) ? array('Contact' => 'Contacts') + $contactTypes : array();
- $profileGroupType = array_merge($contactTypes, $profileGroupType );
+ $profileGroupType = array_merge($contactTypes, $profileGroupType);
return $profileGroupType;
}
/**
- * word replacement match type
+ * Word replacement match type
+ *
+ * @return array
*/
- static function getWordReplacementMatchType() {
+ public static function getWordReplacementMatchType() {
return array(
- 'exactMatch' => ts('Exact Match'),
- 'wildcardMatch' => ts('Wildcard Match'),
- );
+ 'exactMatch' => ts('Exact Match'),
+ 'wildcardMatch' => ts('Wildcard Match'),
+ );
}
/**
- * mailing group types
+ * Mailing group types
+ *
+ * @return array
*/
- static function getMailingGroupTypes() {
+ public static function getMailingGroupTypes() {
return array(
'Include' => ts('Include'),
'Exclude' => ts('Exclude'),
/**
* Mailing Job Status
+ *
+ * @return array
*/
- static function getMailingJobStatus() {
+ public static function getMailingJobStatus() {
return array(
'Scheduled' => ts('Scheduled'),
'Running' => ts('Running'),
);
}
- static function billingMode() {
+ /**
+ * @return array
+ */
+ public static function billingMode() {
return array(
CRM_Core_Payment::BILLING_MODE_FORM => 'form',
CRM_Core_Payment::BILLING_MODE_BUTTON => 'button',
/**
* Frequency unit for schedule reminders
+ *
+ * @return array
*/
- static function getScheduleReminderFrequencyUnits() {
+ public static function getScheduleReminderFrequencyUnits() {
//@todo update schema to refer to option group direct & remove this
static $scheduleReminderFrequencyUnits = NULL;
if (!$scheduleReminderFrequencyUnits) {
$scheduleReminderFrequencyUnits = array(
- 'hour' => ts('hour')) + CRM_Core_OptionGroup::values('recur_frequency_units');
+ 'hour' => ts('hour'),
+ ) + CRM_Core_OptionGroup::values('recur_frequency_units');
}
return $scheduleReminderFrequencyUnits;
}
+
}