added start and stop entries
enhanced administration of activities/projects/customers added navbar for active records and recent activities added edit timesheet entry form added translation packages for errors and flashmessages upgraded composer packages
This commit is contained in:
13
app/Resources/translations/AvanzuAdminTheme.de.xliff
Normal file
13
app/Resources/translations/AvanzuAdminTheme.de.xliff
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<file date="2016-10-19T21:46:45Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<trans-unit id="Toggle navigation">
|
||||||
|
<source>Toggle navigation</source>
|
||||||
|
<target>Ansicht der Seitenleiste umschalten</target>
|
||||||
|
</trans-unit>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</file>
|
||||||
|
</xliff>
|
||||||
17
app/Resources/translations/exceptions.de.xliff
Normal file
17
app/Resources/translations/exceptions.de.xliff
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<file date="2016-10-19T21:46:45Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<trans-unit id="access.denied">
|
||||||
|
<source>access.denied</source>
|
||||||
|
<target>Der Zugriff wurde verweigert</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="timesheet.access.denied">
|
||||||
|
<source>timesheet.deny.stop</source>
|
||||||
|
<target>Der Benutzer "%user%" darf den Zeiteintrag "%entry%" nicht aufrufen</target>
|
||||||
|
</trans-unit>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</file>
|
||||||
|
</xliff>
|
||||||
29
app/Resources/translations/flashmessages.de.xliff
Normal file
29
app/Resources/translations/flashmessages.de.xliff
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<file date="2016-10-19T21:46:45Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<trans-unit id="timesheet.stop.success">
|
||||||
|
<source>timesheet.stop.success</source>
|
||||||
|
<target>Zeitmessung wurde gestoppt</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="timesheet.stop.error">
|
||||||
|
<source>timesheet.stop.error</source>
|
||||||
|
<target>Zeitmessung konnte nicht gestoppt werden: %reason%</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="timesheet.start.success">
|
||||||
|
<source>timesheet.start.success</source>
|
||||||
|
<target>Zeitmessung wurde gestartet</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="timesheet.start.error">
|
||||||
|
<source>timesheet.start.error</source>
|
||||||
|
<target>Zeitmessung konnte nicht gestartet werden: %reason%</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="action.updated_successfully">
|
||||||
|
<source>action.updated_successfully</source>
|
||||||
|
<target>Änderungen erfolgreich gespeichert</target>
|
||||||
|
</trans-unit>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</file>
|
||||||
|
</xliff>
|
||||||
@@ -212,7 +212,7 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.rate">
|
<trans-unit id="label.rate">
|
||||||
<source>label.rate</source>
|
<source>label.rate</source>
|
||||||
<target>Umsatz</target>
|
<target>Lohn</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.language">
|
<trans-unit id="label.language">
|
||||||
<source>label.language</source>
|
<source>label.language</source>
|
||||||
@@ -250,10 +250,6 @@
|
|||||||
<source>action.back</source>
|
<source>action.back</source>
|
||||||
<target>Zurück</target>
|
<target>Zurück</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="action.updated_successfully">
|
|
||||||
<source>action.updated_successfully</source>
|
|
||||||
<target>Änderungen erfolgreich gespeichert</target>
|
|
||||||
</trans-unit>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Dashboard
|
Dashboard
|
||||||
@@ -310,6 +306,18 @@
|
|||||||
<source>timesheet.subtitle</source>
|
<source>timesheet.subtitle</source>
|
||||||
<target>Verwalten Sie Ihre Zeiteinträge</target>
|
<target>Verwalten Sie Ihre Zeiteinträge</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="timesheet.edit">
|
||||||
|
<source>timesheet.edit</source>
|
||||||
|
<target>Eintrag bearbeiten</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="label.begin">
|
||||||
|
<source>label.begin</source>
|
||||||
|
<target>Von</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="label.end">
|
||||||
|
<source>label.end</source>
|
||||||
|
<target>Bis</target>
|
||||||
|
</trans-unit>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
User profile
|
User profile
|
||||||
@@ -430,6 +438,10 @@
|
|||||||
<source>label.timezone</source>
|
<source>label.timezone</source>
|
||||||
<target>Zeitzone</target>
|
<target>Zeitzone</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="label.currency">
|
||||||
|
<source>label.currency</source>
|
||||||
|
<target>Währung</target>
|
||||||
|
</trans-unit>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Admin: User
|
Admin: User
|
||||||
@@ -556,16 +568,28 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Running time entries top menu
|
Navbar - recent entries and activities
|
||||||
-->
|
-->
|
||||||
<trans-unit id="tracking.active">
|
<trans-unit id="active.entries">
|
||||||
<source>tracking.active</source>
|
<source>active.entries</source>
|
||||||
<target>Sie haben %count% aktive Einträge</target>
|
<target>Sie haben %count% aktiven Eintrag|Sie haben %count% aktive Einträge</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="tracking.all">
|
<trans-unit id="timesheet.all">
|
||||||
<source>tracking.all</source>
|
<source>timesheet.all</source>
|
||||||
<target>Alle Einträge anzeigen</target>
|
<target>Alle Einträge anzeigen</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="recent.activities">
|
||||||
|
<source>recent.activities</source>
|
||||||
|
<target>Ihr %count% zuletzt bearbeitete Aktivität|Eine ihrer %count% letzten Aktivitäten neustarten</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="recent.activities.format">
|
||||||
|
<source>recent.activities.format</source>
|
||||||
|
<target>%activity% in %project% für %customer%</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="timesheet.start">
|
||||||
|
<source>timesheet.start</source>
|
||||||
|
<target>Neue Zeitmessung starten</target>
|
||||||
|
</trans-unit>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{% extends 'AvanzuAdminThemeBundle:layout:default-layout.html.twig' %}
|
{% extends 'AvanzuAdminThemeBundle:layout:default-layout.html.twig' %}
|
||||||
|
|
||||||
{% block avanzu_page_content %}
|
{% block avanzu_page_content %}
|
||||||
|
{{ include('default/_flash_messages.html.twig') }}
|
||||||
{% block main %}{% endblock %}
|
{% block main %}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -8,10 +9,6 @@
|
|||||||
{% block title %}{{ 'browser.title'|trans }}{% endblock %}
|
{% block title %}{{ 'browser.title'|trans }}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block avanzu_sidebar_search %}
|
|
||||||
<!-- right now we simply deactivate that box -->
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block avanzu_page_title %}
|
{% block avanzu_page_title %}
|
||||||
{% block page_title %}{% endblock %}
|
{% block page_title %}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -32,10 +29,6 @@
|
|||||||
<b>Kimai</b> - Time Tracking
|
<b>Kimai</b> - Time Tracking
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block flash_messages %}
|
|
||||||
{{ include('default/_flash_messages.html.twig') }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block avanzu_head %}
|
{% block avanzu_head %}
|
||||||
<link rel="stylesheet" href="{{ asset('css/kimai.css') }}">
|
<link rel="stylesheet" href="{{ asset('css/kimai.css') }}">
|
||||||
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
|
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
|
||||||
@@ -47,17 +40,11 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.dropdown-toggle').dropdown();
|
$('.dropdown-toggle').dropdown();
|
||||||
$(document).kimai({imagePath: '{{ asset('images') }}'});
|
$(document).kimai({imagePath: '{{ asset('images') }}'});
|
||||||
$(document).kimai('ticktac', 'a#ticktac');
|
//$(document).kimai('pauseRecord', 'li.messages-menu ul.menu li');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block avanzu_sidebar_user %}
|
|
||||||
{% if app.user is not null and is_granted('IS_AUTHENTICATED_FULLY') %}
|
|
||||||
{{ render(controller('TimesheetBundle:Timesheet:statusEntry')) }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block avanzu_footer %}
|
{% block avanzu_footer %}
|
||||||
{% block footer %}
|
{% block footer %}
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
@@ -67,23 +54,21 @@
|
|||||||
<strong>Copyright © {{ 'now'|date('Y') }} - <a href="http://www.kevinpapst.de">Kevin Papst</a></strong>.
|
<strong>Copyright © {{ 'now'|date('Y') }} - <a href="http://www.kevinpapst.de">Kevin Papst</a></strong>.
|
||||||
{{ 'footer.license'|trans }}
|
{{ 'footer.license'|trans }}
|
||||||
</footer>
|
</footer>
|
||||||
|
<!-- Page rendered on {{ 'now'|localizeddate('long', 'long', null, 'UTC') }} -->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{#
|
{% block avanzu_navbar_messages %}
|
||||||
avanzu_navbar_toggle
|
{% if app.user is not null and is_granted('IS_AUTHENTICATED_FULLY') %}
|
||||||
avanzu_navbar_messages
|
{{ render(controller('TimesheetBundle:Timesheet:activeEntries')) }}
|
||||||
avanzu_navbar_notifications
|
{% endif %}
|
||||||
avanzu_navbar_tasks
|
{% endblock %}
|
||||||
avanzu_navbar_user
|
|
||||||
avanzu_navbar_control_sidebar_toggle
|
|
||||||
avanzu_sidebar_user
|
|
||||||
avanzu_sidebar_nav
|
|
||||||
avanzu_breadcrumb
|
|
||||||
avanzu_control_sidebar
|
|
||||||
avanzu_javascripts
|
|
||||||
avanzu_javascripts_inline
|
|
||||||
|
|
||||||
|
{% block avanzu_navbar_notifications %}
|
||||||
|
{% if app.user is not null and is_granted('IS_AUTHENTICATED_FULLY') %}
|
||||||
|
{{ render(controller('TimesheetBundle:Activity:recentActivities')) }}
|
||||||
|
{% endif %}
|
||||||
|
{#
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-globe"></i> <span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-globe"></i> <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu locales" role="menu">
|
<ul class="dropdown-menu locales" role="menu">
|
||||||
@@ -92,7 +77,19 @@ avanzu_javascripts_inline
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
#}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
<!-- Page rendered on {{ 'now'|localizeddate('long', 'long', null, 'UTC') }} -->
|
{% block avanzu_navbar_toggle %}{{ parent() }}{% endblock %}
|
||||||
|
{% block avanzu_navbar_tasks %}{{ parent() }}{% endblock %}
|
||||||
|
{% block avanzu_navbar_user %}{{ parent() }}{% endblock %}
|
||||||
|
{% block avanzu_navbar_control_sidebar_toggle %}{{ parent() }}{% endblock %}
|
||||||
|
|
||||||
#}
|
{% block avanzu_sidebar_user %}{# right now we simply deactivate that box #}{% endblock %}
|
||||||
|
{% block avanzu_sidebar_search %}{# right now we simply deactivate that box #}{% endblock %}
|
||||||
|
{% block avanzu_sidebar_nav %}{{ parent() }}{% endblock %}
|
||||||
|
|
||||||
|
{% block avanzu_breadcrumb %}{{ parent() }}{% endblock %}
|
||||||
|
{% block avanzu_control_sidebar %}{{ parent() }}{% endblock %}
|
||||||
|
{% block avanzu_javascripts %}{{ parent() }}{% endblock %}
|
||||||
|
{% block avanzu_javascripts_inline %}{{ parent() }}{% endblock %}
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
{% if app.session.started and app.session.flashBag.peekAll is not empty %}
|
{% import "AvanzuAdminThemeBundle:layout:macros.html.twig" as macro %}
|
||||||
<div class="messages">
|
|
||||||
{% for type, messages in app.session.flashBag.all %}
|
|
||||||
{% for message in messages %}
|
|
||||||
{# Bootstrap alert, see http://getbootstrap.com/components/#alerts #}
|
|
||||||
<div class="alert alert-dismissible alert-{{ type }}" role="alert">
|
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{{ message|trans }}
|
{% if app.session.started and app.session.flashbag.peekAll|length > 0 %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
{{ macro.session_flash(avanzu_adminlte_close_alert|default(true), false, '', 'flashmessages') }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -35,21 +35,3 @@
|
|||||||
<div class="col-sm-4"></div>
|
<div class="col-sm-4"></div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
{{ parent() }}
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// FIXME remove me
|
|
||||||
$(document).ready(function() {
|
|
||||||
var usernameEl = $('#username');
|
|
||||||
var passwordEl = $('#password');
|
|
||||||
// in a real application, hardcoding the user/password would be idiotic
|
|
||||||
// but for the demo application it's very convenient to do so
|
|
||||||
if (!usernameEl.val() && !passwordEl.val()) {
|
|
||||||
usernameEl.val('anna_admin');
|
|
||||||
passwordEl.val('kitten');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
{% import _self as widgets %}
|
{% import _self as widgets %}
|
||||||
|
|
||||||
{{ include('default/_flash_messages.html.twig') }}
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{{ widgets.profile_box(user, stats) }}
|
{{ widgets.profile_box(user, stats) }}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ framework:
|
|||||||
engines: ['twig']
|
engines: ['twig']
|
||||||
default_locale: "%locale%"
|
default_locale: "%locale%"
|
||||||
trusted_hosts: ~
|
trusted_hosts: ~
|
||||||
trusted_proxies: ~
|
|
||||||
session:
|
session:
|
||||||
handler_id: session.handler.native_file
|
handler_id: session.handler.native_file
|
||||||
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
|
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
|
||||||
@@ -60,7 +59,8 @@ twig:
|
|||||||
globals:
|
globals:
|
||||||
kimai_context:
|
kimai_context:
|
||||||
date_1: "d.m.Y" # used for display in timesheets
|
date_1: "d.m.Y" # used for display in timesheets
|
||||||
box_color: "green"
|
box_color: "green" # a color for ???
|
||||||
|
active_warning: 3 # display a warning color if the user has at least X active recordings
|
||||||
|
|
||||||
# Assetic Configuration (used for managing web assets: CSS, JavaScript, Sass, etc.)
|
# Assetic Configuration (used for managing web assets: CSS, JavaScript, Sass, etc.)
|
||||||
#assetic:
|
#assetic:
|
||||||
@@ -100,4 +100,5 @@ avanzu_admin_theme:
|
|||||||
boxed_layout : false
|
boxed_layout : false
|
||||||
collapsed_sidebar: true
|
collapsed_sidebar: true
|
||||||
mini_sidebar : true
|
mini_sidebar : true
|
||||||
|
# TODO support options like: language and skin via sidebar menu
|
||||||
control_sidebar : false
|
control_sidebar : false
|
||||||
|
|||||||
@@ -43,3 +43,7 @@ services:
|
|||||||
|
|
||||||
avanzu_admin_theme:
|
avanzu_admin_theme:
|
||||||
enable_demo: false
|
enable_demo: false
|
||||||
|
|
||||||
|
web_profiler:
|
||||||
|
toolbar: true
|
||||||
|
intercept_redirects: false
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# this imports the routes used to display the web debug toolbar at the bottom of each page
|
# this imports the routes used to display the web debug toolbar at the bottom of each page
|
||||||
#_wdt:
|
_wdt:
|
||||||
# resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
|
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
|
||||||
# prefix: /_wdt
|
prefix: /_wdt
|
||||||
|
|
||||||
# this imports the routes needed to display the Symfony Profiler information
|
# this imports the routes needed to display the Symfony Profiler information
|
||||||
#_profiler:
|
_profiler:
|
||||||
# resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
|
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
|
||||||
# prefix: /_profiler
|
prefix: /_profiler
|
||||||
|
|
||||||
# this imports the route used to test error pages. Just browse the following URL:
|
# this imports the route used to test error pages. Just browse the following URL:
|
||||||
# /{_locale}/_error/{status_code}.{format}
|
# /{_locale}/_error/{status_code}.{format}
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ security:
|
|||||||
# this firewall applies to all URLs
|
# this firewall applies to all URLs
|
||||||
pattern: ^/
|
pattern: ^/
|
||||||
|
|
||||||
|
# does what it says
|
||||||
|
logout_on_user_change: true
|
||||||
|
|
||||||
# but the firewall does not require login on every page
|
# but the firewall does not require login on every page
|
||||||
# denying access is done in access_control or in your controllers
|
# denying access is done in access_control or in your controllers
|
||||||
anonymous: ~
|
anonymous: ~
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
services:
|
services:
|
||||||
slugger:
|
|
||||||
class: AppBundle\Utils\Slugger
|
|
||||||
|
|
||||||
markdown:
|
markdown:
|
||||||
class: AppBundle\Utils\Markdown
|
class: AppBundle\Utils\Markdown
|
||||||
@@ -31,7 +29,7 @@ services:
|
|||||||
class: AppBundle\EventListener\MenuBuilder
|
class: AppBundle\EventListener\MenuBuilder
|
||||||
arguments: ["@event_dispatcher", "@security.authorization_checker"]
|
arguments: ["@event_dispatcher", "@security.authorization_checker"]
|
||||||
tags:
|
tags:
|
||||||
- { name: kernel.event_listener, event:theme.sidebar_setup_menu, method:onSetupNavbar }
|
- { name: kernel.event_listener, event: theme.sidebar_setup_menu, method: onSetupNavbar }
|
||||||
|
|
||||||
# service that prefixes every database table
|
# service that prefixes every database table
|
||||||
app.tableprefix_subscriber:
|
app.tableprefix_subscriber:
|
||||||
@@ -40,6 +38,7 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: doctrine.event_subscriber }
|
- { name: doctrine.event_subscriber }
|
||||||
|
|
||||||
|
# additional menu entries for the timesheet bundle
|
||||||
timesheet.configure_menu_listener:
|
timesheet.configure_menu_listener:
|
||||||
class: TimesheetBundle\EventListener\Menu
|
class: TimesheetBundle\EventListener\Menu
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"sensio/distribution-bundle": "^5.0",
|
"sensio/distribution-bundle": "^5.0",
|
||||||
"sensio/framework-extra-bundle": "^3.0",
|
"sensio/framework-extra-bundle": "^3.0",
|
||||||
"symfony/assetic-bundle": "^2.8",
|
"symfony/assetic-bundle": "^2.8",
|
||||||
"symfony/monolog-bundle": "^2.8",
|
"symfony/monolog-bundle": "^3.1",
|
||||||
"symfony/swiftmailer-bundle": "^2.3",
|
"symfony/swiftmailer-bundle": "^2.3",
|
||||||
"symfony/symfony": "~3.4",
|
"symfony/symfony": "~3.4",
|
||||||
"twig/extensions": "^1.3",
|
"twig/extensions": "^1.3",
|
||||||
|
|||||||
35
composer.lock
generated
35
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "5501e716ff6eaf23c5ae63019424fcfe",
|
"content-hash": "9be870d4b37b8cc29103dbe2cc2d02e6",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "almasaeed2010/adminlte",
|
"name": "almasaeed2010/adminlte",
|
||||||
@@ -2262,41 +2262,44 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/monolog-bundle",
|
"name": "symfony/monolog-bundle",
|
||||||
"version": "v2.12.1",
|
"version": "v3.1.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/monolog-bundle.git",
|
"url": "https://github.com/symfony/monolog-bundle.git",
|
||||||
"reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f"
|
"reference": "2b41b8b6d2c6edb1a5494f02f8e4129be2a44784"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/b0146bdca7ba2a65f3bbe7010423c7393b29ec3f",
|
"url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/2b41b8b6d2c6edb1a5494f02f8e4129be2a44784",
|
||||||
"reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f",
|
"reference": "2b41b8b6d2c6edb1a5494f02f8e4129be2a44784",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"monolog/monolog": "~1.18",
|
"monolog/monolog": "~1.22",
|
||||||
"php": ">=5.3.2",
|
"php": ">=5.3.2",
|
||||||
"symfony/config": "~2.3|~3.0",
|
"symfony/config": "~2.7|~3.0|~4.0",
|
||||||
"symfony/dependency-injection": "~2.3|~3.0",
|
"symfony/dependency-injection": "~2.7|~3.0|~4.0",
|
||||||
"symfony/http-kernel": "~2.3|~3.0",
|
"symfony/http-kernel": "~2.7|~3.0|~4.0",
|
||||||
"symfony/monolog-bridge": "~2.3|~3.0"
|
"symfony/monolog-bridge": "~2.7|~3.0|~4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^4.8",
|
"symfony/console": "~2.3|~3.0|~4.0",
|
||||||
"symfony/console": "~2.3|~3.0",
|
"symfony/phpunit-bridge": "^3.3|^4.0",
|
||||||
"symfony/yaml": "~2.3|~3.0"
|
"symfony/yaml": "~2.3|~3.0|~4.0"
|
||||||
},
|
},
|
||||||
"type": "symfony-bundle",
|
"type": "symfony-bundle",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "2.x-dev"
|
"dev-master": "3.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Bundle\\MonologBundle\\": ""
|
"Symfony\\Bundle\\MonologBundle\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@@ -2318,7 +2321,7 @@
|
|||||||
"log",
|
"log",
|
||||||
"logging"
|
"logging"
|
||||||
],
|
],
|
||||||
"time": "2017-01-02T19:04:26+00:00"
|
"time": "2017-11-06T16:02:17+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-apcu",
|
"name": "symfony/polyfill-apcu",
|
||||||
|
|||||||
113
src/AppBundle/Controller/AbstractController.php
Normal file
113
src/AppBundle/Controller/AbstractController.php
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Kimai package.
|
||||||
|
*
|
||||||
|
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace AppBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The abstract base controller.
|
||||||
|
*
|
||||||
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
|
*/
|
||||||
|
abstract class AbstractController extends Controller
|
||||||
|
{
|
||||||
|
const FLASH_SUCCESS = 'success';
|
||||||
|
const FLASH_WARNING = 'warning';
|
||||||
|
const FLASH_ERROR = 'error';
|
||||||
|
|
||||||
|
const DOMAIN_FLASH = 'flashmessages';
|
||||||
|
const DOMAIN_ERROR = 'exceptions';
|
||||||
|
|
||||||
|
const ROLE_ADMIN = 'ROLE_ADMIN';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return object|\Symfony\Component\Translation\DataCollectorTranslator|\Symfony\Component\Translation\IdentityTranslator
|
||||||
|
*/
|
||||||
|
protected function getTranslator()
|
||||||
|
{
|
||||||
|
return $this->container->get('translator');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A translated helper for denyAccessUnlessGranted()
|
||||||
|
*
|
||||||
|
* @param $attributes
|
||||||
|
* @param null $subject
|
||||||
|
* @param string $translationKey
|
||||||
|
* @param array $parameter
|
||||||
|
* @throws AccessDeniedException
|
||||||
|
*/
|
||||||
|
protected function denyUnlessGranted($attributes, $subject = null, $translationKey = 'access.denied', $parameter = [])
|
||||||
|
{
|
||||||
|
$error = $this->getTranslator()->trans($translationKey, $parameter, self::DOMAIN_ERROR);
|
||||||
|
// TODO try & catch and add to audit log?
|
||||||
|
$this->denyAccessUnlessGranted($attributes, $subject, $error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a "successful" flash message to the stack.
|
||||||
|
*
|
||||||
|
* @param string $translationKey
|
||||||
|
* @param array $parameter
|
||||||
|
*/
|
||||||
|
protected function flashSuccess($translationKey, $parameter = [])
|
||||||
|
{
|
||||||
|
if (!empty($parameter)) {
|
||||||
|
$translationKey = $this->getTranslator()->trans(
|
||||||
|
$translationKey,
|
||||||
|
$parameter,
|
||||||
|
self::DOMAIN_FLASH
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addFlash(self::FLASH_SUCCESS, $translationKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a "warning" flash message to the stack.
|
||||||
|
*
|
||||||
|
* @param $translationKey
|
||||||
|
* @param array $parameter
|
||||||
|
*/
|
||||||
|
protected function flashWarning($translationKey, $parameter = [])
|
||||||
|
{
|
||||||
|
if (!empty($parameter)) {
|
||||||
|
$translationKey = $this->getTranslator()->trans(
|
||||||
|
$translationKey,
|
||||||
|
$parameter,
|
||||||
|
self::DOMAIN_FLASH
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addFlash(self::FLASH_WARNING, $translationKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a "error" flash message to the stack.
|
||||||
|
*
|
||||||
|
* @param $translationKey
|
||||||
|
* @param array $parameter
|
||||||
|
*/
|
||||||
|
protected function flashError($translationKey, $parameter = [])
|
||||||
|
{
|
||||||
|
if (!empty($parameter)) {
|
||||||
|
$translationKey = $this->getTranslator()->trans(
|
||||||
|
$translationKey,
|
||||||
|
$parameter,
|
||||||
|
self::DOMAIN_FLASH
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addFlash(self::FLASH_ERROR, $translationKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,7 +33,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
*
|
*
|
||||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
*/
|
*/
|
||||||
class ProfileController extends Controller
|
class ProfileController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/{username}", name="user_profile")
|
* @Route("/{username}", name="user_profile")
|
||||||
@@ -48,10 +48,11 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param Form $editForm
|
* @param Form|null $editForm
|
||||||
* @param Form $pwdForm
|
* @param Form|null $pwdForm
|
||||||
* @param string $tab
|
* @param string $tab
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||||
*/
|
*/
|
||||||
protected function getProfileView(User $user, Form $editForm = null, Form $pwdForm = null, $tab = 'charts')
|
protected function getProfileView(User $user, Form $editForm = null, Form $pwdForm = null, $tab = 'charts')
|
||||||
{
|
{
|
||||||
@@ -105,7 +106,7 @@ class ProfileController extends Controller
|
|||||||
$entityManager->persist($user);
|
$entityManager->persist($user);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
$this->addFlash('success', 'action.updated_successfully');
|
$this->flashSuccess('action.updated_successfully');
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'user_profile', ['username' => $user->getUsername()]
|
'user_profile', ['username' => $user->getUsername()]
|
||||||
@@ -135,7 +136,7 @@ class ProfileController extends Controller
|
|||||||
$entityManager->persist($user);
|
$entityManager->persist($user);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
$this->addFlash('success', 'action.updated_successfully');
|
$this->flashSuccess('action.updated_successfully');
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'user_profile', ['username' => $user->getUsername()]
|
'user_profile', ['username' => $user->getUsername()]
|
||||||
@@ -146,7 +147,7 @@ class ProfileController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME
|
* FIXME implement profile deletion
|
||||||
* @Route("/{username}/delete", name="user_profile_delete")
|
* @Route("/{username}/delete", name="user_profile_delete")
|
||||||
* @Method({"GET", "POST"})
|
* @Method({"GET", "POST"})
|
||||||
*/
|
*/
|
||||||
@@ -174,7 +175,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
// only administrator can bypass that part if the requested user is not the current user
|
// only administrator can bypass that part if the requested user is not the current user
|
||||||
if ($username !== $user->getUsername()) {
|
if ($username !== $user->getUsername()) {
|
||||||
$this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'Unable to access this page'); // TODO translation
|
$this->denyUnlessGranted('ROLE_ADMIN');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the user is not the current use, load the requested one
|
// if the user is not the current use, load the requested one
|
||||||
@@ -192,7 +193,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @return \Symfony\Component\Form\Form
|
* @return \Symfony\Component\Form\FormInterface
|
||||||
*/
|
*/
|
||||||
private function createEditForm(User $user)
|
private function createEditForm(User $user)
|
||||||
{
|
{
|
||||||
@@ -208,7 +209,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @return \Symfony\Component\Form\Form
|
* @return \Symfony\Component\Form\FormInterface
|
||||||
*/
|
*/
|
||||||
private function createPasswordForm(User $user)
|
private function createPasswordForm(User $user)
|
||||||
{
|
{
|
||||||
@@ -225,8 +226,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*
|
* @return \Symfony\Component\Form\FormInterface
|
||||||
* @return \Symfony\Component\Form\Form The form
|
|
||||||
*/
|
*/
|
||||||
private function createDeleteForm(User $user)
|
private function createDeleteForm(User $user)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace AppBundle\Tests\Controller;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME CAN BE REMOVED
|
* TODO adjust to actual app
|
||||||
*
|
*
|
||||||
* Functional test that implements a "smoke test" of all the public and secure
|
* Functional test that implements a "smoke test" of all the public and secure
|
||||||
* URLs of the application.
|
* URLs of the application.
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Tests\Utils;
|
|
||||||
|
|
||||||
use AppBundle\Utils\Slugger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME CAN BE REMOVED
|
|
||||||
*
|
|
||||||
* Unit test for the application utils.
|
|
||||||
* See http://symfony.com/doc/current/book/testing.html#unit-tests
|
|
||||||
*
|
|
||||||
* Execute the application tests using this command (requires PHPUnit to be installed):
|
|
||||||
*
|
|
||||||
* $ cd your-symfony-project/
|
|
||||||
* $ phpunit -c app
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class SluggerTest extends \PHPUnit_Framework_TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @dataProvider getSlugs
|
|
||||||
*/
|
|
||||||
public function testSlugify($string, $slug)
|
|
||||||
{
|
|
||||||
$slugger = new Slugger();
|
|
||||||
$result = $slugger->slugify($string);
|
|
||||||
|
|
||||||
$this->assertEquals($slug, $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSlugs()
|
|
||||||
{
|
|
||||||
yield ['Lorem Ipsum' , 'lorem-ipsum'];
|
|
||||||
yield [' Lorem Ipsum ' , 'lorem-ipsum'];
|
|
||||||
yield [' lOrEm iPsUm ' , 'lorem-ipsum'];
|
|
||||||
yield ['!Lorem Ipsum!' , 'lorem-ipsum'];
|
|
||||||
yield ['lorem-ipsum' , 'lorem-ipsum'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,6 +15,8 @@ use AppBundle\Utils\Markdown;
|
|||||||
use Symfony\Component\Intl\Intl;
|
use Symfony\Component\Intl\Intl;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateInterval;
|
use DateInterval;
|
||||||
|
use TimesheetBundle\Entity\Customer;
|
||||||
|
use TimesheetBundle\Entity\Timesheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiple Twig extensions: filters and functions
|
* Multiple Twig extensions: filters and functions
|
||||||
@@ -52,7 +54,10 @@ class Extensions extends \Twig_Extension
|
|||||||
return [
|
return [
|
||||||
new \Twig_SimpleFilter('md2html', [$this, 'markdownToHtml'], ['is_safe' => ['html']]),
|
new \Twig_SimpleFilter('md2html', [$this, 'markdownToHtml'], ['is_safe' => ['html']]),
|
||||||
new \Twig_SimpleFilter('duration', array($this, 'duration')),
|
new \Twig_SimpleFilter('duration', array($this, 'duration')),
|
||||||
|
new \Twig_SimpleFilter('durationForEntry', array($this, 'durationForEntry')),
|
||||||
new \Twig_SimpleFilter('money', array($this, 'money')),
|
new \Twig_SimpleFilter('money', array($this, 'money')),
|
||||||
|
new \Twig_SimpleFilter('currency', array($this, 'currency')),
|
||||||
|
new \Twig_SimpleFilter('country', array($this, 'country')),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,6 +71,18 @@ class Extensions extends \Twig_Extension
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the formatted duration for a Timesheet entry.
|
||||||
|
*
|
||||||
|
* @param Timesheet $entry
|
||||||
|
* @param bool $includeSeconds
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function durationForEntry(Timesheet $entry, $includeSeconds = false)
|
||||||
|
{
|
||||||
|
return $this->duration($entry->getDuration(), $includeSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms seconds into a duration string.
|
* Transforms seconds into a duration string.
|
||||||
*
|
*
|
||||||
@@ -91,13 +108,32 @@ class Extensions extends \Twig_Extension
|
|||||||
return $hour . ':' . $minute . ':' . $second . ' h';
|
return $hour . ':' . $minute . ':' . $second . ' h';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $currency
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function currency($currency)
|
||||||
|
{
|
||||||
|
return Intl::getCurrencyBundle()->getCurrencySymbol($currency);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $country
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function country($country)
|
||||||
|
{
|
||||||
|
return Intl::getRegionBundle()->getCountryName($country);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param float $amount
|
* @param float $amount
|
||||||
* @param string $currency
|
* @param string $currency
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function money($amount, $currency = 'EUR')
|
public function money($amount, $currency = null)
|
||||||
{
|
{
|
||||||
|
$currency = $currency ?: Customer::DEFAULT_CURRENCY;
|
||||||
return round($amount) . ' ' . Intl::getCurrencyBundle()->getCurrencySymbol($currency);
|
return round($amount) . ' ' . Intl::getCurrencyBundle()->getCurrencySymbol($currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace AppBundle\Utils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME CAN BE REMOVED
|
|
||||||
*
|
|
||||||
* This class is used to provide an example of integrating simple classes as
|
|
||||||
* services into a Symfony application.
|
|
||||||
*
|
|
||||||
* @author Ryan Weaver <weaverryan@gmail.com>
|
|
||||||
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
|
|
||||||
*/
|
|
||||||
class Slugger
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param string $string
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function slugify($string)
|
|
||||||
{
|
|
||||||
return trim(preg_replace('/[^a-z0-9]+/', '-', strtolower(strip_tags($string))), '-');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
54
src/TimesheetBundle/Controller/ActivityController.php
Normal file
54
src/TimesheetBundle/Controller/ActivityController.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Kimai package.
|
||||||
|
*
|
||||||
|
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace TimesheetBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
|
use TimesheetBundle\Entity\Activity;
|
||||||
|
use TimesheetBundle\Repository\ActivityRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller used to manage activity contents in the public part of the site.
|
||||||
|
*
|
||||||
|
* @Route("/activity")
|
||||||
|
* @Security("has_role('ROLE_USER')")
|
||||||
|
*
|
||||||
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
|
*/
|
||||||
|
class ActivityController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ActivityRepository
|
||||||
|
*/
|
||||||
|
protected function getRepository()
|
||||||
|
{
|
||||||
|
return $this->getDoctrine()->getRepository(Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The flyout to render recent activities and quick-start new recordings.
|
||||||
|
*
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function recentActivitiesAction()
|
||||||
|
{
|
||||||
|
$user = $this->getUser();
|
||||||
|
$activeEntries = $this->getRepository()->getRecentActivities($user, new \DateTime('-30 days')); // TODO make days configurable
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'TimesheetBundle:Navbar:recent-activities.html.twig',
|
||||||
|
['activities' => $activeEntries]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,10 +11,11 @@
|
|||||||
|
|
||||||
namespace TimesheetBundle\Controller\Admin;
|
namespace TimesheetBundle\Controller\Admin;
|
||||||
|
|
||||||
|
use AppBundle\Controller\AbstractController;
|
||||||
|
use Pagerfanta\Pagerfanta;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use TimesheetBundle\Entity\Activity;
|
use TimesheetBundle\Entity\Activity;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
@@ -30,7 +31,7 @@ use TimesheetBundle\Repository\ActivityRepository;
|
|||||||
*
|
*
|
||||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
*/
|
*/
|
||||||
class ActivityController extends Controller
|
class ActivityController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/", defaults={"page": 1}, name="admin_activity")
|
* @Route("/", defaults={"page": 1}, name="admin_activity")
|
||||||
@@ -50,9 +51,8 @@ class ActivityController extends Controller
|
|||||||
* @Route("/{id}/edit", name="admin_activity_edit")
|
* @Route("/{id}/edit", name="admin_activity_edit")
|
||||||
* @Method({"GET", "POST"})
|
* @Method({"GET", "POST"})
|
||||||
*/
|
*/
|
||||||
public function editAction($id, Request $request)
|
public function editAction(Activity $activity, Request $request)
|
||||||
{
|
{
|
||||||
$activity = $this->getById($id);
|
|
||||||
$editForm = $this->createEditForm($activity);
|
$editForm = $this->createEditForm($activity);
|
||||||
|
|
||||||
$editForm->handleRequest($request);
|
$editForm->handleRequest($request);
|
||||||
@@ -62,7 +62,7 @@ class ActivityController extends Controller
|
|||||||
$entityManager->persist($activity);
|
$entityManager->persist($activity);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
$this->addFlash('success', 'action.updated_successfully');
|
$this->flashSuccess('action.updated_successfully');
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'admin_activity', ['id' => $activity->getId()]
|
'admin_activity', ['id' => $activity->getId()]
|
||||||
@@ -78,21 +78,6 @@ class ActivityController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $id
|
|
||||||
* @return null|Activity
|
|
||||||
*/
|
|
||||||
protected function getById($id)
|
|
||||||
{
|
|
||||||
/* @var $repo ActivityRepository */
|
|
||||||
$repo = $this->getDoctrine()->getRepository(Activity::class);
|
|
||||||
$activity = $repo->getById($id);
|
|
||||||
if (null === $activity) {
|
|
||||||
throw new NotFoundHttpException('Activity "'.$id.'" does not exist');
|
|
||||||
}
|
|
||||||
return $activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Activity $activity
|
* @param Activity $activity
|
||||||
* @return \Symfony\Component\Form\Form
|
* @return \Symfony\Component\Form\Form
|
||||||
|
|||||||
@@ -11,10 +11,11 @@
|
|||||||
|
|
||||||
namespace TimesheetBundle\Controller\Admin;
|
namespace TimesheetBundle\Controller\Admin;
|
||||||
|
|
||||||
|
use AppBundle\Controller\AbstractController;
|
||||||
|
use Pagerfanta\Pagerfanta;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use TimesheetBundle\Entity\Customer;
|
use TimesheetBundle\Entity\Customer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
@@ -30,7 +31,7 @@ use TimesheetBundle\Repository\CustomerRepository;
|
|||||||
*
|
*
|
||||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
*/
|
*/
|
||||||
class CustomerController extends Controller
|
class CustomerController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/", defaults={"page": 1}, name="admin_customer")
|
* @Route("/", defaults={"page": 1}, name="admin_customer")
|
||||||
@@ -49,50 +50,38 @@ class CustomerController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit", name="admin_customer_edit")
|
* @Route("/{id}/edit", name="admin_customer_edit")
|
||||||
* @Method({"GET", "POST"})
|
* @Method({"GET", "POST"})
|
||||||
|
*
|
||||||
|
* @param Customer $customer
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function editAction($id, Request $request)
|
public function editAction(Customer $customer, Request $request)
|
||||||
{
|
{
|
||||||
$entity = $this->getById($id);
|
$editForm = $this->createEditForm($customer);
|
||||||
$editForm = $this->createEditForm($entity);
|
|
||||||
|
|
||||||
$editForm->handleRequest($request);
|
$editForm->handleRequest($request);
|
||||||
|
|
||||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||||
$entityManager = $this->getDoctrine()->getManager();
|
$entityManager = $this->getDoctrine()->getManager();
|
||||||
$entityManager->persist($entity);
|
$entityManager->persist($customer);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
$this->addFlash('success', 'action.updated_successfully');
|
$this->flashSuccess('action.updated_successfully');
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'admin_customer', ['id' => $entity->getId()]
|
'admin_customer', ['id' => $customer->getId()]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
'TimesheetBundle:admin:customer_edit.html.twig',
|
'TimesheetBundle:admin:customer_edit.html.twig',
|
||||||
[
|
[
|
||||||
'customer' => $entity,
|
'customer' => $customer,
|
||||||
'form' => $editForm->createView()
|
'form' => $editForm->createView()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $id
|
|
||||||
* @return null|Customer
|
|
||||||
*/
|
|
||||||
protected function getById($id)
|
|
||||||
{
|
|
||||||
/* @var $repo CustomerRepository */
|
|
||||||
$repo = $this->getDoctrine()->getRepository(Customer::class);
|
|
||||||
$activity = $repo->getById($id);
|
|
||||||
if (null === $activity) {
|
|
||||||
throw new NotFoundHttpException('Customer "'.$id.'" does not exist');
|
|
||||||
}
|
|
||||||
return $activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Customer $customer
|
* @param Customer $customer
|
||||||
* @return \Symfony\Component\Form\Form
|
* @return \Symfony\Component\Form\Form
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace TimesheetBundle\Controller\Admin;
|
namespace TimesheetBundle\Controller\Admin;
|
||||||
|
|
||||||
|
use AppBundle\Controller\AbstractController;
|
||||||
use Pagerfanta\Pagerfanta;
|
use Pagerfanta\Pagerfanta;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use TimesheetBundle\Entity\Project;
|
use TimesheetBundle\Entity\Project;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
@@ -30,7 +30,7 @@ use TimesheetBundle\Repository\ProjectRepository;
|
|||||||
*
|
*
|
||||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
*/
|
*/
|
||||||
class ProjectController extends Controller
|
class ProjectController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/", defaults={"page": 1}, name="admin_project")
|
* @Route("/", defaults={"page": 1}, name="admin_project")
|
||||||
@@ -53,13 +53,12 @@ class ProjectController extends Controller
|
|||||||
* @Route("/{id}/edit", name="admin_project_edit")
|
* @Route("/{id}/edit", name="admin_project_edit")
|
||||||
* @Method({"GET", "POST"})
|
* @Method({"GET", "POST"})
|
||||||
*
|
*
|
||||||
* @param $id
|
* @param Project $project
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function editAction($id, Request $request)
|
public function editAction(Project $project, Request $request)
|
||||||
{
|
{
|
||||||
$project = $this->getById($id);
|
|
||||||
$editForm = $this->createEditForm($project);
|
$editForm = $this->createEditForm($project);
|
||||||
|
|
||||||
$editForm->handleRequest($request);
|
$editForm->handleRequest($request);
|
||||||
@@ -69,7 +68,7 @@ class ProjectController extends Controller
|
|||||||
$entityManager->persist($project);
|
$entityManager->persist($project);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
$this->addFlash('success', 'action.updated_successfully');
|
$this->flashSuccess('action.updated_successfully');
|
||||||
|
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'admin_project', ['id' => $project->getId()]
|
'admin_project', ['id' => $project->getId()]
|
||||||
@@ -85,24 +84,9 @@ class ProjectController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $id
|
|
||||||
* @return null|Project
|
|
||||||
*/
|
|
||||||
protected function getById($id)
|
|
||||||
{
|
|
||||||
/* @var $repo ProjectRepository */
|
|
||||||
$repo = $this->getDoctrine()->getRepository(Project::class);
|
|
||||||
$activity = $repo->getById($id);
|
|
||||||
if (null === $activity) {
|
|
||||||
throw new NotFoundHttpException('Project "'.$id.'" does not exist');
|
|
||||||
}
|
|
||||||
return $activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Project $project
|
* @param Project $project
|
||||||
* @return \Symfony\Component\Form\Form
|
* @return \Symfony\Component\Form\FormInterface
|
||||||
*/
|
*/
|
||||||
private function createEditForm(Project $project)
|
private function createEditForm(Project $project)
|
||||||
{
|
{
|
||||||
@@ -112,7 +96,7 @@ class ProjectController extends Controller
|
|||||||
[
|
[
|
||||||
'action' => $this->generateUrl('admin_project_edit', ['id' => $project->getId()]),
|
'action' => $this->generateUrl('admin_project_edit', ['id' => $project->getId()]),
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'currency' => $project->getCurrency()
|
'currency' => $project->getCustomer()->getCurrency()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,17 @@
|
|||||||
|
|
||||||
namespace TimesheetBundle\Controller;
|
namespace TimesheetBundle\Controller;
|
||||||
|
|
||||||
|
use AppBundle\Controller\AbstractController;
|
||||||
|
use Pagerfanta\Pagerfanta;
|
||||||
|
use TimesheetBundle\Entity\Activity;
|
||||||
use TimesheetBundle\Entity\Timesheet;
|
use TimesheetBundle\Entity\Timesheet;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use TimesheetBundle\Form\TimesheetEditForm;
|
||||||
|
use TimesheetBundle\Repository\TimesheetRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller used to manage timesheet contents in the public part of the site.
|
* Controller used to manage timesheet contents in the public part of the site.
|
||||||
@@ -26,8 +31,16 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
|
|||||||
*
|
*
|
||||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
*/
|
*/
|
||||||
class TimesheetController extends Controller
|
class TimesheetController extends AbstractController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return TimesheetRepository
|
||||||
|
*/
|
||||||
|
protected function getRepository()
|
||||||
|
{
|
||||||
|
return $this->getDoctrine()->getRepository(Timesheet::class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/", defaults={"page": 1}, name="timesheet")
|
* @Route("/", defaults={"page": 1}, name="timesheet")
|
||||||
* @Route("/page/{page}", requirements={"page": "[1-9]\d*"}, name="timesheet_paginated")
|
* @Route("/page/{page}", requirements={"page": "[1-9]\d*"}, name="timesheet_paginated")
|
||||||
@@ -38,20 +51,144 @@ class TimesheetController extends Controller
|
|||||||
{
|
{
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
/* @var $entries Pagerfanta */
|
/* @var $entries Pagerfanta */
|
||||||
$entries = $this->getDoctrine()->getRepository(Timesheet::class)->findLatest($user, $page);
|
$entries = $this->getRepository()->findLatest($user, $page);
|
||||||
|
|
||||||
return $this->render('TimesheetBundle:timesheet:index.html.twig', ['entries' => $entries]);
|
return $this->render('TimesheetBundle:timesheet:index.html.twig', [
|
||||||
|
'entries' => $entries,
|
||||||
|
'page' => $page
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function statusEntryAction()
|
/**
|
||||||
|
* The "main button and flyout" for displaying (and stopping) active entries.
|
||||||
|
*
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function activeEntriesAction()
|
||||||
{
|
{
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$activeEntry = $this->getDoctrine()->getRepository(Timesheet::class)->getActiveEntry($user);
|
$activeEntries = $this->getRepository()->getActiveEntries($user);
|
||||||
|
|
||||||
$activeEntry = null;
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
'TimesheetBundle:Sidebar:navbar-panel.html.twig',
|
'TimesheetBundle:Navbar:active-entries.html.twig',
|
||||||
['entry' => $activeEntry]
|
['entries' => $activeEntries]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The route to stop a running entry.
|
||||||
|
*
|
||||||
|
* @Route("/{id}/stop", name="timesheet_stop")
|
||||||
|
* @Method({"GET"})
|
||||||
|
*
|
||||||
|
* @param Timesheet $entry
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function stopAction(Timesheet $entry, Request $request)
|
||||||
|
{
|
||||||
|
$user = $this->getUser();
|
||||||
|
|
||||||
|
// make sure only ADMIN can stop other users entries
|
||||||
|
if ($user->getId() !== $entry->getUser()->getId()) {
|
||||||
|
$this->denyUnlessGranted('ROLE_ADMIN', null, 'timesheet.access.denied', ['%user%' => $user->getId(), '%entry%' => $entry->getId()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->getRepository()->stopRecording($entry);
|
||||||
|
$this->flashSuccess('timesheet.stop.success');
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
$this->flashError('timesheet.stop.error', ['%reason%' => $ex->getMessage()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirectToRoute('timesheet');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The route to stop a running entry.
|
||||||
|
*
|
||||||
|
* @Route("/start/{id}", name="timesheet_start", requirements={"id" = "\d+"})
|
||||||
|
* @Method({"GET", "POST"})
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function startAction(Activity $activity, Request $request)
|
||||||
|
{
|
||||||
|
$user = $this->getUser();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->getRepository()->startRecording($user, $activity);
|
||||||
|
$this->flashSuccess('timesheet.start.success');
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
$this->flashError('timesheet.start.error', ['%reason%' => $ex->getMessage()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirectToRoute('timesheet');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The route to edit an existing entry or to create a complete new entry.
|
||||||
|
*
|
||||||
|
* @Route("/{id}/edit", name="timesheet_edit")
|
||||||
|
* @Method({"GET", "POST"})
|
||||||
|
*
|
||||||
|
* @param Timesheet $entry
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function editAction(Timesheet $entry, Request $request)
|
||||||
|
{
|
||||||
|
$user = $this->getUser();
|
||||||
|
|
||||||
|
// make sure only ADMIN can edit other users entries
|
||||||
|
if ($user->getId() !== $entry->getUser()->getId()) {
|
||||||
|
$this->denyUnlessGranted('ROLE_ADMIN', null, 'timesheet.access.denied', ['%user%' => $user->getId(), '%entry%' => $entry->getId()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$editForm = $this->createEditForm($entry, $request->get('page'));
|
||||||
|
|
||||||
|
$editForm->handleRequest($request);
|
||||||
|
|
||||||
|
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||||
|
$entityManager = $this->getDoctrine()->getManager();
|
||||||
|
$entityManager->persist($entry);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
$this->flashSuccess('action.updated_successfully');
|
||||||
|
|
||||||
|
return $this->redirectToRoute(
|
||||||
|
'timesheet_paginated', ['page' => $request->get('page')]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'TimesheetBundle:timesheet:edit.html.twig',
|
||||||
|
[
|
||||||
|
'entry' => $entry,
|
||||||
|
'form' => $editForm->createView(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Timesheet $entry
|
||||||
|
* @param string $page
|
||||||
|
* @return \Symfony\Component\Form\Form
|
||||||
|
*/
|
||||||
|
private function createEditForm(Timesheet $entry, $page)
|
||||||
|
{
|
||||||
|
return $this->createForm(
|
||||||
|
TimesheetEditForm::class,
|
||||||
|
$entry,
|
||||||
|
[
|
||||||
|
'action' => $this->generateUrl('timesheet_edit', [
|
||||||
|
'id' => $entry->getId(),
|
||||||
|
'page' => $page
|
||||||
|
]),
|
||||||
|
'method' => 'POST',
|
||||||
|
'currency' => $entry->getActivity()->getProject()->getCustomer()->getCurrency(),
|
||||||
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,15 +152,17 @@ class LoadFixtures extends AppBundleLoadFixtures
|
|||||||
$rate = rand(self::RATE_MIN, self::RATE_MAX);
|
$rate = rand(self::RATE_MIN, self::RATE_MAX);
|
||||||
|
|
||||||
$entry = new Timesheet();
|
$entry = new Timesheet();
|
||||||
$entry->setActivity($activity);
|
$entry
|
||||||
$entry->setDescription($this->getRandomPhrase());
|
->setActivity($activity)
|
||||||
$entry->setUser($user);
|
->setDescription($this->getRandomPhrase())
|
||||||
$entry->setRate(round(($duration / 3600) * $rate));
|
->setUser($user)
|
||||||
$entry->setBegin($start);
|
->setRate(round(($duration / 3600) * $rate))
|
||||||
|
->setBegin($start);
|
||||||
|
|
||||||
if ($setEndDate) {
|
if ($setEndDate) {
|
||||||
$entry->setEnd($end);
|
$entry
|
||||||
$entry->setDuration($duration);
|
->setEnd($end)
|
||||||
|
->setDuration($duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entry;
|
return $entry;
|
||||||
@@ -176,11 +178,14 @@ class LoadFixtures extends AppBundleLoadFixtures
|
|||||||
|
|
||||||
for ($i = 0; $i < $amountCustomer; $i++) {
|
for ($i = 0; $i < $amountCustomer; $i++) {
|
||||||
$entry = new Customer();
|
$entry = new Customer();
|
||||||
$entry->setName($allCustomer[$i]);
|
$entry
|
||||||
$entry->setCity($this->getRandomLocation());
|
->setCurrency($this->getRandomCurrency())
|
||||||
$entry->setComment($this->getRandomPhrase());
|
->setVat(rand(0, 30))
|
||||||
$entry->setVisible($i % 3 != 0);
|
->setName($allCustomer[$i])
|
||||||
$entry->setTimezone($allTimezones[rand(1, $amountTimezone)]);
|
->setAddress($this->getRandomLocation())
|
||||||
|
->setComment($this->getRandomPhrase())
|
||||||
|
->setVisible($i % 3 != 0)
|
||||||
|
->setTimezone($allTimezones[rand(1, $amountTimezone)]);
|
||||||
|
|
||||||
$manager->persist($entry);
|
$manager->persist($entry);
|
||||||
}
|
}
|
||||||
@@ -195,12 +200,12 @@ class LoadFixtures extends AppBundleLoadFixtures
|
|||||||
for ($i = 0; $i < $amountCustomer * 2; $i++) {
|
for ($i = 0; $i < $amountCustomer * 2; $i++) {
|
||||||
|
|
||||||
$entry = new Project();
|
$entry = new Project();
|
||||||
$entry->setName($this->getRandomProject());
|
$entry
|
||||||
$entry->setCurrency($this->getRandomCurrency());
|
->setName($this->getRandomProject())
|
||||||
$entry->setBudget(rand(1000, 100000));
|
->setBudget(rand(1000, 100000))
|
||||||
$entry->setComment($this->getRandomPhrase());
|
->setComment($this->getRandomPhrase())
|
||||||
$entry->setCustomer($allCustomer[($i % $amountCustomer) + 1]);
|
->setCustomer($allCustomer[($i % $amountCustomer) + 1])
|
||||||
$entry->setVisible($i % 3 != 0);
|
->setVisible($i % 3 != 0);
|
||||||
|
|
||||||
$manager->persist($entry);
|
$manager->persist($entry);
|
||||||
}
|
}
|
||||||
@@ -215,10 +220,11 @@ class LoadFixtures extends AppBundleLoadFixtures
|
|||||||
$activityCount = rand(1, self::AMOUNT_ACTIVITIES);
|
$activityCount = rand(1, self::AMOUNT_ACTIVITIES);
|
||||||
for ($i = 0; $i < $activityCount; $i++) {
|
for ($i = 0; $i < $activityCount; $i++) {
|
||||||
$entry = new Activity();
|
$entry = new Activity();
|
||||||
$entry->setProject($project);
|
$entry
|
||||||
$entry->setName($this->getRandomActivity());
|
->setProject($project)
|
||||||
$entry->setComment($this->getRandomPhrase());
|
->setName($this->getRandomActivity())
|
||||||
$entry->setVisible($i % 3 != 0);
|
->setComment($this->getRandomPhrase())
|
||||||
|
->setVisible($i % 3 != 0);
|
||||||
|
|
||||||
$manager->persist($entry);
|
$manager->persist($entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,18 +70,20 @@ class Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $project
|
* @param Project $project
|
||||||
|
* @return Activity
|
||||||
*/
|
*/
|
||||||
public function setProject($project)
|
public function setProject($project)
|
||||||
{
|
{
|
||||||
$this->project = $project;
|
$this->project = $project;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set name
|
* Set name
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
|
||||||
* @return Activity
|
* @return Activity
|
||||||
*/
|
*/
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
@@ -105,13 +107,11 @@ class Activity
|
|||||||
* Set comment
|
* Set comment
|
||||||
*
|
*
|
||||||
* @param string $comment
|
* @param string $comment
|
||||||
*
|
|
||||||
* @return Activity
|
* @return Activity
|
||||||
*/
|
*/
|
||||||
public function setComment($comment)
|
public function setComment($comment)
|
||||||
{
|
{
|
||||||
$this->comment = $comment;
|
$this->comment = $comment;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ class Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get activityid
|
* Get activity id
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
class Customer
|
class Customer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const DEFAULT_CURRENCY = 'EUR';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer
|
* @var integer
|
||||||
*
|
*
|
||||||
@@ -100,6 +102,13 @@ class Customer
|
|||||||
*/
|
*/
|
||||||
private $country;
|
private $country;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(name="currency", type="string", length=3, nullable=false)
|
||||||
|
*/
|
||||||
|
private $currency = self::DEFAULT_CURRENCY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
@@ -339,6 +348,25 @@ class Customer
|
|||||||
return $this->country;
|
return $this->country;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCurrency()
|
||||||
|
{
|
||||||
|
return $this->currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $currency
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setCurrency($currency)
|
||||||
|
{
|
||||||
|
$this->currency = $currency;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set phone
|
* Set phone
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -64,17 +64,10 @@ class Project
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="budget", type="decimal", precision=10, scale=2, nullable=true)
|
* @ORM\Column(name="budget", type="decimal", precision=10, scale=2, nullable=false)
|
||||||
*/
|
*/
|
||||||
private $budget = 0.00;
|
private $budget = 0.00;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @ORM\Column(name="currency", type="string", length=3, nullable=false)
|
|
||||||
*/
|
|
||||||
private $currency = 'EUR';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Activity[]
|
* @var Activity[]
|
||||||
*
|
*
|
||||||
@@ -92,25 +85,6 @@ class Project
|
|||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCurrency()
|
|
||||||
{
|
|
||||||
return $this->currency;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $currency
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setCurrency($currency)
|
|
||||||
{
|
|
||||||
$this->currency = $currency;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Customer
|
* @return Customer
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class Timesheet
|
|||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer
|
* @var Activity
|
||||||
*
|
*
|
||||||
* @ORM\ManyToOne(targetEntity="TimesheetBundle\Entity\Activity")
|
* @ORM\ManyToOne(targetEntity="TimesheetBundle\Entity\Activity")
|
||||||
* @ORM\JoinColumn(name="activity", referencedColumnName="id")
|
* @ORM\JoinColumn(name="activity", referencedColumnName="id")
|
||||||
@@ -128,6 +128,10 @@ class Timesheet
|
|||||||
public function setEnd($end)
|
public function setEnd($end)
|
||||||
{
|
{
|
||||||
$this->end = $end;
|
$this->end = $end;
|
||||||
|
if ($end === null) {
|
||||||
|
$this->duration = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,14 +155,18 @@ class Timesheet
|
|||||||
*/
|
*/
|
||||||
public function getDuration()
|
public function getDuration()
|
||||||
{
|
{
|
||||||
if ($this->duration !== 0 || $this->begin === null) {
|
if ($this->begin === null) {
|
||||||
return $this->duration;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->end === null) {
|
||||||
$current = new \DateTime();
|
$current = new \DateTime();
|
||||||
return $current->getTimestamp() - $this->begin->getTimestamp();
|
return $current->getTimestamp() - $this->begin->getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->duration;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set user
|
* Set user
|
||||||
*
|
*
|
||||||
@@ -183,9 +191,9 @@ class Timesheet
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set activityid
|
* Set activity
|
||||||
*
|
*
|
||||||
* @param integer $activity
|
* @param Activity $activity
|
||||||
*
|
*
|
||||||
* @return Timesheet
|
* @return Timesheet
|
||||||
*/
|
*/
|
||||||
@@ -196,9 +204,9 @@ class Timesheet
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get activityid
|
* Get Activity
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return Activity
|
||||||
*/
|
*/
|
||||||
public function getActivity()
|
public function getActivity()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace TimesheetBundle\Form;
|
|||||||
use AppBundle\Form\Type\YesNoType;
|
use AppBundle\Form\Type\YesNoType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CountryType;
|
use Symfony\Component\Form\Extension\Core\Type\CountryType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\PercentType;
|
use Symfony\Component\Form\Extension\Core\Type\PercentType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TelType;
|
use Symfony\Component\Form\Extension\Core\Type\TelType;
|
||||||
@@ -83,10 +84,14 @@ class CustomerEditForm extends AbstractType
|
|||||||
'label' => 'label.address',
|
'label' => 'label.address',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
])
|
])
|
||||||
// TODO string - length 2
|
// string - length 2
|
||||||
->add('country', CountryType::class, [
|
->add('country', CountryType::class, [
|
||||||
'label' => 'label.country',
|
'label' => 'label.country',
|
||||||
])
|
])
|
||||||
|
// string - length 3
|
||||||
|
->add('currency', CurrencyType::class, [
|
||||||
|
'label' => 'label.currency',
|
||||||
|
])
|
||||||
// string - length 255
|
// string - length 255
|
||||||
->add('phone', TelType::class, [
|
->add('phone', TelType::class, [
|
||||||
'label' => 'label.phone',
|
'label' => 'label.phone',
|
||||||
|
|||||||
@@ -12,18 +12,18 @@
|
|||||||
namespace TimesheetBundle\Form;
|
namespace TimesheetBundle\Form;
|
||||||
|
|
||||||
use AppBundle\Form\Type\YesNoType;
|
use AppBundle\Form\Type\YesNoType;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Intl\Intl;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use TimesheetBundle\Entity\Customer;
|
||||||
use TimesheetBundle\Entity\Project;
|
use TimesheetBundle\Entity\Project;
|
||||||
use TimesheetBundle\Form\Type\CustomerType;
|
use TimesheetBundle\Form\Type\CustomerType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the form used to manipulate Projects.
|
* Defines the form used to edit Projects.
|
||||||
*
|
*
|
||||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
*/
|
*/
|
||||||
@@ -37,7 +37,7 @@ class ProjectEditForm extends AbstractType
|
|||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
// string - length 255
|
// string - length 255
|
||||||
->add('name', null, [
|
->add('name', TextType::class, [
|
||||||
'label' => 'label.name',
|
'label' => 'label.name',
|
||||||
])
|
])
|
||||||
// text
|
// text
|
||||||
@@ -57,7 +57,6 @@ class ProjectEditForm extends AbstractType
|
|||||||
'label' => 'label.budget',
|
'label' => 'label.budget',
|
||||||
'currency' => $builder->getOption('currency'),
|
'currency' => $builder->getOption('currency'),
|
||||||
])
|
])
|
||||||
// FIXME add budget
|
|
||||||
// do not allow activity selection as this causes headaches:
|
// do not allow activity selection as this causes headaches:
|
||||||
// 1. it is a bad UX
|
// 1. it is a bad UX
|
||||||
// 2. what should happen if they are detached?
|
// 2. what should happen if they are detached?
|
||||||
@@ -82,7 +81,7 @@ class ProjectEditForm extends AbstractType
|
|||||||
'csrf_protection' => true,
|
'csrf_protection' => true,
|
||||||
'csrf_field_name' => '_token',
|
'csrf_field_name' => '_token',
|
||||||
'csrf_token_id' => 'admin_activity_edit',
|
'csrf_token_id' => 'admin_activity_edit',
|
||||||
'currency' => 'EUR,'
|
'currency' => Customer::DEFAULT_CURRENCY,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
88
src/TimesheetBundle/Form/TimesheetEditForm.php
Normal file
88
src/TimesheetBundle/Form/TimesheetEditForm.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Kimai package.
|
||||||
|
*
|
||||||
|
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace TimesheetBundle\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use TimesheetBundle\Entity\Customer;
|
||||||
|
use TimesheetBundle\Entity\Timesheet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the form used to manipulate Timesheet entries.
|
||||||
|
*
|
||||||
|
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||||
|
*/
|
||||||
|
class TimesheetEditForm extends AbstractType
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
// datetime
|
||||||
|
->add('begin', DateTimeType::class, [
|
||||||
|
'label' => 'label.begin',
|
||||||
|
'date_widget' => 'single_text',
|
||||||
|
])
|
||||||
|
// datetime
|
||||||
|
->add('end', DateTimeType::class, [
|
||||||
|
'label' => 'label.end',
|
||||||
|
'date_widget' => 'single_text',
|
||||||
|
'required' => false,
|
||||||
|
])
|
||||||
|
// integer
|
||||||
|
/*
|
||||||
|
->add('duration', RangeType::class, [
|
||||||
|
'label' => 'label.duration',
|
||||||
|
])
|
||||||
|
// User
|
||||||
|
->add('user', UserType::class, [
|
||||||
|
'label' => 'label.user',
|
||||||
|
])
|
||||||
|
// Activity
|
||||||
|
->add('activity', ActivityType::class, [
|
||||||
|
'label' => 'label.activity',
|
||||||
|
])
|
||||||
|
*/
|
||||||
|
// customer
|
||||||
|
->add('description', TextareaType::class, [
|
||||||
|
'label' => 'label.description',
|
||||||
|
'required' => false,
|
||||||
|
])
|
||||||
|
// string
|
||||||
|
->add('rate', MoneyType::class, [
|
||||||
|
'label' => 'label.rate',
|
||||||
|
'currency' => $builder->getOption('currency'),
|
||||||
|
])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => Timesheet::class,
|
||||||
|
'csrf_protection' => true,
|
||||||
|
'csrf_field_name' => '_token',
|
||||||
|
'csrf_token_id' => 'admin_timsheet_edit',
|
||||||
|
'currency' => Customer::DEFAULT_CURRENCY,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
namespace TimesheetBundle\Repository;
|
namespace TimesheetBundle\Repository;
|
||||||
|
|
||||||
use AppBundle\Entity\User;
|
use AppBundle\Entity\User;
|
||||||
|
use Doctrine\ORM\Query;
|
||||||
use TimesheetBundle\Entity\Activity;
|
use TimesheetBundle\Entity\Activity;
|
||||||
use TimesheetBundle\Entity\Timesheet;
|
use TimesheetBundle\Entity\Timesheet;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
|
||||||
use Pagerfanta\Adapter\DoctrineORMAdapter;
|
use Pagerfanta\Adapter\DoctrineORMAdapter;
|
||||||
use Pagerfanta\Pagerfanta;
|
use Pagerfanta\Pagerfanta;
|
||||||
use TimesheetBundle\Model\ActivityStatistic;
|
use TimesheetBundle\Model\ActivityStatistic;
|
||||||
@@ -37,10 +37,52 @@ class ActivityRepository extends EntityRepository
|
|||||||
return $this->find($id);
|
return $this->find($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User|null $user
|
||||||
|
* @param \DateTime|null $startFrom
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getRecentActivities(User $user = null, \DateTime $startFrom = null)
|
||||||
|
{
|
||||||
|
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||||
|
|
||||||
|
$qb->select('t', 'a', 'p', 'c')
|
||||||
|
->from('TimesheetBundle:Timesheet', 't')
|
||||||
|
->join('t.activity', 'a')
|
||||||
|
->join('a.project', 'p')
|
||||||
|
->join('p.customer', 'c')
|
||||||
|
->where($qb->expr()->isNotNull('t.end'))
|
||||||
|
->groupBy('a.id')
|
||||||
|
->orderBy('t.end', 'DESC')
|
||||||
|
->setMaxResults(10)
|
||||||
|
;
|
||||||
|
|
||||||
|
if ($user !== null) {
|
||||||
|
$qb->andWhere('t.user = :user')
|
||||||
|
->setParameter('user', $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($startFrom !== null) {
|
||||||
|
$qb->andWhere($qb->expr()->gt('t.begin', ':begin'))
|
||||||
|
->setParameter('begin', $startFrom);
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = $qb->getQuery()->getResult();
|
||||||
|
|
||||||
|
$activities = [];
|
||||||
|
/* @var Timesheet $entry */
|
||||||
|
foreach($results as $entry) {
|
||||||
|
$activities[] = $entry->getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $activities;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return statistic data for all user.
|
* Return statistic data for all user.
|
||||||
*
|
*
|
||||||
* @return ActivityStatistic
|
* @return ActivityStatistic
|
||||||
|
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||||
*/
|
*/
|
||||||
public function getGlobalStatistics()
|
public function getGlobalStatistics()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
namespace TimesheetBundle\Repository;
|
namespace TimesheetBundle\Repository;
|
||||||
|
|
||||||
use AppBundle\Entity\User;
|
use AppBundle\Entity\User;
|
||||||
|
use TimesheetBundle\Entity\Activity;
|
||||||
use TimesheetBundle\Entity\Timesheet;
|
use TimesheetBundle\Entity\Timesheet;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
@@ -32,6 +33,51 @@ use DateTime;
|
|||||||
class TimesheetRepository extends EntityRepository
|
class TimesheetRepository extends EntityRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Timesheet $entry
|
||||||
|
* @return bool
|
||||||
|
* @throws \Doctrine\ORM\ORMException
|
||||||
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
|
*/
|
||||||
|
public function stopRecording(Timesheet $entry)
|
||||||
|
{
|
||||||
|
$end = new DateTime();
|
||||||
|
$begin = $entry->getBegin();
|
||||||
|
|
||||||
|
$entry->setEnd($end);
|
||||||
|
$entry->setDuration($end->getTimestamp() - $begin->getTimestamp());
|
||||||
|
|
||||||
|
// TODO calculate rate by users hourly rate
|
||||||
|
|
||||||
|
$entityManager = $this->getEntityManager();
|
||||||
|
$entityManager->persist($entry);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
* @param Activity $activity
|
||||||
|
* @return bool
|
||||||
|
* @throws \Doctrine\ORM\ORMException
|
||||||
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
|
*/
|
||||||
|
public function startRecording(User $user, Activity $activity)
|
||||||
|
{
|
||||||
|
$entry = new Timesheet();
|
||||||
|
$entry
|
||||||
|
->setBegin(new DateTime())
|
||||||
|
->setUser($user)
|
||||||
|
->setActivity($activity);
|
||||||
|
|
||||||
|
$entityManager = $this->getEntityManager();
|
||||||
|
$entityManager->persist($entry);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $select
|
* @param $select
|
||||||
* @param User|null $user
|
* @param User|null $user
|
||||||
@@ -78,6 +124,7 @@ class TimesheetRepository extends EntityRepository
|
|||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @return TimesheetStatistic
|
* @return TimesheetStatistic
|
||||||
|
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||||
*/
|
*/
|
||||||
public function getUserStatistics(User $user)
|
public function getUserStatistics(User $user)
|
||||||
{
|
{
|
||||||
@@ -159,7 +206,8 @@ class TimesheetRepository extends EntityRepository
|
|||||||
/**
|
/**
|
||||||
* Fetch statistic data for all user.
|
* Fetch statistic data for all user.
|
||||||
*
|
*
|
||||||
* @return TimesheetStatistic
|
* @return TimesheetGlobalStatistic
|
||||||
|
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||||
*/
|
*/
|
||||||
public function getGlobalStatistics()
|
public function getGlobalStatistics()
|
||||||
{
|
{
|
||||||
@@ -172,7 +220,7 @@ class TimesheetRepository extends EntityRepository
|
|||||||
$userTotal = $this->getEntityManager()
|
$userTotal = $this->getEntityManager()
|
||||||
->createQuery('SELECT COUNT(DISTINCT(t.user)) FROM TimesheetBundle:Timesheet t')
|
->createQuery('SELECT COUNT(DISTINCT(t.user)) FROM TimesheetBundle:Timesheet t')
|
||||||
->getSingleScalarResult();
|
->getSingleScalarResult();
|
||||||
$activeNow = $this->getActiveEntry();
|
$activeNow = $this->getActiveEntries();
|
||||||
$amountMonth = $this->queryThisMonth('SUM(t.rate)')
|
$amountMonth = $this->queryThisMonth('SUM(t.rate)')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->getSingleScalarResult();
|
->getSingleScalarResult();
|
||||||
@@ -197,16 +245,20 @@ class TimesheetRepository extends EntityRepository
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @return Query
|
* @return Timesheet[]|null
|
||||||
*/
|
*/
|
||||||
public function getActiveEntry(User $user = null)
|
public function getActiveEntries(User $user = null)
|
||||||
{
|
{
|
||||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||||
|
|
||||||
$qb->select('t')
|
$qb->select('t', 'a', 'p', 'c')
|
||||||
->from('TimesheetBundle:Timesheet', 't')
|
->from('TimesheetBundle:Timesheet', 't')
|
||||||
|
->join('t.activity', 'a')
|
||||||
|
->join('a.project', 'p')
|
||||||
|
->join('p.customer', 'c')
|
||||||
->where($qb->expr()->gt('t.begin', '0'))
|
->where($qb->expr()->gt('t.begin', '0'))
|
||||||
->andWhere($qb->expr()->isNull('t.end'));
|
->andWhere($qb->expr()->isNull('t.end'))
|
||||||
|
->orderBy('t.begin', 'DESC');
|
||||||
|
|
||||||
$params = [];
|
$params = [];
|
||||||
|
|
||||||
@@ -226,8 +278,9 @@ class TimesheetRepository extends EntityRepository
|
|||||||
{
|
{
|
||||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||||
|
|
||||||
$qb->select('t')
|
$qb->select('t', 'a')
|
||||||
->from('TimesheetBundle:Timesheet', 't')
|
->from('TimesheetBundle:Timesheet', 't')
|
||||||
|
->join('t.activity', 'a')
|
||||||
->orderBy('t.begin', 'DESC');
|
->orderBy('t.begin', 'DESC');
|
||||||
|
|
||||||
if (null !== $user) {
|
if (null !== $user) {
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
<li class="dropdown messages-menu">
|
||||||
|
<a href="#" class="dropdown-toggle ddt-large ticktac" data-toggle="dropdown">
|
||||||
|
<i class="fa fa-play-circle fa-2x"></i>
|
||||||
|
{% if entries is not empty %}<span class="label label-{% if entries|length >= kimai_context.active_warning %}warning{% else %}success{% endif %}">{{ entries|length }}</span>{% endif %}
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li class="header">
|
||||||
|
{{ 'active.entries'|transchoice(entries|length) }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<ul class="menu">
|
||||||
|
{% for entry in entries %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('timesheet_stop', {'id' : entry.id}) }}">
|
||||||
|
<div class="pull-left">
|
||||||
|
<i class="fa fa-stop-circle fa-2x"></i>
|
||||||
|
</div>
|
||||||
|
<h4>
|
||||||
|
{{ entry.activity.name }}
|
||||||
|
<small><i class="fa fa-clock-o"></i> {{ entry|durationForEntry }}</small>
|
||||||
|
</h4>
|
||||||
|
<p>{{ entry.activity.project.name }} ({{ entry.activity.project.customer.name }})</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="footer"><a href="#">{{ 'timesheet.start'|trans }}</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{% if activities is not empty %}
|
||||||
|
<li class="dropdown notifications-menu">
|
||||||
|
<a href="#" class="dropdown-toggle ddt-large" data-toggle="dropdown">
|
||||||
|
<i class="fa fa-tasks fa-2x"></i>
|
||||||
|
<span class="label label-success">{{ activities|length }}</span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li class="header">{{ 'recent.activities'|transchoice(activities|length) }}</li>
|
||||||
|
<li>
|
||||||
|
<ul class="menu">
|
||||||
|
{% for activity in activities %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('timesheet_start', {'id' : activity.id}) }}">
|
||||||
|
<i class="fa fa-play-circle text-green"></i> {{ 'recent.activities.format'|trans({'%activity%': activity.name, '%project%': activity.project.name, '%customer%': activity.project.customer.name}) }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="footer"><a href="{{ url('timesheet') }}">{{ 'timesheet.all'|trans }}</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
@@ -6,8 +6,6 @@
|
|||||||
{% block page_subtitle %}{{ 'admin_activity.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
|
{% block page_subtitle %}{{ 'admin_activity.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{{ include('default/_flash_messages.html.twig') }}
|
|
||||||
|
|
||||||
{% if entries.count > 0 %}
|
{% if entries.count > 0 %}
|
||||||
{{ tables.data_table_header({
|
{{ tables.data_table_header({
|
||||||
'label.id': 'hidden-xs',
|
'label.id': 'hidden-xs',
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
{% block page_subtitle %}{{ 'admin_activity.subtitle'|trans }}{% endblock %}
|
{% block page_subtitle %}{{ 'admin_activity.subtitle'|trans }}{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{{ include('default/_flash_messages.html.twig') }}
|
|
||||||
{{ include('default/_form.html.twig', {
|
{{ include('default/_form.html.twig', {
|
||||||
'title': activity.name,
|
'title': activity.name,
|
||||||
'form': form,
|
'form': form,
|
||||||
|
|||||||
@@ -6,22 +6,7 @@
|
|||||||
{% block page_subtitle %}{{ 'admin_customer.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
|
{% block page_subtitle %}{{ 'admin_customer.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{{ include('default/_flash_messages.html.twig') }}
|
{# Available fields: vat; contact; address; country; phone; fax; mobile; mail; homepage; timezone; #}
|
||||||
|
|
||||||
{#
|
|
||||||
private $vat;
|
|
||||||
private $contact;
|
|
||||||
private $street;
|
|
||||||
private $zipcode;
|
|
||||||
private $city;
|
|
||||||
private $country;
|
|
||||||
private $phone;
|
|
||||||
private $fax;
|
|
||||||
private $mobile;
|
|
||||||
private $mail;
|
|
||||||
private $homepage;
|
|
||||||
private $timezone;
|
|
||||||
#}
|
|
||||||
|
|
||||||
{% if entries.count > 0 %}
|
{% if entries.count > 0 %}
|
||||||
{{ tables.data_table_header({
|
{{ tables.data_table_header({
|
||||||
@@ -29,6 +14,8 @@
|
|||||||
'label.name': '',
|
'label.name': '',
|
||||||
'label.project': '',
|
'label.project': '',
|
||||||
'label.comment': 'hidden-xs',
|
'label.comment': 'hidden-xs',
|
||||||
|
'label.country': 'hidden-xs',
|
||||||
|
'label.currency': 'hidden-xs',
|
||||||
'label.visible': '',
|
'label.visible': '',
|
||||||
'label.actions': '',
|
'label.actions': '',
|
||||||
}) }}
|
}) }}
|
||||||
@@ -43,6 +30,8 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
<td class="hidden-xs">{{ entry.comment }}</td>
|
<td class="hidden-xs">{{ entry.comment }}</td>
|
||||||
|
<td class="hidden-xs">{{ entry.country|country }}</td>
|
||||||
|
<td class="hidden-xs">{{ entry.currency }} {{ entry.currency|currency }}</td>
|
||||||
<td>{{ widgets.label_visible(entry.visible) }}</td>
|
<td>{{ widgets.label_visible(entry.visible) }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ widgets.button_group({
|
{{ widgets.button_group({
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
{% block page_subtitle %}{{ 'admin_customer.subtitle'|trans }}{% endblock %}
|
{% block page_subtitle %}{{ 'admin_customer.subtitle'|trans }}{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{{ include('default/_flash_messages.html.twig') }}
|
|
||||||
{{ include('default/_form.html.twig', {
|
{{ include('default/_form.html.twig', {
|
||||||
'title': customer.name,
|
'title': customer.name,
|
||||||
'form': form,
|
'form': form,
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
{% block page_subtitle %}{{ 'admin_project.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
|
{% block page_subtitle %}{{ 'admin_project.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{{ include('default/_flash_messages.html.twig') }}
|
|
||||||
|
|
||||||
{% if entries.count > 0 %}
|
{% if entries.count > 0 %}
|
||||||
{{ tables.data_table_header({
|
{{ tables.data_table_header({
|
||||||
'label.id': 'hidden-xs',
|
'label.id': 'hidden-xs',
|
||||||
@@ -29,7 +27,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="hidden-xs hidden-sm">{{ entry.comment }}</td>
|
<td class="hidden-xs hidden-sm">{{ entry.comment }}</td>
|
||||||
<td class="hidden-xs hidden-sm">{{ widgets.badge_counter(entry.activities.count) }}</td>
|
<td class="hidden-xs hidden-sm">{{ widgets.badge_counter(entry.activities.count) }}</td>
|
||||||
<td class="hidden-xs">{{ entry.budget|money(entry.currency) }}</td>
|
<td class="hidden-xs">{{ entry.budget|money(entry.customer.currency) }}</td>
|
||||||
<td>{{ widgets.label_visible(entry.visible) }}</td>
|
<td>{{ widgets.label_visible(entry.visible) }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ widgets.button_group({
|
{{ widgets.button_group({
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
{% block page_subtitle %}{{ 'admin_project.subtitle'|trans }}{% endblock %}
|
{% block page_subtitle %}{{ 'admin_project.subtitle'|trans }}{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{{ include('default/_flash_messages.html.twig') }}
|
|
||||||
{{ include('default/_form.html.twig', {
|
{{ include('default/_form.html.twig', {
|
||||||
'title': project.name,
|
'title': project.name,
|
||||||
'form': form,
|
'form': form,
|
||||||
|
|||||||
14
src/TimesheetBundle/Resources/views/timesheet/edit.html.twig
Normal file
14
src/TimesheetBundle/Resources/views/timesheet/edit.html.twig
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
{% import "macros/widgets.html.twig" as widgets %}
|
||||||
|
{% import "macros/datatables.html.twig" as tables %}
|
||||||
|
|
||||||
|
{% block page_title %}{{ 'timesheet.title'|trans }}{% endblock %}
|
||||||
|
{% block page_subtitle %}{{ 'timesheet.subtitle'|trans }}{% endblock %}
|
||||||
|
|
||||||
|
{% block main %}
|
||||||
|
{{ include('default/_form.html.twig', {
|
||||||
|
'title': 'timesheet.edit'|trans,
|
||||||
|
'form': form,
|
||||||
|
'back': path('timesheet')
|
||||||
|
}) }}
|
||||||
|
{% endblock %}
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
'label.endtime': '',
|
'label.endtime': '',
|
||||||
'label.duration': 'hidden-xs',
|
'label.duration': 'hidden-xs',
|
||||||
'label.rate': 'hidden-xs',
|
'label.rate': 'hidden-xs',
|
||||||
|
'label.activity': 'hidden-xs hidden-sm',
|
||||||
'label.description': 'hidden-xs hidden-sm',
|
'label.description': 'hidden-xs hidden-sm',
|
||||||
'label.actions': '',
|
'label.actions': '',
|
||||||
}) }}
|
}) }}
|
||||||
@@ -27,12 +28,17 @@
|
|||||||
<td class="hidden-xs">{{ entry.rate|money }}</td>
|
<td class="hidden-xs">{{ entry.rate|money }}</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td>‐</td>
|
<td>‐</td>
|
||||||
<td class="hidden-xs">‐</td>
|
<td class="hidden-xs"><i>{{ entry.duration|duration }}</i></td>
|
||||||
<td class="hidden-xs">‐</td>
|
<td class="hidden-xs">‐</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<td class="hidden-xs hidden-sm">{{ entry.activity.name }}</td>
|
||||||
<td class="hidden-xs hidden-sm">{{ entry.description }}</td>
|
<td class="hidden-xs hidden-sm">{{ entry.description }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ widgets.button_group({'repeat': '#', 'edit': '#', 'trash': '#'}) }}
|
{% if entry.end %}
|
||||||
|
{{ widgets.button_group({'repeat': '#', 'edit': path('timesheet_edit', {'id' : entry.id, 'page': page}), 'trash': '#'}) }}
|
||||||
|
{% else %}
|
||||||
|
{{ widgets.button_group({'stop': path('timesheet_stop', {'id' : entry.id}), 'edit': path('timesheet_edit', {'id' : entry.id, 'page': page}), 'trash': '#'}) }}
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ include_once __DIR__.'/../var/bootstrap.php.cache';
|
|||||||
// $apcLoader->register(true);
|
// $apcLoader->register(true);
|
||||||
|
|
||||||
$kernel = new AppKernel('prod', false);
|
$kernel = new AppKernel('prod', false);
|
||||||
$kernel->loadClassCache();
|
|
||||||
|
|
||||||
// When using the HTTP Cache to improve application performance, the application
|
// When using the HTTP Cache to improve application performance, the application
|
||||||
// kernel is wrapped by the AppCache class to activate the built-in reverse proxy.
|
// kernel is wrapped by the AppCache class to activate the built-in reverse proxy.
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ $loader = require __DIR__.'/../app/autoload.php';
|
|||||||
Debug::enable();
|
Debug::enable();
|
||||||
|
|
||||||
$kernel = new AppKernel('dev', true);
|
$kernel = new AppKernel('dev', true);
|
||||||
$kernel->loadClassCache();
|
|
||||||
$request = Request::createFromGlobals();
|
$request = Request::createFromGlobals();
|
||||||
$response = $kernel->handle($request);
|
$response = $kernel->handle($request);
|
||||||
$response->send();
|
$response->send();
|
||||||
|
|||||||
@@ -1,28 +1,57 @@
|
|||||||
#ticktac img {
|
/* ================================ NAVBAR ================================ */
|
||||||
width: 30px;
|
|
||||||
|
.navbar-nav>li>a.ddt-large {
|
||||||
|
padding-top: 12px;
|
||||||
|
padding-bottom: 9px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
li.messages-menu ul.menu li:hover .pull-left i {
|
||||||
|
color: #dd4b39;
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
.ticktac:hover i.running{
|
||||||
|
color: #4ff131;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.open .ticktac i.running{
|
||||||
|
color: #4ff131;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ticktac i.stopped{
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ticktac:hover i.stopped{
|
||||||
|
color: #4ff131;
|
||||||
|
}
|
||||||
.user-panel>.info {
|
.user-panel>.info {
|
||||||
left: 40px;
|
left: 40px;
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
}
|
}
|
||||||
/*
|
*/
|
||||||
#ticktac img {
|
|
||||||
width: 100%;
|
|
||||||
}
|
/* ================================ SIDEBAR ================================ */
|
||||||
|
|
||||||
|
/* Used for the Sidebar UserPanel (which is deactivated right now) */
|
||||||
.user-panel>.info {
|
.user-panel>.info {
|
||||||
left: 80px;
|
left: 80px;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
/* ================================ FOOTER ================================ */
|
||||||
|
|
||||||
footer.main-footer {
|
footer.main-footer {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================ DATA-TABLES ================================ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO
|
TODO "display:hidden" regel für dataTable - spalten - mobile ansicht
|
||||||
"display:hidden" regel für dataTable - spalten - mobile ansicht
|
TODO "display:hidden" regel für dataTable - header icon - mobile ansicht
|
||||||
"display:hidden" regel für dataTable - header icon - mobile ansicht
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,15 @@ $(document).ready(function() {
|
|||||||
publish: function() {
|
publish: function() {
|
||||||
pubSub.trigger.apply(pubSub, arguments);
|
pubSub.trigger.apply(pubSub, arguments);
|
||||||
},
|
},
|
||||||
ticktac: function(selector) {
|
pauseRecord: function(selector) {
|
||||||
$(selector + ' img').hover(function () {
|
$(selector + ' .pull-left i').hover(function () {
|
||||||
$(this).attr('src', $.fn.kimai.settings.imagePath + '/buzzer-on-hover.png');
|
var link = $(this).parents('a');
|
||||||
|
link.attr('href', link.attr('href').replace('/stop', '/pause'));
|
||||||
|
$(this).removeClass('fa-stop-circle').addClass('fa-pause-circle').addClass('text-orange');
|
||||||
},function () {
|
},function () {
|
||||||
$(this).attr('src', $.fn.kimai.settings.imagePath + '/buzzer-on.png');
|
var link = $(this).parents('a');
|
||||||
|
link.attr('href', link.attr('href').replace('/pause', '/stop'));
|
||||||
|
$(this).removeClass('fa-pause-circle').removeClass('text-orange').addClass('fa-stop-circle');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user