예제 #1
0
 public function parseAssets($rowset, $characterID, $containerID)
 {
     //echo "Working on container: $containerID <br>";
     foreach ($rowset as $item) {
         if ($item->count() > 0) {
             //echo "Triggered next nest. Count = {$rowset->count()} <br>";
             $this->parseAssets($item->rowset->row, $characterID, $item->attributes()->itemID);
         }
         if (isset($item->attributes()->locationID)) {
             $locationName = $this->getLocationName($item->attributes()->locationID);
         }
         $invType = Invtypes::Model()->findByPk($item->attributes()->typeID);
         $asset = new Assets();
         $asset->characterID = $characterID;
         $asset->itemID = $item->attributes()->itemID;
         $asset->locationID = $item->attributes()->locationID;
         $asset->typeID = $item->attributes()->typeID;
         $asset->quantity = $item->attributes()->quantity;
         $asset->flag = $item->attributes()->flag;
         $asset->singleton = $item->attributes()->singleton;
         $asset->containerID = $containerID;
         $asset->locationName = $locationName;
         $asset->typeName = $invType->typeName;
         $asset->groupID = $invType->groupID;
         try {
             $asset->save();
             //echo "Item: {$asset->itemID} {$asset->typeName} Character: {$asset->characterID} Container: {$asset->containerID} <br>";
         } catch (Exception $e) {
             //echo "ERROR: Item {$asset->itemID} <br>";
             //echo "Item: {$asset->itemID} {$asset->typeName} Character: {$asset->characterID} Container: {$asset->containerID} <br>";
             //$message = $e->getMessage();
             //echo "Exception: $message <br>";
         }
     }
 }
예제 #2
0
 public function parseAssets($rowset, $characterID, $containerID)
 {
     foreach ($rowset as $item) {
         if ($item->count() > 0) {
             $this->parseAssets($item->rowset->row, $characterID, $item->attributes()->itemID);
         }
         if (isset($item->attributes()->locationID)) {
             $locationName = $this->getLocationName($item->attributes()->locationID);
         }
         $invType = Invtypes::Model()->findByPk($item->attributes()->typeID);
         $asset = new CorpAssets();
         $asset->characterID = $characterID;
         $asset->itemID = $item->attributes()->itemID;
         $asset->locationID = $item->attributes()->locationID;
         $asset->typeID = $item->attributes()->typeID;
         $asset->quantity = $item->attributes()->quantity;
         $asset->flag = $item->attributes()->flag;
         $asset->singleton = $item->attributes()->singleton;
         $asset->containerID = $containerID;
         $asset->locationName = $locationName;
         $asset->typeName = $invType->typeName;
         $asset->groupID = $invType->groupID;
         try {
             $asset->save();
         } catch (Exception $e) {
             $e->getMessage();
         }
     }
 }
예제 #3
0
 public function getMaterials($bpTypeID, $typeID, $pe = 0, $me = 0, $peSkill = 5)
 {
     //Get the blueprint details
     $blueprint = InvBlueprintTypes::Model()->findByPk($bpTypeID);
     //Get the invType material base requirements
     $requirements = InvTypeMaterials::Model()->findAll('typeID=:typeID', array(':typeID' => $typeID));
     //Loop through each mineral or part
     foreach ($requirements as $requirement) {
         //Get the invType details for each material
         $invType = Invtypes::Model()->findByPk($requirement->materialTypeID);
         $adjustedRequirements[] = array('typeName' => $invType->typeName, 'typeID' => $requirement->materialTypeID, 'quantity' => round($requirement->quantity * (1 + $blueprint->wasteFactor / (1 + $me) + (0.25 - 0.05 * $peSkill))));
     }
     return $adjustedRequirements;
 }
예제 #4
0
 public function __get($name)
 {
     if (preg_match("/id[0-9]*/i", $name)) {
         $fixedName = str_replace('id', '', $name);
         $skill = $this->_charSheetXML->xpath("//rowset[@name='skills']/row[@typeID='" . $fixedName . "']");
     } elseif (is_string($name)) {
         $fixedName = str_replace('_', ' ', $name);
         $invType = Invtypes::Model()->find("typeName=:typeName", array(":typeName" => $fixedName));
         if ($invType == NULL) {
             return 0;
         }
         $skill = $this->_charSheetXML->xpath("//rowset[@name='skills']/row[@typeID='" . $invType->typeID . "']");
     }
     if (!is_object($skill[0])) {
         return 0;
     } else {
         return $skill[0]->attributes()->level;
     }
 }
