Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calendar location field automatically links to google maps
#1
I have altered the function 'transferForAddIntoTitle' in the CalendarUtils.php file a little:

PHP Code:
function transferForAddIntoTitle($type$row$CD) {
 if (
$CD["uitype"] == "66"
 
$Col_Field = array($CD["fieldname"]=> $row["parent_id"]);
 else
 
$Col_Field = array($CD["fieldname"]=> $row[$CD["columnname"]]);

 if (
$CD["fieldname"] == "duration_hours"
 
$Col_Field["duration_minutes"] = $row["duration_minutes"];

 if (
$CD["fieldname"] == "contact_id") {
 
$Col_Field["contact_id"] = getAssignedContactsForEvent($row["crmid"]);
 
$CD["uitype"] = "1"  
 
}
 
$Cal_Data getDetailViewOutputHtml($CD["uitype"], $CD["fieldname"], $CD["fieldlabel"], $Col_Field"2"$calendar_tabid"Calendar");

 if (
$CD["uitype"] == "15")
 
$value getTranslatedString($Cal_Data[1],'Calendar');
 else
 
$value $Cal_Data[1];
 if (
$CD["fieldname"] == "location" {
 
$value "<a href='https://www.google.nl/maps/place/".$row['location']."' target='_blank'>".$row['location']."</a>";
 }
 if (
$type == "1")
 return 
$Cal_Data[1];
 else
 return 
'<br><b>'.$Cal_Data[0].'</b>: <span onmouseover="vtlib_listview.trigger(\'cell.onmouseover\', $(this))" onmouseout="vtlib_listview.trigger(\'cell.onmouseout\', $(this))">'.$value.'</span>';
 
// return '<table><tr><th>'.$Cal_Data[0].':</th><td onmouseover="vtlib_listview.trigger(\'cell.onmouseover\', $(this))" onmouseout="vtlib_listview.trigger(\'cell.onmouseout\', $(this))">'.$value.'</td></tr></table>';


Now, when you add a location the event will automatically create a link to google maps with that address or location pre-filled out.

If you adopt my account-selection autocomplete, the address for the appointment will automatically fill the location. To do so, change the 'select' in the autocomplete call to:

PHP Code:
         select: function( eventui) {
             
 // Add crmentity id to hidden input
             
 jQuery('input[name=parent_id]').attr('value',ui.item.value);
             
 // Also update the activity name with the activity type and account name
             
 jQuery('input[name=subject]').val(jQuery('#activitytype option:selected').text() + " " ui.item.label);
             
 // Overwrite the input field with the account name in stead of the crmentity
             
 jQuery('#account_autocomplete').val(ui.item.label);
             
 // Update the address automatically
             
 jQuery('input[name=location]').val(ui.item.street " " ui.item.city);
             
 return false;
         
 }, 
Reply


Forum Jump:


Users browsing this thread: