Kalender in Vers. 1.3.9

Hier bekommst Du deutschsprachigen Support bezüglich offizieller Module für phpwcms. Keine Fehlermeldungen oder Erweiterungswünsche bitte!
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Kalender in Vers. 1.3.9

Post by flip-flop »

Oliver Georgi wrote:Dafür gibt es einen speziellen Replacement Tag und in der Dateiverwaltung auch die einfache ID-Info beim Überfahren der jeweiligen Datei.

Bilder

Code: Select all

[img=ID.FORMAT WxHxCROPxQUALITY]ALT-Text[/img]
bzw. verkürzt

Code: Select all

[img=ID.FORMAT WxHxCROPxQUALITY]
Die WxHxCROPxQUALITY sind optional - [W[xH[xCROP[xQUALITY]]]]

Im Prinzip reicht das:

Code: Select all

[img=10 100x100]
Zeige Bild mit ID 10 als JPG und verkleinere proportional auf max. 100 Pixel Breite bzw. 100 Pixel Höhe.
Dieser Tag funktioniert zumindest bei mir nicht (r283). Mich wundert dass niemand der hier beteiligten das getestet hat. :evil:

Funktion temporär ausgelagert ( /include/inc_front/ext.func.inc.php ->function parse_images($matches) ) nach frontend_render, da ich das brauche und nicht warten kann:
[imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/imgx]

Code: Select all

<?php
/* ===========================================================================================
	imgx V1.0  03.01.09  K.Heermann (flip-flop) http://planmatrix.de
	-> [imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/imgx]
	The original script in /include/inc_front/ext.func.inc.php  programmed by (c) Oliver Georgi 
	03.01.09  patched and swaped out to /frontend_render/* by K.Heermann (flip-flop)
	Forum: http://forum.phpwcms.org/viewtopic.php?p=107263#p107263

	Tag: 
	[imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/imgx]
	.FORMAT WxHxCROPxQUALITY ALT-Text Title-Text sind optional - 
	[.FORMAT [W[xH[xCROP[xQUALITY[ ALT-Text[Title-Text]]]]]]]


	Have a look into /include/inc_front/ext.func.inc.php -> 	function parse_images($matches) { ....
	For me it can´t run. 
	I have swaped out and patched this function to /frontend_render/ with the tag: 
	[imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/imgx]
 ============================================================================================= */

// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ----------------------------------------------------------------

if( strpos($content['all'], '[imgx=') !== FALSE ) {

function parse_imagesx($matches) {
// $matches[0] = [imgx=ID.FORMAT WxHxCROPxQUALITY ALT-Text]Title-Text[/img]
// $matches[1] = FileID 
// $matches[2] = WxHxCROPxQUALITY ALT-Text
// $matches[3] = Title-Text

	if(isset($matches[1])) { 
		
		// Image file ID
		$img_id 	= intval($matches[1]); 							// .FileID
		
		// check for Alt-Text
		$alt			= explode(' ', $matches[2], 3); 		// WxHxCROPxQUALITY ALT-Text
// $alt[0] = .FORMAT
// $alt[1] = WxHxCROPxQUALITY
// $alt[2] = ALT-Text
		
		$value		= explode('x', trim(strtolower($alt[1]))); 
		$alttext	= isset($alt[ 2 ])    ? trim($alt[ 2 ]) : '';		// + kh -> alt text

		if(substr($alt[0], 0, 1) == '.') {  // .FORMAT
			$ext	= trim($alt[0]); 
		} else {
			$ext	= '.jpg';
		}

		$alt		= isset($alt[1]) ? html_specialchars(trim($alt[1])) : ''; // WxHxCROPxQUALITY

		$width		= isset($value[ 0 ])  ? intval($value[ 0 ]) : 0;
		$height		= isset($value[ 1 ])  ? intval($value[ 1 ]) : 0;
		$crop			= isset($value[ 2 ]) && intval($value[ 2 ]) === 1 ? 1 : 0; 
		$quality	= isset($value[ 3 ])  ? intval($value[ 3 ]) : 0;

		$image		= '<img src="'.PHPWCMS_URL.'img/cmsimage.php/'.$width.'x'.$height.'x'.$crop;
		if($quality <= 100 && $quality >= 10) {
			$image .= 'x'.$quality;
		}
		$image	   .= '/'.$img_id.$ext.'" alt="'.$alttext.'" border="0"';
		if(isset($matches[3])) {
		
			$title = html_specialchars( preg_replace('/\s+/', ' ', clean_slweg( xss_clean( $matches[3] ) ) ) );
			if($title !== '') {
				$image .= ' title="'.$title.'"';
			}
		}
		$image	   .= ' />';
		
		return $image;
		
	}

	return '<img src="'.PHPWCMS_URL.'img/leer.gif" alt="" border="0" />';

}

$content["all"] = preg_replace_callback('/\[imgx=(\d+)(.*?){0,1}\](.*?)\[\/imgx\]/i', 'parse_imagesx', $content["all"]);
$content["all"] = preg_replace_callback('/\[imgx=(\d+)(.*?){0,1}\]/i', 'parse_imagesx', $content["all"]);


} // end if

?>
Knut :roll:
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
photojo
Posts: 710
Joined: Wed 15. Nov 2006, 20:02
Location: Regensburg, Germany
Contact:

Re: Kalender in Vers. 1.3.9

Post by photojo »

Hi,

trotz Befolgung der Einstellungen bzgl. des Kalenders in diesem Thread, bekomme ich meinen Kalender nicht gerendert. Auf meiner Seite erscheint nach Eingabe der Template von Knut

Code: Select all

<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>
diese Ausgabe ...

Code: Select all

 {STARTDATE:d.m.Y lang=DE}{STARTDATE:Y}
[TITLE]
{TITLE}
[/TITLE][PLACE]

Ort: {PLACE}
[/PLACE][TEXT]
{TEXT}
[/TEXT] [TEXTLONG]
{TEXTLONG}
[/TEXTLONG][IMAGE_CALENDAR]
{IMAGE_CALENDAR}
[/IMAGE_CALENDAR] 
Was habe ich da falsch gemacht?

Danke Jo
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Kalender in Vers. 1.3.9

Post by flip-flop »

Erste Amtshandlung: conf.inc.php

Code: Select all

$phpwcms['allow_ext_render']  = 1; // allow including of custom external scripts at frontend rendering 

$phpwcms['allow_cntPHP_rt']   = 1; // allow PHP replacement tags and includes in content parts 

$phpwcms['SESSION_FEinit']    = 1; // set 1 to enable sessions in frontend, 0 to disable sessions in frontend 
einschalten.

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
photojo
Posts: 710
Joined: Wed 15. Nov 2006, 20:02
Location: Regensburg, Germany
Contact:

Re: Kalender in Vers. 1.3.9

Post by photojo »

Amtshandlung ausgeführt, Schalter passen (waren schon richtig gesetzt!)
Trotzdem gehts nicht! Woran könnte es noch liegen?

Danke Jo
User avatar
zelsyus
Posts: 85
Joined: Wed 5. Nov 2003, 14:23
Location: Lauffen am Neckar
Contact:

Re: Kalender in Vers. 1.3.9

Post by zelsyus »

Hallo ihr.

Ich habe es irgendwie geschafft den in PHPWCMS integrierten Kalender zu aktivieren. Ich kann auch schön Termine im Backend anlegen. Allerdings werden die nicht in der kleinen Kalender-Übersicht angezeigt. Nur im Template. Und dort geht es auch nicht, wenn ich per Klick auf die Überschrift klicke, dass mir die Detail-Seite angezeigt wird.

http://www.romanwreden.de/rw.php?shows

Aber diese Frontend-Funktion geht noch gar nicht? Das ist also normal – oder?

So wie ich das hier gelesen hatte müsste ich dann gleich alle Informationen ins Template stecken?

Und "href=index.php?ebene06" verstehe ich so, dass das dem Menüpunkt entspricht in dem der Kalender drin sein soll? Also in meinem Fall "shows".

Tut mir leid falls die Frage jetzt doppelt ist. Aber ich habe alle Themen zum Kalendar durchgelesen und bin irgendwie nicht schlauer geworden.

