本文整理汇总了PHP中Gekosale\App::getFormModel方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getFormModel方法的具体用法?PHP App::getFormModel怎么用?PHP App::getFormModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gekosale\App
的用法示例。
在下文中一共展示了App::getFormModel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($registry, $designPath = NULL)
{
$this->registry = $registry;
$this->id = $this->registry->core->getParam();
$this->model = \Gekosale\App::getModel($this->getName());
$this->formModel = \Gekosale\App::getFormModel($this->getName());
}
示例2: index
public function index()
{
$form = App::getFormModel('clientlogin')->initForm();
if ($form->Validate()) {
$formData = $form->getSubmitValues();
$clean = App::getModel('formprotection')->cropDangerousCodeSubmitedValues($formData);
if ($clean == true) {
$result = App::getModel('clientlogin')->authProccess($formData['login'], $formData['password']);
if ($result > 0) {
Session::setActiveClientid($result);
App::getModel('clientlogin')->checkClientGroup();
App::getModel('clientlogin')->setLoginTime();
$this->model->saveClientData();
$misingCart = App::getModel('missingcart')->checkMissingCartForClient($result);
if (isset($formData['autologin']) && $formData['autologin'] == 1) {
App::getModel('clientlogin')->setAutologinKey($result);
} else {
App::getModel('clientlogin')->destroyAutologinKey();
}
if (is_array($misingCart) && !empty($misingCart)) {
App::getModel('cart')->addProductsToCartFromMissingCart($misingCart);
App::getModel('missingcart')->cleanMissingCart(Session::getActiveClientid());
}
if (($this->Cart = Session::getActiveCart()) != NULL) {
App::redirectUrl($this->registry->router->generate('frontend.cart', true));
} else {
App::redirectUrl($this->registry->router->generate('frontend.home', true));
}
} elseif ($result < 0) {
Session::setVolatileUserLoginError(2, false);
} else {
Session::setVolatileUserLoginError(1, false);
}
}
}
if ($this->getParam() == 'changed') {
$this->registry->template->assign('clientChangedMail', _('TXT_LOGGOUT_CHANGED_EMAIL'));
}
$error = Session::getVolatileUserLoginError();
if ($error[0] == 1) {
$this->registry->template->assign('loginerror', _('ERR_BAD_LOGIN_OR_PASSWORD'));
} elseif ($error[0] == 2) {
$this->registry->template->assign('loginerror', _('TXT_BLOKED_USER'));
}
$this->registry->template->assign('form', $form->getForm());
return $this->registry->template->fetch($this->loadTemplate('index.tpl'));
}
示例3: index
public function index()
{
// limit available delivery countries
$dispatchmethod = Session::getActiveDispatchmethodChecked();
// list of country ids which are specified for selected delivery method
$countryids = App::getModel('delivery')->getDispatchmethodCountries($dispatchmethod['dispatchmethodid']);
$clientorder = App::getModel('finalization')->setClientOrder();
if (empty($clientorder['cart'])) {
App::redirectUrl($this->registry->router->generate('frontend.cart', true));
}
if (Session::getActiveClientid() == NULL) {
$formLogin = App::getFormModel('clientlogin')->initForm();
if ($formLogin->Validate()) {
$formLoginData = $formLogin->getSubmitValues();
$result = App::getModel('clientlogin')->authProccess($formLoginData['login'], $formLoginData['password']);
if ($result > 0) {
Session::setActiveClientid($result);
App::getModel('clientlogin')->checkClientGroup();
App::getModel('clientlogin')->setLoginTime();
$this->clientModel->saveClientData();
$misingCart = App::getModel('missingcart')->checkMissingCartForClient(Session::getActiveClientid());
if (is_array($misingCart) && $misingCart != 0) {
App::getModel('cart')->addProductsToCartFromMissingCart($misingCart);
App::getModel('missingcart')->cleanMissingCart(Session::getActiveClientid());
}
if (($this->Cart = Session::getActiveCart()) != NULL) {
App::redirectUrl($this->registry->router->generate('frontend.checkout', true));
} else {
App::redirectUrl($this->registry->router->generate('frontend.home', true));
}
} elseif ($result < 0) {
Session::setVolatileUserLoginError(2, false);
} else {
Session::setVolatileUserLoginError(1, false);
}
}
$error = Session::getVolatileUserLoginError();
if ($error[0] == 1) {
$this->registry->template->assign('loginerror', _('ERR_BAD_LOGIN_OR_PASSWORD'));
} elseif ($error[0] == 2) {
$this->registry->template->assign('loginerror', _('TXT_BLOKED_USER'));
}
$this->registry->template->assign('formLogin', $formLogin->getForm());
}
$form = new SimpleForm\Form(array('name' => 'order', 'action' => '', 'method' => 'post'));
$billingClientType = $form->AddChild(new SimpleForm\Elements\Radio(array('name' => 'billing_clienttype', 'label' => _('TXT_CLIENT_TYPE'), 'options' => array('1' => _('TXT_INDIVIDUAL_CLIENT'), '2' => _('TXT_COMPANY_CLIENT')))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_companyname', 'label' => _('TXT_COMPANYNAME'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_COMPANYNAME'), $billingClientType, new SimpleForm\Conditions\Equals('2'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_nip', 'label' => _('TXT_NIP'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_NIP'), $billingClientType, new SimpleForm\Conditions\Equals('2'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_street', 'label' => _('TXT_STREET'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_STREET'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_placeno', 'label' => _('TXT_PLACENO'))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_placename', 'label' => _('TXT_PLACE'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_PLACE'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'billing_postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_POSTCODE'))))));
$form->AddChild(new SimpleForm\Elements\Select(array('name' => 'billing_country', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => App::getModel('lists')->getCountryForSelect($countryids), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
$otherAddress = $form->AddChild(new SimpleForm\Elements\Checkbox(array('name' => 'other_address', 'label' => _('TXT_OTHER_DELIVERY_ADRESS'), 'default' => 0)));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'shipping_firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_FIRSTNAME'), $otherAddress, new SimpleForm\Conditions\Equals('1'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'shipping_surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_SURNAME'), $otherAddress, new SimpleForm\Conditions\Equals('1'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'shipping_companyname', 'label' => _('TXT_COMPANYNAME'))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'shipping_street', 'label' => _('TXT_STREET'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_STREET'), $otherAddress, new SimpleForm\Conditions\Equals('0'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'shipping_streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_STREETNO'), $otherAddress, new SimpleForm\Conditions\Equals('0'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'shipping_placeno', 'label' => _('TXT_PLACENO'))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'shipping_placename', 'label' => _('TXT_PLACE'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_PLACE'), $otherAddress, new SimpleForm\Conditions\Equals('0'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'shipping_postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_POSTCODE'), $otherAddress, new SimpleForm\Conditions\Equals('0'))))));
$form->AddChild(new SimpleForm\Elements\Select(array('name' => 'shipping_country', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => App::getModel('lists')->getCountryForSelect($countryids), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_NAME_OF_COUNTRY'), $otherAddress, new SimpleForm\Conditions\Equals('0'))))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_PHONE')), new SimpleForm\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'phone2', 'label' => _('TXT_ADDITIONAL_PHONE'), 'rules' => array(new SimpleForm\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
$form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_EMAIL')), new SimpleForm\Rules\Email(_('ERR_WRONG_EMAIL'))))));
if ((int) Session::getActiveClientid() == 0) {
$createAccount = $form->AddChild(new SimpleForm\Elements\Checkbox(array('name' => 'create_account', 'label' => _('TXT_CHECKOUT_CREATE_ACCOUNT'), 'default' => 1)));
$newPassword = $form->AddChild(new SimpleForm\Elements\Password(array('name' => 'password', 'label' => _('TXT_PASSWORD'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_PASSWORD'), $createAccount, new SimpleForm\Conditions\Equals('1'))))));
$form->AddChild(new SimpleForm\Elements\Password(array('name' => 'confirmpassword', 'label' => _('TXT_PASSWORD_REPEAT'), 'rules' => array(new SimpleForm\Rules\RequiredDependency(_('ERR_EMPTY_CONFIRM_PASSWORD'), $createAccount, new SimpleForm\Conditions\Equals('1')), new SimpleForm\Rules\Compare(_('ERR_PASSWORDS_NOT_COMPATIBILE'), $newPassword)))));
$form->AddChild(new SimpleForm\Elements\Checkbox(array('name' => 'confirmterms', 'label' => sprintf(_('TXT_ACCEPT_TERMS_AND_POLICY_OF_PRIVATE'), App::getModel('staticcontent')->getConditionsLink(), Session::getActiveShopName()), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_TERMS_NOT_AGREED'))), 'default' => 0)));
$form->AddChild(new SimpleForm\Elements\Checkbox(array('name' => 'newsletter', 'label' => _('TXT_NEWSLETTER_SIGNUP'), 'default' => 0)));
}
$clientData = $this->clientModel->getClient();
$clientBillingAddress = $this->clientModel->getClientAddress(1);
$clientShippingAddress = $this->clientModel->getClientAddress(0);
$form->Populate(array('billing_clienttype' => $clientBillingAddress['clienttype'], 'other_address' => 0, 'create_account' => 1, 'phone' => isset($clientData['phone']) ? $clientData['phone'] : '', 'phone2' => isset($clientData['phone2']) ? $clientData['phone2'] : '', 'email' => isset($clientData['email']) ? $clientData['email'] : '', 'billing_firstname' => $clientBillingAddress['firstname'], 'billing_surname' => $clientBillingAddress['surname'], 'billing_companyname' => $clientBillingAddress['companyname'], 'billing_nip' => $clientBillingAddress['nip'], 'billing_street' => $clientBillingAddress['street'], 'billing_streetno' => $clientBillingAddress['streetno'], 'billing_placeno' => $clientBillingAddress['placeno'], 'billing_placename' => $clientBillingAddress['placename'], 'billing_postcode' => $clientBillingAddress['postcode'], 'billing_country' => $clientBillingAddress['countryid'], 'shipping_firstname' => $clientShippingAddress['firstname'], 'shipping_surname' => $clientShippingAddress['surname'], 'shipping_companyname' => $clientShippingAddress['companyname'], 'shipping_nip' => $clientShippingAddress['nip'], 'shipping_street' => $clientShippingAddress['street'], 'shipping_streetno' => $clientShippingAddress['streetno'], 'shipping_placeno' => $clientShippingAddress['placeno'], 'shipping_placename' => $clientShippingAddress['placename'], 'shipping_postcode' => $clientShippingAddress['postcode'], 'shipping_country' => $clientShippingAddress['countryid']));
if ($form->Validate()) {
$formData = $form->getSubmitValues();
$Data['clientaddress'] = array('firstname' => $formData['billing_firstname'], 'surname' => $formData['billing_surname'], 'companyname' => $formData['billing_clienttype'] == 2 ? $formData['billing_companyname'] : '', 'nip' => $formData['billing_clienttype'] == 2 ? $formData['billing_nip'] : '', 'street' => $formData['billing_street'], 'streetno' => $formData['billing_streetno'], 'placeno' => $formData['billing_placeno'], 'placename' => $formData['billing_placename'], 'postcode' => $formData['billing_postcode'], 'countryid' => $formData['billing_country'], 'clienttype' => $formData['billing_clienttype']);
if (!empty($formData['other_address'])) {
$Data['deliveryAddress'] = array('firstname' => $formData['shipping_firstname'], 'surname' => $formData['shipping_surname'], 'companyname' => $formData['shipping_companyname'], 'street' => $formData['shipping_street'], 'streetno' => $formData['shipping_streetno'], 'placeno' => $formData['shipping_placeno'], 'placename' => $formData['shipping_placename'], 'postcode' => $formData['shipping_postcode'], 'countryid' => $formData['shipping_country']);
} else {
$Data['deliveryAddress'] = $Data['clientaddress'];
}
$recurMail = 0;
if (!empty($formData['create_account'])) {
$recurMail = $this->clientModel->checkClientNewMail($formData);
if ($recurMail == 0) {
$clientData = $Data['clientaddress'];
$clientData['email'] = $formData['email'];
$clientData['password'] = $formData['password'];
$clientData['newsletter'] = $formData['newsletter'];
$clientData['phone'] = $formData['phone'];
$clientData['phone2'] = $formData['phone2'];
$clientId = $this->clientModel->addNewClient($clientData);
$result = App::getModel('clientlogin')->authProccess($formData['email'], $formData['password']);
//.........这里部分代码省略.........
示例4: index
public function index()
{
// support for enable/disable registration
if (isset($this->layer['enableregistration']) && $this->layer['enableregistration'] == 1) {
if (strlen($this->registry->core->getParam()) > 10) {
$checkClient = $this->model->checkClientLink($this->registry->core->getParam());
if (count($checkClient > 0)) {
$result = App::getModel('clientlogin')->authProccessConfirmation($checkClient['email'], $checkClient['password']);
if ($result != 0) {
Session::setActiveClientid($result);
App::getModel('clientlogin')->checkClientGroup();
$this->model->saveClientData();
}
if (($this->Cart = Session::getActiveCart()) != NULL) {
App::redirectUrl($this->registry->router->generate('frontend.cart', true));
} else {
App::redirectUrl($this->registry->router->generate('frontend.home', true));
}
}
}
$form = App::getFormModel('registration')->initForm();
if ($form->Validate()) {
$formData = $form->getSubmitValues();
$recurMail = $this->model->checkClientNewMail($formData);
if ($recurMail == 0) {
$clientId = $this->model->addNewClient($formData);
if (isset($this->layer['confirmregistration']) && $this->layer['confirmregistration'] == 1) {
$link = $this->model->updateClientDisable($clientId, 1, sha1($formData['email'] . time()));
$this->registry->template->assign('activelink', $link);
}
$this->registry->template->assign('address', $formData);
App::getModel('mailer')->sendEmail(array('template' => 'addClient', 'email' => array($formData['email']), 'bcc' => false, 'subject' => _('TXT_REGISTRATION_NEW'), 'viewid' => Helper::getViewId()));
if (isset($this->layer['confirmregistration']) && $this->layer['confirmregistration'] == 1) {
Session::setVolatileActivationRequired(1, false);
} else {
Session::setVolatileRegistrationOk(1, false);
$result = App::getModel('clientlogin')->authProccess($formData['email'], $formData['password']);
if ($result > 0) {
Session::setActiveClientid($result);
App::getModel('clientlogin')->checkClientGroup();
$this->model->saveClientData();
}
if ($result < 0) {
Session::setVolatileActivationRequired(1, false);
} else {
Session::setVolatileRegistrationOk(1, false);
App::redirectUrl($this->registry->router->generate('frontend.clientsettings', true));
}
}
} else {
$result = App::getModel('clientlogin')->authProccess($formData['email'], $formData['password']);
if ($result != 0) {
Session::setActiveClientid($result);
App::getModel('clientlogin')->checkClientGroup();
$this->model->saveClientData();
Session::setVolatileRegistrationOk(1, false);
App::redirectUrl($this->registry->router->generate('frontend.clientsettings', true));
} elseif ($result < 0) {
Session::setVolatileActivationRequired(1, false);
} else {
Session::setVolatileRecureMail(1, false);
}
}
}
$this->registry->template->assign('form', $form->getForm());
$activationrequired = Session::getVolatileActivationRequired();
if ($activationrequired[0] == 1) {
$this->registry->template->assign('error', _('TXT_ACTIVATION_REQUIRED'));
$this->registry->template->assign('error_msg', _('TXT_ACTIVATION_REQUIRED_MSG'));
}
$recureMailError = Session::getVolatileRecureMail();
if ($recureMailError[0] == 1) {
$this->registry->template->assign('error', _('ERR_DUPLICATE_EMAIL'));
$this->registry->template->assign('error', _('ERR_DUPLICATE_EMAIL_MSG'));
}
$forbiddenCode = Session::getVolatileForbiddenCode();
if ($forbiddenCode[0] == 1) {
$this->registry->template->assign('error', _('TXT_ERROR_FORBIDDEN_CODE'));
$this->registry->template->assign('error', _('TXT_ERROR_FORBIDDEN_CODE_MSG'));
}
$passwdGenError = Session::getVolatilePasswordGenerateError();
if ($passwdGenError[0] == 1) {
$this->registry->template->assign('error', _('ERROR_PASSWORD_GENERATE'));
$this->registry->template->assign('error', _('ERROR_PASSWORD_GENERATE_MSG'));
}
return $this->registry->template->fetch($this->loadTemplate('index.tpl'));
} else {
$this->registry->template->assign('error', _('TXT_REGISTRATION_DISABLED_HELP'));
}
}
示例5: __construct
public function __construct($registry)
{
parent::__construct($registry);
$this->model = App::getModel('controllerseo');
$this->formModel = App::getFormModel('controllerseo');
}