forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'livedocx-2.0' of https://github.com/jonathanmaron/zf2 i…
…nto hotfix/maron-livedocx-2.0
- Loading branch information
Showing
24 changed files
with
518 additions
and
134 deletions.
There are no files selected for viewing
This file contains 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
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
demos/Zend/Service/LiveDocx/MailMerge/conference-pass/generate-document.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php'; | ||
|
||
|
||
use Zend\Date\Date; | ||
use Zend\Service\LiveDocx\MailMerge; | ||
|
||
$mailMerge = new MailMerge(); | ||
|
||
$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME) | ||
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD); | ||
|
||
/** | ||
* Image Source: | ||
* iStock_000003413016Medium_business-man-with-hands-up.jpg | ||
*/ | ||
$photoFilename = 'dailemaitre.jpg'; | ||
|
||
if (!$mailMerge->imageExists($photoFilename)) { | ||
$mailMerge->uploadImage($photoFilename); | ||
} | ||
|
||
$mailMerge->setLocalTemplate('template.docx'); | ||
|
||
$mailMerge->assign('name', 'Daï Lemaitre') | ||
->assign('company', 'Megasoft Co-operation') | ||
->assign('date', Date::now()->toString(Date::DATE_LONG)) | ||
->assign('image:photo', $photoFilename); | ||
|
||
$mailMerge->createDocument(); | ||
|
||
$document = $mailMerge->retrieveDocument('pdf'); | ||
|
||
file_put_contents('document.pdf', $document); | ||
|
||
$mailMerge->deleteImage($photoFilename); | ||
|
||
unset($mailMerge); |
Binary file not shown.
30 changes: 30 additions & 0 deletions
30
demos/Zend/Service/LiveDocx/MailMerge/images/delete-all.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php'; | ||
|
||
|
||
use Zend\Service\LiveDocx\Helper; | ||
use Zend\Service\LiveDocx\MailMerge; | ||
|
||
Helper::printLine( | ||
PHP_EOL . 'Deleting All Remotely Stored Images' . | ||
PHP_EOL . | ||
PHP_EOL | ||
); | ||
|
||
$mailMerge = new MailMerge(); | ||
|
||
$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME) | ||
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD); | ||
|
||
$counter = 1; | ||
foreach ($mailMerge->listImages() as $result) { | ||
printf('%d) %s', $counter, $result['filename']); | ||
$mailMerge->deleteImage($result['filename']); | ||
print(' - DELETED.' . PHP_EOL); | ||
$counter++; | ||
} | ||
|
||
print(PHP_EOL); | ||
|
||
unset($mailMerge); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php'; | ||
|
||
|
||
use Zend\Service\LiveDocx\Helper; | ||
use Zend\Service\LiveDocx\MailMerge; | ||
|
||
Helper::printLine( | ||
PHP_EOL . 'Downloading Remotely Stored Images' . | ||
PHP_EOL . | ||
PHP_EOL | ||
); | ||
|
||
$mailMerge = new MailMerge(); | ||
|
||
$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME) | ||
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD); | ||
|
||
$counter = 1; | ||
foreach ($mailMerge->listImages() as $result) { | ||
printf('%d) %s', $counter, $result['filename']); | ||
$image = $mailMerge->downloadImage($result['filename']); | ||
file_put_contents('downloaded-' . $result['filename'], $image); | ||
print(' - DOWNLOADED.' . PHP_EOL); | ||
$counter++; | ||
} | ||
|
||
print(PHP_EOL); | ||
|
||
unset($mailMerge); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions
30
demos/Zend/Service/LiveDocx/MailMerge/images/image-exists.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php'; | ||
|
||
|
||
use Zend\Service\LiveDocx\Helper; | ||
use Zend\Service\LiveDocx\MailMerge; | ||
|
||
Helper::printLine( | ||
PHP_EOL . 'Checking For Remotely Stored Images' . | ||
PHP_EOL . | ||
PHP_EOL | ||
); | ||
|
||
$mailMerge = new MailMerge(); | ||
|
||
$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME) | ||
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD); | ||
|
||
print('Checking whether an image is available... '); | ||
if (true === $mailMerge->imageExists('image-01.png')) { | ||
print('EXISTS. '); | ||
} else { | ||
print('DOES NOT EXIST. '); | ||
} | ||
print('DONE' . PHP_EOL); | ||
|
||
print(PHP_EOL); | ||
|
||
unset($mailMerge); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php'; | ||
|
||
|
||
use Zend\Service\LiveDocx\Helper; | ||
use Zend\Service\LiveDocx\MailMerge; | ||
|
||
Helper::printLine( | ||
PHP_EOL . 'Remotely Stored Images' . | ||
PHP_EOL . | ||
PHP_EOL . 'The following images are currently stored on the LiveDocx server:' . | ||
PHP_EOL . | ||
PHP_EOL | ||
); | ||
|
||
$mailMerge = new MailMerge(); | ||
|
||
$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME) | ||
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD); | ||
|
||
print(Helper::listDecorator($mailMerge->listImages())); | ||
|
||
unset($mailMerge); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php'; | ||
|
||
|
||
use Zend\Service\LiveDocx\Helper; | ||
use Zend\Service\LiveDocx\MailMerge; | ||
|
||
Helper::printLine( | ||
PHP_EOL . 'Uploading Locally Stored Images to Server' . | ||
PHP_EOL . | ||
PHP_EOL | ||
); | ||
|
||
$mailMerge = new MailMerge(); | ||
|
||
$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME) | ||
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD); | ||
|
||
print('Uploading image... '); | ||
$mailMerge->uploadImage('image-01.png'); | ||
print('DONE.' . PHP_EOL); | ||
|
||
print('Uploading image... '); | ||
$mailMerge->uploadImage('image-02.png'); | ||
print('DONE.' . PHP_EOL); | ||
|
||
print(PHP_EOL); | ||
|
||
unset($mailMerge); |
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
Empty file modified
0
demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php
100644 → 100755
Empty file.
This file contains 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
Empty file.
Oops, something went wrong.