/**
  * Get the dashboard rep id, if applicable
  * null otherwise
  *
  * @param Mage_Core_Model_Store
  * @return string|null
  */
 public function getDashboardRepId(Mage_Core_Model_Store $store)
 {
     if ($store->isAdmin()) {
         $adminSession = $this->_getAdminSession();
         $csr = $adminSession->getCustomerServiceRep() ?: Mage::getModel('eb2ccsr/representative');
         $repId = $csr->getRepId();
         if ($repId) {
             return $repId;
         }
         $adminUser = $adminSession->getUser();
         return $adminUser ? $adminUser->getUsername() : null;
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * Transform a given store into a new base url.
  *
  * @param \Mage_Core_Model_Store $store
  * @param bool $secure
  * @return string
  * @throws \InvalidArgumentException when $secure is not a boolean
  */
 public function transformBaseUrl(\Mage_Core_Model_Store $store, $secure = false)
 {
     if (!is_bool($secure)) {
         throw new \InvalidArgumentException('Invalid value for $secure supplied. Expected a boolean. Got: ' . gettype($secure));
     }
     $currentUrl = $store->getBaseUrl($store::URL_TYPE_LINK, $secure);
     $path = parse_url($currentUrl, PHP_URL_PATH);
     // The executable somehow ends up in the admin store URL.
     if ($store->isAdmin()) {
         // Let's strip it out.
         $path = preg_replace(sprintf('/^\\/%s/', preg_quote($this->getPharName())), '', $path);
     }
     $scheme = parse_url($currentUrl, PHP_URL_SCHEME);
     $domain = $this->createDomain($store);
     return "{$scheme}://{$domain}{$path}";
 }