Merges from upstream Kabuki.
This commit is contained in:
parent
31e1357b47
commit
1a15e347f2
@ -19,6 +19,7 @@ class ManageErrors extends HTMLController
|
||||
{
|
||||
ErrorLog::flush();
|
||||
header('Location: ' . BASEURL . '/manageerrors/');
|
||||
exit;
|
||||
}
|
||||
|
||||
Session::resetSessionToken();
|
||||
|
@ -93,10 +93,10 @@ class ManageUsers extends HTMLController
|
||||
'sort_direction' => !empty($_GET['dir']) ? $_GET['dir'] : '',
|
||||
'title' => 'Manage users',
|
||||
'no_items_label' => 'No users meet the requirements of the current filter.',
|
||||
'items_per_page' => 15,
|
||||
'items_per_page' => 30,
|
||||
'index_class' => 'floatleft',
|
||||
'base_url' => BASEURL . '/manageusers/',
|
||||
'get_data' => function($offset = 0, $limit = 15, $order = '', $direction = 'down') {
|
||||
'get_data' => function($offset = 0, $limit = 30, $order = '', $direction = 'down') {
|
||||
if (!in_array($order, ['id_user', 'surname', 'first_name', 'slug', 'emailaddress', 'last_action_time', 'ip_address', 'is_admin']))
|
||||
$order = 'id_user';
|
||||
|
||||
|
@ -116,13 +116,6 @@ class Asset
|
||||
}
|
||||
}
|
||||
|
||||
public static function byPostId($id_post, $return_format = 'object')
|
||||
{
|
||||
$db = Registry::get('db');
|
||||
|
||||
// !!! TODO
|
||||
}
|
||||
|
||||
public static function createNew(array $data, $return_format = 'object')
|
||||
{
|
||||
// Extract the data array.
|
||||
@ -438,7 +431,19 @@ class Asset
|
||||
|
||||
public function delete()
|
||||
{
|
||||
return Registry::get('db')->query('
|
||||
$db = Registry::get('db');
|
||||
|
||||
if (!unlink(ASSETSDIR . '/' . $this->subdir . '/' . $this->filename))
|
||||
return false;
|
||||
|
||||
$db->query('
|
||||
DELETE FROM assets_meta
|
||||
WHERE id_asset = {int:id_asset}',
|
||||
[
|
||||
'id_asset' => $this->id_asset,
|
||||
]);
|
||||
|
||||
return $db->query('
|
||||
DELETE FROM assets
|
||||
WHERE id_asset = {int:id_asset}',
|
||||
[
|
||||
@ -481,7 +486,7 @@ class Asset
|
||||
|
||||
public static function getCount()
|
||||
{
|
||||
return $db->queryValue('
|
||||
return Registry::get('db')->queryValue('
|
||||
SELECT COUNT(*)
|
||||
FROM assets');
|
||||
}
|
||||
|
@ -114,15 +114,16 @@ class GenericTable extends PageIndex
|
||||
|
||||
private function parseAllRows($rows, $options)
|
||||
{
|
||||
// Parse all rows...
|
||||
$i = 0;
|
||||
foreach ($rows as $row)
|
||||
foreach ($rows as $i => $row)
|
||||
{
|
||||
$i ++;
|
||||
$newRow = array(
|
||||
'class' => $i %2 == 1 ? 'odd' : 'even',
|
||||
'cells' => array(),
|
||||
);
|
||||
$className = $i & 1 ? 'even' : 'odd';
|
||||
if (isset($options['row_classifier']))
|
||||
$className .= $options['row_classifier']($row);
|
||||
|
||||
$newRow = [
|
||||
'class' => $className,
|
||||
'cells' => [],
|
||||
];
|
||||
|
||||
foreach ($options['columns'] as $column)
|
||||
{
|
||||
@ -154,7 +155,12 @@ class GenericTable extends PageIndex
|
||||
|
||||
// timestamps: let's make them readable!
|
||||
case 'timestamp':
|
||||
$pattern = !empty($column['parse']['data']['pattern']) && $column['parse']['data']['pattern'] == 'long' ? '%F %H:%M' : '%H:%M';
|
||||
if (empty($column['parse']['data']['pattern']) || $column['parse']['data']['pattern'] === 'long')
|
||||
$pattern = '%F %H:%M';
|
||||
elseif ($column['parse']['data']['pattern'] === 'short')
|
||||
$pattern = '%F';
|
||||
else
|
||||
$pattern = $column['parse']['data']['pattern'];
|
||||
|
||||
if (!is_numeric($row[$column['parse']['data']['timestamp']]))
|
||||
$timestamp = strtotime($row[$column['parse']['data']['timestamp']]);
|
||||
|
@ -9,10 +9,10 @@
|
||||
class PageIndex
|
||||
{
|
||||
protected $page_index = [];
|
||||
protected $current_page = 0;
|
||||
protected $current_page = 1;
|
||||
protected $items_per_page = 0;
|
||||
protected $needsPageIndex = false;
|
||||
protected $num_pages = 0;
|
||||
protected $num_pages = 1;
|
||||
protected $recordCount = 0;
|
||||
protected $start = 0;
|
||||
protected $sort_order = null;
|
||||
|
@ -24,9 +24,7 @@ class FormView extends SubTemplate
|
||||
{
|
||||
if (!empty($this->title))
|
||||
echo '
|
||||
<div id="journal_title">
|
||||
<h3>', $this->title, '</h3>
|
||||
</div>
|
||||
<div id="inner">';
|
||||
|
||||
foreach ($this->_subtemplates as $template)
|
||||
|
Loading…
Reference in New Issue
Block a user