7260c8aa by Jeff Balicki

new api calls

1 parent 304f606f
...@@ -31,7 +31,7 @@ class ApiController extends Controller ...@@ -31,7 +31,7 @@ class ApiController extends Controller
31 { 31 {
32 32
33 33
34 $json = '{"pdf":[{"name":"Sample PDF Document","folder":"Sample","pdfLocation":"http://hotelpodlipou.sk/uploads/files/sample.pdf"}],"changes":[{"label":"none","locationUp":"400","locationRight":90,"pages":"1","content":"LOGO_text_black.jpg","z-index":null,"idstylesPDF":1,"order":"2","style":null,"idchange_typePDF":2,"change_type":"2","fileLocation":"https://image.freepik.com/free-vector/logo-sample-text_355-558.jpg"},{"label":"text style","locationUp":"60","locationRight":290,"pages":"1","content":"519.642.4404 London","z-index":null,"idstylesPDF":2,"order":"1","style":"a:3:{s:11:\"font-family\";s:11:\"TradeGothic\";s:9:\"font-size\";s:2:\"14\";s:10:\"font-color\";s:16:\"cmyk 0 0.6 0.5 0\";}","idchange_typePDF":1,"change_type":"1"}]}'; 34 $json = '{"pdf":[{"name":"Sample PDF Document","folder":"Sample","pdfLocation":"http://hotelpodlipou.sk/uploads/files/sample.pdf"}],"changes":[{"label":"none","locationUp":"400","locationRight":90,"pages":"1","content":"logo-sample-text_355-558.jpg","z-index":null,"idstylesPDF":1,"order":"2","style":null,"idchange_typePDF":2,"change_type":"2","fileLocation":"https://image.freepik.com/free-vector/logo-sample-text_355-558.jpg"},{"label":"text style","locationUp":"60","locationRight":290,"pages":"1","content":"519.642.4404 London","z-index":null,"idstylesPDF":2,"order":"1","style":"a:3:{s:11:\"font-family\";s:11:\"TradeGothic\";s:9:\"font-size\";s:2:\"14\";s:10:\"font-color\";s:16:\"cmyk 0 0.6 0.5 0\";}","idchange_typePDF":1,"change_type":"1"}]}';
35 35
36 $apiCallId = new pdfModel(); 36 $apiCallId = new pdfModel();
37 $apiCallId = $apiCallId->addApiCall('1',$json); 37 $apiCallId = $apiCallId->addApiCall('1',$json);
...@@ -92,20 +92,29 @@ class ApiController extends Controller ...@@ -92,20 +92,29 @@ class ApiController extends Controller
92 92
93 public function getList($json) 93 public function getList($json)
94 { 94 {
95
96 $rows = new pdfModel(); 95 $rows = new pdfModel();
97 $rows = $rows->getList($json)->get(); 96 $rows = $rows->getList($json)->get();
98 $rows = json_encode($rows); 97 $response = json_encode($rows);
99 var_dump($rows); 98 $statusCode = 200;
99 return Response::json($response, $statusCode);
100 100
101 } 101 }
102 public function getPdf($json) 102
103 public function getApi($json)
103 { 104 {
105 $statusCode = 200;
106 $response = URL::asset('js/interface.js');
107 return Response::json($response, $statusCode);
104 108
109 }
110
111 public function getPdf($json)
112 {
105 $rows = new pdfModel(); 113 $rows = new pdfModel();
106 $rows = $rows->getpdf($json)->get(); 114 $rows = $rows->getpdf($json)->get();
107 $rows = json_encode($rows); 115 $response = json_encode($rows);
108 var_dump($rows); 116 $statusCode = 200;
117 return Response::json($response, $statusCode);
109 118
110 } 119 }
111 } 120 }
......
...@@ -118,7 +118,7 @@ try { ...@@ -118,7 +118,7 @@ try {
118 } 118 }
119 $num_optlist = "fillcolor={".$fontColor." }"; 119 $num_optlist = "fillcolor={".$fontColor." }";
120 $p->setfont($font, $fontSize); 120 $p->setfont($font, $fontSize);
121 $p->fit_textline($textline, $textLUp, $textLRight, $num_optlist); 121 $p->fit_textline($textline, $textLRight, $textLUp, $num_optlist);
122 122
123 123
124 } else if ($row->change_type == 'img') { 124 } else if ($row->change_type == 'img') {
...@@ -135,7 +135,7 @@ try { ...@@ -135,7 +135,7 @@ try {
135 if ($image == 0) { 135 if ($image == 0) {
136 die("Error: " . $p->get_errmsg()); 136 die("Error: " . $p->get_errmsg());
137 } 137 }
138 $p->fit_image($image, $imgLUp, $imgLRight, ""); 138 $p->fit_image($image, $imgLRight, $imgLUp, "");
139 139
140 140
141 } 141 }
......
...@@ -17,7 +17,13 @@ Route::get('/', function () { ...@@ -17,7 +17,13 @@ Route::get('/', function () {
17 17
18 18
19 Route::get('pdf/{id}', 'PdfController@pdf'); 19 Route::get('pdf/{id}', 'PdfController@pdf');
20 Route::get('api/add/{json}', 'ApiController@insert');
21 Route::get('api/get-list/{json}', 'ApiController@getList');
22 Route::get('api/get-pdf/{json}', 'ApiController@getpdf');
23 20
21 Route::group(array('prefix' => 'api/v1'), function($json)
22 {
23
24 Route::resource('add', 'ApiController@insert');
25 Route::resource('get-list', 'ApiController@getList');
26 Route::resource('get-pdf', 'ApiController@getpdf');
27 Route::resource('api', 'ApiController@getApi');
28
29 });
...\ No newline at end of file ...\ No newline at end of file
......