Changeset 240 for dev/mods/example_mod

Show
Ignore:
Timestamp:
09/25/07 15:26:51 (14 years ago)
Author:
ralle030583
Message:

Implemented exi's involvedloader class

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/mods/example_mod/home.php

    r233 r240  
    11<?php 
    2 require_once("common/includes/class.killsummarytable.php"); 
    3 require_once("common/includes/class.box.php"); 
    4 require_once("common/includes/class.corp.php"); 
    5 require_once("common/includes/class.alliance.php"); 
    6 require_once("common/includes/class.killlist.php"); 
    7 require_once("common/includes/class.killlisttable.php"); 
    8 require_once("common/includes/class.contract.php"); 
    9 require_once("common/includes/class.graph.php"); 
    10 require_once("common/includes/class.toplist.php"); 
     2require_once('common/includes/class.killsummarytable.php'); 
     3require_once('common/includes/class.corp.php'); 
     4require_once('common/includes/class.alliance.php'); 
     5require_once('common/includes/class.killlist.php'); 
     6require_once('common/includes/class.killlisttable.php'); 
     7require_once('common/includes/class.contract.php'); 
     8require_once('common/includes/class.toplist.php'); 
    119 
    12 $week = date("W"); 
    13 $year = date("Y"); 
     10$week = kbdate('W'); 
     11$year = kbdate('Y'); 
    1412 
    1513$page = new Page("omgwtfpwnd!!!1"); 
    1614 
    1715$kslist = new KillList(); 
    18 if (CORP_ID) 
    19     $kslist->addInvolvedCorp(new Corporation(CORP_ID)); 
    20 if (ALLIANCE_ID) 
    21     $kslist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 
    22  
     16involved::load($kslist,'kill'); 
    2317$kslist->setWeek($week); 
    2418$kslist->setYear($year); 
    2519 
    2620$llist = new KillList(); 
    27 if (CORP_ID) 
    28     $llist->addVictimCorp(new Corporation(CORP_ID)); 
    29 if (ALLIANCE_ID) 
    30     $llist->addVictimAlliance(new Alliance(ALLIANCE_ID)); 
    31  
     21involved::load($llist,'loss'); 
    3222$llist->setWeek($week); 
    3323$llist->setYear($year); 
     
    3525$summarytable = new KillSummaryTable($kslist, $llist); 
    3626$summarytable->setBreak(5); 
    37 //$html .= $summarytable->generate(); 
     27$html .= $summarytable->generate(); 
    3828 
    3929if ($week == 1) 
    4030{ 
    41     $pyear = date("Y") - 1; 
     31    $pyear = kbdate("Y") - 1; 
    4232    $pweek = 52; 
    4333} 
    4434else 
    4535{ 
    46     $pyear = date("Y"); 
     36    $pyear = kbdate("Y"); 
    4737    $pweek = $week - 1; 
    4838} 
     
    6858} 
    6959 
    70 $html .= "<div class=kb-kills-header>20 most recent pwns</div>"; 
     60// bad hax0ring, we really need mod callback stuff 
     61if (strpos(config::get('mods_active'), 'rss_feed') !== false) 
     62{ 
     63    $html .= "<div class=kb-kills-header><a href=\"?a=rss\"><img src=\"mods/rss_feed/rss_icon.png\" alt=\"RSS-Feed\" border=\"0\"></a>&nbsp;20 most recent kills</div>"; 
     64} 
     65else 
     66{ 
     67    $html .= "<div class=kb-kills-header>20 most recent kills</div>"; 
     68} 
    7169 
    7270$klist = new KillList(); 
    7371$klist->setOrdered(true); 
    74 if (CORP_ID) 
    75     $klist->addInvolvedCorp(new Corporation(CORP_ID)); 
    76 if (ALLIANCE_ID) 
    77     $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 
     72involved::load($klist,'kill'); 
     73 
    7874 
    7975// boards with low killcount could not display 20 kills with those limits 
    8076//$klist->setStartWeek($week - 1); 
    8177//$klist->setYear($year); 
     78$klist->setLimit(20); 
    8279 
    8380if ($_GET['scl_id']) 
     
    9188 
    9289$page->setContent($html); 
    93 $menubox = new MenuBox(); 
    94 $menubox->addCaption("Navigation"); 
    95 $menubox->addOption("Previous week", "?a=kills&w=" . $pweek . "&y=" . $pyear); 
     90$menubox = new box("Menu"); 
     91$menubox->setIcon("menu-item.gif"); 
     92$menubox->addOption("caption","Navigation"); 
     93$menubox->addOption("link","Previous week", "?a=kills&w=" . $pweek . "&y=" . $pyear); 
    9694$page->addContext($menubox->generate()); 
    9795 
     
    9997$tklist->setWeek($week); 
    10098$tklist->setYear($year); 
    101 if (CORP_ID) 
    102     $tklist->addInvolvedCorp(new Corporation(CORP_ID)); 
    103 if (ALLIANCE_ID) 
    104     $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 
     99involved::load($tklist,'kill'); 
    105100 
    106101$tklist->generate(); 
     
    113108    $tklist->setWeek($week); 
    114109    $tklist->setYear($year); 
    115     if (CORP_ID) 
    116         $tklist->addInvolvedCorp(new Corporation(CORP_ID)); 
    117     if (ALLIANCE_ID) 
    118         $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); 
     110    involved::load($tklist,'kill'); 
    119111 
    120112    $tklist->generate();