Reply
payed work (admin panel for a php calendar)
Old 09-03-2005, 08:29 AM payed work (admin panel for a php calendar)
Experienced Talker

Posts: 31
I need an admin panel for a calendar script that uses only 1 file.
The admin panel I need is to add/remove/edit the events of the calendar.
The following is the code of the calendar script
I pay 20 dollars via paypal the 1 who makes it.
Thanks


PHP Code:
<?php
    
    
    
/////////////////////////////////////////////
    //Load the language into usable variables
    //

    //darussol: TRANSLATION (18 May 2004)
    //        : Fill in the names of the days/months in variables
    //e-man   : LOAD TRANSLATION FILE INTO VARIABLES (from darussol)(19 May 2004)
    //        : Put the days/months names from language file into a array    

    
$language_file  "/home/sancarlo/public_html/calendario/calendar." $calendar_language;        //Language file into variable
    
$fd             fopen$language_file"r" );             //Open the language file
    
$fd             fread$fdfilesize$language_file ) ); //Read the opened file
    
$language_array explode"\n" $fd );                    //Put file info into array

    
$dayname   array_slice($language_array,0,7); //The names of the days

    
$monthname array_slice($language_array,7);   //The rest of the language file are the monthnames
    //
    /////////////////////////////////////////////


    /////////////////////////////////////////////
    //Use the date to build up the calendar. From the Query_string or the current date
    //    
    
if( isset( $_GET['date'] ) )
        list(
$month,$year) = explode("-",$_GET['date']);
    else
    {
        
$month date("m");
        
$year  date("Y");
    }
    
//
    /////////////////////////////////////////////

    
$date_string mktime(0,0,0,$month,1,$year); //The date string we need for some info... saves space ^_^

    
$day_start date("w",$date_string);  //The number of the 1st day of the week

    /////////////////////////////////////////////
    //Filter the current $_GET['date'] from the QUERY_STRING
    //
    
$QUERY_STRING ereg_replace("&date=".$month."-".$year,"",$_SERVER['QUERY_STRING']);
    
//
    /////////////////////////////////////////////
    

    /////////////////////////////////////////////
    //Calculate the previous/next month/year
    //
    
if( $month 12 )
    {
        
$next_month $month+1;
        
$next_date $next_month."-".$year;
    }
    else
    {
        
$next_year $year+1;
        
$next_date "1-".$next_year;
        
$next_month 1;
    }
    if( 
$month )
    {
        
$previous_month $month-1;
        
$next_month    $month+1;
        
$previous_date $previous_month."-".$year;
    }
    else
    {
        
$previous_year $year-1;
        
$previous_date "12-".$previous_year;
        
$previous_month 12;
    }
    
//
    /////////////////////////////////////////////

    // darussol: DEFINITION OF THETRANSLATED MONTH+YEAR TO BE USED IN THE TABLE AND INFO-TITLES (18 May 2004)
    // e-man   : USING THE VALUES OF THE PREVIOUS AND NEXT MONTH FOR THE TITLE DAY (19 May 2004);
    
$table_caption_prev $monthname[$previous_month-1] . " " $year// previous
    
$table_caption      $monthname[date("n",$date_string)-1] . " " $year// current
  
if ($next_month == 13){
    
$next_month 1;
    
$year++;
  }
    
$table_caption_foll $monthname[$next_month-1] . " " $year;   // following
    
    /////////////////////////////////////////////
    //Print the calendar css code
    //
  
