public static function render_instance(BlockInstance $instance, $editing = false) { // Check if XSLT extension is loaded properly, because we will need it... // The XSL extension implements the XSL standard, performing XSLT transformations using the libxslt library. $xslext = extension_loaded('xsl'); if (!$xslext) { $missingextensions = array(); !$xslext && ($missingextensions[] = 'xsl'); $errormsg = '<p>' . get_string('europassextensionmissing', 'artefact.europass') . '</p>'; $errormsg .= '<ul>'; foreach ($missingextensions as $extension) { $errormsg .= '<li><a href="http://www.php.net/' . $extension . '">' . $extension . '</a></li>'; } $errormsg .= '</ul>'; return $errormsg; exit; } global $USER; $configdata = $instance->get('configdata'); if ($configdata == array()) { $locale = set_default_locale(get_config('lang')); } else { $locale = $configdata['locale']; } $configdata['viewid'] = $instance->get('view'); // Load up the Europass CV generated XML string //$xmlDoc = new DOMDocument; //$xmlDoc->loadXML(generate_europasscv_xml((!empty($configdata['userid']) ? $configdata['userid'] : $USER->get('id')), true, $locale, (!empty($configdata['internaldate']) ? $configdata['internaldate'] : 'dmy11'), (!empty($configdata['externaldate']) ? $configdata['externaldate'] : '/numeric/long'))); $xmlDoc = simplexml_load_string(generate_europasscv_xml(!empty($configdata['userid']) ? $configdata['userid'] : $USER->get('id'), true, $locale, !empty($configdata['internaldate']) ? $configdata['internaldate'] : 'dmy11', !empty($configdata['externaldate']) ? $configdata['externaldate'] : '/numeric/long')); // Load up the appropriate XSL file, according to selected locale //$xslDoc = new DOMDocument; //$xslDoc->load(get_config('docroot') . 'artefact/europass/blocktype/europasscv/xsl/cv_' . $locale . '_V2.0.xsl'); $xslDoc = simplexml_load_string(file_get_contents(get_config('wwwroot') . 'artefact/europass/blocktype/europasscv/xsl/cv_' . $locale . '_V2.0.xsl')); //Start the XSLT processor and import stylesheet $xslt = new XSLTProcessor(); $xslt->importStyleSheet($xslDoc); // Apply the transformation $html = $xslt->transformToXml($xmlDoc); $start = stripos($html, '<body>'); $finish = stripos($html, '</body>'); $result = '<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'artefact/europass/theme/raw/static/style/html.css">'; //$result .= '<table width="700" border="0" cellspacing="0" cellpadding="0" class="CV" id="CV">'; $result .= substr($html, $start + 6, $finish - $start); //$result .= '</table>'; $result = html_entity_decode($result); // Replace the following reference because it does not exist anymore: // http://europass.cedefop.europa.eu/instruments/images/logospace.gif $result = str_replace('http://europass.cedefop.europa.eu/instruments/images/logospace.gif', get_config('wwwroot') . 'artefact/europass/images/space.png', $result); return $result; }
curl_setopt($ch, CURLOPT_POSTFIELDS, $document_v3); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_CAINFO, get_config('docroot') . 'artefact/europass/cert/cacert.crt'); $output = curl_exec($ch); $info = curl_getinfo($ch); $content = substr($output, $info['header_size']); curl_close($ch); } // Set default filename $filename = 'cv'; } if ($fileformat == 'xml') { $content = generate_europasscv_xml($USER->get('id'), false, $locale, $internaldate, $externaldate, $photograph); $content = indentXML($content); // Set default filename $filename = 'cv'; } if ($content == '') { if ($wsdl_error != '') { $message = '<div style="color: #dd0221; background: #ffd3d9; padding: 0.2em 0.7em; font-family: sans-serif; font-size: 0.8em;">' . $wsdl_error . '</div>'; } else { $message = '<div style="color: #dd0221; background: #ffd3d9; padding: 0.2em 0.7em; font-family: sans-serif; font-size: 0.8em;">' . get_string('europassexportservererror', 'artefact.europass') . '</div>'; } print_r($message); } else { // Send the header here - download generated file switch ($fileformat) { case 'pdf':