public function initContext($format = null)
 {
     parent::initContext($format);
     // Hack to prevent duplicate content-type headers
     $pos = false;
     $response = $this->getResponse();
     $headers = $response->getHeaders();
     $response->clearHeaders();
     foreach ($headers as $header) {
         $name = $header['name'];
         $value = $header['value'];
         $replace = $header['replace'];
         if (strtolower($name) == 'content-type') {
             if ($pos === true) {
                 continue;
             }
             $pos = true;
         }
         $response->setHeader($name, $value, $replace);
     }
     if (null === $this->_currentContext || !$this->getAutoSwitchLayout()) {
         return;
     }
     $layoutName = $this->getLayout($this->_currentContext);
     if ($layoutName) {
         $layout = Zend_Layout::getMvcInstance();
         $layout->enableLayout()->setLayout($layoutName);
     }
 }
 /**
  * 设置对话框布局
  *
  * @param  string $format
  * @return void
  */
 public function initContext($format = null)
 {
     $this->_currentContext = null;
     $this->setAutoDisableLayout(false);
     $this->setCallback('inbox', self::TRIGGER_POST, '_callbackPost');
     return parent::initContext($format);
 }
Exemplo n.º 3
0
 /**
  * Initialize AJAX context switching
  *
  * Checks for XHR requests; if detected, attempts to perform context switch.
  * 
  * @param  string $format 
  * @return void
  */
 public function initContext($format = null)
 {
     $this->_currentContext = null;
     if (!$this->getRequest()->isXmlHttpRequest()) {
         return;
     }
     return parent::initContext($format);
 }
Exemplo n.º 4
0
 /**
  * Initialize AJAX context switching
  *
  * Checks for XHR requests; if detected, attempts to perform context switch.
  *
  * @param  string $format
  * @return void
  */
 public function initContext($format = null)
 {
     $this->_currentContext = null;
     $request = $this->getRequest();
     if (!method_exists($request, 'isXmlHttpRequest') || !$this->getRequest()->isXmlHttpRequest()) {
         return;
     }
     return parent::initContext($format);
 }
Exemplo n.º 5
0
 public function initContext($format = null)
 {
     parent::initContext($format);
     // Hack to prevent duplicate content-type headers
     $pos = false;
     $headers = $this->getResponse()->getHeaders();
     foreach ($headers as $key => $value) {
         if (strtolower($key) == 'content-type') {
             if (!$pos) {
                 $pos = $key;
             } else {
                 unset($headers[$pos]);
             }
         }
     }
     if (null === $this->_currentContext || !$this->getAutoSwitchLayout()) {
         return;
     }
     $layoutName = $this->getLayout($this->_currentContext);
     if ($layoutName) {
         $layout = Zend_Layout::getMvcInstance();
         $layout->enableLayout()->setLayout($layoutName);
     }
 }
Exemplo n.º 6
0
 /**
  * Initialize Iphone context switching
  *
  * Checks if HTTP_USER_AGENT contains "iphone" or "ipod". if detected,
  * attempts to perform context switch.
  *
  * @param  string $format
  * @return void
  */
 public function initContext($format = null)
 {
     // give paret's implementation presedence, in case format
     // parameter was passed
     parent::initContext($format);
     // context found, skip iphone detection
     if ($this->_currentContext != null) {
         return;
     }
     $ipod = strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'ipod');
     $iphone = strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'iphone');
     if ($ipod === false && $iphone === false) {
         // nope, no iphone
         return;
     }
     $suffix = $this->getSuffix('iphone');
     $this->_getViewRenderer()->setViewSuffix($suffix);
     $this->_currentContext = 'iphone';
 }