Compare commits
No commits in common. "master" and "master" have entirely different histories.
@ -45,34 +45,6 @@ class ManageAssets extends HTMLController
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'thumbnail' => [
|
|
||||||
'header' => ' ',
|
|
||||||
'is_sortable' => false,
|
|
||||||
'cell_class' => 'text-center',
|
|
||||||
'parse' => [
|
|
||||||
'type' => 'function',
|
|
||||||
'data' => function($row) {
|
|
||||||
$asset = Image::byRow($row);
|
|
||||||
$width = $height = 65;
|
|
||||||
if ($asset->isImage())
|
|
||||||
{
|
|
||||||
if ($asset->isPortrait())
|
|
||||||
$width = null;
|
|
||||||
else
|
|
||||||
$height = null;
|
|
||||||
|
|
||||||
$thumb = $asset->getThumbnailUrl($width, $height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$thumb = BASEURL . '/images/nothumb.svg';
|
|
||||||
|
|
||||||
$width = isset($width) ? $width . 'px' : 'auto';
|
|
||||||
$height = isset($height) ? $height . 'px' : 'auto';
|
|
||||||
|
|
||||||
return sprintf('<img src="%s" style="width: %s; height: %s;">', $thumb, $width, $height);
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'id_asset' => [
|
'id_asset' => [
|
||||||
'value' => 'id_asset',
|
'value' => 'id_asset',
|
||||||
'header' => 'ID',
|
'header' => 'ID',
|
||||||
@ -135,7 +107,7 @@ class ManageAssets extends HTMLController
|
|||||||
|
|
||||||
$data = Registry::get('db')->queryAssocs('
|
$data = Registry::get('db')->queryAssocs('
|
||||||
SELECT a.id_asset, a.subdir, a.filename,
|
SELECT a.id_asset, a.subdir, a.filename,
|
||||||
a.image_width, a.image_height, a.mimetype,
|
a.image_width, a.image_height,
|
||||||
u.id_user, u.first_name, u.surname
|
u.id_user, u.first_name, u.surname
|
||||||
FROM assets AS a
|
FROM assets AS a
|
||||||
LEFT JOIN users AS u ON a.id_user_uploaded = u.id_user
|
LEFT JOIN users AS u ON a.id_user_uploaded = u.id_user
|
||||||
|
@ -32,7 +32,7 @@ class Asset
|
|||||||
$this->$attribute = $value;
|
$this->$attribute = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['date_captured']) && $data['date_captured'] !== 'NULL' && !is_object($data['date_captured']))
|
if (!empty($data['date_captured']) && $data['date_captured'] !== 'NULL')
|
||||||
$this->date_captured = new DateTime($data['date_captured']);
|
$this->date_captured = new DateTime($data['date_captured']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class Asset
|
|||||||
'_' => '_',
|
'_' => '_',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $return_format === 'object' ? new static($row) : $row;
|
return $return_format == 'object' ? new Asset($row) : $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fromIds(array $id_assets, $return_format = 'array')
|
public static function fromIds(array $id_assets, $return_format = 'array')
|
||||||
@ -168,7 +168,7 @@ class Asset
|
|||||||
foreach ($thumbnails as $thumb)
|
foreach ($thumbnails as $thumb)
|
||||||
$assets[$thumb[0]]['thumbnails'][$thumb[1]] = $thumb[2];
|
$assets[$thumb[0]]['thumbnails'][$thumb[1]] = $thumb[2];
|
||||||
|
|
||||||
if ($return_format === 'array')
|
if ($return_format == 'array')
|
||||||
return $assets;
|
return $assets;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -306,11 +306,9 @@ class Database
|
|||||||
if (defined("DB_LOG_QUERIES") && DB_LOG_QUERIES)
|
if (defined("DB_LOG_QUERIES") && DB_LOG_QUERIES)
|
||||||
$this->logged_queries[] = $db_string;
|
$this->logged_queries[] = $db_string;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$return = @mysqli_query($this->connection, $db_string, empty($this->unbuffered) ? MYSQLI_STORE_RESULT : MYSQLI_USE_RESULT);
|
$return = @mysqli_query($this->connection, $db_string, empty($this->unbuffered) ? MYSQLI_STORE_RESULT : MYSQLI_USE_RESULT);
|
||||||
}
|
|
||||||
catch (Exception $e)
|
if (!$return)
|
||||||
{
|
{
|
||||||
$clean_sql = implode("\n", array_map('trim', explode("\n", $db_string)));
|
$clean_sql = implode("\n", array_map('trim', explode("\n", $db_string)));
|
||||||
trigger_error($this->error() . '<br>' . $clean_sql, E_USER_ERROR);
|
trigger_error($this->error() . '<br>' . $clean_sql, E_USER_ERROR);
|
||||||
|
@ -12,6 +12,12 @@ class Image extends Asset
|
|||||||
const TYPE_LANDSCAPE = 2;
|
const TYPE_LANDSCAPE = 2;
|
||||||
const TYPE_PORTRAIT = 4;
|
const TYPE_PORTRAIT = 4;
|
||||||
|
|
||||||
|
protected function __construct(array $data)
|
||||||
|
{
|
||||||
|
foreach ($data as $attribute => $value)
|
||||||
|
$this->$attribute = $value;
|
||||||
|
}
|
||||||
|
|
||||||
public static function fromId($id_asset, $return_format = 'object')
|
public static function fromId($id_asset, $return_format = 'object')
|
||||||
{
|
{
|
||||||
$asset = parent::fromId($id_asset, 'array');
|
$asset = parent::fromId($id_asset, 'array');
|
||||||
|
@ -366,8 +366,8 @@ div.polaroid a {
|
|||||||
/* Album button box
|
/* Album button box
|
||||||
---------------------*/
|
---------------------*/
|
||||||
.album_button_box {
|
.album_button_box {
|
||||||
|
float: right;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 3rem;
|
margin-bottom: 3rem;
|
||||||
}
|
}
|
||||||
.album_button_box > a,
|
.album_button_box > a,
|
||||||
|
@ -22,7 +22,7 @@ class AlbumButtonBox extends Template
|
|||||||
public function html_main()
|
public function html_main()
|
||||||
{
|
{
|
||||||
echo '
|
echo '
|
||||||
<div class="container album_button_box">';
|
<div class="album_button_box">';
|
||||||
|
|
||||||
foreach ($this->buttons as $button)
|
foreach ($this->buttons as $button)
|
||||||
echo '
|
echo '
|
||||||
|
@ -174,11 +174,8 @@ class PhotoPage extends Template
|
|||||||
echo '
|
echo '
|
||||||
</ul>';
|
</ul>';
|
||||||
|
|
||||||
if ($allowLinkingNewTags)
|
|
||||||
{
|
|
||||||
$this->printNewTagScript($tagKind, $tagListId, $newTagId);
|
$this->printNewTagScript($tagKind, $tagListId, $newTagId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private function printNewTagScript($tagKind, $tagListId, $newTagId)
|
private function printNewTagScript($tagKind, $tagListId, $newTagId)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
class TabularData extends SubTemplate
|
class TabularData extends SubTemplate
|
||||||
{
|
{
|
||||||
protected GenericTable $_t;
|
private GenericTable $_t;
|
||||||
|
|
||||||
public function __construct(GenericTable $table)
|
public function __construct(GenericTable $table)
|
||||||
{
|
{
|
||||||
@ -16,47 +16,6 @@ class TabularData extends SubTemplate
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function html_content()
|
protected function html_content()
|
||||||
{
|
|
||||||
$this->renderTitle();
|
|
||||||
|
|
||||||
foreach ($this->_subtemplates as $template)
|
|
||||||
$template->html_main();
|
|
||||||
|
|
||||||
// Showing an inline form?
|
|
||||||
$pager = $this->_t->getPageIndex();
|
|
||||||
if (!empty($pager) || isset($this->_t->form_above))
|
|
||||||
$this->renderPaginationForm($pager, $this->_t->form_above);
|
|
||||||
|
|
||||||
$tableClass = $this->_t->getTableClass();
|
|
||||||
if ($tableClass)
|
|
||||||
echo '
|
|
||||||
<div class="', $tableClass, '">';
|
|
||||||
|
|
||||||
// Build the table!
|
|
||||||
echo '
|
|
||||||
<table class="table table-striped table-condensed">';
|
|
||||||
|
|
||||||
$this->renderTableHead($this->_t->getHeader());
|
|
||||||
$this->renderTableBody($this->_t->getBody());
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</table>';
|
|
||||||
|
|
||||||
if ($tableClass)
|
|
||||||
echo '
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
// Showing an inline form?
|
|
||||||
if (!empty($pager) || isset($this->_t->form_below))
|
|
||||||
$this->renderPaginationForm($pager, $this->_t->form_below);
|
|
||||||
|
|
||||||
$title = $this->_t->getTitle();
|
|
||||||
if (!empty($title))
|
|
||||||
echo '
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function renderTitle()
|
|
||||||
{
|
{
|
||||||
$title = $this->_t->getTitle();
|
$title = $this->_t->getTitle();
|
||||||
if (!empty($title))
|
if (!empty($title))
|
||||||
@ -66,32 +25,43 @@ class TabularData extends SubTemplate
|
|||||||
<div class="generic-table', !empty($titleclass) ? ' ' . $titleclass : '', '">
|
<div class="generic-table', !empty($titleclass) ? ' ' . $titleclass : '', '">
|
||||||
<h1>', htmlspecialchars($title), '</h1>';
|
<h1>', htmlspecialchars($title), '</h1>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected function renderPaginationForm($pager, $form, $class='row')
|
foreach ($this->_subtemplates as $template)
|
||||||
|
$template->html_main();
|
||||||
|
|
||||||
|
// Showing an inline form?
|
||||||
|
$pager = $this->_t->getPageIndex();
|
||||||
|
if (!empty($pager) || isset($this->_t->form_above))
|
||||||
{
|
{
|
||||||
echo '
|
echo '
|
||||||
<div class="', $class, ' clearfix justify-content-end">';
|
<div class="row clearfix justify-content-end">';
|
||||||
|
|
||||||
// Page index?
|
// Page index?
|
||||||
if (!empty($pager))
|
if (!empty($pager))
|
||||||
PageIndexWidget::paginate($pager);
|
PageIndexWidget::paginate($pager);
|
||||||
|
|
||||||
// Form controls?
|
// Form controls?
|
||||||
if (isset($form))
|
if (isset($this->_t->form_above))
|
||||||
$this->renderInlineForm($form);
|
$this->showForm($this->_t->form_above);
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderTableHead(array $headers)
|
$tableClass = $this->_t->getTableClass();
|
||||||
{
|
if ($tableClass)
|
||||||
echo '
|
echo '
|
||||||
|
<div class="', $tableClass, '">';
|
||||||
|
|
||||||
|
// Build the table!
|
||||||
|
echo '
|
||||||
|
<table class="table table-striped table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>';
|
<tr>';
|
||||||
|
|
||||||
foreach ($headers as $th)
|
// Show all headers in their full glory!
|
||||||
|
$header = $this->_t->getHeader();
|
||||||
|
foreach ($header as $th)
|
||||||
{
|
{
|
||||||
echo '
|
echo '
|
||||||
<th', (!empty($th['width']) ? ' width="' . $th['width'] . '"' : ''), (!empty($th['class']) ? ' class="' . $th['class'] . '"' : ''), ($th['colspan'] > 1 ? ' colspan="' . $th['colspan'] . '"' : ''), ' scope="', $th['scope'], '">',
|
<th', (!empty($th['width']) ? ' width="' . $th['width'] . '"' : ''), (!empty($th['class']) ? ' class="' . $th['class'] . '"' : ''), ($th['colspan'] > 1 ? ' colspan="' . $th['colspan'] . '"' : ''), ' scope="', $th['scope'], '">',
|
||||||
@ -105,14 +75,11 @@ class TabularData extends SubTemplate
|
|||||||
|
|
||||||
echo '
|
echo '
|
||||||
</tr>
|
</tr>
|
||||||
</thead>';
|
</thead>
|
||||||
}
|
|
||||||
|
|
||||||
protected function renderTableBody($body)
|
|
||||||
{
|
|
||||||
echo '
|
|
||||||
<tbody>';
|
<tbody>';
|
||||||
|
|
||||||
|
// The body is what we came to see!
|
||||||
|
$body = $this->_t->getBody();
|
||||||
if (is_array($body))
|
if (is_array($body))
|
||||||
{
|
{
|
||||||
foreach ($body as $tr)
|
foreach ($body as $tr)
|
||||||
@ -123,31 +90,59 @@ class TabularData extends SubTemplate
|
|||||||
foreach ($tr['cells'] as $td)
|
foreach ($tr['cells'] as $td)
|
||||||
{
|
{
|
||||||
echo '
|
echo '
|
||||||
<td',
|
<td', (!empty($td['width']) ? ' width="' . $td['width'] . '"' : ''), '>';
|
||||||
(!empty($td['class']) ? ' class="' . $td['class'] . '"' : ''),
|
|
||||||
(!empty($td['width']) ? ' width="' . $td['width'] . '"' : ''), '>',
|
if (!empty($td['class']))
|
||||||
$td['value'],
|
echo '<span class="', $td['class'], '">', $td['value'], '</span>';
|
||||||
'</td>';
|
else
|
||||||
|
echo $td['value'];
|
||||||
|
|
||||||
|
echo '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// !!! Sum colspan!
|
||||||
else
|
else
|
||||||
{
|
|
||||||
$header = $this->_t->getHeader();
|
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="', count($header), '" class="fullwidth">', $body, '</td>
|
<td colspan="', count($header), '" class="fullwidth">', $body, '</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</tbody>';
|
</tbody>
|
||||||
|
</table>';
|
||||||
|
|
||||||
|
if ($tableClass)
|
||||||
|
echo '
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
// Showing an inline form?
|
||||||
|
if (!empty($pager) || isset($this->_t->form_below))
|
||||||
|
{
|
||||||
|
echo '
|
||||||
|
<div class="row clearfix justify-content-end">';
|
||||||
|
|
||||||
|
// Page index?
|
||||||
|
if (!empty($pager))
|
||||||
|
PageIndexWidget::paginate($pager);
|
||||||
|
|
||||||
|
// Form controls?
|
||||||
|
if (isset($this->_t->form_below))
|
||||||
|
$this->showForm($this->_t->form_below);
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderInlineForm($form)
|
if (!empty($title))
|
||||||
|
echo '
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function showForm($form)
|
||||||
{
|
{
|
||||||
if (!isset($form['is_embed']))
|
if (!isset($form['is_embed']))
|
||||||
echo '
|
echo '
|
||||||
|
Loading…
Reference in New Issue
Block a user