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


PHP Varien_Event_Observer::getUser方法代码示例

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


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

示例1: admin_session_user_login_success

 /**
  * Event admin_session_user_login_success
  *
  * @param   Varien_Event_Observer $event Event object
  * @return  void
  */
 public function admin_session_user_login_success(Varien_Event_Observer $event)
 {
     $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
     $tableName = Mage::getSingleton('core/resource')->getTableName('admin/user');
     $select = $connection->select()->from($tableName, 'default_backend_language')->where('user_id = ?', $event->getUser()->getId());
     $localeCode = $connection->fetchOne($select);
     if (false !== $localeCode) {
         Mage::getSingleton('adminhtml/session')->setLocale($localeCode);
     }
 }
开发者ID:nhp,项目名称:Aoe_BackendDefaultLanguage,代码行数:16,代码来源:Observer.php

示例2: checkVersion

 /**
  * Checks if a update request is necessary and performs it if so.
  *
  * @param Varien_Event_Observer $observer
  */
 public function checkVersion($observer)
 {
     $user = $observer->getUser();
     $extra = unserialize($user->getExtra());
     $lastCheck = Mage::getStoreConfig('payment/barzahlen/last_check');
     if (isset($extra['configState']['payment_barzahlen']) && $extra['configState']['payment_barzahlen'] == 1) {
         if ($lastCheck == null || $lastCheck < strtotime("-1 week")) {
             $config = new Mage_Core_Model_Config();
             $config->saveConfig('payment/barzahlen/last_check', time(), 'default', 0);
             Mage::getConfig()->cleanCache();
             $barzahlen = Mage::getSingleton('barzahlen/barzahlen');
             $check = Mage::getSingleton('barzahlen/api_version');
             $shopId = $barzahlen->getConfigData('shop_id') != null ? $barzahlen->getConfigData('shop_id') : $barzahlen->getConfigData('shop_id', 1);
             if ($check->isNewVersionAvailable($shopId, 'Magento', Mage::getVersion(), (string) Mage::getConfig()->getNode()->modules->ZerebroInternet_Barzahlen->version)) {
                 Mage::getSingleton('core/session')->addNotice(sprintf(Mage::helper('barzahlen')->__('bz_adm_now_available'), $check->getNewPluginVersion(), $check->getNewPluginUrl()));
             }
         }
     }
 }
开发者ID:TriplesenseReply,项目名称:Barzahlen-Magento,代码行数:24,代码来源:Observer.php

示例3: resetAttemptForBackend

 /**
  * Reset Attempts For Backend
  *
  * @param Varien_Event_Observer $observer
  * @return Mage_Captcha_Model_Observer
  */
 public function resetAttemptForBackend($observer)
 {
     return $this->_resetAttempt($observer->getUser()->getUsername());
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:10,代码来源:Observer.php

示例4: adminSessionLoginSuccess

 /**
  * Log successful admin sign in
  *
  * @param Varien_Event_Observer $observer
  */
 public function adminSessionLoginSuccess($observer)
 {
     $this->_logAdminLogin($observer->getUser()->getUsername(), $observer->getUser()->getId());
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:9,代码来源:Observer.php

示例5: trackAdminSuccessfulLogin

 /**
  * Track admin user successful logins
  *
  * @param Varien_Event_Observer $observer
  * @return null
  */
 public function trackAdminSuccessfulLogin(Varien_Event_Observer $observer)
 {
     $helper = Mage::helper('totango');
     $helper->log('Track successful admin user login');
     if (!$helper->isEnabled()) {
         return;
     }
     if ($helper->isTrackerEnabled('admin_login')) {
         $adminUser = $observer->getUser();
         $adminUsername = $adminUser->getUsername();
         $excludedAdminUsers = array_flip($helper->getExcludedAdminUsers());
         if (!isset($excludedAdminUsers[$adminUsername])) {
             // New login is not counted in this event.
             // So, this is a workaround for $adminUser->getLogDate()
             $logDate = Mage::getModel('core/date')->date('Y-m-d H:i:s');
             $helper->track(array('user-activity' => array('action' => 'AdminLogin', 'module' => 'Admin'), 'account-attribute' => array('Admin User Name' => $adminUser->getUsername(), 'Admin Last Login Time' => $logDate, 'Admin Login Number' => $adminUser->getLognum() + 1)));
         } else {
             $helper->log(array('message' => sprintf('Admin user "%s" is excluded from tracking', $adminUsername), 'level' => 5));
         }
     }
 }
开发者ID:shopgo-magento1,项目名称:magento-totango-integration,代码行数:27,代码来源:Observer.php


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