* * @ORM\ManyToMany(targetEntity="H5pImport", inversedBy="libraries") * * @ORM\JoinTable( * name="plugin_h5p_import_rel_libraries", * joinColumns={@ORM\JoinColumn(name="h5p_import_library_id", referencedColumnName="iid", onDelete="CASCADE")}, * inverseJoinColumns={@ORM\JoinColumn(name="h5p_import_id", referencedColumnName="iid", onDelete="CASCADE")} * ) */ private $h5pImports; /** * @var Course * * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course") * * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false) */ private $course; public function __construct() { $this->h5pImports = new ArrayCollection(); } public function getIid(): int { return $this->iid; } public function setIid(int $iid): H5pImportLibrary { $this->iid = $iid; return $this; } public function getMachineName(): string { return $this->machineName; } public function setMachineName(string $machineName): H5pImportLibrary { $this->machineName = $machineName; return $this; } public function getTitle(): string { return $this->title; } public function setTitle(string $title): H5pImportLibrary { $this->title = $title; return $this; } public function getMajorVersion(): int { return $this->majorVersion; } public function setMajorVersion(int $majorVersion): H5pImportLibrary { $this->majorVersion = $majorVersion; return $this; } public function getMinorVersion(): int { return $this->minorVersion; } public function setMinorVersion(int $minorVersion): H5pImportLibrary { $this->minorVersion = $minorVersion; return $this; } public function getPatchVersion(): int { return $this->patchVersion; } public function setPatchVersion(int $patchVersion): H5pImportLibrary { $this->patchVersion = $patchVersion; return $this; } public function getRunnable(): int { return $this->runnable; } public function setRunnable(?int $runnable): H5pImportLibrary { $this->runnable = $runnable; return $this; } /** * @return array */ public function getPreloadedJs(): ?array { return $this->preloadedJs; } public function setPreloadedJs(?array $preloadedJs): H5pImportLibrary { $this->preloadedJs = $preloadedJs; return $this; } /** * @return array */ public function getPreloadedCss(): ?array { return $this->preloadedCss; } public function setPreloadedCss(?array $preloadedCss): H5pImportLibrary { $this->preloadedCss = $preloadedCss; return $this; } public function getEmbedTypes(): ?array { return $this->embedTypes; } public function setEmbedTypes(?array $embedTypes): H5pImportLibrary { $this->embedTypes = $embedTypes; return $this; } public function getLibraryPath(): string { return $this->libraryPath; } public function setLibraryPath(string $libraryPath): H5pImportLibrary { $this->libraryPath = $libraryPath; return $this; } public function addH5pImport(H5pImport $h5pImport): self { if (!$this->h5pImports->contains($h5pImport)) { $this->h5pImports[] = $h5pImport; } return $this; } public function removeH5pImport(H5pImport $h5pImport): self { $this->h5pImports->removeElement($h5pImport); return $this; } public function getH5pImports(): Collection { return $this->h5pImports; } public function getCourse(): Course { return $this->course; } public function setCourse(Course $course): self { $this->course = $course; return $this; } public function getCreatedAt(): DateTime { return $this->createdAt; } public function setCreatedAt(DateTime $createdAt): H5pImportLibrary { $this->createdAt = $createdAt; return $this; } public function getModifiedAt(): DateTime { return $this->modifiedAt; } public function setModifiedAt(DateTime $modifiedAt): H5pImportLibrary { $this->modifiedAt = $modifiedAt; return $this; } public function getLibraryByMachineNameAndVersions(string $machineName, int $majorVersion, int $minorVersion) { if ( $this->machineName === $machineName && $this->majorVersion === $majorVersion && $this->minorVersion === $minorVersion ) { return $this; } return false; } /** * Get the preloaded JS array of the imported library formatted as a comma-separated string. * * @return string the preloaded JS array of the imported library formatted as a comma-separated string */ public function getPreloadedJsFormatted(): string { $formattedJs = []; foreach ($this->preloadedJs as $value) { if (is_string($value->path)) { $formattedJs[] = $value->path; } } return implode(',', $formattedJs); } /** * Get the preloaded CSS array of the imported library formatted as a comma-separated string. * * @return string the preloaded CSS array of the imported library formatted as a comma-separated string */ public function getPreloadedCssFormatted(): string { $formattedJCss = []; foreach ($this->preloadedCss as $value) { if (is_string($value->path)) { $formattedJCss[] = $value->path; } } return implode(',', $formattedJCss); } /** * Get the embed types array formatted as a comma-separated string. * * @return string the embed types array formatted as a comma-separated string */ public function getEmbedTypesFormatted(): string { return implode(',', $this->getEmbedTypes()); } }