Wäre nett wenn mit jemand Tipps geben könnte.
Schon mal Danke
Marco
User avatar
zelsyus
Posts: 85
Joined: Wed 5. Nov 2003, 14:23
Location: Lauffen am Neckar
Contact:

Re: Kalender in Vers. 1.3.9

Post by zelsyus »

Noch ne Frage...:

Kann ich eine Art Archiv der Events darstellen? Also die vergangenen Termine auf der gleichen Seite darstellen?
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Kalender in Vers. 1.3.9

Post by flip-flop »

Hallo,

der Eingebaute Kalender (Modul) hat mit dem kleinen Vorschaukalender nichts zu tun, das sind zwei unabhängig voneinander existierende Kalender. (Ist verwirrend gemacht).

Die FE Darstellung des Modul-Kalenders kannst du beisp.weise hier betrachten: http://www.iba-stadtumbau.de/index.php?kalender

Eine Ausgabe vergangener Termine (Archiv) klappt im Moment noch nicht. Du könntest jedoch die Datei dahingehend erweitern. (Wird in der nächsten Zeit von mir erweitert, auch das Bilderzooming - kann aber keinen Termin nennen).

Aufruf des Kalenders im Frontend:
Tag in einem CP (vorzugsweise HTML oder Plaintext):

Code: Select all

{CALENDAR:
items=10
template=my_dates_list_de.html
lang=de
tag=tag1, tag2
tagmode=OR
href=index.php?ebene06
}
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
zelsyus
Posts: 85
Joined: Wed 5. Nov 2003, 14:23
Location: Lauffen am Neckar
Contact:

Re: Kalender in Vers. 1.3.9

Post by zelsyus »

Vielen Dank Knut. Das mit dem Archiv (das noch niccht geht) hilft mir schon mal weiter. Da muss ich mal schaun, ob ich das selbst hinbekomme...

Den Rest habe ich jetzt auch soweit verstanden. Hatte da ein Problem mit der Logik. Jetzt geht's.
caramello
Posts: 70
Joined: Thu 23. Sep 2004, 21:43

Re: Kalender in Vers. 1.3.9

Post by caramello »

I wrote this for a client as well, but still he just rented some of my time and knowledge. He doesn't own it. Therefor it should still be available for the community that served me wel for some time now.

Here's Olivers' phpwcmsCalendar.class.php, but a bit modified to properly include all the information you can fill in in the backend. I included the whole file as code for easy replacement. Also a full template's code with possible reptags. I left {TEXT} intact, but also added {TEASER} as i found that more logical. Both can be used for the same line of text from the backend.

Some extra info:
I use, two templates in two pages. To be able to show a list of events in one article, and show the full text in another article, using the "href" tag in the REPTAG. Because the HREF tag in the templates adds the "show_date" and the ID to the browsers URL the calendar class now knows to select only that calendar item. Using the LONGTEXT reptag in a different template i can now show the full article. Using this method i have different calendars on different pages showing different events based on the "tag=birthdays, reservations" settings in the reptags.


Images work, caption work, url works that should be a small help for some.

Added a extra REPTAG feature :

Code: Select all

{CALENDAR:
items=10
template=home_dates_de.html
lang=
tag=
tagmode=OR
href=index.php?agenda-full
WxHxCxQ=75x100x1x75}
This allows ofcourse for an easier setting of the width,height, crop and quality of the image presented.

And last but not least added support for zoom and light box.

NOTE TO Oliver.
How to you asure that the meta tags needed in the header of the page for mootools and such get in the header the moment lightbox is enabled somewhere. You must have some trick to do that as gallery, or article pages that dont have lightbox also dont include the meta tags like mootools. Or....it must be magic :-). I now get the meta tags in using the option in the template used for the page.


phpwcmsCalendar.class.php :

Code: Select all

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

/**
 * phpwcms Calendar frontend render class
 */
class phpwcmsCalendar {

	var $mode		= 'simple';
	var $dates		= array();

