Hilfe bei sortierung array_multisort nach Datum

Gesperrt
NightCaller
Beiträge: 30
Registriert: Sa 26. Jan 2008, 15:17
Kontaktdaten:

Hilfe bei sortierung array_multisort nach Datum

Beitrag von NightCaller »

Hallo Forum,

komme gerade echt nicht weiter. Meine Terminliste die ich mir zusammengebastelt habe funktioniert soweit gut. Ich möchte aber nach dem Startdatum sortieren und bekomme es nicht hin. bei der SQL bekomme ich es mit der ORDER nicht hin und versuche gerade über array_multisort, hier werde aber die Ausgaben durcheinander gewürfelt.

Ich hoffe mir kann jemand helfen.

Code: Alles auswählen

#set array to build up the due dates in array
	$dueDates = array(array());

	#loop records about the SQL_query
	while ($j < $db->num_rows())
	{
		$db->next_record();
		if ($db->f("idart") > $dueDates["idart"][$anz])
		{
			$anz++;
		}

		switch ($db->f("typeid")) {
			case 0: #Start due date
			$dueDates["startDate"][$anz] = $db->f("value");
			$dueDates["startYear"][$anz] = substr($db->f("value"),0,4);
			$dueDates["startMonth"][$anz] = substr($db->f("value"),5,2);
			$dueDates["startDay"][$anz] = substr($db->f("value"),8,2);
			$dueDates["idart"][$anz] = $db->f("idart");
			break;
			case 1: #Start time
			$dueDates["startTime"][$anz] = $db->f("value");
			$dueDates["startDate"][$anz] = $dueDates["startDate"][$anz]." ".$dueDates["startTime"][$anz];
			break;
			case 2: #End du date
			$dueDates["endDate"][$anz] = $db->f("value");
			$dueDates["endYear"][$anz] = substr($db->f("value"),0,4);
			$dueDates["endMonth"][$anz] = substr($db->f("value"),5,2);
			$dueDates["endDay"][$anz] = substr($db->f("value"),8,2);
			break;
			case 3: #End time
			$dueDates["endTime"][$anz] = $db->f("value");
			$dueDates["endDate"][$anz] = $dueDates["endDate"][$anz]." ".$dueDates["endTime"][$anz];
			break;
			case 4: #Location
			$dueDates["location"][$anz] = $db->f("value");
			break;
			case 6: // Title
			$dueDates["title"][$anz] = $db->f("value");
			break;
			case 7: #subtitle
			$dueDates["subTitle"][$anz] = $db->f("value");
			break;
		}
		$j++;
	}
	array_multisort (
	$dueDates["startDate"], SORT_ASC, SORT_STRING, $dueDates["endDate"], SORT_ASC, SORT_STRING,
	$dueDates["startYear"], $dueDates["startMonth"], $dueDates["startDay"], $dueDates["startTime"],
	$dueDates["endYear"], $dueDates["endMonth"], $dueDates["endDay"], $dueDates["endTime"],
	$dueDates["idart"], $dueDates["ort"], $dueDates["title"], $dueDates["subTitle"]);

	#Loop whole given resultSets
	for ($i=0; $i <= $anz; $i++)
	{
		#Only due Dates there are current or more
		if ( $dueDates["startDate"][$i] >= $curDate || $dueDates[$i]["endDate"] >= $curDate )
		{

			$navmod_link ="front_content.php?client=".$client."?=".$lang."&idcat=".$idcat."&idart=".$dueDates["idart"][$i]."";

			#Build output for Template Engine || Module Templates
			$tpl->set('d', 'startDate', $dueDates["startDate"][$i]);
			$tpl->set('d', 'startTime', $dueDates["startTime"][$i]);
			$tpl->set('d', 'title', $dueDates["title"][$i]);
			$tpl->set('d', 'subTitle', $dueDates["subTitle"][$i]);
			$tpl->set('d', 'location', $dueDates["location"][$i]);

			$tpl->set('d', 'details','<a href="'.$sess->url("$navmod_link").'">Details...</a>');
			
...usw.
Die Ausgabe in der ArtikelListenAnsicht ist nun komplett durcheinander.
NightCaller
Beiträge: 30
Registriert: Sa 26. Jan 2008, 15:17
Kontaktdaten:

Beitrag von NightCaller »

Hi all,

habs eben hinbekommen, hatte ne kleine Denkfehler.

In meiner array hatte ich falsche Daten.

Gruß
Gesperrt