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


PHP Zend_Layout::resetMvcInstance方法代码示例

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


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

示例1: reset

 /**
  * Reset MVC state
  *
  * Creates new request/response objects, resets the front controller
  * instance, and resets the action helper broker.
  *
  * @todo   Need to update Zend_Layout to add a resetInstance() method
  * @return void
  */
 public function reset()
 {
     $_SESSION = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     $this->resetRequest();
     $this->resetResponse();
     Zend_Layout::resetMvcInstance();
     Zend_Controller_Action_HelperBroker::resetHelpers();
     $this->frontController->resetInstance();
     Zend_Session::$_unitTestEnabled = true;
 }
开发者ID:Cryde,项目名称:sydney-core,代码行数:22,代码来源:ControllerTestCase.php

示例2: roundselectAction

 /**
  * Ajax return function for round selection
  */
 public function roundselectAction()
 {
     \Zend_Layout::resetMvcInstance();
     $trackId = $this->getRequest()->getParam('sourceValue');
     $rounds = $this->db->fetchPairs($this->roundDescriptionQuery, $trackId);
     echo json_encode($rounds);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:10,代码来源:CommJobAction.php

示例3: _after

 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = [];
     $_GET = [];
     $_POST = [];
     $_COOKIE = [];
     if ($this->bootstrap) {
         $fc = $this->bootstrap->getBootstrap()->getResource('frontcontroller');
         if ($fc) {
             $fc->resetInstance();
         }
     }
     \Zend_Layout::resetMvcInstance();
     \Zend_Controller_Action_HelperBroker::resetHelpers();
     \Zend_Session::$_unitTestEnabled = true;
     $this->queries = 0;
     $this->time = 0;
 }
开发者ID:namnv609,项目名称:Codeception,代码行数:18,代码来源:ZF1.php

示例4: tearDown

 /**
  * Tears down the fixture, for example, close a network connection.
  * This method is called after a test is executed.
  *
  * @return void
  */
 public function tearDown()
 {
     Zend_Layout::resetMvcInstance();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:10,代码来源:PluginTest.php

示例5: testResettingMvcInstanceRemovesMvcSingleton

 public function testResettingMvcInstanceRemovesMvcSingleton()
 {
     $this->testGetMvcInstanceReturnsLayoutInstanceWhenStartMvcHasBeenCalled();
     Zend_Layout::resetMvcInstance();
     $this->assertNull(Zend_Layout::getMvcInstance());
 }
开发者ID:hjr3,项目名称:zf2,代码行数:6,代码来源:LayoutTest.php

示例6: render

 /**
  * static function to render a document outside of a view
  *
  * @static
  * @param Document $document
  * @param array $params
  * @param bool $useLayout
  * @return string
  */
 public static function render(Document $document, $params = array(), $useLayout = false)
 {
     $layout = null;
     $existingActionHelper = null;
     if (\Zend_Controller_Action_HelperBroker::hasHelper("layout")) {
         $existingActionHelper = \Zend_Controller_Action_HelperBroker::getExistingHelper("layout");
     }
     $layoutInCurrentAction = \Zend_Layout::getMvcInstance() instanceof \Zend_Layout ? \Zend_Layout::getMvcInstance()->getLayout() : false;
     $viewHelper = \Zend_Controller_Action_HelperBroker::getExistingHelper("ViewRenderer");
     if ($viewHelper) {
         if ($viewHelper->view === null) {
             $viewHelper->initView(PIMCORE_WEBSITE_PATH . "/views");
         }
         $view = $viewHelper->view;
     } else {
         $view = new \Pimcore\View();
     }
     // add the view script path from the website module to the view, because otherwise it's not possible to call
     // this method out of other modules to render documents, eg. sending e-mails out of an plugin with Pimcore_Mail
     $moduleDirectory = \Zend_Controller_Front::getInstance()->getModuleDirectory($document->getModule());
     if (!empty($moduleDirectory)) {
         $view->addScriptPath($moduleDirectory . "/views/layouts");
         $view->addScriptPath($moduleDirectory . "/views/scripts");
     } else {
         $view->addScriptPath(PIMCORE_FRONTEND_MODULE . "/views/layouts");
         $view->addScriptPath(PIMCORE_FRONTEND_MODULE . "/views/scripts");
     }
     $documentBackup = null;
     if ($view->document) {
         $documentBackup = $view->document;
     }
     $view->document = $document;
     if ($useLayout) {
         if (!($layout = \Zend_Layout::getMvcInstance())) {
             $layout = \Zend_Layout::startMvc();
             $layout->setViewSuffix(View::getViewScriptSuffix());
             if ($layoutHelper = $view->getHelper("layout")) {
                 $layoutHelper->setLayout($layout);
             }
         }
         $layout->setLayout("--modification-indicator--");
     }
     $params["document"] = $document;
     foreach ($params as $key => $value) {
         if (!$view->{$key}) {
             $view->{$key} = $value;
         }
     }
     $content = $view->action($document->getAction(), $document->getController(), $document->getModule(), $params);
     //has to be called after $view->action so we can determine if a layout is enabled in $view->action()
     if ($useLayout) {
         if ($layout instanceof \Zend_Layout) {
             $layout->{$layout->getContentKey()} = $content;
             if (is_array($params)) {
                 foreach ($params as $key => $value) {
                     $layout->getView()->{$key} = $value;
                 }
             }
             // when using Document\Service::render() you have to set a layout in the view ($this->layout()->setLayout("mylayout"))
             if ($layout->getLayout() != "--modification-indicator--") {
                 $content = $layout->render();
             }
             //deactivate the layout if it was not activated in the called action
             //otherwise we would activate the layout in the called action
             \Zend_Layout::resetMvcInstance();
             if (!$layoutInCurrentAction) {
                 $layout->disableLayout();
             } else {
                 $layout = \Zend_Layout::startMvc();
                 $layout->setViewSuffix(View::getViewScriptSuffix());
                 // set pimcore specifiy view suffix
                 $layout->setLayout($layoutInCurrentAction);
                 $view->getHelper("Layout")->setLayout($layout);
                 if ($existingActionHelper) {
                     \Zend_Controller_Action_HelperBroker::removeHelper("layout");
                     \Zend_Controller_Action_HelperBroker::addHelper($existingActionHelper);
                     $pluginClass = $layout->getPluginClass();
                     $front = $existingActionHelper->getFrontController();
                     if ($front->hasPlugin($pluginClass)) {
                         $plugin = $front->getPlugin($pluginClass);
                         $plugin->setLayoutActionHelper($existingActionHelper);
                     }
                 }
             }
             $layout->{$layout->getContentKey()} = null;
             //reset content
         }
     }
     if ($documentBackup) {
         $view->document = $documentBackup;
     }
//.........这里部分代码省略.........
开发者ID:Gerhard13,项目名称:pimcore,代码行数:101,代码来源:Service.php

示例7: configureView

 private function configureView($csvArray, $ceId, $filename)
 {
     if ($this->getRequest()->getParam('as') == 'csv') {
         $csvString = '';
         foreach ($csvArray as $singleArray) {
             foreach ($csvArray[0] as $alias => $head) {
                 $csvString .= $singleArray[$alias] . ',';
             }
             $csvString .= "\n";
         }
         $this->view->csvString = $csvString;
         $this->view->filename = $filename;
         // generate the download file
         Zend_Layout::resetMvcInstance();
         $this->render('csvstring');
     } else {
         $this->view->csvArray = $csvArray;
         $this->view->Action = $this->getRequest()->getActionName();
         $this->view->ceId = $ceId;
         $this->render('csvarray');
     }
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:22,代码来源:StatisticController.php

示例8: cleanUp

 /**
  * Used in unit tests
  */
 public static function cleanUp()
 {
     Zend_Registry::_unsetInstance();
     Zend_Layout::resetMvcInstance();
     Zend_Controller_Action_HelperBroker::resetHelpers();
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:9,代码来源:Application.php

示例9: _after

 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     $this->front = $this->bootstrap->getBootstrap()->getContainer()->frontcontroller->resetInstance();
     \Zend_Layout::resetMvcInstance();
     \Zend_Controller_Action_HelperBroker::resetHelpers();
     \Zend_Session::$_unitTestEnabled = true;
     $this->queries = 0;
     $this->time = 0;
 }
开发者ID:BatVane,项目名称:Codeception,代码行数:13,代码来源:SocialEngine.php

示例10: render

 /**
  * static function to render a document outside of a view
  *
  * @static
  * @param Document $document
  * @param array $params
  * @param bool $useLayout
  * @return string
  */
 public static function render(Document $document, $params = array(), $useLayout = false)
 {
     $layoutEnabledInCurrentAction = Zend_Layout::getMvcInstance() instanceof Zend_Layout ? true : false;
     $viewHelper = Zend_Controller_Action_HelperBroker::getExistingHelper("ViewRenderer");
     if ($viewHelper) {
         if ($viewHelper->view === null) {
             $viewHelper->initView(PIMCORE_WEBSITE_PATH . "/views");
         }
         $view = $viewHelper->view;
     } else {
         $view = new Pimcore_View();
     }
     // add the view script path from the website module to the view, because otherwise it's not possible to call
     // this method out of other modules to render documents, eg. sending e-mails out of an plugin with Pimcore_Mail
     $view->addScriptPath(PIMCORE_FRONTEND_MODULE . "/views/layouts");
     $view->addScriptPath(PIMCORE_FRONTEND_MODULE . "/views/scripts");
     $documentBackup = null;
     if ($view->document) {
         $documentBackup = $view->document;
     }
     $view->document = $document;
     if ($useLayout) {
         if (!($layout = Zend_Layout::getMvcInstance())) {
             $layout = Zend_Layout::startMvc();
             if ($layoutHelper = $view->getHelper("layout")) {
                 $layoutHelper->setLayout($layout);
             }
         }
         $layout->setLayout("--modification-indicator--");
     }
     $params["document"] = $document;
     foreach ($params as $key => $value) {
         if (!$view->{$key}) {
             $view->{$key} = $value;
         }
     }
     $content = $view->action($document->getAction(), $document->getController(), $document->getModule(), $params);
     //has to be called after $view->action so we can determine if a layout is enabled in $view->action()
     if ($useLayout) {
         if ($layout instanceof Zend_Layout) {
             $layout->{$layout->getContentKey()} = $content;
             if (is_array($params)) {
                 foreach ($params as $key => $value) {
                     if (!$layout->getView()->{$key}) {
                         //otherwise we could overwrite e.g. controller, content...
                         $layout->getView()->{$key} = $value;
                     }
                 }
             }
             // when using Document_Service::render() you have to set a layout in the view ($this->layout()->setLayout("mylayout"))
             if ($layout->getLayout() != "--modification-indicator--") {
                 $content = $layout->render();
             }
             //deactivate the layout if it was not activated in the called action
             //otherwise we would activate the layout in the called action
             Zend_Layout::resetMvcInstance();
             if (!$layoutEnabledInCurrentAction) {
                 $layout->disableLayout();
             } else {
                 $layout = Zend_Layout::startMvc();
                 $layout->setViewSuffix(Pimcore_View::getViewScriptSuffix());
                 // set pimcore specifiy view suffix
                 $view->getHelper("Layout")->setLayout($layout);
             }
             $layout->{$layout->getContentKey()} = null;
             //reset content
         }
     }
     if ($documentBackup) {
         $view->document = $documentBackup;
     }
     return $content;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:82,代码来源:Service.php

示例11: autofilterAction

 /**
  * The automatically filtered result
  *
  * @param $resetMvc When true only the filtered resulsts
  */
 public function autofilterAction($resetMvc = true)
 {
     // \MUtil_Model::$verbose = true;
     // We do not need to return the layout, just the above table
     if ($resetMvc) {
         // Make sure all links are generated as if the current request was index.
         $this->aliasAction('index');
         \Zend_Layout::resetMvcInstance();
     }
     if ($this->autofilterSnippets) {
         $params = $this->_processParameters($this->autofilterParameters + $this->_defaultAutofilterParameters);
         $this->addSnippets($this->autofilterSnippets, $params);
     }
     if ($resetMvc) {
         // Lazy call here, because any echo calls in the snippets have not yet been
         // performed. so they will appear only in the next call when not lazy.
         $this->html->raw(\MUtil_Lazy::call(array('MUtil_Echo', 'out')));
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:24,代码来源:ModelSnippetActionAbstract.php

示例12: createattributecsvAction

 public function createattributecsvAction()
 {
     $csvString = '';
     // prepare the header
     $fishBaseAttr = array(Fish::COL_SAMPLE_CODE);
     $imageBaseAttr = array(Image::COL_ORIGINAL_FILENAME, Image::COL_RATIO_EXTERNAL);
     $meta = new Default_MetaData();
     $attribRowset = array_merge($fishBaseAttr, $meta->getAttributesBasic('FISH'), $imageBaseAttr, $meta->getAttributesBasic('IMAGE'));
     /*handle last item differently
      * credit:grobemo
      * 24-Apr-2009 08:13
      * http://de3.php.net/manual/en/control-structures.foreach.php
      */
     $last_item = end($attribRowset);
     foreach ($attribRowset as $attr) {
         if ($attr == $last_item) {
             if (is_array($attr) && array_key_exists(AttributeDescriptor::COL_NAME, $attr)) {
                 $csvString .= $attr[AttributeDescriptor::COL_NAME];
             } else {
                 $csvString .= $attr;
             }
         } else {
             if (is_array($attr) && array_key_exists(AttributeDescriptor::COL_NAME, $attr)) {
                 $csvString .= $attr[AttributeDescriptor::COL_NAME] . ',';
             } else {
                 $csvString .= $attr . ',';
             }
         }
     }
     $csvString .= "\n";
     $this->view->csvString = $csvString;
     // generate the download file
     Zend_Layout::resetMvcInstance();
     $this->render('csvstring');
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:35,代码来源:AttributeController.php


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