Guest User

Untitled

a guest
Jul 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. class App_Plugin_DojoLayer extends Zend_Controller_Plugin_Abstract
  2. {
  3. public $layerScript = APPLICATION_PATH . '/../public/js/custom/main.js';
  4. protected $_build;
  5.  
  6. public function dispatchLoopShutdown()
  7. {
  8. if (!file_exists($this->layerScript)) {
  9. $this->generateDojoLayer();
  10. }
  11. }
  12.  
  13. public function getBuild()
  14. {
  15. if (null === $this->_build) {
  16. $this->_build = new Zend_Dojo_BuildLayer(array(
  17. 'view' => $view,
  18. 'layerName' => 'custom.main',
  19. ));
  20. }
  21. return $this->_build;
  22. }
  23.  
  24. public function generateDojoLayer()
  25. {
  26. $build = $this->getBuild();
  27. $layerContents = $build->generateLayerScript();
  28. if (!dir_exists(dirname($this->layerScript))) {
  29. mkdir(dirname($this->layerScript));
  30. }
  31. file_put_contents($this->layerScript, $layerContents);
  32. }
  33. }
Add Comment
Please, Sign In to add comment