当前位置: 首页>>代码示例>>PHP>>正文


PHP SoapClient::SetLocalTemplate方法代码示例

本文整理汇总了PHP中SoapClient::SetLocalTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::SetLocalTemplate方法的具体用法?PHP SoapClient::SetLocalTemplate怎么用?PHP SoapClient::SetLocalTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoapClient的用法示例。


在下文中一共展示了SoapClient::SetLocalTemplate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildResume

 function buildResume($format)
 {
     // Turn off WSDL caching
     ini_set('soap.wsdl_cache_enabled', 0);
     // Define credentials for LD
     define('USERNAME', 'rsimha01');
     define('PASSWORD', 'prannu35');
     // SOAP WSDL endpoint
     define('ENDPOINT', 'https://api.livedocx.com/1.2/mailmerge.asmx?WSDL');
     // Define timezone
     date_default_timezone_set('Europe/Berlin');
     // -----------------------------------------------------------------------------
     //
     // SAMPLE #1 - License Agreement
     //
     // Instantiate SOAP object and log into LiveDocx
     $soap = new SoapClient(ENDPOINT);
     $soap->LogIn(array('username' => USERNAME, 'password' => PASSWORD));
     // Upload template
     $data = file_get_contents('template.docx');
     $soap->SetLocalTemplate(array('template' => base64_encode($data), 'format' => 'docx'));
     // Assign data to template
     $fieldValues = array('first_name' => $this->firstname, 'last_name' => $this->lastname, 'street_name' => $this->address, 'city' => $this->city, 'state' => $this->state, 'zip' => $this->zip, 'phone_no' => $this->phone, 'email' => $this->email, 'company_name' => $this->company['company_name'], 'years' => $this->company['years'], 'job_title' => $this->company['job_title'], 'job_description' => $this->company['job_description'], 'degree' => $this->school['degree'], 'school' => $this->school['school'], 'school_dates' => $this->school['dates'], 'skills' => $this->skills[0]);
     $soap->SetFieldValues(array('fieldValues' => $this->assocArrayToArrayOfArrayOfString($fieldValues)));
     // Build the document
     $soap->CreateDocument();
     // Get document as PDF
     $result = $soap->RetrieveDocument(array('format' => $format));
     $data = $result->RetrieveDocumentResult;
     file_put_contents('resume.' . $format . '', base64_decode($data));
     return "resume." . $format;
     $soap->LogOut();
     unset($soap);
     print 'DONE.' . PHP_EOL;
 }
开发者ID:brmsharad,项目名称:resume-extraction-search-app,代码行数:35,代码来源:Resume.php

示例2: convertToDocx

function convertToDocx($filepath, $format)
{
    // Turn up error reporting
    error_reporting(E_ERROR | E_PARSE);
    // Turn off WSDL caching
    ini_set('soap.wsdl_cache_enabled', 0);
    //// Define credentials for LD
    //define ('USERNAME', 'yourUsername');
    //define ('PASSWORD', 'yourPassword');
    // SOAP WSDL endpoint
    define('ENDPOINT', 'https://api.livedocx.com/1.2/mailmerge.asmx?WSDL');
    // Define timezone
    date_default_timezone_set('Europe/Berlin');
    // -----------------------------------------------------------------------------
    //
    // SAMPLE #1 - License Agreement
    //
    // Instantiate SOAP object and log into LiveDocx
    $soap = new SoapClient(ENDPOINT);
    $soap->LogIn(array('username' => rsimha01, 'password' => prannu35));
    // Upload template
    $data = file_get_contents($filepath);
    $soap->SetLocalTemplate(array('template' => base64_encode($data), 'format' => $format));
    // Build the document
    $soap->CreateDocument();
    // Get document as docx
    $result = $soap->RetrieveDocument(array('format' => 'docx'));
    $data = $result->RetrieveDocumentResult;
    file_put_contents('files/resume.zip', base64_decode($data));
}
开发者ID:brmsharad,项目名称:resume-extraction-search-app,代码行数:30,代码来源:ToDocx.php

