admin.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Fuel is a fast, lightweight, community driven PHP5 framework.
  4. *
  5. * @package Fuel
  6. * @version 1.5
  7. * @author Fuel Development Team
  8. * @license MIT License
  9. * @copyright 2010 - 2013 Fuel Development Team
  10. * @link http://fuelphp.com
  11. */
  12. namespace Oil;
  13. /**
  14. * Oil\Scaffold Class
  15. *
  16. * @package Fuel
  17. * @subpackage Oil
  18. * @category Core
  19. */
  20. class Generate_Admin extends Generate_Scaffold
  21. {
  22. public static $view_subdir = 'admin/';
  23. public static $controller_prefix = 'Admin_';
  24. public static $model_prefix = '';
  25. public static $controller_parent = 'Controller_Admin';
  26. public static function forge($args, $subfolder)
  27. {
  28. $default_files = array(
  29. array(
  30. 'source' => $subfolder.'/controllers/base.php',
  31. 'location' => 'classes/controller/base.php',
  32. 'type' => 'controller',
  33. ),
  34. array(
  35. 'source' => $subfolder.'/controllers/admin.php',
  36. 'location' => 'classes/controller/admin.php',
  37. 'type' => 'controller',
  38. ),
  39. array(
  40. 'source' => '/template.php',
  41. 'location' => 'views/admin/template.php',
  42. 'type' => 'views',
  43. ),
  44. array(
  45. 'source' => 'dashboard.php',
  46. 'location' => 'views/admin/dashboard.php',
  47. 'type' => 'views',
  48. ),
  49. array(
  50. 'source' => 'login.php',
  51. 'location' => 'views/admin/login.php',
  52. 'type' => 'views',
  53. ),
  54. );
  55. foreach ($default_files as $file)
  56. {
  57. // check if there's a template in app, and if so, use that
  58. if (file_exists(APPPATH.'views/'.static::$view_subdir.$file['source']))
  59. {
  60. Generate::create(APPPATH.$file['location'], file_get_contents(APPPATH.'views/'.static::$view_subdir.$file['source']), $file['type']);
  61. }
  62. else
  63. {
  64. Generate::create(APPPATH.$file['location'], file_get_contents(\Package::exists('oil').'views/'.static::$view_subdir.$file['source']), $file['type']);
  65. }
  66. }
  67. parent::forge($args, $subfolder);
  68. }
  69. }
  70. /* End of file oil/classes/generate/admin.php */