Merge pull request #15843 from totten/master-simplehead
[civicrm-core.git] / CRM / Case / Form / ActivityView.php
index 16247cda225f1e4c7619aec3ca9268331476c530..9d4da771985fd0ef4a5efb278f9309d380bb8a63 100644 (file)
@@ -1,34 +1,18 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
  */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
  */
 
 /**
@@ -66,31 +50,31 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form {
 
     $attachmentUrl = CRM_Core_BAO_File::attachmentInfo('civicrm_activity', $activityID);
     if ($attachmentUrl) {
-      $report['fields'][] = array(
+      $report['fields'][] = [
         'label' => 'Attachment(s)',
         'value' => $attachmentUrl,
         'type' => 'Link',
-      );
+      ];
     }
 
     $tags = CRM_Core_BAO_EntityTag::getTag($activityID, 'civicrm_activity');
     if (!empty($tags)) {
-      $allTag = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
+      $allTag = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', ['onlyActive' => FALSE]);
       foreach ($tags as $tid) {
         $tags[$tid] = $allTag[$tid];
       }
-      $report['fields'][] = array(
+      $report['fields'][] = [
         'label' => 'Tags',
         'value' => implode('<br />', $tags),
         'type' => 'String',
-      );
+      ];
     }
 
     $this->assign('report', $report);
 
     $latestRevisionID = CRM_Activity_BAO_Activity::getLatestActivityId($activityID);
 
-    $viewPriorActivities = array();
+    $viewPriorActivities = [];
     $priorActivities = CRM_Activity_BAO_Activity::getPriorAcitivities($activityID);
     foreach ($priorActivities as $activityId => $activityValues) {
       if (CRM_Case_BAO_Case::checkPermission($activityId, 'view', NULL, $contactID)) {
@@ -152,7 +136,7 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form {
 
     $title = $title . $recentContactDisplay . ' (' . $activityTypes[$activityTypeID] . ')';
 
-    $recentOther = array();
+    $recentOther = [];
     if (CRM_Case_BAO_Case::checkPermission($activityID, 'edit')) {
       $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/case/activity',
         "reset=1&action=update&id={$activityID}&cid={$recentContactId}&caseid={$caseID}&context=home"
@@ -204,6 +188,17 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form {
       ],
     ];
     CRM_Utils_System::appendBreadCrumb($breadcrumb);
+
+    $this->addButtons([
+      [
+        'type' => 'cancel',
+        'name' => ts('Done'),
+      ],
+    ]);
+    // Add additional action links
+    $activityDeleted = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityID, 'is_deleted');
+    $actionLinks = CRM_Case_Selector_Search::permissionedActionLinks($caseID, $contactID, CRM_Core_Session::getLoggedInContactID(), NULL, $activityTypeID, $activityDeleted, $activityID, FALSE);
+    $this->assign('actionLinks', $actionLinks);
   }
 
 }