Zum Inhalt springen

SK_Calendar (VCE) Sortierung Einträge Monat / Woche

Erstellt am 5. Dezember 2007 · 4 Antworten · letzte Antwort am 12. Dezember 2007

Tags: Kalender & Termine, Frage

vwenk ·

Hallo Zusammen,

habe mal wieder ein kleines Problem mit dem SK_Calendar (VCE):

In der Anzeige der Monats- oder Wochenübersicht werden bei mehreren Einträgen die Termine wahllos angezeigt.
Wie kann ich diese sortieren nach Startuhrzeit?

PS: Ist eigentlich ein Update auf vers. 3.3. problemlos? Habe keine Lust, dass es mir die Daten zerschiesst oder die Darstellung verändert.

Ich hoffe auf Hilfe und danke im Voraus.

Gruss Volker

vwenk ·

Zum Sortproblem habe ich folgenden Hinweis gefunden:

einfügen von "order by" oder "group by" in der Datei pi1/class.tx_skcalendar_weekview.php
bzw eine der anderen class.tx_skalender - dateien

Das zu sortierende Feld ist: start_time

Nun habe ich mir diese angeschaut und bin ratlos wo genau ich die Änderung machen soll.
Kann jemand helfen?

class tx_skcalendar_monthview extends tx_skcalendar_htmlview {

	function tx_skcalendar_monthview($container,$conf) {
		// calls mothership
		
		$this->tx_skcalendar_htmlview($container,$conf);
	}

	function parseCalendar() {
		$month = intval(date('m',$this->offset));
		
		// register subparts
		$subparts = array(
			'MONTH_VIEW_ITEM',
			'MONTH_VIEW_DAYWRAP',
			'MONTH_VIEW_ROWWRAP',
			'MONTH_VIEW_CALENDARWRAP',
			'MONTH_VIEW_NAVIGATION',
			'MONTH_VIEW_WHOLEWRAP');
		$this->template->registerSubparts($subparts);
		
		if ($this->conf['general']['showlinks']) $this->makeLinks();
		if ($this->conf['general']['showfilters']) $this->makeFilters();
		
		// calculate offset
		$weekday = date('w',mktime(0,0,0,$month,1,$this->year));
		if ($weekday == 0) $weekday=7;
		$d=$weekday-(($weekday-1)*2);
		
		// amount weeks
		$days = date('t',mktime(0,0,0,$month,1,$this->year))-28;
		$days = $days+$weekday-1;// How many overhanging days?
		if ($days > 7) $count_weeks=6;
		elseif ($days == 0) $count_weeks=4;
		else $count_weeks = 5;
		
		for ($w=1; $w<=$count_weeks;$w++) {
			for ($i=1;$i<=7;$i++) {
				$temp['style'] = 'month_' . $this->calendarArray[$month][$d]['style'];
				$temp['name'] = $this->calendarArray[$month][$d]['d_name']['no'] . '&nbsp;' . $this->calendarArray[$month][$d]['d_name']['short'];
				if ($this->calendarArray[$month][$d]['d_ts']) $temp['timestamp'] = $this->calendarArray[$month][$d]['d_ts'];

				if ($this->calendarArray[$month][$d]['events']) {
					while (list(,$data) = each($this->calendarArray[$month][$d]['events'])) {
					if ($this->conf['month']['iconmode']) {
					$cat = $this->getCategory($data['category']);
					if (!$cat['icon']) $cat['icon'] = 'cat_fallback.gif';
					$linktext = '<img border=0 width=10 src="uploads/tx_skcalendar/'.  $cat['icon'] . '">';
					}
					else $linktext = $data['title'];
					$temp['linktext'] = $linktext;
					$this->template->setItem($data);
					$this->template->setTempData($temp);
					$this->template->getSubpart('MONTH_VIEW_ITEM');

					$content_day .= $this->template->parseTemplate();
					}
				}
				// Make my day
				$temp['wrapit_MONTH_VIEW_ITEM'] = $content_day;
				$this->template->setTempData($temp);
				$this->template->getSubpart('MONTH_VIEW_DAYWRAP');
				$content_row .= $this->template->parseTemplate();
				unset ($content_day);
				$d++;
			}

			// close row
			$temp['wrapit_MONTH_VIEW_DAYWRAP'] = $content_row;
			$this->template->setTempData($temp);
			$this->template->getSubpart('MONTH_VIEW_ROWWRAP');
			$content .= $this->template->parseTemplate();
			unset ($content_row);

		}
		
		$temp['date'] = $this->offset;
		$temp['wrapit_MONTH_VIEW_ROWWRAP'] = $content;
		$this->template->setTempData($temp);
		$this->template->getSubpart('MONTH_VIEW_CALENDARWRAP');
		$content = $this->template->parseTemplate();
		
		// get Navigation
		$this->template->setTempData($this->makeNavigation());
		$this->template->getSubpart('MONTH_VIEW_NAVIGATION');
		$temp['wrapit_MONTH_VIEW_NAVIGATION'] = $content . $this->template->parseTemplate();
		
		// wrap whole thing
		$this->template->setTempData($temp);
		$this->template->getSubpart('MONTH_VIEW_WHOLEWRAP');
		$this->content .= $this->template->parseTemplate();
	}

