This is an old revision of the document!


Calendar

FIXME translate/rewrite

Download: http://forum.phpwcms.org/viewtopic.php?p=103834#p103834

Modul: Modul Kalender/Events //(ab V1.4.2 r348 integriert)// (6.49 KiB, 85 downloads)

Changed file for wysiwyg output with picture from file center (up to V1.4.2 r347): Complete set, CSS, Templ, php (5.79 KiB, 81 downloads)

Installation

Move template/inc_script/frontend_render/disabled/init-calendar.php into: 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
 * }
 *
 * 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']);
 
}
 
?>


In backend choose → calendar/events and afterwards you should delete (or rename) the setup folder. The database now should contain the calendar tables.

Now again click the module link → calendar/events and enter a new entry. Fill in all fields but the description.
The picture feature will not be working at this time, the content of the calendar class didn't reveal anything, at least.

Now set up a new article and add a content part (CP) → plain text.

The replacement tag (RT) looks like (from V1.42 r348 upwards) this:

Tags of the calendars: 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
}
tag1, tag2, and so on will be entered atcalendar: colon separated.
This way you can filter different groups for output purposes containing this(these) tag(s).
Tagmode: only OR possible at this time.

The template can be found in /template/calendar/


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

<div class="calendar">
        <div class="date">
                <strong>{STARTDATE:d.m.}</strong><strong class="year">{STARTDATE: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

phpwcmsCalendar.class.php

/**
* Get Image ID from DB String
*/
$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');
if ($sql_hash[0][f_hash])  // KH 10.09.2010: Is there any image?
    $image_calendar_name = PHPWCMS_FILES.$sql_hash[0][f_hash].'.'.$sql_hash[0][f_ext];
else
    $image_calendar_name = PHPWCMS_FILES.'image_placeholder.png';
 
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="" />';
 
$items[$key] = render_cnt_template($items[$key], 'IMAGE_CALENDAR', $image_calendar);
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

<div class="calendar">
        <div class="date">
                <strong>{STARTDATE:d.m.}</strong><strong class="year">{STARTDATE: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

english/modules/calendar.1284126010.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