コード例 #1
0
ファイル: Profile.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Bind only profiles with same login
  *
  * @param \XLite\Model\Profile $profile Profile
  *
  * @return \XLite\Model\QueryBuilder\AQueryBuilder
  */
 public function bindSameLogin(\XLite\Model\Profile $profile)
 {
     return $this->andWhere('p.login = :login')->andWhere('p.profile_id != :profileId')->setParameter('login', $profile->getLogin())->setParameter('profileId', $profile->getProfileId() ?: 0);
 }
コード例 #2
0
ファイル: Search.php プロジェクト: kingsj/core
 /**
  * Preprocess profile
  *
  * @param \XLite\Model\Profile $profile Profile
  * @param array                $column  Column data
  * @param \XLite\Model\Order   $entity  Order
  *
  * @return string
  */
 protected function preprocessProfile(\XLite\Model\Profile $profile, array $column, \XLite\Model\Order $entity)
 {
     $address = $profile->getBillingAddress() ?: $profile->getShippingAddress();
     return $address ? $address->getName() : $profile->getLogin();
 }
コード例 #3
0
ファイル: Auth.php プロジェクト: kingsj/core
 /**
  * Updates the specified profile on login. Saves profile to session
  *
  * @param \XLite\Model\Profile $profile Profile object
  *
  * @return boolean
  */
 public function loginProfile(\XLite\Model\Profile $profile)
 {
     $result = $profile->isPersistent();
     if ($result) {
         // Restart session
         \XLite\Core\Session::getInstance()->restart();
         $loginTime = time();
         // Check for the fisrt time login
         if (!$profile->getFirstLogin()) {
             // Set first login date
             $profile->setFirstLogin($loginTime);
         }
         // Set last login date
         $profile->setLastLogin($loginTime);
         // Update profile
         $profile->update();
         // Save profile Id in session
         \XLite\Core\Session::getInstance()->profile_id = $profile->getProfileId();
         // Save login in cookies
         $this->rememberLogin($profile->getLogin());
     }
     return $result;
 }
コード例 #4
0
 /**
  * {@inheritDoc}
  */
 public function getLogin()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLogin', array());
     return parent::getLogin();
 }
コード例 #5
0
ファイル: XPaymentsClient.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Prepare address data
  *
  * @param \XLite\Model\Profile $profile Customer's profile
  * @param $type Address type, billing or shipping
  *
  * @return array
  */
 protected function prepareAddress(\XLite\Model\Profile $profile, $type = 'billing')
 {
     $result = array();
     $addressFields = array('firstname' => 'N/A', 'lastname' => '', 'address' => 'N/A', 'city' => 'N/A', 'state' => 'N/A', 'country' => 'N/A', 'zipcode' => 'N/A', 'phone' => '', 'fax' => '', 'company' => '');
     $repo = \XLite\Core\Database::getRepo('\\XLite\\Model\\AddressField');
     $type = $type . 'Address';
     foreach ($addressFields as $field => $defValue) {
         $method = 'address' == $field ? 'street' : $field;
         $address = $profile->{$type};
         if ($address && ($repo->findOneBy(array('serviceName' => $method)) || method_exists($address, 'get' . $method)) && $address->{$method}) {
             $result[$field] = is_object($profile->{$type}->{$method}) ? $profile->{$type}->{$method}->getCode() : $profile->{$type}->{$method};
         }
         if (empty($result[$field])) {
             $result[$field] = $defValue;
         }
     }
     $result['email'] = $profile->getLogin();
     return $result;
 }
コード例 #6
0
ファイル: Auth.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Updates the specified profile on login. Saves profile to session
  *
  * @param \XLite\Model\Profile $profile Profile object
  *
  * @return boolean
  */
 public function loginProfile(\XLite\Model\Profile $profile)
 {
     $result = $profile->isPersistent();
     if ($result) {
         // Restart session
         \XLite\Core\Session::getInstance()->restart();
         $loginTime = \XLite\Core\Converter::time();
         // Check for the first time login
         if (!$profile->getFirstLogin()) {
             // Set first login date
             $profile->setFirstLogin($loginTime);
         }
         $profile->setCountOfLoginAttempts(0);
         $profile->setDateOfLoginAttempt(0);
         // Set last login date
         $profile->setLastLogin($loginTime);
         // Update profile
         $profile->update();
         // Save profile Id in session
         \XLite\Core\Session::getInstance()->profile_id = $profile->getProfileId();
         \XLite\Core\Session::getInstance()->forceChangePassword = $profile->getForceChangePassword();
         // Save login in cookies
         $this->rememberLogin($profile->getLogin());
     }
     return $result;
 }
コード例 #7
0
ファイル: ProfileAbstract.php プロジェクト: kewaunited/xcart
 /**
  * Define query for findOneAnonymousByProfile() method
  *
  * @param \XLite\Model\Profile $profile Profile
  *
  * @return \XLite\Model\QueryBuilder\AQueryBuilder
  */
 protected function defineFindOneAnonymousByProfileQuery(\XLite\Model\Profile $profile)
 {
     return $this->createQueryBuilder()->bindAnonymous()->bindAndCondition('p.login', $profile->getLogin());
 }
コード例 #8
0
ファイル: Mailer.php プロジェクト: kewaunited/xcart
 /**
  * Send notification about updated profile to the user
  *
  * @param \XLite\Model\Profile $profile  Profile object
  * @param string               $password Profile password OPTIONAL
  *
  * @return void
  */
 public static function sendProfileUpdatedCustomer(\XLite\Model\Profile $profile, $password = null)
 {
     $interface = $profile->isAdmin() ? \XLite::ADMIN_SELF : \XLite::CART_SELF;
     $url = \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('login', '', array(), $interface));
     static::register(array('profile' => $profile, 'password' => $password, 'url' => $url));
     static::compose(static::TYPE_PROFILE_UPDATED_CUSTOMER, static::getSiteAdministratorMail(), $profile->getLogin(), 'profile_modified', array(), true, \XLite::CUSTOMER_INTERFACE, static::getMailer()->getLanguageCode(\XLite::CUSTOMER_INTERFACE, $profile->getLanguage()));
 }
コード例 #9
0
ファイル: Profile.php プロジェクト: kingsj/core
 /**
  * Define query for findUserWithSameLogin() method
  *
  * @param \XLite\Model\Profile $profile Profile object
  *
  * @return \Doctrine\ORM\QueryBuilder
  */
 protected function defineFindUserWithSameLoginQuery(\XLite\Model\Profile $profile)
 {
     $queryBuilder = $this->createQueryBuilder()->andWhere('p.login = :login')->andWhere('p.profile_id != :profileId')->setParameter('login', $profile->getLogin())->setParameter('profileId', $profile->getProfileId() ?: 0)->setMaxResults(1);
     if ($profile->getOrder()) {
         $queryBuilder->innerJoin('p.order', 'porder')->andWhere('porder.order_id = :orderId')->setParameter('orderId', $profile->getOrder()->getOrderId());
     } else {
         $queryBuilder->andWhere('p.order is null');
     }
     return $queryBuilder;
 }