pp3/module/Application/view/application/index/index.phtml (163 lines of code) (raw):
<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
?>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Most downloaded</h3>
</div>
<div class="panel-body">
<?php
$i=1;
foreach($this->best as $p) {
echo '<p>
<h5>'.$i.'. <span class="text-primary"><a href="'.$this->url('catalogue', array(), array('query' => array('id'=>$p->getId()))).'">'.$p->getName().'</a></span>
<i class="fas fa-download"></i> '.number_format($p->getDownloads()).'</h5>
</p>';
$i++;
}
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Latest updates</h3>
</div>
<div class="panel-body">
<?php
$i=1;
foreach($this->latest as $p) {
echo '<p>
<h5>'.$i.'. <span class="text-primary"><a href="'.$this->url('catalogue', array(), array('query' => array('id'=>$p->getId()))).'">'.$p->getName().'</a></span>
'.date_format($p->getLastUpdatedAt(), 'Y-m-d').'</h5>
</p>';
$i++;
}
?>
</div>
</div>
</div>
</div>
<br/><br/>
<form class="form-inline" method="get" action="">
<div class="form-group">
<label for="search">Search</label>
<input type="text" class="form-control" name="search" id="search"
placeholder="Name, description, author, category, license..." style="width: 350px;" value="<?= htmlentities($this->search) ?>">
</div>
<div class="form-group">
<label for="nbvsel"> NetBeans version</label>
<select id="nbvsel" name="nbv" class="form-control">
<option value="">Any</option>
<?php
foreach($this->versions as $version) {
$sel = (array_key_exists('nbv', $_GET) && $_GET['nbv'] == $version->getVersion()) ? 'selected' : '';
echo '<option value="'.$version->getVersion().'" '.$sel.'>'.$version->getVersion().'</option>';
}
?>
</select>
</div>
<div class="form-group">
<label for="catsel"> Category</label>
<select id="catsel" name="cat" class="form-control">
<option value="">Any</option>
<?php
foreach($this->categories as $cat) {
$sel = (array_key_exists('cat', $_GET) && $_GET['cat'] == $cat->getName()) ? 'selected' : '';
echo '<option value="'.$cat->getName().'" '.$sel.'>'.$cat->getName().'</option>';
}
?>
</select>
</div>
<button type="submit" class="btn btn-primary">Go!</button>
</form>
<br/>
<hr/>
<p class="text-info">Found <?= number_format($this->paginator->getTotalItemCount())?> plugins.</p>
<table class="table table-striped">
<thead>
<tr>
<th>Plugin</th>
<th>Categories</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<?php
foreach($this->paginator as $plugin) {
/* @var $plugin Application\Entity\Plugin */
$authors = [];
foreach($plugin->getAuthors() as $author) {
$authors[] = htmlspecialchars($author->getName(), ENT_COMPAT, "UTF-8");
}
$versionBadges = array();
foreach ($plugin->getVersions() as $version) {
foreach ($version->getNbVersionsPluginVersions() as $nbvPv) {
$verif = $nbvPv->getVerification();
if ($verif && $verif->isVerified()) {
$versionBadges[]='<span class="badge '.$nbvPv->getVerification()->getStatusBadgeClass().'" title="'.$nbvPv->getVerification()->getStatusBadgeTitle().'">
NB '.$nbvPv->getNbVersion()->getVersion().' - '.$nbvPv->getVerification()->getStatusBadgeTitle().'</span>';
}
}
}
echo '<tr>
<td>
<h4 class="text-primary"><a href="'.$this->url('catalogue', array(), array('query' => array('id'=>$plugin->getId()))).'">'.$plugin->getName().'</a></h4>
<table role="presentation">
<tr><td style="padding-right: 1ex">GroupId: </td><td><b>'.$plugin->getGroupId().'</b></td></tr>
<tr style="padding-right: 1ex"><td>ArtifactId:</td><td><b>'.$plugin->getArtifactId().'</b> <i class="fas fa-download"></i> '.number_format($plugin->getDownloads()).'</td></tr>
<tr style="padding-right: 1ex"><td>Author:</td><td><b>'. implode("<br />", $authors) .'</b></td></tr>
<tr style="padding-right: 1ex"><td>License:</td><td><b>'.$plugin->getLicense().'</b></td></tr>
</table>
<p>'.implode(' ', $versionBadges).'</p>
</td>
<td>';
foreach ($plugin->getCategories() as $cat) {
echo '<span class="badge badge-blue">'.$cat->getName().'</span> ';
}
echo '</td>
<td>'.$plugin->getShortDescription().'</td>
</tr>';
}
?>
</tbody>
</table>
<script type="text/javascript">
const searchElement = document.getElementById('search');
if (searchElement) {
searchElement.focus();
const val = searchElement.value;
searchElement.value = '';
searchElement.value = val;
}
$( function() {
$( "#search" ).autocomplete({
source: "<?= $this->url('plugin',array('action'=>'search-autocomplete')) ?>",
minLength: 3,
});
} );
</script>
<?= $this->paginationControl($this->paginator,
'Sliding',
'partials/_paginator',
['route' => 'home', 'search' => $this->search]); ?>