echo "
        <style type=\"text/css\">
            a.cal_head
            {
                color: " 
$head_link_color ";
            }
            a.cal_head:hover
            {
                text-decoration: none;
            }
            .cal_head
            {
                background-color: " 
$head_background_color ";
                color:            " 
$head_font_color ";
                font-family:      " 
$font_family ";
                font-size:        " 
$head_font_size ";
                font-weight:      " 
$head_font_weight ";
                font-style:       " 
$head_font_style ";
            }
            .cal_days /*darussol*/
            {
                background-color: " 
$days_head_background_color ";
                color:            " 
$days_head_font_color ";
                font-family:      " 
$font_family ";
                font-size:        " 
$days_head_font_size ";
                font-weight:      " 
$days_head_font_weight ";
                font-style:       " 
$days_head_font_style ";
            }
            .cal_content
            {
                background-color: " 
$content_background_color ";
                color:            " 
$content_font_color ";
                font-family:      " 
$font_family ";
                font-size:        " 
$content_font_size ";
                font-weight:      " 
$content_font_weight ";
                font-style:       " 
$content_font_style ";
            }
            .cal_today
            {
                background-color: " 
$today_background_color ";
                color:            " 
$today_font_color ";
                font-family:      " 
$font_family ";
                font-size:        " 
$today_font_size ";
                font-weight:      " 
$today_font_weight ";
                font-style:       " 
$today_font_style ";
            }
            .cal_event, a.cal_event /* e-man 17-06-04 */
            {
                background-color: " 
$event_background_color ";
                color:            " 
$event_font_color ";
                font-family:      " 
$font_family ";
                font-size:        " 
$event_font_size ";
                font-weight:      " 
$event_font_weight ";
                font-style:       " 
$event_font_style ";
            }
        </style>
  "
;
    
//
    /////////////////////////////////////////////
    

    /////////////////////////////////////////////
    //show events in popup?
    //
    
if (isset ($_GET['show_event'])){
    list (
$year$month$day) = explode ("-"$_GET['event_date']);
    
$query "
      SELECT *
      FROM " 
$event_table "
      WHERE EventYear  = '" 
$year "'
      AND   EventMonth = '" 
$month "'
      AND   EventDay   = '" 
$day "'
      ORDER BY EventTime ASC
    "
;

    
/* connect to the database */
    
$database_connection mysql_connect ($server$username$password);
    
mysql_select_db ($database$database_connection);
    
$result mysql_query ($query) or die(mysql_error());

    
/* initize the variabele color_alternated (boolean) */
    
$color_alternated false;

    
/* header of the table */
    
echo "<table width=\"100%\" border=\"" $table_border "\" cellpadding=\"" $table_cellpadding "\" cellspacing=\"" $table_cellspacing "\">";

    
$date_string mktime(0,0,0,$month,$day,$year);
    
$month sprintf("%01d",$month);

    echo 
"<tr><td align=\"center\" class=\"cal_head\" colspan=\"2\">".$day." " $monthname[$month-1] . " ".$year."</td></tr>";

    
/* loop through the results via a mysql_fetch_assoc () */
    
while ($record mysql_fetch_assoc ($result)){
      if (
$color_alternated){
        
$color_alternated false;
        
$background_color_row $event_background_color;
      }
      else{
        
$color_alternated true;
        
$background_color_row $event_background_color2;
      }
      echo 
"<tr class=\"cal_event\">
              
              <td style=\"background-color:"
.$background_color_row."\">" nl2br($record['Event']) . "</td>
            </tr>"
;
    }
    
/* close the table */
    
echo "</table>";

    
/* bring an exit so the script will terminate*/
    
exit;
    }
    
//
    /////////////////////////////////////////////
    
    /////////////////////////////////////////////
    //Print the calendar table header
    //
    
