diff --git a/plugins/addons/tasks/class_tasksColumn.inc b/plugins/addons/tasks/class_tasksColumn.inc new file mode 100644 index 0000000000000000000000000000000000000000..4bf01a76e4087f205ca2fbc1b7fec54f34f39043 --- /dev/null +++ b/plugins/addons/tasks/class_tasksColumn.inc @@ -0,0 +1,70 @@ +<?php +/* + This code is part of FusionDirectory (http://www.fusiondirectory.org/) + + Copyright (C) 2011-2022 FusionDirectory + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +/*! + * \brief Column rendering Tasks columns + */ +class TasksColumn extends Column +{ + 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(); + + case 'fdTasksMailObject': + return static::filterType(); + + default: + return parent::renderSingleValue($entry, $value); + } + } + } + + static function filterStatus (): string + { + + $status = "test_status"; + return $status; + } + + static function filtertype (): string + { + $type ="test_type"; + return $type; + } + + 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))) { + return true; + } + } + + return false; + } + +} diff --git a/plugins/addons/tasks/class_tasksManagement.inc b/plugins/addons/tasks/class_tasksManagement.inc index ea702818ed2ac352e962eaa975bc49dae347d30b..779ae1cae1a4fe337874ac580e8e95d26267837b 100644 --- a/plugins/addons/tasks/class_tasksManagement.inc +++ b/plugins/addons/tasks/class_tasksManagement.inc @@ -22,16 +22,16 @@ class tasksManagement extends management { /* - * LinkColun exists by class collumn + * LinkColumn exists by class collumn * TasksColumn is a new class for Tasks bassed on argonaut column definition */ public static $columns = [ ['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']], //below fdTasksMailObject must be change to have a type defined within task creation (new ldap attributes ?hidden) - ['Column', ['attributes' => 'fdTasksMailObject', 'label' => 'Types']], - ['Column', ['attributes' => 'fdTasksSchedule', 'label' => 'Schedule']], + ['TasksColumn', ['attributes' => 'fdTasksMailObject', 'label' => 'Types']], + ['Column', ['attributes' => 'fdTasksScheduleDate', 'label' => 'Schedule']], //below fdTasksStatus attribute needs to be calculated based on the type of the task. - ['Column', ['attributes' => 'fdTasksStatus', 'label' => 'Status']], + ['TasksColumn', ['attributes' => 'fdTasksStatus', 'label' => 'Status']], ['Column', ['attributes' => 'fdTasksCreationDate', 'label' => 'Creation Date']], ['ActionsColumn', ['label' => 'Actions']], ];