예제 #5
0
 public function storeData($walletID)
 {
     $attributes = $this->apiAttributes();
     //Retrieve the XML dataset
     $industryJobs = $this->getEVEData($walletID);
     $character = Characters::Model()->findByPk($walletID);
     if (!isset($industryJobs->error)) {
         foreach ($industryJobs->result->rowset->row as $row) {
             //if ($row->attributes()->installerID == $character->characterID)
             //{
             $exist = IndustryJobs::Model()->exists('jobID=:jobID', array(':jobID' => $row->attributes()->jobID));
             // If this job doesn't exist yet, create a new one and populate it
             if (!$exist) {
                 $jobRow = new IndustryJobs();
                 $jobRow->jobID = $row->attributes()->jobID;
                 $jobRow->assemblyLineID = $row->attributes()->assemblyLineID;
                 $jobRow->containerID = $row->attributes()->containerID;
                 $jobRow->installedItemID = $row->attributes()->installedItemID;
                 $jobRow->installedItemLocationID = $row->attributes()->installedItemLocationID;
                 $jobRow->installedItemQuantity = $row->attributes()->installedItemQuantity;
                 $jobRow->installedItemProductivityLevel = $row->attributes()->installedItemProductivityLevel;
                 $jobRow->installedItemMaterialLevel = $row->attributes()->installedItemMaterialLevel;
                 $jobRow->installedItemLicensedProductionRunsRemaining = $row->attributes()->installedItemLicensedProductionRunsRemaining;
                 $jobRow->outputLocationID = $row->attributes()->outputLocationID;
                 $jobRow->installerID = $row->attributes()->installerID;
                 $jobRow->runs = $row->attributes()->runs;
                 $jobRow->licensedProductionRuns = $row->attributes()->licensedProductionRuns;
                 $jobRow->installedInSolarSystemID = $row->attributes()->installedInSolarSystemID;
                 $jobRow->containerLocationID = $row->attributes()->containerLocationID;
                 $jobRow->materialMultiplier = $row->attributes()->materialMultiplier;
                 $jobRow->charMaterialMultiplier = $row->attributes()->charMaterialMultiplier;
                 $jobRow->timeMultiplier = $row->attributes()->timeMultiplier;
                 $jobRow->charTimeMultiplier = $row->attributes()->charTimeMultiplier;
                 $jobRow->installedItemTypeID = $row->attributes()->installedItemTypeID;
                 $jobRow->outputTypeID = $row->attributes()->outputTypeID;
                 $jobRow->containerTypeID = $row->attributes()->containerTypeID;
                 $jobRow->installedItemCopy = $row->attributes()->installedItemCopy;
                 $jobRow->completed = $row->attributes()->completed;
                 $jobRow->completedSuccessfully = $row->attributes()->completedSuccessfully;
                 $jobRow->installedItemFlag = $row->attributes()->installedItemFlag;
                 $jobRow->activityID = $row->attributes()->activityID;
                 $jobRow->completedStatus = $row->attributes()->completedStatus;
                 $jobRow->installTime = $row->attributes()->installTime;
                 $jobRow->outputFlag = $row->attributes()->outputFlag;
                 $jobRow->beginProductionTime = $row->attributes()->beginProductionTime;
                 $jobRow->endProductionTime = $row->attributes()->endProductionTime;
                 $jobRow->pauseProductionTime = $row->attributes()->pauseProductionTime;
                 $jobRow->save();
                 print_r($jobRow->getErrors());
             } else {
                 // Retrieve the job
                 $jobRow = IndustryJobs::Model()->findByPk($row->attributes()->jobID);
                 // Do we need to move this job to assets?
                 if ($jobRow->completed == 0 && $row->attributes()->completed == 1) {
                     //Get the typeID details
                     $typeID = Invtypes::Model()->findByPk($row->attributes()->outputTypeID);
                     //Create a new asset
                     $asset = new Assets();
                     $asset->characterID = $character->characterID;
                     $asset->locationID = $row->attributes()->installedItemLocationID;
                     $asset->typeID = $row->attributes()->outputTypeID;
                     $asset->quantity = $row->attributes()->runs;
                     $asset->flag = 4;
                     $asset->singleton = 0;
                     $asset->containerID = 0;
                     $asset->locationName = $this->getLocationName($row->attributes()->installedItemLocationID);
                     $asset->typeName = $typeID->typeName;
                     $asset->groupID = $typeID->groupID;
                     $asset->save();
                 }
                 // Update the job row with the new data from CCP
                 $jobRow->jobID = $row->attributes()->jobID;
                 $jobRow->assemblyLineID = $row->attributes()->assemblyLineID;
                 $jobRow->containerID = $row->attributes()->containerID;
                 $jobRow->installedItemID = $row->attributes()->installedItemID;
                 $jobRow->installedItemLocationID = $row->attributes()->installedItemLocationID;
                 $jobRow->installedItemQuantity = $row->attributes()->installedItemQuantity;
                 $jobRow->installedItemProductivityLevel = $row->attributes()->installedItemProductivityLevel;
                 $jobRow->installedItemMaterialLevel = $row->attributes()->installedItemMaterialLevel;
                 $jobRow->installedItemLicensedProductionRunsRemaining = $row->attributes()->installedItemLicensedProductionRunsRemaining;
                 $jobRow->outputLocationID = $row->attributes()->outputLocationID;
                 $jobRow->installerID = $row->attributes()->installerID;
                 $jobRow->runs = $row->attributes()->runs;
                 $jobRow->licensedProductionRuns = $row->attributes()->licensedProductionRuns;
                 $jobRow->installedInSolarSystemID = $row->attributes()->installedInSolarSystemID;
                 $jobRow->containerLocationID = $row->attributes()->containerLocationID;
                 $jobRow->materialMultiplier = $row->attributes()->materialMultiplier;
                 $jobRow->charMaterialMultiplier = $row->attributes()->charMaterialMultiplier;
                 $jobRow->timeMultiplier = $row->attributes()->timeMultiplier;
                 $jobRow->charTimeMultiplier = $row->attributes()->charTimeMultiplier;
                 $jobRow->installedItemTypeID = $row->attributes()->installedItemTypeID;
                 $jobRow->outputTypeID = $row->attributes()->outputTypeID;
                 $jobRow->containerTypeID = $row->attributes()->containerTypeID;
                 $jobRow->installedItemCopy = $row->attributes()->installedItemCopy;
                 $jobRow->completed = $row->attributes()->completed;
                 $jobRow->completedSuccessfully = $row->attributes()->completedSuccessfully;
                 $jobRow->installedItemFlag = $row->attributes()->installedItemFlag;
                 $jobRow->activityID = $row->attributes()->activityID;
                 $jobRow->completedStatus = $row->attributes()->completedStatus;
                 $jobRow->installTime = $row->attributes()->installTime;
                 $jobRow->outputFlag = $row->attributes()->outputFlag;
                 $jobRow->beginProductionTime = $row->attributes()->beginProductionTime;
                 $jobRow->endProductionTime = $row->attributes()->endProductionTime;
                 $jobRow->pauseProductionTime = $row->attributes()->pauseProductionTime;
                 $jobRow->save();
             }
             //}
         }
     }
 }
