public function getMembersAsCharIDArray($groupID) { $members = TrackingGroupMembers::Model()->findAll('trackingGroupID=:groupID', array(':groupID' => $groupID)); foreach ($members as $member) { $character = Characters::Model()->findByPk($member->characterID); $memberArray[] = $character->characterID; } return $memberArray; }
public function getCharacters() { $groupMembers = TrackingGroupMembers::Model()->findAll('trackingGroupID=:trackingGroupID', array(':trackingGroupID' => Yii::app()->user->trackingGroupID)); foreach ($groupMembers as $member) { $character = Characters::Model()->findByPk($member->characterID); $charArray[$character->characterID] = $character->characterName; } return $charArray; }
public function storeData($walletID) { $attributes = $this->apiAttributes(); //Retrieve the XML dataset $orders = $this->getEVEData($walletID); $character = Characters::Model()->findByPk($walletID); Orders::Model()->deleteAll('charID=:charID', array(':charID' => $character->characterID)); foreach ($orders->result->rowset->row as $row) { $exist = Orders::Model()->exists('orderID=:orderID', array(':orderID' => $row->attributes()->orderID)); if (!$exist) { //echo "ORDERID: {$row->attributes()->orderID} <br>"; $orderRow = new Orders(); $orderRow->orderID = $row->attributes()->orderID; $orderRow->charID = $row->attributes()->charID; $orderRow->stationID = $row->attributes()->stationID; $orderRow->volEntered = $row->attributes()->volEntered; $orderRow->volRemaining = $row->attributes()->volRemaining; $orderRow->minVolume = $row->attributes()->minVolume; $orderRow->orderState = $row->attributes()->orderState; $orderRow->typeID = $row->attributes()->typeID; $orderRow->range = $row->attributes()->range; $orderRow->accountKey = $row->attributes()->accountKey; $orderRow->duration = $row->attributes()->duration; $orderRow->escrow = $row->attributes()->escrow; $orderRow->price = $row->attributes()->price; $orderRow->bid = $row->attributes()->bid; $orderRow->issued = $row->attributes()->issued; $orderRow->save(); //print_r($orderRow->getErrors()); } else { //echo "ORDERID: {$row->attributes()->orderID} <br>"; $orderRow = Orders::Model()->findByPk($row->attributes()->orderID); $orderRow->orderID = $row->attributes()->orderID; $orderRow->charID = $row->attributes()->charID; $orderRow->stationID = $row->attributes()->stationID; $orderRow->volEntered = $row->attributes()->volEntered; $orderRow->volRemaining = $row->attributes()->volRemaining; $orderRow->minVolume = $row->attributes()->minVolume; $orderRow->orderState = $row->attributes()->orderState; $orderRow->typeID = $row->attributes()->typeID; $orderRow->range = $row->attributes()->range; $orderRow->accountKey = $row->attributes()->accountKey; $orderRow->duration = $row->attributes()->duration; $orderRow->escrow = $row->attributes()->escrow; $orderRow->price = $row->attributes()->price; $orderRow->bid = $row->attributes()->bid; $orderRow->issued = $row->attributes()->issued; $orderRow->save(); //print_r($orderRow->getErrors()); } } }
public function getCharacters() { //Grab the characters from the db $members = $this->getMembersAsArray(Yii::app()->user->trackingGroupID); $sqlarray = '(' . implode(',', $members) . ')'; $characters = Characters::Model()->findAll('walletID IN ' . $sqlarray . '', array(':accountID' => $userid)); foreach ($characters as $character) { $characterSheet = new APICharacterInfo(); $characterAPI = $characterSheet->getEVEData($character['walletID']); $characterInfos[] = $characterAPI->result; } return $characterInfos; }
public function storeData($walletID) { $attributes = $this->apiAttributes(); //Retrieve the XML dataset $transactions = $this->getEVEData($walletID); $character = Characters::Model()->findByPk($walletID); if (!isset($transactions->error)) { $row = $transactions->result->rowset->row; for ($i = count($row) - 1; $i >= 0; $i--) { if ($character->limitUpdate) { $orderTime = strtotime($row[$i]->attributes()->transactionDateTime); $timeLimit = strtotime($character->limitDate); } else { $orderTime = 1; $timeLimit = 0; } $exist = Wallet::Model()->exists('transactionID=:transactionID', array(':transactionID' => $row[$i]->attributes()->transactionID)); if ($exist == false && $orderTime > $timeLimit) { if ($row[$i]->attributes()->transactionFor == "personal") { $orderRow = new Wallet(); $orderRow->transactionDateTime = $row[$i]->attributes()->transactionDateTime; $orderRow->transactionID = $row[$i]->attributes()->transactionID; $orderRow->quantity = $row[$i]->attributes()->quantity; $orderRow->typeName = $row[$i]->attributes()->typeName; $orderRow->typeID = $row[$i]->attributes()->typeID; $orderRow->price = $row[$i]->attributes()->price; $orderRow->clientID = $row[$i]->attributes()->clientID; $orderRow->clientName = $row[$i]->attributes()->clientName; $orderRow->stationID = $row[$i]->attributes()->stationID; $orderRow->stationName = $row[$i]->attributes()->stationName; $orderRow->transactionType = $row[$i]->attributes()->transactionType; $orderRow->characterID = $walletID; $orderRow->personal = 0; $lastPrice = $this->lastStockPrice($orderRow->typeID, $orderRow, $character->walletID); if ($orderRow->transactionType == "buy") { $this->addStock($orderRow); } if ($lastPrice == 0 || $orderRow->transactionType == "buy") { $orderRow->profit = 0; } else { $orderRow->profit = $orderRow->quantity * $orderRow->price - $orderRow->quantity * $lastPrice; $this->subtractStock($orderRow, $orderRow->quantity, $character->walletID); } $orderRow->save(); print_r($orderRow->getErrors()); } } } } }
public static function load($characterID, $className = __CLASS__) { if (!isset($characterID)) { return false; } $character = Characters::Model()->find('characterID = :characterID', array(':characterID' => $characterID)); $sheetObject = new APICharacterSheet(); $sheetObject->_charSheetXML = $sheetObject->getEVEData($character->walletID); if ($sheetObject->_charSheetXML != false) { return $sheetObject; } else { return false; } }
public function actionUpdateCharacter($id) { $model = Characters::Model()->find('characterID=:characterID', array(':characterID' => $id)); // Generate the accounts dropdown list $accounts = Accounts::Model()->findAll(); foreach ($accounts as $account) { $accountsArray[$account->accountID] = $account->fullName; } if (isset($_POST['ajax']) && $_POST['ajax'] === 'characters-updateCharacter-form') { echo CActiveForm::validate($model); Yii::app()->end(); } if (isset($_POST['Characters'])) { $model->attributes = $_POST['Characters']; if ($model->validate()) { $model->save(); $this->redirect(array('index')); } } $this->render('updateCharacter', array('model' => $model, 'accountsArray' => $accountsArray)); }
public function storeData($walletID) { $attributes = $this->apiAttributes(); $character = Characters::Model()->findByPk($walletID); //Retrieve the XML dataset $journal = $this->getEVEData($walletID); if (!isset($journal->error)) { foreach ($journal->result->rowset->row as $row) { if ($character->limitUpdate) { $orderTime = strtotime($row->attributes()->date); $timeLimit = strtotime($character->limitDate); } else { $orderTime = 1; $timeLimit = 0; } $exist = Journal::Model()->exists('refID=:refID', array(':refID' => $row->attributes()->refID)); if (!$exist && $orderTime > $timeLimit) { $orderRow = new Journal(); $orderRow->date = $row->attributes()->date; $orderRow->refID = $row->attributes()->refID; $orderRow->refTypeID = $row->attributes()->refTypeID; $orderRow->ownerName1 = $row->attributes()->ownerName1; $orderRow->ownerID1 = $row->attributes()->ownerID1; $orderRow->ownerName2 = $row->attributes()->ownerName2; $orderRow->ownerID2 = $row->attributes()->ownerID2; $orderRow->argName1 = $row->attributes()->argName1; $orderRow->argID1 = $row->attributes()->argID1; $orderRow->amount = $row->attributes()->amount; $orderRow->balance = $row->attributes()->balance; $orderRow->reason = $row->attributes()->reason; $orderRow->characterID = $walletID; $orderRow->save(); } } } }
public function getTotalBalance() { $group = $this->getDefaultTrackingGroup(Yii::app()->user->trackingGroupID); $groupMembers = $this->getTrackingGroupMembers($group->trackingGroupID); foreach ($groupMembers as $member) { $character = Characters::Model()->findByPk($member->characterID); if ($character->displayBalance) { $criteria = new CDbCriteria(); $criteria->condition = 'characterID = :characterID'; $criteria->order = 'balanceDateTime DESC'; $criteria->params = array(':characterID' => $character->characterID); $balanceRow = Balances::Model()->find($criteria); $balance = $balance + $balanceRow->balance; } } return $balance; }
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(); } //} } } }
<?php //Acquire skill in training $characterTable = Characters::Model()->find('characterID=:characterID', array(':characterID' => $data->characterID)); $skillAPI = new APISkillInTraining(); $skills = $skillAPI->getEVEData($characterTable->walletID); ?> <div style="width: 100%;" class="characterstats"> <h1 class="header1"><B><?php echo $data->characterName; ?> </B></h1> <table> <tr> <td> <div style="width: 150px; height: 150px; margin-right: 2px;"> <img src="http://image.eveonline.com/Character/<?php echo $data->characterID; ?> _200.jpg" height="150" width="150"> </div> <div style="margin-top: 0px; margin-bottom: 0px; width: 150px;" class="affiliationstats"> <div style="width: 200px;"> <img src="http://image.eveonline.com/Corporation/<?php echo $data->corporationID; ?> _32.png" style="float:left; margin-right:2px;"> <div style="margin-left: 0px;">
public function getSkillLevel($characterID, $skillTypeID) { //Get the character information $character = Characters::Model()->find('characterID = :characterID', array(':characterID' => $characterID)); //Get the skill sheet $characterAPIInterface = new APICharacterSheet(); $characterSkillSheet = $characterAPIInterface->getEVEData($character->walletID); //Grab the specific skill data $skill = $characterSkillSheet->xpath("//rowset[@name='skills']/row[@typeID='" . $skillTypeID . "']"); if (!is_object($skill[0])) { return 0; } else { return $skill[0]->attributes()->level; } }
$group = $this->getDefaultTrackingGroup(Yii::app()->user->trackingGroupID); // Change this to work with the Station Selection Menu Item $prodStation = 60010822; //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'
<?php //Check on our cache value $orderInterface = new APIOrders(); $group = $this->getDefaultTrackingGroup(Yii::app()->user->trackingGroupID); $groupMembers = $this->getTrackingGroupMembers($group->trackingGroupID); foreach ($groupMembers as $member) { $orderInterface->getEveData($member->characterID); $character = Characters::Model()->findByPk($member->characterID); if ($character->ordersEnabled) { $orderInterface->storeData($member->characterID); } } echo "API Updated. Please refresh your page.";
$index = 0; foreach ($results as $row) { if ($index % 2) { echo "<tr class='odd'>"; } else { echo "<tr>"; } //Load the solarsystem information $systemInfo = new CDbCriteria(); $systemInfo->condition = 'solarSystemID=:solarSystemID'; $systemInfo->params = array(':solarSystemID' => $row->installedInSolarSystemID); $systemName = MapSolarSystems::Model()->find($systemInfo); $charInfo = new CDbCriteria(); $charInfo->condition = 'characterID=:characterID'; $charInfo->params = array(':characterID' => $row->installerID); $charName = Characters::Model()->find($charInfo); $itemInfo = new CDbCriteria(); $itemInfo->condition = 'typeID=:typeID'; $itemInfo->params = array(':typeID' => $row->installedItemTypeID); $itemName = Invtypes::Model()->find($itemInfo); $dateEnd = $row->endProductionTime; $dateBegin = $row->beginProductionTime; $dateNow = date('Y-m-d H:i:s', strtotime("+5 hour")); $diff = 100 - (strtotime($dateEnd) - strtotime($dateNow)) / (strtotime($dateEnd) - strtotime($dateBegin)) * 100; if ($diff < 0) { $diff = 0; } if ($diff > 100) { $diff = 100; } $diff = number_format($diff, 1, '.', '');
<?php $this->breadcrumbs = array('Overview'); $group = $this->getDefaultTrackingGroup(Yii::app()->user->trackingGroupID); $groupMembers = $this->getTrackingGroupMembers($group->trackingGroupID); $allMembers = Characters::Model()->findAll(); // Find all members foreach ($allMembers as $member) { $allMembersArray[] = $member->characterID; } $allMembersString = "(" . implode($allMembersArray, ',') . ")"; $journalInterface = new APIJournal(); if (!$journalInterface->getCacheExpiration($groupMembers[0]->characterID)) { ?> <script type="text/javascript"> $(function() { $.gritter.add({ title: 'Updating API', text: 'Your journal is being updated...', time: 4000, image: '<?php echo Yii::app()->request->baseUrl; ?> /images/repeat-icon.png' }); }); </script> <?php $updatejournal = CHtml::ajax(array('url' => 'index.php?r=mainPage/updatejournal', 'success' => 'js:function(){ $.gritter.add({ title: "Update Complete",