简体   繁体   English

如何将TYPO3 7.6.14中带有Calendar Base扩展名的同一页面中的月份视图和列表视图混合使用

[英]How mix Month view and List view in same page with Calendar Base extension in TYPO3 7.6.14

I have been seeing the code of Calendar Base but I have not understood the way as work markers and its functionality in the code. 我一直在看Calendar Base的代码,但是我不了解代码中的工作标记及其功能。

I want to know if is possible to create a mini calendar and in the moment that I click one day with events show below them the list. 我想知道是否有可能创建一个迷你日历,并且当我单击某一天的事件并在其下方显示事件的那一刻时,该列表就会出现。

Please guide me what is the way to resolve it, not give me a code. 请指导我解决问题的方法,而不是给我代码。

There are a lot of possible configurations for EXT:cal. EXT:cal有很多可能的配置。 I will only give the minimum required configurations for EXT:cal version 1.10.3 in TYPO3 CMS 7.6 as I used for one of my projects (not the sliding one, as mentioned i first comment). 我将只为我的一个项目提供TYPO3 CMS 7.6中EXT:cal版本1.10.3所需的最低配置(而不是滑动项目,正如我首先提到的那样)。

You have installed EXT:cal and include static typoscripts ( 'Standard CSS-based template' and maybe 'Standard CSS styles' ). 您已经安装了EXT:cal,并包含静态拼写( “基于CSS的标准模板” ,也可能包含“标准CSS样式” )。

At your calendar page in TYPO3 you create two contentelements of type plugin, where you choose 'TYPO3 calendar' as plugin. 在TYPO3的日历页面中,创建两个类型为plugin的内容元素,在其中选择“ TYPO3 calendar”作为插件。 The first contentelement for month-mini-view, the second contentelement for list-view, with following configurations: 具有月配置迷你视图的第一个内容元素,具有列表配置的第二个内容元素,具有以下配置:

  1. Contentelement plugin month-mini-view: Contentelement插件month-mini-view:

Tab 'General settings' field 'Allowed views' select 'Month' only. 标签的“常规设置”字段“允许的视图 仅选择“月”

Tab 'Month view' field 'Display as a mini calendar' activate checkbox. 选项卡的“月视图”字段中的“显示为迷你日历”激活复选框。

  1. Contentelement plugin list-view: Contentelement插件列表视图:

Tab 'General settings' field 'Allowed views' select 'List' and 'Single Event' in this order. “常规设置”选项卡 “允许的视图”选项卡中,依次选择“列表”“单个事件”

All other fields in plugin configuration are empty or has default value. 插件配置中的所有其他字段为空或具有默认值。 I prefer, to not use field Record Storage Page , use typoscript 'plugin.tx_cal_controller.pidList' instead. 我更喜欢不要使用字段Record Storage Page ,而应使用拼写'plugin.tx_cal_controller.pidList'

At frontend you should already see a month-mini and a list view. 在前端,您应该已经看到一个月最小的列表视图。

Add following typoscript configuration (setup) to your page tree, which I found useful when using mont-mini and list view in combination: 在页面树中添加以下印刷文字配置(设置),当结合使用mont-mini和列表视图时,我发现这很有用:

// General
plugin.tx_cal_controller.pidList = [!!!-FILL_HERE_YOUR_CAL_STORAGE-PIDS-PLEASE-!!!]

// List view
plugin.tx_cal_controller.view.list.starttime = today
// Use getdate and custom start&end date to use link from minical inside listview
[globalVar = GP:tx_cal_controller|year >0]
  plugin.tx_cal_controller.view.list.useGetdate = 1
[else]
  plugin.tx_cal_controller.view.list.useGetdate = 0
[global]
// Adapt list view for urls from monthMini view
// year-view: if (yaer=true && month=false && week=false && day=false)
[globalVar = GP:tx_cal_controller|year >0] && [globalVar = GP:tx_cal_controller|month <1] && [globalVar = GP:tx_cal_controller|week <1] && [globalVar = GP:tx_cal_controller|day <1]
  plugin.tx_cal_controller.view.list.useCustomStarttime = 1
  plugin.tx_cal_controller.view.list.useCustomEndtime = 1
  plugin.tx_cal_controller.view.list.customStarttimeRelativeToGetdate = 1
  plugin.tx_cal_controller.view.list.customEndtimeRelativeToGetdate = 1
  plugin.tx_cal_controller.view.list.starttime = yearstart
  plugin.tx_cal_controller.view.list.endtime = yearend
