PHP Classes

File: DeleteGroup.php

Recommend this page to a friend!
  Classes of Mostafa Abd-El-Hamid   PHP Azure Active Directory   DeleteGroup.php   Download  
File: DeleteGroup.php
Role: Example script
Content type: text/plain
Description: Class source
Class: PHP Azure Active Directory
Manage users and groups of Windows Azure
Author: By
Last change:
Date: 8 years ago
Size: 2,280 bytes
 

Contents

Class file image Download
<?php
   
//Include menu options applicable to all pages of the web site
   
include("PhpSampleTemplate.php");
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>
            Delete Group
        </title>
    </head>
    <body>
        <?php
           
// If this was not a post back show the delete group form
      
if (!isset($_POST['submit'])) {
               
$group = GraphServiceAccessHelper::getEntry('groups',$_GET['id']);
                echo(
'<H1>Do you really want to delete this group?<H1>');
                echo(
'<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$_GET['id']. '">');
                echo(
'<table>');
                echo(
'<tr><td><b>Display Name:</b></td><td><input type="text" disabled size="20" maxlength="100" name="dname" value="'. $group->{'displayName'}.'"></td></tr>');
                echo(
'<tr><td><b>Group:</b></td><td><input type="text" disabled size="20" maxlength="15" name="alias" value="'. $group->{'description'}.'"></td></tr>');
                echo (
'<input name="id" type="hidden" value='.$_GET['id'].'>');
                echo(
'<tr><td><input type="submit" value="Delete" name="submit"></td></tr>');
                echo(
'</table>');
                echo(
'</form>');
       }
       else {
               
// Delete the group and display a message
               
$group = GraphServiceAccessHelper::deleteEntry('groups',$_POST['id']);
               
//Check to see if we got back an error.
               
if(!empty($group->{'odata.error'}))
                {
                   
$message = $group->{'odata.error'}->{'message'};
                    echo(
'<p>Group deletion failed. Service returned error:<b>'.$message->{'value'}. '</b> Please go back to <a href="DeleteGroup.php'.'?id='.$_POST['id'].'">Delete Group</a></p>');
                }
                else {
                    echo(
'<p>');
                    echo(
'<b>Deleted the Group with the following Key:</b>'.$_POST['id'] );
                    echo(
'<br/><br/><br/>');
                    echo(
'You can go back to <a href="DisplayGroups.php">Manage Groups</a> to continue managing Group information.');
                    echo(
'</p>');
                }
       }
 
 
?>
</body>
</html>