Verified Commit bcb3dec4 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(Tasks) - First column addition

Adds columns management in order to have proper
status report as well as type.
Showing with 74 additions and 4 deletions
+74 -4
<?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 '&nbsp;';
} 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;
}
}
...@@ -22,16 +22,16 @@ class tasksManagement extends management ...@@ -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 * TasksColumn is a new class for Tasks bassed on argonaut column definition
*/ */
public static $columns = [ public static $columns = [
['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']], ['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']],
//below fdTasksMailObject must be change to have a type defined within task creation (new ldap attributes ?hidden) //below fdTasksMailObject must be change to have a type defined within task creation (new ldap attributes ?hidden)
['Column', ['attributes' => 'fdTasksMailObject', 'label' => 'Types']], ['TasksColumn', ['attributes' => 'fdTasksMailObject', 'label' => 'Types']],
['Column', ['attributes' => 'fdTasksSchedule', 'label' => 'Schedule']], ['Column', ['attributes' => 'fdTasksScheduleDate', 'label' => 'Schedule']],
//below fdTasksStatus attribute needs to be calculated based on the type of the task. //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']], ['Column', ['attributes' => 'fdTasksCreationDate', 'label' => 'Creation Date']],
['ActionsColumn', ['label' => 'Actions']], ['ActionsColumn', ['label' => 'Actions']],
]; ];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment