Guest User

Untitled

a guest
Apr 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <?php
  2.  
  3. include("../../vendor/autoload.php");
  4.  
  5. use GroceryCrud\Core\GroceryCrud;
  6.  
  7. class HomeController extends BaseController {
  8.  
  9. public function showWelcome()
  10. {
  11. $crud = $this->getGroceryCrudEnterprise();
  12.  
  13. $crud->setTable('customers');
  14. $crud->setSubject('Customer', 'Customers');
  15.  
  16. $output = $crud->render();
  17.  
  18. return $this->gCrudShowResponse($output);
  19. }
  20.  
  21. private function getGroceryCrudEnterprise() {
  22. $db = include( __DIR__ . '/../config/gcrud-enterprise-db.php');
  23. $config = include( __DIR__ . '/../config/gcrud-enterprise.php');
  24.  
  25. $config['xss_clean'] = false;
  26. $config['default_per_page'] = 50;
  27.  
  28. $groceryCrud = new GroceryCrud($config, $db);
  29.  
  30. return $groceryCrud;
  31. }
  32.  
  33. private function gCrudShowResponse($output) {
  34. if ($output->isJSONResponse) {
  35. header('Content-Type: application/json; charset=utf-8');
  36. echo $output->output;
  37. exit;
  38. }
  39.  
  40. $css_files = $output->css_files;
  41. $js_files = $output->js_files;
  42. $output = $output->output;
  43.  
  44. $final_output = array(
  45. 'css_files' => $css_files,
  46. 'js_files' => $js_files,
  47. 'output' => $output
  48. );
  49.  
  50. return View::make('default', $final_output);
  51. }
  52.  
  53. }
Add Comment
Please, Sign In to add comment