<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | 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. |
- | |
- | 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. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | 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 |
+--------------------------------------------------------------------+
*/
namespace Civi\CCase;
* @return bool
*/
public function hasActivity($type, $status = NULL) {
- $idx = $this->getActivityIndex(array('activity_type_id', 'status_id'));
- $activityTypeGroup = civicrm_api3('option_group', 'get', array('name' => 'activity_type'));
- $activityType = array(
+ $idx = $this->getActivityIndex(['activity_type_id', 'status_id']);
+ $activityTypeGroup = civicrm_api3('option_group', 'get', ['name' => 'activity_type']);
+ $activityType = [
'name' => $type,
'option_group_id' => $activityTypeGroup['id'],
- );
+ ];
$activityTypeID = civicrm_api3('option_value', 'get', $activityType);
$activityTypeID = $activityTypeID['values'][$activityTypeID['id']]['value'];
if ($status) {
- $activityStatusGroup = civicrm_api3('option_group', 'get', array('name' => 'activity_status'));
- $activityStatus = array(
+ $activityStatusGroup = civicrm_api3('option_group', 'get', ['name' => 'activity_status']);
+ $activityStatus = [
'name' => $status,
'option_group_id' => $activityStatusGroup['id'],
- );
+ ];
$activityStatusID = civicrm_api3('option_value', 'get', $activityStatus);
$activityStatusID = $activityStatusID['values'][$activityStatusID['id']]['value'];
}
if ($this->activities === NULL) {
// TODO find batch-oriented API for getting all activities in a case
$case = $this->getCase();
- $activities = array();
+ $activities = [];
if (isset($case['activities'])) {
foreach ($case['activities'] as $actId) {
- $result = civicrm_api3('Activity', 'get', array(
+ $result = civicrm_api3('Activity', 'get', [
'id' => $actId,
'is_current_revision' => 1,
- ));
+ ]);
$activities = array_merge($activities, $result['values']);
}
}
* @return array|NULL, activity record (api/v3)
*/
public function getSingleActivity($type) {
- $idx = $this->getActivityIndex(array('activity_type_id', 'id'));
+ $idx = $this->getActivityIndex(['activity_type_id', 'id']);
$actTypes = array_flip(\CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'validate'));
$typeId = $actTypes[$type];
$count = isset($idx[$typeId]) ? count($idx[$typeId]) : 0;
*/
public function getCase() {
if ($this->case === NULL) {
- $this->case = civicrm_api3('case', 'getsingle', array('id' => $this->caseId));
+ $this->case = civicrm_api3('case', 'getsingle', ['id' => $this->caseId]);
}
return $this->case;
}
$this->case = NULL;
$this->caseType = NULL;
$this->activities = NULL;
- $this->indices = array();
+ $this->indices = [];
}
}