function GB_DetectBuildWI($entry, $GB_url)
 {
     $UnitCapacity = '';
     $output = '<br>';
     $GBObj = $this->GBSQLGetObjByID($entry['_storagecode']);
     $GBunit = $this->GBSQLGetUnitByName($GBObj['itemName']);
     $Storage = $entry['_storagecode'];
     $Target = $GBObj;
     //($Storage, $objects);
     if (!array_key_exists('isFullyBuilt', $Target)) {
         $Target['isFullyBuilt'] = "N";
     }
     if ($Target['isFullyBuilt'] == "1") {
         $GBunit = $this->GBSQLGetUnitByName($GBObj['itemName']);
         $UnitCapacity = $GBunit['_capacity'];
         if (array_key_exists('expansionLevel', $Target)) {
             $level = $Target['expansionLevel'];
             if ($level > 1) {
                 $GBSQL = "SELECT _capacity FROM unitbuilding WHERE _level = '" . $level . "' AND _buildingcode = '" . $GBunit['_code'] . "' ";
                 $result = $this->_GBMain->query($GBSQL);
                 $UnitCapacity = $result->fetchSingle();
             }
         } else {
             $level = 0;
         }
         $output .= '<br><b>' . GBHead($this->GB_get_friendlyName($GBObj['itemName'])) . "</b> State: " . $Target['state'] . " Code: " . $GBunit['_code'] . "  Capacity: " . $UnitCapacity . "  level: " . $level . "  id: " . $Target['id'] . "<br>";
         $output .= '<table class="sofT" cellspacing="0"><tr><td class="helpHed">Image</td><td class="helpHed">Amount</td><td class="helpHed">Name</td><td class="helpHed">Maximum</td><td class="helpHed">Amount to put in the ' . $Target['itemName'] . '</td></tr>';
         $output .= '<form action="' . GiftBox_URL . '" >';
         //?url=settings_buildwi
         $output .= '<input name="url" type="hidden" value="' . $GB_url . '" >';
         $GBSQL = "SELECT _itemcode FROM unitbuilding WHERE _buildingcode = '" . $GBunit['_code'] . "' ";
         $query = $this->_GBMain->query($GBSQL);
         $GB_AllItemPosible = $query->fetchAll(SQLITE_ASSOC);
         $ItemPNumMax = 0;
         foreach ($GB_AllItemPosible as $ItemP2) {
             // Set defaults
             $ItemInputVal = 0;
             $ItemPNum = 0;
             $ItemP = $ItemP2['_itemcode'];
             $GBaction = $this->GBSQLgetAction($ItemP);
             // check if there is data for this building
             if (array_key_exists("_target", $GBaction)) {
                 // data exist Check that it is this building
                 if ($GBaction['_target'] == $Target['id']) {
                     // Yes, it is this building
                     $ItemInputVal = $GBaction['_place_in_build'];
                 }
             }
             $ItemInput = '<input name="PTval" type="text" size="3" maxlength="3"  value="' . $ItemInputVal . '" >';
             $ItemInput .= '<input name="PTcode" type="hidden" value="' . $ItemP . '" >';
             $ItemInput .= '<input name="PTobj" type="hidden" value="' . $Target['id'] . '" >';
             $ItemInput .= '<input name="PTmax" type="hidden" value="' . $UnitCapacity . '" >';
             $ObjD = $this->GBSQLGetUnitByCode($ItemP);
             foreach ($GBObj['contents'] as $contents) {
                 if ($contents['itemCode'] == $ItemP) {
                     $ItemPNum = $contents['numItem'];
                 }
             }
             $GB_displ_name = $this->GB_get_friendlyName($ObjD['_name']) . '<br>[ ' . $ObjD['_name'] . ' ' . $ObjD['_code'] . ' ]';
             $ItemPNumMax = $ItemPNumMax + $ItemPNum;
             $output .= '<tr><td>' . GB_ShowIMG($ObjD) . '</td><td>' . $ItemPNum . '</td><td>' . $GB_displ_name . '</td><td>max ' . $UnitCapacity . '</td><td>' . $ItemInput . '</td></tr>';
         }
         $output .= '<tr><td></td><td></td><td>Currently in this building:</td><td>' . $ItemPNumMax . '</td><td>';
         $output .= '<input type="submit" name="submitPlaceThis"  value="Save" />';
         $output .= '<input type="submit" name="submitPlaceThis"  value="Set_All_999" />';
         $output .= '</form>';
         $output .= '</td></tr>';
         $output .= '</table>';
     }
     // if construction
     $output2['output'] = $output;
     $output2['Capacity'] = $UnitCapacity;
     $output2['NumbItems'] = $ItemPNumMax;
     return $output2;
 }
Exemple #2
0
    echo '<input type="hidden" name="ShowNow" value="ShowNow" /> ';
    echo '<input type="hidden" name="url" value="image" /> ';
    echo '</form></br><div class="icon">';
    echo '<br>';
    echo '<br>';
    if (isset($_POST['ShowNow'])) {
        echo 'showing now:<br><br><br><br>';
        $GBSQL = "SELECT iconurl,_name FROM units WHERE iconurl IS NOT NULL ";
        $query = $GBC->_GBMain->query($GBSQL);
        $x_units = $query->fetchAll();
        // retrieve them from DB
        //$x_units = array();
        //$x_units = GB_GetUnitList();
        foreach ($x_units as $value) {
            //echo " = " .$value['iconurl'];
            echo GB_ShowIMG($value);
        }
    }
    //end show now.
    echo '<br><br><br><br>';
}
//   ***************************************************************************
//   ***   Menu Screen
$GB_current_url = "settings_ImportNow";
//   ***
//   ***************************************************************************
if ($GB_url == $GB_current_url) {
    echo '<h2>Import actions</h2><p>';
    echo 'Here you can load the actions from file<br>';
    echo '<b> Make sure you have paused the bot !! </b><br>';
    echo '<hr>';