WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 27.10.2019 15:43:47

shack
Member

Event Calendar Datumsanzeige Event List

Hallo,

im Modul Event Calendar habe ich "alle Veranstaltungen anzeigen" und als Datumsformat "Tag.Monat.Jahr" ausgewählt.

Es werden mir jetzt alle Termine mit Datum (zB: 24.12.2019) angezeigt, der Titel der Veranstaltung ist verlinkt, bei anklicken öffnet sich der Beschreibungstext. Gut so.

Ich habe auch das Droplet mittels [[Get_Event_List?max=8]] eingebunden. Hier werden mir die Termine aber als Y-M-D ausgegeben (zB: 2019-12-24). Auch wird der Titel der Veranstaltung nebst gesamten Beschreibungstext angegeben.

Wie kann ich erreichen, dass

das Datum im Format dd.mm.yyyy ausgegeben wird?

lediglich der Titel der Veranstaltung und dieser zum Beschreibungstext verlinkt ausgegeben wird?

Danke und Gruß,
Shack.

Offline

#2 27.10.2019 16:28:33

florian
Administrator

Re: Event Calendar Datumsanzeige Event List

Das müsste im Droplet geändert werden, leider sagt mir das aber gerade nichts... kannst Du den volständigen Dropletcode hier mal posten?


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

#3 29.10.2019 14:35:33

shack
Member

Re: Event Calendar Datumsanzeige Event List

Hallo,

der Code des Droplets ist:

// Get_Events_x
global $database, $wb;
// Show how many items, defaults to 10?
if ( !isset($max) ){    $max = 10; }
// Fetch the items
$mod_query = $database->query(
"SELECT * FROM ".TABLE_PREFIX."mod_event_dates ".
"WHERE section_id='21' AND `date` >= CURRENT_DATE ORDER BY date DESC ".
"LIMIT ".$max);
while ( $row = $mod_query->fetchRow()){
$mod_list .= '<p><b>'.$row["date"].'</b>: '.$row["event_desc"].'<br />'
.$row["event_longdesc"].'</p>';
}
return $mod_list;

Der Code des Moduls (view.php) - welcher nach meinen bescheidenen Kenntnissen für die Ausgabe der Termine des Moduls verantwortlich sein dürfte und welcher das Datum "korrekt" (also DD.MM.YYYY) ausgibt - lautet:

<?php


// prevent this file from being accessed directly
if(!defined('WB_PATH')) die(header('Location: index.php'));

// check if module language file exists for the language set by the user (e.g. DE, EN)
if(!file_exists(WB_PATH .'/modules/event/languages/'.LANGUAGE .'.php')) {
	// no module language file exists for the language set by the user, include default module language file EN.php
	require WB_PATH .'/modules/event/languages/EN.php';
} else {
	// a module language file exists for the language defined by the user, load it
	require WB_PATH .'/modules/event/languages/'.LANGUAGE .'.php';
}



