Location: PHPKode > projects > Communication Kit > programs/live/home_2_inc.php
<?php
  class ck_home_2 {
    var $page_ref = '';
    var $ob = "" ; //order by
    var $ob_dir = "" ; //order by direction
    var $ob_next = "" ; //order by next
    var $update_actions = Array('dummy');
    var $display_actions = Array('edit','perms','perms_view','edit_fields','checkperms');
    function update_page($action){
    }
    function display_page($action){
      // read events for next seven days
      $today  = date("Y-m-d");
      $todate = date("Y-m-d",strtotime($today."+1 week"));
      $sql_diary = mysql_query("SELECT * FROM ".DIARY."
      WHERE entry_date >= '$today' AND entry_date <= '$todate'
      ORDER BY entry_date")
      or die (mysql_error());
      $no_of_entries = mysql_num_rows($sql_diary);
      // print events for next seven days
      if ($no_of_entries > 0){
        $last_day = "";
        $sql = mysql_query("SELECT page_id FROM ".PAGES."
        WHERE page_program = 'cal_month_inc.php' OR
        page_program = 'cal_week_inc.php'");
        $no_of_pages = mysql_numrows($sql);
        if ($no_of_pages>0) {
          $row = mysql_fetch_array($sql);
          foreach($row AS $key => $val){
            $$key = stripslashes($val);
          }
          $cal = $page_id;
        } else {
          $cal = 0;
        }
        print "<div class=right_image>";
        print "<table border=1 bordercolor=".$_SESSION['sess_color_4']." cellpadding=0 cellspacing=0 width=250px>";
        print "<tr><td><table border=0 cellpadding=2 cellspacing=0 width=100%>";
        print "<tr><td align=center colspan=2 class=event_title>Events during the next 7 days</td></tr>\n";
        while ($row = mysql_fetch_array($sql_diary)){
          foreach( $row AS $key => $val ){
            $$key = stripslashes( $val );
          }
          $html_entry_full = nl2br($entry_full);
          $html_entry_full = (eregi_replace(" www."," http://www.",$html_entry_full));
          $html_entry_full = (eregi_replace("(http://)(www.[_./a-z0-9-]+)","<a href='\\0' target = '_blank'>\\2</a>",$html_entry_full));
          if ($last_day <> date("d",strtotime($entry_date))){
            print "<tr><td class=events_header>";
            //          print date("l",strtotime($entry_date));
            print date("l",strtotime($entry_date));
            //          print "</td><td class=events_header><hr></td></tr>\n";
            print "</td><td class=events_header>";
            print date("jS F",strtotime($entry_date));
            print "</td></tr>\n";
            $last_day = date("d",strtotime($entry_date));
          }
          print "<tr><td class=event_title>";
          print ($entry_date_no) ? "" : date('g:ia',strtotime($entry_date));
          print "</td>";
          print "    <td class=event_title>$entry_title</td></tr>\n";
          print "<tr><td class=events></td><td class=events>$html_entry_full</td></tr>";
          if ($entry_contact>""){
            print "<tr><td class='events'>
            </td><td class='events' align='right'><a href=\"javascript:Help(560,460,'".$_SERVER['PHP_SELF']."?page_ref=$cal&pu=y&action=cdpu&diary_entry_id=$entry_id')\">More details....</a></td></tr>\n";
          }
        }
        print "</table></td></tr>\n";
        print "</table></div>";
      }
    }
  }
?>
Return current item: Communication Kit