	/**
	 * Initialize class
	 */
	function phpwcmsCalendar($date=false) {

		// current

		if(!isset($_GET['show_date'])) {


			$this->current_date	= getdate();
			// print_r($this->current_date);




		}
		// If there's only one ! We need to select only ONE ! By the ID give in the U R L
		if(isset($_GET['show_date']) && mysql_real_escape_string($_GET['show_date']) != "") {

			$show_date = mysql_real_escape_string($_GET['show_date']);

			list($year, $month, $day, $event_id) = split('[-_]', $show_date);

			$this->event_id = $event_id;

		}

		// set today 00:00:00 as start date
		$this->date_start	= mktime(0, 0, 0, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year']);

		// by default date_start + 1 year
		$this->date_end		= mktime(0, 0, 0, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year'] + 1) - 1;
		$this->dbReset();
	}

	/**
	 * Reset db base vars
	 */
	function dbReset() {
		$this->where	= '';
		$this->select	= '*';
		$this->join_on	= '';
		$this->group_by	= '';
		$this->order_by	= 'calendar_start ASC';
		$this->limit	= 0;
	}

	function defaultTemplate() {
		$this->template = '';
		$this->href		= '';
	}

	/**
	 * search string for calendar tag and parse
	 */
	function parse(& $string) {

		if( preg_match_all('/\{CALENDAR:(.*?)\}/s', $string, $matches) ) {

			if( isset($matches[1]) ) {

				foreach($matches[1] as $key => $value) {

					$this->parse_match($value);
					$result = $this->render();

					// replace calendar by result
					$string = str_replace($matches[0][$key], $result, $string);

				}

				$string = html_parser($string);

			}
		}

	}

	function render() {

		$items		= array();

		foreach($this->dates as $key => $date) {
			 // print_r($items);
			$date['calendar_refid'] = intval($date['calendar_refid']);

			if($date['calendar_refid'] > 0) {
				$href = 'index.php?aid='.$date['calendar_refid'];
			} else {
				$href = $this->href ? $this->href . '&show_date='.date('Y-m-d', $date['calendar_start_date']).'_'.$date['calendar_id'] : '';
			}

			$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']);
			// The long or FULL text
			$items[$key] = render_cnt_template($items[$key], 'TEXTLONG', $date['calendar_text']);
			// I use teaser, but left the {TEXT} code intact, but {TEASER} seems more appropriate
			$items[$key] = render_cnt_template($items[$key], 'TEASER', $date['calendar_teaser']);
			// Now for the image part
			/**
			* Get Image ID from DB String
			*/
			// print $date['calendar_object'];
			$image_temp = explode(":", $date['calendar_object']);
			$image_temp = explode(";", $image_temp[9]);
			$image_id_temp = $image_temp[0];

			// Image URL
			// $image_temp2 = explode(":", $date['calendar_object']);

			// 13 = filename
			// 16 = Zoom  yes / no

			// 19 = lightbox yes or no

			// 23 = caption tekst
			// 25 = link yes / no
			// 27 = URL

			// Get the right url for the image
			$image_temp = explode(":", $date['calendar_object']);
			$image_temp = explode(";", $image_temp[27]);
			$image_url = $image_temp[0];

			// Zoomin' yes or ........nooooo
			$image_temp = explode(":", $date['calendar_object']);
			$image_temp = explode(";", $image_temp[16]);
			$image_zoom = $image_temp[0];

			// Lightbox' yes or ........nooooo
			$image_temp = explode(":", $date['calendar_object']);
			$image_temp = explode(";", $image_temp[19]);
			$image_lightbox = $image_temp[0];

			// Caption info, same ol same ol
			$image_temp = explode(":", $date['calendar_object']);
			$image_temp = explode(";", $image_temp[23]);
			$image_caption = $image_temp[0];
			// Strip some nasty quotes
			$image_caption = substr($image_caption, 1, -1);





			/**
			* 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 LIMIT 0,1');

			// print_r($sql_hash);
			if($sql_hash[0][f_hash] != "") {

				$image_calendar_name = $sql_hash[0][f_hash].'.'.$sql_hash[0][f_ext];

				// Set the image using the PHPWCMS image All in One wonder call
				$image_calendar =  "<img border=\"0\" src=\"".PHPWCMS_URL."img/cmsimage.php/".$this->WxHxCxQ."/".$image_calendar_name."\" title=\"".$image_caption."\" alt=\"".$image_caption."\">";

				if($image_zoom == '1') {
					$image_calendar_link = "<a href=\"".PHPWCMS_URL."img/cmsimage.php/800x600/".$image_calendar_name."\"";


					if($image_lightbox == '1') {
						$image_calendar_link.= " border=\"0\" target=\"_blank\" rel=\"lightbox\" alt=\"".$image_caption."\">";
					}
					$image_calendar_link.= $image_calendar."</a>";
					$image_calendar = $image_calendar_link;
				}

			}
			// Just needs to be here, otherwise it will use the last image from the event before this one. (STrange brew !!)
			else {
				$image_calendar = "";
			}

			// Now the rest of the items the backend has provided us with.
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_CALENDAR', $image_calendar);

			$items[$key] = render_cnt_template($items[$key], 'URL', $image_url);

			$items[$key] = render_cnt_template($items[$key], 'CAPTION', $image_caption);



		}

		return implode(LF, $items);

	}

	/**
	 * Parse matched replacement tag
	 */
	function parse_match($match='') {

		$default		= array();
		$match			= trim($match);

		// set query defaults
		$this->dbReset();
		$this->defaultTemplate();

		if($match !== '' && strpos($match, '=') !== FALSE ) {

			// oh yes fix, in case LF was converted to <br /> by phpwcms
			$match = str_replace('<br />', LF, $match);

			// result is a normal array
			$match = parse_ini_str($match, false);

			$default['items']		= isset($match['items']) ? intval($match['items']) : 0;
			$default['template']	= empty($match['template']) ? '' : trim($match['template']);
			$default['lang']		= empty($match['lang']) ? '' : trim($match['lang']);
			$default['tag']			= empty($match['tag']) ? '' : trim($match['tag']);
			$default['tagmode']		= empty($match['tagmode']) ? 'OR' : ( trim($match['tagmode']) == 'AND' ? 'AND' : 'OR' );
			$default['href']		= empty($match['href']) ? '' : trim($match['href']);
			// We want to set the size of the image, and such more in the reptag.
			$default['WxHxCxQ']		= empty($match['WxHxCxQ']) ? '' : trim($match['WxHxCxQ']);
			// This was added for a reason that i cant remember right now. Having to do with displaying the full article.

			$default['mode']		= empty($match['mode']) ? '' : trim($match['mode']);

		} else {

			// base format
			// 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]]]]
			$match = explode(',', $match, 5);

			$default['items']		= intval($match[0]);
			$default['lang']		= empty($match[1]) ? '' : $match[1];
			$default['template']	= empty($match[2]) ? '' : trim($match[2]) ;
			$default['href']		= empty($match[3]) ? '' : trim($match[3]);
			$default['tag']			= empty($match[4]) ? '' : $match[4];
			$default['tagmode']		= 'OR';
			// We want to set the size of the image, and such more in the reptag.
			$default['WxHxCxQ']		= '100x100x1x90';
			$default['mode']		= '';

		}
		$this->WxHxCxQ = $default['WxHxCxQ'];
		$this->limit = $default['items'];
		$this->href  = $default['href'];
		// Remeber the one with the "i cant remember....."? Same here
		$this->mode  = $default['mode'];

		if($default['template'] !== '') {
			$default['template'] = preg_replace('/[\/\\:]/', '', $default['template']);
			if(is_file(PHPWCMS_TEMPLATE.'calendar/'.$default['template'])) {
				$this->template = file_get_contents(PHPWCMS_TEMPLATE.'calendar/'.$default['template']);
				$this->template = str_replace('{STARTDATE', '{LIVEDATE', $this->template);
				$this->template = str_replace('{ENDDATE', '{KILLDATE', $this->template);
			} else {
				$default['template'] = '';
			}
		}

		$where = array();

		if($default['lang'] !== '') {

			$default['lang']	= str_replace(',', ' ', preg_replace('/[^a-z\-]/', '', strtolower($default['lang'])));
			$default['lang']	= array_intersect( convertStringToArray( $default['lang'], ' '), $GLOBALS['phpwcms']['allowed_lang']);

			if(count($default['lang'])) {
				$where[]			= "calendar_lang IN ('" . implode("','", $default['lang']) . "')";
			}
		}

		if($default['tag'] !== '') {

			$default['tag'] = convertStringToArray( strtolower( $default['tag'] ), ',');

			if(count($default['tag'])) {

				$tag_where = array();

				foreach($default['tag'] as $tag) {

					$tag_where[]		= "cat_name='".aporeplace($tag)."'";

				}

			if(count($tag_where)) {

					$where[]		= '(' . implode(' '.$default['tagmode'] . ' ', $tag_where) . ')';

					$this->join_on	= 'LEFT JOIN '.DB_PREPEND.'phpwcms_categories ON cat_pid=calendar_id';
					$this->group_by	= 'calendar_id';
				}

			};
		}

		$this->where = implode(' AND ', $where);


		$this->getDate();

		return $default;

	}


	function getDate() {

		// 1 daily
		// 2 Every weekday (Mon-Fri)
		// 3 Every Mon., Wed. and Fri.
		// 4 Every Tues. and Thurs.
		// 5 Weekly
		// 6 Monthly
		// 7 yearly

		if(is_string($this->order_by) && trim($this->order_by) != '') {
			$this->order_by = '  ORDER BY '.$this->order_by;
		} else {
			$this->order_by = '';
		}
		if(is_int($this->limit) && $this->limit > 0) {
			$this->limit = ' LIMIT '.$this->limit;
		} else {
			$this->limit = '';
		}
		if(is_string($this->group_by) && trim($this->group_by) != '') {
			$this->group_by = '  GROUP BY '.$this->group_by;
		} else {
			$this->group_by = '';
		}



		$sql  = 'SELECT '. $this->select .', ';
		$sql .= "UNIX_TIMESTAMP(calendar_start) AS calendar_start_date, ";
		$sql .= "UNIX_TIMESTAMP(calendar_end) AS calendar_end_date ";
		$sql .= ' FROM '.DB_PREPEND.'phpwcms_calendar pc ';
		$sql .= $this->join_on;
		$sql .= ' WHERE ';



		$sql .= 'calendar_status = 1 AND ';
		$sql .= "calendar_start >= '".aporeplace( date('Y-m-d H:i:s', $this->date_start) )."' AND ";
		$sql .= "calendar_start <= '".aporeplace( date('Y-m-d H:i:s', $this->date_end) )."'";
		if(!empty($this->where)) {
			$sql .= ' AND ' . $this->where;
		}
		$sql .= $this->group_by;
		$sql .= $this->order_by;
		$sql .= $this->limit;


		// If the url given by the link in the list of events, gives us an ID at the end,
		// we need to limit the sql statement to just the event from the ID given. We stripped
		// this from the showdate.
		if(isset($this->event_id) && isset($this->event_id) == 'full') {


			$sql = "SELECT *, UNIX_TIMESTAMP(calendar_start) AS calendar_start_date, UNIX_TIMESTAMP(calendar_end) AS calendar_end_date FROM phpwcms_calendar pc WHERE calendar_status = 1 AND calendar_id >= '".$this->event_id."' LIMIT 0,1";



		}

		// Now we know when to select a list or just the one item.

		$this->dates = _dbQuery($sql);
		if( !$this->dates ) {
			$this->dates = array();
		}
	}

}


?>
template example :

Code: Select all

<div class="calendar" style="clear : both; padding : 10px;">
	
	<div class="calendar_image" style="float : left;">
		[IMAGE_CALENDAR]
              {IMAGE_CALENDAR}
		[/IMAGE_CALENDAR]
		<br/>
		[CAPTION]<span style="color : black;">{CAPTION}</span>[/CAPTION]
    </div>

	<div class="calendar_text" style="padding : 10px; float : right;">
		[TITLE]<h3>[HREF]<a href="{HREF}">[/HREF]{TITLE}[HREF]</a>[/HREF]</h3>[/TITLE]
		[PLACE]<p><b>Plaats :</b> {PLACE}</p>[/PLACE]
		[TEASER]<p>{TEASER}</p>[/TEASER]

		[TEXTLONG]<p>{TEXTLONG}</p>[/TEXTLONG]
		
	</div>
	
	<div class="calendar_date">
		[HREF]<a href="{HREF}">[/HREF]
			<strong>Datum :</strong> {STARTDATE:d.m.Y}<br/>
			<strong>Tijd  :</strong> {STARTDATE:H:i} - {ENDDATE:H:i}
		[HREF]</a>[/HREF]
	</div>

		
		
	<div class="calendar_url">	
		[URL]<a href={URL}>Meer..{URL}</a>[/URL]
	</div>

</div>
Oh ... before i forget......this works on r304+
A website is a concept not a digital brochure ! Vectrus Internet Solution
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Kalender in Vers. 1.3.9

Post by flip-flop »

I think this is a better way to catching the whole image set and loading mootools automatically:

phpwcmsCalendar.class.php (enhancement for a basic image set)

Code: Select all

		$items       = array();
		$lightbox_on = false;
		
		foreach($this->dates as $key => $date) { .........
		 .........................

			// ========== Image representation: 17.01.08 Enhanced by flip-flop (K.Heermann)
			// the multi all in one function
			$image_temp = @unserialize($date['calendar_object']);

			$image_id    = $image_temp['image']['id'];
			$image_name  = $image_temp['image']['name'];
			$image_zoom  = $image_temp['image']['zoom'];
			$image_light = empty($image_temp['image']['lightbox']) ? 0 : $image_temp['image']['lightbox'];
			$lightbox_on = $image_light > 0 ? true : $lightbox_on;
			$image_url   = $image_temp['image']['link'];
			
			// following is default for the exploded $caption
			// [0] caption text
			// [1] alt text for image
			// [2] link -> array(0 => link, 1 => target)
			// [3] title text -> if empty alt text will be used
			// [4] copyright information
			$image_capt = getImageCaption($image_temp['image']['caption']);

			$image_text  = html_specialchars($image_capt[0]);
			$image_alt   = html_specialchars(empty($image_capt[1]) ? $image_name : $image_capt[1]);  // alt
			$image_link  = empty($image_capt[2][0]) ? '' : html_specialchars($image_capt[2][0]); // link
			$image_link_t= empty($image_capt[2][1]) ? '' : html_specialchars($image_capt[2][1]); // link target
			$image_title = empty($image_capt[3]) ? ''    : html_specialchars($image_capt[3]);    // title
			$image_copyr = empty($image_capt[4]) ? ''    : html_specialchars($image_capt[4]);    // copyright
			


// get segments: cmsimage.php/%WIDTH%x%HEIGHT%x%CROP%x%QUALITY%/%HASH%.%EXT%
			$image_calendar = '<img src="'.PHPWCMS_URL.'img/cmsimage.php/100x100/'.$image_id.'" alt="'.$image_alt.'" />';

//----------------
			// function render_cnt_template($text='', $tag='', $value='')   // front.func.inc.php
			$items[$key] = render_cnt_template($items[$key], 'TEXTLONG', $date['calendar_text']);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_CALENDAR', $image_calendar);
//----------------
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_ID',    $image_id);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_NAME',  $image_name);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_ZOOM',  $image_zoom);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_LIGHT', $image_light);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_URL',   $image_url);

			$items[$key] = render_cnt_template($items[$key], 'IMAGE_TEXT',  $image_text);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_ALT',   $image_alt);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_LINK',  $image_link);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_LINK_TARGET', $image_link_t);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_TITLE', $image_title);
			$items[$key] = render_cnt_template($items[$key], 'IMAGE_COPYR', $image_copyr);
			
