mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
get one publication
This commit is contained in:
@@ -64,7 +64,7 @@ class PSExposeController extends Controller
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($response->getStatusCode() == 200) {
|
if ($resPublication->getStatusCode() == 200) {
|
||||||
$publications[] = json_decode($resPublication->getBody()->getContents(),true);
|
$publications[] = json_decode($resPublication->getBody()->getContents(),true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,6 +81,41 @@ class PSExposeController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Require params "exposeName" and "publicationId"
|
||||||
|
*
|
||||||
|
* @param PhraseaApplication $app
|
||||||
|
* @param Request $request
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPublicationAction(PhraseaApplication $app, Request $request)
|
||||||
|
{
|
||||||
|
$exposeConfiguration = $app['conf']->get(['phraseanet-service', 'expose-service', 'exposes'], []);
|
||||||
|
$exposeConfiguration = $exposeConfiguration[$request->get('exposeName')];
|
||||||
|
|
||||||
|
$exposeClient = new Client(['base_uri' => $exposeConfiguration['expose_base_uri'], 'http_errors' => false]);
|
||||||
|
|
||||||
|
if (!isset($exposeConfiguration['token'])) {
|
||||||
|
$exposeConfiguration = $this->generateAndSaveToken($exposeConfiguration, $request->get('exposeName'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$publication = [];
|
||||||
|
$resPublication = $exposeClient->get('/publications/' . $request->get('publicationId') , [
|
||||||
|
'headers' => [
|
||||||
|
'Authorization' => 'Bearer '. $exposeConfiguration['token'],
|
||||||
|
'Content-Type' => 'application/json'
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($resPublication->getStatusCode() == 200) {
|
||||||
|
$publication = json_decode($resPublication->getBody()->getContents(),true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render("prod/WorkZone/ExposeEdit.html.twig", [
|
||||||
|
'publications' => $publication,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a publication
|
* Create a publication
|
||||||
* Require params "exposeName" and "publicationData"
|
* Require params "exposeName" and "publicationData"
|
||||||
|
@@ -42,6 +42,10 @@ class PSExposeServiceProvider implements ControllerProviderInterface, ServicePro
|
|||||||
->method('GET')
|
->method('GET')
|
||||||
->bind('ps_expose_list_publication');
|
->bind('ps_expose_list_publication');
|
||||||
|
|
||||||
|
$controllers->match('/get-publication/{publicationId}', 'controller.ps.expose:getPublicationAction')
|
||||||
|
->method('GET')
|
||||||
|
->bind('ps_expose_get_publication');
|
||||||
|
|
||||||
$controllers->match('/delete-publication/{publicationId}', 'controller.ps.expose:deletePublicationAction')
|
$controllers->match('/delete-publication/{publicationId}', 'controller.ps.expose:deletePublicationAction')
|
||||||
->method('POST|DELETE')
|
->method('POST|DELETE')
|
||||||
->bind('ps_expose_delete_publication');
|
->bind('ps_expose_delete_publication');
|
||||||
|
Reference in New Issue
Block a user