From 2d0e01e8ada87ef813a4aa1c91d0ff90c0d7e8e6 Mon Sep 17 00:00:00 2001 From: Thibault Dockx <thibault.dockx@fusiondirectory.org> Date: Mon, 17 Oct 2022 13:00:40 +0100 Subject: [PATCH] :sparkles: Feat(Tasks) - Better status and object type Better Status generated and Object Type reported --- plugins/addons/tasks/class_tasksColumn.inc | 32 +++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/plugins/addons/tasks/class_tasksColumn.inc b/plugins/addons/tasks/class_tasksColumn.inc index 4bf01a76e..5a60385da 100644 --- a/plugins/addons/tasks/class_tasksColumn.inc +++ b/plugins/addons/tasks/class_tasksColumn.inc @@ -24,39 +24,45 @@ */ class TasksColumn extends Column { + // Keep in mind this method is being called for each value. protected function renderSingleValue (ListingEntry $entry, string $value): string { if ($value == '') { return ' '; } else { - print_r($this->attributes); switch ($this->attributes[0]) { case 'fdTasksStatus': - return static::filterStatus(); + return static::filterStatus($value); case 'fdTasksMailObject': - return static::filterType(); - + return "Mail Object"; + default: return parent::renderSingleValue($entry, $value); } } } - static function filterStatus (): string + static function filterStatus (int $status = NULL): string { - $status = "test_status"; - return $status; - } + // A call towards a status map would be interesting here. + switch ($status) { + case 1 : + return "Created"; - static function filtertype (): string - { - $type ="test_type"; - return $type; + case 2 : + return "Processed"; + + default : + return "Error Encountered"; + + } } - static function in_array_r($needle, $haystack, $strict = false) + // Not used for now + // Find a key value in multi dimensionnal array (multi unknown levels). + static function in_array_r($needle, $haystack, $strict = FALSE) { foreach ($haystack as $item) { if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) { -- GitLab