Merge pull request #714 from kitodo/dev-prepare-calendar-plugin

Extbase: Calendar Plugin
This commit is contained in:
Alexander Bigga 2021-10-21 19:15:34 +02:00 committed by GitHub
commit 3f08f4beca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 662 additions and 568 deletions

View File

@ -11,9 +11,9 @@
namespace Kitodo\Dlf\Controller;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
@ -122,5 +122,4 @@ class AudioplayerController extends AbstractController
return;
}
}
}

View File

@ -0,0 +1,387 @@
<?php
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Kitodo\Dlf\Controller;
use Kitodo\Dlf\Common\Helper;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class CalendarController extends AbstractController
{
public $prefixId = 'tx_dlf';
/**
* The main method of the plugin
*
* @return void
*/
public function mainAction()
{
$requestData = GeneralUtility::_GPmerged('tx_dlf');
unset($requestData['__referrer'], $requestData['__trustedProperties']);
// Set initial document (anchor or year file) if configured.
if (empty($requestData['id']) && !empty($this->settings['initialDocument'])) {
$requestData['id'] = $this->settings['initialDocument'];
}
// Load current document.
$this->loadDocument($requestData);
if ($this->doc === null) {
// Quit without doing anything if required variables are not set.
return;
}
$metadata = $this->doc->getTitledata();
if (!empty($metadata['type'][0])) {
$type = $metadata['type'][0];
} else {
return;
}
switch ($type) {
case 'newspaper':
case 'ephemera':
$this->forward('years', NULL, NULL, $requestData);
case 'year':
$this->forward('calendar', NULL, NULL, $requestData);
case 'issue':
default:
break;
}
}
/**
* The Calendar Method
*
* @access public
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return void
*/
public function calendarAction()
{
$requestData = GeneralUtility::_GPmerged('tx_dlf');
unset($requestData['__referrer'], $requestData['__trustedProperties']);
// access arguments passed by the mainAction()
$mainrquestData = $this->request->getArguments();
// merge both arguments together --> passing id by GET parameter tx_dlf[id] should win
$requestData = array_merge($requestData, $mainrquestData);
// Load current document.
$this->loadDocument($requestData);
if ($this->doc === null) {
// Quit without doing anything if required variables are not set.
return;
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
// Get all children of year anchor.
$result = $queryBuilder
->select(
'tx_dlf_documents.uid AS uid',
'tx_dlf_documents.title AS title',
'tx_dlf_documents.year AS year',
'tx_dlf_documents.mets_label AS label',
'tx_dlf_documents.mets_orderlabel AS orderlabel'
)
->from('tx_dlf_documents')
->where(
$queryBuilder->expr()->eq('tx_dlf_documents.structure', Helper::getUidFromIndexName('issue', 'tx_dlf_structures', $this->doc->cPid)),
$queryBuilder->expr()->eq('tx_dlf_documents.partof', intval($this->doc->uid)),
Helper::whereExpression('tx_dlf_documents')
)
->orderBy('tx_dlf_documents.mets_orderlabel')
->execute();
$issues = [];
// Process results.
while ($resArray = $result->fetch()) {
// Set title for display in calendar view.
if (!empty($resArray['title'])) {
$title = $resArray['title'];
} else {
$title = !empty($resArray['label']) ? $resArray['label'] : $resArray['orderlabel'];
if (strtotime($title) !== false) {
$title = strftime('%x', strtotime($title));
}
}
$issues[] = [
'uid' => $resArray['uid'],
'title' => $title,
'year' => $resArray['year']
];
}
// We need an array of issues with year => month => day number as key.
$calendarIssuesByYear = [];
foreach ($issues as $issue) {
$dateTimestamp = strtotime($issue['year']);
if ($dateTimestamp !== false) {
$_year = date('Y', $dateTimestamp);
$_month = date('n', $dateTimestamp);
$_day = date('j', $dateTimestamp);
$calendarIssuesByYear[$_year][$_month][$_day][] = $issue;
} else {
$this->logger->warning('Document with UID ' . $issue['uid'] . 'has no valid date of publication');
}
}
// Sort by years.
ksort($calendarIssuesByYear);
// Build calendar for year (default) or season.
$iteration = 1;
foreach ($calendarIssuesByYear as $year => $calendarIssuesByMonth) {
// Sort by months.
ksort($calendarIssuesByMonth);
// Default: First month is January, last month is December.
$firstMonth = 1;
$lastMonth = 12;
// Show calendar from first issue up to end of season if applicable.
if (
empty($this->settings['showEmptyMonths'])
&& count($calendarIssuesByYear) > 1
) {
if ($iteration == 1) {
$firstMonth = (int) key($calendarIssuesByMonth);
} elseif ($iteration == count($calendarIssuesByYear)) {
end($calendarIssuesByMonth);
$lastMonth = (int) key($calendarIssuesByMonth);
}
}
$this->getCalendarYear($calendarIssuesByMonth, $year, $firstMonth, $lastMonth);
$iteration++;
}
// Prepare list as alternative view.
$issueData = [];
foreach ($this->allIssues as $dayTimestamp => $issues) {
$issueData[$dayTimestamp]['dateString'] = strftime('%A, %x', $dayTimestamp);
$issueData[$dayTimestamp]['items'] = [];
foreach ($issues as $issue) {
$issueData[$dayTimestamp]['items'][] = $issue;
}
}
$this->view->assign('issueData', $issueData);
// Link to current year.
$linkTitleData = $this->doc->getTitledata();
$yearLinkTitle = !empty($linkTitleData['mets_orderlabel'][0]) ? $linkTitleData['mets_orderlabel'][0] : $linkTitleData['mets_label'][0];
$this->view->assign('documentId', $this->doc->uid);
$this->view->assign('yearLinkTitle', $yearLinkTitle);
$this->view->assign('parentDocumentId', $this->doc->parentId);
$this->view->assign('allYearDocTitle', $this->doc->getTitle($this->doc->parentId));
}
/**
* The Years Method
*
* @access public
*
* @return void
*/
public function yearsAction()
{
$requestData = GeneralUtility::_GPmerged('tx_dlf');
unset($requestData['__referrer'], $requestData['__trustedProperties']);
// access arguments passed by the mainAction()
$mainrquestData = $this->request->getArguments();
// merge both arguments together --> passing id by GET parameter tx_dlf[id] should win
$requestData = array_merge($requestData, $mainrquestData);
// Load current document.
$this->loadDocument($requestData);
if ($this->doc === null) {
// Quit without doing anything if required variables are not set.
return;
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
// Get all children of anchor. This should be the year anchor documents
$result = $queryBuilder
->select(
'tx_dlf_documents.uid AS uid',
'tx_dlf_documents.title AS title',
'tx_dlf_documents.mets_label AS label',
'tx_dlf_documents.mets_orderlabel AS orderlabel'
)
->from('tx_dlf_documents')
->where(
$queryBuilder->expr()->eq('tx_dlf_documents.structure', Helper::getUidFromIndexName('year', 'tx_dlf_structures', $this->doc->cPid)),
$queryBuilder->expr()->eq('tx_dlf_documents.partof', intval($this->doc->uid)),
Helper::whereExpression('tx_dlf_documents')
)
->orderBy('tx_dlf_documents.mets_orderlabel')
->execute();
$years = [];
// Process results.
while ($resArray = $result->fetch()) {
$years[] = [
'title' => !empty($resArray['label']) ? $resArray['label'] : (!empty($resArray['orderlabel']) ? $resArray['orderlabel'] : $resArray['title']),
'uid' => $resArray['uid']
];
}
$yearArray = [];
if (count($years) > 0) {
foreach ($years as $year) {
$yearArray[] = [
'documentId' => $year['uid'],
'title' => $year['title']
];
}
$this->view->assign('yearName', $yearArray);
}
$this->view->assign('documentId', $this->doc->uid);
$this->view->assign('allYearDocTitle', $this->doc->getTitle($this->doc->uid));
}
/**
* Build calendar for a certain year
*
* @access protected
*
* @param array $calendarIssuesByMonth All issues sorted by month => day
* @param int $year Gregorian year
* @param int $firstMonth 1 for January, 2 for February, ... 12 for December
* @param int $lastMonth 1 for January, 2 for February, ... 12 for December
*
* @return string Content for template subpart
*/
protected function getCalendarYear($calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12)
{
$calendarData = [];
for ($i = $firstMonth; $i <= $lastMonth; $i++) {
$calendarData[$i] = [
'DAYMON_NAME' => strftime('%a', strtotime('last Monday')),
'DAYTUE_NAME' => strftime('%a', strtotime('last Tuesday')),
'DAYWED_NAME' => strftime('%a', strtotime('last Wednesday')),
'DAYTHU_NAME' => strftime('%a', strtotime('last Thursday')),
'DAYFRI_NAME' => strftime('%a', strtotime('last Friday')),
'DAYSAT_NAME' => strftime('%a', strtotime('last Saturday')),
'DAYSUN_NAME' => strftime('%a', strtotime('last Sunday')),
'MONTHNAME' => strftime('%B', strtotime($year . '-' . $i . '-1')) . ' ' . $year,
'CALYEAR' => ($i == $firstMonth) ? $year : ''
];
$firstOfMonth = strtotime($year . '-' . $i . '-1');
$lastOfMonth = strtotime('last day of', ($firstOfMonth));
$firstOfMonthStart = strtotime('last Monday', $firstOfMonth);
// There are never more than 6 weeks in a month.
for ($j = 0; $j <= 5; $j++) {
$firstDayOfWeek = strtotime('+ ' . $j . ' Week', $firstOfMonthStart);
$calendarData[$i]['week'][$j] = [
'DAYMON' => ['dayValue' => '&nbsp;'],
'DAYTUE' => ['dayValue' => '&nbsp;'],
'DAYWED' => ['dayValue' => '&nbsp;'],
'DAYTHU' => ['dayValue' => '&nbsp;'],
'DAYFRI' => ['dayValue' => '&nbsp;'],
'DAYSAT' => ['dayValue' => '&nbsp;'],
'DAYSUN' => ['dayValue' => '&nbsp;'],
];
// Every week has seven days. ;-)
for ($k = 0; $k <= 6; $k++) {
$currentDayTime = strtotime('+ ' . $k . ' Day', $firstDayOfWeek);
if (
$currentDayTime >= $firstOfMonth
&& $currentDayTime <= $lastOfMonth
) {
$dayLinks = '';
$dayLinksText = [];
$currentMonth = date('n', $currentDayTime);
if (is_array($calendarIssuesByMonth[$currentMonth])) {
foreach ($calendarIssuesByMonth[$currentMonth] as $id => $day) {
if ($id == date('j', $currentDayTime)) {
$dayLinks = $id;
foreach ($day as $issue) {
$dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title'];
$dayLinksText[] = [
'documentId' => $issue['uid'],
'text' => $dayLinkLabel
];
// Save issue for list view.
$this->allIssues[$currentDayTime][] = [
'documentId' => $issue['uid'],
'text' => $dayLinkLabel
];
}
}
}
$dayLinkDiv = $dayLinksText;
}
switch (strftime('%w', strtotime('+ ' . $k . ' Day', $firstDayOfWeek))) {
case '0':
$calendarData[$i]['week'][$j]['DAYSUN']['dayValue'] = strftime('%d', $currentDayTime);
if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
$calendarData[$i]['week'][$j]['DAYSUN']['issues'] = $dayLinkDiv;
}
break;
case '1':
$calendarData[$i]['week'][$j]['DAYMON']['dayValue'] = strftime('%d', $currentDayTime);
if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
$calendarData[$i]['week'][$j]['DAYMON']['issues'] = $dayLinkDiv;
}
break;
case '2':
$calendarData[$i]['week'][$j]['DAYTUE']['dayValue'] = strftime('%d', $currentDayTime);
if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
$calendarData[$i]['week'][$j]['DAYTUE']['issues'] = $dayLinkDiv;
}
break;
case '3':
$calendarData[$i]['week'][$j]['DAYWED']['dayValue'] = strftime('%d', $currentDayTime);
if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
$calendarData[$i]['week'][$j]['DAYWED']['issues'] = $dayLinkDiv;
}
break;
case '4':
$calendarData[$i]['week'][$j]['DAYTHU']['dayValue'] = strftime('%d', $currentDayTime);
if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
$calendarData[$i]['week'][$j]['DAYTHU']['issues'] = $dayLinkDiv;
}
break;
case '5':
$calendarData[$i]['week'][$j]['DAYFRI']['dayValue'] = strftime('%d', $currentDayTime);
if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
$calendarData[$i]['week'][$j]['DAYFRI']['issues'] = $dayLinkDiv;
}
break;
case '6':
$calendarData[$i]['week'][$j]['DAYSAT']['dayValue'] = strftime('%d', $currentDayTime);
if ((int) $dayLinks === (int) date('j', $currentDayTime)) {
$calendarData[$i]['week'][$j]['DAYSAT']['issues'] = $dayLinkDiv;
}
break;
}
}
}
}
}
$this->view->assign('calendarData', $calendarData);
}
}

