Jump to content

Php calender


Kekie

Recommended Posts

hey. i have a problem with a script i found on the net. i would love this script to show a month insted of a week. would appreciate if anyone got a solution. i have tryied all i know but i guess im too big a noob =)

 

<html>
<head>
<script type="text/javascript">
function InsertText(str) {
var oDiv=document.getElementById("text");
oDiv.innerHTML=str;
}
</script>
<STYLE type="text/css">
<!--
a.raid_calendar {
text-decoration:none;
font-weight: 900;
color: #C0C0C0;
font-family: Tahoma;
font-size: 12px;
}

a:hover.raid_calendar {
text-decoration:underline;
}

.date_text {
font-size: 10px;
font-family: Tahoma;
font-weight: 900;
color: grey;
}

.raid_text {
font-size: 12px;
font-family: Tahoma;
font-weight: 900;
color: white;
}
-->
</STYLE>
</head>
<body text="white" bgcolor="black">

<?php
//© Copywrite Eternal Souls, Created by Zemathar of the Eternals Souls Guild on EU Scarhield Legion server, feel free to use this code as long as you do not remove this message.
// Here are the config for this page.
// Version 1.1.1
// Emergency bug-correction.
// Fixed how the script connects to the database.

// Version 1.1.0
// Implemented the "no raid" function.
// You can now display an image or text if there is no raid that day.
// You can of cause have it like standard where nothing will be displayed.

// Version 1.0.1
// Implemented $timezone
// There you can change the output time to be in your timezone. You will have to calculate by yourself how many
// hours plus or minus you need.
//
// $db_raid_tabel is a value pointed to where the xxx_raid tabel is located. You will have to check in the database for the
// right value.

// Version 1.0
// I made this addon just because we needed it.
// It has it flaws and buggs but I will try to fix them as soon as possible

// Edited by Vendictive of The Legacy of Legends and Padraigh of MeleeStorm on US Scarlet Crusade

//NOTE! we have put the phpraiderfiles in a folder that we have named raids,
//if you do not want do go thru the code and change to much we advice you to
//do the same.
// ******************************************************
// START OF CONFIGURATION
//

// Include the phpRaider configuration file for easy use database connection.
include("raid/configuration.php");

// How many hours + or - the viewer should calculate. Some do have to edit this to make
// the timedisplay to be correct.
// For example $timezone = 3 or $timezone = -4
$timezone = 1;

// Where the raidcalender's index.php is located
$raid_cal_index = 'http:/raid/index.php';

// Where the raidcalenders raid-icons are located
$raid_icon_folder = '/raid/games/WoW/images/raids/';

// MySQL- settings. Note that db_table_prefixes can vary depending on what you choose when you install phpraider.
$db_raid_tabel = 'phpraider_raid';

// Layout. The size of the windows of the days displayed.
$layout_frame_width = 180;
$layout_frame_height = 100;
$layout_frame_raidinfo = 25;

// What will be displayed when no raids are planned for that particular day.
// You can choose to have a text or an icon.
// $no_raid_type = 'image';
// $no_raid_type = 'text';
// $no_raid_type = 'none';

// $no_raid_type = 'none'; // What mode do you want?
// $no_raid_text = 'No raid today'; // What text to be shown
// $no_raid_image = '/raids/games/WoW/images/raids/no_raid.jpg'; // link to your icon if you use that.



$no_raid_txt = 'No raid today';
//
// END OF CONFIGURATION
// ******************************************************

$db = mysql_connect($pConfig['db_server'], $pConfig['db_user'], $pConfig['db_pass']);
mysql_select_db($pConfig['db_name'],$db);
//CHECK OFFSET FROM CURRENT WEEK AND SETS VARIABLES
if ($_GET["offset"]) {
$weekoffset = $_GET["offset"]*604800;
$wo=$_GET["offset"];
}
else {
$weekoffset=0;
$wo=0;
}


$weekstart = (date('U')-(date('w')+6)%7*86400)+$weekoffset; // sets start date of displayed week
$timezone *= 3600; // Calculates the timezone-diff.

// Lets deal with the output

echo '<table align="right" width="99%" border="1" bordercolor="#C6C6C6" bgcolor="" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border-color:#000000;" ><tr height="'.$layout_frame_height.'" >'."\n";

