api/v3/RelationshipType - Fix default for "is_active"
[civicrm-core.git] / api / v3 / Event.php
index 78fd0527340fdd87653f7ed5cc16be8afe1df7a6..93eb30c93e6f6bce74697ae57f73aab6eaf916c9 100644 (file)
@@ -2,9 +2,9 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -33,7 +33,7 @@
  * @package CiviCRM_APIv3
  * @subpackage API_Event
  *
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * @version $Id: Event.php 30964 2010-11-29 09:41:54Z shot $
  *
  */
@@ -220,6 +220,10 @@ function civicrm_api3_event_delete($params) {
  * @param int $event_id Id of the event to be updated
  *
  */
+/**
+ * @param $event
+ * @param $event_id
+ */
 function _civicrm_api3_event_getisfull(&$event, $event_id) {
   $eventFullResult = CRM_Event_BAO_Participant::eventFull($event_id, 1);
   if (!empty($eventFullResult) && is_int($eventFullResult)) {
@@ -233,12 +237,13 @@ function _civicrm_api3_event_getisfull(&$event, $event_id) {
 
 
 /**
- * Overrides _civicrm_api3_generic_getlist_params.
+ * @see _civicrm_api3_generic_getlist_params.
  *
  * @param $request array
  */
 function _civicrm_api3_event_getlist_params(&$request) {
-  $request['params']['return'] = array('start_date', 'event_type_id', 'title', 'summary');
+  $fieldsToReturn = array('start_date', 'event_type_id', 'title', 'summary');
+  $request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra']));
   $request['params']['options']['sort'] = 'start_date DESC';
   $request['params'] += array(
     'is_template' => 0,
@@ -247,7 +252,7 @@ function _civicrm_api3_event_getlist_params(&$request) {
 }
 
 /**
- * Overrides _civicrm_api3_generic_getlist_output
+ * @see _civicrm_api3_generic_getlist_output
  *
  * @param $result array
  * @param $request array
@@ -269,6 +274,9 @@ function _civicrm_api3_event_getlist_output($result, $request) {
       if (!empty($row['summary'])) {
         $data['description'][] = $row['summary'];
       }
+      foreach ($request['extra'] as $field) {
+        $data['extra'][$field] = isset($row[$field]) ? $row[$field] : NULL;
+      }
       $output[] = $data;
     }
   }