diff --git a/client/index.html b/client/index.html index 8d81ac3..48ea4a0 100644 --- a/client/index.html +++ b/client/index.html @@ -11,26 +11,28 @@ - + - + + +
+
+
+ + +
- -
- -
- - -
+ +
@@ -55,7 +57,7 @@
- + @@ -79,13 +81,14 @@ + - + - + diff --git a/client/js/controllers/home/home.js b/client/js/controllers/home/home.js new file mode 100644 index 0000000..f84f625 --- /dev/null +++ b/client/js/controllers/home/home.js @@ -0,0 +1,36 @@ +/** + * The home controller + * + * @param {$scope} $scope The $scope service from angular + */ +mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','Identity', function ($scope, Compute, $rootScope, Loading, Identity) +{ + + var callMeAfterPullData=function(data){ + $scope.machines=Compute.getData().machines; + Loading.stop(); + } + + ; + if(Compute.getData().machines == null && Identity.isAlreadyLogin()){ + Loading.start(); + Compute.pullData(callMeAfterPullData); + } + + + + + $scope.raiseShowMachineDetailsEvent=function(id){ + + var callback=function(){ + Loading.stop(); + var data=Compute.getData(); + $rootScope.$broadcast("showMachineDetailsEvent", data.machines[id], data.axioms); + + } + Loading.start(); + Compute.pullMachines(callback); + } + + +}]); diff --git a/client/js/controllers/home/machineDetails.js b/client/js/controllers/home/machineDetails.js index f84a073..c015eaa 100644 --- a/client/js/controllers/home/machineDetails.js +++ b/client/js/controllers/home/machineDetails.js @@ -6,21 +6,25 @@ mainApp.controller('machineDetailsCtrl', [ '$scope', 'Compute', '$rootScope', '$timeout', function ($scope, Compute, $rootScope, $timeout) { + // Init scope $scope.machine={}; - $("#waitingForToggleMachine").hide(); + $scope.machineIsStarting=false; // For loading icon - $scope.$on('showMachineDetailsEvent', function(eventName ,machine){ + + $scope.$on('showMachineDetailsEvent', function(eventName ,machine, axioms){ $scope.machine=machine; + $scope.axioms=axioms; $('#machineDetailsModal').modal({backdrop: false, keyboard: true}); }); $scope.toggleMachineState=function(){ - $("#waitingForToggleMachine").show(); + // Display gif + $scope.machineIsStarting=true; // Fake timeout $timeout(function(){ - $("#waitingForToggleMachine").hide(); + $scope.machineIsStarting=false; }, 3000); $timeout(function(){ $scope.machine.online=!$scope.machine.online; diff --git a/client/js/controllers/home/main.js b/client/js/controllers/home/main.js deleted file mode 100644 index d93c376..0000000 --- a/client/js/controllers/home/main.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * The home controller - * - * @param {$scope} $scope The $scope service from angular - */ -mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', function ($scope, Compute, $rootScope) -{ - - var updatePage=function(){ - // TODO Update graph etc... - } - - // Retrieve all Data - Compute.pullData(updatePage); - - $scope.raiseShowMachineDetailsEvent=function(){ - var machine={name: "Machine 1", online:true}; - $rootScope.$broadcast("showMachineDetailsEvent", machine); - } - - -}]); diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js index 1a89563..63cb6d1 100644 --- a/client/js/controllers/login.js +++ b/client/js/controllers/login.js @@ -16,10 +16,11 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s // Manager logout event $scope.$on('logoutEvent', function(){ - Identity.logout(); $('#loginModal').modal({backdrop: 'static', keyboard: false}); }); + + // Hide loading button and message alert $('#loadingLoginButton').hide(); $('#failedToLoginAlert').hide(); diff --git a/client/js/controllers/network/main.js b/client/js/controllers/network/network.js similarity index 100% rename from client/js/controllers/network/main.js rename to client/js/controllers/network/network.js diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index 940d794..6f398ad 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -11,10 +11,10 @@ mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($ // Give profile to model $scope.profile=Identity.getProfile(); - + // Function to logout - $scope.raiseLogoutEvent=function(){ - $rootScope.$broadcast('logoutEvent'); + $scope.logout=function(){ + Identity.logout(); }; }]); diff --git a/client/js/services/Compute.js b/client/js/services/Compute.js index 70359ee..36ddc16 100644 --- a/client/js/services/Compute.js +++ b/client/js/services/Compute.js @@ -2,38 +2,139 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){ - + // Init data var data={}; - data.machines={}; + data.machines=null; + data.axioms={} // Contain static data + data.axioms.ram=[128,512,1024,2048,4096]; + data.axioms.disk=[1,2,5,10,25,50,100,150,200] + data.axioms.images={}; // Retrieve after - // Parser - var parseGetMachinesAnswer=function(response, failedToSendRequest){ + /** + * Parse pullMachines answer + * @param {response} the server response + * @param {boolean} false if the request as been send true else + * @return {requestParserResult} the result of parsing + */ + var parsePullMachinesAnswer=function(response, failedToSendRequest){ + + // Defined return object + var requestParserResult={}; + requestParserResult.status=1; + requestParserResult.failReason=null; + + if (typeof response.data.Servers !== 'undefined') { + // Set status code + requestParserResult.status=0; + data.machines=response.data.Servers; + + } + else if(failedToSendRequest){ + requestParserResult.failReason="Failed to send request"; + } + else{ + requestParserResult.failReason="Error"; + } + return requestParserResult; }; - // Get Machine - var getMachines=function(callback){ - + /** + * Retrieve machine list + * @param {callback} function to call after request complete + */ + var pullMachines=function(callback){ + // Send listServers request var result=$http.post('../server/index.php', - $.param({"token" : Identity.profile.token, "task" : "Compute"})); + $.param({"token" : Identity.getToken(), "task" : "compute", "action":"listServers"})); + + // Wait and handle the response + result.then(function (response){ + callback(parsePullMachinesAnswer(response, false)); + },function(response){ + callback(parsePullMachinesAnswer(response, true)); + }); + }; + + + /** + * Parse pullImages answer + * @param {response} the server response + * @param {boolean} false if the request as been send true else + * @return {requestParserResult} the result of parsing + */ + var parsePullImagesAnswer=function(response, failedToSendRequest){ + + // Defined return object + var requestParserResult={}; + requestParserResult.status=1; + requestParserResult.failReason=null; + if (typeof response.data.Images !== 'undefined') { + // Set status code + requestParserResult.status=0; + data.axioms.images=response.data.Images; + } + else if(failedToSendRequest){ + requestParserResult.failReason="Failed to send request"; + } + else{ + requestParserResult.failReason="Error"; + } + return requestParserResult; }; + + + + /** + * Retrieve machine list + * @param {callback} function to call after request complete + */ + var pullImages=function(callback){ + // Send listServers request + var result=$http.post('../server/index.php', + $.param({"token" : Identity.getToken(), "task" : "compute", "action":"listImages"})); + + // Wait and handle the response + result.then(function (response){ + callback(parsePullImagesAnswer(response, false)); + },function(response){ + callback(parsePullImagesAnswer(response, true)); + }); + }; + /** + * Retrieve all data + * @param {callback} function to call after request complete + */ var pullData=function(callback){ - // TODO call getMachines etc... + var nextFunction=function(response){ + if(response.status==0){ + pullMachines(callback); + } + } + pullImages(nextFunction); } - + + /** + * Get Data + * @return {data} return the data object + */ + var getData=function(){ + return data; + } + // Return services objects return { - getMachines: getMachines, + pullMachines: pullMachines, pullData: pullData, - data:data + getData: getData }; diff --git a/client/js/services/Identity.js b/client/js/services/Identity.js index 7604230..db93e97 100644 --- a/client/js/services/Identity.js +++ b/client/js/services/Identity.js @@ -1,5 +1,5 @@ -mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ +mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ /* Create profile structure to store informations * about current session @@ -9,42 +9,37 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ profile.projectname=null; var token=null; + /* * @returns {boolean} Return true if a cookie is found (and load it in profile) false else */ var isAlreadyLogin=function(){ + + // Load cookies var profileInCookie=$cookies.getObject('profile'); var tokenPart_0InCookie=$cookies.getObject('token.part_0'); var tokenPart_1InCookie=$cookies.getObject('token.part_1'); + // Check if cookie is defined if(typeof profileInCookie !== 'undefined' && typeof tokenPart_0InCookie !== 'undefined' && typeof tokenPart_1InCookie !== 'undefined' ){ + + // If yes, put it into variables angular.extend(profile, profileInCookie); token=tokenPart_0InCookie+tokenPart_1InCookie; - + + // Return I'm Login return true; } + // Return I'm not Login return false; } - /* - * Get the profile - */ - var getProfile=function(){ - return profile; - } - - /* - * Get the token - */ - var getToken=function(){ - return token; - } /* * Destroy profile cookies @@ -53,6 +48,12 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ $cookies.remove('profile'); $cookies.remove('token.part_0'); $cookies.remove('token.part_1'); + token=null; + profile.username=null; + profile.projectname=null; + + // Reload Page + location.reload(); } @@ -64,7 +65,7 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ */ var parseLoginAnswer=function(response, failedToSendRequest){ - + // Defined return object var requestParserResult={}; requestParserResult.status=1; requestParserResult.failReason=null; @@ -86,6 +87,10 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ $cookies.putObject('token.part_0', response.data.token.substring(0, middle), {'expires': expireDate}); // Save second part of token $cookies.putObject('token.part_1', response.data.token.substring(middle, response.data.token.length), {'expires': expireDate}); + + // Put token in var + token=response.data.token; + } else if(failedToSendRequest){ requestParserResult.failReason="Failed to send request"; @@ -93,9 +98,11 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ else{ requestParserResult.failReason="Please check your username, password and project name !"; } + return requestParserResult; }; + /** * Function to connect to OpenStack @@ -106,25 +113,43 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ * @param {string} projectname The user project name * @param {function} function to call when data is avalaible */ - var login=function(username, password,projectname, callback){ + var login=function(username, password,projectname,callback){ // Set profile information (early) profile.username=username; profile.projectname=projectname; var result=$http.post('../server/index.php', - $.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname})); + $.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname})); // Wait and handle the response result.then(function (response){ - callback(parseLoginAnswer(response), false); + callback(parseLoginAnswer(response, false)); },function(response){ - callback(parseLoginAnswer(response), true) + callback(parseLoginAnswer(response, true)); }); }; + + + /* + * Get the profile + */ + var getProfile=function(){ + return profile; + } + + /* + * Get the token + */ + var getToken=function(){ + return token; + } + + + // Return services objects return { login: login, diff --git a/client/js/services/Loading.js b/client/js/services/Loading.js new file mode 100644 index 0000000..db06194 --- /dev/null +++ b/client/js/services/Loading.js @@ -0,0 +1,23 @@ + +mainApp.factory('Loading',[ function(){ + /** + * Display Loading modal + */ + var start=function(){ + $('#loadingModal').modal({backdrop: 'static', keyboard: false}); + }; + + /** + * Hide Loading modal + */ + var stop=function(){ + $('#loadingModal').modal('hide'); + } + + + // Service returns + return { + start:start, + stop:stop + }; +}]); diff --git a/client/partials/home/machineDetails.html b/client/partials/home/machineDetails.html index 606edcf..c4c8a38 100644 --- a/client/partials/home/machineDetails.html +++ b/client/partials/home/machineDetails.html @@ -21,12 +21,12 @@
- Online - Offline + Online + Offline   - - -   + + +  
@@ -34,36 +34,22 @@
+ MB
diff --git a/client/partials/home/main.html b/client/partials/home/main.html index 37638d3..f9f8878 100644 --- a/client/partials/home/main.html +++ b/client/partials/home/main.html @@ -3,9 +3,10 @@ Home
- Main Content - -
-
+ + Pour charger les machines, recharger la page (temporaire)
+ Selectionner une machine: +
{{ machine.name }}
+
diff --git a/client/partials/loading.html b/client/partials/loading.html new file mode 100644 index 0000000..c978190 --- /dev/null +++ b/client/partials/loading.html @@ -0,0 +1,18 @@ + diff --git a/client/partials/nav.html b/client/partials/nav.html deleted file mode 100644 index b3ef76a..0000000 --- a/client/partials/nav.html +++ /dev/null @@ -1,41 +0,0 @@ - diff --git a/client/partials/status.html b/client/partials/status.html new file mode 100644 index 0000000..01b9079 --- /dev/null +++ b/client/partials/status.html @@ -0,0 +1,29 @@ + diff --git a/server/Test/imageTests.php b/server/Test/imageTests.php index 94ff7b6..3af12fc 100644 --- a/server/Test/imageTests.php +++ b/server/Test/imageTests.php @@ -1,35 +1,6 @@ "admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]); -$options["scope"] = Array("project"=>Array("name"=>"admin", "domain"=>["id"=>"Default"])); -$options["authUrl"] = "http://148.60.11.31:5000/v3"; - -$openstack = new OpenStack\OpenStack($options); - -//$identity = $openstack->identityV3(); -//var_dump($identity); -// Since usernames will not be unique across an entire OpenStack installation, -// when authenticating with them you must also provide your domain ID. You do -// not have to do this if you authenticate with a user ID. -/*$token = $identity->generateToken([ - 'user' => [ - 'name' => 'admin', - 'password' => 'ae5or6cn', - 'domain' => [ - 'id' => 'Default' - ] - ] - ]); - */ -//$compute = $openstack->computeV2(["region" => "RegionOne"]); -//$image= $openstack->imagesV2(["region" => "RegionOne"]); -//var_dump($compute->client); -//$servers = $compute->listServers(true); -echo 'toto'; +include('InitTest.php'); +include_once("../core/Image.php"); $image = new Image($App); @@ -43,52 +14,54 @@ $opt['minDisk'] = 1; $opt['protected'] = false; $opt['minRam'] = 10; -//$new_image = $image->create_image($opt); - +//$new_image = $image->createImage($opt); //Liste des images -$images = $image->list_images(); - -echo "Images présentes :"; -echo "
"; - -foreach($images as $i){ - echo $i->name; - if($i->name == "Test"){ - $id_image = $i->id; - $list = $i->tags; - echo $i->status; +$image->action("listImage"); +//$images = $image->listImage(); +$im = $App->show(); +$images = json_decode($im, true)["Images"]; +if(isset($images)){ + echo "Images présentes :"; + echo "
"; + foreach($images as $i){ + echo $i['name']; + echo "
"; } echo "
"; -} -echo "
"; -if(isset($list)){ - foreach ($list as $l) { - echo $l; - echo "
"; - } + if(isset($list)){ + foreach ($list as $l) { + echo $l; + echo "
"; + } } +} +else{ + echo "Aucune image présente\n"; +} + + // Détails Image -//$details = $image->image_details($id_image); +//$details = $image->imageDetails($id_image); -//$image->delete_image('123456'); +//$image->deleteImage('123456'); -//$image->desactivate_image($id_image); -//$image->reactivate_image($id_image); +//$image->desactivateImage($id_image); +//$image->reactivateImage($id_image); //$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso"; -//$image->upload_image($id_image, $file_name); +//$image->uploadImage($id_image, $file_name); -//$image->download_image($id_image); +//$image->downloadImage($id_image); /* $opt_update = Array(); $opt_update['name'] = "Test"; $opt_update['tags'] = null; -$update = $image->update_image($id_image, $opt_update); +$update = $image->updateImage($id_image, $opt_update); echo $update->name; */ diff --git a/server/core/Compute.php b/server/core/Compute.php index 94e219c..a5b8375 100644 --- a/server/core/Compute.php +++ b/server/core/Compute.php @@ -35,7 +35,20 @@ class compute */ public function listServers() { - $servers = $this->libClass->listServers(); + $serverList = $this->libClass->listServers(true); + $servers = Array(); + foreach($serverList as $server){ + $servers[$server->id] = Array(); + $server->flavor->retrieve(); + $server->image->retrieve(); + $servers[$server->id]["id"] = $server->id; + $servers[$server->id]["name"] = $server->name; + $servers[$server->id]["imageId"] = $server->image->id; + $servers[$server->id]["flavorId"] = $server->flavor->id; + $servers[$server->id]["status"] = $server->status; + $servers[$server->id]["ram"] = $server->flavor->ram; + $servers[$server->id]["disk"] = $server->flavor->disk; + } $this->app->setOutput("Servers", $servers); return; } @@ -45,7 +58,13 @@ class compute */ public function listFlavors() { - $flavors = $this->libClass->listFlavors(); + $flavorList = $this->libClass->listFlavors(); + $flavors = Array(); + foreach($flavorList as $flavor){ + $flavors[$flavor->id] = Array(); + $flavors[$flavor->id]["id"] = $flavor->id; + $flavors[$flavor->id]["name"] = $flavor->name; + } $this->app->setOutput("Flavors", $flavors); return; } @@ -55,7 +74,13 @@ class compute */ public function listImages() { - $images = $this->libClass->listImages(); + $imageList = $this->libClass->listImages(); + $images = Array(); + foreach($imageList as $image){ + $images[$image->id] = Array(); + $images[$image->id]["id"] = $image->id; + $images[$image->id]["name"] = $image->name; + } $this->app->setOutput("Images", $images); return; } diff --git a/server/core/Image.php b/server/core/Image.php index 4025595..b192716 100644 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -14,6 +14,10 @@ use OpenStack\Common\Error\BaseError; use OpenStack\Common\Error\NotImplementedError; use OpenStack\Common\Error\UserInputError; + +include("CoreInterface.php"); + + /** * Image Class of the back-end application * @@ -78,6 +82,9 @@ class image implements Core{ **/ private function createImage(array $opt){ + $opt = $this->app->getPostParam("opt"); + + if(!isset($opt)){ $this->app->setOutput("Error", "Incorrect parameter"); } @@ -141,7 +148,8 @@ class image implements Core{ }catch(NotImplementedError $e){ $this->app->getErrorInstance->NotImplementedHandler($e); } - return $image; + $this->app->setOutput("Images", $image); + } /** @@ -151,9 +159,10 @@ class image implements Core{ */ private function listImage(){ try{ + $result = array(); $l = $this->libClass->listImages(); - if(!isset($l)){ // if the list is empty there is no images - $this->app->setOutput("Error", "No image"); + foreach($l as $tmp){ + $result[] = $tmp; } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); @@ -164,7 +173,8 @@ class image implements Core{ }catch(NotImplementedError $e){ $this->app->getErrorInstance->NotImplementedHandler($e); } - return $l; + + $this->app->setOutput("Images", $result); } @@ -175,9 +185,11 @@ class image implements Core{ * identifier of the image * **/ - private function detailsImage($id){ + private function detailsImage(){ + $id = $this->app->getPostParam("id"); if(!isset($id)){ - // Renvoyer erreur + $this->app->setOutput("Error", "Incorrect id parameter"); + } try{ $service = $this->libClass; @@ -185,8 +197,9 @@ class image implements Core{ if($image == null){ // if the image don't exists -> error $this->app->setOutput("Error", "Image doesn't exist"); } - - return $image; + + $this->app->setOutput("Images", $image); + }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ @@ -207,7 +220,11 @@ class image implements Core{ * @param array $opt * 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)){ $this->app->setOutput("Error", "Incorrect id parameter"); } @@ -254,7 +271,7 @@ class image implements Core{ }catch(NotImplementedError $e){ $this->app->getErrorInstance->NotImplementedHandler($e); } - return $image; + $this->app->setOutput("Images", $image); } /** @@ -263,9 +280,10 @@ class image implements Core{ * @param string $id * identifier of the image **/ - private function deleteImage($id){ + private function deleteImage(){ // si protected = true, demander de le mettre a false // vérifier existence image + $id = $this->app->getPostParam("id"); if(!isset($id)){ $this->app->setOutput("Error", "Image doesn't exist"); } @@ -285,8 +303,7 @@ class image implements Core{ $this->app->getErrorInstance->BaseErrorHandler($e); }catch(NotImplementedError $e){ $this->app->getErrorInstance->NotImplementedHandler($e); - } - + } } /** @@ -295,7 +312,9 @@ class image implements Core{ * @param string $id * identifier of the image **/ - private function reactivateImage($id){ + private function reactivateImage(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect parameter"); } @@ -324,7 +343,9 @@ class image implements Core{ * @param string $id * identifier of the image **/ - private function desactivateImage($id){ + private function desactivateImage(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect parameter"); } @@ -357,6 +378,10 @@ class image implements Core{ * path of the image **/ private function uploadImage($id, $file_name){ + $id = $this->app->getPostParam("id"); + $file_name = $this->app->getPostParam("file_name"); + + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect id parameter"); } @@ -390,6 +415,10 @@ class image implements Core{ * identifier of the image **/ private function downloadImage($id){ +<<<<<<< HEAD +======= + $id = $this->app->getPostParam("id"); +>>>>>>> develop if(!isset($id)){ $this->app->setOutput("Error", "Incorrect parameter"); } @@ -410,7 +439,7 @@ class image implements Core{ }catch(NotImplementedError $e){ $this->app->getErrorInstance->NotImplementedHandler($e); } - return $stream; + $this->app->setOutput("Images", $stream); } /** @@ -422,7 +451,10 @@ class image implements Core{ * @param string $member_id * 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)){ $this->app->setOutput("Error", "Incorrect parameter image_id"); } @@ -455,7 +487,10 @@ class image implements Core{ * @param string $image_id * 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)){ $this->app->setOutput("Error", "Incorrect parameter image_id"); } @@ -482,7 +517,7 @@ class image implements Core{ }catch(NotImplementedError $e){ $this->app->getErrorInstance->NotImplementedHandler($e); } - return $members; + $this->app->setOutput("Images", $member); } /** @@ -494,7 +529,10 @@ class image implements Core{ * @param string $member_id * 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)){ $this->app->setOutput("Error", "Incorrect parameter image_id"); } @@ -525,7 +563,7 @@ class image implements Core{ }catch(NotImplementedError $e){ $this->app->getErrorInstance->NotImplementedHandler($e); } - return $member; + $this->app->setOutput("Images", $member); } /** @@ -537,7 +575,10 @@ class image implements Core{ * @param string $member_id * 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)){ $this->app->setOutput("Error", "Incorrect parameter image_id"); } @@ -580,6 +621,10 @@ class image implements Core{ * new status for the member **/ 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)){ $this->app->setOutput("Error", "Incorrect parameter image_id"); }