Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • CheckoutStep
  • CheckoutStep_ContactDetails
  • CheckoutStep_Membership
  • CheckoutStep_PaymentMethod
  • CheckoutStep_Summary
  • SteppedCheckout
  1 <?php
  2 
  3 /**
  4  * Авторизация и регистрация
  5  *
  6  * @package cart
  7  * @subpackage steppedcheckout
  8  * @author dvp
  9  */
 10 class CheckoutStep_Membership extends CheckoutStep{
 11 
 12     static $allowed_actions = array('membership', 'LoginForm');
 13     static $skip_if_logged_in = true;
 14     
 15     function StepIsActive() {
 16         $conf = SiteConfig::current_site_config();      
 17         // Регистрация недоступна
 18         if (!$conf->CartRegistraionAvailable()) {       
 19             return false;
 20         }
 21         // пользователь уже авторизован - можно прыгнуть на след. шаг
 22         if (self::$skip_if_logged_in && Member::currentUser()) {
 23             return false;
 24         }       
 25         return true;
 26     }
 27     
 28     /**
 29      * Шаг авторизации
 30      */
 31     function membership() {
 32         $conf = SiteConfig::current_site_config();
 33         
 34         // Регистрация недоступна
 35         if (!$conf->CartRegistraionAvailable()) {
 36             Director::redirect($this->NextStepLink());
 37             return;
 38         }
 39 
 40         // пользователь уже авторизован - можно прыгнуть на след. шаг
 41         if (self::$skip_if_logged_in && Member::currentUser()) {
 42             Director::redirect($this->NextStepLink());
 43             return;
 44         }
 45 
 46         Session::set('BackURL', $this->owner->Link());
 47         $rs = array(
 48             'Title' => $this->stepTitle(),
 49             'Content' => $this->stepMessage(),
 50             'Form' => $this->LoginForm(),
 51         );
 52         if (Member::currentUser() || !$conf->CartRegisterRequire) {
 53             $rs['NextLink'] = $this->NextStepLink();
 54         }
 55         if ($conf->CartRegisterEnabled) {
 56             $rs['RegistrationLink'] = RegistrationPage::find_link();
 57         }
 58         return $rs;
 59         
 60     }
 61 
 62     /**
 63      * Форма авторизации
 64      * 
 65      * Дополнительно можно зарегистрировать нового пользователя или продолжить без регистрации в зависимости от настроек магазина
 66      * 
 67      * @return Form
 68      */
 69     function LoginForm(){
 70         $conf = SiteConfig::current_site_config();
 71         $form = new MemberLoginForm($this->owner, 'LoginForm');
 72         if (Member::currentUser()) {
 73             $form->actions()->push(new FormAction("docontinue", _t('CheckoutPage.NextButton', "Continue")));
 74         }
 75         else {
 76             /*
 77             if ($conf->CartRegisterEnabled) {
 78                 $form->actions()->push(new FormAction("createaccount", _t('CheckoutPage.CreateAccountButton', "Create an Account")));
 79             }
 80             if (!$conf->CartRegisterRequire) {
 81                 $form->actions()->push(new FormAction("docontinue", _t('CheckoutPage.GuestButton', "Continue as Guest")));
 82             }
 83             */
 84         }
 85         
 86         $this->owner->extend('updateLoginForm', $form);
 87         return $form;
 88     }
 89 
 90     function docontinue(){
 91         $this->owner->redirect($this->NextStepLink());
 92     }
 93 
 94     function createaccount($requestdata){
 95         // пользователь авторизован - создавать не надо
 96         if (Member::currentUser()) { 
 97             Director::redirect($this->NextStepLink());
 98             return;
 99         }
100         
101         Session::set('BackURL', $this->owner->Link());
102         Director::redirect(RegistrationPage::find_link());
103     }
104 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0