W.I.P of holiday report for calendar app

This commit is contained in:
Hadi Nategh 2016-10-28 16:11:21 +02:00
parent fb5429992e
commit e396b8e7d5
5 changed files with 149 additions and 1 deletions

View File

@ -0,0 +1,79 @@
<?php
/**
* EGroupware - Calendar's holiday report utility
*
* @link http://www.egroupware.org
* @package calendar
* @author Hadi Nategh <hn-AT-egroupware.org>
* @copyright (c) 2013-16 by Hadi Nategh <hn-AT-egroupware.org>
* @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);
}
}

View File

@ -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')));
}
/**

View File

@ -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;}
#calendar-edit_quantity, #calendar-edit_role {float:left;}
.holiday_report_cats {height:80%;overflow-y: auto;display:block;}

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
<!--
Egroupware
@license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
@package calendar
@subpackage
@link http://www.egroupware.org
@author Hadi Nategh <hn-AT-egroupware.org>
@version $Id$
-->
<overlay>
<template id="calendar.holiday_report" template="" lang="" group="0" version="16.2">
<hbox class="dialogHeader" height="28">
<description value="Holiday Report"/>
</hbox>
<grid width="100%" class="holiday_report_cats">
<columns>
<column width="10%"/>
<column width="90%"/>
</columns>
<rows>
<row>
<description value="Categories"/>
<grid id="grid" width="100%">
<columns>
<column width="40%"/>
<column/>
<column/>
<column/>
<column/>
</columns>
<rows>
<row class="th">
<description value="Category"/>
<description align="center" value="User"/>
<description align="center" value="Weekend"/>
<description align="center" value="Holidays"/>
<description align="center" value="Min days as week"/>
</row>
<row class="row">
<taglist-cat id="${row}[cat_id]" readonly="true" width="500" class="select-cat"/>
<checkbox align="center" id="${row}[user]"/>
<checkbox align="center" id="${row}[weekend]"/>
<checkbox align="center" id="${row}[holidays]"/>
<number type="integer" align="center" id="${row}[min_days]"/>
</row>
</rows>
</grid>
</row>
</rows>
</grid>
<hbox class="dialogFooterToolbar">
<description value="Range"/>
<date id="start" label="Start"/>
<date id="end" label="End"/>
<button id="report" label="Report"/>
</hbox>
</template>
</overlay>

View File

@ -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;