1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Hide homepage/download link if its not set.

This commit is contained in:
lonalore
2016-06-20 11:30:00 +02:00
parent 90e25f1d8a
commit 6cac761e47

View File

@@ -95,8 +95,7 @@ class library_list_ui extends e_admin_ui
$provider = $this->getProvider($details);
$status = $this->getStatus($details);
$homepage = $this->getHomepage($details);
$download = $this->getDownload($details);
$links = $this->getLinks($details);
$html .= '<tr>';
$html .= '<td>' . $details['name'] . '</td>';
@@ -104,7 +103,7 @@ class library_list_ui extends e_admin_ui
$html .= '<td>' . $details['version'] . '</td>';
$html .= '<td>' . $status . '</td>';
$html .= '<td>' . $details['error_message'] . '</td>';
$html .= '<td>' . $homepage . ' | ' . $download . '</td>';
$html .= '<td>' . $links . '</td>';
$html .= '</tr>';
}
@@ -114,11 +113,40 @@ class library_list_ui extends e_admin_ui
return '<div class="table-responsive">' . $html . '</div>';
}
/**
* Helper function to get links.
*/
private function getLinks($details)
{
$homepage = $this->getHomepage($details);
$download = $this->getDownload($details);
if ($homepage && $download)
{
return $homepage . ' | ' . $download;
}
if($homepage)
{
return $homepage;
}
if($download)
{
return $download;
}
}
/**
* Helper function to get homepage link.
*/
private function getHomepage($details)
{
if (empty($details['vendor_url']))
{
return false;
}
$href = $details['vendor_url'];
$title = $details['name'];
@@ -130,6 +158,11 @@ class library_list_ui extends e_admin_ui
*/
private function getDownload($details)
{
if (empty($details['download_url']))
{
return false;
}
$href = $details['download_url'];
$title = $details['name'];