当前位置: 首页>>代码示例>>PHP>>正文


PHP Phone::getPhoneById方法代码示例

本文整理汇总了PHP中Phone::getPhoneById方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::getPhoneById方法的具体用法?PHP Phone::getPhoneById怎么用?PHP Phone::getPhoneById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phone的用法示例。


在下文中一共展示了Phone::getPhoneById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

    }
    if ($member) {
        ?>
<div class="col-md-8">
    <div class="page-header">
        <h1>Éditer une promotion</h1>
    </div>

    <form action="index.php?page=admin/promotion-edit&amp;id=<?php 
        echo $id;
        ?>
" method="POST">
        <div class="form-group">
            <label for="phone">Téléphone</label>
            <p><?php 
        echo Phone::getPhoneById($promotion->phone)->name;
        ?>
</p>
        </div>
        <div class="form-group">
            <label for="promotion-percent">Pourcentage</label>
            <input type="text" class="form-control" id="promotion-percent" value="<?php 
        echo $promotion->percent;
        ?>
" name="percent" placeholder="Pourcentage">
        </div>
        
        <button type="submit" class="btn btn-lg btn-primary" name="edit">Éditer</button>
    </form>
</div>
开发者ID:HadrienX,项目名称:PhoneDeals,代码行数:30,代码来源:promotion-edit.php

示例2: array

<?php

if (isset($_POST['action'])) {
    if ($_POST['action'] == 'add') {
        $phone = Phone::getPhoneById($_POST['id']);
        // Si la session existe, alors on initialise la valeur dans une variable
        if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) {
            $cart = $_SESSION['cart'];
        } else {
            $cart = array('phones' => array(), 'phone_total' => (int) 0, 'price_total' => (int) 0);
        }
        // Lorsqu'on ajoute un téléphone, on le stocke dans un tableau
        array_push($cart['phones'], array('id' => (int) $phone->id, 'name' => $phone->name, 'price' => (int) $_POST['price'], 'amount' => (int) $_POST['amount'], 'capacity' => (int) $_POST['capacity'], 'color' => (int) $_POST['color']));
        // On précise que les données entrés précédement correspondent à la variable $cart pour les ajouter dans la session
        $_SESSION['cart'] = $cart;
        $_SESSION['cart']['phone_total'] = $_SESSION['cart']['phone_total'] + $_POST['amount'];
        $_SESSION['cart']['price_total'] = $_SESSION['cart']['price_total'] + $phone->price;
        $msg->success('Le téléphone a bien été ajouté au panier.', 'index.php?page=cart');
    } elseif ($_POST['action'] == 'remove') {
        $_SESSION['cart']['phone_total'] = $_SESSION['cart']['phone_total'] - $_SESSION['cart']['phones'][$_POST['id']]['amount'];
        $_SESSION['cart']['price_total'] = $_SESSION['cart']['price_total'] - $_SESSION['cart']['phones'][$_POST['id']]['price'] * $_SESSION['cart']['phones'][$_POST['id']]['amount'];
        unset($_SESSION['cart']['phones'][$_POST['id']]);
        // App::dd($_SESSION['cart']['phones']);
        $msg->success('Le produit a bie été supprimé de votre panier', 'index.php?page=cart');
    } else {
        echo 'Erreur';
    }
} else {
    $empty = true;
    $phonesTotal = 0;
    if (isset($_SESSION['cart']['phones']) && !empty($_SESSION['cart']['phones'])) {
开发者ID:HadrienX,项目名称:PhoneDeals,代码行数:31,代码来源:cart.php

示例3: getNewPrice

 public static function getNewPrice($promotionId)
 {
     $promotion = self::getPromotionByPhoneId($promotionId);
     $phone = Phone::getPhoneById($promotion->phone);
     return $phone->price - $promotion->percent * 0.01 * $phone->price;
 }
开发者ID:HadrienX,项目名称:PhoneDeals,代码行数:6,代码来源:Promotion.class.php

示例4:

<div class="container">
	<div class="row">
		<?php 
if (!isset($_GET['id']) || empty($_GET['id'])) {
    App::redirect('index.php?page=list');
} else {
    $id = $_GET['id'];
    $phone = Phone::getPhoneById($id);
    $promotion = Promotion::getPromotionByPhoneId($phone->id);
    $brand = Brand::getBrandById($phone->brand);
    ?>
			<div class="col-sm-12" style="margin-bottom: 30px;">
				<h1 style="margin-bottom: 0;"><?php 
    echo $phone->name;
    ?>
</h1>
				<span style="color: #bfbfbf; display: block; font-size: 18px;"><?php 
    echo $brand->name;
    ?>
</span>
			</div>
			<div class="col-md-4 col-sm-6 col-xs-12">
				<a href="index.php?page=product&amp;id=<?php 
    echo $phone->id;
    ?>
" style="display: inline-block; padding: 15px; border: 1px solid #ededed;">
					<img id="phone_img" src="<?php 
    echo Phone::getPhoneThumbnail($phone->id);
    ?>
" alt="<?php 
    echo $phone->name;
开发者ID:HadrienX,项目名称:PhoneDeals,代码行数:31,代码来源:product.php

示例5: foreach

    ?>
		<table class="table table-striped">
			<thead>
				<th>Téléphone</th>
				<th>Pourcentage</th>
				<th>Prix de base</th>
				<th>Prix réduit</th>
				<th></th>
				<th></th>
			</thead>
			<?php 
    foreach (Promotion::getPromotionsList() as $promotion) {
        echo '<tr data-id="' . $promotion->id . '">';
        echo '<td><a href="index.php?page=admin/promotion-edit&amp;id=' . $promotion->id . '">' . Phone::getPhoneById($promotion->phone)->name . '</a></td>';
        echo '<td>' . $promotion->percent . ' %</td>';
        echo '<td>' . Phone::getPhoneById($promotion->phone)->price . ' &euro;</td>';
        echo '<td>' . Promotion::getNewPrice($promotion->phone) . ' &euro;</td>';
        echo '<td><a href="index.php?page=admin/promotion-edit&amp;id=' . $promotion->id . '"><i class="fa fa-pencil" data-toggle="tooltip" title="Modifier"></i></a></td>';
        echo '<td><a href="#" title="Supprimer" data-toggle="tooltip" data-action="delete" title="Supprimer"><i class="fa fa-trash"></i></a></td>';
        echo '</tr>';
    }
    ?>
		</table>
		<a href="index.php?page=admin/add-promotion" class="btn btn-primary">Ajouter une promotion</a>
	<?php 
} else {
    echo '<p>Aucune promotion n\'a été ajouté.</p>';
}
?>
</div>
<script>
开发者ID:HadrienX,项目名称:PhoneDeals,代码行数:31,代码来源:promotions-list.php


注:本文中的Phone::getPhoneById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。