Merge pull request #14326 from civicrm/5.14
[civicrm-core.git] / CRM / Event / Form / ManageEvent.php
index 5e58066d398c2fb046a356b25431b4cf3a95d339..9e065f4cc16612d808b96c1912248e58feae6fd9 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -27,7 +27,7 @@
 
 /**
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  */
 
 /**
@@ -45,14 +45,14 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
   /**
    * Is this the first page?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_first = FALSE;
 
   /**
    * Are we in single form mode or wizard mode?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single;
 
@@ -60,13 +60,14 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
 
   /**
    * Are we actually managing an event template?
-   * @var boolean
+   * @var bool
    */
   protected $_isTemplate = FALSE;
 
   /**
-   * Pre-populate fields based on this template event_id
-   * @var integer
+   * Pre-populate fields based on this template event_id.
+   *
+   * @var int
    */
   protected $_templateId;
 
@@ -75,11 +76,13 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
   /**
    * The campaign id of the existing event, we use this to know if we need to update
    * the participant records
+   * @var int
    */
   protected $_campaignID = NULL;
 
   /**
    * Check if repeating event.
+   * @var bool
    */
   public $_isRepeatingEvent;
 
@@ -120,7 +123,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
       }
       $this->_single = TRUE;
 
-      $params = array('id' => $this->_id);
+      $params = ['id' => $this->_id];
       CRM_Event_BAO_Event::retrieve($params, $eventInfo);
 
       // its an update mode, do a permission check
@@ -203,12 +206,12 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
     $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
     $ufCreate = CRM_ACL_API::group(CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups);
     $ufEdit = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups);
-    $checkPermission = array(
-      array(
+    $checkPermission = [
+      [
         'administer CiviCRM',
         'manage event profiles',
-      ),
-    );
+      ],
+    ];
     if (CRM_Core_Permission::check($checkPermission) || !empty($ufCreate) || !empty($ufEdit)) {
       $this->assign('perm', TRUE);
     }
@@ -218,7 +221,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
 
     // Set Done button URL and breadcrumb. Templates go back to Manage Templates,
     // otherwise go to Manage Event for new event or ManageEventEdit if event if exists.
-    $breadCrumb = array();
+    $breadCrumb = [];
     if (!$this->_isTemplate) {
       if ($this->_id) {
         $this->_doneUrl = CRM_Utils_System::url(CRM_Utils_System::currentPath(),
@@ -229,22 +232,22 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
         $this->_doneUrl = CRM_Utils_System::url('civicrm/event/manage',
           'reset=1'
         );
-        $breadCrumb = array(
-          array(
+        $breadCrumb = [
+          [
             'title' => ts('Manage Events'),
             'url' => $this->_doneUrl,
-          ),
-        );
+          ],
+        ];
       }
     }
     else {
       $this->_doneUrl = CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1');
-      $breadCrumb = array(
-        array(
+      $breadCrumb = [
+        [
           'title' => ts('Manage Event Templates'),
           'url' => $this->_doneUrl,
-        ),
-      );
+        ],
+      ];
     }
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
   }
@@ -255,15 +258,15 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
    * For edit/view mode the default values are retrieved from the database.
    */
   public function setDefaultValues() {
-    $defaults = array();
+    $defaults = [];
     if (isset($this->_id)) {
-      $params = array('id' => $this->_id);
+      $params = ['id' => $this->_id];
       CRM_Event_BAO_Event::retrieve($params, $defaults);
 
       $this->_campaignID = CRM_Utils_Array::value('campaign_id', $defaults);
     }
     elseif ($this->_templateId) {
-      $params = array('id' => $this->_templateId);
+      $params = ['id' => $this->_templateId];
       CRM_Event_BAO_Event::retrieve($params, $defaults);
       $defaults['is_template'] = $this->_isTemplate;
       $defaults['template_id'] = $defaults['id'];
@@ -303,44 +306,44 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
     }
 
     if ($this->_single) {
-      $buttons = array(
-        array(
+      $buttons = [
+        [
           'type' => 'upload',
           'name' => ts('Save'),
           'isDefault' => TRUE,
-        ),
-        array(
+        ],
+        [
           'type' => 'upload',
           'name' => ts('Save and Done'),
           'spacing' => '                 ',
           'subName' => 'done',
-        ),
-        array(
+        ],
+        [
           'type' => 'cancel',
           'name' => ts('Cancel'),
-        ),
-      );
+        ],
+      ];
       $this->addButtons($buttons);
     }
     else {
-      $buttons = array();
+      $buttons = [];
       if (!$this->_first) {
-        $buttons[] = array(
+        $buttons[] = [
           'type' => 'back',
           'name' => ts('Previous'),
           'spacing' => '     ',
-        );
+        ];
       }
-      $buttons[] = array(
+      $buttons[] = [
         'type' => 'upload',
         'name' => ts('Continue'),
         'spacing' => '         ',
         'isDefault' => TRUE,
-      );
-      $buttons[] = array(
+      ];
+      $buttons[] = [
         'type' => 'cancel',
         'name' => ts('Cancel'),
-      );
+      ];
 
       $this->addButtons($buttons);
     }
@@ -374,7 +377,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
       }
 
       CRM_Core_Session::setStatus(ts("'%1' information has been saved.",
-        array(1 => CRM_Utils_Array::value('title', CRM_Utils_Array::value($subPage, $this->get('tabHeader')), $className))
+        [1 => CRM_Utils_Array::value('title', CRM_Utils_Array::value($subPage, $this->get('tabHeader')), $className)]
       ), ts('Saved'), 'success');
 
       $config = CRM_Core_Config::singleton();
@@ -423,7 +426,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
    */
   public static function addProfileEditScripts() {
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
-    CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ParticipantModel'));
+    CRM_UF_Page_ProfileEditor::registerSchemas(['IndividualModel', 'ParticipantModel']);
   }
 
 }