echo "
        <script language=\"javascript\">
      function open_event(date_stamp){
        window.open(\"" 
$calendar_script "?show_event=true&event_date=\" + date_stamp, \"calendar_popup\",\"height=" $event_popup_height ",width=".$event_popup_width."\");
      }
        </script>
        <table border=\"" 
$table_border "\" cellpadding=\"" $table_cellpadding "\" cellspacing=\"" $table_cellspacing "\" style=\"height:" $table_height "\" width=\"" $table_width "\">
            <tr>
                <td align=\"center\" class=\"cal_head\"><a class=\"cal_head\" href=\"" 
$_SERVER['PHP_SELF'] . "?" $QUERY_STRING "&date=" .
                
$previous_date "\" title=\"" $table_caption_prev "\">&laquo;</a></td>
                <td align=\"center\" class=\"cal_head\" colspan=\"5\">" 
$table_caption "</td>
                <td align=\"center\" class=\"cal_head\"><a class=\"cal_head\" href=\"" 
$_SERVER['PHP_SELF'] . "?" $QUERY_STRING "&date=" .
                
$next_date "\" title=\"" $table_caption_foll "\">&raquo;</a></td>
            </tr>
            <tr>
                <td class=\"cal_days\">"
.$dayname[0]."</td>
                <td class=\"cal_days\">"
.$dayname[1]."</td>
                <td class=\"cal_days\">"
.$dayname[2]."</td>
                <td class=\"cal_days\">"
.$dayname[3]."</td>
                <td class=\"cal_days\">"
.$dayname[4]."</td>
                <td class=\"cal_days\">"
.$dayname[5]."</td>
                <td class=\"cal_days\">"
.$dayname[6]."</td>
            </tr><tr>
            "
;
    
//
    /////////////////////////////////////////////
    
    /////////////////////////////////////////////
    //The empty columns before the 1st day of the week
    //
    
for( $i $i $day_start$i++ )
    {
        echo 
"<td class=\"cal_content\">&nbsp;</td>";
    }
    
//
    /////////////////////////////////////////////
    
    
$current_position $day_start//The current (column) position of the current day from the loop
    
    
$total_days_in_month date("t",$date_string); //The total days in the month for the end of the loop

    /////////////////////////////////////////////
    //Retrieve events for the current month + year
    //e-man : added 07 June 04
  
if ($events_from_database)
  {
    
$database_connection mysql_connect ($server$username$password);
    
mysql_select_db ($database$database_connection);
    
$result mysql_query("
      SELECT *
      FROM " 
$event_table "
      WHERE
        EventYear = '" 
$year "'
      AND
        EventMonth = '" 
$month "'
    "
);
    while (
$record mysql_fetch_assoc($result)){
      
$event[$record['EventDay']] = $record;
    }
  }
    
//
    /////////////////////////////////////////////

    /////////////////////////////////////////////
    //Loop all the days from the month
    //
    
for( $i 1$i <= $total_days_in_month $i++)
    {
        
$class "cal_content";
        
        if( 
$i == date("j") && $month == date("n") && $year == date("Y") )
            
$class "cal_today";
        
        
$current_position++;

    
/* is there any event on this day? Yes, create a link. No clear the (previous) string */
        
$link_start "";
        
$link_end   "";


    
/* if there is an event do */
        
if( isset($event[$i]) )
    {
      
$link_start "<a href=\"java script:;\" class=\"cal_event\" onclick=\"java script: open_event('".$year."-".$month."-".$i."');\">";
      
$link_end   "</a>";
      
$class      "cal_event";
    }

    
/* for the event filter */
    /* e-man : added 07 June 04 */
    
$date_stamp $year."-".$month."-".sprintf"%02d",$i);
    
        echo 
"<td align=\"center\" class=\"" $class "\">" $link_start $i $link_end "</td>";
        if( 
$current_position == )
        {
            echo 
"</tr><tr>\n";
            
$current_position 0;
        }
    }
    
//
    /////////////////////////////////////////////
    
    
$end_day 7-$current_position//There are
    
    /////////////////////////////////////////////
    //Fill the last columns
    //    
    
for( $i $i $end_day $i++ )
        echo 
"<td class=\"cal_content\"></td>\n";
    
//
    /////////////////////////////////////////////
    
    
echo "</tr></table>";  // Close the table
?>
agu12 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Reply     « Reply to payed work (admin panel for a php calendar)
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11998 seconds with 12 queries