<?php
/*
+--------------------------------------------------------------------+
- | 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. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
*
*/
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
+ //CRM-14466 initialize variable to avoid php notice
+ $sortSQL = "";
if ($sort && $sortOrder) {
$sortSQL = $sort .' '.$sortOrder;
}
// move/transform caseRoles array data to caseRelationships
// for sorting and display
+ // CRM-14466 added cid to the non-client array to avoid php notice
foreach($caseRoles as $id => $value) {
if ($id != "client") {
$rel = array();
// set user name, email and edit columns links
// idx will count number of current row / needed by edit links
$idx = 1;
- foreach ($caseRelationships as $key => $row) {
+ foreach ($caseRelationships as &$row) {
+ // Get rid of the "<br />(Case Manager)" from label
+ list($typeLabel) = explode('<', $row['relation']);
// view user links
- if ($caseRelationships[$key]['cid']) {
- $caseRelationships[$key]['name'] = '<a href='.CRM_Utils_System::url('civicrm/contact/view',
- 'action=view&reset=1&cid='.$caseRelationships[$key]['cid']).'>'.$caseRelationships[$key]['name'].'</a>';
+ if (!empty($row['cid'])) {
+ $row['name'] = '<a class="view-contact" title="'. ts('View Contact') .'" href='.CRM_Utils_System::url('civicrm/contact/view',
+ 'action=view&reset=1&cid='.$row['cid']).'>'.$row['name'].'</a>';
}
// email column links/icon
- if ($caseRelationships[$key]['email']) {
- $caseRelationships[$key]['email'] = '<a href="'.CRM_Utils_System::url('civicrm/contact/view/activity', 'action=reset=1&action=add&atype=3&cid='.$caseRelationships[$key]['cid']).'" title="compose and send an email"><div class="icon email-icon" title="compose and send an email"></div>
- </a>';
+ if ($row['email']) {
+ $row['email'] = '<a class="crm-hover-button crm-popup" href="'.CRM_Utils_System::url('civicrm/activity/email/add', 'reset=1&action=add&atype=3&cid='.$row['cid']).'&caseid='.$caseID.'" title="'. ts('Send an Email') . '"><span class="icon email-icon"></span></a>';
}
// edit links
+ $row['actions'] = '';
if ($hasAccessToAllCases) {
- switch($caseRelationships[$key]['source']){
+ switch($row['source']){
case 'caseRel':
- $caseRelationships[$key]['actions'] =
- '<a href="#" title="edit case role" onclick="createRelationship( '.$caseRelationships[$key]['relation_type'].', '.$caseRelationships[$key]['cid'].', '.$caseRelationships[$key]['rel_id'].', '.$idx.', \''.$caseRelationships[$key]['relation'].'\' );return false;"><div class="icon edit-icon" ></div></a> <a href="#" class="case-role-delete" case_id="'.$caseID.'" rel_type="'.$caseRelationships[$key]['relation_type'].'"><div class="icon delete-icon" title="remove contact from case role"></div></a>';
+ $row['actions'] =
+ '<a href="#editCaseRoleDialog" title="'. ts('Reassign %1', array(1 => $typeLabel)) .'" class="crm-hover-button case-miniform" data-rel_type="'. $row['relation_type'] .'" data-rel_id="'. $row['rel_id'] .'"data-key="'. CRM_Core_Key::get('civicrm/ajax/relation') .'">'.
+ '<span class="icon edit-icon"></span>'.
+ '</a>'.
+ '<a href="#deleteCaseRoleDialog" title="'. ts('Remove %1', array(1 => $typeLabel)) .'" class="crm-hover-button case-miniform" data-rel_type="'.$row['relation_type'].'" data-key="'. CRM_Core_Key::get('civicrm/ajax/delcaserole') .'">'.
+ '<span class="icon delete-icon"></span>'.
+ '</a>';
break;
case 'caseRoles':
- $caseRelationships[$key]['actions'] =
- '<a href="#" title="edit case role" onclick="createRelationship('.$caseRelationships[$key]['relation_type'].', null, null, '.$idx.', \''.$caseRelationships[$key]['relation'].'\');return false;"><div class="icon edit-icon"></div></a>';
+ $row['actions'] =
+ '<a href="#editCaseRoleDialog" title="'. ts('Assign %1', array(1 => $typeLabel)) .'" class="crm-hover-button case-miniform" data-rel_type="'. $row['relation_type'] .'" data-key="'. CRM_Core_Key::get('civicrm/ajax/relation') .'">'.
+ '<span class="icon edit-icon"></span>'.
+ '</a>';
break;
}
- } else {
- $caseRelationships[$key]['actions'] = '';
}
$idx++;
}
$iFilteredTotal = $iTotal = $params['total'] = count($allCaseRelationships);
$selectorElements = array('relation', 'name', 'phone', 'email', 'actions');
-
+
echo CRM_Utils_JSON::encodeDataTableSelector($caseRelationships, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
1 => 'subject',
2 => 'source_contact_name',
3 => '',
- 4 => 'activity_date_time',
- 5 => 'status_id',
+ 4 => '',
+ 5 => 'activity_date_time',
+ 6 => 'status_id',
);
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');