This is an old revision of the document!


Kalender

Installation

Programmteil um den Kalender im FE zu aktivieren: template/inc_script/frontend_render/init-calendar.php

init_calendar.php

<?php
/*************************************************************************************
   Copyright notice
 
   (c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
 
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
 
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
 
This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
// ----------------------------------------------------------------
// OBLIGATE CHECK FOR PHPWCMS CONSTANTS
if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");}
// ----------------------------------------------------------------
 
 
/**
 * Usage: sample Replacement Tag
 *
 * {CALENDAR:
 *    items=100
 *    template=dates_list_de.html
 *    lang=de
 *    tag=tag1, tag2
 *    tagmode=OR
 *    date_start=01.01.2009
 *     date_end=31.12.2010
 *    href=index.php?calendar
 *    WxHxCxQ=150x100x0x80       (since V1.1)
 * }
 *
 * OR
 *
 * {CALENDAR:2,main_page.tmpl,de en, href, tag1, tag2 tag2, tag3}
 * [item count,[template[,language(en de - separated by space)[, href, tags, tag, tag, tag]]]]
 *
 **/
 
if(strpos($content['all'], '{CALENDAR:')) {
 
    $GLOBALS['block']['css']['calendar'] = 'specific/calendar.css'; // +kh: including the css file
 
    include('include/inc_module/mod_calendar/inc/calendar.class.php');
 
    $myCal = & new phpwcmsCalendar();
    $myCal->parse($content['all']);
 
}
 
?>


Im Backend auf Module → Kalender/Events und danach das Setup Verzeichnis löschen falls noch nicht geschehen. Jetzt sollten die entsprechenden Kalender Tabellen in der Datenbank angelegt sein. (“_Setup” Verzeichnis braucht in neueren CMS-Versionen nicht mehr gelöscht zu werden).

Dann wieder auf Module → Kalender/Events und einen neuen Eintrag anlegen. Bis auf die “Beschreibung” und “Bild” bitte alles einmal ausfüllen und testen.
Im Original wird “Beschreibung” und “Bild” nicht funktioniert da noch nicht implementiert → Siehe Erweiterung V1.1 / Erweiterung V1.2.

Dann einen neuen Artikel mit CP → Einfacher Text anlegen.

Der RT sieht zur Zeit (ab V1.42 r348) aus:

Tags des Kalenders: http://forum.phpwcms.org/viewtopic.php?p=106796#p106796

{CALENDAR:
items=10
template=my_dates_list_de.html
lang=de
tag=tag1, tag2
tagmode=OR
date_start=01.01.2010
date_end=31.12.2010
href=index.php?ebene06
WxHxCxQ=150x100x0x80
}

WxHxCxQ erst ab Erweiterung V1.1 / Erweiterung V1.2 verfügbar.

tag1, tag2, usw. wird im Kalender bei Kalender: oder calendar: eingetragen, Komma separiert.
So kann bei der Ausgabe noch einmal über verschiedenen Gruppen die den z.B. “tag1” enthalten gefiltert werden. (Hier ist nicht ein Tag im Sinne von Datum gemeint, sondern eine Kennung (engl. “tag”) die auch aus z.B. Städtenamen bestehen könnte).
Tagmode im Moment nur OR möglich.

Das Template liegt in /template/calendar/


CSS:

Datei: template/inc_css/specific/calendar.css

calendar.css

/* Calendar */
.calendar {
    padding: 10px 0 5px 0;
    margin: 0;
    clear: left;
    margin: 0;
    border-top: 1px solid #888;
    width: 500px;
    margin-bottom:10px;
}
.calendar div.date {
    float: left;
    position: relativ;
    background-color: #baeaea;
    text-align: left;
    line-height: 100%;
    width: 120px;
    height: 60px;
    margin: 0;
    padding: 5px 0 10px 5px;
    font-size: 1.2em;
}
 
 
.calendar div.detail {
    position: relativ;
    background-color: transparent;
    width: auto;
    line-height: 100%;
/*    float: left; */
    margin: 0 0 0 125px;
    padding: 0px 0 10px 20px;
    font-size: 1.3em;
    border-left: 1px solid #ccc;
}
 
 
.calendar div.date strong {
    width: 100px;
    text-align: left;
    padding-top: 5px;
    letter-spacing: .06em;
}
 
