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; }
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)); }
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; }
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; 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; $blockFieldValues3[$i]['service_name_' . (string) $i] = $current_service->service_name; $blockFieldValues3[$i]['service_description_' . (string) $i] = $current_service->service_description; $blockFieldValues3[$i]['days_spent_' . (string) $i] = $services[$i]['days_spent']; $blockFieldValues3[$i]['price_' . (string) $i] = $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['price']; $blockFieldValues3[$i]['id_' . (string) $i] = "2." . $id . " "; $blockFieldValues3[$i]['p_' . (string) $i] = $page; $i++; } $avp = 6; $last = 7; if ($array_size > 6) { $avp = 7; $last = 8; } if ($array_size > 11) { $avp = 8; $last = 9; } $custom_fields = unserialize($objProposal->custom_fields); $custom_fields_size = sizeof($custom_fields); for ($i = 0; $i < $custom_fields_size; $i++) { $fieldValues = $fieldValues + array($custom_fields[$i]['field_name'] => $custom_fields[$i]['value']); } $fieldValues = $fieldValues + array('sum' => $sum, 'sum_days' => $sum_days, 'avp' => $avp, 'last' => $last); $result = $soap->SetFieldValues(array('fieldValues' => $this->nuSoap_assocArrayToArrayOfArrayOfString($fieldValues))); $soap->SetBlockFieldValues(array('blockName' => 'content', 'blockFieldValues' => $this->nuSoap_multiAssocArrayToArrayOfArrayOfString($blockFieldValues))); $soap->SetBlockFieldValues(array('blockName' => 'content_menu', 'blockFieldValues' => $this->nuSoap_multiAssocArrayToArrayOfArrayOfString($blockFieldValues2))); $soap->SetBlockFieldValues(array('blockName' => 'content_array', 'blockFieldValues' => $this->nuSoap_multiAssocArrayToArrayOfArrayOfString($blockFieldValues3))); // Build the document $soap->CreateDocument(); // Get document as PDF $result = $soap->RetrieveDocument(array('format' => 'pdf')); $data = $result->RetrieveDocumentResult; $soap->LogOut(); unset($soap); header('Content-Type: application/x-download'); header('Content-Disposition: attachment; filename="' . $event->proposal_label . '.pdf"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); echo base64_decode($data); return; } else { echo 'LivedocX only is available at the moment !'; } }
public static function getProducts() { $wsdl = 'http://89.122.46.210/InterfacesWS/IInterfacesBO3.asmx?WSDL'; $trace = true; $exceptions = false; try { $client = new \SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions)); $xml_array = array(); $xml_array['plngVersiune'] = 1; $xml_array['pstrNumeFirma'] = 'TESTE AUGER'; $xml_array['pstrUtilizator'] = 'Interfete'; $xml_array['pstrParolaSecurizata'] = '007a142775e4bec2c3c6ee9ffe86b1f8'; $clientToken = $client->LogIn($xml_array)->LogInResult; $export = []; unset($xml_array); $xml_array = array(); $xml_array['ClientToken'] = $clientToken; $xml_array['pstrFiltersAsXML'] = ''; $xml_array['pstrEntitate'] = 'TipAgenti'; $export['TipAgenti'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Agenti'; $export['Agenti'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Gestiuni'; $export['Gestiuni'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'UM'; $export['UM'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Categorii'; $export['Categorii'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'CategoriiProduse'; $export['CategoriiProduse'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Ramuri'; $export['Ramuri'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'TipuriProdusAccizat'; $export['TipuriProdusAccizat'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'GrupeProduse'; $export['GrupeProduse'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'ClasificariProduse'; $export['ClasificariProduse'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Valute'; $export['Valute'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Banci'; $export['Banci'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Produse'; $export['Produse'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'PreturiPerGestiuni'; $export['PreturiPerGestiuni'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'InfoAprovizionare'; $export['InfoAprovizionare'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'CoduriBare'; $export['CoduriBare'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'InfoAprovizionare'; $export['InfoAprovizionare'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Terti'; $export['Terti'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'TertiConturiBancare'; $export['TertiConturiBancare'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'TertiPersoaneContact'; $export['TertiPersoaneContact'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'CaseMarcat'; $export['CaseMarcat'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'ConturiCasaProprii'; $export['ConturiCasaProprii'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'Stocuri'; $export['Stocuri'] = $client->Export($xml_array)->ExportResult; $xml_array['pstrEntitate'] = 'TVA'; $export['TVA'] = $client->Export($xml_array)->ExportResult; $products = array(); $lines = explode("\n", $export['Produse']); foreach ($lines as $line) { $columns = explode("\t", $line); $products[] = $columns; } return $products; //$response = $client->LogOut($xml_array)->LogOutResult; //echo 'LogOut: ' . '<BR>'; //echo $response; /*foreach($export as $key => $value) { echo '<h1>' . $key . '</h1>'; echo nl2br($value); echo '<br />'; }*/ } catch (Exception $e) { echo "Error!"; echo $e->getMessage(); echo 'Last response: ' . $client->__getLastResponse(); } }
function resman_livedocx_fonts_box() { $username = get_option('resman_livedocx_username'); $password = get_option('resman_livedocx_password'); $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)); $result = $ldx->GetFontNames(); ?> <p> <ul> <?php foreach ($result->GetFontNamesResult->string as $format) { if (strpos($format, '@') === 0) { continue; } ?> <li><span style="font-family:<?php echo $format; ?> "><?php echo $format; ?> </span> (<?php echo $format; ?> )</li> <?php } ?> </ul> </p> <?php $ldx->LogOut(); unset($ldx); }