			$items[$key] = render_cnt_template($items[$key], 'SITE', PHPWCMS_URL);
//----------------
		}
		
		// Start lightbox: loading mootools and so on ---------------------------------

		if($lightbox_on) {
			initializeLightbox();
		}
		// ---------------------------------
		// ========== END Image representation 

		........................

Template:

Code: Select all

<!--
  image ID:         {IMAGE_ID}
  image name:       {IMAGE_NAME}
  zoom:             {IMAGE_ZOOM}
  lightbox:         {IMAGE_LIGHT}
  url:              {IMAGE_URL}
// caption =======
/ following is default for the exploded $caption
/ caption text|alt text for image|link|       |title text  |copyright information
/ IMAGE_TEXT  |IMAGE_ALT         |IMAGE_LINK  |IMAGE_TITLE |IMAGE_COPYR
  image text        {IMAGE_TEXT}
  image alt         {IMAGE_ALT}
  image link        {IMAGE_LINK}
  image link target {IMAGE_LINK_TARGET}
  image title       {IMAGE_TITLE}
  image copyright   {IMAGE_COPYR}
  site url          {SITE}
//-->
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
caramello
Posts: 70
Joined: Thu 23. Sep 2004, 21:43

Re: Kalender in Vers. 1.3.9

Post by caramello »

