예제 #1
0
 /**
  * @param LearningMaterialInterface $learningMaterial
  * @return string
  */
 protected function getTextForLearningMaterial(LearningMaterialInterface $learningMaterial)
 {
     $text = $this->purify($learningMaterial->getTitle()) . ' ';
     if ($citation = $learningMaterial->getCitation()) {
         $text .= $this->purify($citation);
     } elseif ($link = $learningMaterial->getLink()) {
         $text .= $this->purify($link);
     } else {
         $uri = $this->generateUrl('ilios_core_downloadlearningmaterial', array('token' => $learningMaterial->getToken()), UrlGeneratorInterface::ABSOLUTE_URL);
         $text .= $uri;
     }
     return $text;
 }
 /**
  * @param LearningMaterialInterface $learningMaterial
  * @param Router $router
  */
 public function __construct(LearningMaterialInterface $learningMaterial, Router $router)
 {
     if ($learningMaterial->getFilename()) {
         $link = $router->generate('ilios_core_downloadlearningmaterial', ['token' => $learningMaterial->getToken()], UrlGenerator::ABSOLUTE_URL);
         $this->absoluteFileUri = $link;
     }
     $this->id = $learningMaterial->getId();
     $this->title = $learningMaterial->getTitle();
     $this->description = $learningMaterial->getDescription();
     $this->uploadDate = $learningMaterial->getUploadDate();
     $this->originalAuthor = $learningMaterial->getOriginalAuthor();
     $this->userRole = (string) $learningMaterial->getUserRole();
     $this->status = (string) $learningMaterial->getStatus();
     $this->owningUser = (string) $learningMaterial->getOwningUser();
     $this->citation = $learningMaterial->getCitation();
     $this->copyrightPermission = $learningMaterial->hasCopyrightPermission();
     $this->copyrightRationale = $learningMaterial->getCopyrightRationale();
     $this->mimetype = $learningMaterial->getMimetype();
     $this->filesize = $learningMaterial->getFilesize();
     $this->filename = $learningMaterial->getFilename();
     $this->link = $learningMaterial->getLink();
     $courseLearningMaterialIds = $learningMaterial->getCourseLearningMaterials()->map(function (CourseLearningMaterialInterface $lm) {
         return (string) $lm;
     });
     $this->courseLearningMaterials = $courseLearningMaterialIds->toArray();
     $sessionLearningMaterialIds = $learningMaterial->getSessionLearningMaterials()->map(function (SessionLearningMaterialInterface $lm) {
         return (string) $lm;
     });
     $this->sessionLearningMaterials = $sessionLearningMaterialIds->toArray();
 }