File: delete.php

Recommend this page to a friend!
  Classes of Michael J. Fuhrman  >  People  >  delete.php  >  Download  
File: delete.php
Role: Example script
Content type: text/plain
Description: Deletes a Person from the People Folder
Class: People
Manage user contacts
Author: By
Last change:
Date: 10 years ago
Size: 1,736 bytes
 

 

Contents

Class file image Download
<?
/* =======================================
    Copyright 1998 - 2010 - E Net Arch
    This program is distributed under the terms of the GNU
    General Public License (or the Lesser GPL).
    ======================================= */

function dirPath() { return ("../../"); }

Include_Once (
dirPath() . "Shared/Classes/Ladder/Ladder_Ladder.cls");
Include_Once (
"Panel_Panel.cls");
Include_Once (
"Common_People.cls");
Include_Once (
"Common_Person.cls");
Include_Once (
"Panel_ContactType.cls");
Include_Once (
dirPath() . "Shared/_app.inc");

Function
php_Main ()
{
   
$nFolderID = 0;
    if (isset (
$_REQUEST ['nFolderID']))
       
$nFolderID = $_REQUEST ['nFolderID'];

   
// ==========================================
    // Validations

   
if ($nFolderID == 0) return;

   
// ==========================================
    // Get ContactTypes Folder

   
$fldrTarget = gblLadder()->getItem ($nFolderID);

   
// =======================================
    // Set ContactTypes Folder

   
$fldrPeople = New ENetArch_Common_People();
   
$fldrPeople->setState ($fldrTarget);

   
// ==========================================
    // Get Item

   
if (isset ($_POST ['ENetArch_People_ID']))
        for (
$t=0; $t<count ($_POST ['ENetArch_People_ID']); $t++)
        {
           
$nPos = $_POST ['ENetArch_People_ID'][$t];
            if (
$nPos != 0)
            {
               
$itmPerson = $fldrPeople->get_Person ($nPos);
               
$itmPerson->Delete();
            }
        }

   
header ("Location:List.php?nFolderID=" . $nFolderID . "&");

    return;

   
// ==========================================
    // for testing

   
print ("<HR>");
    foreach (
$_REQUEST as $key => $value)
    {
        if (
is_array ($value)) { print_r ($value); print ("<BR>"); }
        print (
$key . " = " . $value . "<BR>\n");
    }

}
?>


For more information send a message to info at phpclasses dot org.