/** * Parse general placeholders, mostly certificate data * * @param ilObjCourse $course * @return array */ protected function parseGeneralPlaceholders(ilObjCourse $course) { $utc = ilCertificateConfig::get('time_format_utc'); $cert_valid_from = strtotime($this->certificate->getValidFrom()); $cert_valid_to = strtotime($this->certificate->getValidTo()); if ($utc) { // fix for timezone issue: when converting a mysql date into a timestamp and then into another timezone, its possible the date changes (because the start date is the first second of the day). // We now add 12*60*60 seconds to be in the middle of the day $cert_valid_to += srCertificate::TIME_ZONE_CORRECTION; $cert_valid_from += srCertificate::TIME_ZONE_CORRECTION; } $placeholder = array('DATE' => $this->formatDate('DATE'), 'DATETIME' => $this->formatDateTime('DATETIME'), 'TIMESTAMP' => $utc ? strtotime(gmdate('Y-m-d H:i:s')) : time(), 'CERT_FILE_NAME' => $this->certificate->getFilename(), 'CERT_FILE_VERSION' => $this->certificate->getFileVersion(), 'CERT_VALID_FROM' => $this->certificate->getValidFrom() == '' ? $this->pl->txt('unlimited') : $this->formatDate('CERT_VALID_FROM', $cert_valid_from), 'CERT_VALID_TO' => $this->certificate->getValidTo() == '' ? $this->pl->txt('unlimited') : $this->formatDate('CERT_VALID_TO', $cert_valid_to), 'CERT_ID' => $this->certificate->getId(), 'CERT_TEMPLATE_PATH' => $this->certificate->getDefinition()->getType()->getCertificateTemplatesPath(), 'CERT_TYPE_TITLE' => $this->certificate->getDefinition()->getType()->getTitle(), 'CERT_TYPE_DESCRIPTION' => $this->certificate->getDefinition()->getType()->getDescription(), 'COURSE_TITLE' => $course->getTitle()); return $placeholder; }