public function __construct(Dossier $dossier) { $this->setClass('dossier'); $this->addComponent(new Title($dossier->getTitle(), 2)); $author = $dossier->getAuthor(); if ($author instanceof TeamMember) { $author = $author->getPseudo(); } $timestamp = strftime("%d/%m/%Y", $dossier->getTimestamp()); $subtitle = $timestamp . " par " . $author; $this->addComponent(new Title($subtitle, 4)); $content = new SimpleBlockComponent(); $content->setClass('content'); $content->setContent(Format::convertTextToHtml($dossier->getContent())); $content->setContentPinned(true); $this->addComponent($content); $id = $dossier->getCommentID(); $comment = new SimpleTextComponent(); $comment->setClass('comment'); $comment->setContent('~ <a href="http://commentaires.zerofansub.net/t' . $id . '.htm" target="_blank">Commentaires</a> - <a href="http://commentaires.zerofansub.net/posting.php?mode=reply&t=' . $id . '" target="_blank">Ajouter un commentaire</a> ~'); $this->addComponent($comment); }
private function fillWithDownloadData($releaseContent, $release) { $fileList = new SimpleListComponent(); $fileList->setClass("fileList"); $ddlLinks = new GroupedLinks(new Image("images/icones/ddl.png")); $ddlLinks->setClass("ddlLinks"); $megauploadLinks = new GroupedLinks(new Image("images/icones/megaup.jpg")); $megauploadLinks->setClass("megauploadLinks"); $freeLinks = new GroupedLinks(new Image("images/icones/free.jpg")); $freeLinks->setClass("freeLinks"); $rapidShareLinks = new GroupedLinks(new Image("images/icones/rapidshare.jpg")); $rapidShareLinks->setClass("rapidShareLinks"); $mediaFireLinks = new GroupedLinks(new Image("images/icones/mediafire.jpg", "Mediafire")); $mediaFireLinks->setClass("mediaFireLinks"); $torrentLinks = new GroupedLinks(new Link($release->getTorrentUrl(), new Image("images/icones/torrent.png"))); $torrentLinks->setClass("torrentLink"); $fileDescriptors = $release->getFileDescriptors(); $index = 1; foreach ($fileDescriptors as $descriptor) { $description = new SimpleTextComponent(); $path = $descriptor->getFilePath(); $name = basename($path); if (empty($name)) { $name = Debug::createWarningTag("aucun fichier renseigné"); } $description->addLine($name); $url = "ddl/" . $path; $size = "Taille : "; try { $size .= Format::formatSize(filesize($url)); } catch (Exception $e) { $size .= Debug::createWarningTag("inconnue"); } $size .= " "; $description->addComponent($size); if ($descriptor->getCRC() !== null) { $description->addComponent("CRC : " . $descriptor->getCRC() . " "); } $id = null; if ($release->getProject()->isDoujin()) { $pages = ""; if ($descriptor->getPageNumber() != null) { $n = $descriptor->getPageNumber(); $pages = $n . " page" . ($n > 1 ? "s" : null) . " "; } $description->addComponent($pages); } else { $array = array(); if ($descriptor->getVideoCodec() !== null) { $array[] = $descriptor->getVideoCodec()->getName(); if ($id == null) { $id = $descriptor->getVideoCodec()->getName(); } } if ($descriptor->getSoundCodec() !== null) { $array[] = $descriptor->getSoundCodec()->getName(); if ($id == null) { $id = $descriptor->getSoundCodec()->getName(); } } if ($descriptor->getContainerCodec() !== null) { $array[] = $descriptor->getContainerCodec()->getName(); if ($id == null) { $id = $descriptor->getContainerCodec()->getName(); } } $codecs = ""; if (!empty($array)) { $codecs = "Codecs : " . implode(" ", $array) . " "; } $description->addComponent($codecs); } if ($descriptor->getReleaseSource() !== null) { $description->addComponent("Source : " . $descriptor->getReleaseSource() . " "); } if ($descriptor->getID() != null) { $id = $descriptor->getID(); } else { if ($id == null) { $id = $index; } } $index++; if ($descriptor->getComment() !== null) { $description->addLine(); $comment = new SimpleBlockComponent(); $comment->setClass("comment"); $comment->setContent($descriptor->getComment()); $description->addComponent($comment); } $description->addLine(); $description->addLine(); $fileList->addcomponent($description); $linkName = count($fileDescriptors) == 1 ? "Télécharger" : $id; $ddlLinks->addLink(new Link($url, $linkName)); if ($descriptor->getMegauploadUrl() !== null) { $megauploadLinks->addLink(new Link($descriptor->getMegauploadUrl(), $linkName)); } if ($descriptor->getFreeUrl() !== null) { $freeLinks->addLink(new Link($descriptor->getFreeUrl(), $linkName)); } if ($descriptor->getRapidShareUrl() !== null) { $rapidShareLinks->addLink(new Link($descriptor->getRapidShareUrl(), $linkName)); } if ($descriptor->getMediaFireUrl() !== null) { $mediaFireLinks->addLink(new Link($descriptor->getMediaFireUrl(), $linkName)); } if ($descriptor->getTorrentUrl() !== null) { $torrentLinks->addLink(new Link($descriptor->getTorrentUrl(), $linkName)); } } $releaseContent->addComponent(new title("Fichiers")); $releaseContent->addComponent($fileList); $releaseContent->addComponent(new title("Téléchargements")); $list = new SimpleListComponent(); $list->setClass("linkList"); $list->addcomponent($ddlLinks); if (!$megauploadLinks->isEmpty()) { // MU links removed because MU down //$list->addComponent($megauploadLinks); } if (!$freeLinks->isEmpty()) { $list->addComponent($freeLinks); } if (!$rapidShareLinks->isEmpty()) { $list->addComponent($rapidShareLinks); } if (!$mediaFireLinks->isEmpty()) { $list->addComponent($mediaFireLinks); } $list->addComponent($torrentLinks); $list->addComponent(new XdccLink()); $streamingsLinks = new GroupedLinks(new Image("images/icones/streaming.png")); $streamingsLinks->setClass("streamingsLinks"); foreach ($release->getStreamings() as $link) { $streamingsLinks->addLink($link); } if (!$streamingsLinks->isEmpty()) { $list->addComponent($streamingsLinks); } $bonusLinks = new GroupedLinks(new Image("images/icones/bonus.png")); $bonusLinks->setClass("bonusLinks"); foreach ($release->getBonuses() as $link) { $bonusLinks->addLink($link); } if (!$bonusLinks->isEmpty()) { $list->addComponent($bonusLinks); } $releaseContent->addComponent($list); }