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; }
if ($featureCreditsName != 'N') { $GBSQL = "SELECT * FROM totstorage WHERE _storagecode = '" . $featureCreditsName . "' AND _itemcode = 'current'"; $query = $GBC->_GBUser->query($GBSQL); if ($query->numRows() > 0) { $totstorage = $query->fetchAll(); $TotItems = $totstorage['0']['_amount']; } } //echo "Tatget obj count". $TotItems.'<BR>' ; if ($UnitCapacity > $TotItems) { $TableClass = ' class="sofT" '; } else { $TableClass = ' class="sofTfull" '; } // write the header of the table. echo '<br><b>' . GBHead($GBC->GB_get_friendlyName($TargetObject['itemName'])) . "</b> Name: " . $TargetObject['itemName'] . " State: " . $TargetObject['state'] . " Code: " . $Unit['_code'] . " Capacity: " . $UnitCapacity . " level: " . $level . " id: " . $TargetObject['id'] . "<br>"; echo '<table ' . $TableClass . ' 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 ' . $TargetObject['itemName'] . '</td></tr>'; echo '<form method="post">'; //?url=settings_buildwi echo '<input name="url" type="hidden" value="' . $GB_url . '" >'; //which items fit into this building? $GBSQL = "SELECT _itemCode ,_allowKeyword, _limit FROM StorageConfig WHERE _part = '0' AND _name ='" . $Unit['_storageType_itemClass'] . "'"; if ($Building['_name'] == 'hatchstorage') { $GBSQL = "SELECT _itemCode ,_allowKeyword, _limit FROM StorageConfig WHERE _part = '0' AND _name ='" . $Unit['_name'] . "'"; } // added $query = $GBC->_GBMain->query($GBSQL); $GB_AllItemPosible1 = $query->fetchAll(SQLITE_ASSOC); $j = 0; $GB_AllItemPosible = array(); $GBSQL = "SELECT _code AS _itemCode FROM units WHERE _keyword = '" . $GB_AllItemPosible1['0']['_allowKeyword'] . "'";