TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 316
  • Total: 316

phpraider Center Block - Display this weeks raids

Started by cyberbane, April 29, 2008, 09:39:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cyberbane

Ok first off disclaimer here I didnt write this I got it from Vendictive in this post on the phpraider forums about setting it up for phpbb3 who modified the code originall posted by Mathandir.

http://forums.phpraider.com/showthread.php?t=1189

With a tiny bit of effort it can be taken and used in TP and SMF.

Basically create a php file called raid_week_display.php

containing this

<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: #007799;
    font-family: Tahoma;
    font-size: 12px;
}

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

.date_text {
    font-size: 12px;
    font-family: Tahoma;
    font-weight: 900;
    color: orange;
}

.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("../raider/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://www.mywebsite.com/phpraider/index.php';

// Where the raidcalenders raid-icons are located
$raid_icon_folder '/phpraider/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 'MY_DATABASE.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="center" width="100%" border="1" bordercolor="#C6C6C6" bgcolor="#000000" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border-color:#C6C6C6;" ><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)+$timezone));
                
// $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.'?option=com_view&id='.$raid_id.'" target="_parent"><img src="'.$raid_icon_folder.''.$check["icon_name"].'" onmouseover="InsertText(\''.$img_txt.'\');" onmouseout="InsertText(\'\');" border="0"></a>&nbsp;&nbsp;&nbsp;';
                }
             
// 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.

// IF ($_SERVER['PHP_SELF'] == '/index.php') {
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\"><a href=\"?offset=$prev\" class=\"raid_calendar\">Previous Week</a> - <a href=\"?offset=0\" class=\"raid_calendar\">Current Week</a> - <a href=\"?offset=$next\" class=\"raid_calendar\">Next Week</a></td><td align=\"right\"><a href=\"http://www.mywebsite.com/phpraider\" class=\"raid_calendar\" target=\"_parent\">Click here for phpRaider</a></td></tr></table>";
// }
// ELSE {
// }
?>

</body>
</html>


Change things in the start configuration section as necessary
Also note that at the very end of the file is a http link to your phpraider site this needs changing.

Save this file in your phpraider directory.

Then create a PHPBOX center block in TP and add this code obviously changing it to your path.

include ('/home/ACCOUNTNAME/public_html/phpraider/raid_week_display.php');


I have attached the php file and a small screenshot.

This website is proudly hosted on Crocweb Cloud Website Hosting.