Changeset 307 for dev/mods

Show
Ignore:
Timestamp:
12/31/07 14:30:49 (12 years ago)
Author:
ralle030583
Message:

- Fix:

merged the last few changes into kill_detail (slotfix) into fitting mod

Location:
dev/mods/fitting
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dev/mods/fitting/kill_detail.php

    r302 r307  
    55require_once('common/includes/class.alliance.php'); 
    66 
    7 $page = new Page('Kill details - MOD'); 
     7$page = new Page('Kill details with Fitting MOD'); 
    88 
    99if (config::get('item_values')) 
     
    1313    { 
    1414        $smarty->assign('admin', 'true'); 
    15         if (isset($_POST['submit'])) 
     15        if (isset($_POST['submit']) && $_POST['submit'] == 'UpdateValue') 
    1616        { 
    1717            // Send new value for item to the database 
     
    1919            $Val = $_POST[$IID]; 
    2020            $qry = new DBQuery(); 
    21             $qry->execute("UPDATE kb3_items SET itm_value ='".$Val."' WHERE itm_id='".$IID."'"); 
     21            $qry->execute("INSERT INTO kb3_item_price (typeID, price) VALUES ('".$IID."', '".$Val."') ON DUPLICATE KEY UPDATE price = '".$Val."'"); 
    2222        } 
     23    } 
     24} 
     25 
     26if ($page->isAdmin()) 
     27{ 
     28    if (isset($_GET['view']) && $_GET['view']== 'FixSlot') 
     29    { 
     30            $smarty->assign('fixSlot', 'true'); 
     31    } 
     32 
     33    $smarty->assign('admin', 'true'); 
     34    if (isset($_POST['submit']) && $_POST['submit'] == 'UpdateSlot') 
     35    { 
     36        $IID = $_POST['IID']; 
     37        $KID = $_POST['KID']; 
     38        $Val = $_POST[$IID]; 
     39        $table = $_POST['TYPE']; 
     40        $old = $_POST['OLDSLOT']; 
     41        $qry = new DBQuery(); 
     42        $qry->execute("UPDATE kb3_items_".$table." SET itd_itl_id ='".$Val."' WHERE itd_itm_id=".$IID." AND itd_kll_id = ".$KID." AND itd_itl_id = ".$old); 
    2343    } 
    2444} 
     
    4262 
    4363// victim $smarty->assign('',); 
     64$smarty->assign('KillId', $kill->getID()); 
    4465$smarty->assign('VictimPortrait', $kill->getVictimPortrait(64)); 
    4566$smarty->assign('VictimURL', "?a=pilot_detail&plt_id=".$kill->getVictimID()); 
     
    144165$smarty->assign('VictimShipImg', $ship->getImage(64)); 
    145166 
     167// preparing slot layout 
     168 
     169    $slot_array = array(); 
     170    $slot_array[1] = array('img' => 'icon08_11.png', 'text' => 'Fitted - High slot', 'items' => array()); 
     171    $slot_array[2] = array('img' => 'icon08_10.png', 'text' => 'Fitted - Mid slot', 'items' => array()); 
     172    $slot_array[3] = array('img' => 'icon08_09.png', 'text' => 'Fitted - Low slot', 'items' => array()); 
     173    $slot_array[5] = array('img' => 'icon68_01.png', 'text' => 'Fitted - Rig slot', 'items' => array()); 
     174    $slot_array[6] = array('img' => 'icon02_10.png', 'text' => 'Drone bay', 'items' => array()); 
     175    $slot_array[4] = array('img' => 'icon03_14.png', 'text' => 'Cargo Bay', 'items' => array()); 
     176 
    146177// ship fitting 
    147178if (count($kill->destroyeditems_) > 0) 
    148179{ 
    149180    $dest_array = array(); 
    150     $dest_array[1] = array('img' => 'icon08_11.png', 'text' => 'Fitted - High slot', 'items' => array()); 
    151     $dest_array[2] = array('img' => 'icon08_10.png', 'text' => 'Fitted - Mid slot', 'items' => array()); 
    152     $dest_array[3] = array('img' => 'icon08_09.png', 'text' => 'Fitted - Low slot', 'items' => array()); 
    153     $dest_array[5] = array('img' => 'icon68_01.png', 'text' => 'Fitted - Rig slot', 'items' => array()); 
    154     $dest_array[6] = array('img' => 'icon02_10.png', 'text' => 'Drone bay', 'items' => array()); 
    155     $dest_array[4] = array('img' => 'icon03_14.png', 'text' => 'Cargo Bay', 'items' => array()); 
    156  
    157181    foreach($kill->destroyeditems_ as $destroyed) 
    158182    { 
     
    164188            $formatted = $destroyed->getFormatttedValue(); 
    165189        } 
    166         $dest_array[$destroyed->getLocationID()]['items'][] = array('Icon' => $item->getIcon(32), 'Name' => $item->getName(), 'Quantity' => $destroyed->getQuantity(), 'Value' => $formatted, 'single_unit' => $value, 'itemID' => $item->getID()); 
     190        $dest_array[$destroyed->getLocationID()][] = array('Icon' => $item->getIcon(32), 'Name' => $item->getName(), 'Quantity' => $destroyed->getQuantity(), 'Value' => $formatted, 'single_unit' => $value, 'itemID' => $item->getID(),'slotID' => $destroyed->getLocationID()); 
    167191                 
    168192                //Fitting, KE - add destroyed items to an array of all fitted items. 
     
    181205{ 
    182206    $drop_array = array(); 
    183     $drop_array[1] = array('img' => 'icon08_11.png', 'text' => 'Fitted - High slot', 'items' => array()); 
    184     $drop_array[2] = array('img' => 'icon08_10.png', 'text' => 'Fitted - Mid slot', 'items' => array()); 
    185     $drop_array[3] = array('img' => 'icon08_09.png', 'text' => 'Fitted - Low slot', 'items' => array()); 
    186     $drop_array[5] = array('img' => 'icon68_01.png', 'text' => 'Fitted - Rig slot', 'items' => array()); 
    187     $drop_array[6] = array('img' => 'icon02_10.png', 'text' => 'Drone bay', 'items' => array()); 
    188     $drop_array[4] = array('img' => 'icon03_14.png', 'text' => 'Cargo Bay', 'items' => array()); 
    189  
    190207    foreach($kill->droppeditems_ as $dropped) 
    191208    { 
     
    197214            $formatted = $dropped->getFormatttedValue(); 
    198215        } 
    199         $drop_array[$dropped->getLocationID()]['items'][] = array('Icon' => $item->getIcon(32), 'Name' => $item->getName(), 'Quantity' => $dropped->getQuantity(), 'Value' => $formatted, 'single_unit' => $value, 'itemID' => $item->getID()); 
     216        $drop_array[$dropped->getLocationID()][] = array('Icon' => $item->getIcon(32), 'Name' => $item->getName(), 'Quantity' => $dropped->getQuantity(), 'Value' => $formatted, 'single_unit' => $value, 'itemID' => $item->getID(),'slotID' => $dropped->getLocationID()); 
    200217                 
    201218                //Fitting -KE, add dropped items to the list 
     
    269286$dropvalue = number_format($dropvalue, 2); 
    270287 
    271  
    272288$smarty->assign_by_ref('destroyed', $dest_array); 
    273289$smarty->assign_by_ref('dropped', $drop_array); 
     290$smarty->assign_by_ref('slots', $slot_array); 
    274291$smarty->assign_by_ref('fitting_high', $fitting_array[1]); 
    275292$smarty->assign_by_ref('fitting_med', $fitting_array[2]); 
     
    293310    $menubox->addOption("caption", "Admin"); 
    294311    $menubox->addOption("link", "Delete", "javascript:openWindow('?a=admin_kill_delete&kll_id=".$kill->getID()."', null, 420, 300, '' );"); 
     312    $menubox->addOption("link", "Fix Slots", "?a=kill_detail&kll_id=".$kill->getID()."&view=FixSlot"); 
     313 
    295314} 
    296315$page->addContext($menubox->generate()); 
  • dev/mods/fitting/kill_detail.tpl

    r303 r307  
    6161            </table> 
    6262 
    63  
    6463          <br /> 
    6564          <div id="fitting" style="position:relative; height:380px; width:360px; background-image:url(mods/fitting/fitting.gif)" name="fitting"> 
    66 <div id="high1" style="position:absolute; left:40px; top:255px; width:32px; height:32px; z-index:1;">{$fitting_high.0.Icon}</div> 
    67 <div id="high2" style="position:absolute; left:8px; top:162px; width:32px; height:32px; z-index:1;">{$fitting_high.1.Icon}</div> 
    68 <div id="high3" style="position:absolute; left:41px; top:71px; width:32px; height:32px; z-index:1;">{$fitting_high.2.Icon}</div> 
    69 <div id="high4" style="position:absolute; left:117px; top:15px; width:32px; height:32px; z-index:1;">{$fitting_high.3.Icon}</div> 
    70 <div id="high5" style="position:absolute; left:212px; top:13px; width:32px; height:32px; z-index:1;">{$fitting_high.4.Icon}</div> 
    71 <div id="high6" style="position:absolute; left:295px; top:72px; width:32px; height:32px; z-index:1;">{$fitting_high.5.Icon}</div> 
    72 <div id="high7" style="position:absolute; left:323px; top:165px; width:32px; height:32px; z-index:1;">{$fitting_high.6.Icon}</div> 
    73 <div id="high8" style="position:absolute; left:295px; top:253px; width:32px; height:32px; z-index:1;">{$fitting_high.7.Icon}</div> 
    74  
    75 <div id="mid1" style="position:absolute; left:73px; top:229px; width:32px; height:32px; z-index:1;">{$fitting_med.0.Icon}</div> 
    76 <div id="mid2" style="position:absolute; left:51px; top:165px; width:32px; height:32px; z-index:1;">{$fitting_med.1.Icon}</div> 
    77 <div id="mid3" style="position:absolute; left:72px; top:93px; width:32px; height:32px; z-index:1;">{$fitting_med.2.Icon}</div> 
    78 <div id="mid4" style="position:absolute; left:132px; top:57px; width:32px; height:32px; z-index:1;">{$fitting_med.3.Icon}</div> 
    79 <div id="mid5" style="position:absolute; left:198px; top:52px; width:32px; height:32px; z-index:1;">{$fitting_med.4.Icon}</div> 
    80 <div id="mid6" style="position:absolute; left:256px; top:101px; width:32px; height:32px; z-index:1;">{$fitting_med.5.Icon}</div> 
    81 <div id="mid7" style="position:absolute; left:275px; top:166px; width:32px; height:32px; z-index:1;">{$fitting_med.6.Icon}</div> 
    82 <div id="mid8" style="position:absolute; left:261px; top:228px; width:32px; height:32px; z-index:1;">{$fitting_med.7.Icon}</div> 
    83  
    84 <div id="low1" style="position:absolute; left:107px; top:205px; width:32px; height:32px; z-index:1;">{$fitting_low.0.Icon}</div> 
    85 <div id="low2" style="position:absolute; left:94px; top:163px; width:32px; height:32px; z-index:1;">{$fitting_low.1.Icon}</div> 
    86 <div id="low3" style="position:absolute; left:111px; top:123px; width:32px; height:32px; z-index:1;">{$fitting_low.2.Icon}</div> 
    87 <div id="low4" style="position:absolute; left:143px; top:93px; width:32px; height:32px; z-index:1;">{$fitting_low.3.Icon}</div> 
    88 <div id="low5" style="position:absolute; left:186px; top:94px; width:32px; height:32px; z-index:1;">{$fitting_low.4.Icon}</div> 
    89 <div id="low6" style="position:absolute; left:228px; top:123px; width:32px; height:32px; z-index:1;">{$fitting_low.5.Icon}</div> 
    90 <div id="low7" style="position:absolute; left:237px; top:164px; width:32px; height:32px; z-index:1;">{$fitting_low.6.Icon}</div> 
    91 <div id="low8" style="position:absolute; left:225px; top:203px; width:32px; height:32px; z-index:1;">{$fitting_low.7.Icon}</div> 
    92  
    93 <div id="rig1" style="position:absolute; left:54px; top:345px; width:32px; height:32px; z-index:1;">{$fitting_rig.0.Icon}</div> 
    94 <div id="rig2" style="position:absolute; left:86px; top:345px; width:32px; height:32px; z-index:1;">{$fitting_rig.1.Icon}</div> 
    95 <div id="rig3" style="position:absolute; left:118px; top:345px; width:32px; height:32px; z-index:1;">{$fitting_rig.2.Icon}</div> 
    96  
    97 </div> 
     65                <div id="high1" style="position:absolute; left:40px; top:255px; width:32px; height:32px; z-index:1;">{$fitting_high.0.Icon}</div> 
     66                <div id="high2" style="position:absolute; left:8px; top:162px; width:32px; height:32px; z-index:1;">{$fitting_high.1.Icon}</div> 
     67                <div id="high3" style="position:absolute; left:41px; top:71px; width:32px; height:32px; z-index:1;">{$fitting_high.2.Icon}</div> 
     68                <div id="high4" style="position:absolute; left:117px; top:15px; width:32px; height:32px; z-index:1;">{$fitting_high.3.Icon}</div> 
     69                <div id="high5" style="position:absolute; left:212px; top:13px; width:32px; height:32px; z-index:1;">{$fitting_high.4.Icon}</div> 
     70                <div id="high6" style="position:absolute; left:295px; top:72px; width:32px; height:32px; z-index:1;">{$fitting_high.5.Icon}</div> 
     71                <div id="high7" style="position:absolute; left:323px; top:165px; width:32px; height:32px; z-index:1;">{$fitting_high.6.Icon}</div> 
     72                <div id="high8" style="position:absolute; left:295px; top:253px; width:32px; height:32px; z-index:1;">{$fitting_high.7.Icon}</div> 
     73 
     74                <div id="mid1" style="position:absolute; left:73px; top:229px; width:32px; height:32px; z-index:1;">{$fitting_med.0.Icon}</div> 
     75                <div id="mid2" style="position:absolute; left:51px; top:165px; width:32px; height:32px; z-index:1;">{$fitting_med.1.Icon}</div> 
     76                <div id="mid3" style="position:absolute; left:72px; top:93px; width:32px; height:32px; z-index:1;">{$fitting_med.2.Icon}</div> 
     77                <div id="mid4" style="position:absolute; left:132px; top:57px; width:32px; height:32px; z-index:1;">{$fitting_med.3.Icon}</div> 
     78                <div id="mid5" style="position:absolute; left:198px; top:52px; width:32px; height:32px; z-index:1;">{$fitting_med.4.Icon}</div> 
     79                <div id="mid6" style="position:absolute; left:256px; top:101px; width:32px; height:32px; z-index:1;">{$fitting_med.5.Icon}</div> 
     80                <div id="mid7" style="position:absolute; left:275px; top:166px; width:32px; height:32px; z-index:1;">{$fitting_med.6.Icon}</div> 
     81                <div id="mid8" style="position:absolute; left:261px; top:228px; width:32px; height:32px; z-index:1;">{$fitting_med.7.Icon}</div> 
     82 
     83                <div id="low1" style="position:absolute; left:107px; top:205px; width:32px; height:32px; z-index:1;">{$fitting_low.0.Icon}</div> 
     84                <div id="low2" style="position:absolute; left:94px; top:163px; width:32px; height:32px; z-index:1;">{$fitting_low.1.Icon}</div> 
     85                <div id="low3" style="position:absolute; left:111px; top:123px; width:32px; height:32px; z-index:1;">{$fitting_low.2.Icon}</div> 
     86                <div id="low4" style="position:absolute; left:143px; top:93px; width:32px; height:32px; z-index:1;">{$fitting_low.3.Icon}</div> 
     87                <div id="low5" style="position:absolute; left:186px; top:94px; width:32px; height:32px; z-index:1;">{$fitting_low.4.Icon}</div> 
     88                <div id="low6" style="position:absolute; left:228px; top:123px; width:32px; height:32px; z-index:1;">{$fitting_low.5.Icon}</div> 
     89                <div id="low7" style="position:absolute; left:237px; top:164px; width:32px; height:32px; z-index:1;">{$fitting_low.6.Icon}</div> 
     90                <div id="low8" style="position:absolute; left:225px; top:203px; width:32px; height:32px; z-index:1;">{$fitting_low.7.Icon}</div> 
     91 
     92                <div id="rig1" style="position:absolute; left:54px; top:345px; width:32px; height:32px; z-index:1;">{$fitting_rig.0.Icon}</div> 
     93                <div id="rig2" style="position:absolute; left:86px; top:345px; width:32px; height:32px; z-index:1;">{$fitting_rig.1.Icon}</div> 
     94                <div id="rig3" style="position:absolute; left:118px; top:345px; width:32px; height:32px; z-index:1;">{$fitting_rig.2.Icon}</div> 
     95          </div> 
    9896            
    99             
    100             
    101             
    102           <div class="block-header">Ship details</div> 
     97                <div class="block-header">Ship details</div> 
    10398            <table class="kb-table" width="360" border="0" cellspacing="1"> 
    104 {foreach from=$destroyed item=slot key=slotindex} 
     99{foreach from=$slots item=slot key=slotindex} 
    105100{* set to true to show empty slots *} 
    106 {if $slot.items or $dropped.$slotindex.items} 
     101{if $destroyed.$slotindex or $dropped.$slotindex} 
    107102                <tr class="kb-table-row-even"> 
    108103                    <td class="item-icon" width="32"><img width="32" height="32" src="{$img_url}/{$slot.img}" alt="{$slot.text}" border="0"></td> 
     
    112107    {/if} 
    113108                </tr> 
    114     {foreach from=$slot.items item=i} 
     109    {foreach from=$destroyed.$slotindex item=i} 
    115110                <tr class="kb-table-row-odd"> 
    116111                    <td class="item-icon" width="32" height="34" valign="top"><a href="?a=invtype&id={$i.itemID}">{$i.Icon}</a></td> 
     
    121116        {/if} 
    122117                </tr> 
    123         {if $admin and $config->get('item_values')} 
     118        {if $admin and $config->get('item_values') and !$fixSlot} 
    124119                    <tr class="kb-table-row-even"> 
    125120                      <form method="post" action=""> 
     
    130125                                <input name="{$i.itemID}" type="text" class="comment-button" value="{$i.single_unit}" size="6"> 
    131126                            </div> 
    132                         <td height="34" valign="top"><input type="submit" name="submit" value="Update" class="comment-button"></td> 
    133                       </form> 
    134                     </tr> 
    135         {/if} 
    136     {foreachelse} 
    137                 <tr class="kb-table-row-odd"> 
    138                     <td colspan="4" valign="top">No Items lost</td> 
    139                 </tr> 
     127                        <td height="34" valign="top"><input type="submit" name="submit" value="UpdateValue" class="comment-button"></td> 
     128                      </form> 
     129                    </tr> 
     130        {/if} 
     131        {if $admin and $i.slotID < 4 and $fixSlot} 
     132                    <tr class="kb-table-row-even"> 
     133                      <form method="post" action=""> 
     134                        <td height="34" colspan="3" valign="top"> 
     135                            <div align="right"> 
     136                                Fix slot:  
     137                                <input name="IID" value="{$i.itemID}" type="hidden"> 
     138                                <input name="KID" value="{$KillId}" type="hidden"> 
     139                                                                <input name="TYPE" value="destroyed" type="hidden"> 
     140                                                                <input name="OLDSLOT" value="{$i.slotID}" type="hidden">                                 
     141                                <input name="{$i.itemID}" type="text" class="comment-button" value="{$i.slotID}" size="6"> 
     142                            </div> 
     143                        <td height="34" valign="top"><input type="submit" name="submit" value="UpdateSlot" class="comment-button"></td> 
     144                      </form> 
     145                    </tr> 
     146        {/if} 
    140147    {/foreach} 
    141     {foreach from=$dropped.$slotindex.items item=i} 
     148    {foreach from=$dropped.$slotindex item=i} 
    142149                <tr class="kb-table-row-odd" style="background-color: green;"> 
    143150                    <td style="border: 1px solid green;" width="32" height="34" valign="top"><a href="?a=invtype&id={$i.itemID}">{$i.Icon}</a></td> 
     
    148155        {/if} 
    149156                </tr> 
    150         {if $admin and $config->get('item_values')} 
     157        {if $admin and $config->get('item_values') and !$fixSlot} 
    151158                    <tr class="kb-table-row-even"> 
    152159                      <form method="post" action=""> 
     
    158165                            </div> 
    159166                        <td height="34" valign="top"><input type="submit" name="submit" value="Update" class="comment-button"></td> 
     167                      </form> 
     168                    </tr> 
     169        {/if} 
     170        {if $admin and $i.slotID < 4 and $fixSlot} 
     171                    <tr class="kb-table-row-even"> 
     172                      <form method="post" action=""> 
     173                        <td height="34" colspan="3" valign="top"> 
     174                            <div align="right"> 
     175                                Fix slot:  
     176                                <input name="IID" value="{$i.itemID}" type="hidden"> 
     177                                <input name="KID" value="{$KillId}" type="hidden"> 
     178                                                                <input name="TYPE" value="dropped" type="hidden"> 
     179                                                                <input name="OLDSLOT" value="{$i.slotID}" type="hidden">                                 
     180                                <input name="{$i.itemID}" type="text" class="comment-button" value="{$i.slotID}" size="6"> 
     181                            </div> 
     182                        <td height="34" valign="top"><input type="submit" name="submit" value="UpdateSlot" class="comment-button"></td> 
    160183                      </form> 
    161184                    </tr>