	function makeNavigation() {
		$offset = date('m',$this->offset);
		$next = $this->prepareTypolink();
		$back = $this->prepareTypolink();
		$nextyear = $this->prepareTypolink();
		$backyear = $this->prepareTypolink();
		
		$next['tx_skcalendar_pi1[offset]'] = mktime(0,0,0,$offset+1,1,$this->year);
		$back['tx_skcalendar_pi1[offset]'] = mktime(0,0,0,$offset-1,1,$this->year);
		$nextyear['tx_skcalendar_pi1[offset]'] = mktime(0,0,0,$offset,1,$this->year+1);
		$backyear['tx_skcalendar_pi1[offset]'] = mktime(0,0,0,$offset,1,$this->year-1);

		$navi['backlinkyear'] = '<a href="' . $GLOBALS["TSFE"]->cObj->getTypoLink_URL($GLOBALS["TSFE"]->id,$backyear) . '"> << ' . strftime("%Y",mktime(0,0,0,$offset,1,$this->year-1)) . '</a>';
		$navi['nextlinkyear'] = '<a href="' . $GLOBALS["TSFE"]->cObj->getTypoLink_URL($GLOBALS["TSFE"]->id,$nextyear) . '">' . strftime("%Y",mktime(0,0,0,$offset,1,$this->year+1)) . ' >></a>';

		$navi['backlink'] = '<a href="' . $GLOBALS["TSFE"]->cObj->getTypoLink_URL($GLOBALS["TSFE"]->id,$back) . '"> << ' . $this->pi_getLL('prev_month') . '</a>';
		$navi['nextlink'] = '<a href="' . $GLOBALS["TSFE"]->cObj->getTypoLink_URL($GLOBALS["TSFE"]->id,$next) . '">' . $this->pi_getLL('next_month') . ' >></a>';
		return $navi;
	}
}

if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/sk_calendar/pi1/class.tx_skcalendar_monthview.php"])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/sk_calendar/pi1/class.tx_skcalendar_monthview.php"]);
}
teddy86 ·

es gibt in deinem ganzen codeschnipsel keine mysql abfrage.. bei dieser sqlabfrage liegt aber der knackpunkt welche einträge angezeigt werden und welche eben nicht. leider kenne ich deine verwendete extension nicht -> daher keine ahnung wo du suchen musst. in deinem geposteten codeschnipsel stehts jedenfalls nicht

gruß teddy

vwenk ·

Besten Dank für Deinen Input.

Ist vielleicht Jemand da draussen, der den Kalender einsetzt und sich auskennt?
Wenn ja bitte meldet Euch bei mir.
Oder habe ich nur allein das genannte Problem?

Ich komme nicht weiter...

Danke und Gruss

Volker