Created
March 13, 2016 10:42
-
-
Save cmourizard/288411475064a7bd6f16 to your computer and use it in GitHub Desktop.
Dealing with PDF Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$defaultConfig = array( | |
'forced_root_block' => '', | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'include/Sugarpdf/sugarpdf/sugarpdf.pdfmanager.php'; | |
class MeetingsSugarpdfPdfmanager extends SugarpdfPdfmanager | |
{ | |
public function preDisplay() | |
{ | |
parent::preDisplay(); | |
$previewMode = false; | |
if (!empty($_REQUEST['pdf_preview']) && $_REQUEST['pdf_preview'] == 1) { | |
$previewMode = true; | |
} | |
if ($previewMode === false) { | |
// Select links to add | |
$linksToLoad = array('contacts', 'users'); | |
foreach ($linksToLoad as $linkName) { | |
/** @var Meeting $this->bean */ | |
$this->bean->load_relationship($linkName); | |
$linkedBeans = $this->bean->$linkName->getBeans(); | |
// Prepare data | |
$linkedData = array(); | |
foreach ($linkedBeans as $linkedBean) { | |
$linkedData[] = PdfManagerHelper::parseBeanFields($linkedBean, true); | |
} | |
// Assign data to template | |
$this->ss->assign($linkName, $linkedData); | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Meeting Summary</h1> | |
Topic: {$fields.name}<br /> | |
Description: {$fields.description}<br /> | |
{if isset($contacts) and $contacts|@count gt 0} | |
<br /> | |
<h2>Contact Guests</h2> | |
<table style="width: 100%;" border="0"> | |
<tbody> | |
<tr> | |
<td><strong>Name</strong></td> | |
<td>Email</td> | |
<td>Phone</td> | |
</tr> | |
<!-- {foreach from=$contacts item="contact"} --> | |
<tr> | |
<td>{$contact.full_name}</td> | |
<td>Email {$contact.email1}</td> | |
<td>{$contact.phone_work}</td> | |
</tr> | |
<!-- {/foreach} --> | |
</tbody> | |
</table> | |
{/if} {if isset($users) and $users|@count gt 0} | |
<br /> | |
<h2>User Guests</h2> | |
<table style="width: 100%;" border="0"> | |
<tbody> | |
<tr> | |
<td><strong>Name</strong></td> | |
<td>Email</td> | |
<td>Title</td> | |
</tr> | |
<!-- {foreach from=$users item="user"} --> | |
<tr> | |
<td>{$user.full_name}</td> | |
<td>{$user.email1}</td> | |
<td>{$user.title}</td> | |
</tr> | |
<!-- {/foreach} --> | |
</tbody> | |
</table> | |
{/if} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment