2017-01-13 67 views
0

我已經看到Calendar Base的代碼,但我還沒有理解作爲代碼中工作標記及其功能的方式。如何在TYPO3的Calendar Base擴展中在同一頁面中混合月視圖和列表視圖7.6.14

我想知道是否有可能創建一個迷你日曆,並在我點擊某一天的事件時在其下方顯示列表。

請指導我解決它的方法,不要給我一個代碼。

+0

我會寫我的解決方案http://www.vikingeskibsmuseet.dk/kalender/,但它需要一段時間 – jokumer

+0

請告訴我什麼時候該職位準備好 –

+0

答案有幫助嗎? – jokumer

回答

0

EXT有很多可能的配置:cal。 我只給出EXT的最低配置要求:TYPO3 CMS 7.6中的cal 1.10.3版本,因爲我用於我的一個項目(不是滑動的,如我第一條評論所述)。

您已經安裝EXT:CAL和包括靜態打字原稿格式('標準基於CSS模板'也許'標準的CSS樣式')。

在TYPO3的日曆頁面中,您可以創建兩個類型插件的內容,您可以選擇'TYPO3 calendar'作爲插件。 第一ContentElement的爲一個月,迷你視圖,爲列表視圖第二ContentElement的,具有以下配置:

  1. ContentElement的插件一個月的迷你視圖:

標籤「常規設置」 字段'允許的意見' 選擇'月'只有

標籤「月視圖」 字段「顯示作爲一個小型日曆」 激活複選框。

  • ContentElement的插件列表視圖:
  • 標籤'常規設置' 字段'允許的觀點' 選擇'列表'「單個事件'按此順序。

    插件配置中的所有其他字段爲空或具有默認值。我寧願不使用字段記錄存儲頁面,而是使用typoscript 'plugin.tx_cal_controller.pidList'

    在前端,您應該已經看到了月份迷你和列表視圖。

    添加以下Typo腳本配置(設置),將您的頁面樹,這是我用蒙-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 > 
    

    現在你想獲得爲期一週的數字作爲鏈接在當前視圖中將星期或日期數字鏈接到這一天。 由於EXT:CAL版本1.9我需要XCLASS主控制器方法,設置日,周,月,年,list..view的view-pid。

    您將需要一個sitepackage擴展,在下面的例子中EXT:mysitepackage最小下列文件:

    • 類/ Xclass/CalController.php
    • ext_localconf.php
    • ext_emconf.php
    • ext_icon.gif

    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

    <?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工作。然後,您可以添加以下的TypoScript配置到現有的設置:

    /** 
    * 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 
    

    ,並在月中視所有數字應該是一個鏈接,如果它包含一個有效的事件一天或某個時段。

    您將錯過指向下個月或上個月的鏈接,這將保持我當前的月份 - 迷你和列表視圖組合。 然後你需要修改一些模板。看一看:

    plugin.tx_cal_controller.view.month.monthMiniTemplate 和標記爲### PREV_MONTHLINK ###### NEXT_MONTHLINK ###

    我可以在其他問題中描述這一點。

    +0

    我一直在使用你的指南在這工作。我想評論你關於第一個錯字的許多事情。 –

    +0

    第一個條件總是錯誤的,所以'plugin.tx_cal_controller.view.list.useGetdate'爲0,因此我今天看不到事件。刪除條件並將值設置爲1。其他條件也是錯誤的。因此,當我在'year-view'的部分刪除所有條件''plugin.tx_cal_controller.view.list.useCustomEndtime = 1'時,我想知道這一行。我有所有的代碼,但我沒有看到鏈接和新的PHP文件控制器不運行,我試過'回聲' –

    +0

    試試我的測試擴展,它已經過測試並運行EXT:CAL版本1.10.3在TYPO3 CMS 7.6 http://enobe.de/mysitepackage.zip – jokumer