.calendar div.date div.day,
.calendar div.date div.day-short_month {
    float: none;
    padding: 0 0 10px 0;
    font-weight: bold;
    letter-spacing: .1em;
    line-height: 108%;
    font-size: 30px;
    color: #888;
}
.calendar div.date div.day-short_month {
    letter-spacing: .01em;
}
 
.calendar div.date div.day-word {
    float: none;
    padding: 0 0 4px 0;
    margin: 0;
    font-weight: bold;
    letter-spacing: .1.5em;
    line-height: 108%;
}
.calendar div.date div.day-month-year {
    float: none;
    padding: 0;
    font-weight: normal;
    letter-spacing: .05em;
    line-height: 100%;
}
.calendar div.date div.year {
    float: none;
    width: auto;
    padding: 0;
    font-weight: normal;
    letter-spacing: .1em;
    line-height: 108%;
}
 
 
 
.calendar div.detail h2 {
/*    padding: 1px 0 2px 120px; */
    margin: 0;
    padding: 0 0 10px 0;
    font-size: 1.5em;
    font-family: "HelveticaNeue Condensed", "Arial Narrow", "Helvetica Condensed", Arial, Helvetica, sans-serif;
    font-weight: normal;
    line-height: 100%;
    color: #666;
}
.calendar div.detail p {
    padding: 0 0 0 0;
    margin: 0;
}
.calendar div.detail p.place {
    font-weight: bold;
    color: #666;
    font-size: 1.1em;
    padding-bottom: 3px;
}
 
.calendar div.detail div.textlong {
    font-weight: normal;
    color: #666;
    font-size: 1.0em;
    padding-bottom: 3px;
}
 
.calendar div.detail a {
    text-decoration: none;
}
.calendar div.detail h2 a {
    color: #7C8084;
}
.calendar div.detail a:hover {
    color: #000000;
    text-decoration: underline;
}
.calendar div.teaser {
    line-height: 140%;
    margin: 0;
    padding: 0;
}


Text des Wysiwyg Editors ausliefern

→ ab Zeile 105 /template/inc_script/phpwcmsCalendar.class.php
→ Seit V1.42 r348 ab Zeile 105 /include/inc_module/mod_calendar/inc/calendar.class.php
$items[$key] = $this->template;
$items[$key] = render_cnt_template($items[$key], 'HREF', $href);
$items[$key] = render_cnt_template($items[$key], 'TITLE', html_specialchars($date['calendar_title']));
$items[$key] = render_cnt_template($items[$key], 'TEXT', plaintext_htmlencode($date['calendar_teaser']));
$items[$key] = render_cnt_template($items[$key], 'PLACE', html_specialchars($date['calendar_where']));
$items[$key] = render_cnt_date($items[$key], $date['calendar_start_date'], $date['calendar_start_date'], $date['calendar_end_date']);

(Ab V1.42 r348 sind die Einträge URL und TARGET hinzugekommen).

→ das einfügen
 $items[$key] = render_cnt_template($items[$key], 'TEXTLONG', $date['calendar_text']);
TEXTLONG ist hier der Platzhalter der in das Template kommt:


Beispieltemplate mit TEXTLONG:

template/calendar/TemplateDatei.html

<div class="calendar">
        <div class="date">
                <strong>{STARTDATE:d.m.}</strong><strong class="year">{STARTDATE:Y}</strong> - <strong>{ENDDATE:d.m.}</strong><strong class="year">{ENDDATE:Y}</strong>
        </div>[TITLE]
        <h2>{TITLE}</h2>[/TITLE][PLACE]
        <p class="place">Ort: {PLACE}</p>[/PLACE][TEXT]
        <div class="teaser">
                {TEXT}
        </div>[/TEXT]
        [TEXTLONG]
        <div class="textlong">
                {TEXTLONG}
        </div>[/TEXTLONG]
</div>


Darstellung von Bilder aus der Dateizentrale:

http://forum.phpwcms.org/viewtopic.php?p=107230#p107230

→ phpwcmsCalendar.class.php ab Zeile 105 (/template/inc_script/)
$items[$key] = $this->template;
$items[$key] = render_cnt_template($items[$key], 'HREF', $href);
$items[$key] = render_cnt_template($items[$key], 'TITLE', html_specialchars($date['calendar_title']));
$items[$key] = render_cnt_template($items[$key], 'TEXT', plaintext_htmlencode($date['calendar_teaser']));
$items[$key] = render_cnt_template($items[$key], 'PLACE', html_specialchars($date['calendar_where']));
$items[$key] = render_cnt_date($items[$key], $date['calendar_start_date'], $date['calendar_start_date'], $date['calendar_end_date']);

