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


PHP Registration::load方法代码示例

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


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

示例1: __construct

 function __construct($id)
 {
     $this->registration = Registration::load(array('order_id' => $id));
     if (!$this->registration) {
         error_exit("That registration does not exist");
     }
     $this->event = Event::load(array('registration_id' => $this->registration->registration_id));
     registration_add_to_menu($this->registration);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:9,代码来源:RegistrationHandler.php

示例2: get_registration_for

 function get_registration_for($user_id = null)
 {
     return Registration::load(array('user_id' => $user_id, 'registration_id' => $this->registration_id));
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:4,代码来源:event.php

示例3: registration_permissions

function registration_permissions(&$user, $action, $id, $registration)
{
    global $lr_session;
    if (!$lr_session || !$lr_session->user) {
        return false;
    }
    switch ($action) {
        case 'view':
            if ($id && is_null($registration)) {
                $registration = Registration::load(array('order_id' => $id));
            }
            if (!is_null($registration) && $lr_session->is_complete() && $registration->user_id == $lr_session->user->user_id) {
                return 1;
            }
            break;
        case 'viewnotes':
        case 'edit':
        case 'addpayment':
        case 'delpayment':
            // Only admin can edit
            break;
        case 'register':
            // Only admins can register other players
            if (!is_null($id)) {
                return $id == $lr_session->user->user_id || $lr_session->is_admin();
            }
            // Otherwise, only players with completed profiles can register
            return $lr_session->user->is_active() && $lr_session->is_complete();
        case 'unregister':
            // Players may only unregister themselves from events before paying.
            // TODO: should be $registration->user_can_unregister()
            if ($lr_session->user->is_active() && $lr_session->is_complete() && $registration->user_id == $lr_session->user->user_id) {
                if ($registration->payment != 'Unpaid' && $registration->payment != 'Pending') {
                    // Don't allow user to unregister from paid events themselves -- admin must do it
                    return 0;
                }
                return 1;
            }
            return 0;
        case 'history':
            // Players with completed profiles can view their own history
            if ($id) {
                return $lr_session->is_complete() && $lr_session->user->user_id == $id;
            } else {
                return $lr_session->is_complete();
            }
        case 'statistics':
        case 'download':
            // admin only
            break;
    }
    return false;
}
开发者ID:roboshed,项目名称:leaguerunner,代码行数:53,代码来源:permissions.php

示例4: validatePayment

 /**
  * Checks information received from PayPal to ensure it's correct data.
  * If correct, stores updated transaction details.
  *
  * @param int $order_id Registration # of event being paid
  * @param float $mc_gross Amount paid by user during the PayPal checkout
  * @param int $paid_by User ID of player who made the payment
  */
 function validatePayment($order_id, $mc_gross, $paid_by)
 {
     // is the item number a valid registration?
     $registration = Registration::load(array('order_id' => $order_id));
     if (!$registration) {
         $status = array('status' => false, 'message' => 'Invalid Registration ID');
         return $status;
     }
     // has registration been already paid?
     //if ($registration->payment_type == 'Paid') {
     //	$status = array('status' => false, 'message' =>'Registration '.$order_id.' already paid in full');
     //	return $status;
     //}
     // is the registration attached to the correct Event
     $event = Event::load(array('registration_id' => $registration->registration_id));
     if (!$event) {
         $status = array('status' => false, 'message' => 'Invalid Event ID');
         return $status;
     }
     // does the price paid and registration cost match?
     if ($mc_gross != $event->cost) {
         $status = array('status' => false, 'message' => 'Amount Paid does not match Registration Cost');
         return $status;
     }
     // Payment is valid, and should be saved
     $payment = new RegistrationPayment();
     $payment->set('order_id', $registration->order_id);
     // TODO:  PDT returns from PayPal are logged under the Paypal account.
     // Would be nice to find a better way to do this instead of a Paypal user account
     $payment->set('entered_by', 999);
     // assign requrired values to the RegistrationPayment from the talkback results
     $payment->set('payment_type', 'Full');
     $payment->set('payment_amount', $mc_gross);
     $payment->set('payment_method', 'PayPal');
     $payment->set('paid_by', $paid_by);
     $payment->set('date_paid', date("Y-m-d"));
     // Save the payment if it's not already stored in the database
     // It's possible that the IPN payment beats the user PDT return.
     // Still need to ensure user is informed correctly, while not displaying any errors.
     if ($registration->payment_type != 'Paid') {
         if (!$payment->save()) {
             $status = array('status' => false, message => "Couldn't save payment to database");
             return $status;
         }
         // update registration in question
         $registration->set('payment', 'Paid');
         if (!$registration->save()) {
             $status = array('status' => false, message => "Internal error: couldn't save changes to registration");
         }
     }
     // if successful, return the $payment to handle/display to user
     return array('status' => true, 'message' => $payment);
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:61,代码来源:PaypalHandler.php


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