eb7fb1afd0f643404449f4377f5623d00e6b11f9.svn-base 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | template.php 后台管理 功能 模板可视化管理
  5. |--------------------------------------------------------------------------
  6. */
  7. namespace MazeApp\Manage;
  8. use Maze;
  9. use Maze\Template\View;
  10. use MazeApp\Manage\Lib\Visual;
  11. Maze::load('manage/auth.init');
  12. class Template
  13. {
  14. /**
  15. * project
  16. *
  17. * @var string
  18. */
  19. private $project;
  20. /**
  21. * dir
  22. *
  23. * @var string
  24. */
  25. protected $type;
  26. /**
  27. * config
  28. *
  29. * @var array
  30. */
  31. protected $config;
  32. /**
  33. * __construct
  34. *
  35. * @return mixed
  36. */
  37. public function __construct()
  38. {
  39. $this->project = Maze::input('key');
  40. $this->type = Maze::input('type', 'config');
  41. $config = Maze::load('manage/project.get');
  42. if(isset($config[$this->project]))
  43. {
  44. $this->config = $config[$this->project];
  45. }
  46. }
  47. /**
  48. * index
  49. *
  50. * @return mixed
  51. */
  52. public function index()
  53. {
  54. # 读取当前的service
  55. $view = View::getInstance('home', $this->config['path'], $this->project);
  56. $content = $view->runing();
  57. $config = $view->result();
  58. if(strpos($content, '</body>') >= 0)
  59. {
  60. $content = str_replace('</body>', Visual::tool() . '</body>', $content);
  61. }
  62. else
  63. {
  64. $content = $content . Visual::tool();
  65. }
  66. return $content;
  67. }
  68. }