예제 #6
0
	</td>
	<td style="vertical-align:top">
	
	<div class="currentstats" style="width: 300px">
	<table>
		<tr class="header1">
			<td style="text-align: left; width: 100px;"><div class='textCenter'><img src="images/items/icon25_14.png" width="16" height="16">Training Item</div></td>
			<td style="text-align: left; width: 200px;">Detail</td>
		</tr>
		<tr>
			<td>Training</td>
		<?php 
if ($skills->result->skillInTraining == 0) {
    $currentSkill = "<font color='red'>There is no skill currently in training.</font>";
} else {
    $typeData = Invtypes::Model()->findByPk($skills->result->trainingTypeID);
    $level = $skills->result->trainingToLevel;
    $finishes = $skills->result->trainingEndTime;
    $starts = $skills->result->trainingStartTime;
    $currentSkill = "";
    $dateNow = date('Y-m-d H:i:s', strtotime("+4 hour"));
    $diff = 100 - (strtotime($finishes) - strtotime($dateNow)) / (strtotime($finishes) - strtotime($starts)) * 100;
    $diff = number_format($diff, 1, '.', '');
    if ($diff > 100) {
        $diff = 0;
    }
    $progressBar = "<div class='progress-container'><div style='width:{$diff}%'>{$diff}%</div></div>";
}
?>
		<td><?php 
