ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCertificate.php
Go to the documentation of this file.
1 <?php
2  /*
3  +----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +----------------------------------------------------------------------------+
22 */
23 
34 {
40  protected $ctrl;
41 
47  protected $tree;
48 
54  protected $ilias;
55 
61  protected $tpl;
62 
68  protected $lng;
69 
75  protected $adapter;
76 
83  {
84  global $lng, $tpl, $ilCtrl, $ilias, $tree;
85 
86  $this->lng =& $lng;
87  $this->tpl =& $tpl;
88  $this->ctrl =& $ilCtrl;
89  $this->ilias =& $ilias;
90  $this->tree =& $tree;
91  $this->adapter =& $adapter;
92  }
93 
99  public function getBackgroundImagePath()
100  {
101  return $this->getAdapter()->getCertificatePath() . $this->getBackgroundImageName();
102  }
103 
109  public function getBackgroundImageName()
110  {
111  return "background.jpg";
112  }
113 
119  public function getBackgroundImageThumbPath()
120  {
121  return $this->getAdapter()->getCertificatePath() . $this->getBackgroundImageName() . ".thumb.jpg";
122  }
123 
130  {
131  return $this->getAdapter()->getCertificatePath() . "background_upload";
132  }
133 
139  public function getXSLPath()
140  {
141  return $this->getAdapter()->getCertificatePath() . $this->getXSLName();
142  }
143 
149  function getXSLName()
150  {
151  return "certificate.xml";
152  }
153 
159  public static function _getXSLName()
160  {
161  return "certificate.xml";
162  }
163 
169  public function getBackgroundImagePathWeb()
170  {
171  // TODO: this is generic now -> provide better solution
172  include_once "./Services/Utilities/classes/class.ilUtil.php";
173  $webdir = $this->getAdapter()->getCertificatePath() . $this->getBackgroundImageName();
175  }
176 
183  {
184  // TODO: this is generic now -> provide better solution
185  include_once "./Services/Utilities/classes/class.ilUtil.php";
187  }
188 
194  public function deleteBackgroundImage()
195  {
196  $result = TRUE;
197  if (file_exists($this->getBackgroundImageThumbPath()))
198  {
199  $result = $result & unlink($this->getBackgroundImageThumbPath());
200  }
201  if (file_exists($this->getBackgroundImagePath()))
202  {
203  $result = $result & unlink($this->getBackgroundImagePath());
204  }
205  if (file_exists($this->getBackgroundImageTempfilePath()))
206  {
207  $result = $result & unlink($this->getBackgroundImageTempfilePath());
208  }
209  return $result;
210  }
211 
217  public function cloneCertificate($newObject)
218  {
219  $xsl = $this->getXSLPath();
220  $bgimage = $this->getBackgroundImagePath();
221  $bgimagethumb = $this->getBackgroundImageThumbPath();
222  $certificatepath = $this->getAdapter()->getCertificatePath();
223 
224  $new_xsl = $newObject->getXSLPath();
225  $new_bgimage = $newObject->getBackgroundImagePath();
226  $new_bgimagethumb = $newObject->getBackgroundImageThumbPath();
227  $new_certificatepath = $newObject->getAdapter()->getCertificatePath();
228 
229  if (@file_exists($xsl))
230  {
231  ilUtil::makeDirParents($new_certificatepath);
232  @copy($xsl, $new_xsl);
233  if (@file_exists($bgimage)) @copy($bgimage, $new_bgimage);
234  if (@file_exists($bgimagethumb)) @copy($bgimagethumb, $new_bgimagethumb);
235  }
236  }
237 
243  public function deleteCertificate()
244  {
245  if (@file_exists($this->getAdapter()->getCertificatePath()))
246  {
247  include_once "./Services/Utilities/classes/class.ilUtil.php";
248  ilUtil::delDir($this->getAdapter()->getCertificatePath());
249  $this->getAdapter()->deleteCertificate();
250  }
251  }
252 
256  public function getFormFieldsFromFO()
257  {
258  if (@file_exists($this->getXSLPath()))
259  {
260  $xslfo = file_get_contents($this->getXSLPath());
261  }
262  // retrieve form information (using a dirty way with regular expressions)
263  $pagewidth = "21cm";
264  if (preg_match("/page-width\=\"([^\"]+)\"/", $xslfo, $matches))
265  {
266  $pagewidth = $matches[1];
267  }
268  $pageheight = "29.7cm";
269  if (preg_match("/page-height\=\"([^\"]+)\"/", $xslfo, $matches))
270  {
271  $pageheight = $matches[1];
272  }
273  $certificatesettings = new ilSetting("certificate");
274  $pagesize = $certificatesettings->get("pageformat");;
275  if (((strcmp($pageheight, "29.7cm") == 0) || (strcmp($pageheight, "297mm") == 0)) && ((strcmp($pagewidth, "21cm") == 0) || (strcmp($pagewidth, "210mm") == 0)))
276  {
277  $pagesize = "a4";
278  }
279  else if (((strcmp($pagewidth, "29.7cm") == 0) || (strcmp($pagewidth, "297mm") == 0)) && ((strcmp($pageheight, "21cm") == 0) || (strcmp($pageheight, "210mm") == 0)))
280  {
281  $pagesize = "a4landscape";
282  }
283  else if (((strcmp($pageheight, "21cm") == 0) || (strcmp($pageheight, "210mm") == 0)) && ((strcmp($pagewidth, "14.8cm") == 0) || (strcmp($pagewidth, "148mm") == 0)))
284  {
285  $pagesize = "a5";
286  }
287  else if (((strcmp($pagewidth, "21cm") == 0) || (strcmp($pagewidth, "210mm") == 0)) && ((strcmp($pageheight, "14.8cm") == 0) || (strcmp($pageheight, "148mm") == 0)))
288  {
289  $pagesize = "a5landscape";
290  }
291  else if (((strcmp($pageheight, "11in") == 0)) && ((strcmp($pagewidth, "8.5in") == 0)))
292  {
293  $pagesize = "letter";
294  }
295  else if (((strcmp($pagewidth, "11in") == 0)) && ((strcmp($pageheight, "8.5in") == 0)))
296  {
297  $pagesize = "letterlandscape";
298  }
299  if (!strlen($xslfo)) $pagesize = $certificatesettings->get("pageformat");;
300 
301  $paddingtop = "0cm";
302  if (preg_match("/padding-top\=\"([^\"]+)\"/", $xslfo, $matches))
303  {
304  $paddingtop = $matches[1];
305  }
306  $marginbody_top = "0cm";
307  $marginbody_right = "2cm";
308  $marginbody_bottom = "0cm";
309  $marginbody_left = "2cm";
310  if (preg_match("/fo:flow[^>]*margin\=\"([^\"]+)\"/", $xslfo, $matches))
311  {
312  $marginbody = $matches[1];
313  if (preg_match_all("/([^\s]+)/", $marginbody, $matches))
314  {
315  $marginbody_top = $matches[1][0];
316  $marginbody_right = $matches[1][1];
317  $marginbody_bottom = $matches[1][2];
318  $marginbody_left = $matches[1][3];
319  }
320  }
321 
322  $xsl = file_get_contents("./Services/Certificate/xml/fo2xhtml.xsl");
323  if ((strlen($xslfo)) && (strlen($xsl)))
324  {
325  $args = array( '/_xml' => $xslfo, '/_xsl' => $xsl );
326  $xh = xslt_create();
327  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL);
328  xslt_error($xh);
329  xslt_free($xh);
330  }
331 
332  $output = preg_replace("/<\?xml[^>]+?>/", "", $output);
333  // dirty hack: the php xslt processing seems not to recognize the following
334  // replacements, so we do it in the code as well
335  $output = str_replace("&#xA0;", "<br />", $output);
336  $output = str_replace("&#160;", "<br />", $output);
337  $form_fields = array(
338  "pageformat" => $pagesize,
339  "pagewidth" => $pagewidth,
340  "pageheight" => $pageheight,
341  "padding_top" => $paddingtop,
342  "margin_body_top" => $marginbody_top,
343  "margin_body_right" => $marginbody_right,
344  "margin_body_bottom" => $marginbody_bottom,
345  "margin_body_left" => $marginbody_left,
346  "certificate_text" => $output
347  );
348  $this->getAdapter()->addFormFieldsFromObject($form_fields);
349  return $form_fields;
350  }
351 
358  public function processXHTML2FO($form_data, $for_export = FALSE)
359  {
360  $content = "<html><body>".$form_data["certificate_text"]."</body></html>";
361  $content = preg_replace("/<p>(&nbsp;){1,}<\\/p>/", "<p></p>", $content);
362  $content = preg_replace("/<p>(\\s)*?<\\/p>/", "<p></p>", $content);
363 // $content = str_replace("<p>&nbsp;</p>", "<p><br /></p>", $content);
364 // $content = str_replace("<p> </p>", "<p><br /></p>", $content);
365  $content = str_replace("<p></p>", "<p class=\"emptyrow\"></p>", $content);
366  $content = str_replace("&nbsp;", "&#160;", $content);
367  $content = preg_replace("//", "", $content);
368 
369  include_once "./Services/Certificate/classes/class.ilXmlChecker.php";
370  $check = new ilXMLChecker();
371  $check->setXMLContent($content);
372  $check->startParsing();
373  if ($check->hasError())
374  {
375  throw new Exception($this->lng->txt("certificate_not_well_formed"));
376  }
377 
378  $xsl = file_get_contents("./Services/Certificate/xml/xhtml2fo.xsl");
379  $args = array( '/_xml' => $content, '/_xsl' => $xsl );
380  $xh = xslt_create();
381  if (strcmp($form_data["pageformat"], "custom") == 0)
382  {
383  $pageheight = $form_data["pageheight"];
384  $pagewidth = $form_data["pagewidth"];
385  }
386  else
387  {
388  $pageformats = $this->getPageFormats();
389  $pageheight = $pageformats[$form_data["pageformat"]]["height"];
390  $pagewidth = $pageformats[$form_data["pageformat"]]["width"];
391  }
392  include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
394  $params = array(
395  "pageheight" => $pageheight,
396  "pagewidth" => $pagewidth,
397  "backgroundimage" => $backgroundimage,
398  "marginbody" => $form_data["margin_body_top"] . " " . $form_data["margin_body_right"] . " " . $form_data["margin_body_bottom"] . " " . $form_data["margin_body_left"],
399  "paddingtop" => $form_data["padding_top"]
400  );
401  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
402  xslt_error($xh);
403  xslt_free($xh);
404  return $output;
405  }
406 
414  private function exchangeCertificateVariables($certificate_text, $insert_tags = array())
415  {
416  if (count($insert_tags) == 0)
417  {
418  $insert_tags = $this->getAdapter()->getCertificateVariablesForPreview();
419  }
420  foreach ($insert_tags as $var => $value)
421  {
422  $certificate_text = str_replace($var, $value, $certificate_text);
423  }
424  return $certificate_text;
425  }
426 
432  public function outCertificate($params, $deliver = TRUE)
433  {
434  global $ilLog;
435 
436  $insert_tags = $this->getAdapter()->getCertificateVariablesForPresentation($params);
437  $xslfo = file_get_contents($this->getXSLPath());
438 
439  include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
440  try
441  {
442  $pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF(
443  $this->exchangeCertificateVariables($xslfo, $insert_tags));
444  if ($deliver)
445  {
446  include_once "./Services/Utilities/classes/class.ilUtil.php";
447  ilUtil::deliverData($pdf_base64->scalar, $this->getAdapter()->getCertificateFilename($params), "application/pdf");
448  }
449  else
450  {
451  return $pdf_base64->scalar;
452  }
453  }
454  catch(XML_RPC2_FaultException $e)
455  {
456  $ilLog->write(__METHOD__.': '.$e->getMessage());
457  return false;
458  }
459  catch(Exception $e)
460  {
461  $ilLog->write(__METHOD__.': '.$e->getMessage());
462  return false;
463  }
464 
465  /*
466  include_once "./Services/Transformation/classes/class.ilFO2PDF.php";
467  $fo2pdf = new ilFO2PDF();
468  $fo2pdf->setFOString($this->exchangeCertificateVariables($xslfo, $insert_tags));
469  $result = $fo2pdf->send();
470  if ($deliver)
471  {
472  include_once "./Services/Utilities/classes/class.ilUtil.php";
473  ilUtil::deliverData($result, $this->getAdapter()->getCertificateFilename($params), "application/pdf");
474  }
475  else
476  {
477  return $result;
478  }
479  */
480  }
481 
485  public function createPreview()
486  {
487  global $ilLog;
488 
489  $xslfo = file_get_contents($this->getXSLPath());
490 
491  include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
492  try
493  {
494  $pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF(
495  $this->exchangeCertificateVariables($xslfo));
496  ilUtil::deliverData($pdf_base64->scalar, $this->getAdapter()->getCertificateFilename(), "application/pdf");
497 
498  }
499  catch(XML_RPC2_FaultException $e)
500  {
501  $ilLog->write(__METHOD__.': '.$e->getMessage());
502  return false;
503  }
504  catch(Exception $e)
505  {
506  $ilLog->write(__METHOD__.': '.$e->getMessage());
507  return false;
508  }
509 
510  /*
511  include_once "./Services/Transformation/classes/class.ilFO2PDF.php";
512  $fo2pdf = new ilFO2PDF();
513  $fo2pdf->setFOString($this->exchangeCertificateVariables($xslfo));
514  $result = $fo2pdf->send();
515  include_once "./Services/Utilities/classes/class.ilUtil.php";
516  ilUtil::deliverData($result, $this->getAdapter()->getCertificateFilename(), "application/pdf");
517  */
518  }
519 
525  public function saveCertificate($xslfo, $filename = "")
526  {
527  if (!file_exists($this->getAdapter()->getCertificatePath()))
528  {
529  ilUtil::makeDirParents($this->getAdapter()->getCertificatePath());
530  }
531  if (strlen($filename) == 0)
532  {
533  $filename = $this->getXSLPath();
534  }
535  $fh = fopen($filename, "w");
536  fwrite($fh, $xslfo);
537  fclose($fh);
538  }
539 
547  public function uploadBackgroundImage($image_tempfilename)
548  {
549  if (!empty($image_tempfilename))
550  {
551  $image_filename = "background_upload";
552  $convert_filename = $this->getBackgroundImageName();
553  $imagepath = $this->getAdapter()->getCertificatePath();
554  if (!file_exists($imagepath))
555  {
556  ilUtil::makeDirParents($imagepath);
557  }
558  // upload the file
559  if (!ilUtil::moveUploadedFile($image_tempfilename, $image_filename, $this->getBackgroundImageTempfilePath()))
560  {
561  return FALSE;
562  }
563  // convert the uploaded file to JPEG
566  if (!file_exists($this->getBackgroundImagePath()))
567  {
568  // something went wrong converting the file. use the original file and hope, that PDF can work with it
569  if (!ilUtil::moveUploadedFile($this->getBackgroundImageTempfilePath(), $convert_filename, $this->getBackgroundImagePath()))
570  {
571  return FALSE;
572  }
573  }
574  unlink($this->getBackgroundImageTempfilePath());
575  if (file_exists($this->getBackgroundImagePath()) && (filesize($this->getBackgroundImagePath()) > 0))
576  {
577  return TRUE;
578  }
579  }
580  return FALSE;
581  }
582 
588  public function hasBackgroundImage()
589  {
590  if (file_exists($this->getBackgroundImagePath()) && (filesize($this->getBackgroundImagePath()) > 0))
591  {
592  return TRUE;
593  }
594  else
595  {
596  return FALSE;
597  }
598  }
599 
605  public function isComplete()
606  {
607  if (file_exists($this->getAdapter()->getCertificatePath()))
608  {
609  if (file_exists($this->getXSLPath()) && (filesize($this->getXSLPath()) > 0))
610  {
611  return TRUE;
612  }
613  }
614  return FALSE;
615  }
616 
624  {
625  if (is_object($adapter) && method_exists($adapter, "getCertificatePath"))
626  {
627  $certificatepath = $adapter->getCertificatePath();
628  if (file_exists($certificatepath))
629  {
630  $xslpath = $adapter->getCertificatePath() . ilCertificate::_getXSLName();
631  if (file_exists($xslpath) && (filesize($xslpath) > 0))
632  {
633  return TRUE;
634  }
635  }
636  }
637  return FALSE;
638  }
639 
645  public function getPageFormats()
646  {
647  return array(
648  "a4" => array(
649  "name" => $this->lng->txt("certificate_a4"), // (297 mm x 210 mm)
650  "value" => "a4",
651  "width" => "210mm",
652  "height" => "297mm"
653  ),
654  "a4landscape" => array(
655  "name" => $this->lng->txt("certificate_a4_landscape"), // (210 mm x 297 mm)",
656  "value" => "a4landscape",
657  "width" => "297mm",
658  "height" => "210mm"
659  ),
660  "a5" => array(
661  "name" => $this->lng->txt("certificate_a5"), // (210 mm x 148.5 mm)
662  "value" => "a5",
663  "width" => "148mm",
664  "height" => "210mm"
665  ),
666  "a5landscape" => array(
667  "name" => $this->lng->txt("certificate_a5_landscape"), // (148.5 mm x 210 mm)
668  "value" => "a5landscape",
669  "width" => "210mm",
670  "height" => "148mm"
671  ),
672  "letter" => array(
673  "name" => $this->lng->txt("certificate_letter"), // (11 inch x 8.5 inch)
674  "value" => "letter",
675  "width" => "8.5in",
676  "height" => "11in"
677  ),
678  "letterlandscape" => array(
679  "name" => $this->lng->txt("certificate_letter_landscape"), // (11 inch x 8.5 inch)
680  "value" => "letterlandscape",
681  "width" => "8.5in",
682  "height" => "11in"
683  ),
684  "custom" => array(
685  "name" => $this->lng->txt("certificate_custom"),
686  "value" => "custom",
687  "width" => "",
688  "height" => ""
689  )
690  );
691  }
692 
696  public function deliverExportFileXML()
697  {
698  include_once "./Services/Utilities/classes/class.ilUtil.php";
699  $exportpath = $this->createArchiveDirectory();
700  ilUtil::makeDir($exportpath);
701  $xsl = file_get_contents($this->getXSLPath());
702  $xslexport = str_replace($this->getAdapter()->getCertificatePath(), "", $xsl);
703  // save export xsl file
704  $this->saveCertificate($xslexport, $exportpath . $this->getXSLName());
705  // save background image
706  if ($this->hasBackgroundImage())
707  {
708  copy($this->getBackgroundImagePath(), $exportpath . $this->getBackgroundImageName());
709  }
710  else
711  {
712  include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
714  {
716  }
717  }
718  $zipfile = time() . "__" . IL_INST_ID . "__" . $this->getAdapter()->getAdapterType() . "__" . $this->getAdapter()->getCertificateId() . "__certificate.zip";
719  ilUtil::zip($exportpath, $this->getAdapter()->getCertificatePath() . $zipfile);
720  ilUtil::delDir($exportpath);
721  ilUtil::deliverFile($this->getAdapter()->getCertificatePath() . $zipfile, $zipfile, "application/zip");
722  }
723 
729  public function importCertificate($zipfile, $filename)
730  {
731  include_once "./Services/Utilities/classes/class.ilUtil.php";
732  $importpath = $this->createArchiveDirectory();
733  if (!ilUtil::moveUploadedFile($zipfile, $filename, $importpath . $filename))
734  {
735  ilUtil::delDir($importpath);
736  return FALSE;
737  }
738  ilUtil::unzip($importpath . $filename, TRUE);
739  $subdir = str_replace(".zip", "", strtolower($filename)) . "/";
740  $copydir = "";
741  if (is_dir($importpath . $subdir))
742  {
743  $dirinfo = ilUtil::getDir($importpath . $subdir);
744  $copydir = $importpath . $subdir;
745  }
746  else
747  {
748  $dirinfo = ilUtil::getDir($importpath);
749  $copydir = $importpath;
750  }
751  $xmlfiles = 0;
752  $otherfiles = 0;
753  foreach ($dirinfo as $file)
754  {
755  if (strcmp($file["type"], "file") == 0)
756  {
757  if (strpos($file["entry"], ".xml") !== FALSE)
758  {
759  $xmlfiles++;
760  }
761  else if (strpos($file["entry"], ".zip") !== FALSE)
762  {
763  }
764  else
765  {
766  $otherfiles++;
767  }
768  }
769  }
770  // if one XML file is in the archive, we try to import it
771  if ($xmlfiles == 1)
772  {
773  foreach ($dirinfo as $file)
774  {
775  if (strcmp($file["type"], "file") == 0)
776  {
777  if (strpos($file["entry"], ".xml") !== FALSE)
778  {
779  $xsl = file_get_contents($copydir . $file["entry"]);
780  // as long as we cannot make RPC calls in a given directory, we have
781  // to add the complete path to every url
782  $xsl = preg_replace("/url\([']{0,1}(.*?)[']{0,1}\)/", "url(" . $this->getAdapter()->getCertificatePath() . "\${1})", $xsl);
783  $this->saveCertificate($xsl);
784  }
785  else if (strpos($file["entry"], ".zip") !== FALSE)
786  {
787  }
788  else
789  {
790  @copy($copydir . $file["entry"], $this->getAdapter()->getCertificatePath() . $file["entry"]);
791  if (strcmp($this->getBackgroundImagePath(), $this->getAdapter()->getCertificatePath() . $file["entry"]) == 0)
792  {
793  // upload of the background image, create a preview
795  }
796  }
797  }
798  }
799  }
800  else
801  {
802  ilUtil::delDir($importpath);
803  return FALSE;
804  }
805  ilUtil::delDir($importpath);
806  return TRUE;
807  }
808 
814  public function getAdapter()
815  {
816  return $this->adapter;
817  }
818 
824  public function setAdapter($adapter)
825  {
826  $this->adapter =& $adapter;
827  }
828 
829  /***************************************
830  /* BULK CERTIFICATE PROCESSING METHODS *
831  /***************************************
832 
838  public function createArchiveDirectory()
839  {
840  $dir = $this->getAdapter()->getCertificatePath() . time() . "__" . IL_INST_ID . "__" . $this->getAdapter()->getAdapterType() . "__" . $this->getAdapter()->getCertificateId() . "__certificate/";
841  include_once "./Services/Utilities/classes/class.ilUtil.php";
842  ilUtil::makeDirParents($dir);
843  return $dir;
844  }
845 
853  public function addPDFtoArchiveDirectory($pdfdata, $dir, $filename)
854  {
855  $fh = fopen($dir . $filename, "wb");
856  fwrite($fh, $pdfdata);
857  fclose($fh);
858  }
859 
867  public function zipCertificatesInArchiveDirectory($dir, $deliver = TRUE)
868  {
869  $zipfile = time() . "__" . IL_INST_ID . "__" . $this->getAdapter()->getAdapterType() . "__" . $this->getAdapter()->getCertificateId() . "__certificates.zip";
870  ilUtil::zip($dir, $this->getAdapter()->getCertificatePath() . $zipfile);
871  ilUtil::delDir($dir);
872  if ($deliver)
873  {
874  ilUtil::deliverFile($this->getAdapter()->getCertificatePath() . $zipfile, $zipfile, "application/zip");
875  }
876  return $this->getAdapter()->getCertificatePath() . $zipfile;
877  }
878 
884  public static function _goto($ref_id)
885  {
886  global $ilCtrl;
887  include_once "./classes/class.ilObject.php";
888  $type = ilObject::_lookupType($ref_id, true);
889  switch ($type)
890  {
891  case 'sahs':
892  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=".$ref_id.
893  "&cmd=downloadCertificate";
894  ilUtil::redirect($cmd_link);
895  break;
896  case 'tst':
897  default:
898  include_once "./Services/Utilities/classes/class.ilUtil.php";
899  ilUtil::redirect("repository.php?cmd=frameset");
900  break;
901  }
902  }
903 }
904 
905 ?>