root/dev/common/kills.php @ 104

Revision 104, 3.4 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.ship.php" );
8  require_once( "class.killlisttable.php" );
9  require_once( "class.killsummarytable.php" );
10  require_once( "class.toplist.php" );
11
12  $week = $_GET['w'];
13  $year = $_GET['y'];
14 
15  if ( $week == "" )
16    $week = date( "W" );
17 
18  if ( $year == "" )
19    $year = date( "Y" );
20   
21  if ( $week == 52 ) {
22    $nweek = 1;
23    $nyear = $year + 1;
24    $pyear = $year - 1;
25  }
26  else {
27    $nweek = $week + 1;
28    $nyear = $year;
29  }
30  if ( $week == 1 ) {
31    $pweek = 52;
32    $pyear = $year - 1;
33  }
34  else {
35    $pweek = $week - 1;
36    $pyear = $year;
37  }
38
39  $page = new Page( "Kills - Week ".$week );
40
41  $kslist = new KillList();
42  $kslist->setWeek( $week );
43  $kslist->setYear( $year );
44  if ( CORP_ID )
45    $kslist->addInvolvedCorp( new Corporation( CORP_ID ) );
46  if ( ALLIANCE_ID )
47    $kslist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) );
48                                                                               
49  $llist = new KillList();
50  $llist->setWeek( $week );
51  $llist->setYear( $year );
52  if ( CORP_ID )
53    $llist->addVictimCorp( new Corporation( CORP_ID ) );
54  if ( ALLIANCE_ID )
55    $llist->addVictimAlliance( new Alliance( ALLIANCE_ID ) );
56
57  $summarytable = new KillSummaryTable( $kslist, $llist );
58  $summarytable->setBreak( 6 );
59  $html .= $summarytable->generate();
60
61  $klist = new KillList();
62  $klist->setOrdered( true );
63  $klist->setWeek( $week );
64  $klist->setYear( $year );
65  if ( CORP_ID )
66    $klist->addInvolvedCorp( new Corporation( CORP_ID ) );
67  if ( ALLIANCE_ID )
68    $klist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) );
69  if ( $_GET['scl_id'] )
70    $klist->addVictimShipClass( new ShipClass( $_GET['scl_id'] ) );
71  else
72    $klist->setPodsNoobShips( false );
73
74  $table = new KillListTable( $klist );
75  $html .= $table->generate();
76
77  $page->setContent( $html );
78$menubox = new box("Menu");
79$menubox->setIcon("menu-item.gif");
80  $menubox->addOption("caption", "Navigation" );
81  $menubox->addOption("link", "Previous week ", "?a=kills&w=".$pweek."&y=".$pyear );
82  if ( $week != date( "W" ) )
83    $menubox->addOption( "Next week", "?a=kills&w=".$nweek."&y=".$nyear );
84  $page->addContext( $menubox->generate() );
85 
86  $tklist = new TopKillsList();
87  $tklist->setWeek( $week );
88  $tklist->setYear( $year );
89  if ( CORP_ID )
90    $tklist->addInvolvedCorp( new Corporation( CORP_ID ) );
91  if ( ALLIANCE_ID )
92    $tklist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) );
93   
94  $tklist->generate();
95  $tkbox = new AwardBox( $tklist, "Top killers", "kills in week ".$week, "kills", "eagle" );
96  $page->addContext( $tkbox->generate() ); 
97
98  $killboard = $page->killboard_;
99  $config = $killboard->getConfig();
100  if ( $config->getKillPoints() ) {
101    $tklist = new TopScoreList();
102    $tklist->setWeek( $week );
103    $tklist->setYear( $year );
104    if ( CORP_ID )
105      $tklist->addInvolvedCorp( new Corporation( CORP_ID ) );
106    if ( ALLIANCE_ID )
107      $tklist->addInvolvedAlliance( new Alliance( ALLIANCE_ID ) );
108   
109    $tklist->generate();
110    $tkbox = new AwardBox( $tklist, "Top scorers", "points in week ".$week, "points", "redcross" );
111    $page->addContext( $tkbox->generate() ); 
112  }
113
114  $page->generate();
115?>
Note: See TracBrowser for help on using the browser.