Architecture mofification
This commit is contained in:
parent
0161194d08
commit
66baa3ffc8
2 changed files with 43 additions and 30 deletions
|
@ -20,18 +20,12 @@ $opt['minRam'] = 10;
|
||||||
$image->action("listImage");
|
$image->action("listImage");
|
||||||
//$images = $image->listImage();
|
//$images = $image->listImage();
|
||||||
$im = $App->show();
|
$im = $App->show();
|
||||||
error_log(var_export(json_decode($im, true), true), 0);
|
|
||||||
$images = json_decode($im, true)["Images"];
|
$images = json_decode($im, true)["Images"];
|
||||||
if(isset($images)){
|
if(isset($images)){
|
||||||
echo "Images présentes :";
|
echo "Images présentes :";
|
||||||
echo "</br>";
|
echo "</br>";
|
||||||
foreach($images as $i){
|
foreach($images as $i){
|
||||||
echo $i['name'];
|
echo $i['name'];
|
||||||
if($i['name'] == "Test"){
|
|
||||||
$id_image = $i->id;
|
|
||||||
$list = $i->tags;
|
|
||||||
echo $i->status;
|
|
||||||
}
|
|
||||||
echo "</br>";
|
echo "</br>";
|
||||||
}
|
}
|
||||||
echo "</br>";
|
echo "</br>";
|
||||||
|
|
|
@ -79,6 +79,7 @@ class image implements Core{
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
private function createImage(array $opt){
|
private function createImage(array $opt){
|
||||||
|
$opt = $this->app->getPostParam("opt");
|
||||||
|
|
||||||
if(!isset($opt)){
|
if(!isset($opt)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter");
|
$this->app->setOutput("Error", "Incorrect parameter");
|
||||||
|
@ -143,7 +144,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $image;
|
$this->app->setOutput("Images", $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,11 +156,8 @@ class image implements Core{
|
||||||
try{
|
try{
|
||||||
$result = array();
|
$result = array();
|
||||||
$l = $this->libClass->listImages();
|
$l = $this->libClass->listImages();
|
||||||
foreach($l as $tmp)
|
foreach($l as $tmp){
|
||||||
$result[] = $tmp;
|
$result[] = $tmp;
|
||||||
error_log(var_export($result, true), 0);
|
|
||||||
if(!isset($l)){ // if the list is empty there is no images
|
|
||||||
$this->app->setOutput("Error", "No image");
|
|
||||||
}
|
}
|
||||||
}catch(BadResponseError $e){
|
}catch(BadResponseError $e){
|
||||||
$this->app->getErrorInstance()->BadResponseHandler($e);
|
$this->app->getErrorInstance()->BadResponseHandler($e);
|
||||||
|
@ -170,7 +168,6 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
//return $l;
|
|
||||||
$this->app->setOutput("Images", $result);
|
$this->app->setOutput("Images", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,9 +178,10 @@ class image implements Core{
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
private function detailsImage($id){
|
private function detailsImage(){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
// Renvoyer erreur
|
$this->app->setOutput("Error", "Incorrect id parameter");
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
$service = $this->libClass;
|
$service = $this->libClass;
|
||||||
|
@ -191,8 +189,7 @@ class image implements Core{
|
||||||
if($image == null){ // if the image don't exists -> error
|
if($image == null){ // if the image don't exists -> error
|
||||||
$this->app->setOutput("Error", "Image doesn't exist");
|
$this->app->setOutput("Error", "Image doesn't exist");
|
||||||
}
|
}
|
||||||
|
$this->app->setOutput("Images", $image);
|
||||||
return $image;
|
|
||||||
}catch(BadResponseError $e){
|
}catch(BadResponseError $e){
|
||||||
$this->app->getErrorInstance()->BadResponseHandler($e);
|
$this->app->getErrorInstance()->BadResponseHandler($e);
|
||||||
}catch(UserInputError $e){
|
}catch(UserInputError $e){
|
||||||
|
@ -213,7 +210,9 @@ class image implements Core{
|
||||||
* @param array $opt
|
* @param array $opt
|
||||||
* options for the image creation
|
* options for the image creation
|
||||||
**/
|
**/
|
||||||
private function updateImage($id, array $opt){
|
private function updateImage(){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
|
$opt = $this->app->getPostParam("opt");
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect id parameter");
|
$this->app->setOutput("Error", "Incorrect id parameter");
|
||||||
}
|
}
|
||||||
|
@ -260,7 +259,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $image;
|
$this->app->setOutput("Images", $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -269,9 +268,10 @@ class image implements Core{
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function deleteImage($id){
|
private function deleteImage(){
|
||||||
// si protected = true, demander de le mettre a false
|
// si protected = true, demander de le mettre a false
|
||||||
// vérifier existence image
|
// vérifier existence image
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Image doesn't exist");
|
$this->app->setOutput("Error", "Image doesn't exist");
|
||||||
}
|
}
|
||||||
|
@ -291,8 +291,7 @@ class image implements Core{
|
||||||
$this->app->getErrorInstance->BaseErrorHandler($e);
|
$this->app->getErrorInstance->BaseErrorHandler($e);
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,7 +300,8 @@ class image implements Core{
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function reactivateImage($id){
|
private function reactivateImage(){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter");
|
$this->app->setOutput("Error", "Incorrect parameter");
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,8 @@ class image implements Core{
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function desactivateImage($id){
|
private function desactivateImage(){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter");
|
$this->app->setOutput("Error", "Incorrect parameter");
|
||||||
}
|
}
|
||||||
|
@ -363,6 +364,9 @@ class image implements Core{
|
||||||
* path of the image
|
* path of the image
|
||||||
**/
|
**/
|
||||||
private function uploadImage($id, $file_name){
|
private function uploadImage($id, $file_name){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
|
$file_name = $this->app->getPostParam("file_name");
|
||||||
|
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect id parameter");
|
$this->app->setOutput("Error", "Incorrect id parameter");
|
||||||
}
|
}
|
||||||
|
@ -396,6 +400,7 @@ class image implements Core{
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function downloadImage($id){
|
private function downloadImage($id){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter");
|
$this->app->setOutput("Error", "Incorrect parameter");
|
||||||
}
|
}
|
||||||
|
@ -416,7 +421,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $stream;
|
$this->app->setOutput("Images", $stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -428,7 +433,10 @@ class image implements Core{
|
||||||
* @param string $member_id
|
* @param string $member_id
|
||||||
* identifier of the member
|
* identifier of the member
|
||||||
**/
|
**/
|
||||||
private function addMemberImage($image_id, $member_id){
|
private function addMemberImage(){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
|
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
@ -461,7 +469,9 @@ class image implements Core{
|
||||||
* @param string $image_id
|
* @param string $image_id
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function listMemberImage($image_id, $member_id){
|
private function listMemberImage(){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
@ -488,7 +498,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $members;
|
$this->app->setOutput("Images", $member);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -500,7 +510,9 @@ class image implements Core{
|
||||||
* @param string $member_id
|
* @param string $member_id
|
||||||
* identifier of the member
|
* identifier of the member
|
||||||
**/
|
**/
|
||||||
private function detailMemberImage($image_id, $member_id){
|
private function detailMemberImage(){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
@ -531,7 +543,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $member;
|
$this->app->setOutput("Images", $member);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -543,7 +555,10 @@ class image implements Core{
|
||||||
* @param string $member_id
|
* @param string $member_id
|
||||||
* identifier of the member
|
* identifier of the member
|
||||||
**/
|
**/
|
||||||
private function removeMemberImage($image_id, $member_id){
|
private function removeMemberImage(){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
|
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
@ -586,6 +601,10 @@ class image implements Core{
|
||||||
* new status for the member
|
* new status for the member
|
||||||
**/
|
**/
|
||||||
private function updateMemberImage($image_id, $member_id, $status){
|
private function updateMemberImage($image_id, $member_id, $status){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
|
$status = $this->app->getPostParam("status");
|
||||||
|
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue