Problem mit phpplanner: kein Event zum ersten Tag des Monats möglich

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Problem mit phpplanner: kein Event zum ersten Tag des Monats möglich

    Hallo ich habe hier ein Problem mit dem "phpplanner". Aktionen, die für den ersten Tag im Monat Juli eingetragen werden, werden dem 31 Juli zugeordnet. Die ganze Sache funktioniert auf andere Weise nicht wenn ich zum ersten des Monats August eine Aktion einfüge. Hier wird die Aktion gar nicht angezeigt. (zur Erklärung: eine Aktion wird dadurch angezeigt, dass nur das Datum und nicht das Datum als Link angezeigt ist.

    Zur erklärung der Timestamp wird richtig in die mysql tabelle gespeichert. Jedoch bei der Ausgabe muss der Fehler passieren.


    Hier der Code der Datei function.php (besonders relevant):

    function lang($str) {
    global $lang;
    $str = strtolower($str);

    if ( isset($lang[$str]) )
    return $lang[$str];
    else
    return $str;
    }
    function notice($str)
    {
    header("Location: notice.php?msg=". urlencode($str));
    die();
    }

    /* Idea by Missarh, sets a cookie right away */
    function set_cookie($name,$value,$expire=1234567,$path=NULL,$domain=NULL,$secure=0)
    {
    setcookie($name,$value,time()+$expire,$path,$domain,$secure);
    $_COOKIE[$name] = $value;
    }

    /* Idea by Missarh, deletes a cookie */
    function delete_cookie($name)
    {
    setcookie($name,"",time() - 3600);
    $_COOKIE[$name] = '';
    unset($_COOKIE[$name]);
    }

    function add_links($str)
    {

    $ret = " " . $str;
    $rpl_string = "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>";
    $ret = preg_replace("#([\n ])([a-z]+?)://([^\t <\n\r]+)#i", $rpl_string, $ret);

    $rpl_string = "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">\\2.\\3\\4</a>";
    $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^\t <\n\r]*)?)#i", $rpl_string, $ret);

    $rpl_string = "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>";
    $ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", $rpl_string, $ret);

    $ret = substr($ret, 1);

    return $ret;
    }
    function FormatOutput($str,$replaceLB=false,$removeHTML=true)
    {
    $str = trim($str);

    if ($removeHTML)
    {
    $str = htmlentities($str);
    }

    $str = add_links($str);

    $str = stripslashes($str);

    if ($replaceLB)
    {
    $str = nl2br($str);
    }

    return $str;
    }

    function ftime($s,$stamp=NULL) {
    return ucwords(strftime($s,$stamp));
    }

    function special_image($id=0,$align="middle") {
    global $config;
    if ($id != 0) {
    $pic = $config['colors'][$id][3];
    if (is_file("./images/". $pic))
    return '<img src="./images/'. $pic .'" height="16" width="16" border="0" alt="'. ucwords($config['colors'][$id][2]) .' event" align="$align">';
    else
    return "";
    }
    }



    function new_week($index)
    {
    global $current, $config;
    $week = date("W", mktime(0,0,0,$current['month'],1,$current['year']) ) + ($index/7);
    echo <<<WEEK

    </tr>
    <tr>
    <!-- NEW WEEK # {$week}-->
    <td valign="top" class="text" width="39" height="{$config['cell_height']}">{$week}</td>

    WEEK;

    }




    function wrap_event($stamp=NULL,$link=false,$content='')
    {
    global $config, $current;
    $width = round(($config['table_width']-38)/7,0);

    if ( !is_null($stamp) )
    {
    $stamp = mktime(0,0,0,$current['month'],$stamp-$current['first_day_of_month']+1,$current['year']);
    $content = '&nbsp;&nbsp;&nbsp;&nbsp;'. ftime("%d", $stamp ) . "<br>". $content;
    }

    if ( $link === true )
    {
    $content = '<a href="manage.php?stamp='. $stamp .'">'. $content .'</a>';
    } else {
    $content = "<span class=\"redtext\">".$content."</span>";
    }




    echo "<td height=\"{$config['cell_height']}\" width=\"200\" valign=\"top\">{$content}</td>";


    }





    function new_empty_event($x=NULL)
    {
    wrap_event($x,true);
    }

    function new_event($x,$ary)
    {

    $checkeinzelzimmer = 3;
    $checkdoppelzimmer = 1;
    $checkapartments = 1;

    $res = array();

    foreach ($ary as $y => $item)
    {
    $res[] = $item['einzelzimmer'];
    $res[] = $item['doppelzimmer'];
    $res[] = $item['apartments'];
    }

    if(($item['einzelzimmer'] >= $checkeinzelzimmer) OR ($item['doppelzimmer'] >= $checkdoppelzimmer) OR ($item['apartments'] >= $checkapartments ))
    {
    wrap_event($x,false);
    } else {
    wrap_event($x,true);
    }
    }


    ?>

    Und Schließlich der Code der Datei index.php:

    require_once("common.php");
    make_template_header();

    @$months .= sprintf("\t<option value=\"%s\">%s</option>\n"
    , mktime(0,0,0,12,1,$current['year']-1)
    , lang('last_year') ."..."
    );

    for ($i = 1; $i <= 12; $i++)
    $months .= sprintf("\t<option value=\"%s\"%s>%s</option>\n"
    , mktime(0,0,0,$i,1,$current['year'])
    , (date("n",mktime(0,0,0,$i,1,$current['year'])) == $current['month']) ? " selected" : ""
    , ftime("%B %Y", mktime(0,0,0,$i,1,$current['year']))
    );

    $months .= sprintf("\t<option value=\"%s\">%s</option>\n"
    , mktime(0,0,0,1,1,$current['year']+1)
    , lang('next_year') ."..."
    );


    make_header($config['name'].'<p></p>
    <form name="TopForm" action="'. basename($_SERVER['PHP_SELF']) .'" method="GET">
    <a href="index.php?view='. mktime(0,0,0,$current['month']-1,1,$current['year']) .'">&laquo;'. lang('previous') .'</a>
    <select name="view" onChange="TopForm.submit()">
    '. $months .'
    </select>
    <a href="index.php?view='. mktime(0,0,0,$current['month']+1,1,$current['year']) .'">'. lang('next') .'&raquo;</a><br>
    </form>');

    echo '<table width="'. $config["table_width"] .'" border="0" align="center" cellpadding="25" cellspacing="0" class="text">';
    echo "\n<tr>";
    echo "\n<td align=\"center\" class=\"weekday-names\">". lang('week') ."</td>";
    echo "\n<td align=\"center\" class=\"weekday-names\">". lang('sunday') ."</td>";
    echo "\n<td align=\"center\" class=\"weekday-names\">". lang('monday') ."</td>";
    echo "\n<td align=\"center\" class=\"weekday-names\">". lang('tuesday') ."</td>";
    echo "\n<td align=\"center\" class=\"weekday-names\">". lang('wednesday') ."</td>";
    echo "\n<td align=\"center\" class=\"weekday-names\">". lang('thursday') ."</td>";
    echo "\n<td align=\"center\" class=\"weekday-names\">". lang('friday') ."</td>";
    echo "\n<td align=\"center\" class=\"weekday-names\">". lang('saturday') ."</td>";


    $current['first_day_of_month'] = date("w", mktime(0,0,0,$current['month'],1,$current['year']));
    $current['number_of_rows'] = ceil(($current['days_in_month']+$current['first_day_of_month'])/7);


    $SQL = mysql_query("SELECT einzelzimmer, doppelzimmer, apartments, DAYOFMONTH(FROM_UNIXTIME(`date`-3000)) as `day` FROM freie_zimmer
    WHERE `date` >= ". mktime(0,0,0,$current['month'],1,$current['year']) ."
    AND `date` < ". mktime(0,0,0,$current['month'],$current['days_in_month'],$current['year']) ."") or die(mysql_error());

    $events = array();
    while ( $rs = mysql_fetch_assoc($SQL) )
    {
    $events[$rs['day']][] = $rs;
    }



    for ($x = 0; $x <= 42; $x++)
    {

    /* We've run out of days and rows, lets stop then */
    if ($x >= ($current['first_day_of_month']+$current['days_in_month']) && $x % 7 == 0 )
    {
    break;
    }

    /* If we've printed 7 days, lets change week */
    if ( $x % 7 == 0 )
    {
    new_week($x);
    }

    /* Display the first "empty" days of the month */
    if ( $x < $current['first_day_of_month'] )
    {
    wrap_event();
    }

    /* Display the last "empty" days of the month */
    elseif ( $x >= $current['first_day_of_month']+$current['days_in_month'] )
    {
    wrap_event();
    }

    /* Display the days of the month */
    else
    {
    if ( !isset($events[$x-$current['first_day_of_month']]) )
    {
    new_empty_event($x);
    } else {
    new_event($x,$events[$x-$current['first_day_of_month']]);
    }
    }



    }

    echo "</tr>";
    echo "</table>";



    make_end_html()
    ?>

  • #2
    warum nicht beim hersteller nachfragen?

    Kommentar


    • #3
      es gibt keine kontaktadresse des herstellers

      Leider leider

      Kommentar


      • #4
        Hmm?
        http://sourceforge.net/tracker/?grou...45&atid=492005

        Kommentar


        • #5
          hier irgendwo muss der fehler liegen

          $current['first_day_of_month'] = date("w", mktime(0,0,0,$current['month'],1,$current['year']));
          $current['number_of_rows'] = ceil(($current['days_in_month']+$current['first_day_of_month'])/7);


          $SQL = mysql_query("SELECT einzelzimmer, doppelzimmer, apartments, DAYOFMONTH(FROM_UNIXTIME(`date`-3000)) as `day` FROM freie_zimmer
          WHERE `date` >= ". mktime(0,0,0,$current['month'],1,$current['year']) ."
          AND `date` <= ". mktime(0,0,0,$current['month'],$current['days_in_month'],$current['year']) ."") or die(mysql_error());

          $events = array();
          while ( $rs = mysql_fetch_assoc($SQL) )
          {
          $events[$rs['day']][] = $rs;
          }



          for ($x = 0; $x <= 42; $x++)
          {

          /* We've run out of days and rows, lets stop then */
          if ($x >= ($current['first_day_of_month']+$current['days_in_month']) && $x % 7 == 0 )
          {
          break;
          }

          /* If we've printed 7 days, lets change week */
          if ( $x % 7 == 0 )
          {
          new_week($x);
          }

          /* Display the first "empty" days of the month */
          if ( $x < $current['first_day_of_month'] )
          {
          wrap_event();
          }

          /* Display the last "empty" days of the month */
          elseif ( $x >= $current['first_day_of_month']+$current['days_in_month'] )
          {
          wrap_event();
          }

          /* Display the days of the month */
          else
          {
          if ( !isset($events[$x-$current['first_day_of_month']]) )
          {
          new_empty_event($x);
          } else {
          new_event($x,$events[$x-$current['first_day_of_month']]);
          }
          }



          }
          PHP-Code:
              $current['first_day_of_month'] = date("w"mktime(0,0,0,$current['month'],1,$current['year'])); 

          Kommentar

          Lädt...
          X