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


PHP Basket::addEvent方法代码示例

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


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

示例1: action_ajax

 public function action_ajax()
 {
     $r = Yii::app()->request;
     $c = $this->config;
     switch ($r->getParam('action')) {
         case 'addProduct':
             $model = new Basket('addProduct');
             $model->product_id = $r->getParam('product_id');
             $model->count = $r->getParam('count');
             echo json_encode((int) $model->addProduct());
             break;
         case 'addEvent':
             $model = new Basket('addEvent');
             $model->event_id = $r->getParam('event_id');
             $model->count = $r->getParam('count');
             echo json_encode((int) $model->addEvent());
             break;
         case 'changeCount':
             $basket = $this->loadBasket($r->getParam('id'));
             if ((int) $r->getParam('count') == 1 && $basket->count < 1000 || (int) $r->getParam('count') == -1 && $basket->count > 1) {
                 $basket->saveCounters(array('count' => (int) $r->getParam('count')));
                 echo json_encode(1);
             } else {
                 echo json_encode(0);
             }
             break;
         case 'removeFromBasket':
             $basket = $this->loadBasket($r->getParam('id'));
             echo json_encode((int) $basket->delete());
             break;
         default:
             echo json_encode(null);
             break;
     }
 }
开发者ID:postfx,项目名称:fermion,代码行数:35,代码来源:BasketController.php

示例2: process

 public function process()
 {
     $event = Events::getById($this->getElementvalue('event'));
     Basket::addEvent($event, $this->ticketCosts[$event['id']]);
 }
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:5,代码来源:FormAddToBasket.php

示例3: testAdd

 public function testAdd()
 {
     $event = array('id' => 1);
     Basket::addEvent($event, 1.99);
 }
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:5,代码来源:BasketTest.php

示例4: redirect

require_once 'includes/classes/FormAddToBasket.php';
require_once 'includes/classes/Basket.php';
use libAllure\Session;
use libAllure\Sanitizer;
use libAllure\DatabaseFactory;
if (!Session::isLoggedIn()) {
    redirect('login.php', 'You need to <a href = "login.php">login</a> or <a href = "register.php">register</a> to pay for events.');
}
$sanitizer = new Sanitizer();
$action = $sanitizer->filterString('action');
if (isset($_REQUEST['event'])) {
    $eventId = intval($_REQUEST['event']);
    $event = Events::getById($eventId);
    switch ($action) {
        case 'addPersonal':
            Basket::addEvent($event);
            redirect('basket.php', 'Ticked added', false, 1);
        case 'delete':
            Basket::removeEvent($event, $_REQUEST['user']);
            redirect('basket.php', 'Ticket removed', false, -1);
    }
}
$signupableEvents = Events::getSignupableEvents();
$tpl->assign('signupableEvents', $signupableEvents);
$formAddToBasket = new FormAddToBasket($signupableEvents);
if ($formAddToBasket->validate()) {
    $formAddToBasket->process();
    redirect('basket.php', 'Ticket added to basket');
}
$tpl->assign('addToBasketHasEvents', $formAddToBasket->hasEvents);
$tpl->assignForm($formAddToBasket, 'addToBasket');
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:31,代码来源:basket.php


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