95                 return "background.jpg";
 
  115                 return $this->
getAdapter()->getCertificatePath() . 
"background_upload";
 
  135                 return "certificate.xml";
 
  145                 return "certificate.xml";
 
  156                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  169                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  206                 $certificatepath = $this->
getAdapter()->getCertificatePath();
 
  208                 $new_xsl = $newObject->getXSLPath();
 
  209                 $new_bgimage = $newObject->getBackgroundImagePath();
 
  210                 $new_bgimagethumb = $newObject->getBackgroundImageThumbPath();
 
  211                 $new_certificatepath = $newObject->getAdapter()->getCertificatePath();
 
  213                 if (@file_exists($xsl))
 
  216                         @copy($xsl, $new_xsl);
 
  217                         if (@file_exists($bgimage)) @copy($bgimage, $new_bgimage);
 
  218                         if (@file_exists($bgimagethumb)) @copy($bgimagethumb, $new_bgimagethumb);
 
  229                 if (@file_exists($this->
getAdapter()->getCertificatePath()))
 
  231                         include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  245                         $xslfo = file_get_contents($this->
getXSLPath());
 
  249                 if (preg_match(
"/page-width\=\"([^\"]+)\"/", $xslfo, $matches))
 
  251                         $pagewidth = $matches[1];
 
  253                 $pageheight = 
"29.7cm";
 
  254                 if (preg_match(
"/page-height\=\"([^\"]+)\"/", $xslfo, $matches))
 
  256                         $pageheight = $matches[1];
 
  258                 $certificatesettings = 
new ilSetting(
"certificate");
 
  259                 $pagesize = $certificatesettings->get(
"pageformat");;
 
  260                 if (((strcmp($pageheight, 
"29.7cm") == 0) || (strcmp($pageheight, 
"297mm") == 0)) && ((strcmp($pagewidth, 
"21cm") == 0) || (strcmp($pagewidth, 
"210mm") == 0)))
 
  264                 else if (((strcmp($pagewidth, 
"29.7cm") == 0) || (strcmp($pagewidth, 
"297mm") == 0)) && ((strcmp($pageheight, 
"21cm") == 0) || (strcmp($pageheight, 
"210mm") == 0)))
 
  266                         $pagesize = 
"a4landscape";
 
  268                 else if (((strcmp($pageheight, 
"21cm") == 0) || (strcmp($pageheight, 
"210mm") == 0)) && ((strcmp($pagewidth, 
"14.8cm") == 0) || (strcmp($pagewidth, 
"148mm") == 0)))
 
  272                 else if (((strcmp($pagewidth, 
"21cm") == 0) || (strcmp($pagewidth, 
"210mm") == 0)) && ((strcmp($pageheight, 
"14.8cm") == 0) || (strcmp($pageheight, 
"148mm") == 0)))
 
  274                         $pagesize = 
"a5landscape";
 
  276                 else if (((strcmp($pageheight, 
"11in") == 0)) && ((strcmp($pagewidth, 
"8.5in") == 0)))
 
  278                         $pagesize = 
"letter";
 
  280                 else if (((strcmp($pagewidth, 
"11in") == 0)) && ((strcmp($pageheight, 
"8.5in") == 0)))
 
  282                         $pagesize = 
"letterlandscape";
 
  286                         $pagesize = 
"custom";
 
  288                 if (!strlen($xslfo)) $pagesize = $certificatesettings->get(
"pageformat");;
 
  291                 if (preg_match(
"/padding-top\=\"([^\"]+)\"/", $xslfo, $matches))
 
  293                         $paddingtop = $matches[1];
 
  295                 $marginbody_top = 
"0cm";
 
  296                 $marginbody_right = 
"2cm";
 
  297                 $marginbody_bottom = 
"0cm";
 
  298                 $marginbody_left = 
"2cm";
 
  299                 if(preg_match(
"/fo:flow[^>]*margin\=\"([^\"]+)\"/", $xslfo, $matches))
 
  302                         $marginbody = $matches[1];
 
  303                         if (preg_match_all(
"/([^\s]+)/", $marginbody, $matches))
 
  305                                 $marginbody_top = $matches[1][0];
 
  306                                 $marginbody_right = $matches[1][1];
 
  307                                 $marginbody_bottom = $matches[1][2];
 
  308                                 $marginbody_left = $matches[1][3];
 
  311                 else if(preg_match(
"/fo:region-body[^>]*margin\=\"([^\"]+)\"/", $xslfo, $matches))
 
  313                         $marginbody = $matches[1];
 
  314                         if (preg_match_all(
"/([^\s]+)/", $marginbody, $matches))
 
  316                                 $marginbody_top = $matches[1][0];
 
  317                                 $marginbody_right = $matches[1][1];
 
  318                                 $marginbody_bottom = $matches[1][2];
 
  319                                 $marginbody_left = $matches[1][3];
 
  323                 $xsl = file_get_contents(
"./Services/Certificate/xml/fo2xhtml.xsl");
 
  324                 if ((strlen($xslfo)) && (strlen($xsl)))
 
  326                         $args = array( 
'/_xml' => $xslfo, 
'/_xsl' => $xsl );
 
  328                         $output = 