for ($i=0;$i<7;$i++) {
// Loops through the week
echo '<td aligh="left" valign="top" width="'.$layout_frame_width.'">'."\n";
$current = $weekstart+(86400*($i));
$day = date('D M d, Y:',$current);
$currdate = date('dmY',$current);
echo '<b><span class="date_text">'. $day . '</b></span><br>'."\n";
$sql = mysql_query("SELECT * FROM $db_raid_tabel ORDER by start_time",$db);

// Get error if there is one
echo mysql_error();

// Getting raid start dates
while ($check = mysql_fetch_array($sql)){
if ($currdate == date('dmY',$check["start_time"])) { // Checks if the date of the raid is equal to displayed day
$invite_start = date("H:i",($check["invite_time"]+$timezone));
$starter = date("H:i",($check["start_time"]+$timezone));
$freeze = date("H:i",$check["start_time"]-(($check["freeze_time"]*3600)+$timezon e));
// $now_tmp = mktime(date("H,i"));
$now_tmp = date("H,i");
$freeze_tmp = $check["start_time"]-(($check["freeze_time"]*3600)+$timezone);
$raid_month = date("n",$check["start_time"]);
$raid_year = date("Y",$check["start_time"]);
$raid_id = $check["raid_id"];

// Here is the text set. The info about a raid when its opened or closed.
// Feel free to edit this part as you wish.
if ($now_tmp <= $freeze_tmp) {
$img_txt = 'Click on the image to view this raid. Invites start at : '.$invite_start.' and the raid starts at : '.$starter;
} else {
$img_txt = 'This raid is closed and over!';
}
echo '<a href="'.$raid_cal_index.'?monthID='.$raid_month.'&yearID='.$raid_year.'" border=0 target=_new><img src="'.$raid_icon_folder.''.$check["icon_name"].'" onmouseover="InsertText(\''.$img_txt.'\');" onmouseout="InsertText(\'\');" border=0"></a>';
}


// else {
// switch ($no_raid_type) {
// case text:
// echo $no_raid_txt;
// break;
// case image:
// echo '<img src="'.$no_raid_image.'">';
// break;
// case none:
// echo '';
// break;
// default:
// echo '';
// }
// }
}
echo '</td>'."\n";
}

echo '<tr><td colspan=7 height='.$layout_frame_raidinfo.'></font><div id="text"><font color=black>.</div></td></tr>';
echo '</table>'."\n";

////////////SLOPPY CALCULATOR FOR CHANGING WEEK////////////
$next = $wo+1;
$prev = $wo-1;

// Here is a IF-statement which controls if the "next week" link should be visible.
// i have set it to be visible only when you are in "/index.php".
// If you want them to always show remote the whole IF-statement but do not remote the echo-line.


?>
</body>
</html>

 

looks like this on my website.

 

scheldule.jpg

 

thanks =)

Link to comment
https://forums.phpfreaks.com/topic/183585-php-calender/
Share on other sites

sorry i cant find the edit button..  here is the table structure

 

-- Table structure for `phpraider_raid`
-- ----------------------------
DROP TABLE IF EXISTS `phpraider_raid`;
CREATE TABLE `phpraider_raid` (
  `raid_id` int(10) NOT NULL AUTO_INCREMENT,
  `expired` int(1) NOT NULL DEFAULT '0',
  `location` varchar(45) COLLATE latin1_danish_ci NOT NULL,
  `raid_leader` varchar(45) COLLATE latin1_danish_ci NOT NULL,
  `invite_time` varchar(45) COLLATE latin1_danish_ci NOT NULL,
  `maximum` int(3) NOT NULL,
  `description` text COLLATE latin1_danish_ci NOT NULL,
  `start_time` varchar(45) COLLATE latin1_danish_ci NOT NULL,
  `freeze_time` int(11) NOT NULL DEFAULT '0',
  `maximum_level` int(11) NOT NULL DEFAULT '0',
  `minimum_level` int(11) NOT NULL DEFAULT '0',
  `use_icon` int(1) NOT NULL DEFAULT '0',
  `use_name` int(1) NOT NULL DEFAULT '0',
  `icon_name` varchar(45) COLLATE latin1_danish_ci NOT NULL,
  `profile_id` int(11) NOT NULL,
  `recurring` varchar(45) COLLATE latin1_danish_ci NOT NULL DEFAULT '0',
  PRIMARY KEY (`raid_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_danish_ci;

Link to comment
https://forums.phpfreaks.com/topic/183585-php-calender/#findComment-969105
Share on other sites

okay. i found out how to do it..

 

just change  i<7 to i<14 or more.

 

for ($i=0;$i[color=red]<7[/color];$i++) {
      // Loops through the week
        echo '<td aligh="left" valign="top" width="'.$layout_frame_width.'">'."\n";
        $current = $weekstart+(86400*($i));
        $day = date('D M d, Y:',$current);
        $currdate = date('dmY',$current);
        echo '<b><span class="date_text">'. $day . '</b></span><br>'."\n";
        $sql = mysql_query("SELECT * FROM $db_raid_tabel ORDER by start_time",$db);

 

now i just need the table to expand downwards like 1 week then 2 week under.. insted of it showing in one line i hope someone can help =)

 

mmhs.jpg

 

 

Link to comment
https://forums.phpfreaks.com/topic/183585-php-calender/#findComment-969146
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.