diff --git a/app/controllers/ProfileController.php b/app/controllers/ProfileController.php index 3691e6d11c740ea5585e0cc8a939f2b8b1df6091..7bc03c5917b2f07afa73aafac5d80ee35fdf5265 100644 --- a/app/controllers/ProfileController.php +++ b/app/controllers/ProfileController.php @@ -16,6 +16,7 @@ </soap:Envelope>'; $headers = array( "Content-Type: text/xml;charset=\"utf-8\"", + 'Content-Length: ' .strlen($request_param), ); $url = $_ENV["SOAP_URL"]; $ch = curl_init(); @@ -25,11 +26,10 @@ curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); - // if($response === FALSE){ - // var_dump("Gagal request"); - // } - // var_dump($response); - return $this->view('profile','index',["premium_status" => $response]); + curl_close($ch); + $temp = str_replace('<?xml version=\'1.0\' encoding=\'UTF-8\'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getPremiumStatusResponse xmlns:ns2="http://service.LMS.com/"><return>',"",$response); + $temp2 = str_replace('</return></ns2:getPremiumStatusResponse></S:Body></S:Envelope>',"",$temp); + return $this->view('profile','index',["premium_status" => $temp2]); } } ?> \ No newline at end of file diff --git a/app/views/profile/index.php b/app/views/profile/index.php index d5be4677d8a2e5a31f4cf0b0e4d3bbad3d794322..43f5d2a0f890835de5e4160312b6562869c3ed53 100644 --- a/app/views/profile/index.php +++ b/app/views/profile/index.php @@ -138,8 +138,10 @@ <button type='button' onclick='toggle()' class='edit-button' id='profile-button'>Edit</button> </div> <div> - <?php if (($data["premium_status"] === 'REJECTED' || $data["premium_status"] === "NOT PREMIUM") && $thisUser["user_role"] === "STUDENT"){ ?> - <button id="subscribe-button" type="button" class="edit-button" ><a href="/api/subscribe/subscribe.php">Subscribe</a></button> + <?php + if($thisUser["user_role"] === "STUDENT" &&($data['premium_status'] === "NOT PREMIUM" || $data["premium_status" === "REJECTED"])){ + ?> + <button id="subscribe-button" type="button" class="edit-button" ><a href="/api/subscribe/subscribe.php">Subscribe</a></button> <?php } ?> </div> </form> diff --git a/public/css/profile/profile.css b/public/css/profile/profile.css index 1142b01fb0611735959a1436463f5c6f715ea494..184203dccbd1df171e6ccfd2e9bb07d1664c6a8d 100644 --- a/public/css/profile/profile.css +++ b/public/css/profile/profile.css @@ -158,6 +158,11 @@ a { font-size: var(--normal-font-size); } +.edit-button a{ + text-decoration: none; + color: white; +} + .change-buttons { display: flex; margin: 3px;