echo "{$typeData->typeName} {$level} {$currentSkill}";
예제 #7
0
$index = 0;
$criteria = new CDbCriteria();
$criteria->select = 'SUM(quantity) AS quantity, typeID';
$criteria->order = 'typeName ASC';
$criteria->condition = 'groupID IN (915,525,643) GROUP BY typeID';
$results = Assets::Model()->findAll($criteria);
foreach ($results as $row) {
    if ($index % 2) {
        echo "<tr class='odd'>";
    } else {
        echo "<tr>";
    }
    $itemInfo = new CDbCriteria();
    $itemInfo->condition = 'typeID=:typeID';
    $itemInfo->params = array(':typeID' => $row->typeID);
    $itemName = Invtypes::Model()->find($itemInfo);
    //TEMP
    // Need to figure out BPC value
    $value = 1.0;
    echo "<td><div class='textCenter'><img style='height: 20px; width: 20px;' src='http://image.eveonline.com/Type/" . $row->typeID . "_32.png'><a href='index.php?r=wallet/item&id={$row->typeID}'>{$itemName->typeName}</div></td>";
    echo "<td style='text-align: right;'>{$row->quantity}</td>";
    echo "<td style='text-align: right;'>" . $value . "</td>";
    echo "<td style='text-align: right;'>Stock*Value</td>";
    echo "</tr>";
    $valueTotal = $valueTotal + $value;
    $stockTotal = $stockTotal + $row->quantity;
    $index++;
}
if ($index % 2) {
    echo "<tr class='odd'>";
} else {
 public function getTotalMineralRequirements($getMaterialsArray)
 {
     foreach ($getMaterialsArray as $part) {
         //Get the invType material base requirements
         $requirements = InvTypeMaterials::Model()->findAll('typeID=:typeID', array(':typeID' => $part['typeID']));
         foreach ($requirements as $requirement) {
             //Get the invType details for each material
             $invType = Invtypes::Model()->findByPk($requirement->materialTypeID);
             $mineralName = $invType->typeName;
             $minerals[$mineralName]['typeID'] = $requirement->materialTypeID;
             $minerals[$mineralName]['quantity'] += $requirement->quantity * $part['quantity'];
         }
     }
     return $minerals;
 }
예제 #9
0
//Get cached data values
$typeID = $this->phdGetCache("capitalCache");
$bpcMELevel = $this->phdGetCache("BPCMECache");
$charPELevel = $this->phdGetCache("charPECache");
$characterID = $this->phdGetCache("characterIDCache");
$sellPrice = $this->phdGetCache("priceSellCache");
$bpcPrice = $this->phdGetCache("priceBPCCache");
$partsPrice = $this->phdGetCache("priceCapitalPartsCache");
$slotPrice = $this->phdGetCache("priceSlotCache");
if ($characterID == 0) {
    $groupMembers = $this->getTrackingGroupMembers($group->trackingGroupID);
    $walletID = $groupMembers[0]->characterID;
    $characterID = Characters::Model()->findByPk($walletID)->characterID;
    $this->phdSetCache("characterIDCache", $characterID);
}
$invType = Invtypes::Model()->findByPk($typeID);
//Find the blueprint typeID
$bpTypeID = InvBlueprintTypes::Model()->find("productTypeID = :typeID", array(':typeID' => $invType->typeID));
//Load the skill sheet
$skillSheet = APICharacterSheet::load($characterID);
?>
<script type="text/javascript">
		jQuery(function($)
		{
			$('.bpcme').phdInlineInput({
				'label'		: 'Select',
				'getUrl' 	: 'capitalProduction/getbpcme',
				'submitUrl'	: 'capitalProduction/submitbpcme'
			});
			$('.pricesell').phdInlineInput({
				'label'		: 'Select',
예제 #10
0
 public function actionItem($id)
 {
     //Grab the characters from the db
     $members = $this->getMembersAsArray(Yii::app()->user->trackingGroupID);
     $sqlarray = '(' . implode(',', $members) . ')';
     //Fetch the sales of the item
     $criteria1 = new CDbCriteria();
     $criteria1->condition = 'typeID=:typeID AND transactionType = "sell" AND characterID IN ' . $sqlarray . '';
     $criteria1->params = array(':typeID' => $id);
     $criteria1->order = 'transactionDateTime DESC';
     //Grab the sales as a data provider
     $salesTransactions = new CActiveDataProvider('Wallet', array('pagination' => array('pageSize' => 5), 'criteria' => $criteria1));
     //Change to purchases
     $criteria2 = new CDbCriteria();
     $criteria2->condition = 'typeID=:typeID AND transactionType = "buy" AND characterID IN ' . $sqlarray . '';
     $criteria2->params = array(':typeID' => $id);
     $criteria2->order = 'transactionDateTime DESC';
     //Grab the purchases as a data provider
     $purchaseTransactions = new CActiveDataProvider('Wallet', array('pagination' => array('pageSize' => 5), 'criteria' => $criteria2));
     //Load the item details
     $item = Invtypes::Model()->findByPk($id);
     //Render the item view and pass along both data sets and item details
     $this->render('item', array('salesTransactions' => $salesTransactions, 'purchaseTransactions' => $purchaseTransactions, 'item' => $item));
 }
예제 #11
0
 echo "<td style='text-align: right;' class='header1'>Profit</td>\n";
 echo "<td style='text-align: right;' class='header1'>Profit/Unit</td>\n";
 echo "</tr>\n";
 $names++;
 $j = 0;
 //Loop through the items
 foreach ($group as $item) {
     $i++;
     $j++;
     if ($j % 2) {
         echo "<tr class='odd'>\n";
     } else {
         echo "<tr>\n";
     }
     //Get the item details
     $itemDetails = Invtypes::Model()->findByPk($item);
     //Get some order information
     $orders = Orders::Model()->find('typeID=:typeID AND orderState = 0', array(':typeID' => $item));
     if (empty($orders)) {
         $orderText = "<font color='#FFA824'>No Orders</font>";
     } else {
         $orderText = number_format($orders->volRemaining) . "/" . number_format($orders->volEntered) . " (" . floor($orders->volRemaining / $orders->volEntered * 100) . "%)";
     }
     //Get profit, volume, and icon information
     $details = $this->getProfitDetails($item);
     $detailsRow = $details->read();
     $profit = number_format($detailsRow['totalProfit']);
     $volume = number_format($detailsRow['totalVolume']);
     $perUnit = number_format($detailsRow['totalProfit'] / $detailsRow['totalVolume'], 0);
     $color = $this->numToColor($profit);
     $icon = $this->getIcon($itemDetails->typeID);
예제 #12
0
<td style="text-align: left; width: 70px;">Minerals</td>
<td style="text-align: right; width: 40px;">Last Null</td>
<td style="text-align: right; width: 60px;">Null Volume</td>
<td style="text-align: right; width: 60px;">Null Value</td>
<td style="text-align: right; width: 40px;">Last Jita</td>
<td style="text-align: right; width: 60px;">Jita Volume</td>
<td style="text-align: right; width: 60px;">Jita Value</td>
<td style="text-align: right; width: 40px;">Difference</td>
<td style="text-align: left; width: 150px;">% Difference</td>
</tr>

<?php 
$index = 0;
$mineralInfo = new CDbCriteria();
$mineralInfo->condition = 'groupID=18 AND published=1 ';
$minerals = Invtypes::Model()->findAll($mineralInfo);
foreach ($minerals as $row) {
    if ($index % 2) {
        echo "<tr class='odd'>";
    } else {
        echo "<tr>";
    }
    $icon = $this->getIcon($row->typeID);
    $lastNullPrice = $this->lastNullPrice($row->typeID);
    $lastJitaPrice = $this->lastJitaPrice($row->typeID);
    $lastJitaVolume = $this->lastJitaVolume($row->typeID, 30);
    $lastNullVolume = $this->lastNullVolume($row->typeID, 30);
    echo "<td><div class='textCenter'><img style='height: 20px; width: 20px;' src='http://image.eveonline.com/Type/{$icon}'><a href='index.php?r=wallet/item&id={$row->typeID}'>{$row->typeName}</div></td>";
    echo "<td style='text-align: right;'><font color='red'>" . number_format($lastNullPrice, 2) . "</font></td>";
    echo "<td style='text-align: right;'><font color='red'>" . number_format($lastNullVolume, 0) . "</font></td>";
    echo "<td style='text-align: right;'><font color='red'>" . number_format($lastNullPrice * $lastNullVolume, 0) . "</font></td>";