// Get settings
$query_content = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_event_settings` WHERE `section_id` = '$section_id'");
if($query_content->numRows() > 0) {
	$fetch_content = $query_content->fetchRow();
	$WB_PATH = WB_PATH;
	$WB_URL = WB_URL;
	$evheader = stripslashes($fetch_content['evheader']);
	$evfooter = stripslashes($fetch_content['evfooter']);
   	$todayevent = stripslashes($fetch_content['todayevent']);
  	$monthevent = stripslashes($fetch_content['monthevent']);
	$event_msg = stripslashes($fetch_content['event_msg']);
	$noeventsmsg = stripslashes($fetch_content['noevents_msg']);
	$showalldata = stripslashes($fetch_content['showalldata']);
}

if (isset($_GET['eventdate'])) {
	$eventdate = $_GET['eventdate'];
        
}

if (isset($_GET['monthno'])) {
	$monthno = $_GET['monthno'];
} else {
	$monthno=date('n');
}

if (isset($_GET['year'])) {
	$year = $_GET['year'];
} else {
	$year = date('Y');
}

if (isset($_GET['view'])) {
	$view = $_GET['view'];
} else {
	$view = 0;        
}

if (isset($_GET['dview'])) { 
	$date_view = $_GET['dview'];
} else {
	$date_view = $fetch_content['date_view'];
}

$monthfulltext = ($month_name[$monthno]);

$day_in_mth = date('t', mktime(0, 0, 0, (int) $monthno, 1, (int) $year)) ;

$today = date("Y-m-j");

$todayyearly = date("2000-m-j");

$TOTAL_Event = 0 ;

if ( $evheader <> "" ) {
	echo $evheader;
    }
?>

<script type="text/javascript">

    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
</script>

<!-- Display events from today -->
<?php if ($todayevent == 1 ){ ?>
	<table border="0" cellpadding="0" cellspacing="0" width="98%" class="eventborder">
            <tr>
		<td class="tdeventheading">

                <?php	echo $MOD_EVENT['TODAYEVENTS']; ?>&nbsp;
                <?php   if ($date_view == 0) {
                            echo date('Y') . ' ' . $month_name[date('n')] . ' ' . date('d');
			} elseif ($date_view == 1) {
                            echo date('d') . '. ' . $month_name[date('n')] . ' ' . date('Y');
			} elseif ($date_view == 2) {
                            echo $month_name[date('n')] . ' ' . date('d') . ' ' . date('Y');
			} elseif ($date_view == 3) {
                            echo $month_name[date('n')] . ' ' . date('d');
			} elseif ($date_view == 4) {
                            echo date('d') . '. ' . $month_name[date('n')];
			}
		?>
		</td>
            </tr>
            
	<?php
	$query_dates = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_event_dates` WHERE `section_id` = '$section_id' && (`date` = '$today' or `date` = '$todayyearly')");
	if ($query_dates->numRows() > 0) {
            while( $result = $query_dates->fetchRow() ) {
	?>
	
            <tr>
		<td class="tdevent">

		<?php echo '<b>' . $result['event_desc'] . '</b><br />';
			$content=$result['event_longdesc'];
			$wb->preprocess($content);
			echo $content;
			$url1=$_SERVER['SERVER_NAME'];
			$url2=parse_url($result['evweb_url']);
                        
			if (($url1==$url2) or ((strpos($result['evweb_url'], 'http://') === false) and (strpos($result['evweb_url'], 'https://') === false))) {
                            $target='_parent';
			} else {
                            $target='_blank';
			}

                        if (!$result['evweb_url'] == "") { ?>
                            <a href="<?php echo $result['evweb_url']; ?>" target="<?php echo"$target";?>"><?php echo $result['name_link']; ?></a>
                        <?php 	}  ?>

		</td>
            </tr>
		<?php 	}
	} else { ?>

            <tr>
		<td class="tdevent"><?php echo $event_msg; ?></td>
            </tr>
		<?php 
		} ?>
	</table>
    <?php } ?>