xslt_process($xh, 
"arg:/_xml", 
"arg:/_xsl", NULL, $args, NULL);
 
  333                 $output = preg_replace(
"/<\?xml[^>]+?>/", 
"", $output);
 
  336                 $output = str_replace(
" ", 
"<br />", $output);
 
  337                 $output = str_replace(
" ", 
"<br />", $output);
 
  338                 $form_fields = array(
 
  339                         "pageformat" => $pagesize,
 
  340                         "pagewidth" => $pagewidth,
 
  341                         "pageheight" => $pageheight,
 
  342                         "padding_top" => $paddingtop,
 
  343                         "margin_body_top" => $marginbody_top,
 
  344                         "margin_body_right" => $marginbody_right,
 
  345                         "margin_body_bottom" => $marginbody_bottom,
 
  346                         "margin_body_left" => $marginbody_left,
 
  347                         "certificate_text" => $output
 
  349                 $this->
getAdapter()->addFormFieldsFromObject($form_fields);
 
  361                 $content = 
"<html><body>".$form_data[
"certificate_text"].
"</body></html>";
 
  362                 $content = preg_replace(
"/<p>( ){1,}<\\/p>/", 
"<p></p>", $content);
 
  363                 $content = preg_replace(
"/<p>(\\s)*?<\\/p>/", 
"<p></p>", $content);
 
  366                 $content = str_replace(
"<p></p>", 
"<p class=\"emptyrow\"></p>", $content);
 
  367                 $content = str_replace(
" ", 
" ", $content);
 
  368                 $content = preg_replace(
"//", 
"", $content);
 
  370                 include_once 
"./Services/Certificate/classes/class.ilXmlChecker.php";
 
  372                 $check->setXMLContent($content);
 
  373                 $check->startParsing();
 
  374                 if ($check->hasError())
 
  376                         throw new Exception($this->lng->txt(
"certificate_not_well_formed"));
 
  379                 $xsl = file_get_contents(
"./Services/Certificate/xml/xhtml2fo.xsl");
 
  383                                 'font-family="Helvetica, unifont"',
 
  384                                 'font-family="'.
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont').
'"',
 
  388                 $args = array( 
'/_xml' => $content, 
'/_xsl' => $xsl );
 
  390                 if (strcmp($form_data[
"pageformat"], 
"custom") == 0)
 
  392                         $pageheight = $form_data[
"pageheight"];
 
  393                         $pagewidth = $form_data[
"pagewidth"];
 
  398                         $pageheight = $pageformats[$form_data[
"pageformat"]][
"height"];
 
  399                         $pagewidth = $pageformats[$form_data[
"pageformat"]][
"width"];
 
  401                 include_once 
"./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
 
  404                         "pageheight" => $pageheight, 
 
  405                         "pagewidth" => $pagewidth,
 
  406                         "backgroundimage" => $backgroundimage,
 
  407                         "marginbody" => $form_data[
"margin_body_top"] . 
" " . $form_data[
"margin_body_right"] . 
" " . $form_data[
"margin_body_bottom"] . 
" " . $form_data[
"margin_body_left"],
 
  408                         "paddingtop" => $form_data[
"padding_top"]
 
  410                 $output = 
xslt_process($xh, 
"arg:/_xml", 
"arg:/_xsl", NULL, $args, $params);
 
  425                 if (count($insert_tags) == 0)
 
  427                         $insert_tags = $this->
getAdapter()->getCertificateVariablesForPreview();
 
  429                         foreach (self::getCustomCertificateFields() as $k => $f)
 
  431                                 $insert_tags[$f[
"ph"]] = $f[
"name"];
 
  434                 foreach ($insert_tags as $var => $value)
 
  436                         $certificate_text = str_replace($var, $value, $certificate_text);
 
  438                 return $certificate_text;
 
  450                 $insert_tags = $this->
getAdapter()->getCertificateVariablesForPresentation($params);
 
  452                 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
 
  454                 $cust_data = $cust_data->getAll();
 
  455                 foreach (self::getCustomCertificateFields() as $k => $f)
 
  457                         $insert_tags[$f[
"ph"]] = $cust_data[
"f_".$k];
 
  460                 $xslfo = file_get_contents($this->
getXSLPath());
 
  462                 include_once 
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
 
  469                                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  470                                 ilUtil::deliverData($pdf_base64->scalar, $this->getAdapter()->getCertificateFilename($params), 
"application/pdf");
 
  474                                 return $pdf_base64->scalar;
 
  479                         $ilLog->write(__METHOD__.
': '.$e->getMessage());
 
  484                         $ilLog->write(__METHOD__.
': '.$e->getMessage());
 
  516                 $xslfo = file_get_contents($this->
getXSLPath());
 
  518                 include_once 
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
 
  523                         ilUtil::deliverData($pdf_base64->scalar, $this->getAdapter()->getCertificateFilename(), 
"application/pdf");
 
  528                         $ilLog->write(__METHOD__.
': '.$e->getMessage());
 
  533                         $ilLog->write(__METHOD__.
': '.$e->getMessage());
 
  556                 if (!file_exists($this->
getAdapter()->getCertificatePath()))
 
  578                 if (!empty($image_tempfilename))
 
  580                         $image_filename = 
"background_upload";
 
  582                         $imagepath = $this->
getAdapter()->getCertificatePath();
 
  583                         if (!file_exists($imagepath))
 
  638                         $obj_id = $this->
getAdapter()->getCertificateID();
 
  639                         if($obj_id && !self::isObjectActive($obj_id))
 
  643                         if (file_exists($this->
getAdapter()->getCertificatePath()))
 
  666                                 $obj_id = 
$adapter->getCertificateID();
 
  667                                 if($obj_id && !self::isObjectActive($obj_id))
 
  672                                 $certificatepath = 
$adapter->getCertificatePath();
 
  673                                 if (file_exists($certificatepath))
 
  676                                         if (file_exists($xslpath) && (filesize($xslpath) > 0))
 
  695                                 "name" => $this->lng->txt(
"certificate_a4"), 
 
  700                         "a4landscape" => array(
 
  701                                 "name" => $this->lng->txt(
"certificate_a4_landscape"), 
 
  702                                 "value" => 
"a4landscape",
 
  707                                 "name" => $this->lng->txt(
"certificate_a5"), 
 
  712                         "a5landscape" => array(
 
  713                                 "name" => $this->lng->txt(
"certificate_a5_landscape"), 
 
  714                                 "value" => 
"a5landscape",
 
  719                                 "name" => $this->lng->txt(
"certificate_letter"), 
 
  724                         "letterlandscape" => array(
 
  725                                 "name" => $this->lng->txt(
"certificate_letter_landscape"), 
 
  726                                 "value" => 
"letterlandscape",
 
  731                                 "name" => $this->lng->txt(
"certificate_custom"),
 
  744                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  747                 $xsl = file_get_contents($this->
getXSLPath());
 
  748                 $xslexport = str_replace($this->
getAdapter()->getCertificatePath(), 
"", $xsl);
 
  758                         include_once 
"./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
 
  764                 $zipfile = time() . 
"__" . IL_INST_ID . 
"__" . $this->
getAdapter()->getAdapterType() . 
"__" . $this->
getAdapter()->getCertificateId() . 
"__certificate.zip";
 
  777                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  785                 $subdir = str_replace(
".zip", 
"", strtolower($filename)) . 
"/";
 
  787                 if (is_dir($importpath . $subdir))
 
  790                         $copydir = $importpath . $subdir;
 
  795                         $copydir = $importpath;
 
  799                 foreach ($dirinfo as 
$file)
 
  801                         if (strcmp($file[
"type"], 
"file") == 0)
 
  803                                 if (strpos($file[
"entry"], 
".xml") !== FALSE) 
 
  807                                 else if (strpos($file[
"entry"], 
".zip") !== FALSE)
 
  819                         foreach ($dirinfo as $file)
 
  821                                 if (strcmp($file[
"type"], 
"file") == 0)
 
  823                                         if (strpos($file[
"entry"], 
".xml") !== FALSE) 
 
  825                                                 $xsl = file_get_contents($copydir . $file[
"entry"]);
 
  828                                                 $xsl = preg_replace(
"/url\([']{0,1}(.*?)[']{0,1}\)/", 
"url(" . $this->
getAdapter()->getCertificatePath() . 
"\${1})", $xsl);
 
  831                                         else if (strpos($file[
"entry"], 
".zip") !== FALSE)
 
  836                                                 @copy($copydir . $file[
"entry"], $this->
getAdapter()->getCertificatePath() . $file[
"entry"]);