本文整理汇总了PHP中Assets::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Assets::save方法的具体用法?PHP Assets::save怎么用?PHP Assets::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assets
的用法示例。
在下文中一共展示了Assets::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseAssets
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: actionCreate
/**
* 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));
}
示例3: storeData
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;
//.........这里部分代码省略.........