TYPO3 Ext。 cal:调整搜索表单

时间:2017-07-09 19:27:13

标签: typo3 typo3-extensions

默认情况下,搜索表单包含以下输入:

enter image description here

我想要一个带月份选项的选择框,而不是两个输入“Startdatum”和“Enddatum”。

在 typo3conf \分机\ CAL \资源\私人\模板\ V2 \ search_event.tmpl

搜索只有post参数start_day和end_date。

如果我只能选择并发布月份值,如何实现月份selextbox?

我必须在这里进行更改吗? typo3conf \分机\ CAL \类\视图\ SearchViews.php

我能用自己的cal扩展扩展来实现这个吗?

1 个答案:

答案 0 :(得分:0)

假设您使用类型为plugin的内容元素,并将视图设置为“list”,并添加您自己的表单选择月份,这将生成带有参数的请求,如

?tx_cal_controller[month]=08

然后您可以使用typoscript条件操作列表结果,以仅显示当前年度请求月份的事件:

[globalVar = GP:tx_cal_controller|month >0]
    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]

要对列表视图使用您自己的类别过滤器,您需要调整/扩展class \ TYPO3 \ CMS \ Cal \ Controller \ Controller :: initConfigs()以调用类似

的参数
?tx_cal_controller[category]=2

进入全局配置,如

/**
 * Init configurations
 * Change category mode in listview, if category given in GET params
 * Used for category filter by selection
 */
public function initConfigs() {
    parent::initConfigs();
    if ($this->piVars['category'] && $this->conf ['view'] === 'list') {
        $this->conf ['view.'] ['categoryMode'] = 4;
        $this->conf ['view.'] ['category'] = $this->piVars['category'];
    }
} 

对于事件所有者的工作过滤器,我没有例子。

相关问题