示例3: export

 public function export()
 {
     require_once 'libs/nusoap/nusoap.php';
     if ($this->Input->get('key') != 'pdf') {
         return '';
     }
     $thisID = $this->Input->get('id');
     // Turn off WSDL caching
     ini_set('soap.wsdl_cache_enabled', 0);
     // SOAP WSDL endpoint
     define('ENDPOINT', 'https://api.livedocx.com/1.2/mailmerge.asmx?wsdl');
     // Define timezone
     date_default_timezone_set('Europe/Berlin');
     // Instantiate nuSOAP Client
     $soap = new SoapClient(ENDPOINT);
     // Set charset encoding for outgoing messages
     //	$soap ->soap_defencoding = 'UTF-8';
     $soap->LogIn(array('username' => $GLOBALS['TL_CONFIG']['livedocx_username'], 'password' => $GLOBALS['TL_CONFIG']['livedocx_password']));
     // Upload template
     $data = file_get_contents('templates/invoice-template.docx', FILE_USE_INCLUDE_PATH);
     // Assign field values data to template
     $soap->SetLocalTemplate(array('template' => base64_encode($data), 'format' => 'docx'));
     /* 	//debug
          $fieldNames = $soap->getFieldNames();
          print_r($fieldNames);
          exit;
         */
     $event = $this->Database->prepare("SELECT * FROM tl_pic_invoices WHERE id=?")->limit(1)->execute($thisID);
     if (!$event->numRows) {
         $this->log('Event not found', 'export_to_pdf()', TL_ERROR);
         header('Location: ?do=Invoices');
         return;
     }
     $name = $this->Database->prepare("SELECT * FROM tl_pic_customer_company WHERE id=?")->limit(1)->execute($event->customer_company_id);
     $address = $this->Database->prepare("SELECT * FROM tl_pic_customer_addresses WHERE pid=?")->limit(1)->execute($event->customer_company_id);
     $objInvoice = $this->Database->prepare("SELECT services FROM tl_pic_invoices WHERE id=?")->limit(1)->execute($thisID);
     $services = unserialize($objInvoice->services);
     $invoice_date = $event->invoice_date;
     $this->invoice_label = $_invoice_label;
     $format = 'd/m/Y';
     $this->invoice_date = gmdate($format, $invoice_date);
     $event->invoice_date = gmdate($format, $invoice_date);
     $fieldValues = array('logo' => $GLOBALS['TL_CONFIG']['logo'], 'company_name' => $GLOBALS['TL_CONFIG']['company_name'], 'address1' => $GLOBALS['TL_CONFIG']['company_address1'], 'address2' => $GLOBALS['TL_CONFIG']['company_address2'], 'city' => $GLOBALS['TL_CONFIG']['company_city'], 'postcode' => $GLOBALS['TL_CONFIG']['company_postcode'], 'phone' => $GLOBALS['TL_CONFIG']['company_phone'], 'num' => $GLOBALS['TL_CONFIG']['company_number'], 'taxnum' => $GLOBALS['TL_CONFIG']['company_taxnumber'], 'invoice_label' => $event->invoice_label, 'invoice_date' => $event->invoice_date, 'customer_company_name' => $name->customer_company_name, 'street' => $address->street, 'city' => $address->city, 'postal' => $address->postal, 'id' => $event->id, 'invoice_purchase_order' => $event->invoice_purchase_order, 'invoice_remaining_days' => $GLOBALS['TL_CONFIG']['invoice_remaining_days'], 'company_bankname' => $GLOBALS['TL_CONFIG']['company_bankname'], 'company_bankcode' => $GLOBALS['TL_CONFIG']['company_bankcode'], 'company_bankaccountnumber' => $GLOBALS['TL_CONFIG']['company_bankaccountnumber'], 'company_name' => $GLOBALS['TL_CONFIG']['company_name'], 'contact_firstname' => $GLOBALS['TL_CONFIG']['contact_firstname'], 'contact_lastname' => $GLOBALS['TL_CONFIG']['contact_lastname'], 'contact_phone' => $GLOBALS['TL_CONFIG']['contact_phone'], 'contact_email' => $GLOBALS['TL_CONFIG']['contact_email'], 'tax_applied' => $GLOBALS['TL_CONFIG']['tax_applied']);
     $sum = 0;
     $array_size = sizeof($services);
     for ($i = 0; $i < $array_size; $i++) {
         $sum = $sum + $services[$i]['cost'] * $services[$i]['quantity'];
         $fieldValues = $fieldValues + array('service_' . $i => $services[$i]['title'], 'price_' . $i => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['cost'], 'qty_' . $i => $services[$i]['quantity'], 'amount_' . $i => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['cost'] * $services[$i]['quantity']);
     }
     $fieldValues = $fieldValues + array('sum' => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $sum, 'vat' => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . ($vat = $sum * $GLOBALS['TL_CONFIG']['tax_applied'] / 100), 'sumvat' => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . ($sum + $vat));
     $result = $soap->SetFieldValues(array('fieldValues' => $this->nuSoap_assocArrayToArrayOfArrayOfString($fieldValues)));
     // Build the document
     $soap->CreateDocument();
     // Get document as PDF
     $result = $soap->RetrieveDocument(array('format' => 'pdf'));
     $data = $result->RetrieveDocumentResult;
     $soap->LogOut();
     unset($soap);
     $invoice_name = $GLOBALS['TL_CONFIG']['invoice_title'] . $event->invoice_date . "-" . $event->invoice_number;
     $GLOBALS['TL_CONFIG']['invoice_startnum']++;
     header('Content-Type: application/x-download');
     header('Content-Disposition: attachment; filename="' . $invoice_name . '.pdf"');
     header('Cache-Control: private, max-age=0, must-revalidate');
     //$soap->Output($invoice_name . '.pdf', $GLOBALS['TL_CONFIG']['invoice_path']);
     header('Pragma: public');
     echo base64_decode($data);
     return;
 }
