summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Controller/Calendar.php4
-rw-r--r--app/Controller/Config.php2
-rw-r--r--app/Locale/da_DK/translations.php1
-rw-r--r--app/Locale/de_DE/translations.php1
-rw-r--r--app/Locale/es_ES/translations.php1
-rw-r--r--app/Locale/fi_FI/translations.php1
-rw-r--r--app/Locale/fr_FR/translations.php1
-rw-r--r--app/Locale/hu_HU/translations.php165
-rw-r--r--app/Locale/it_IT/translations.php1
-rw-r--r--app/Locale/ja_JP/translations.php1
-rw-r--r--app/Locale/nl_NL/translations.php1
-rw-r--r--app/Locale/pl_PL/translations.php1
-rw-r--r--app/Locale/pt_BR/translations.php1
-rw-r--r--app/Locale/ru_RU/translations.php1
-rw-r--r--app/Locale/sr_Latn_RS/translations.php1
-rw-r--r--app/Locale/sv_SE/translations.php1
-rw-r--r--app/Locale/th_TH/translations.php1
-rw-r--r--app/Locale/tr_TR/translations.php1
-rw-r--r--app/Locale/zh_CN/translations.php1
-rw-r--r--app/Model/SubtaskForecast.php117
-rw-r--r--app/Schema/Mysql.php8
-rw-r--r--app/Schema/Postgres.php8
-rw-r--r--app/Schema/Sqlite.php8
-rw-r--r--app/ServiceProvider/ClassProvider.php1
-rw-r--r--app/Template/config/board.php1
25 files changed, 243 insertions, 87 deletions
diff --git a/app/Controller/Calendar.php b/app/Controller/Calendar.php
index 6cfa2bad..49c7f56e 100644
--- a/app/Controller/Calendar.php
+++ b/app/Controller/Calendar.php
@@ -82,7 +82,9 @@ class Calendar extends Base
$subtask_timeslots = $this->subtaskTimeTracking->getUserCalendarEvents($user_id, $start, $end);
- $this->response->json(array_merge($due_tasks, $subtask_timeslots));
+ $subtask_forcast = $this->config->get('subtask_forecast') == 1 ? $this->subtaskForecast->getCalendarEvents($user_id, $end) : array();
+
+ $this->response->json(array_merge($due_tasks, $subtask_timeslots, $subtask_forcast));
}
/**
diff --git a/app/Controller/Config.php b/app/Controller/Config.php
index bee897be..6f3bc43c 100644
--- a/app/Controller/Config.php
+++ b/app/Controller/Config.php
@@ -41,7 +41,7 @@ class Config extends Base
$values = $this->request->getValues();
if ($redirect === 'board') {
- $values += array('subtask_restriction' => 0, 'subtask_time_tracking' => 0);
+ $values += array('subtask_restriction' => 0, 'subtask_time_tracking' => 0, 'subtask_forecast' => 0);
}
if ($this->config->save($values)) {
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index c12e6d9b..f9fe1bab 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 3a3d145e..9898e7f3 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index 00b342dd..0f576376 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index d1ae2412..a5c76cd1 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 340d16b1..7a88669c 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -810,4 +810,5 @@ return array(
'Move the task to another column when assigned to a user' => 'Déplacer la tâche dans une autre colonne lorsque celle-ci est assignée à quelqu\'un',
'Move the task to another column when assignee is cleared' => 'Déplacer la tâche dans une autre colonne lorsque celle-ci n\'est plus assignée',
'Source column' => 'Colonne d\'origine',
+ 'Show subtask estimates in the user calendar' => 'Afficher le temps estimé des sous-tâches dans le calendrier utilisateur',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index a8d5b637..c6bf929f 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -1,13 +1,13 @@
<?php
return array(
- // 'number.decimals_separator' => '',
- // 'number.thousands_separator' => '',
+ 'number.decimals_separator' => ',',
+ 'number.thousands_separator' => ' ',
'None' => 'Nincs',
'edit' => 'szerkesztés',
'Edit' => 'Szerkesztés',
- 'remove' => 'eltávolítás',
- 'Remove' => 'Eltávolítás',
+ 'remove' => 'törlés',
+ 'Remove' => 'Törlés',
'Update' => 'Frissítés',
'Yes' => 'Igen',
'No' => 'Nem',
@@ -437,7 +437,7 @@ return array(
'Move the task to another project' => 'Feladat áthelyezése másik projektbe',
'Move to another project' => 'Áthelyezés másik projektbe',
'Do you really want to duplicate this task?' => 'Tényleg szeretné megkettőzni ezt a feladatot?',
- 'Duplicate a task' => 'Feladat megkettőzése',
+ 'Duplicate a task' => 'Feladat másolása',
'External accounts' => 'Külső fiókok',
'Account type' => 'Fiók típusa',
'Local' => 'Helyi',
@@ -519,7 +519,7 @@ return array(
'Label' => 'Címke',
'Database' => 'Adatbázis',
'About' => 'Kanboard információ',
- 'Database driver:' => 'Adatbázis driver:',
+ 'Database driver:' => 'Adatbázis motor:',
'Board settings' => 'Tábla beállítások',
'URL and token' => 'URL és tokenek',
'Webhook settings' => 'Webhook beállítások',
@@ -576,8 +576,8 @@ return array(
'My subtasks' => 'Részfeladataim',
'User repartition' => 'Felhasználó újrafelosztás',
'User repartition for "%s"' => 'Felhasználó újrafelosztás: %s',
- 'Clone this project' => 'Projekt megkettőzése',
- 'Column removed successfully.' => 'Oszlop sikeresen eltávolítva.',
+ 'Clone this project' => 'Projekt másolása',
+ 'Column removed successfully.' => 'Oszlop sikeresen törölve.',
'Edit Project' => 'Projekt szerkesztése',
'Github Issue' => 'Github issue',
'Not enough data to show the graph.' => 'Nincs elég adat a grafikonhoz.',
@@ -671,7 +671,7 @@ return array(
'There is nothing to show.' => 'Nincs megjelenítendő adat.',
'Time Tracking' => 'Idő követés',
'You already have one subtask in progress' => 'Már van egy folyamatban levő részfeladata',
- 'Which parts of the project do you want to duplicate?' => 'A projekt mely részeit szeretné duplikálni?',
+ 'Which parts of the project do you want to duplicate?' => 'A projekt mely részeit szeretné másolni?',
'Change dashboard view' => 'Vezérlőpult megjelenés változtatás',
'Show/hide activities' => 'Tevékenységek megjelenítése/elrejtése',
'Show/hide projects' => 'Projektek megjelenítése/elrejtése',
@@ -730,82 +730,83 @@ return array(
'Close dialog box' => 'Ablak bezárása',
'Submit a form' => 'Űrlap beküldése',
'Board view' => 'Tábla nézet',
- 'Keyboard shortcuts' => 'Billentyű kombináció',
+ 'Keyboard shortcuts' => 'Billentyű kombinációk',
'Open board switcher' => 'Tábla választó lenyitása',
'Application' => 'Alkalmazás',
'Filter recently updated' => 'Szűrés az utolsó módosítás ideje szerint',
'since %B %e, %Y at %k:%M %p' => '%Y. %m. %d. %H:%M óta',
'More filters' => 'További szűrők',
- // 'Compact view' => '',
- // 'Horizontal scrolling' => '',
- // 'Compact/wide view' => '',
- // 'No results match:' => '',
- // 'Remove hourly rate' => '',
- // 'Do you really want to remove this hourly rate?' => '',
- // 'Hourly rates' => '',
- // 'Hourly rate' => '',
- // 'Currency' => '',
- // 'Effective date' => '',
- // 'Add new rate' => '',
- // 'Rate removed successfully.' => '',
- // 'Unable to remove this rate.' => '',
- // 'Unable to save the hourly rate.' => '',
- // 'Hourly rate created successfully.' => '',
- // 'Start time' => '',
- // 'End time' => '',
- // 'Comment' => '',
- // 'All day' => '',
- // 'Day' => '',
- // 'Manage timetable' => '',
- // 'Overtime timetable' => '',
- // 'Time off timetable' => '',
- // 'Timetable' => '',
- // 'Work timetable' => '',
- // 'Week timetable' => '',
- // 'Day timetable' => '',
- // 'From' => '',
- // 'To' => '',
- // 'Time slot created successfully.' => '',
- // 'Unable to save this time slot.' => '',
- // 'Time slot removed successfully.' => '',
- // 'Unable to remove this time slot.' => '',
- // 'Do you really want to remove this time slot?' => '',
- // 'Remove time slot' => '',
- // 'Add new time slot' => '',
- // 'This timetable is used when the checkbox "all day" is checked for scheduled time off and overtime.' => '',
- // 'Files' => '',
- // 'Images' => '',
- // 'Private project' => '',
- // 'Amount' => '',
- // 'AUD - Australian Dollar' => '',
- // 'Budget' => '',
- // 'Budget line' => '',
- // 'Budget line removed successfully.' => '',
- // 'Budget lines' => '',
- // 'CAD - Canadian Dollar' => '',
- // 'CHF - Swiss Francs' => '',
- // 'Cost' => '',
- // 'Cost breakdown' => '',
- // 'Custom Stylesheet' => '',
- // 'download' => '',
- // 'Do you really want to remove this budget line?' => '',
- // 'EUR - Euro' => '',
- // 'Expenses' => '',
- // 'GBP - British Pound' => '',
- // 'INR - Indian Rupee' => '',
- // 'JPY - Japanese Yen' => '',
- // 'New budget line' => '',
- // 'NZD - New Zealand Dollar' => '',
- // 'Remove a budget line' => '',
- // 'Remove budget line' => '',
- // 'RSD - Serbian dinar' => '',
- // 'The budget line have been created successfully.' => '',
- // 'Unable to create the budget line.' => '',
- // 'Unable to remove this budget line.' => '',
- // 'USD - US Dollar' => '',
- // 'Remaining' => '',
- // 'Destination column' => '',
- // 'Move the task to another column when assigned to a user' => '',
- // 'Move the task to another column when assignee is cleared' => '',
- // 'Source column' => '',
+ 'Compact view' => 'Kompakt nézet',
+ 'Horizontal scrolling' => 'Vízszintes görgetés',
+ 'Compact/wide view' => 'Kompakt/széles nézet',
+ 'No results match:' => 'Nincs találat:',
+ 'Remove hourly rate' => 'Órabér törlése',
+ 'Do you really want to remove this hourly rate?' => 'Valóban törölni kívánja az órabért?',
+ 'Hourly rates' => 'Órabérek',
+ 'Hourly rate' => 'Órabér',
+ 'Currency' => 'Pénznem',
+ 'Effective date' => 'Hatálybalépés ideje',
+ 'Add new rate' => 'Új bér',
+ 'Rate removed successfully.' => 'Bér sikeresen törölve.',
+ 'Unable to remove this rate.' => 'Bér törlése sikertelen.',
+ 'Unable to save the hourly rate.' => 'Órabér mentése sikertelen.',
+ 'Hourly rate created successfully.' => 'Órabér sikeresen mentve.',
+ 'Start time' => 'Kezdés ideje',
+ 'End time' => 'Végzés ideje',
+ 'Comment' => 'Megjegyzés',
+ 'All day' => 'Egész nap',
+ 'Day' => 'Nap',
+ 'Manage timetable' => 'Időbeosztás kezelése',
+ 'Overtime timetable' => 'Túlóra időbeosztás',
+ 'Time off timetable' => 'Szabadság időbeosztás',
+ 'Timetable' => 'Időbeosztás',
+ 'Work timetable' => 'Munka időbeosztás',
+ 'Week timetable' => 'Heti időbeosztás',
+ 'Day timetable' => 'Napi időbeosztás',
+ 'From' => 'Feladó:',
+ 'To' => 'Címzett:',
+ 'Time slot created successfully.' => 'Időszelet sikeresen létrehozva.',
+ 'Unable to save this time slot.' => 'Időszelet mentése sikertelen.',
+ 'Time slot removed successfully.' => 'Időszelet sikeresen törölve.',
+ 'Unable to remove this time slot.' => 'Időszelet törlése sikertelen.',
+ 'Do you really want to remove this time slot?' => 'Biztos törli ezt az időszeletet?',
+ 'Remove time slot' => 'Időszelet törlése',
+ 'Add new time slot' => 'Új Időszelet',
+ 'This timetable is used when the checkbox "all day" is checked for scheduled time off and overtime.' => 'Ez az időbeosztás van használatban ha az "egész nap" jelölőnégyzet be van jelölve a tervezett szabadságnál és túlóránál.',
+ 'Files' => 'Fájlok',
+ 'Images' => 'Képek',
+ 'Private project' => 'Privát projekt',
+ 'Amount' => 'Összeg',
+ 'AUD - Australian Dollar' => 'AUD - Ausztrál dollár',
+ 'Budget' => 'Költségvetés',
+ 'Budget line' => 'Költségvetési tétel',
+ 'Budget line removed successfully.' => 'Költségvetési tétel sikeresen törölve.',
+ 'Budget lines' => 'Költségvetési tételek',
+ 'CAD - Canadian Dollar' => 'CAD - Kanadai dollár',
+ 'CHF - Swiss Francs' => 'CHF - Svájci frank',
+ 'Cost' => 'Költség',
+ 'Cost breakdown' => 'Költség visszaszámlálás',
+ 'Custom Stylesheet' => 'Egyéni sítluslap',
+ 'download' => 'letöltés',
+ 'Do you really want to remove this budget line?' => 'Biztos törölni akarja ezt a költségvetési tételt?',
+ 'EUR - Euro' => 'EUR - Euro',
+ 'Expenses' => 'Kiadások',
+ 'GBP - British Pound' => 'GBP - Angol font',
+ 'INR - Indian Rupee' => 'INR - Indiai rúpia',
+ 'JPY - Japanese Yen' => 'JPY - Japán Yen',
+ 'New budget line' => 'Új költségvetési tétel',
+ 'NZD - New Zealand Dollar' => 'NZD - Új-Zélandi dollár',
+ 'Remove a budget line' => 'Költségvetési tétel törlése',
+ 'Remove budget line' => 'Költségvetési tétel törlése',
+ 'RSD - Serbian dinar' => 'RSD - Szerb dínár',
+ 'The budget line have been created successfully.' => 'Költségvetési tétel sikeresen létrehozva.',
+ 'Unable to create the budget line.' => 'Költségvetési tétel létrehozása sikertelen.',
+ 'Unable to remove this budget line.' => 'Költségvetési tétel törlése sikertelen.',
+ 'USD - US Dollar' => 'USD - Amerikai ollár',
+ 'Remaining' => 'Maradék',
+ 'Destination column' => 'Cél oszlop',
+ 'Move the task to another column when assigned to a user' => 'Feladat másik oszlopba helyezése felhasználóhoz rendélés után',
+ 'Move the task to another column when assignee is cleared' => 'Feladat másik oszlopba helyezése felhasználóhoz rendélés törlésekor',
+ 'Source column' => 'Forrás oszlop',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 6e704ca1..08444549 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 43834145..aa6c51f0 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index 00ef6023..1a22bc30 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index 2f5be941..983b42a8 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 098b6dcf..79856921 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 8f597adc..181b035c 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index 9c7f63a8..0f7df233 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index 212440a7..4da013bb 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index bc94adf4..c478c9ba 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index 0272a7f8..93638f89 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index e99fedab..aa679327 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -808,4 +808,5 @@ return array(
// 'Move the task to another column when assigned to a user' => '',
// 'Move the task to another column when assignee is cleared' => '',
// 'Source column' => '',
+ // 'Show subtask estimates in the user calendar' => '',
);
diff --git a/app/Model/SubtaskForecast.php b/app/Model/SubtaskForecast.php
new file mode 100644
index 00000000..5daee56b
--- /dev/null
+++ b/app/Model/SubtaskForecast.php
@@ -0,0 +1,117 @@
+<?php
+
+namespace Model;
+
+use DateTime;
+use DateInterval;
+
+/**
+ * Subtask Forecast
+ *
+ * @package model
+ * @author Frederic Guillot
+ */
+class SubtaskForecast extends Base
+{
+ /**
+ * Get not completed subtasks with an estimate sorted by postition
+ *
+ * @access public
+ * @param integer $user_id
+ * @return array
+ */
+ public function getSubtasks($user_id)
+ {
+ return $this->db
+ ->table(Subtask::TABLE)
+ ->columns(Subtask::TABLE.'.id', Task::TABLE.'.project_id', Subtask::TABLE.'.task_id', Subtask::TABLE.'.title', Subtask::TABLE.'.time_estimated')
+ ->join(Task::TABLE, 'id', 'task_id')
+ ->asc(Task::TABLE.'.position')
+ ->asc(Subtask::TABLE.'.position')
+ ->gt(Subtask::TABLE.'.time_estimated', 0)
+ ->eq(Subtask::TABLE.'.user_id', $user_id)
+ ->findAll();
+ }
+
+ /**
+ * Get the start date for the forecast
+ *
+ * @access public
+ * @param integer $user_id
+ * @return array
+ */
+ public function getStartDate($user_id)
+ {
+ $subtask = $this->db->table(Subtask::TABLE)
+ ->columns(Subtask::TABLE.'.time_estimated', SubtaskTimeTracking::TABLE.'.start')
+ ->eq(SubtaskTimeTracking::TABLE.'.user_id', $user_id)
+ ->eq(SubtaskTimeTracking::TABLE.'.end', 0)
+ ->status('status', Subtask::STATUS_INPROGRESS)
+ ->join(SubtaskTimeTracking::TABLE, 'subtask_id', 'id')
+ ->findOne();
+
+ if ($subtask && $subtask['time_estimated'] && $subtask['start']) {
+ return date('Y-m-d H:i', $subtask['start'] + $subtask['time_estimated'] * 3600);
+ }
+
+ return date('Y-m-d H:i');
+ }
+
+ /**
+ * Get all calendar events according to the user timetable and the subtasks estimates
+ *
+ * @access public
+ * @param integer $user_id
+ * @param string $end End date of the calendar
+ * @return array
+ */
+ public function getCalendarEvents($user_id, $end)
+ {
+ $events = array();
+ $start_date = new DateTime($this->getStartDate($user_id));
+ $timetable = $this->timetable->calculate($user_id, $start_date, new DateTime($end));
+ $subtasks = $this->getSubtasks($user_id);
+ $total = count($subtasks);
+ $offset = 0;
+
+ foreach ($timetable as $slot) {
+
+ $interval = $this->dateParser->getHours($slot[0], $slot[1]);
+ $start = $slot[0]->getTimestamp();
+
+ if ($slot[0] < $start_date) {
+ continue;
+ }
+
+ while ($offset < $total) {
+
+ $event = array(
+ 'id' => $subtasks[$offset]['id'].'-'.$subtasks[$offset]['task_id'].'-'.$offset,
+ 'subtask_id' => $subtasks[$offset]['id'],
+ 'title' => t('#%d', $subtasks[$offset]['task_id']).' '.$subtasks[$offset]['title'],
+ 'url' => $this->helper->url('task', 'show', array('task_id' => $subtasks[$offset]['task_id'], 'project_id' => $subtasks[$offset]['project_id'])),
+ 'editable' => false,
+ 'start' => date('Y-m-d\TH:i:s', $start),
+ );
+
+ if ($subtasks[$offset]['time_estimated'] <= $interval) {
+
+ $start += $subtasks[$offset]['time_estimated'] * 3600;
+ $interval -= $subtasks[$offset]['time_estimated'];
+ $offset++;
+
+ $event['end'] = date('Y-m-d\TH:i:s', $start);
+ $events[] = $event;
+ }
+ else {
+ $subtasks[$offset]['time_estimated'] -= $interval;
+ $event['end'] = $slot[1]->format('Y-m-d\TH:i:s');
+ $events[] = $event;
+ break;
+ }
+ }
+ }
+
+ return $events;
+ }
+}
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index a78ffacf..3669a647 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -6,7 +6,13 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 54;
+const VERSION = 55;
+
+function version_55($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('subtask_forecast', '0'));
+}
function version_54($pdo)
{
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index 2396000f..b60e441b 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -6,7 +6,13 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 35;
+const VERSION = 36;
+
+function version_36($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('subtask_forecast', '0'));
+}
function version_35($pdo)
{
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index 0e0512d0..34ac2c6f 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -6,7 +6,13 @@ use Core\Security;
use PDO;
use Model\Link;
-const VERSION = 53;
+const VERSION = 54;
+
+function version_54($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('subtask_forecast', '0'));
+}
function version_53($pdo)
{
diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php
index fc71ebf9..2373ab01 100644
--- a/app/ServiceProvider/ClassProvider.php
+++ b/app/ServiceProvider/ClassProvider.php
@@ -36,6 +36,7 @@ class ClassProvider implements ServiceProviderInterface
'ProjectPermission',
'Subtask',
'SubtaskExport',
+ 'SubtaskForecast',
'SubtaskTimeTracking',
'Swimlane',
'Task',
diff --git a/app/Template/config/board.php b/app/Template/config/board.php
index 57efcd08..15e2b422 100644
--- a/app/Template/config/board.php
+++ b/app/Template/config/board.php
@@ -28,6 +28,7 @@
<?= $this->formCheckbox('subtask_restriction', t('Allow only one subtask in progress at the same time for a user'), 1, $values['subtask_restriction'] == 1) ?>
<?= $this->formCheckbox('subtask_time_tracking', t('Enable time tracking for subtasks'), 1, $values['subtask_time_tracking'] == 1) ?>
+ <?= $this->formCheckbox('subtask_forecast', t('Show subtask estimates in the user calendar'), 1, $values['subtask_forecast'] == 1) ?>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>