Esempio n. 1
0
 /**
  * Add page IDs to the preview of the element
  */
 protected function addPageIdsToTable()
 {
     $pageIdsNames = ['detailPid', 'listPid', 'yearPid', 'monthPid', 'weekPid', 'dayPid'];
     foreach ($pageIdsNames as $pageIdName) {
         $pageId = (int) $this->flexFormService->get('settings.' . $pageIdName, 'pages');
         $pageRow = BackendUtility::getRecord('pages', $pageId);
         if ($pageRow) {
             $this->layoutService->addRow(TranslateUtility::get($pageIdName), $pageRow['title'] . ' (' . $pageId . ')');
         }
     }
 }
Esempio n. 2
0
 /**
  * Get event list
  *
  * @param $events
  *
  * @return string
  */
 protected function getEventList($events)
 {
     $items = [];
     foreach ($events as $event) {
         $entry = date('d.m.Y', $event['start_date']) . ' - ' . date('d.m.Y', $event['end_date']);
         if (!$event['all_day']) {
             $start = BackendUtility::time($event['start_time'], false);
             $end = BackendUtility::time($event['end_time'], false);
             $entry .= ' (' . $start . ' - ' . $end . ')';
         }
         $items[] = $entry;
     }
     if (!sizeof($items)) {
         $items[] = TranslateUtility::get('noEvents');
     }
     return '<ul><li>' . implode('</li><li>', $items) . '</li></ul>';
 }
Esempio n. 3
0
 /**
  * Get event list
  *
  * @param $events
  *
  * @return string
  */
 protected function getEventList($events)
 {
     $items = [];
     foreach ($events as $event) {
         $startDateStamp = $event['start_date'] instanceof \DateTime ? $event['start_date']->getTimestamp() : $event['start_date'];
         $startDate = strftime('%a %d.%m.%G', $startDateStamp);
         $endDateStamp = $event['end_date'] instanceof \DateTime ? $event['end_date']->getTimestamp() : $event['end_date'];
         $endDate = strftime('%a %d.%m.%G', $endDateStamp);
         $entry = $startDate . ' - ' . $endDate;
         if (!$event['all_day']) {
             $start = BackendUtility::time($event['start_time'], false);
             if ((int) $event['end_time'] === AbstractTimeTable::DAY_END) {
                 $end = '"' . TranslateUtility::get('openEndTime') . '"';
             } else {
                 $end = BackendUtility::time($event['end_time'], false);
             }
             $entry .= ' (' . $start . ' - ' . $end . ')';
         }
         $items[] = $entry;
     }
     if (!sizeof($items)) {
         $items[] = TranslateUtility::get('noEvents');
     }
     return '<ul><li>' . implode('</li><li>', $items) . '</li></ul>';
 }
Esempio n. 4
0
<?php

/**
 * General ext_tables file and also an example for your own extension
 *
 * @category Extension
 * @package  Calendarize
 * @author   Tim Lochmüller
 */
if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
\HDNET\Autoloader\Loader::extTables('HDNET', 'calendarize', \HDNET\Calendarize\Register::getDefaultAutoloader());
if (!(bool) \HDNET\Calendarize\Utility\ConfigurationUtility::get('disableDefaultEvent')) {
    \HDNET\Calendarize\Register::extTables(\HDNET\Calendarize\Register::getDefaultCalendarizeConfiguration());
    \TYPO3\CMS\Core\Category\CategoryRegistry::getInstance()->add('calendarize', 'tx_calendarize_domain_model_event');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin('calendarize', 'Calendar', \HDNET\Calendarize\Utility\TranslateUtility::get('pluginName'));
if (\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('7.0.0')) {
    $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['calendarize_calendar'] .= ',categories';
}
// module icon
$extensionIcon = \HDNET\Autoloader\Utility\IconUtility::getByExtensionKey('calendarize', true);
if (\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('7.0')) {
    /** @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
    $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconRegistry');
    $iconRegistry->registerIcon('apps-pagetree-folder-contains-calendarize', 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\BitmapIconProvider', ['source' => $extensionIcon]);
} else {
    $extensionRelPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('calendarize');
    \TYPO3\CMS\Backend\Sprite\SpriteManager::addTcaTypeIcon('pages', 'contains-calendar', str_replace('EXT:calendarize/', $extensionRelPath, $extensionIcon));
}
Esempio n. 5
0
 /**
  * Get the title for a configuration time
  *
  * @param $row
  *
  * @return string
  */
 protected function getConfigurationTitleTime($row)
 {
     $title = '';
     if ($row['start_date']) {
         $dateStart = strftime('%a %d.%m.%G', $row['start_date']);
         $dateEnd = strftime('%a %d.%m.%G', $row['end_date'] ?: $row['start_date']);
         $title .= $dateStart;
         if ($dateStart != $dateEnd) {
             $title .= ' - ' . $dateEnd;
         }
     }
     if ($row['all_day']) {
         $title .= ' ' . TranslateUtility::get('tx_calendarize_domain_model_index.all_day');
     } elseif ($row['start_time']) {
         $title .= '<br />' . BackendUtility::time($row['start_time'], false);
         $title .= ' - ' . BackendUtility::time($row['end_time'], false);
     }
     if ($row['frequency'] && $row['frequency'] !== Configuration::FREQUENCY_NONE) {
         $title .= '<br /><i>' . TranslateUtility::get('configuration.frequency.' . $row['frequency']) . '</i>';
     }
     return $title;
 }
Esempio n. 6
0
 /**
  * Detail action
  *
  * @param \HDNET\Calendarize\Domain\Model\Index $index
  *
  * @return string
  */
 public function detailAction(Index $index = null)
 {
     if ($index === null) {
         if (!MathUtility::canBeInterpretedAsInteger($this->settings['listPid'])) {
             return TranslateUtility::get('noEventDetailView');
         }
         $this->redirect('list', null, null, [], null, $this->settings['listPid'], 301);
     }
     $this->slotExtendedAssignMultiple(['index' => $index, 'domain' => GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY')], __CLASS__, __FUNCTION__);
     return $this->view->render();
 }
Esempio n. 7
0
 /**
  * Get the title for a configuration time
  *
  * @param $row
  *
  * @return string
  */
 protected function getConfigurationTitleTime($row)
 {
     $title = '';
     if ($row['start_date']) {
         $dateStart = date('d.m.Y', $row['start_date']);
         $dateEnd = date('d.m.Y', $row['end_date'] ?: $row['start_date']);
         $title .= $dateStart;
         if ($dateStart != $dateEnd) {
             $title .= ' - ' . $dateEnd;
         }
     }
     if ($row['all_day']) {
         $title .= ' ' . TranslateUtility::get('tx_calendarize_domain_model_index.all_day');
     } elseif ($row['start_time']) {
         $title .= '<br />' . BackendUtility::time($row['start_time'], false);
         $title .= ' - ' . BackendUtility::time($row['end_time'], false);
     }
     $frequency = is_array($row['frequency']) ? $row['frequency'][0] : $row['frequency'];
     // The new FormEngine prepare the select as array
     if ($frequency && $frequency !== Configuration::FREQUENCY_NONE) {
         $title .= '<br /><i>' . TranslateUtility::get('configuration.frequency.' . $row['frequency']) . '</i>';
     }
     return $title;
 }