Example #1
0
 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
 {
     global $ilSetting, $ilUser;
     $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
     if ($lg && $this->ref_id && ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId())) {
         // certificate
         include_once "Services/Certificate/classes/class.ilCertificate.php";
         if (ilCertificate::isActive() && ilCertificate::isObjectActive($this->object->getId()) && ilCourseParticipants::getDateTimeOfPassed($this->object->getId(), $ilUser->getId())) {
             $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
             $this->lng->loadLanguageModule("certificate");
             $lg->addCustomCommand($cert_url, "download_certificate");
             $lg->addHeaderIcon("cert_icon", ilUtil::getImagePath("icon_cert.svg"), $this->lng->txt("download_certificate"), null, null, $cert_url);
         }
         // notification
         if ($ilSetting->get("crsgrp_ntf")) {
             if (!$ilUser->getPref("grpcrs_ntf_" . $this->ref_id)) {
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.svg"), $this->lng->txt("crs_notification_deactivated"));
                 $this->ctrl->setParameter($this, "crs_ntf", 1);
                 $caption = "crs_activate_notification";
             } else {
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.svg"), $this->lng->txt("crs_notification_activated"));
                 $this->ctrl->setParameter($this, "crs_ntf", 0);
                 $caption = "crs_deactivate_notification";
             }
             $lg->addCustomCommand($this->ctrl->getLinkTarget($this, "saveNotification"), $caption);
             $this->ctrl->setParameter($this, "crs_ntf", "");
         }
     }
     return $lg;
 }