public function run($args) { $characters = Characters::model()->findAll(); foreach ($characters as $character) { echo "Found character {$character->characterName}\n"; $walletInterface = new APITransactions(); $journalInterface = new APIJournal(); $ordersInterface = new APIOrders(); $assetsInterface = new APIAssetList(); $sheetInterface = new APICharacterSheet(); //Wallet if (!$walletInterface->getCacheExpiration($character->walletID) && $character->walletEnabled) { echo "Updating transactions...\n"; $walletInterface->storeData($character->walletID); } //Journal if (!$journalInterface->getCacheExpiration($character->walletID) && $character->journalEnabled) { echo "Updating journal...\n"; $journalInterface->storeData($character->walletID); } //Orders if (!$ordersInterface->getCacheExpiration($character->walletID) && $character->ordersEnabled) { echo "Updating orders...\n"; $ordersInterface->storeData($character->walletID); } /* //Assets if(!($assetsInterface->getCacheExpiration($character->walletID))) { echo "Updating assets...\n"; $assetsInterface->storeData($character->walletID); } */ //Balance if (!$sheetInterface->getCacheExpiration($character->walletID) && $character->displayBalance) { echo "Updating balances...\n"; $sheet = $sheetInterface->getEveData($character->walletID); $sheetBalance = $sheet->result->balance[0][0]; $balance = (double) $sheetBalance; $balanceRow = new Balances(); $balanceRow->characterID = $character->characterID; $balanceRow->balanceDateTime = $this->getEveTimeSql(); $balanceRow->balance = $balance; $balanceRow->save(); } } }
<?php $group = $this->getDefaultTrackingGroup(Yii::app()->user->trackingGroupID); $groupMembers = $this->getTrackingGroupMembers($group->trackingGroupID); $journalInterface = new APIJournal(); foreach ($groupMembers as $member) { $character = Characters::Model()->findByPk($member->characterID); if ($character->journalEnabled) { $journalInterface->storeData($member->characterID); } }
<?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",