开发者ID:romaindesjours,项目名称:SimpleBusinessManager,代码行数:68,代码来源:export_to_pdf.php

示例4: export

 public function export()
 {
     if ($GLOBALS['TL_CONFIG']['generator_type'] == 'LivedocX') {
         require_once 'libs/nusoap/nusoap.php';
         if ($this->Input->get('key') != 'pdf') {
             return '';
         }
         $thisID = $this->Input->get('id');
         // Turn off WSDL caching
         ini_set('soap.wsdl_cache_enabled', 0);
         // SOAP WSDL endpoint
         define('ENDPOINT', 'https://api.livedocx.com/1.2/mailmerge.asmx?wsdl');
         // Define timezone
         date_default_timezone_set('Europe/Berlin');
         // Instantiate nuSOAP Client
         $soap = new SoapClient(ENDPOINT);
         // Set charset encoding for outgoing messages
         //	$soap ->soap_defencoding = 'UTF-8';
         $soap->LogIn(array('username' => $GLOBALS['TL_CONFIG']['livedocx_username'], 'password' => $GLOBALS['TL_CONFIG']['livedocx_password']));
         // Upload template
         $data = file_get_contents('templates/proposal-template.docx', FILE_USE_INCLUDE_PATH);
         // Assign field values data to template
         $soap->SetLocalTemplate(array('template' => base64_encode($data), 'format' => 'docx'));
         $event = $this->Database->prepare("SELECT * FROM tl_pic_proposal WHERE id=?")->limit(1)->execute($thisID);
         if (!$event->numRows) {
             $this->log('Event not found', 'export_proposal_to_pdf()', TL_ERROR);
             header('Location: ?do=Proposals');
             return;
         }
         $name = $this->Database->prepare("SELECT * FROM tl_pic_customer_company WHERE id=?")->limit(1)->execute($event->customer_company_id);
         $format = 'd/m/Y';
         $proposal_date = $event->proposal_date;
         $proposal_startdate = $event->proposal_startdate;
         $proposal_enddate = $event->proposal_enddate;
         $this->proposal_date = gmdate($format, $proposal_date);
         $event->proposal_date = gmdate($format, $proposal_date);
         $event->proposal_startdate = gmdate($format, $proposal_startdate);
         $event->proposal_enddate = gmdate($format, $proposal_enddate);
         $objProposal = $this->Database->prepare("SELECT * FROM tl_pic_proposal WHERE id=?")->limit(1)->execute($thisID);
         $services = unserialize($objProposal->services);
         $fieldValues = array('company_name' => $GLOBALS['TL_CONFIG']['company_name'], 'address1' => $GLOBALS['TL_CONFIG']['company_address1'], 'address2' => $GLOBALS['TL_CONFIG']['company_address2'], 'city' => $GLOBALS['TL_CONFIG']['company_city'], 'postcode' => $GLOBALS['TL_CONFIG']['company_postcode'], 'phone' => $GLOBALS['TL_CONFIG']['company_phone'], 'firstname' => $GLOBALS['TL_CONFIG']['contact_firstname'], 'lastname' => $GLOBALS['TL_CONFIG']['contact_lastname'], 'phone' => $GLOBALS['TL_CONFIG']['contact_phone'], 'email' => $GLOBALS['TL_CONFIG']['contact_email'], 'website' => $GLOBALS['TL_CONFIG']['company_website'], 'curr' => $GLOBALS['TL_CONFIG']['company_defaultCurrency'], 'proposal_label' => $event->proposal_label, 'customer_company_name' => $name->customer_company_name, 'proposal_version' => $event->proposal_version, 'proposal_date' => $event->proposal_date, 'proposal_startdate' => $event->proposal_startdate, 'proposal_enddate' => $event->proposal_enddate, 'introduction_headline' => $event->introduction_headline, 'introduction' => $event->introduction, 'endtext_headline' => $event->endtext_headline, 'endtext' => $event->endtext);
         $array_size = sizeof($services);
         $sum_days = 0;
         $sum = 0;
         $blockFieldValues = array();
         $i = 0;
         while ($i < $array_size) {
             $current_service = $this->Database->prepare("SELECT * FROM tl_pic_services WHERE id=?")->limit(1)->execute($services[$i]['service']);
             $sum_days = $sum_days + $services[$i]['days_spent'];
             $sum = $sum + $services[$i]['price'];
             if ($i >= 0 && $i <= 5) {
                 $page = 5;
             }
             if ($i >= 6 && $i <= 10) {
                 $page = 6;
             }
             if ($i >= 11 && $i <= 15) {
                 $page = 7;
             }
             $id = (string) $i + 1;
             $blockFieldValues[$i]['service_name_' . (string) $i] = $current_service->service_name;
             $blockFieldValues[$i]['service_description_' . (string) $i] = $current_service->service_description;
             $blockFieldValues[$i]['days_spent_' . (string) $i] = $services[$i]['days_spent'];
             $blockFieldValues[$i]['price_' . (string) $i] = $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['price'];
             $blockFieldValues[$i]['id_' . (string) $i] = "2." . $id . " ";
             $blockFieldValues[$i]['p_' . (string) $i] = $page;
             $i++;
         }
         $array_size = sizeof($services);
         $sum_days = 0;
         $sum = 0;
         $blockFieldValues2 = array();
         $i = 0;
         while ($i < $array_size) {
             $current_service = $this->Database->prepare("SELECT * FROM tl_pic_services WHERE id=?")->limit(1)->execute($services[$i]['service']);
             $sum_days = $sum_days + $services[$i]['days_spent'];
             $sum = $sum + $services[$i]['price'];
             if ($i >= 0 && $i <= 5) {
                 $page = 5;
             }
             if ($i >= 6 && $i <= 10) {
                 $page = 6;
             }
             if ($i >= 11 && $i <= 15) {
                 $page = 7;
             }
             $id = (string) $i + 1;
             $blockFieldValues2[$i]['service_name_' . (string) $i] = $current_service->service_name;
             $blockFieldValues2[$i]['service_description_' . (string) $i] = $current_service->service_description;
             $blockFieldValues2[$i]['days_spent_' . (string) $i] = $services[$i]['days_spent'];
             $blockFieldValues2[$i]['price_' . (string) $i] = $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['price'];
             $blockFieldValues2[$i]['id_' . (string) $i] = "2." . $id . " ";
             $blockFieldValues2[$i]['p_' . (string) $i] = $page;
             $i++;
         }
         $array_size = sizeof($services);
         $sum_days = 0;
         $sum = 0;
         $blockFieldValues3 = array();
         $i = 0;
//.........这里部分代码省略.........
开发者ID:romaindesjours,项目名称:SimpleBusinessManager,代码行数:101,代码来源:export_proposal_to_pdf.php

示例5: resman_livedocx_create_documents

function resman_livedocx_create_documents()
{
    global $wpdb;
    $fieldValues = array();
    $username = get_option('resman_livedocx_username');
    $password = get_option('resman_livedocx_password');
    $dateformat = get_option('resman_date_format');
    if ($dateformat == '') {
        $dateformat = 'Y-m-d';
    }
    $ldx = new SoapClient(LIVEDOCX_URL, array('user_agent' => 'Wordpress-Resume-Manager/' . RESMAN_VERSION . ' http://pento.net/projects/wordpress-resume-mananger-plugin/'));
    $ldx->LogIn(array('username' => $username, 'password' => $password));
    $template = file_get_contents(WP_PLUGIN_DIR . '/' . RESMAN_FOLDER . '/template/classic.docx');
    $ldx->SetLocalTemplate(array('template' => base64_encode($template), 'format' => 'docx'));
    // PERSONAL
    $sql = 'SELECT d.value AS value, f.name AS name FROM ' . $wpdb->prefix . 'resman_data AS d LEFT JOIN ' . $wpdb->prefix . 'resman_fields AS f on f.id = d.fieldid WHERE f.section="personal";';
    $data = $wpdb->get_results($sql, ARRAY_A);
    $nationality = array();
    $fieldValues['personal-count'] = 0;
    foreach ($data as $item) {
        switch ($item['name']) {
            case 'nationality':
                $nationality[] = $item['value'];
                break;
            default:
                $fieldValues['personal-' . $item['name']] = $item['value'];
        }
        $fieldValues['personal-count']++;
    }
    if (count($nationality)) {
        $fieldValues['personal-nationality'] = implode(', ', $nationality);
    }
    // GENERAL
    $sql = 'SELECT d.value AS value, f.name AS name FROM ' . $wpdb->prefix . 'resman_data AS d LEFT JOIN ' . $wpdb->prefix . 'resman_fields AS f on f.id = d.fieldid WHERE f.section="general";';
    $data = $wpdb->get_results($sql, ARRAY_A);
    $fieldValues['general-count'] = 0;
    foreach ($data as $item) {
        $fieldValues['general-' . $item['name']] = $item['value'];
        $fieldValues['general-count']++;
    }
    // EXPERIENCE
    $sql = 'SELECT d.value AS value, f.name AS name, d.repeatgroup_count AS repeatgroup FROM ' . $wpdb->prefix . 'resman_data AS d LEFT JOIN ' . $wpdb->prefix . 'resman_fields AS f on f.id = d.fieldid WHERE f.section="experience" ORDER BY d.repeatgroup_count;';
    $data = $wpdb->get_results($sql, ARRAY_A);
    $experience = array();
    $fieldValues['experience-count'] = 0;
    foreach ($data as $item) {
        switch ($item['name']) {
            case 'start':
            case 'end':
                $experience[$item['repeatgroup'] - 1]['experience-' . $item['name']] = date($dateformat, strtotime($item['value']));
                break;
            case 'abstract':
                $experience[$item['repeatgroup'] - 1]['experience-' . $item['name']] = resman_livedocx_format_abstract($item['value']);
                break;
            default:
                $experience[$item['repeatgroup'] - 1]['experience-' . $item['name']] = $item['value'];
        }
    }
    $fields = array('start', 'end', 'title', 'abstract', 'name', 'address', 'sector');
    $expBlock = array();
    foreach ($experience as $key => $exp) {
        if (!isset($experience[$key]['experience-start'])) {
            $experience[$key]['experience-start'] = __('Present', 'resman');
        }
        if (!isset($experience[$key]['experience-end'])) {
            $experience[$key]['experience-end'] = __('Present', 'resman');
        }
        foreach ($fields as $field) {
            if (!isset($experience[$key]['experience-' . $field])) {
                $experience[$key]['experience-' . $field] = '';
            }
            $expBlock[$fieldValues['experience-count']]['experience-' . $field] = $experience[$key]['experience-' . $field];
        }
        $fieldValues['experience-count']++;
    }
    $ldx->SetBlockFieldValues(array('blockName' => 'experience', 'blockFieldValues' => resman_multiAssocArrayToArrayOfArrayOfString($expBlock)));
    // EDUCATION
    $sql = 'SELECT d.value AS value, f.name AS name, d.repeatgroup_count AS repeatgroup FROM ' . $wpdb->prefix . 'resman_data AS d LEFT JOIN ' . $wpdb->prefix . 'resman_fields AS f on f.id = d.fieldid WHERE f.section="education" ORDER BY d.repeatgroup_count;';
    $data = $wpdb->get_results($sql, ARRAY_A);
    $education = array();
    $fieldValues['education-count'] = 0;
    foreach ($data as $item) {
        switch ($item['name']) {
            case 'start':
            case 'end':
                $education[$item['repeatgroup'] - 1]['education-' . $item['name']] = date($dateformat, strtotime($item['value']));
                break;
            case 'abstract':
                $education[$item['repeatgroup'] - 1]['education-' . $item['name']] = resman_livedocx_format_abstract($item['value']);
                break;
            default:
                $education[$item['repeatgroup'] - 1]['education-' . $item['name']] = $item['value'];
        }
    }
    $fields = array('start', 'end', 'title', 'abstract', 'name', 'address', 'field');
    $eduBlock = array();
    foreach ($education as $key => $exp) {
        if (!isset($education[$key]['education-start'])) {
            $education[$key]['education-start'] = __('Present', 'resman');
        }
//.........这里部分代码省略.........
开发者ID:jaswinderbanga,项目名称:wordpress-resume-manager,代码行数:101,代码来源:resman-livedocx.php


注:本文中的SoapClient::SetLocalTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。