Merge pull request #5289 from mallezie/crm-16040
[civicrm-core.git] / CRM / Event / PseudoConstant.php
index dc1472b76228dc8798c0b64662500957b40858c7..4e4658195a3d07f8eecef8d0bb18ec7e3d8015c0 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -43,7 +43,6 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
    * Event
    *
    * @var array
-   * @static
    */
   private static $event;
 
@@ -51,7 +50,6 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
    * Participant Status
    *
    * @var array
-   * @static
    */
   private static $participantStatus;
 
@@ -59,7 +57,6 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
    * Participant Role
    *
    * @var array
-   * @static
    */
   private static $participantRole;
 
@@ -67,7 +64,6 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
    * Participant Listing
    *
    * @var array
-   * @static
    */
   private static $participantListing;
 
@@ -75,12 +71,11 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
    * Event Type.
    *
    * @var array
-   * @static
    */
   private static $eventType;
 
   /**
-   * event template titles
+   * Event template titles
    * @var array
    */
   private static $eventTemplates;
@@ -88,21 +83,19 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   /**
    * Personal campaign pages
    * @var array
-   * @static
    */
   private static $pcPage;
 
   /**
    * Get all the n events
    *
-   * @access public
    *
-   * @param null $id
+   * @param int $id
    * @param bool $all
    * @param null $condition
    *
-   * @return array - array of all events if any
-   * @static
+   * @return array
+   *   array of all events if any
    */
   public static function event($id = NULL, $all = FALSE, $condition = NULL) {
     $key = "{$id}_{$all}_{$condition}";
@@ -130,16 +123,16 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   }
 
   /**
-   * Get all the n participant statuses
+   * Get all the n participant statuses.
    *
-   * @access public
    *
-   * @param null $id
+   * @param int $id
    * @param null $cond
-   * @param string $retColumn tells populate() whether to return 'name' (default) or 'label' values
+   * @param string $retColumn
+   *   Tells populate() whether to return 'name' (default) or 'label' values.
    *
-   * @return array  - array reference of all participant statuses if any
-   * @static
+   * @return array
+   *   array reference of all participant statuses if any
    */
   public static function &participantStatus($id = NULL, $cond = NULL, $retColumn = 'name') {
     if (self::$participantStatus === NULL) {
@@ -163,12 +156,27 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
     return self::$participantStatus[$index];
   }
 
+  /**
+   * Get participant status class options.
+   *
+   * @return array
+   */
+  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
    *
-   * @return array  of status classes, keyed by status type
+   * @return array
+   *   Array of status classes, keyed by status type
    */
-  static function &participantStatusClass() {
+  public static function &participantStatusClass() {
     static $statusClasses = NULL;
 
     if ($statusClasses === NULL) {
@@ -179,15 +187,14 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   }
 
   /**
-   * Get all the n participant roles
+   * Get all the n participant roles.
    *
-   * @access public
    *
-   * @param null $id
+   * @param int $id
    * @param null $cond
    *
-   * @return array - array reference of all participant roles if any
-   * @static
+   * @return array
+   *   array reference of all participant roles if any
    */
   public static function &participantRole($id = NULL, $cond = NULL) {
     $index = $cond ? $cond : 'No Condition';
@@ -212,14 +219,13 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   }
 
   /**
-   * Get all the participant listings
+   * Get all the participant listings.
    *
-   * @access public
    *
-   * @param null $id
+   * @param int $id
    *
-   * @return array - array reference of all participant listings if any
-   * @static
+   * @return array
+   *   array reference of all participant listings if any
    */
   public static function &participantListing($id = NULL) {
     if (!self::$participantListing) {
@@ -237,11 +243,10 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   /**
    * Get all  event types.
    *
-   * @access public
    *
-   * @param null $id
-   * @return array - array reference of all event types.
-   * @static
+   * @param int $id
+   * @return array
+   *   array reference of all event types.
    */
   public static function &eventType($id = NULL) {
     if (!self::$eventType) {
@@ -257,11 +262,12 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   }
 
   /**
-   * get event template titles
+   * Get event template titles.
    *
-   * @param null $id
+   * @param int $id
    *
-   * @return array  of event id → template title pairs
+   * @return array
+   *   Array of event id → template title pairs
    */
   public static function &eventTemplates($id = NULL) {
     if (!self::$eventTemplates) {
@@ -283,25 +289,22 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
    * Flush given pseudoconstant so it can be reread from db
    * nex time it's requested.
    *
-   * @access public
-   * @static
    *
    * @param bool|string $name pseudoconstant to be flushed
    */
   public static function flush($name = 'cache') {
-   if (isset(self::$$name)) {
+    if (isset(self::$$name)) {
       self::$$name = NULL;
     }
   }
 
   /**
-   * Get all the Personal campaign pages
+   * Get all the Personal campaign pages.
    *
-   * @access public
    *
-   * @param null $id
-   * @return array - array reference of all pcp if any
-   * @static
+   * @param int $id
+   * @return array
+   *   array reference of all pcp if any
    */
   public static function &pcPage($id = NULL) {
     if (!self::$pcPage) {
@@ -315,5 +318,5 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
     }
     return self::$pcPage;
   }
-}
 
+}