View File

@ -11,9 +11,9 @@
namespace Kitodo\Dlf\Controller;
use Kitodo\Dlf\Common\Helper;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use Kitodo\Dlf\Common\Helper;
class NavigationController extends AbstractController
{

View File

@ -13,7 +13,6 @@ namespace Kitodo\Dlf\Controller;
use Kitodo\Dlf\Common\Document;
use Kitodo\Dlf\Common\Helper;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

View File

@ -1,448 +0,0 @@
<?php
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Kitodo\Dlf\Plugin;
use Kitodo\Dlf\Common\Helper;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Plugin 'Calendar' for the 'dlf' extension
*
* @author Alexander Bigga <alexander.bigga@slub-dresden.de>
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage dlf
* @access public
*/
class Calendar extends \Kitodo\Dlf\Common\AbstractPlugin
{
public $scriptRelPath = 'Classes/Plugin/Calendar.php';
/**
* This holds all issues for the list view.
*
* @var array
* @access protected
*/
protected $allIssues = [];
/**
* The main method of the PlugIn
*
* @access public
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return string The content that is displayed on the website
*/
public function main($content, $conf)
{
$this->init($conf);
// Set initial document (anchor or year file) if configured.
if (empty($this->piVars['id']) && !empty($this->conf['settings.initialDocument'])) {
$this->piVars['id'] = $this->conf['settings.initialDocument'];
}
// Load current document.
$this->loadDocument();
if ($this->doc === null) {
// Quit without doing anything if required variables are not set.
return $content;
}
$metadata = $this->doc->getTitledata();
if (!empty($metadata['type'][0])) {
$type = $metadata['type'][0];
} else {
return $content;
}
switch ($type) {
case 'newspaper':
case 'ephemera':
return $this->years($content, $conf);
case 'year':
return $this->calendar($content, $conf);
case 'issue':
default:
break;
}
// Nothing to do here.
return $content;
}
/**
* The Calendar Method
*
* @access public
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return string The content that is displayed on the website
*/
public function calendar($content, $conf)
{
$this->init($conf);
// Load current document.
$this->loadDocument();
if ($this->doc === null) {
// Quit without doing anything if required variables are not set.
return $content;
}
// Load template file.
$this->getTemplate('###TEMPLATECALENDAR###');
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
// Get all children of year anchor.
$result = $queryBuilder
->select(
'tx_dlf_documents.uid AS uid',
'tx_dlf_documents.title AS title',
'tx_dlf_documents.year AS year',
'tx_dlf_documents.mets_label AS label',
'tx_dlf_documents.mets_orderlabel AS orderlabel'
)
->from('tx_dlf_documents')
->where(
$queryBuilder->expr()->eq('tx_dlf_documents.structure', Helper::getUidFromIndexName('issue', 'tx_dlf_structures', $this->doc->cPid)),
$queryBuilder->expr()->eq('tx_dlf_documents.partof', intval($this->doc->uid)),
Helper::whereExpression('tx_dlf_documents')
)
->orderBy('tx_dlf_documents.mets_orderlabel')
->execute();
$issues = [];
// Process results.
while ($resArray = $result->fetch()) {
// Set title for display in calendar view.
if (!empty($resArray['title'])) {
$title = $resArray['title'];
} else {
$title = !empty($resArray['label']) ? $resArray['label'] : $resArray['orderlabel'];
if (strtotime($title) !== false) {
$title = strftime('%x', strtotime($title));
}
}
$issues[] = [
'uid' => $resArray['uid'],
'title' => $title,
'year' => $resArray['year']
];
}
// We need an array of issues with year => month => day number as key.
$calendarIssuesByYear = [];
foreach ($issues as $issue) {
$dateTimestamp = strtotime($issue['year']);
if ($dateTimestamp !== false) {
$_year = date('Y', $dateTimestamp);
$_month = date('n', $dateTimestamp);
$_day = date('j', $dateTimestamp);
$calendarIssuesByYear[$_year][$_month][$_day][] = $issue;
} else {
$this->logger->warning('Document with UID ' . $issue['uid'] . 'has no valid date of publication');
}
}
// Sort by years.
ksort($calendarIssuesByYear);
// Build calendar for year (default) or season.
$subPartContent = '';
$iteration = 1;
foreach ($calendarIssuesByYear as $year => $calendarIssuesByMonth) {
// Sort by months.
ksort($calendarIssuesByMonth);
// Default: First month is January, last month is December.
$firstMonth = 1;
$lastMonth = 12;
// Show calendar from first issue up to end of season if applicable.
if (
empty($this->conf['settings.showEmptyMonths'])
&& count($calendarIssuesByYear) > 1
) {
if ($iteration == 1) {
$firstMonth = (int) key($calendarIssuesByMonth);
} elseif ($iteration == count($calendarIssuesByYear)) {
end($calendarIssuesByMonth);
$lastMonth = (int) key($calendarIssuesByMonth);
}
}
$subPartContent .= $this->getCalendarYear($calendarIssuesByMonth, $year, $firstMonth, $lastMonth);
$iteration++;
}
// Prepare list as alternative view.
$subPartContentList = '';
// Get subpart templates.
$subParts['list'] = $this->templateService->getSubpart($this->template, '###ISSUELIST###');
$subParts['singleday'] = $this->templateService->getSubpart($subParts['list'], '###SINGLEDAY###');
foreach ($this->allIssues as $dayTimestamp => $issues) {
$markerArrayDay['###DATE_STRING###'] = strftime('%A, %x', $dayTimestamp);
$markerArrayDay['###ITEMS###'] = '';
foreach ($issues as $issue) {
$markerArrayDay['###ITEMS###'] .= $issue;
}
$subPartContentList .= $this->templateService->substituteMarkerArray($subParts['singleday'], $markerArrayDay);
}
$this->template = $this->templateService->substituteSubpart($this->template, '###SINGLEDAY###', $subPartContentList);
// Link to current year.
$linkConf = [
'useCacheHash' => 1,
'parameter' => $GLOBALS['TSFE']->id,
'forceAbsoluteUrl' => !empty($this->conf['settings.forceAbsoluteUrl']) ? 1 : 0,
'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['settings.forceAbsoluteUrl']) && !empty($this->conf['settings.forceAbsoluteUrlHttps']) ? 'https' : 'http'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->uid),
];
$linkTitleData = $this->doc->getTitledata();
$linkTitle = !empty($linkTitleData['mets_orderlabel'][0]) ? $linkTitleData['mets_orderlabel'][0] : $linkTitleData['mets_label'][0];
$yearLink = $this->cObj->typoLink($linkTitle, $linkConf);
// Link to years overview.
$linkConf = [
'useCacheHash' => 1,
'parameter' => $GLOBALS['TSFE']->id,
'forceAbsoluteUrl' => !empty($this->conf['settings.forceAbsoluteUrl']) ? 1 : 0,
'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['settings.forceAbsoluteUrl']) && !empty($this->conf['settings.forceAbsoluteUrlHttps']) ? 'https' : 'http'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->parentId),
];
$allYearsLink = $this->cObj->typoLink(htmlspecialchars($this->pi_getLL('allYears', '')) . ' ' . $this->doc->getTitle($this->doc->parentId), $linkConf);
// Fill marker array.
$markerArray = [
'###CALENDARVIEWACTIVE###' => count($this->allIssues) > 5 ? 'active' : '',
'###LISTVIEWACTIVE###' => count($this->allIssues) < 6 ? 'active' : '',
'###CALYEAR###' => $yearLink,
'###CALALLYEARS###' => $allYearsLink,
'###LABEL_CALENDAR###' => htmlspecialchars($this->pi_getLL('label.view_calendar')),
'###LABEL_LIST_VIEW###' => htmlspecialchars($this->pi_getLL('label.view_list')),
];
$this->template = $this->templateService->substituteMarkerArray($this->template, $markerArray);
return $this->templateService->substituteSubpart($this->template, '###CALMONTH###', $subPartContent);
}
/**
* Build calendar for a certain year
*
* @access protected
*
* @param array $calendarIssuesByMonth All issues sorted by month => day
* @param int $year Gregorian year
* @param int $firstMonth 1 for January, 2 for February, ... 12 for December
* @param int $lastMonth 1 for January, 2 for February, ... 12 for December
*
* @return string Content for template subpart
*/
protected function getCalendarYear($calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12)
{
// Get subpart templates.
$subPartContent = '';
$subParts['month'] = $this->templateService->getSubpart($this->template, '###CALMONTH###');
$subParts['week'] = $this->templateService->getSubpart($subParts['month'], '###CALWEEK###');
for ($i = $firstMonth; $i <= $lastMonth; $i++) {
$markerArray = [
'###DAYMON_NAME###' => strftime('%a', strtotime('last Monday')),
'###DAYTUE_NAME###' => strftime('%a', strtotime('last Tuesday')),
'###DAYWED_NAME###' => strftime('%a', strtotime('last Wednesday')),
'###DAYTHU_NAME###' => strftime('%a', strtotime('last Thursday')),
'###DAYFRI_NAME###' => strftime('%a', strtotime('last Friday')),
'###DAYSAT_NAME###' => strftime('%a', strtotime('last Saturday')),
'###DAYSUN_NAME###' => strftime('%a', strtotime('last Sunday')),
'###MONTHNAME###' => strftime('%B', strtotime($year . '-' . $i . '-1')) . ' ' . $year,
'###CALYEAR###' => ($i == $firstMonth) ? '<div class="year">' . $year . '</div>' : ''
];
// Fill the month markers.
$subPartContentMonth = $this->templateService->substituteMarkerArray($subParts['month'], $markerArray);
// Reset week content of new month.
$subPartContentWeek = '';
$firstOfMonth = strtotime($year . '-' . $i . '-1');
$lastOfMonth = strtotime('last day of', ($firstOfMonth));
$firstOfMonthStart = strtotime('last Monday', $firstOfMonth);
// There are never more than 6 weeks in a month.
for ($j = 0; $j <= 5; $j++) {
$firstDayOfWeek = strtotime('+ ' . $j . ' Week', $firstOfMonthStart);
$weekArray = [
'###DAYMON###' => '&nbsp;',
'###DAYTUE###' => '&nbsp;',
'###DAYWED###' => '&nbsp;',
'###DAYTHU###' => '&nbsp;',
'###DAYFRI###' => '&nbsp;',
'###DAYSAT###' => '&nbsp;',
'###DAYSUN###' => '&nbsp;',
];
// Every week has seven days. ;-)
for ($k = 0; $k <= 6; $k++) {
$currentDayTime = strtotime('+ ' . $k . ' Day', $firstDayOfWeek);
if (
$currentDayTime >= $firstOfMonth
&& $currentDayTime <= $lastOfMonth
) {
$dayLinks = '';
$dayLinksText = [];
$dayLinksList = '';
$currentMonth = date('n', $currentDayTime);
if (is_array($calendarIssuesByMonth[$currentMonth])) {
foreach ($calendarIssuesByMonth[$currentMonth] as $id => $day) {
if ($id == date('j', $currentDayTime)) {
$dayLinks = $id;
foreach ($day as $issue) {
$dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title'];
$linkConf = [
'useCacheHash' => 1,
'parameter' => $this->conf['settings.targetPid'],
'forceAbsoluteUrl' => !empty($this->conf['settings.forceAbsoluteUrl']) ? 1 : 0,
'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['settings.forceAbsoluteUrl']) && !empty($this->conf['settings.forceAbsoluteUrlHttps']) ? 'https' : 'http'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($issue['uid']),
'ATagParams' => ' class="title"',
];
$dayLinksText[] = $this->cObj->typoLink($dayLinkLabel, $linkConf);
// Save issue for list view.
$this->allIssues[$currentDayTime][] = $this->cObj->typoLink($dayLinkLabel, $linkConf);
}
}
}
if (!empty($dayLinksText)) {
$dayLinksList = '<ul>';
foreach ($dayLinksText as $link) {
$dayLinksList .= '<li>' . $link . '</li>';
}
$dayLinksList .= '</ul>';
}
$dayLinkDiv = '<div class="issues"><h4>' . strftime('%d', $currentDayTime) . '</h4><div>' . $dayLinksList . '</div></div>';
}
switch (strftime('%w', strtotime('+ ' . $k . ' Day', $firstDayOfWeek))) {
case '0':
$weekArray['###DAYSUN###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break;
case '1':
$weekArray['###DAYMON###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break;
case '2':
$weekArray['###DAYTUE###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break;
case '3':
$weekArray['###DAYWED###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break;
case '4':
$weekArray['###DAYTHU###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break;
case '5':
$weekArray['###DAYFRI###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break;
case '6':
$weekArray['###DAYSAT###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break;
}
}
}
// Fill the weeks.
$subPartContentWeek .= $this->templateService->substituteMarkerArray($subParts['week'], $weekArray);
}
// Fill the week markers with the week entries.
$subPartContent .= $this->templateService->substituteSubpart($subPartContentMonth, '###CALWEEK###', $subPartContentWeek);
}
return $subPartContent;
}
/**
* The Years Method
*
* @access public
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return string The content that is displayed on the website
*/
public function years($content, $conf)
{
$this->init($conf);
// Load current document.
$this->loadDocument();
if ($this->doc === null) {
// Quit without doing anything if required variables are not set.
return $content;
}
// Load template file.
$this->getTemplate('###TEMPLATEYEAR###');
// Get subpart templates
$subparts['year'] = $this->templateService->getSubpart($this->template, '###LISTYEAR###');
// Get the title of the anchor file
$titleAnchor = $this->doc->getTitle($this->doc->uid);
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tx_dlf_documents');
// Get all children of anchor. This should be the year anchor documents
$result = $queryBuilder
->select(
'tx_dlf_documents.uid AS uid',
'tx_dlf_documents.title AS title',
'tx_dlf_documents.mets_label AS label',
'tx_dlf_documents.mets_orderlabel AS orderlabel'
)
->from('tx_dlf_documents')
->where(
$queryBuilder->expr()->eq('tx_dlf_documents.structure', Helper::getUidFromIndexName('year', 'tx_dlf_structures', $this->doc->cPid)),
$queryBuilder->expr()->eq('tx_dlf_documents.partof', intval($this->doc->uid)),
Helper::whereExpression('tx_dlf_documents')
)
->orderBy('tx_dlf_documents.mets_orderlabel')
->execute();
$years = [];
// Process results.
while ($resArray = $result->fetch()) {
$years[] = [
'title' => !empty($resArray['label']) ? $resArray['label'] : (!empty($resArray['orderlabel']) ? $resArray['orderlabel'] : $resArray['title']),
'uid' => $resArray['uid']
];
}
$subYearPartContent = '';
if (count($years) > 0) {
foreach ($years as $year) {
$linkConf = [
'useCacheHash' => 1,
'parameter' => $GLOBALS['TSFE']->id,
'forceAbsoluteUrl' => !empty($this->conf['settings.forceAbsoluteUrl']) ? 1 : 0,
'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['settings.forceAbsoluteUrl']) && !empty($this->conf['settings.forceAbsoluteUrlHttps']) ? 'https' : 'http'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($year['uid']),
'title' => $titleAnchor . ': ' . $year['title']
];
$yearArray = [
'###YEARNAME###' => $this->cObj->typoLink($year['title'], $linkConf),
];
$subYearPartContent .= $this->templateService->substituteMarkerArray($subparts['year'], $yearArray);
}
}
// Link to years overview (should be itself here)
$linkConf = [
'useCacheHash' => 1,
'parameter' => $GLOBALS['TSFE']->id,
'forceAbsoluteUrl' => !empty($this->conf['settings.forceAbsoluteUrl']) ? 1 : 0,
'forceAbsoluteUrl.' => ['scheme' => !empty($this->conf['settings.forceAbsoluteUrl']) && !empty($this->conf['settings.forceAbsoluteUrlHttps']) ? 'https' : 'http'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . $this->doc->uid,
];
$allYearsLink = $this->cObj->typoLink(htmlspecialchars($this->pi_getLL('allYears', '')) . ' ' . $this->doc->getTitle($this->doc->uid), $linkConf);
// Fill markers.
$markerArray = [
'###LABEL_CHOOSE_YEAR###' => htmlspecialchars($this->pi_getLL('label.please_choose_year')),
'###CALALLYEARS###' => $allYearsLink
];
$this->template = $this->templateService->substituteMarkerArray($this->template, $markerArray);
// Fill the week markers
return $this->templateService->substituteSubpart($this->template, '###LISTYEAR###', $subYearPartContent);
}
}

View File

@ -16,7 +16,7 @@
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:dlf/Resources/Private/Language/Calendar.xml:tt_content.pi_flexform.sheet_general</sheetTitle>
<sheetTitle>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.sheet_general</sheetTitle>
</TCEforms>
<type>array</type>
<el>
@ -43,7 +43,7 @@
<settings.targetPid>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/Calendar.xml:tt_content.pi_flexform.targetPid</label>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.flexform.targetPid</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
@ -63,7 +63,7 @@
<settings.initialDocument>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/Calendar.xml:tt_content.pi_flexform.initialDocument</label>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.calendar.flexform.initialDocument</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
@ -83,7 +83,7 @@
<settings.showEmptyMonths>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/Calendar.xml:tt_content.pi_flexform.showEmptyMonths</label>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.calendar.flexform.showEmptyMonths</label>
<config>
<type>check</type>
<default>1</default>
@ -93,7 +93,7 @@
<settings.templateFile>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/Calendar.xml:tt_content.pi_flexform.templateFile</label>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:flexform.flexform.templateFile</label>
<config>
<type>group</type>
<internal_type>file_reference</internal_type>

View File

@ -16,7 +16,6 @@ if (!defined('TYPO3_MODE')) {
// Plugin "audioplayer".
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_audioplayer'] = 'layout,select_key,pages,recursive';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_audioplayer'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(['LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tt_content.dlf_audioplayer', 'dlf_audioplayer'], 'list_type', 'dlf');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_audioplayer', 'FILE:EXT:' . 'dlf/Configuration/Flexforms/AudioPlayer.xml');
// Plugin "basket".
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_basket'] = 'layout,select_key,pages,recursive';
@ -26,7 +25,6 @@ $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_basket']
// Plugin "calendar".
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_calendar'] = 'layout,select_key,pages,recursive';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_calendar'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(['LLL:EXT:dlf/Resources/Private/Language/Labels.xml:tt_content.dlf_calendar', 'dlf_calendar'], 'list_type', 'dlf');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_calendar', 'FILE:EXT:' . 'dlf/Configuration/Flexforms/Calendar.xml');
// Plugin "collection".
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_collection'] = 'layout,select_key,pages,recursive';
@ -123,9 +121,17 @@ $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_validato
'LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.navigation.title',
'EXT:dlf/Resources/Public/Icons/tx-dlf-navigation.svg'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Kitodo.Dlf',
'AudioPlayer',
'LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.audioplayer.title',
'EXT:dlf/Resources/Public/Icons/tx-dlf-audioplayer.svg'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Kitodo.Dlf',
'Calendar',
'LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.calendar.title',
'EXT:dlf/Resources/Public/Icons/tx-dlf-calendar.svg'
);

View File

@ -22,8 +22,8 @@ mod.wizards.newContentElement.wizardItems {
}
tx_dlf_calendar {
iconIdentifier = tx-dlf-calendar
title = LLL:EXT:dlf/Resources/Private/Language/Calendar.xml:tt_content.plugin.title
description = LLL:EXT:dlf/Resources/Private/Language/Calendar.xml:tt_content.plugin.description
title = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.calendar.title
description = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.calendar.description
tt_content_defValues {
CType = list
list_type = dlf_calendar

View File

@ -15,26 +15,12 @@
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="tt_content.plugin.title">Calendar</label>
<label index="tt_content.plugin.description">Calendar Plugin for Kitodo.Presentation</label>
<label index="tt_content.pi_flexform.initialDocument">Initial document to show (e.g. of type "newspaper" or "ephemera")</label>
<label index="tt_content.pi_flexform.sheet_general">Options</label>
<label index="tt_content.pi_flexform.showEmptyMonths">Show months without issues in calendar?</label>
<label index="tt_content.pi_flexform.targetPid">Target page (with "DLF: Page View")</label>
<label index="tt_content.pi_flexform.templateFile">Template file</label>
<label index="allYears">All years overview - </label>
<label index="label.please_choose_year">Please choose a year first.</label>
<label index="label.view_calendar">Calendar</label>
<label index="label.view_list">List View</label>
</languageKey>
<languageKey index="de" type="array">
<label index="tt_content.plugin.title">Kalender</label>
<label index="tt_content.plugin.description">Kalender Plugin für Kitodo.Presentation</label>
<label index="tt_content.pi_flexform.initialDocument">Anfangsdokument (z.B. vom Typ "newspaper" oder "ephemera)</label>
<label index="tt_content.pi_flexform.sheet_general">Einstellungen</label>
<label index="tt_content.pi_flexform.showEmptyMonths">Zeige Monate ohne Ausgaben im Kalender?</label>
<label index="tt_content.pi_flexform.targetPid">Zielseite (mit Plugin "DLF: Seitenansicht")</label>
<label index="tt_content.pi_flexform.templateFile">HTML-Template</label>
<label index="allYears">Jahrgangsübersicht - </label>
<label index="label.please_choose_year">Bitte wählen Sie zunächst einen Jahrgang aus.</label>
<label index="label.view_calendar">Kalender</label>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-10-20T14:54:34Z">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-10-21T15:17:51Z">
<header>
<generator>LFEditor</generator>
</header>
@ -13,6 +13,22 @@
<source><![CDATA[Back %s Pages]]></source>
<target><![CDATA[%s Seiten zurück]]></target>
</trans-unit>
<trans-unit id="calendar.allYears" approved="yes">
<source><![CDATA[All years overview - ]]></source>
<target><![CDATA[Jahrgangsübersicht - ]]></target>
</trans-unit>
<trans-unit id="calendar.please_choose_year" approved="yes">
<source><![CDATA[Please choose a year first.]]></source>
<target><![CDATA[Bitte wählen Sie zunächst einen Jahrgang aus.]]></target>
</trans-unit>
<trans-unit id="calendar.view_calendar" approved="yes">
<source><![CDATA[Calendar]]></source>
<target><![CDATA[Kalender]]></target>
</trans-unit>
<trans-unit id="calendar.view_list" approved="yes">
<source><![CDATA[List View]]></source>
<target><![CDATA[Listenansicht]]></target>
</trans-unit>
<trans-unit id="doublePage+1" approved="yes">
<source><![CDATA[Adjust recto/verso]]></source>
<target><![CDATA[Recto/Verso korrigieren]]></target>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-10-21T09:03:15Z">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2021-10-21T15:14:29Z">
<header>
<generator>LFEditor</generator>
</header>
@ -65,6 +65,22 @@
<source><![CDATA[Kitodo: Audio Player]]></source>
<target><![CDATA[Kitodo: Audio Player]]></target>
</trans-unit>
<trans-unit id="plugins.calendar.description" approved="yes">
<source><![CDATA[Calendar Plugin for Kitodo.Presentation]]></source>
<target><![CDATA[Kalender Plugin für Kitodo.Presentation]]></target>
</trans-unit>
<trans-unit id="plugins.calendar.flexform.initialDocument" approved="yes">
<source><![CDATA[Initial document to show (e.g. of type "newspaper" or "ephemera")]]></source>
<target><![CDATA[Anfangsdokument (z.B. vom Typ "newspaper" oder "ephemera)]]></target>
</trans-unit>
<trans-unit id="plugins.calendar.flexform.showEmptyMonths" approved="yes">
<source><![CDATA[Show months without issues in calendar?]]></source>
<target><![CDATA[Zeige Monate ohne Ausgaben im Kalender?]]></target>
</trans-unit>
<trans-unit id="plugins.calendar.title" approved="yes">
<source><![CDATA[Kitodo: Calendar]]></source>
<target><![CDATA[Kitodo: Kalender]]></target>
</trans-unit>
<trans-unit id="plugins.feeds.description" approved="yes">
<source><![CDATA[Feeds Plugin for Kitodo.Presentation]]></source>
<target><![CDATA[Feeds Plugin für Kitodo.Presentation]]></target>

View File

@ -95,6 +95,18 @@
<trans-unit id="rotateReset">
<source><![CDATA[Reset Rotation]]></source>
</trans-unit>
<trans-unit id="calendar.allYears">
<source><![CDATA[All years overview - ]]></source>
</trans-unit>
<trans-unit id="calendar.please_choose_year">
<source><![CDATA[Please choose a year first.]]></source>
</trans-unit>
<trans-unit id="calendar.view_calendar">
<source><![CDATA[Calendar]]></source>
</trans-unit>
<trans-unit id="calendar.view_list">
<source><![CDATA[List View]]></source>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -101,6 +101,18 @@
<trans-unit id="plugins.audioplayer.flexform.elementId">
<source><![CDATA[@ID value of the HTML element for the audio player]]></source>
</trans-unit>
<trans-unit id="plugins.calendar.title">
<source><![CDATA[Kitodo: Calendar]]></source>
</trans-unit>
<trans-unit id="plugins.calendar.description">
<source><![CDATA[Calendar Plugin for Kitodo.Presentation]]></source>
</trans-unit>
<trans-unit id="plugins.calendar.flexform.initialDocument">
<source><![CDATA[Initial document to show (e.g. of type "newspaper" or "ephemera")]]></source>
</trans-unit>
<trans-unit id="plugins.calendar.flexform.showEmptyMonths">
<source><![CDATA[Show months without issues in calendar?]]></source>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -0,0 +1,33 @@
<f:comment>
<!--
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
-->
</f:comment>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
<f:if condition="{day}">
<f:then>
<div class="issues">
<f:if condition="{day.issues}">
<f:then>
<h4>{day.dayValue -> f:format.html()}</h4>
</f:then>
<f:else>
{day.dayValue -> f:format.html()}
</f:else>
</f:if>
<div class="dayLinkList">
<f:for each="{day.issues}" as="item">
<f:link.page pageUid="{settings.targetPid}" additionalParams="{'tx_dlf[id]': item.documentId}">
{item.text}
</f:link.page>
</f:for>
</div>
</div>
</f:then>
</f:if>

View File

@ -1,90 +0,0 @@
<!--
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
-->
<!-- ###TEMPLATECALENDAR### begin -->
<div class="tx-dlf-calendar">
<div class="meta-header">
<div class="year-anchor">
###CALALLYEARS###
</div>
<div class="year">
###CALYEAR###
</div>
<div class="calendar-list-selection">
<a class="select-calendar-view ###CALENDARVIEWACTIVE###">###LABEL_CALENDAR###</a>
<a class="select-list-view ###LISTVIEWACTIVE###">###LABEL_LIST_VIEW###</a>
</div>
</div>
<div class="calendar-view">
<!-- ###CALMONTH### begin -->
###CALYEAR###
<table class="month">
<caption>###MONTHNAME###</caption>
<tr>
<th class="">###DAYMON_NAME###</th>
<th class="">###DAYTUE_NAME###</th>
<th class="">###DAYWED_NAME###</th>
<th class="">###DAYTHU_NAME###</th>
<th class="">###DAYFRI_NAME###</th>
<th class="">###DAYSAT_NAME###</th>
<th class="">###DAYSUN_NAME###</th>
</tr>
<!-- ###CALWEEK### begin -->
<tr>
<td class="">###DAYMON###</td>
<td class="">###DAYTUE###</td>
<td class="">###DAYWED###</td>
<td class="">###DAYTHU###</td>
<td class="">###DAYFRI###</td>
<td class="">###DAYSAT###</td>
<td class="">###DAYSUN###</td>
</tr>
<!-- ###CALWEEK### end -->
</table>
<!-- ###CALMONTH### end -->
</div>
<!-- ###ISSUELIST### begin -->
<div class="list-view">
<ul>
<!-- ###SINGLEDAY### begin -->
<li>
<span class="listview-date">###DATE_STRING###</span>
###ITEMS###
</li>
<!-- ###SINGLEDAY### end -->
</ul>
</div>
<!-- ###ISSUELIST### end -->
</div>
<!-- ###TEMPLATECALENDAR### end -->
<!-- ###TEMPLATEYEAR### begin -->
<div class="tx-dlf-calendar-years">
<div class="meta-header">
<div class="year-anchor">
###CALALLYEARS###
</div>
<div class="meta-hint-year">
###LABEL_CHOOSE_YEAR###
</div>
</div>
<div class="year-view">
<ul>
<!-- ###LISTYEAR### begin -->
<li class="year">
###YEARNAME###
</li>
<!-- ###LISTYEAR### end -->
</ul>
</div>
</div>
<!-- ###TEMPLATEYEAR### end -->

View File

@ -0,0 +1,105 @@
<f:comment>
<!--
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
-->
</f:comment>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
<div class="tx-dlf-calendar">
<div class="meta-header">
<div class="year-anchor">
<div class="year-anchor">
<f:link.page additionalParams="{'tx_dlf[id]': parentDocumentId}">
<f:translate key="calendar.allYears" /> {allYearDocTitle}
</f:link.page>
</div>
</div>
<div class="year">
<f:link.page additionalParams="{'tx_dlf[id]': documentId}">
{yearLinkTitle}
</f:link.page>
</div>
<div class="calendar-list-selection">
<a class="select-calendar-view {f:if(condition:'calendarData->f:count() > 5', then : 'active')}">
<f:translate key="calendar.view_calendar" />
</a>
<a class="select-list-view {f:if(condition:'calendarData->f:count() < 6', then : 'active')}">
<f:translate key="calendar.view_list" />
</a>
</div>
</div>
<div class="calendar-view">
<f:for each="{calendarData}" as="month">
<f:if condition="{month.CALYEAR}">
<f:then>
<div class="year">
{month.CALYEAR}
</div>
</f:then>
</f:if>
<table class="month">
<caption>{month.MONTHNAME}</caption>
<tr>
<th class="">{month.DAYMON_NAME}</th>
<th class="">{month.DAYTUE_NAME}</th>
<th class="">{month.DAYWED_NAME}</th>
<th class="">{month.DAYTHU_NAME}</th>
<th class="">{month.DAYFRI_NAME}</th>
<th class="">{month.DAYSAT_NAME}</th>
<th class="">{month.DAYSUN_NAME}</th>
</tr>
<f:for each="{month.week}" as="week">
<tr>
<td class="">
<f:render partial="Calendar/Day" arguments="{'day': '{week.DAYMON}'}"></f:render>
</td>
<td class="">
<f:render partial="Calendar/Day" arguments="{'day': '{week.DAYTUE}'}"></f:render>
</td>
<td class="">
<f:render partial="Calendar/Day" arguments="{'day': '{week.DAYWED}'}"></f:render>
</td>
<td class="">
<f:render partial="Calendar/Day" arguments="{'day': '{week.DAYTHU}'}"></f:render>
</td>
<td class="">
<f:render partial="Calendar/Day" arguments="{'day': '{week.DAYFRI}'}"></f:render>
</td>
<td class="">
<f:render partial="Calendar/Day" arguments="{'day': '{week.DAYSAT}'}"></f:render>
</td>
<td class="">
<f:render partial="Calendar/Day" arguments="{'day': '{week.DAYSUN}'}"></f:render>
</td>
</tr>
</f:for>
</table>
</f:for>
</div>
<div class="list-view">
<ul>
<f:for each="{issueData}" as="issueDay">
<li>
<span class="listview-date">{issueDay.dateString}</span>
<f:for each="{issueDay.items}" as="item">
<f:link.page pageUid="{settings.targetPid}" additionalParams="{'tx_dlf[id]': item.documentId}">
{item.text}
</f:link.page>
</f:for>
</li>
</f:for>
</ul>
</div>
</div>
</html>

View File

@ -0,0 +1,14 @@
<f:comment>
<!--
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
-->
</f:comment>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
</html>

View File

@ -0,0 +1,36 @@
<f:comment>
<!--
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
-->
</f:comment>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
<div class="tx-dlf-calendar-years">
<div class="meta-header">
<div class="year-anchor">
<f:link.page additionalParams="{'tx_dlf[id]': documentId}">
<f:translate key="calendar.allYears" /> {allYearDocTitle}
</f:link.page>
</div>
<div class="meta-hint-year">
<f:translate key="calendar.please_choose_year" />
</div>
</div>
<div class="year-view">
<ul>
<f:for each="{yearName}" as="yearEntry">
<li class="year">
<f:link.page additionalParams="{'tx_dlf[id]': yearEntry.documentId}">
{yearEntry.title}
</f:link.page>
</li>
</f:for>
</ul>
</div>
</div>
</html>

View File

@ -207,7 +207,6 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][] = [
'class' => \Kitodo\Dlf\Hooks\Form\FieldInformation\SolrCoreStatus::class
];
// Add migration wizards
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\Kitodo\Dlf\Updates\MigrateSettings::class]
= \Kitodo\Dlf\Updates\MigrateSettings::class;
@ -284,3 +283,15 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\Kitodo\Dlf\U
AudioPlayer::class => '',
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Kitodo.Dlf',
'Calendar',
[
Calendar::class => 'main, years, calendar',
],
// non-cacheable actions
[
Calendar::class => '',
]
);