WebsiteBaker Support (2.13.x) > Modules

ProCalendar Monatsübersicht

(1/1)

afischer:
Hallo, ich bastel immer mal wieder an was mit WebsiteBaker. Heute hab ich den ProCalendar ausprobiert, was mir fehlt und nicht gefunden habe, ist ein Droplet oder andere Möglichkeit eine Monatsübersicht dar zu stellen.

Wie ich mir das Vorstellen würde, hab ich als Anhang beigefügt.

ProCalendar Version: procalendar_v1_8_0
WB-Version: 2.13.5 r220

Ich weiss es ging mal mit den Vorgängerversionen?!?

afischer:
Ich benutze für das Modul folgendes droplet, es schmeisst ne fehlermeldung: [125] Call to undefined function each()

--- Code: ---//://:Show tiny calendar
//:usage: [[tiny_calendar?section_id=<xx>]]
global $wb, $database;
require_once(WB_PATH."/modules/procalendar/functions.php");

// --- config options; you may change these ---
// day names length; values > 3 = full name
$day_name_length = 2;
// first day of week; 0 = Sunday, 1 = Monday
$first_day       = 1;
// set locale to the value you need
// set to NULL to use the OS setting -> $locale = NULL;
$locale          = 'de_DE';

// --- do not change these! ---
$month_href = NULL;
$days = array();
if ( isset( $locale ) ) {
    // store old locale
    $oldlocale = setlocale(LC_TIME, NULL); #save current locale
    setlocale( LC_TIME, $locale );
}

// year and month defaults
if(!isset($year))  {$year  = date('Y', time()); }
if(!isset($month)) {$month = date('n', time()); }
if(isset($_GET['procal_next']) && $_GET['procal_next'] != "") {
    $showDate = explode("_",$_GET['procal_next']);
    $month = $showDate[0];
    $year = $showDate[1];
}
if(!isset($section_id)) {$section_id = 0 ; }
if(isset($kat)) {$katstring = "AND acttype =".$kat; }
$nextYear = ($month +1) > 12 ? $year+1 : $year;
$nextMonth = ($month +1) > 12 ? 1 : $month +1;
$prevYear = ($month -1) > 0 ? $year : $year-1;
$prevMonth = ($month -1) > 0 ? $month -1 : 12;
$pn = array("<&nbsp;&nbsp;&nbsp;" => $_SERVER['SCRIPT_NAME']."?procal_next=".$prevMonth."_".$prevYear, "&nbsp;&nbsp;&nbsp;>" => $_SERVER['SCRIPT_NAME']."?procal_next=".$nextMonth."_".$nextYear); // array for prev/next links;

$extrasql = '';
$page_id = 0;
$page_link ='';
$datestart = "$year-$month-1";
$dayend = cal_days_in_month(CAL_GREGORIAN, $month,$year);
$dateend = "$year-$month-".$dayend;
$calendar = '<script type="text/javascript">
function showDate(event, elem){
popContent = elem.innerHTML.repl ace(/display:.?none/ig,"display:block");
popupWindow = document.getElement ById("datePopup");
popupWindow.innerHT ML = popContent;
popupWindow.style.l eft = event.clientX +"px";
popupWindow.style.t op = event.clientY+ "px";
popupWindow.style.d isplay = "block";
return false;
};
function hideDate(){
  popupWindow = document.getElement ById("datePopup").style.display = "none";
}
</script>';
if ($section_id<>0) {
  $extrasql = " section_id = '".$section_id."' AND ";
  $sql = "SELECT page_id FROM ".TABLE_PREFIX."sections WHERE section_id = '".$section_id."'";
  $result = $database->query($sql);
  if ( $result->numRows() > 0 ) {
    while( $row = $result->fetchRow() ) {
      $page_id = $row['page_id'];
    }
  }
  if ($page_id <> 0) {
    $sql = "SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".$page_id."'";
    $result = $database->query($sql);
    if ( $result->numRows() > 0 ) {
      while( $row = $result->fetchRow() ) {
    $page_link = page_link($row['link']);
      }
    }
  }
}

