root/dev/common/losses.php @ 104

Revision 104, 3.3 KB (checked in by knifee, 16 years ago)

Changed the class.box.php to use smarty, and changed all pages that use the class to use the options. Menu Boxes can now be created as follows:
$menubox = new box("Menu");
$menubox->setIcon("menu-item.gif"); // only needed if adding a Menu (ie u want the little icon)
$menubox->addOption("caption","View"); // Add a Caption
$menubox->addOption("link","Name","URL"); // Add a Link
$menubox->addOption("points","Points Value"); // Add points to a Points Box
$menubox->addOption("img","/path to img"); // Add an Image

changed the AwardBox? Class to use smarty, that is called in the same way as before so no need to change anything.

Line 
1<?
2  require_once( "class.page.php" );
3  require_once( "class.box.php" );
4  require_once( "class.corp.php" );
5  require_once( "class.alliance.php" );
6  require_once( "class.killlist.php" );
7  require_once( "class.killlisttable.php" );
8  require_once( "class.killsummarytable.php" );
9  require_once( "class.toplist.php" );
10
11  $week = $_GET['w'];
12  $year = $_GET['y'];
13 
14  if ( $week == "" )
15    $week = date( "W" );
16 
17  if ( $year == "" )
18    $year = date( "Y" );
19   
20  if ( $week == 52 ) {
21    $nweek = 1;
22    $nyear = $year + 1;
23  }
24  else {
25    $nweek = $week + 1;
26    $nyear = $year;
27  }
28  if ( $week == "1" ) {
29    $pweek = 52;
30    $pyear = $year - 1;
31  }
32  else {
33    $pweek = $week - 1;
34    $pyear = $year;
35  }
36
37  $page = new Page( "Losses - Week ".$week );
38
39  $klist = new KillList();
40  $klist->setWeek( $week );
41  $klist->setYear( $year );
42  if ( CORP_ID )
43    $klist->addInvolvedCorp( new Corporation( CORP_ID ) );
44  if ( ALLIANCE_ID )
45    $klist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) );
46                                                                               
47  $lslist = new KillList();
48  $lslist->setWeek( $week );
49  $lslist->setYear( $year );
50  if ( CORP_ID )
51    $lslist->addVictimCorp( new Corporation( CORP_ID ) );
52  if ( ALLIANCE_ID )
53    $lslist->addVictimAlliance( new Alliance( ALLIANCE_ID ) );
54                                                                               
55  $summarytable = new KillSummaryTable( $klist, $lslist );
56  $summarytable->setBreak( 6 );
57  $html .= $summarytable->generate();
58
59  //$html .= "<table width=\"99%\" align=center><tr><td class=weeknav align=left>";
60 
61 // if ( $week != date( "W" ) )
62 //   $html .= "[<a href=\"?a=losses&w=".$nweek."&y=".$nyear."\"><<</a>]";
63   
64//  $html .= "</td><td class=weeknav align=right>[<a href=\"?a=losses&w=".$pweek."&y=".$pyear."\">>></a>]</td></tr></table>";
65
66  $llist = new KillList();
67  $llist->setOrdered( true );
68  $llist->setWeek( $week );
69  $llist->setYear( $year );
70  if ( CORP_ID )
71    $llist->addVictimCorp( new Corporation( CORP_ID ) );
72  if ( ALLIANCE_ID )
73    $llist->addVictimAlliance( new Alliance( ALLIANCE_ID ) );
74  if ( $_GET['scl_id'] )
75    $llist->addVictimShipClass( new ShipClass( $_GET['scl_id'] ) );
76  else
77    $llist->setPodsNoobShips( false );
78                                                                               
79  $table = new KillListTable( $llist );
80  $html .= $table->generate();
81
82$menubox = new box("Menu");
83$menubox->setIcon("menu-item.gif");
84  $menubox->addOption("caption", "Navigation" );
85  $menubox->addOption("link", "Previous week", "?a=losses&w=".$pweek."&y=".$pyear );
86  if ( $week != date( "W" ) )
87    $menubox->addOption("link", "Next week", "?a=losses&w=".$nweek."&y=".$nyear );
88  $page->addContext( $menubox->generate() );
89
90  $tllist = new TopLossesList();
91  $tllist->setWeek( $week );
92  $tllist->setYear( $year );
93  if ( CORP_ID )
94    $tllist->addVictimCorp( new Corporation( CORP_ID ) );
95  if ( ALLIANCE_ID )
96    $tllist->addVictimAlliance( new Alliance( ALLIANCE_ID ) );
97   
98  $tllist->generate();
99  $tlbox = new AwardBox( $tllist, "Top losers", "losses in week ".$week, "losses", "moon" );
100  $page->addContext( $tlbox->generate() ); 
101
102  $page->setContent( $html );
103  $page->generate();
104?>
Note: See TracBrowser for help on using the browser.