本文整理汇总了PHP中Orders::Model方法的典型用法代码示例。如果您正苦于以下问题:PHP Orders::Model方法的具体用法?PHP Orders::Model怎么用?PHP Orders::Model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orders
的用法示例。
在下文中一共展示了Orders::Model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeData
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());
}
}
}
示例2: foreach
<?php
$topTenItems = $this->getTopTenByProfit();
foreach ($topTenItems as $item) {
$i++;
if ($i % 2) {
echo "<tr class='odd'>";
} else {
echo "<tr>";
}
$name = $item['typeName'];
$volume = $item['totalVolume'];
$profit = $item['totalProfit'];
$typeID = $item['typeID'];
$icon = $this->getIcon($typeID);
//get order data
$orders = Orders::Model()->find('typeID=:typeID AND orderState = 0 AND charID IN (' . implode(',', $this->getMembersAsCharIDArray(Yii::app()->user->trackingGroupID)) . ')', array(':typeID' => $typeID));
if (empty($orders)) {
$orderText = "No Orders";
} else {
$orderText = number_format($orders->volRemaining) . "/" . number_format($orders->volEntered) . " (" . floor($orders->volRemaining / $orders->volEntered * 100) . "%)";
}
echo '<td><div class="textCenter"><img height="16" width="16" src="./images/items/' . $icon . '"><a href="index.php?r=wallet/item&id=' . $typeID . '">' . $name . '</a></div></td>';
echo "<td>{$orderText}</td>";
echo '<td style="text-align: right;"><font color="green">+' . number_format($profit, 0) . '</font></td>';
echo "</tr>";
}
?>
</table>
</div>
</div>
示例3: getOrderTotal
public function getOrderTotal($characterID)
{
//Get the character information from the db
$character = Characters::model()->findByPk($characterID);
$criteria = new CDbCriteria();
$criteria->condition = 'charID=:characterID AND orderState=0 AND bid=0';
$criteria->params = array(':characterID' => $character->characterID);
$orders = Orders::Model()->findAll($criteria);
foreach ($orders as $order) {
$orderTotal = $orderTotal + $order->price * $order->volRemaining;
}
return $orderTotal;
}
示例4: foreach
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);
echo "<td><div class='textCenter'><img height='16' width='16' src='http://image.eveonline.com/Type/{$icon}'> <a href='index.php?r=wallet/item&id={$itemDetails->typeID}'>{$itemDetails->typeName}</a></div></td>\n";
#echo "<td><div class='textCenter'><img height='16' width='16' src='images/items/$icon'>$itemDetails->typeName</div></td>\n";