$actions  = fillActionArray($datestart, $dateend, $section_id);
if (is_array($actions)){
    foreach($actions as $row){   
        // Build url like : pages/kalendar.php?year=1900&month=01&day=03&id=2&detail=1
        $ds = $row['date_start']." ".substr($row['time_start'],0,5);
        $page_url = $page_link.'?year='.(substr($ds,0,4)).'&month='.(substr($ds,5,2)).'&day='.(substr($ds,8,2)).'&id='.$row['id'].'&amp;detail=1';
      if ($month == (int)substr($row['date_end'],5,2)){
        $dateend = (int)substr($row['date_end'],8);
      } else $dateend = $dayend;
      if ($month == (int)substr($row['date_start'],5,2)){
        $day = (int)substr($row['date_start'],-2);
      } else $day = 1;   
      while($day <= $dateend) {
        if (array_key_exists($day, $days)){
          //preg_match("#(title='.*?)'#",$days[$day][2],$title);
          //$days[$day][2] = preg_replace("#title='.*?'#",$title[1]." &#10".$row['name']."'",$days[$day][2]);
          $days[$day][3] = preg_replace("#</span>#i",'<br><a href="'.$page_url.'">'.$row["name"].'</a></span>',$days[$day][3]);
        } else {
          $days[$day] = array( NULL, NULL, "<span onmouseover=\"showDate(event, this.nextSibling);\" onmouseout=\"hideDate();\" style='font-weight: bold; border: 1px solid #f00;'><a href='".$page_url."' title1='".$row['name']."'>".$day."</a></span>" );
          $days[$day][3] = '<span style="display:none"><a href="'.$page_url.'">'.$row["name"].'</a></span>';
        }
        $day++;
      }
    }
}
$first_of_month = gmmktime(0,0,0,$month,1,$year);
#remember that mktime will automatically correct if invalid dates are entered
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
# this provides a built in "rounding" feature to generate_calendar()

$day_names = array(); #generate all the day names according to the current locale
for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
   $day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

if ( isset( $oldlocale ) ) {
    // reset locale
    setlocale(LC_TIME, $oldlocale);
}

list($month, $year, $month_name, $weekday)
    = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title   = htmlentities(ucfirst($month_name)).'&nbsp;'.$year;  #note that some locales don't capitalize month and day names

#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span>&nbsp;';
if($n) $n = '&nbsp;<span class="calendar-next">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';
$calendar .= '<table width="168px" class="calendar">'."\n".
   '<caption class="calendar-month">'.$p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";

if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
   #if day_name_length is >3, the full name of the day will be printed
   foreach($day_names as $d)
      $calendar .= '<th abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
   $calendar .= "</tr>\n<tr>";
}

if($weekday > 0) $calendar .= '<td colspan="'.$weekday.'">&nbsp;</td>'; #initial 'empty' days
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
   if($weekday == 7){
      $weekday   = 0; #start a new week
      $calendar .= "</tr>\n<tr>";
   }
   if(isset($days[$day]) and is_array($days[$day])){
      @list($link, $classes, $content, $popup) = $days[$day];
      if(is_null($content))  $content  = $day;
      $calendar .= '<td align="center" '.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
         ($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).$popup.'</td>';
   }
   else $calendar .= "<td align=\"center\">$day</td>";
}
if($weekday != 7) $calendar .= '<td colspan="'.(7-$weekday).'">&nbsp;</td>'; #remaining "empty" days

return $calendar."</tr>\n</table>\n <span id=\"datePopup\" onmouseover=\"this.style.display = 'block';\" onmouseout=\"this.style.display = 'none';\" style=\"display:none;max-width:200px;padding:3px;padding-left:12px;position:fixed;z-index:99;border: 1px solid;background: #FFFFD4\"></span>[[short-url5?info=procal]]";
--- End code ---

afischer:
Hab es gefunden Recherche in einem anderen Forum:

Das hier :

--- Code: ---@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span>&nbsp;';
if($n) $n = '&nbsp;<span class="calendar-next">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';

gegen das hier ersetzen:
$p = '<span class="calendar-prev"><a href="'.$_SERVER['SCRIPT_NAME'].'?procal_next='.$prevMonth.'_'.$prevYear.'">&lt;&nbsp;&nbsp;&nbsp;</a>';
$n = '<span class="calendar-next"><a href="'.$_SERVER['SCRIPT_NAME'].'?procal_next='.$nextMonth.'_'.$nextYear.'">&nbsp;&nbsp;&nbsp;&gt;</a>';
--- End code ---

Damit geht es  ;D
Hab mal den Code als Code formatiert

hgs:
Hab es mal auf meiner Testseite nachbebaut und es funzt. (Y) 
Als Anhang hänge ich dir mal die "alten" Droplets von ProCal 1.38" mit dran.
Vielleicht hast du ja Lust und Zeit die zu fixen.
eventlist (wird mittleiweile vom Modul mitgeliefert und dann unter Droplets abgelegt) ist das einzige dass noch sauber funzt.

Navigation

[0] Message Index

Go to full version