Пример #1
0
 private function createReleasesTable($sType)
 {
     $oSearch = new Search($this->oCurrentUser);
     $oSearch->searchWithIdFiche($this->oFiche->getId(), $sType);
     $aReleases = $oSearch->getReleaseTable();
     if (count($aReleases) != 0) {
         $oFinalTable = new TableGenerator();
         $oFinalTable->setId('releases');
         $oFinalTable->addColumn('Tags');
         $oFinalTable->addColumn('Release');
         $oFinalTable->addColumn('Lien');
         $aTrackers = Tracker::getTrackers();
         $aCategories = Categorie::getCategories();
         foreach ($aReleases as $iIdRelease => $aRelease) {
             //Affichage de la catégorie
             $oCatView = new View('label');
             $oCatView->addData('type', 'primary');
             if ($aRelease['categorie'] != 0) {
                 $oCatView->addData('text', $aCategories[$aRelease['categorie']]->getName());
             } else {
                 $oCatView->addData('text', 'Non scrappé');
             }
             $oCatView->create();
             $sTags = $oCatView->getCode() . ' ';
             //Affichage des TAGS :
             foreach ($aRelease['tags'] as $iTagId => $sTagName) {
                 if ($iTagId != NULL) {
                     $oTagView = new View('label');
                     $oTagView->addData('type', 'info');
                     $oTagView->addData('text', $sTagName);
                     $oTagView->create();
                     $sTags .= $oTagView->getCode() . ' ';
                 }
             }
             //Affichage de la source :
             $oOriginView = new View('label');
             $oOriginView->addData('text', $aRelease['origin']);
             if ($aRelease['origin'] == 'Scene') {
                 $oOriginView->addData('type', 'success');
             } else {
                 $oOriginView->addData('type', 'danger');
             }
             $oOriginView->create();
             $sTags .= $oOriginView->getCode();
             //Création de la popup Tracker
             $oPopup = new View('releasepopup');
             $oPopup->addData('id', $iIdRelease);
             $oPopup->addData('tracker', $aTrackers[$aRelease["first_tracker"]]->getName());
             $oPopup->addData('nbtracker', count($aRelease['torrents']));
             $oPopup->addData('title', $aRelease['release']);
             //Affichage des liens
             $aTableLinks = array();
             foreach ($aRelease['torrents'] as $aTorrent) {
                 $sButtons = '';
                 if (isset($aTorrent['fichelink'])) {
                     $oFicheButton = new View('minibutton');
                     $oFicheButton->addData('link', $aTorrent['fichelink']);
                     $oFicheButton->addData('icon', 'fa-search-plus');
                     $oFicheButton->addData('style', 'primary');
                     $oFicheButton->create();
                     $sButtons .= $oFicheButton->getCode() . ' ';
                 }
                 if (isset($aTorrent['directlink'])) {
                     $oDirectButton = new View('minibutton');
                     $oDirectButton->addData('link', $aTorrent['directlink']);
                     $oDirectButton->addData('icon', 'fa-download');
                     $oDirectButton->addData('style', 'success');
                     $oDirectButton->create();
                     $sButtons .= $oDirectButton->getCode() . ' ';
                     $oRssButton = new View('miniajaxbutton');
                     $oRssButton->addData('tid', $aTorrent['torrentid']);
                     $oRssButton->addData('icon', 'fa-rss-square');
                     $oRssButton->addData('style', 'warning');
                     $oRssButton->create();
                     $sButtons .= $oRssButton->getCode() . ' ';
                 }
                 $aTableLinks[] = array($aTrackers[$aTorrent['tracker']]->getName(), $aTorrent['delay'], $sButtons);
             }
             $oTable = new View('torrentlist');
             $oTable->addData('titre', $aRelease['release']);
             $oTable->addData('tabledatas', $aTableLinks);
             $oTable->addData('bottom', $aRelease['first']);
             $oTable->create();
             $oPopup->addData('content', $oTable->getCode());
             $oPopup->create();
             //Affichage du lien de modération
             if ($this->oCurrentUser->checkAccess('modrelease')) {
                 $sFicheLink = '<a href="index.php?p=modrelease&id=' . $aRelease['release_id'] . '" style="color: black;">' . $aRelease['release'] . '</a>';
             } else {
                 $sFicheLink = $aRelease['release'];
             }
             $oFinalTable->addLine(array($sTags, $sFicheLink, $oPopup->getCode()));
         }
         $oFinalTable->create();
         $this->oView->addData('releases', $oFinalTable->getCode());
     } else {
         $this->oView->addData('releases', 'Aucune release trouvée :(');
     }
 }