→ das einfügen

<note warning> Diese Art der Bilddarstellung bitte nicht mehr verwenden, siehe V1.2!! </note>

phpwcmsCalendar.class.php

 
            // + KH: 10.09.2010
            /**
            * Get Image ID from DB String
            */
            $image_calendar = '';
            $image_temp = explode(":", $date['calendar_object']);
            $image_temp = explode(";", $image_temp[9]);
            $image_id_temp = $image_temp[0];
 
            /**
            * Get Image from DB table 'phpwcms_file'
            */
            $sql_hash = _dbQuery('SELECT * FROM '.DB_PREPEND.'phpwcms_file WHERE f_id = '.$image_id_temp.' AND f_trash = 0');
 
            //dumpVar($sql_hash[0][f_hash]);
            if ($sql_hash[0][f_hash]) {
                $image_calendar_name = PHPWCMS_FILES.$sql_hash[0][f_hash].'.'.$sql_hash[0][f_ext];
 
                list($ic_width, $ic_height, $ic_type, $ic_attr) = getimagesize($image_calendar_name);
 
//                $image_calendar = '<img src="'.$image_calendar_name.'" width="'.$ic_width.'" height="'.$ic_height.'" alt="" />';
                $image_calendar = '<img src="img/cmsimage.php/'.$ic_width.'x'.$ic_height.'/'.$image_id_temp.'.'.$sql_hash[0][f_ext].'" alt="" />';
 
            }
            else
                $image_calendar_name = '';
 
            $items[$key] = render_cnt_template($items[$key], 'IMAGE_CALENDAR', $image_calendar);
            // + KH: 10.09.2010  ENDE
Erläuterung:

Im ersten Schritt wird die ID des Bildes ermittelt das in der Datenbank unter calendar_object abgelegt ist.
Dann wird der Bildname (hash) sowie die Bildgröße aus der Datenbank ermittelt. Im letzten Schritt wird dann der Platzhalter IMAGE_CALENDAR durch den Image-tag ersetzt.

Einschränkungen:

Keine Bildskalierung - Da im Kalender Backend keine Bildgröße für die Vorschau festgelegt werden kann, entspricht die Bildausgabe den original Dimensionen des in der Dateizentrale hochgeladenen Bildes. Im Moment muss also schon vor dem hochladen die Bildgröße entsprechend auf das gewünschte Ausgabeformat angepasst werden.

Keine Bildunterzeile (ALT - TAG) - Die Bildunterzeile wird zur Zeit noch nicht beachtet, der ALT-TAG is somit noch leer.

Keine Vergrößerung / Lightbox - Da im Backend kein Vorschaubild erstellt wird, habe ich auch keinen Link für die Lightbox erstellt.

So, ich hoffe es funktioniert bei euch soweit. Getestet habe ich es unter 1.3.9 R240.


Beispieltemplate mit TEXTLONG und IMAGE_CALENDAR:

template/calendar/TemplateDatei.html

<div class="calendar">
        <div class="date">
                <strong>{STARTDATE:d.m.}</strong><strong class="year">{STARTDATE:Y}</strong> - <strong>{ENDDATE:d.m.}</strong><strong class="year">{ENDDATE:Y}</strong>
        </div>[TITLE]
        <h2>{TITLE}</h2>[/TITLE][PLACE]
        <p class="place">Ort: {PLACE}</p>[/PLACE][TEXT]
        <div class="teaser">
                {TEXT}
        </div>[/TEXT]
        [TEXTLONG]
        <div class="textlong">
                {TEXTLONG}
        </div>[/TEXTLONG][IMAGE_CALENDAR]
                <div class="image_teaser">
                {IMAGE_CALENDAR}
        </div>[/IMAGE_CALENDAR]
</div>


Art der Bildholung

http://forum.phpwcms.org/viewtopic.php?p=107258#p107258

Leider ist diese Art der “Bildholung” überhaupt nicht zu empfehlen!
Im System existiert eine universelle Methode, jedes Bild in der auch immer gewünschten Größe/Ausgabeformat zu erhalten.

Bilder über cmsimage.php einbinden

Image Tags

Alternativ können Bilder aus der Dateizentrale auch über den img Tag in das Dokument geholt werden.

Siehe Tag: imgx

deutsch/module/kalender.1291201171.txt.gz · Last modified: 2018/06/03 18:07 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0