*/ /** * Klasa przechowuje metody komponentu użytkownika. * * @author Bartosz Alejski * * @package stUser * @subpackage actions */ class stUserComponents extends sfComponents { /** * Zwraca aktualnego użytkownika * * @return stUser */ public function getUser() { return parent::getUser(); } /** * Wywołanie komponentu sprawdzającego status zalogowania użytkowniak */ public function executeLoginStatus() { $this->smarty = new stSmarty('stUser'); $this->is_authenticated = false; if($this->getUser()->isAuthenticated()) { $content = $this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser'); if ($content) { $c = new Criteria(); $c->add(sfGuardUserPeer::ID, $this->getUser()->getAttribute('user_id', null, 'sfGuardSecurityUser')); $user = sfGuardUserPeer::doSelectOne($c); if(is_object($user)) { $this->is_authenticated = true; $login = $user->getUsername(); $login_username = explode("@", $login); $this->username = $login_username[0]; $password = $user->getPassword(); $config_points = stConfig::getInstance('stPointsBackend'); $config_points->setCulture(sfContext::getInstance()->getUser()->getCulture()); $this->points_value = stPoints::getLoginStatusPoints(); $this->points_show = $config_points->get('points_show_in_login_status'); $this->points_shortcut = $config_points->get('points_shortcut', null, true); $this->points_system_is_active = stPoints::isPointsSystemActive(); if($this->getUser()->checkPassword("anonymous")) { $this->account_type = "annonymous"; } else { $this->account_type = "full"; } if($user->getExternalAccount()) { $this->externalAccount = $user->getExternalAccount(); $this->account_type = "external"; } } } } } public function executeBasketLoginForm() { $this->smarty = new stSmarty('stUser'); $user_config = stConfig::getInstance(sfContext::getInstance(), 'stUser'); $this->login_google_on = $user_config->get('google_auth_on'); if ($this->getRequest()->getMethod() == sfRequest::POST && $this->hasRequestParameter('submit_login')) { $this->login_show_error = 1; } } public function executeAjaxLoginModal() { $this->smarty = new stSmarty('stUser'); } public function executeUserSidebar() { $config_observe = stConfig::getInstance(sfContext::getInstance(), 'stProductObserveBackend'); $config_recently = stConfig::getInstance(sfContext::getInstance(), 'stRecentlyViewedProductsBackend'); if($config_observe->get('enabled')!=1 && $config_recently->get('enabled')!=1){ return sfView::NONE; } if($config_observe->get('enabled')!=1 && $config_recently->get('show_in_sidebar')!=1){ return sfView::NONE; } $this->smarty = new stSmarty('stUser'); } }