From 77809faada78036d141e6a966e8ccaf03925e515 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Wed, 8 Jan 2025 17:19:09 +0100 Subject: [PATCH] GenericTable: rename 'parse' option to 'format' --- controllers/ManageAlbums.php | 4 ++-- controllers/ManageAssets.php | 10 +++++----- controllers/ManageErrors.php | 6 +++--- controllers/ManageTags.php | 6 +++--- controllers/ManageUsers.php | 10 +++++----- models/GenericTable.php | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/controllers/ManageAlbums.php b/controllers/ManageAlbums.php index 0300409..e725db1 100644 --- a/controllers/ManageAlbums.php +++ b/controllers/ManageAlbums.php @@ -35,7 +35,7 @@ class ManageAlbums extends HTMLController 'tag' => [ 'header' => 'Album', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'link' => BASEURL . '/editalbum/?id={ID_TAG}', 'data' => 'tag', ], @@ -43,7 +43,7 @@ class ManageAlbums extends HTMLController 'slug' => [ 'header' => 'Slug', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'link' => BASEURL . '/editalbum/?id={ID_TAG}', 'data' => 'slug', ], diff --git a/controllers/ManageAssets.php b/controllers/ManageAssets.php index 9054450..3f5923b 100644 --- a/controllers/ManageAssets.php +++ b/controllers/ManageAssets.php @@ -38,7 +38,7 @@ class ManageAssets extends HTMLController 'checkbox' => [ 'header' => '', 'is_sortable' => false, - 'parse' => [ + 'format' => [ 'type' => 'function', 'data' => function($row) { return ''; @@ -49,7 +49,7 @@ class ManageAssets extends HTMLController 'header' => ' ', 'is_sortable' => false, 'cell_class' => 'text-center', - 'parse' => [ + 'format' => [ 'type' => 'function', 'data' => function($row) { $asset = Image::byRow($row); @@ -87,7 +87,7 @@ class ManageAssets extends HTMLController 'value' => 'filename', 'header' => 'Filename', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'type' => 'value', 'link' => BASEURL . '/editasset/?id={ID_ASSET}', 'data' => 'filename', @@ -96,7 +96,7 @@ class ManageAssets extends HTMLController 'id_user_uploaded' => [ 'header' => 'User uploaded', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'type' => 'function', 'data' => function($row) { if (!empty($row['id_user'])) @@ -110,7 +110,7 @@ class ManageAssets extends HTMLController 'dimensions' => [ 'header' => 'Dimensions', 'is_sortable' => false, - 'parse' => [ + 'format' => [ 'type' => 'function', 'data' => function($row) { if (!empty($row['image_width'])) diff --git a/controllers/ManageErrors.php b/controllers/ManageErrors.php index 7dcda24..1496617 100644 --- a/controllers/ManageErrors.php +++ b/controllers/ManageErrors.php @@ -45,7 +45,7 @@ class ManageErrors extends HTMLController 'is_sortable' => true, ], 'message' => [ - 'parse' => [ + 'format' => [ 'type' => 'function', 'data' => function($row) { return $row['message'] . '
' . @@ -71,7 +71,7 @@ class ManageErrors extends HTMLController 'is_sortable' => true, ], 'time' => [ - 'parse' => [ + 'format' => [ 'type' => 'timestamp', 'data' => [ 'timestamp' => 'time', @@ -89,7 +89,7 @@ class ManageErrors extends HTMLController 'uid' => [ 'header' => 'UID', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'link' => BASEURL . '/edituser/?id={ID_USER}', 'data' => 'id_user', ], diff --git a/controllers/ManageTags.php b/controllers/ManageTags.php index cca4140..400d9b1 100644 --- a/controllers/ManageTags.php +++ b/controllers/ManageTags.php @@ -37,7 +37,7 @@ class ManageTags extends HTMLController 'tag' => [ 'header' => 'Tag', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'link' => BASEURL . '/edittag/?id={ID_TAG}', 'data' => 'tag', ], @@ -45,7 +45,7 @@ class ManageTags extends HTMLController 'slug' => [ 'header' => 'Slug', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'link' => BASEURL . '/edittag/?id={ID_TAG}', 'data' => 'slug', ], @@ -53,7 +53,7 @@ class ManageTags extends HTMLController 'id_user_owner' => [ 'header' => 'Owning user', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'type' => 'function', 'data' => function($row) { if (!empty($row['id_user'])) diff --git a/controllers/ManageUsers.php b/controllers/ManageUsers.php index a3c9a81..068a996 100644 --- a/controllers/ManageUsers.php +++ b/controllers/ManageUsers.php @@ -37,7 +37,7 @@ class ManageUsers extends HTMLController 'surname' => [ 'header' => 'Last name', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'link' => BASEURL . '/edituser/?id={ID_USER}', 'data' => 'surname', ], @@ -45,7 +45,7 @@ class ManageUsers extends HTMLController 'first_name' => [ 'header' => 'First name', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'link' => BASEURL . '/edituser/?id={ID_USER}', 'data' => 'first_name', ], @@ -53,7 +53,7 @@ class ManageUsers extends HTMLController 'slug' => [ 'header' => 'Slug', 'is_sortable' => true, - 'parse' => [ + 'format' => [ 'link' => BASEURL . '/edituser/?id={ID_USER}', 'data' => 'slug', ], @@ -64,7 +64,7 @@ class ManageUsers extends HTMLController 'is_sortable' => true, ], 'last_action_time' => [ - 'parse' => [ + 'format' => [ 'type' => 'timestamp', 'data' => [ 'timestamp' => 'last_action_time', @@ -82,7 +82,7 @@ class ManageUsers extends HTMLController 'is_admin' => [ 'is_sortable' => true, 'header' => 'Admin?', - 'parse' => [ + 'format' => [ 'type' => 'function', 'data' => function($row) { return $row['is_admin'] ? 'yes' : 'no'; diff --git a/models/GenericTable.php b/models/GenericTable.php index df48c83..08aa226 100644 --- a/models/GenericTable.php +++ b/models/GenericTable.php @@ -191,9 +191,9 @@ class GenericTable foreach ($options['columns'] as $column) { - // Process data for this particular cell. - if (isset($column['parse'])) - $value = self::processCell($column['parse'], $row); + // Process formatting + if (isset($column['format'])) + $value = self::processFormatting($column['format'], $row); else $value = $row[$column['value']]; @@ -209,7 +209,7 @@ class GenericTable } } - private function processCell($options, $rowData) + private function processFormatting($options, $rowData) { if (!isset($options['type'])) $options['type'] = 'value';