private function generate_routes()
   {
       $db = new JCrud();
       $data = $db->query1('select TableName from SyncTables');
       $routes = "";
       foreach ($data as $col) {
           $routes .= CodeGen::$tab2 . 'when(\'/' . $col->TableName . '\', { templateUrl:BASE_URL+\'' . $col->TableName . '_ctrl\'}).' . CodeGen::$newLine;
       }
       $content = 'angular.module(\'project\', [\'ui.bootstrap\', \'ngGrid\', \'jQuery-ui\']).
 config(function($routeProvider) {
   $routeProvider.
     when(\'/\', { templateUrl:BASE_URL+\'home_ctrl\'}).
     ' . $routes . '
     otherwise({redirectTo:\'/\'});
 });';
       return $content;
   }
<?php

JCrud::$HOST = "127.0.0.1";
JCrud::$DBNAME = "sampledb";
JCrud::$USER = "******";
JCrud::$PASS = "";
class JsonResponse
{
    public $success;
    public $data;
    public $total;
    public $msg;
}
function response($data, $total, $msg, $isSuccess)
{
    $json = new JsonResponse();
    $json->total = $total;
    $json->data = $data;
    $json->msg = $msg;
    $json->success = $isSuccess;
    echo json_encode($json);
}
function responseObj($json)
{
    echo json_encode($json);
}