I like the image detail part and will implement it if you dont mind :-).

What I still dont understand is how the mootools stuff gets in automaticly.
// Start lightbox: loading mootools and so on ---------------------------------

if($lightbox_on) {
initializeLightbox();
}
// ---------------------------------
// ========== END Image representation
Is that enough to include the needed .js files ?

Julius
A website is a concept not a digital brochure ! Vectrus Internet Solution
yoshi001
Posts: 22
Joined: Sun 25. May 2008, 23:32
Location: Bodensee / Lake of Constance

Ausgabe vergangener Termine

Post by yoshi001 »

lieber knut..
flip-flop wrote: Eine Ausgabe vergangener Termine (Archiv) klappt im Moment noch nicht. Du könntest jedoch die Datei dahingehend erweitern. (Wird in der nächsten Zeit von mir erweitert, auch das Bilderzooming - kann aber keinen Termin nennen).
hast du das noch immer auf der agenda? sodass ich den phpwcms-eigenen kalender einsetzen könnte, um "in der nächsten zeit" (dieses jahr?) dieses feature mit deiner leistung nachrüsten zu können?

ich hab's immer gerne "all-in-one", deswegen hoffe ich so eine terminseite mit phpwcms und nichts anderem hinzustellen.. nach einigen querelen mit allerlei lösungen wäre mittlerweile eine externe, per iframe eingebundene alternative die letzte lösung.

