From e396b8e7d5a49750442790d6fa0bb77549fdc347 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 28 Oct 2016 16:11:21 +0200 Subject: [PATCH] W.I.P of holiday report for calendar app --- .../inc/class.calendar_holiday_report.inc.php | 79 +++++++++++++++++++ calendar/inc/class.calendar_ui.inc.php | 1 + calendar/templates/default/app.css | 4 +- calendar/templates/default/holiday_report.xet | 61 ++++++++++++++ calendar/templates/pixelegg/app.css | 5 ++ 5 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 calendar/inc/class.calendar_holiday_report.inc.php create mode 100644 calendar/templates/default/holiday_report.xet diff --git a/calendar/inc/class.calendar_holiday_report.inc.php b/calendar/inc/class.calendar_holiday_report.inc.php new file mode 100644 index 0000000000..fc03b28760 --- /dev/null +++ b/calendar/inc/class.calendar_holiday_report.inc.php @@ -0,0 +1,79 @@ + + * @copyright (c) 2013-16 by Hadi Nategh + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +use EGroupware\Api; +use EGroupware\Api\Link; +use EGroupware\Api\Framework; +use EGroupware\Api\Egw; +use EGroupware\Api\Etemplate; + +/** + * This class reports number of holidays taken by users based + * on categories defined as holidays. THe report would be based + * on start and end date and can be specified with several options + * for each category. The result of the report would be a CSV file + * consistent of user full name, categories names, and number of + * days/ or weeks. + * + */ +class calendar_holiday_report { + + /** + * Public functions allowed to get called + * + * @var type + */ + var $public_functions = array( + 'index' => True, + ); + + /** + * Constructor + */ + function __construct() + { + $this->bo = new calendar_bo(); + $this->tmpl = new Etemplate('calendar.holiday_report'); + } + + /** + * Function to build holiday report index interface and logic + * + * @param type $content + */ + public function index ($content = null) + { + if (is_null($content)) + { + $cat = new Api\Categories($GLOBALS['egw_info']['user']['account_id'],'calendar'); + $cats = $cat->return_sorted_array($start=0, false, '', 'ASC', 'cat_name', true, 0, true); + + foreach ($cats as &$value) + { + $content['grid'][] = array( + 'cat_id' => $value['id'], + 'user' => '', + 'weekend' => '', + 'holidays' => '', + 'min_days' => 4 + ); + } + } + else + { + + } + + $this->tmpl->exec('calendar.holiday_report', $content); + } +} diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 13bfe5db93..355341b9da 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -524,6 +524,7 @@ class calendar_ui ); $GLOBALS['egw']->framework->sidebox($appname,lang('Admin'),$file,'admin'); } + display_sidebox('calendar', lang('Utilities'), array('Holiday report' => Egw::link('/index.php','menuaction=calendar.calendar_holiday_report.index'))); } /** diff --git a/calendar/templates/default/app.css b/calendar/templates/default/app.css index dded500171..d4173474eb 100644 --- a/calendar/templates/default/app.css +++ b/calendar/templates/default/app.css @@ -1493,4 +1493,6 @@ input#calendar-edit_location {padding-left: 0;} } #calendar-edit_quantity.et2_textbox_ro {opacity:0.5;} -#calendar-edit_quantity, #calendar-edit_role {float:left;} \ No newline at end of file +#calendar-edit_quantity, #calendar-edit_role {float:left;} + +.holiday_report_cats {height:80%;overflow-y: auto;display:block;} \ No newline at end of file diff --git a/calendar/templates/default/holiday_report.xet b/calendar/templates/default/holiday_report.xet new file mode 100644 index 0000000000..599ac3e6f5 --- /dev/null +++ b/calendar/templates/default/holiday_report.xet @@ -0,0 +1,61 @@ + + + + + + diff --git a/calendar/templates/pixelegg/app.css b/calendar/templates/pixelegg/app.css index 6b738d0fc3..5f61135b91 100755 --- a/calendar/templates/pixelegg/app.css +++ b/calendar/templates/pixelegg/app.css @@ -1457,6 +1457,11 @@ input#calendar-edit_location { #calendar-edit_role { float: left; } +.holiday_report_cats { + height: 80%; + overflow-y: auto; + display: block; +} /*generell*/ .egw_fw_content_browser_iframe img[src$="svg"] { background-color: #828282 !important;