parent
0155d96381
commit
dbab3a64ef
|
@ -258,7 +258,7 @@ class UserController extends Controller
|
||||||
$suffix = $request->input('suffix');
|
$suffix = $request->input('suffix');
|
||||||
$nickname = $request->input('nickname');
|
$nickname = $request->input('nickname');
|
||||||
$organization = $request->input('organization');
|
$organization = $request->input('organization');
|
||||||
$title = $request->input('title');
|
$vtitle = $request->input('vtitle');
|
||||||
$role = $request->input('role');
|
$role = $request->input('role');
|
||||||
$workUrl = $request->input('work_url');
|
$workUrl = $request->input('work_url');
|
||||||
$email = $request->input('email');
|
$email = $request->input('email');
|
||||||
|
@ -279,33 +279,42 @@ class UserController extends Controller
|
||||||
$workAddressZip = $request->input('work_address_zip');
|
$workAddressZip = $request->input('work_address_zip');
|
||||||
$workAddressCountry = $request->input('work_address_country');
|
$workAddressCountry = $request->input('work_address_country');
|
||||||
|
|
||||||
// Create a new vCard instance
|
// Create an array with all the input fields
|
||||||
$vCard = new VCard();
|
$data = [
|
||||||
|
'prefix' => $request->input('prefix'),
|
||||||
|
'first_name' => $request->input('first_name'),
|
||||||
|
'middle_name' => $request->input('middle_name'),
|
||||||
|
'last_name' => $request->input('last_name'),
|
||||||
|
'suffix' => $request->input('suffix'),
|
||||||
|
'nickname' => $request->input('nickname'),
|
||||||
|
'organization' => $request->input('organization'),
|
||||||
|
'vtitle' => $request->input('vtitle'),
|
||||||
|
'role' => $request->input('role'),
|
||||||
|
'work_url' => $request->input('work_url'),
|
||||||
|
'email' => $request->input('email'),
|
||||||
|
'work_email' => $request->input('work_email'),
|
||||||
|
'home_phone' => $request->input('home_phone'),
|
||||||
|
'work_phone' => $request->input('work_phone'),
|
||||||
|
'cell_phone' => $request->input('cell_phone'),
|
||||||
|
'home_address_label' => $request->input('home_address_label'),
|
||||||
|
'home_address_street' => $request->input('home_address_street'),
|
||||||
|
'home_address_city' => $request->input('home_address_city'),
|
||||||
|
'home_address_state' => $request->input('home_address_state'),
|
||||||
|
'home_address_zip' => $request->input('home_address_zip'),
|
||||||
|
'home_address_country' => $request->input('home_address_country'),
|
||||||
|
'work_address_label' => $request->input('work_address_label'),
|
||||||
|
'work_address_street' => $request->input('work_address_street'),
|
||||||
|
'work_address_city' => $request->input('work_address_city'),
|
||||||
|
'work_address_state' => $request->input('work_address_state'),
|
||||||
|
'work_address_zip' => $request->input('work_address_zip'),
|
||||||
|
'work_address_country' => $request->input('work_address_country'),
|
||||||
|
];
|
||||||
|
|
||||||
// Set the personal information
|
// Convert the array to JSON format
|
||||||
$vCard->addName($lastName, $firstName, $middleName, $prefix, $suffix);
|
$json = json_encode($data);
|
||||||
$vCard->addRole($role);
|
|
||||||
|
|
||||||
// Set the organization information
|
// Set the JSON as the variable $links->link, or null if the JSON is empty
|
||||||
$vCard->addCompany($organization);
|
$LinkURL = $json ? $json : null;
|
||||||
$vCard->addJobtitle($title);
|
|
||||||
$vCard->addUrl($workUrl);
|
|
||||||
|
|
||||||
// Set the phone numbers
|
|
||||||
$vCard->addPhoneNumber($homePhone, 'HOME');
|
|
||||||
$vCard->addPhoneNumber($workPhone, 'WORK');
|
|
||||||
$vCard->addPhoneNumber($cellPhone, 'CELL');
|
|
||||||
|
|
||||||
// Set the email addresses
|
|
||||||
$vCard->addEmail($email, 'HOME');
|
|
||||||
$vCard->addEmail($workEmail, 'WORK');
|
|
||||||
|
|
||||||
// Set the addresses
|
|
||||||
$vCard->addAddress($homeAddressStreet, null, null, $homeAddressCity, $homeAddressState, $homeAddressZip, $homeAddressCountry, 'HOME', $homeAddressLabel);
|
|
||||||
$vCard->addAddress($workAddressStreet, null, null, $workAddressCity, $workAddressState, $workAddressZip, $workAddressCountry, 'WORK', $workAddressLabel);
|
|
||||||
|
|
||||||
// Generate the vCard file content
|
|
||||||
$LinkURL = $vCard->getOutput();
|
|
||||||
|
|
||||||
$OrigLink->update([
|
$OrigLink->update([
|
||||||
'link' => $LinkURL,
|
'link' => $LinkURL,
|
||||||
|
@ -383,33 +392,42 @@ class UserController extends Controller
|
||||||
$workAddressZip = $request->input('work_address_zip');
|
$workAddressZip = $request->input('work_address_zip');
|
||||||
$workAddressCountry = $request->input('work_address_country');
|
$workAddressCountry = $request->input('work_address_country');
|
||||||
|
|
||||||
// Create a new vCard instance
|
// Create an array with all the input fields
|
||||||
$vCard = new VCard();
|
$data = [
|
||||||
|
'prefix' => $request->input('prefix'),
|
||||||
|
'first_name' => $request->input('first_name'),
|
||||||
|
'middle_name' => $request->input('middle_name'),
|
||||||
|
'last_name' => $request->input('last_name'),
|
||||||
|
'suffix' => $request->input('suffix'),
|
||||||
|
'nickname' => $request->input('nickname'),
|
||||||
|
'organization' => $request->input('organization'),
|
||||||
|
'vtitle' => $request->input('vtitle'),
|
||||||
|
'role' => $request->input('role'),
|
||||||
|
'work_url' => $request->input('work_url'),
|
||||||
|
'email' => $request->input('email'),
|
||||||
|
'work_email' => $request->input('work_email'),
|
||||||
|
'home_phone' => $request->input('home_phone'),
|
||||||
|
'work_phone' => $request->input('work_phone'),
|
||||||
|
'cell_phone' => $request->input('cell_phone'),
|
||||||
|
'home_address_label' => $request->input('home_address_label'),
|
||||||
|
'home_address_street' => $request->input('home_address_street'),
|
||||||
|
'home_address_city' => $request->input('home_address_city'),
|
||||||
|
'home_address_state' => $request->input('home_address_state'),
|
||||||
|
'home_address_zip' => $request->input('home_address_zip'),
|
||||||
|
'home_address_country' => $request->input('home_address_country'),
|
||||||
|
'work_address_label' => $request->input('work_address_label'),
|
||||||
|
'work_address_street' => $request->input('work_address_street'),
|
||||||
|
'work_address_city' => $request->input('work_address_city'),
|
||||||
|
'work_address_state' => $request->input('work_address_state'),
|
||||||
|
'work_address_zip' => $request->input('work_address_zip'),
|
||||||
|
'work_address_country' => $request->input('work_address_country'),
|
||||||
|
];
|
||||||
|
|
||||||
// Set the personal information
|
// Convert the array to JSON format
|
||||||
$vCard->addName($lastName, $firstName, $middleName, $prefix, $suffix);
|
$json = json_encode($data);
|
||||||
$vCard->addRole($role);
|
|
||||||
|
|
||||||
// Set the organization information
|
// Set the JSON as the variable $links->link, or null if the JSON is empty
|
||||||
$vCard->addCompany($organization);
|
$links->link = $json ? $json : null;
|
||||||
$vCard->addJobtitle($vtitle);
|
|
||||||
$vCard->addUrl($workUrl);
|
|
||||||
|
|
||||||
// Set the phone numbers
|
|
||||||
$vCard->addPhoneNumber($homePhone, 'HOME');
|
|
||||||
$vCard->addPhoneNumber($workPhone, 'WORK');
|
|
||||||
$vCard->addPhoneNumber($cellPhone, 'CELL');
|
|
||||||
|
|
||||||
// Set the email addresses
|
|
||||||
$vCard->addEmail($email, 'HOME');
|
|
||||||
$vCard->addEmail($workEmail, 'WORK');
|
|
||||||
|
|
||||||
// Set the addresses
|
|
||||||
$vCard->addAddress($homeAddressStreet, null, null, $homeAddressCity, $homeAddressState, $homeAddressZip, $homeAddressCountry, 'HOME', $homeAddressLabel);
|
|
||||||
$vCard->addAddress($workAddressStreet, null, null, $workAddressCity, $workAddressState, $workAddressZip, $workAddressCountry, 'WORK', $workAddressLabel);
|
|
||||||
|
|
||||||
// Generate the vCard file content
|
|
||||||
$links->link = $vCard->getOutput();
|
|
||||||
|
|
||||||
$links->button_id = 96;
|
$links->button_id = 96;
|
||||||
}else{
|
}else{
|
||||||
|
@ -487,14 +505,38 @@ class UserController extends Controller
|
||||||
// Find the link with the specified ID
|
// Find the link with the specified ID
|
||||||
$link = Link::findOrFail($linkId);
|
$link = Link::findOrFail($linkId);
|
||||||
|
|
||||||
// Set the response headers to indicate that a VCard file should be downloaded
|
$json = $link->link;
|
||||||
$headers = [
|
|
||||||
'Content-Type' => 'text/vcard',
|
// Decode the JSON to a PHP array
|
||||||
'Content-Disposition' => 'attachment; filename="vcard.vcf"',
|
$data = json_decode($json, true);
|
||||||
];
|
|
||||||
|
// Create a new vCard object
|
||||||
|
$vcard = new VCard();
|
||||||
|
|
||||||
|
// Set the vCard properties from the $data array
|
||||||
|
$vcard->addName($data['last_name'], $data['first_name'], $data['middle_name'], $data['prefix'], $data['suffix']);
|
||||||
|
$vcard->addCompany($data['organization']);
|
||||||
|
$vcard->addJobtitle($data['vtitle']);
|
||||||
|
$vcard->addRole($data['role']);
|
||||||
|
$vcard->addEmail($data['email']);
|
||||||
|
$vcard->addPhoneNumber($data['home_phone'], 'HOME');
|
||||||
|
$vcard->addPhoneNumber($data['work_phone'], 'WORK');
|
||||||
|
$vcard->addPhoneNumber($data['cell_phone'], 'CELL');
|
||||||
|
$vcard->addAddress($data['home_address_street'], '', $data['home_address_city'], $data['home_address_state'], $data['home_address_zip'], $data['home_address_country'], 'HOME');
|
||||||
|
$vcard->addAddress($data['work_address_street'], '', $data['work_address_city'], $data['work_address_state'], $data['work_address_zip'], $data['work_address_country'], 'WORK');
|
||||||
|
|
||||||
|
// Generate the vCard file contents
|
||||||
|
$file_contents = $vcard->getOutput();
|
||||||
|
|
||||||
|
// Set the file headers for download
|
||||||
|
$headers = [
|
||||||
|
'Content-Type' => 'text/x-vcard',
|
||||||
|
'Content-Disposition' => 'attachment; filename="contact.vcf"'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Return the file download response
|
||||||
|
return response()->make($file_contents, 200, $headers);
|
||||||
|
|
||||||
// Return the link's content as a downloadable file
|
|
||||||
return Response::make($link->link, 200, $headers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Show link, click number, up link in links page
|
//Show link, click number, up link in links page
|
||||||
|
|
|
@ -2,48 +2,52 @@
|
||||||
|
|
||||||
<select style="display:none" name="button" class="form-control"><option class="button button-default email" value="vcard">Vcard</option></select>
|
<select style="display:none" name="button" class="form-control"><option class="button button-default email" value="vcard">Vcard</option></select>
|
||||||
|
|
||||||
{{-- @php
|
@php
|
||||||
$vcard = new VCard($link_url);
|
// Decode the JSON string to a PHP object
|
||||||
|
$data = json_decode($link_url);
|
||||||
|
|
||||||
$prefix = $vcard->getPrefix();
|
// Assign the values to the variables
|
||||||
$firstName = $vcard->getFirstName();
|
$prefix = $data->prefix;
|
||||||
$middleName = $vcard->getMiddleName();
|
$firstName = $data->first_name;
|
||||||
$lastName = $vcard->getLastName();
|
$middleName = $data->middle_name;
|
||||||
$suffix = $vcard->getSuffix();
|
$lastName = $data->last_name;
|
||||||
$organization = $vcard->getOrganization();
|
$suffix = $data->suffix;
|
||||||
$title = $vcard->getTitle();
|
$nickname = $data->nickname;
|
||||||
$role = $vcard->getRole();
|
$organization = $data->organization;
|
||||||
$workUrl = $vcard->getUrl();
|
$vtitle = $data->vtitle;
|
||||||
$email = $vcard->getEmail();
|
$role = $data->role;
|
||||||
$workEmail = $vcard->getWorkEmail();
|
$workUrl = $data->work_url;
|
||||||
$homePhone = $vcard->getHomePhone();
|
$email = $data->email;
|
||||||
$workPhone = $vcard->getWorkPhone();
|
$workEmail = $data->work_email;
|
||||||
$cellPhone = $vcard->getCellPhone();
|
$homePhone = $data->home_phone;
|
||||||
$homeAddressLabel = $vcard->getHomeAddressLabel();
|
$workPhone = $data->work_phone;
|
||||||
$homeAddressStreet = $vcard->getHomeAddressStreet();
|
$cellPhone = $data->cell_phone;
|
||||||
$homeAddressCity = $vcard->getHomeAddressCity();
|
$homeAddressLabel = $data->home_address_label;
|
||||||
$homeAddressState = $vcard->getHomeAddressRegion();
|
$homeAddressStreet = $data->home_address_street;
|
||||||
$homeAddressZip = $vcard->getHomeAddressPostalCode();
|
$homeAddressCity = $data->home_address_city;
|
||||||
$homeAddressCountry = $vcard->getHomeAddressCountry();
|
$homeAddressState = $data->home_address_state;
|
||||||
$workAddressLabel = $vcard->getWorkAddressLabel();
|
$homeAddressZip = $data->home_address_zip;
|
||||||
$workAddressStreet = $vcard->getWorkAddressStreet();
|
$homeAddressCountry = $data->home_address_country;
|
||||||
$workAddressCity = $vcard->getWorkAddressCity();
|
$workAddressLabel = $data->work_address_label;
|
||||||
$workAddressState = $vcard->getWorkAddressRegion();
|
$workAddressStreet = $data->work_address_street;
|
||||||
$workAddressZip = $vcard->getWorkAddressPostalCode();
|
$workAddressCity = $data->work_address_city;
|
||||||
$workAddressCountry = $vcard->getWorkAddressCountry();
|
$workAddressState = $data->work_address_state;
|
||||||
@endphp --}}
|
$workAddressZip = $data->work_address_zip;
|
||||||
|
$workAddressCountry = $data->work_address_country;
|
||||||
|
|
||||||
|
@endphp
|
||||||
|
|
||||||
<label for='title' class='form-label'>Custom Title</label>
|
<label for='title' class='form-label'>Custom Title</label>
|
||||||
<input type='text' name='link_title' value='{{ $link_title }}' class='form-control' />
|
<input type='text' name='link_title' value='{{ $link_title }}' class='form-control' />
|
||||||
<span class='small text-muted'>Leave blank for default title</span><br>
|
<span class='small text-muted'>Leave blank for default title</span><br>
|
||||||
{{$link_url}}
|
|
||||||
<br><h5>Upload existing file</h5>
|
{{-- <br><h5>Upload existing file</h5>
|
||||||
<div class="form-group col-lg-8">
|
<div class="form-group col-lg-8">
|
||||||
<label>Vcard</label>
|
<label>Vcard</label>
|
||||||
<input type="file" accept="text/vcard" class="form-control-file" name="vcard">
|
<input type="file" accept="text/vcard" class="form-control-file" name="vcard">
|
||||||
</div>
|
</div> --}}
|
||||||
|
|
||||||
<br><h4>Name</h4>
|
<br><br><h4>Name</h4>
|
||||||
<label for='prefix' class='form-label'>Prefix</label>
|
<label for='prefix' class='form-label'>Prefix</label>
|
||||||
<input type='text' name='prefix' value='{{$prefix ?? ''}}' class='form-control'/>
|
<input type='text' name='prefix' value='{{$prefix ?? ''}}' class='form-control'/>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -90,7 +90,7 @@ if (isset($_COOKIE['LinkCount'])) {
|
||||||
@if(!empty($link->link) and $button->name != "vcard")
|
@if(!empty($link->link) and $button->name != "vcard")
|
||||||
<br /><a title='{{$link->link}}' href="{{ $link->link}}" target="_blank" class="ml-4 text-muted small">{{Str::limit($link->link, 75 )}}</a>
|
<br /><a title='{{$link->link}}' href="{{ $link->link}}" target="_blank" class="ml-4 text-muted small">{{Str::limit($link->link, 75 )}}</a>
|
||||||
@elseif(!empty($link->link) and $button->name == "vcard")
|
@elseif(!empty($link->link) and $button->name == "vcard")
|
||||||
<br /><a href="{{ url('vcard/'.$link->id) }}" target="_blank" class="ml-4 text-muted small">Download</a>
|
<br /><a href="{{ url('vcard/'.$link->id) }}" target="_blank" class="ml-4 small">Download</a>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue