Comment fixes
[civicrm-core.git] / CRM / Core / SelectValues.php
index 4917fa2be6e3e30564357e6a975c7f1ba5be931e..40d983c454bd161c3379d38c70c58ceb159fe7b0 100644 (file)
@@ -23,7 +23,7 @@
  | 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
@@ -39,9 +39,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Preferred mail format
-   * @static
+   *
+   * @return array
    */
-  static function pmf() {
+  public static function pmf() {
     return array(
       'Both' => ts('Both'),
       'HTML' => ts('HTML'),
@@ -51,9 +52,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Privacy options
-   * @static
+   *
+   * @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'),
@@ -66,9 +68,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Various pre defined contact super types
-   * @static
+   *
+   * @return array
    */
-  static function contactType() {
+  public static function contactType() {
     static $contactType = NULL;
     if (!$contactType) {
       $contactType = CRM_Contact_BAO_ContactType::basicTypePairs();
@@ -78,9 +81,11 @@ class CRM_Core_SelectValues {
 
   /**
    * Various pre defined unit list
-   * @static
+   *
+   * @param string $unitType
+   * @return array
    */
-  static function unitList($unitType = NULL) {
+  public static function unitList($unitType = NULL) {
     $unitList = array(
       'day' => ts('day'),
       'month' => ts('month'),
@@ -94,17 +99,19 @@ class CRM_Core_SelectValues {
 
   /**
    * Membership type unit
-   * @static
+   *
+   * @return array
    */
-  static function membershipTypeUnitList( ) {
+  public static function membershipTypeUnitList() {
     return self::unitList('duration');
   }
 
   /**
    * Various pre defined period types
-   * @static
+   *
+   * @return array
    */
-  static function periodType() {
+  public static function periodType() {
     return array(
       'rolling' => ts('Rolling'),
       'fixed' => ts('Fixed'),
@@ -113,33 +120,49 @@ class CRM_Core_SelectValues {
 
   /**
    * Various pre defined email selection methods
-   * @static
+   *
+   * @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
+   *
+   * @return array
    */
-  static function memberVisibility() {
+  public static function memberVisibility() {
     return array(
       'Public' => ts('Public'),
       'Admin' => ts('Admin'),
     );
   }
 
+  /**
+   * Member auto-renew options
+   *
+   * @return array
+   */
+  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
-   * @static
+   *
+   * @return array
    */
-  static function eventDate() {
+  public static function eventDate() {
     return array(
       'start_date' => ts('start date'),
       'end_date' => ts('end date'),
@@ -149,9 +172,10 @@ class CRM_Core_SelectValues {
 
   /**
    * 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)'),
@@ -176,9 +200,10 @@ class CRM_Core_SelectValues {
   /**
    * Various pre defined extensions for dynamic properties and groups
    *
-   * @static
+   * @return array
+   *
    */
-  static function customGroupExtends() {
+  public static function customGroupExtends() {
     $customGroupExtends = array(
       'Activity' => ts('Activities'),
       'Relationship' => ts('Relationships'),
@@ -205,9 +230,10 @@ class CRM_Core_SelectValues {
   /**
    * Styles for displaying the custom data group
    *
-   * @static
+   * @return array
+   *
    */
-  static function customGroupStyle() {
+  public static function customGroupStyle() {
     return array(
       'Tab' => ts('Tab'),
       'Inline' => ts('Inline'),
@@ -218,9 +244,9 @@ class CRM_Core_SelectValues {
   /**
    * 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'),
@@ -238,9 +264,10 @@ class CRM_Core_SelectValues {
   /**
    * The status of a contact within a group
    *
-   * @static
+   * @return array
+   *
    */
-  static function groupContactStatus() {
+  public static function groupContactStatus() {
     return array(
       'Added' => ts('Added'),
       'Removed' => ts('Removed'),
@@ -250,9 +277,10 @@ class CRM_Core_SelectValues {
 
   /**
    * List of Group Types
-   * @static
+   *
+   * @return array
    */
-  static function groupType() {
+  public static function groupType() {
     return array(
       'query' => ts('Dynamic'),
       'static' => ts('Static'),
@@ -262,17 +290,17 @@ class CRM_Core_SelectValues {
   /**
    * 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 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 -'),
@@ -314,9 +342,9 @@ class CRM_Core_SelectValues {
   /**
    * 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'),
@@ -327,9 +355,9 @@ class CRM_Core_SelectValues {
   /**
    * 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'),
@@ -339,11 +367,11 @@ class CRM_Core_SelectValues {
   /**
    * 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'),
@@ -357,10 +385,9 @@ class CRM_Core_SelectValues {
   /**
    * Get hours
    *
-   *
-   * @static
+   * @return array
    */
-  function getHours() {
+  public function getHours() {
     $hours = array();
     for ($i = 0; $i <= 6; $i++) {
       $hours[$i] = $i;
@@ -371,10 +398,9 @@ class CRM_Core_SelectValues {
   /**
    * Get minutes
    *
-   *
-   * @static
+   * @return array
    */
-  function getMinutes() {
+  public function getMinutes() {
     $minutes = array();
     for ($i = 0; $i < 60; $i = $i + 15) {
       $minutes[$i] = $i;
@@ -385,10 +411,10 @@ class CRM_Core_SelectValues {
   /**
    * 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");
@@ -399,10 +425,10 @@ class CRM_Core_SelectValues {
   /**
    * 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');
@@ -411,13 +437,12 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * 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'));
@@ -428,10 +453,9 @@ class CRM_Core_SelectValues {
   /**
    * 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'),
@@ -455,10 +479,9 @@ class CRM_Core_SelectValues {
   /**
    * 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'),
@@ -470,10 +493,9 @@ class CRM_Core_SelectValues {
   /**
    * 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'),
@@ -488,10 +510,9 @@ class CRM_Core_SelectValues {
   /**
    * 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'),
@@ -506,17 +527,16 @@ class CRM_Core_SelectValues {
       '{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
    *
-   * @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'),
@@ -547,13 +567,13 @@ class CRM_Core_SelectValues {
   /**
    * 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);
@@ -563,8 +583,16 @@ class CRM_Core_SelectValues {
 
       //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'));
@@ -614,10 +642,9 @@ class CRM_Core_SelectValues {
   /**
    * 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();
@@ -627,8 +654,14 @@ class CRM_Core_SelectValues {
 
       // 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');
@@ -650,9 +683,11 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   *  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)'),
@@ -672,26 +707,27 @@ class CRM_Core_SelectValues {
     );
 
     /*
-         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',
@@ -714,8 +750,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Time formats
+   *
+   * @return array
    */
-  static function getTimeFormats() {
+  public static function getTimeFormats() {
     return array(
       '1' => ts('12 Hours'),
       '2' => ts('24 Hours'),
@@ -725,22 +763,25 @@ class CRM_Core_SelectValues {
   /**
    * 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
+   *
+   * @return array
    */
-  static function getBarcodeTypes() {
+  public static function getBarcodeTypes() {
     return array(
       'barcode' => ts('Linear (1D)'),
       'qrcode' => ts('QR code'),
@@ -749,8 +790,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Dedupe rule types
+   *
+   * @return array
    */
-  static function getDedupeRuleTypes() {
+  public static function getDedupeRuleTypes() {
     return array(
       'Unsupervised' => ts('Unsupervised'),
       'Supervised' => ts('Supervised'),
@@ -760,8 +803,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Campaign group types
+   *
+   * @return array
    */
-  static function getCampaignGroupTypes() {
+  public static function getCampaignGroupTypes() {
     return array(
       'Include' => ts('Include'),
       'Exclude' => ts('Exclude'),
@@ -770,8 +815,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Subscription history method
+   *
+   * @return array
    */
-  static function getSubscriptionHistoryMethods() {
+  public static function getSubscriptionHistoryMethods() {
     return array(
       'Admin' => ts('Admin'),
       'Email' => ts('Email'),
@@ -782,8 +829,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Premium units
+   *
+   * @return array
    */
-  static function getPremiumUnits() {
+  public static function getPremiumUnits() {
     return array(
       'day' => ts('Day'),
       'week' => ts('Week'),
@@ -794,9 +843,11 @@ class CRM_Core_SelectValues {
 
   /**
    * Extension types
+   *
+   * @return array
    */
-  static function getExtensionTypes() {
-    return  array(
+  public static function getExtensionTypes() {
+    return array(
       'payment' => ts('Payment'),
       'search' => ts('Search'),
       'report' => ts('Report'),
@@ -807,8 +858,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Job frequency
+   *
+   * @return array
    */
-  static function getJobFrequency() {
+  public static function getJobFrequency() {
     return array(
       'Daily' => ts('Daily'),
       'Hourly' => ts('Hourly'),
@@ -818,8 +871,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Search builder operators
+   *
+   * @return array
    */
-  static function getSearchBuilderOperators() {
+  public static function getSearchBuilderOperators() {
     return array(
       '=' => '=',
       '!=' => '≠',
@@ -828,7 +883,9 @@ class CRM_Core_SelectValues {
       '>=' => '≥',
       '<=' => '≤',
       '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'),
@@ -840,9 +897,9 @@ class CRM_Core_SelectValues {
   /**
    * Profile group types
    *
-   * @static
+   * @return array
    */
-  static function getProfileGroupType() {
+  public static function getProfileGroupType() {
     $profileGroupType = array(
       'Activity' => ts('Activities'),
       'Contribution' => ts('Contributions'),
@@ -851,7 +908,7 @@ class CRM_Core_SelectValues {
     );
     $contactTypes = self::contactType();
     $contactTypes = !empty($contactTypes) ? array('Contact' => 'Contacts') + $contactTypes : array();
-    $profileGroupType = array_merge($contactTypes, $profileGroupType );
+    $profileGroupType = array_merge($contactTypes, $profileGroupType);
 
     return $profileGroupType;
   }
@@ -859,18 +916,22 @@ class CRM_Core_SelectValues {
 
   /**
    * 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
+   *
+   * @return array
    */
-  static function getMailingGroupTypes() {
+  public static function getMailingGroupTypes() {
     return array(
       'Include' => ts('Include'),
       'Exclude' => ts('Exclude'),
@@ -880,8 +941,10 @@ class CRM_Core_SelectValues {
 
   /**
    * Mailing Job Status
+   *
+   * @return array
    */
-  static function getMailingJobStatus() {
+  public static function getMailingJobStatus() {
     return array(
       'Scheduled' => ts('Scheduled'),
       'Running' => ts('Running'),
@@ -891,7 +954,10 @@ class CRM_Core_SelectValues {
     );
   }
 
-  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',
@@ -901,15 +967,19 @@ class CRM_Core_SelectValues {
 
   /**
    * 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;
   }
+
 }