dank+gruss,
yoshi
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Kalender in Vers. 1.3.9

Post by flip-flop »

Das ist immer noch aktuell. Im Moment habe ich allerdings nur wenig Zeit hier an der Erweiterung zu arbeiten.

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
HajoT
Posts: 37
Joined: Sat 17. Jan 2009, 23:16
Location: Neustadt in Holstein

Re: Kalender in Vers. 1.3.9

Post by HajoT »

Oliver Georgi wrote: Im Prinzip reciht das:

Code: Select all

[img=10 100x100]
Zeige Bild mit ID 10 als JPG und verkleinere proportional auf max. 100 Pixel Breite bzw. 100 Pixel Höhe.
Hallo,

Wurde an diesen RT's mittlerweile etwas geändert? Insbesondere in Version 1.4.1.

Folgendes gebe ich ein:

Code: Select all

[img=10.gif 1000x1000]Test[/img]
Das Bild mit der ID 10 wird auch angezeigt. Auch im gewählten Format. Nur "1000x1000" wird dann als ALT Tag verwendet und "Test", was ja eigentlich der ALT Tag sein soll, wird völlig ignoriert.

Grüße

Hajo
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Kalender in Vers. 1.3.9

Post by flip-flop »

Hi,

der Tag ist hier irgendwo falsch beschrieben:

So lautet der Tag:

Code: Select all

[img=ID.FORMATxWxHxCROPxQUALITY ALT-Text]TITEL-Text[/img]
also

Code: Select all

img=10x100x100]
oder

Code: Select all

[img=10.gifx1000x1000]Test[/img]
bzw.

Code: Select all

[img=10.gifx1000x1000 Alt-Text]Title-Text[/img]
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Post Reply