Exemplo n.º 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>";
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Assets();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Assets'])) {
         $model->attributes = $_POST['Assets'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->itemID));
         }
     }
     $this->render('create', array('model' => $model));
 }
Exemplo n.º 3
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();
             }
             //}
         }
     }
 }