[global]
// month-view: if (month=true && day=false)
[globalVar = GP:tx_cal_controller|month >0] && [globalVar = GP:tx_cal_controller|day <1]
  plugin.tx_cal_controller.view.list.useCustomStarttime = 1
  plugin.tx_cal_controller.view.list.useCustomEndtime = 1
  plugin.tx_cal_controller.view.list.customStarttimeRelativeToGetdate = 1
  plugin.tx_cal_controller.view.list.customEndtimeRelativeToGetdate = 1
  plugin.tx_cal_controller.view.list.starttime = monthstart
  plugin.tx_cal_controller.view.list.endtime = monthend
[global]
// week-view: if (week=true && (weekday=0 OR weekday=1 OR weekday>1)) // weekday>0 doesnt worx at all
[globalVar = GP:tx_cal_controller|week >0]
  plugin.tx_cal_controller.view.list.useCustomEndtime = 1
  plugin.tx_cal_controller.view.list.customEndtimeRelativeToGetdate = 1
  plugin.tx_cal_controller.view.list.endtime = +1 week
[global]
// day-view: if (day=true && week=false (&& weekday=false))
[globalVar = GP:tx_cal_controller|day >0] && [globalVar = GP:tx_cal_controller|week <1]
  # hide ' - enddate' in header (startdate - enddate)
  plugin.tx_cal_controller.view.list.heading.2 >
[global]

// Month view
plugin.tx_cal_controller.view.month.monthMakeMiniCal = 1
plugin.tx_cal_controller.view.month.endPointCorrection = 9024000
plugin.tx_cal_controller.view.month.dayViewLink.prioriCalc >

Now you would like to get week-numbers as link to week period or day-numbers as link to this day in the current view. 现在,您希望在当前视图中将周数作为指向周期间的链接或将天数作为指向这一天的链接。 Since EXT:cal version 1.9 I need to XCLASS the main controller method, to set view-pid for day,week,month,year,list..view. 从EXT:cal 1.9版本开始,我需要XCLASS主控制器方法,以设置day-week,month,month,year,list..view的view-pid。

You will need a sitepackage extension, in the following example EXT:mysitepackage with minimum following files: 在以下示例EXT:mysitepackage中,您将需要一个sitepackage扩展名,其中带有最少的以下文件:

  • Classes/Xclass/CalController.php 类/Xclass/CalController.php
  • ext_localconf.php ext_localconf.php
  • ext_emconf.php ext_emconf.php
  • ext_icon.gif ext_icon.gif

Content for Classes/Xclass/CalController.php 类/Xclass/CalController.php的内容

<?php
namespace Vendorname\Mysitepackage\Xclass;

/**
 * Extended main controller for calendar base
 *
 * @package TYPO3
 * @subpackage tx_mysitepackage
 * @copyright Copyright belongs to the respective authors
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
 */
class CalController extends \TYPO3\CMS\Cal\Controller\Controller {

    /**
     * Override main controller function that serves as the entry point from TYPO3.
     * 
     * @param array The content array
     * @param array The conf array
     * @return string of calendar data
     */
    public function main($content, $conf) {
        /**
         * Use dynamic viewPid for links in month-mini view (day, week, month, year), as used in \TYPO3\CMS\Cal\View\New[VIEW]View->get[VIEW]Link().
         * Fx: Each monthMini view has dayLinks. These links are only enabled, if [VIEW]ViewPid is set (should be set to current page id).
         * TS setup configuration for 'plugin.tx_cal_controller.view.[VIEW].[VIEW]ViewPid' is not stdWrap'able.
         * 
         * See TS:
         * plugin.tx_cal_controller.view.[VIEW].[VIEW]ViewPid = TEXT
         * plugin.tx_cal_controller.view.[VIEW].[VIEW]ViewPid.data = TSFE:id
         * plugin.tx_cal_controller.view.[VIEW].[VIEW]ViewPid.insertData = 1
         */
        // Day
        if ($conf ['view.'] ['day.'] ['dayViewPid.']) {
            $conf ['view.'] ['day.'] ['dayViewPid'] = $this->cObj->cObjGetSingle($conf ['view.'] ['day.'] ['dayViewPid'], $conf ['view.'] ['day.'] ['dayViewPid.']);
        }
        // Week
        if ($conf ['view.'] ['week.'] ['weekViewPid.']) {
            $conf ['view.'] ['week.'] ['weekViewPid'] = $this->cObj->cObjGetSingle($conf ['view.'] ['week.'] ['weekViewPid'], $conf ['view.'] ['week.'] ['weekViewPid.']);
        }
        // Month
        if ($conf ['view.'] ['month.'] ['monthViewPid.']) {
            $conf ['view.'] ['month.'] ['monthViewPid'] = $this->cObj->cObjGetSingle($conf ['view.'] ['month.'] ['monthViewPid'], $conf ['view.'] ['month.'] ['monthViewPid.']);
        }
        // Year
        if ($conf ['view.'] ['year.'] ['yearViewPid.']) {
            $conf ['view.'] ['year.'] ['yearViewPid'] = $this->cObj->cObjGetSingle($conf ['view.'] ['year.'] ['yearViewPid'], $conf ['view.'] ['year.'] ['yearViewPid.']);
        }
        return parent::main($content, $conf);
    }
}

Content for ext_localconf.php ext_localconf.php的内容

<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');

// XClass main controller class to adjust $conf. See EXT:mysitepackage/Classes/Xclass/CalController.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Cal\\Controller\\Controller'] = array(
    'className' => 'Vendorname\\Mysitepackage\\Xclass\\CalController',
);

Install and ensure, that Xclass is working. 安装并确保Xclass正常运行。 Then you can add following typoscript configuration to existing setup: 然后,您可以将以下拼写配置添加到现有设置中:

/**
 * Xclass special
 *
 * Use dynamic viewPid for links in month-mini view (day, week, month, year), as used in \TYPO3\CMS\Cal\View\New[VIEW]View->get[VIEW]Link().
 * Fx: Each monthMini view has dayLinks. These links are only enabled, if [VIEW]ViewPid is set (should be set to current page id).
 * TS setup configuration for 'plugin.tx_cal_controller.view.[VIEW].[VIEW]ViewPid' is not stdWrap'able.
 *
 * XClass main controller class to adjust $conf. See EXT:mysitepackage/Classes/Xclass/CalController.php
 */
# day
plugin.tx_cal_controller.view.day.dayViewPid = TEXT
plugin.tx_cal_controller.view.day.dayViewPid.data = TSFE:id
plugin.tx_cal_controller.view.day.dayViewPid.insertData = 1
# week
plugin.tx_cal_controller.view.week.weekViewPid = TEXT
plugin.tx_cal_controller.view.week.weekViewPid.data = TSFE:id
plugin.tx_cal_controller.view.week.weekViewPid.insertData = 1
# month
plugin.tx_cal_controller.view.month.monthViewPid = TEXT
plugin.tx_cal_controller.view.month.monthViewPid.data = TSFE:id
plugin.tx_cal_controller.view.month.monthViewPid.insertData = 1
# year
plugin.tx_cal_controller.view.year.yearViewPid = TEXT
plugin.tx_cal_controller.view.year.yearViewPid.data = TSFE:id
plugin.tx_cal_controller.view.year.yearViewPid.insertData = 1

And all numbers in month-view should be a link, if it contains a valid event day or period. 如果月份视图中的所有数字都包含有效的活动日期或期间,则所有链接都应为链接。

You will miss a link to next or previous month, which will stay i current month-mini and list view combination. 您将错过到下个月或上个月的链接,该链接将保留在当前月份的最小值和列表视图的组合中。 Then you need to adapt some templates. 然后,您需要调整一些模板。 Have a look at: 看一下:

plugin.tx_cal_controller.view.month.monthMiniTemplate and markers for ###PREV_MONTHLINK### and ###NEXT_MONTHLINK### . plugin.tx_cal_controller.view.month.monthMiniTemplate### PREV_MONTHLINK ###### NEXT_MONTHLINK ###的标记。

I could describe this in an other question. 我可以用另一个问题来描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM