예제 #1
0
<?php

include_once realpath('../../../../Bootstrap.php');
use ZendService\LiveDocx\DemoHelper as Helper;
use ZendService\LiveDocx\MailMerge;
Helper::printLine(PHP_EOL . 'Downloading Remotely Stored Images' . PHP_EOL . PHP_EOL);
$mailMerge = new MailMerge();
$mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE);
// for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM
$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);
예제 #2
0
     PodioHook::validate($_POST['hook_id'], array('code' => $_POST['code']));
 case 'item.create':
     $item = PodioItem::get($_POST['item_id']);
     $temp_array = array();
     foreach ($item->files as $fs) {
         $temp_array[] = $fs;
         if ($fs->mimetype == 'application/msword') {
             //Get file name withour ext
             $no_ext = substr($fs->name, 0, strpos($fs->name, '.'));
             //Upload file to our server
             $fl = PodioFile::get($fs->file_id);
             $fc = $fl->get_raw();
             file_put_contents($upload_path . $fs->name, $fc);
             //Part with convert files from doc(x) to pdf
             $mailMerge = new MailMerge();
             $mailMerge->setUsername($user)->setPassword($password)->setService(MailMerge::SERVICE_FREE);
             $mailMerge->setLocalTemplate($upload_path . $fs->name);
             $mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9');
             $mailMerge->createDocument();
             $document = $mailMerge->retrieveDocument($need_ext);
             file_put_contents($upload_path . $no_ext . $ext_pdf, $document);
             unset($mailMerge);
             // Attached file pdf to our item
             $f = PodioFile::upload($upload_path . $no_ext . $ext_pdf, $no_ext . $ext_pdf);
             $temp_array[] = $f;
             // Removed temp files
             unlink($upload_path . $fs->name);
             unlink($upload_path . $no_ext . $ext_pdf);
         }
     }
     // Create a new collection for files
예제 #3
0
 public function testLoginWithSetUsernameSetPasswordSoapClient()
 {
     $mailMerge = new MailMerge();
     $mailMerge->setUsername(TESTS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(TESTS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setSoapClient(new SoapClient($this->mailMerge->getWsdl()));
     $this->assertInstanceOf('ZendService\\LiveDocx\\MailMerge', $this->mailMerge->setLocalTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_1));
     unset($mailMerge);
 }
예제 #4
0
// -----------------------------------------------------------------------------
if (defined('DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME') && defined('DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD') && false !== DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME && false !== DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD) {
    $result = TEST_PASS;
} else {
    $result = TEST_FAIL;
    $failed = false;
}
Helper::printLineToc($counter, 'Checking LiveDocx Premium credentials are defined', $result);
$counter++;
// -----------------------------------------------------------------------------
if (defined('DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME') && defined('DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD') && false !== DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME && false !== DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD) {
    $errorMessage = null;
    try {
        $microtime = microtime(true);
        $mailMerge = new MailMerge();
        $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD)->setService(MailMerge::SERVICE_PREMIUM)->listTemplates();
        $duration = microtime(true) - $microtime;
        unset($mailMerge);
    } catch (Exception $e) {
        $duration = -1;
        $errorMessage = $e->getMessage();
    }
    if (is_null($errorMessage)) {
        $result = TEST_PASS;
    } else {
        $result = TEST_FAIL;
        $failed = true;
    }
    Helper::printLineToc($counter, sprintf('Logging into LiveDocx Premium (%01.2fs)', $duration), $result);
    $counter++;
}
<?php

include_once realpath('../../../../Bootstrap.php');
use ZendService\LiveDocx\DemoHelper as Helper;
use ZendService\LiveDocx\MailMerge;
Helper::printLine(PHP_EOL . 'Using LiveDocx Fully Licensed' . PHP_EOL . PHP_EOL . 'This sample application illustrates how to use the Zend Framework LiveDocx component with the LiveDocx running in your own network.' . PHP_EOL . PHP_EOL);
// -----------------------------------------------------------------------------
// Pass login credentials using set methods
$mailMerge = new MailMerge();
$mailMerge->setUsername('your-username')->setPassword('your-password')->setWsdl('http://api.example.com/2.1/mailmerge.asmx?wsdl');
// set the WSDL of your locally installed,
// LiveDocx Fully Licensed server here
$mailMerge->getTemplateFormats();
// then call methods as usual
printf('Username : %s%sPassword : %s%s    WSDL : %s%s%s', $mailMerge->getUsername(), PHP_EOL, $mailMerge->getPassword(), PHP_EOL, $mailMerge->getWsdl(), PHP_EOL, PHP_EOL);
unset($mailMerge);
// -----------------------------------------------------------------------------
// Pass login credentials using constructor
$mailMerge = new MailMerge();
$mailMerge = new MailMerge(array('username' => 'your-username', 'password' => 'your-password', 'wsdl' => 'http://api.example.com/2.1/mailmerge.asmx?wsdl'));
// set the WSDL of your
// LiveDocx Fully Licensed server here
$mailMerge->getTemplateFormats();
// then call methods as usual
printf('Username : %s%sPassword : %s%s    WSDL : %s%s%s', $mailMerge->getUsername(), PHP_EOL, $mailMerge->getPassword(), PHP_EOL, $mailMerge->getWsdl(), PHP_EOL, PHP_EOL);
unset($mailMerge);
// -----------------------------------------------------------------------------