<!-- Display Month events -->
<?php if (($monthevent == 1 )or($monthevent == 2 )){ ?>
    <table border="0" cellpadding="0" cellspacing="0" width="98%">
        <tr>
            <td class="eventheading" width="5%">
            <?php
            $monthchange = (int) $monthno-1; (int) $yearchange=$year;
            if ($monthchange==0) {
                $monthchange=12;
		$yearchange=$year-1;
            } else {
		$yearchange=$year;
		}
            ?>
            <a href="<?php echo '?monthno=' . $monthchange . '&amp;year=' . $yearchange; ?>"><img src="<?php echo $WB_URL; ?>/modules/event/images/leftarrow.gif" border="0" alt="<?php echo date("M", mktime(0, 0, 0, $monthchange, 1, $yearchange))." ".$yearchange; ?>" title="<?php echo date("M", mktime(0, 0, 0, $monthchange, 1, $yearchange))." ".$yearchange; ?>" /></a>
            </td>
                
            <td class="eventheading" width="90%">
            <a href="<?php echo '?'; ?>"><?php echo $MOD_EVENT['TODAY']; ?></a>
            </td>
                
            <td class="eventheading" width="5%">
            <?php
                $monthchange = (int) $monthno + 1;
                if ($monthchange==13) {
                    $monthchange=1;
                    $yearchange=$year+1;
                } else {
                    $yearchange=$year;
		}
		?>
		<a href="<?php echo '?monthno=' . $monthchange . '&amp;year=' . $yearchange; ?>"><img src="<?php echo $WB_URL; ?>/modules/event/images/rightarrow.gif" border="0" alt="<?php echo date("M", mktime(0, 0, 0, $monthchange, 1, $yearchange))." ".$yearchange; ?>" title="<?php echo date("M", mktime(0, 0, 0, $monthchange, 1, $yearchange))." ".$yearchange; ?>" /></a>
            </td>
            </tr>
	</table>

	<table border="0" cellpadding="0" cellspacing="0" width="98%"  class="eventborder">
            <tr>
		<td class="mteventheading" width="10%">
		<?php echo $TEXT['DATE']; ?>
		</td>

                <td class="mteventheading" width="80%">
		<?php echo $MOD_EVENT['EVENT']; ?>
		<?php
                    if ( $date_view == 0 ) {
			echo $year . ' ' . $monthfulltext;
			} else {
			echo $monthfulltext . ' ' . $year;
			}
		?>
		</td>
                
		<td class="mteventheading" width="10%">
		<?php echo $MOD_EVENT['INFO']; ?>
		</td>
            </tr>
            
            <tr>
                <td colspan="3">
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
		<?php
                    $day_of_wk = date('w', mktime(0, 0, 0, (int) $monthno, 1, (int) $year));
                    for ($date_of_mth = 1; $date_of_mth <= $day_in_mth; $date_of_mth++) {
                    if ($day_of_wk = 0){
                    for ($i=0; $i<$day_of_wk; $i++) {
		?>
            <tr>
                <?php
		}
                    }
		$date_no = date("j", mktime(0, 0, 0, (int) $monthno, $date_of_mth, (int) $year));
		$day_of_wk = date("w", mktime(0, 0, 0, (int) $monthno, $date_of_mth, (int) $year));
		$currentdate = date("Y-m-j", mktime(0, 0, 0, (int) $monthno, $date_of_mth, (int) $year) );
		$currentdateyearly = date("2000-m-j", mktime(0, 0, 0, (int) $monthno, $date_of_mth, (int) $year) );
		$query_dates = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_event_dates` WHERE `section_id` = '$section_id' && (`date` = '$currentdate' or `date` = '$currentdateyearly' )");
		$event  = $query_dates->numRows();
		if (!isset($MY_Event)){
                    $MY_Event = '';
                    }
		if ( $date_no ==  date('j') &&  $monthno == date('n') ) {
                    if ($event > 0 ){
                    $TOTAL_Event = (int) $MY_Event + $event ;
                    $alt = "";
                    $altdate = "";
                    $evweb_url = "";
		while ($row = $query_dates->fetchRow()) {
                    $alt2date=$row['date'];
                    list($a2year, $a2month, $a2day) = array_pad(preg_split('#[/.-]#', $alt2date, 3), 3, null);
                    $ydash="-";
                    $ydot=".";
                    
/*		if ($a2year=="2000"){
                    $a2year="";
                    $alt2date=substr($alt2date,5,5);
                    $ydash="";
                    $ydot="";
                    }
*/
                if ($date_view == 1) {
                    $altdate=$a2day . '.' . $a2month . $ydot . $a2year;
                    } elseif ($date_view == 2) {
                    $altdate=$a2month . '-' . $a2day . $ydash . $a2year;
                    } elseif ($date_view == 3) {
                    $altdate=$a2month . '-'.$a2day;
                    } elseif ($date_view == 4) {
                    $altdate=$a2day . '.' . $a2month . '.';
                    } else {
                    $altdate=$alt2date;
                    }
                    
                    $alt.="<b>".$row['event_desc']."</b><br />";
                    $content="";
                    
                    if($monthevent == 2 ){
                        $content=$row['event_longdesc'];
                        $wb->preprocess($content);
                        $alt=$alt.$content."<br /><br />";
                        }
                    $url1=$_SERVER['SERVER_NAME'];
                    $url2=parse_url($row['evweb_url']);
                    if (($url1==$url2) or ((strpos($row['evweb_url'], 'http://') === false) and (strpos($row['evweb_url'], 'https://') === false))) {
			$target='_parent';
                    } else {
			$target='_blank';
			}

                    $evweb_url.="<a href=\"".$row['evweb_url']."\" target=\"$target\">".$row['name_link']."</a><br />";
                    } // end while
                    ?>
                <tr>
                    <td class="mtevent" width="15%" align="left">
                    <?php echo $altdate; ?>
                    </td>
                    <td class="mtevent">
                    <?php echo $alt; ?>
                    </td>
                    <?php
                    if (!$evweb_url == "") { ?>
                    <td class="mtevent" width="15%" align="right">
                    <?php echo $evweb_url; ?>
                    </td>
                    <?php	}
                    ?>
                </tr>
		<?php
		} 
		} elseif ($event > 0 ) {
                    $TOTAL_Event = (int) $MY_Event + $event ;
                    $alt = "";
                    $altdate = "";
                    $evweb_url = "";
                    
                while ($row = $query_dates->fetchRow()) {
                    $alt2date=$row['date'];
                    list($a2year, $a2month, $a2day) = preg_split('#[/.-]#', $alt2date);
                    $ydash="-";
                    $ydot=".";

                if ($a2year=="2000"){
                    $a2year="";
                    $alt2date=substr($alt2date,5,5);
                    $ydash="";
                    $ydot="";
                    }
		if ($date_view == 1 ) {
                    $altdate=$a2day . '.' . $a2month.$ydot.$a2year;
                    } elseif ($date_view == 2 ) {
                    $altdate=$a2month . '-' . $a2day.$ydash.$a2year;
                    } elseif ($date_view == 3) {
                    $altdate=$a2month.'-'.$a2day;
                    } elseif ($date_view == 4) {
                    $altdate=$a2day.'.'.$a2month . '.';
                    } else {
                    $altdate=$alt2date;
                    }
                    $url1=$_SERVER['SERVER_NAME'];
                    $url2=parse_url($row['evweb_url']);
                    if (($url1==$url2) or ((strpos($row['evweb_url'], 'http://') === false) and (strpos($row['evweb_url'], 'https://') === false))) {
                    $target='_parent';
                    } else {
                    $target='_blank';
                    }
                    $alt.="<b>".$row['event_desc']."</b><br />";
                    if($monthevent == 2 ){
                    $content=$row['event_longdesc'];
                    $wb->preprocess($content);
                    $alt=$alt.$content."<br /><br />";
                    }
                    $evweb_url.="<a href=\"".$row['evweb_url']."\" target=\"$target\">".$row['name_link']."</a><br />";
		} // end while
		?>
                
		<tr>
                    <td class="mtevent" width="15%" align="left">
                    <?php echo $altdate; ?>
                    </td>
                    <td class="mtevent">
                    <?php echo $alt; ?>
                    </td>
                    <?php
                if (!$evweb_url == "") { ?>
                    <td class="mtevent" width="15%" align="right">
                    <?php echo $evweb_url; ?>
                    </td>
                    <?php
                    }
                    ?>
		</tr>
		<?php
		}
                    }
		if ($TOTAL_Event < 1 ) {?>
		<tr>
                    <td colspan="3" class="mtevent">
                    <?php echo $noeventsmsg; ?>
                    </td>
		</tr>
                    <?php
		} ?>
		
                </table>
			</td>
		</tr>
	</table>
<?php } ?>

<!-- Display all events -->

<?php if ($showalldata == 1 ){	?>
	<table border="0" cellpadding="0" cellspacing="0" width="98%" class="eventborder">
		<tr>
			<td class="alleventheading">
				<?php echo  $MOD_EVENT['LISTINGALLEVENTS']; ?>
			</td>
		</tr>
		<tr>
			<td class="allevent">	
				<?php
				$query_dates = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_event_dates` WHERE `section_id` = '$section_id' order by date");
				$check = $query_dates->numRows();
				if ($check > 0) {
				    echo '<ul>';
				    while($result = $query_dates->fetchRow()) {
                                                $alt2date=$result['date'];
                                                list($a2year, $a2month, $a2day) = array_pad(preg_split('#[/.-]#', $alt2date, 3), 3, null);
						$ydash="-";
						$ydot=".";
						if ($a2year=="2000"){
							$a2year="";
							$alt2date=substr($alt2date,5,5);
							$ydash="";
							$ydot="";
						}
						if ($date_view == 1 ) {
							$altdate=$a2day.'.'.$a2month.$ydot.$a2year;
						} elseif ($date_view == 2 ) {
							$altdate=$a2month.'-'.$a2day.$ydash.$a2year;
						} elseif ($date_view == 3) {
							$altdate=$a2month.'-'.$a2day;
						} elseif ($date_view == 4) {
							$altdate=$a2day.'.'.$a2month . '.';
						} else {
							$altdate=$alt2date;
						}
						?>
						<li>
						<?php if (($monthevent == 1 )or($monthevent == 2 )){ ?>
							<a href="?monthno=<?php echo ltrim($a2month,0);
							if(($a2year=="")) {
								if ($a2month<date('m')){
									$nextyear=date('Y')+1;
								} else {
									$nextyear=date('Y');
								}
								echo "&amp;year=".$nextyear;
							} else {
								echo "&amp;year=".$a2year;
							}
							?>"><?php
							
							$divtxt = '"ev'.$result['event_id'].'"';
							echo $altdate; ?></a>&nbsp;&nbsp;&nbsp;<?php echo "<a href='#' onclick='toggle_visibility(".$divtxt.");'>".$result['event_desc']."</a>";
							echo "<div class='desc' id='ev".$result['event_id']."' style='display:none;'><p>".$result['event_longdesc']."</p></div>";
						} else {
							$divtxt = '"ev'.$result['event_id'].'"';
							echo $altdate; ?></a>&nbsp;&nbsp;&nbsp;<?php echo "<a href='#' onclick='toggle_visibility(".$divtxt.")'>".$result['event_desc']."</a>";
							echo "<div class='desc' id='ev".$result['event_id']."' style='display:none;'><br/>".$result['event_longdesc']."</div>";
						}
						?>
						</li>
					<?php
				    }
				    echo '</ul>';
				} else {
					echo '&nbsp;';
				} ?>
			</td>
		</tr>
	</table>
<?php } ?>

</center>

<?php 
if ( $evfooter <> "" ) {
	echo $evfooter;
}

?>

Offline

#4 29.10.2019 15:26:36

florian
Administrator

Re: Event Calendar Datumsanzeige Event List

Wie kann ich erreichen, dass das Datum im Format dd.mm.yyyy ausgegeben wird?

Ändere Zeile

$mod_list .= '<p><b>'.$row["date"].'</b>: '.$row["event_desc"].'<br />'

zu

$gerDateArr=explode('-',$row["date"]);
$mod_list .= '<p><b>'.$gerDateArr[2].'.'.$gerDateArr[1].'.'.$gerDateArr[0].'</b>: '.$row["event_desc"].'<br />'

lediglich der Titel der Veranstaltung und dieser zum Beschreibungstext verlinkt ausgegeben wird?

Den Beschreibungstext wegzulassen, ist kein Problem, dazu müsste im Droplet nur

.'<br />'
.$row["event_longdesc"].'</p>';

durch

.</p>';

ersetzt werden. Es ist aber nicht möglich, auf den Beschreibungstext zu verlinken, da das Modul keine Detailseiten generiert, sondern das alles in einer Liste darstellt und der Beschreibungstext immer erst auf Klick eingeblendet wird.
Du könntest die Detailinfos als Tooltip anzeigen. Implementierung von diesem Stackoverflow-Tipp ins Droplet etwa so:

// Get_Events_x
$mod_list = '<style>.eventry{position:relative}.tooltip{width:400px;height:300px;padding:20px;background-color:#fff;border:1px solid #ccc;overflow:hidden;box-shadow:0 0 3px rgba(0,0,0,.3);-webkit-box-shadow:0 0 3px rgba(0,0,0,.3);border-radius:3px;-webkit-border-radius:3px;position:absolute;top:5px;left:50px;display:none}.tooltip{z-index:100}.link{display:block;}.link:hover+.tooltip{display:block}.tooltip:hover{display:block}</style>';
global $database, $wb;
// Show how many items, defaults to 10?
if ( !isset($max) ){    $max = 10; }
// Fetch the items
$mod_query = $database->query(
"SELECT * FROM ".TABLE_PREFIX."mod_event_dates ".
"WHERE section_id='21' AND `date` >= CURRENT_DATE ORDER BY date DESC ".
"LIMIT ".$max);
while ( $row = $mod_query->fetchRow()){
$gerDateArr=explode('-',$row["date"]);
$mod_list .= '<div class="eventry"><a href="#" class="link"><b>'.$gerDateArr[2].'.'.$gerDateArr[1].'.'.$gerDateArr[0].': '.$row["event_desc"].'</b></a>';
$mod_list .= '<div class="tooltip">'.$row['event_longdesc'].'</div></div>';
}
return $mod_list;

Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

Liked by:

shack

#5 03.11.2019 14:20:46

shack
Member

Re: Event Calendar Datumsanzeige Event List

Top Unterstützung! Danke!

Offline

Board footer

up