ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPdfGenerator Class Reference
+ Collaboration diagram for ilPdfGenerator:

Public Member Functions

 __construct (ilUserCertificateRepository $userCertificateRepository, ilLogger $logger, ilCertificateRpcClientFactoryHelper $rpcHelper=null, ilCertificatePdfFileNameFactory $pdfFileNameFactory=null)
 
 generate (int $userCertificateId)
 
 generateCurrentActiveCertificate (int $userId, int $objId)
 
 generateFileName (int $userId, int $objId)
 

Private Member Functions

 createPDFScalar (ilUserCertificate $certificate)
 

Private Attributes

 $certificateRepository
 
 $logger
 
 $rpcHelper
 
 $scormPdfFilename
 
 $pdfFilenameFactory
 

Detailed Description

Author
Niels Theen nthee.nosp@m.n@da.nosp@m.tabay.nosp@m..de

Definition at line 7 of file class.ilPdfGenerator.php.

Constructor & Destructor Documentation

◆ __construct()

ilPdfGenerator::__construct ( ilUserCertificateRepository  $userCertificateRepository,
ilLogger  $logger,
ilCertificateRpcClientFactoryHelper  $rpcHelper = null,
ilCertificatePdfFileNameFactory  $pdfFileNameFactory = null 
)
Parameters
ilUserCertificateRepository$userCertificateRepository
ilLogger$logger
ilCertificateRpcClientFactoryHelper | null$rpcHelper
ilCertificatePdfFileNameFactory | null$pdfFileNameFactory

Definition at line 40 of file class.ilPdfGenerator.php.

References $logger, and $rpcHelper.

45  {
46  $this->certificateRepository = $userCertificateRepository;
47  $this->logger = $logger;
48 
49  if (null === $rpcHelper) {
50  $rpcHelper = new ilCertificateRpcClientFactoryHelper();
51  }
52  $this->rpcHelper = $rpcHelper;
53 
54  if (null === $pdfFileNameFactory) {
55  $pdfFileNameFactory = new ilCertificatePdfFileNameFactory();
56  }
57  $this->pdfFilenameFactory = $pdfFileNameFactory;
58  }

Member Function Documentation

◆ createPDFScalar()

ilPdfGenerator::createPDFScalar ( ilUserCertificate  $certificate)
private
Parameters
$certificate
Returns
mixed

Definition at line 103 of file class.ilPdfGenerator.php.

References ilUserCertificate\getBackgroundImagePath(), and ilUserCertificate\getCertificateContent().

Referenced by generate(), and generateCurrentActiveCertificate().

103  : string
104  {
105  $certificateContent = $certificate->getCertificateContent();
106 
107  $certificateContent = str_replace(
108  '[BACKGROUND_IMAGE]',
109  '[CLIENT_WEB_DIR]' . $certificate->getBackgroundImagePath(),
110  $certificateContent
111  );
112  $certificateContent = str_replace(
113  '[CLIENT_WEB_DIR]',
114  CLIENT_WEB_DIR,
115  $certificateContent
116  );
117 
118  $pdf_base64 = $this->rpcHelper->ilFO2PDF('RPCTransformationHandler', $certificateContent);
119 
120  return $pdf_base64->scalar;
121  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate()

ilPdfGenerator::generate ( int  $userCertificateId)
Parameters
$userCertificateId
Returns
mixed
Exceptions
ilException

Definition at line 65 of file class.ilPdfGenerator.php.

References $certificate, and createPDFScalar().

66  {
67  $certificate = $this->certificateRepository->fetchCertificate($userCertificateId);
68 
69  return $this->createPDFScalar($certificate);
70  }
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
createPDFScalar(ilUserCertificate $certificate)
+ Here is the call graph for this function:

◆ generateCurrentActiveCertificate()

ilPdfGenerator::generateCurrentActiveCertificate ( int  $userId,
int  $objId 
)
Parameters
$userId
$objId
Returns
mixed
Exceptions
ilException

Definition at line 78 of file class.ilPdfGenerator.php.

References $certificate, and createPDFScalar().

78  : string
79  {
80  $certificate = $this->certificateRepository->fetchActiveCertificate($userId, $objId);
81 
82  return $this->createPDFScalar($certificate);
83  }
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
createPDFScalar(ilUserCertificate $certificate)
+ Here is the call graph for this function:

◆ generateFileName()

ilPdfGenerator::generateFileName ( int  $userId,
int  $objId 
)

Definition at line 85 of file class.ilPdfGenerator.php.

References $certificate, $user, and ilObjectFactory\getInstanceByObjId().

85  : string
86  {
87  $certificate = $this->certificateRepository->fetchActiveCertificateForPresentation($userId, $objId);
88 
90  if (!$user instanceof ilObjUser) {
91  throw new ilException(sprintf('The user_id "%s" does NOT reference a user', $userId));
92  }
93 
94  $pdfFileName = $this->pdfFilenameFactory->create($certificate);
95 
96  return $pdfFileName;
97  }
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
$user
Definition: migrateto20.php:57
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

Field Documentation

◆ $certificateRepository

ilPdfGenerator::$certificateRepository
private

Definition at line 12 of file class.ilPdfGenerator.php.

◆ $logger

ilPdfGenerator::$logger
private

Definition at line 17 of file class.ilPdfGenerator.php.

Referenced by __construct().

◆ $pdfFilenameFactory

ilPdfGenerator::$pdfFilenameFactory
private

Definition at line 32 of file class.ilPdfGenerator.php.

◆ $rpcHelper

ilPdfGenerator::$rpcHelper
private

Definition at line 22 of file class.ilPdfGenerator.php.

Referenced by __construct().

◆ $scormPdfFilename

ilPdfGenerator::$scormPdfFilename
private

Definition at line 27 of file class.ilPdfGenerator.php.


The documentation for this class was generated from the following file: