如何在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
问题描述
我一直在查看Calendar Base的代码,但是我不了解代码中的工作标记及其功能.
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.
我想知道是否有可能创建一个迷你日历,并且当我单击某一天且事件显示在它们下方的那一刻时,该列表就会出现.
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.
推荐答案
EXT:cal有很多可能的配置. 我将只为我的一个项目提供TYPO3 CMS 7.6中EXT:cal版本1.10.3所需的最低配置(而不是滑动的项目,正如我首先提到的那样).
There are a lot of possible configurations for 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).
您已经安装了EXT:cal并包含静态拼写(基于CSS的标准模板" ,也许还有"CSS的标准样式" ).
You have installed EXT:cal and include static typoscripts ('Standard CSS-based template' and maybe 'Standard CSS styles').
在TYPO3的日历页面中,创建两个类型为plugin的内容,在其中选择'TYPO3 calendar'作为插件. 具有以下配置的第一个用于月迷你视图的内容元素,第二个用于列表视图的内容元素:
At your calendar page in TYPO3 you create two contentelements of type plugin, where you choose 'TYPO3 calendar' as plugin. The first contentelement for month-mini-view, the second contentelement for list-view, with following configurations:
- Contentelement插件month-mini-view:
标签常规设置" 字段允许的视图" 仅选择月" .
标签月视图" 字段显示为迷你日历" 激活复选框.
Tab 'Month view' field 'Display as a mini calendar' activate checkbox.
- Contentelement插件列表视图:
标签常规设置" 字段允许的视图" 依次选择列表" 和单个事件" .
Tab 'General settings' field 'Allowed views' select 'List' and 'Single Event' in this order.
插件配置中的所有其他字段为空或具有默认值.我更喜欢不要使用字段记录存储页面,而使用拼写'plugin.tx_cal_controller.pidList'.
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.
在前端,您应该已经看到一个月的最小数字和一个列表视图.
At frontend you should already see a month-mini and a list view.
在您的页面树中添加以下印刷文字配置(设置),当结合使用mont-mini和列表视图时,我发现这很有用:
Add following typoscript configuration (setup) to your page tree, which I found useful when using mont-mini and list view in combination:
// 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 >
现在,您希望在当前视图中将周数作为指向周期间的链接或将天数作为指向这一天的链接. 从EXT:cal 1.9版本开始,我需要XCLASS主控制器方法,以便为日,周,月,年,列表..view设置view-pid.
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:mysitepackage中,带有最少的以下文件:
You will need a sitepackage extension, in the following example EXT:mysitepackage with minimum following files:
- Classes/Xclass/CalController.php
- ext_localconf.php
- ext_emconf.php
- ext_icon.gif
Classs/Xclass/CalController.php的内容
Content for Classes/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);
}
}
ext_localconf.php的内容
Content for 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',
);
安装并确保Xclass正常运行.然后,您可以将以下打字输入法配置添加到现有设置中:
Install and ensure, that Xclass is working. 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 和 ### PREV_MONTHLINK ### 和 ### NEXT_MONTHLINK ### 的标记.
我可以在另一个问题中对此进行描述.
I could describe this in an other question.
这篇关于如何在TYPO3 7.6.14中将月视图和列表视图与具有Calendar Base扩展名的同一页面混合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!