Skip to content

Commit

Permalink
#2 Corretions to ResT documentation of v2.0.0
Browse files Browse the repository at this point in the history
Included some minor correction in the code
  • Loading branch information
thucke committed Nov 11, 2017
1 parent 5e56964 commit 0c84320
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 285 deletions.
17 changes: 16 additions & 1 deletion Classes/Controller/TimezonesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function showAction() {
$this->logger->log( \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'Entry showAction', array());
$this->logger->log( \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'Timezone', array($this->timezoneService->getOffset(), date('Y-m-d H:i',time())));
$this->view->assign('tz_name', $this->timezoneService->getCurrentTimezoneAbbreviation());
$this->view->assign('curdatetime', $this->timezoneService->getIntlDateFormatter()->format(time()));
$this->view->assign('curdatetime', $this->formatDateTime(time()));
$this->logger->log( \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'Exit showAction', array());
}

Expand Down Expand Up @@ -192,5 +192,20 @@ private function checkIntlModule() {
);
}
}

/**
* Convert time to users timezone if avaiable
* @link http://www.php.net/manual/en/intldateformatter.format.php
* @param mixed $value
* @return string The formatted string or, if an error occurred, false.
*/
private function formatDateTime($tstamp) {
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('timezones')) {
$rc = \Thucke\Timezones\Utility\TimezonesUtility::convertToTimezone($tstamp);
} else {
$rc = date(DATE_RFC850, $tstamp);
}
return $rc;
}
}
?>
41 changes: 18 additions & 23 deletions Documentation/Administrator/Index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. ==================================================
.. ==================================================
.. FOR YOUR INFORMATION
.. --------------------------------------------------
.. -*- coding: utf-8 -*- with BOM.
Expand Down Expand Up @@ -28,42 +28,37 @@ Installation
To install the extension, perform the following steps:

#. Check that the php module *intl* is activated
You may place a tiny phpinfo.php on the diretory of your website:
You may place a tiny phpinfo.php on the diretory of your website:

.. code-block:: php
.. code-block:: php
<?php
ini_set('display_errors','on');
phpinfo();
?>
<?php
ini_set('display_errors','on');
phpinfo();
?>
You should look for a section similar to the following:
You should look for a section similar to the following:

.. figure:: ../Images/PhpInfoIntlModule.png
:alt: PHPINFO Section identifying installed module
:alt: PHPINFO Section identifying installed module

If you find that the extension is *NOT* installed please check http://php.net/manual/de/intl.installation.php for installation options.
If you find that the extension is *NOT* installed please check http://php.net/manual/de/intl.installation.php for installation options.

#. Go to the Extension Manager
#. Install the extension
#. Load the static template
#. Include the pre-defined COA in either of the following ways on **every** page where timezone calculation should take place
#. Typoscript with the predefined COA object :typoscript:`lib.timezone`
#. Fluid template:

.. code-block:: html

<f:cObject typoscriptObjectPath="lib.timezone" />

The COA will generate a hyperlink to the page set in the configuration:
#. You may include the pre-defined COA in either of the following ways to show a hyperlink telling the current choosen timezone.
#. Typoscript with the predefined COA object :typoscript:`lib.timezone`
#. Fluid template:

.. figure:: ../Images/IndexTimezone.png
:alt: Link showing current timezone
.. code-block:: html

.. important::
<f:cObject typoscriptObjectPath="lib.timezone" />

Place timezone link on every page to activate time calculation
The COA will generate a hyperlink to the page set in the configuration:

.. figure:: ../Images/IndexTimezone.png
:alt: Link showing current timezone

.. _admin-configuration:

Expand Down
2 changes: 1 addition & 1 deletion Documentation/Changelog/Index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. ==================================================
.. ==================================================
.. FOR YOUR INFORMATION
.. --------------------------------------------------
.. -*- coding: utf-8 -*- with BOM.
Expand Down
21 changes: 13 additions & 8 deletions Documentation/Developer/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@ Target group: **Extension developers**

Create a central function in your extension where you format dates and times, e.g. a function formatDateTime($timestamp):

.. code-block:: php
::

/**
* Convert time to users timezone if avaiable
*
* @param mixed $value
* @return string The formatted string or, if an error occurred, false.
*/
function formatDateTime($tstamp) {
if (TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('timezones')) {
$rc = Thucke\Timezones\Utility\TimezonesUtility::convertToTimezone($tstamp);
} else {
$rc = date($format, $tstamp);
}
return $rc;
private function formatDateTime($tstamp) {
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('timezones')) {
// @link http://www.php.net/manual/en/intldateformatter.format.php
$rc = \Thucke\Timezones\Utility\TimezonesUtility::convertToTimezone($tstamp);
} else {
// @link http://www.php.net/manual/en/function.date.php
$rc = date(DATE_RFC850, $tstamp);
}
return $rc;
}

Use this function wherever u need to display dates and/or times. That's it. No more need to take care of anything else.
78 changes: 37 additions & 41 deletions Documentation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@
:class: typoscript
.. role:: php(code)
.. highlight:: php

.. |br| raw:: html

<br />


.. _docs.typo3.org: https://docs.typo3.org/typo3cms/extensions/timezones/
.. _docs.typo3.org: https://docs.typo3.org/typo3cms/extensions/timezones/

.. |img-1| image:: Images/hr.gif
.. :align: left
Expand All @@ -38,50 +32,39 @@ Timezones

.. only:: html

:Classification:
timezones

:Version:
|release|
:Classification:
timezones

:Language:
en
:Version:
|release|

:Description:
Manages timezones in your website
:Language:
en

:Keywords:
extbase fluid timezone
:Description:
Manages timezones in your website

:Author:
Thomas Hucke
:Keywords:
extbase timezone datetime l18n

:Email:
thucke@web.de
:Author:
Thomas Hucke

:License:
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
:Email:
thucke@web.de

:Rendered:
|today|
:License:
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml

:Rendered:
|today|

The content of this document is related to TYPO3,
a GNU/GPL CMS/Framework available from `www.typo3.org <http://www.typo3.org/>`_.

The content of this document is related to TYPO3,
a GNU/GPL CMS/Framework available from `www.typo3.org <http://www.typo3.org/>`_.

**Table of Contents**

.. toctree::
:maxdepth: 5
:titlesonly:

Introduction/Index
Administrator/Index
User/Index
Developer/Index
Changelog/Index


|img-1|
Expand All @@ -90,5 +73,18 @@ Timezones

|img-1|

You'll find this documentation under `docs.typo3.org`_. |br|
*Thanks to Ralph Schuster who initially created this extension and finally agreed transferring it to me.*

**Table of Contents**

.. toctree::
:maxdepth: 5

Introduction/Index
Administrator/Index
User/Index
Developer/Index
Changelog/Index

You'll find this documentation under `docs.typo3.org`_.

*Thanks to Ralph Schuster who initially created this extension and finally agreed transferring it to me.*
14 changes: 7 additions & 7 deletions Documentation/Introduction/Index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. ==================================================
.. ==================================================
.. FOR YOUR INFORMATION
.. --------------------------------------------------
.. -*- coding: utf-8 -*- with BOM.
Expand Down Expand Up @@ -44,16 +44,16 @@ will be visible on the screen as per default. You may adjust everthing as
you like.

.. figure:: ../Images/IndexTimezone.png
:alt: Link showing current timezone
:alt: Link showing current timezone

Place timezone link on every page to activate time calculation
Place timezone link on every page to activate time calculation

.. figure:: ../Images/ShowTimezone.png
:alt: Content element showing current timezone
:alt: Content element showing current timezone

Content element to display current timezone information
Content element to display current timezone information

.. figure:: ../Images/SelectTimezone.png
:alt: Content element to change current timezone
:alt: Content element to change current timezone

Content element to change current timezone
Content element to change current timezone
34 changes: 17 additions & 17 deletions Documentation/Settings.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
conf.py:
copyright: 2017, Thomas Hucke
project: Timezones
version: 2.0
release: 2.0
html_theme_options:
github_repository: thucke/TYPO3.ext.timezones
github_branch: master
latex_documents:
- - Index
- timezones.tex
- Manages timezones in your website
- Thomas Hucke
- manual
latex_elements:
papersize: a4paper
pointsize: 10pt
conf.py:
copyright: 2017, Thomas Hucke
project: Timezones
version: 2.0
release: 2.0
html_theme_options:
github_repository: thucke/TYPO3.ext.timezones
github_branch: master
latex_documents:
- - Index
- timezones.tex
- Manages timezones in your website
- Thomas Hucke
- manual
latex_elements:
papersize: a4paper
pointsize: 10pt
preamble: \usepackage{typo3}
Loading

0 comments on commit 0c84320

Please sign in to comment.