Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-01-26-14-28-00
[civicrm-core.git] / CRM / Event / Page / EventInfo.php
index 3bdf94b7f9e76c8ed4a15dffc5238608b9e3bae4..548d3855c5f54a85171ec94f31027bba3c350605 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        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -46,7 +46,6 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
    * Finally it calls the parent's run method.
    *
    * @return void
-   *
    */
   public function run() {
     //get the event id.
@@ -54,8 +53,9 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
     $config = CRM_Core_Config::singleton();
     // ensure that the user has permission to see this page
     if (!CRM_Core_Permission::event(CRM_Core_Permission::VIEW,
-        $this->_id, 'view event info'
-      )) {
+      $this->_id, 'view event info'
+    )
+    ) {
       CRM_Utils_System::setUFMessage(ts('You do not have permission to view this event'));
       return CRM_Utils_System::permissionDenied();
     }
@@ -102,7 +102,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
       );
 
       //CRM-10434
-      $discountId= CRM_Core_BAO_Discount::findSet($this->_id, 'civicrm_event');
+      $discountId = CRM_Core_BAO_Discount::findSet($this->_id, 'civicrm_event');
       if ($discountId) {
         $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Discount', $discountId, 'price_set_id');
       }
@@ -120,7 +120,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
           $visibility = CRM_Core_PseudoConstant::visibility('name');
 
           // CRM-14492 Admin price fields should show up on event registration if user has 'administer CiviCRM' permissions
-          $adminFieldVisible = false;
+          $adminFieldVisible = FALSE;
           if (CRM_Core_Permission::check('administer CiviCRM')) {
             $adminFieldVisible = TRUE;
           }
@@ -128,7 +128,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
           foreach ($priceSetFields as $fid => $fieldValues) {
             if (!is_array($fieldValues['options']) ||
               empty($fieldValues['options']) ||
-              (CRM_Utils_Array::value('visibility_id', $fieldValues) != array_search('public', $visibility) && $adminFieldVisible == false)
+              (CRM_Utils_Array::value('visibility_id', $fieldValues) != array_search('public', $visibility) && $adminFieldVisible == FALSE)
             ) {
               continue;
             }
@@ -168,7 +168,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
         $this->assign('isPriceSet', 1);
         $this->assign('isQuickConfig', $setDetails[$priceSetId]['is_quick_config']);
       }
-        }
+    }
 
     $params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event');
     $values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
@@ -195,7 +195,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
       $this->assign('mapKey', $config->mapAPIKey);
       $sumLat = $sumLng = 0;
       $maxLat = $maxLng = -400;
-      $minLat = $minLng = 400;
+      $minLat = $minLng = 400;
       foreach ($locations as $location) {
         $sumLat += $location['lat'];
         $sumLng += $location['lng'];
@@ -215,11 +215,13 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
         }
       }
 
-      $center = array('lat' => (float ) $sumLat / count($locations),
+      $center = array(
+        'lat' => (float ) $sumLat / count($locations),
         'lng' => (float ) $sumLng / count($locations),
       );
-      $span = array('lat' => (float )($maxLat - $minLat),
-        'lng' => (float )($maxLng - $minLng),
+      $span = array(
+        'lat' => (float ) ($maxLat - $minLat),
+        'lng' => (float ) ($maxLng - $minLng),
       );
       $this->assign_by_ref('center', $center);
       $this->assign_by_ref('span', $span);
@@ -311,7 +313,8 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
     $this->assign('allowRegistration', $allowRegistration);
 
     $session = CRM_Core_Session::singleton();
-    $params = array('contact_id' => $session->get('userID'),
+    $params = array(
+      'contact_id' => $session->get('userID'),
       'event_id' => CRM_Utils_Array::value('id', $values['event']),
       'role_id' => CRM_Utils_Array::value('default_role_id', $values['event']),
     );
@@ -374,4 +377,5 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
     }
     return parent::getTemplateFileName();
   }
+
 }