PHP Classes

File: edit.php

Recommend this page to a friend!
  Classes of Michael J. Fuhrman   People   edit.php   Download  
File: edit.php
Role: Example script
Content type: text/plain
Description: Edits a Person from the People Folder
Class: People
Manage user contacts
Author: By
Last change:
Date: 14 years ago
Size: 4,219 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 (
"Common_Name.cls");
Include_Once (
"Common_Address.cls");
Include_Once (
"Common_Contacts.cls");
Include_Once (
"Common_Contact.cls");
Include_Once (
"Common_ContactType.cls");
Include_Once (
"Common_ContactMethod.cls");
Include_Once (
"Common_ContactTypes.cls");
Include_Once (
"Common_ContactTypes_Ref.cls");
Include_Once (
"Panel_Person.cls");
Include_Once (
"Panel_Name.cls");
Include_Once (
"Panel_Address.cls");
Include_Once (
"Panel_Contacts.cls");
Include_Once (
"Panel_Contact.cls");
Include_Once (
"Panel_ContactTypes.cls");
Include_Once (
"Panel_ContactMethod.cls");
Include_Once (
dirPath() . "Shared/_app.inc");

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

   
$nPos = 0;
    if (isset (
$_REQUEST ['nPos']))
       
$nPos = $_REQUEST ['nPos'];

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

   
if ($nFolderID == 0) return;
    if (
$nPos == 0) return;

   
// =======================================
    // Classes

   
$clsCommon_Person = gblLadder()->getClass ("Common_ContactType")->ID();
   
$clsCommon_People = gblLadder()->getClass ("Common_People")->ID();

   
// ==========================================
    // Get Person Folder

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

   
// =======================================
    // Set Person Folder

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

   
$fldrPerson = $fldrPeople->get_Person ($nPos);

   
// ==========================================
    // Panels

   
$pnlPerson = new ENetArch_Panels_Common_Person();
   
$pnlName = new ENetArch_Panels_Common_Name();
   
$pnlAddress = new ENetArch_Panels_Common_Address();
   
$pnlContacts = new ENetArch_Panels_Common_Contacts();
   
$pnlContact = new ENetArch_Panels_Common_Contact();
   
$pnlContactTypes = new ENetArch_Panels_Common_ContactTypes();
   
$pnlContactMethod = new ENetArch_Panels_Common_ContactMethod();

   
$pnlContactTypes->setFolder ($fdlrContactTypes);

   
// ==========================================
    // View

   
$pnlPerson->setPanelName ("ENetArch.Person");
   
$pnlPerson->setPanel_Name ($pnlName);
   
$pnlPerson->setPanel_Address ($pnlAddress );
   
$pnlPerson->setPanel_Contacts ($pnlContacts);
   
$pnlContacts->setPanel_Contact ($pnlContact );
   
$pnlContact->setPanel_Type ($pnlContactTypes);
   
$pnlContact->setPanel_Method ($pnlContactMethod);

   
$pnlPerson->setPanel ($fldrPerson);

?>
<style> @import url("styles.css"); </style>
    <script src="jquery_lite.js"></script>
    <script src="trgrs_People.js"></script>
    <script>
        ENetArch.People.nFolderID = <?= $nFolderID ?>;
        ENetArch.People.nPos = <?= $nPos ?>;
    </script>
<?
?>
<div ID="ENetArch_Navigation">
    <a href="javascript:void(0);" onClick="ENetArch.People.List ();">List</a> |
    <a href="javascript:void(0);" onClick="ENetArch.People.New ();">New</a> |
    <a href="javascript:void(0);" onClick="ENetArch.People.View ();">View</a> |
    <a href="javascript:void(0);" onClick="ENetArch.People.Edit ();">Edit</a> |
    <a href="javascript:void(0);" onClick="ENetArch.People.Delete ();">Delete</a>
    </div>
<?
   
print ("<div ID=\"ENetArch_People\">\n");
    print (
"<form name=\"ENetArch_Person_Form\" ID=\"ENetArch_Person_Form\"
        onSubmit =\"ENetArch.People.Update(this)\" >\n"
);
    print (
"<table ID=\"" . $pnlPerson->getPanelID() . "\">\n");
   
$pnlPerson->drawHeader();
   
$pnlPerson->drawPanel_Edit();
    print (
"</table>\n");
    print (
"<input type=\"submit\" name=\"submit_form\" value=\"submit\">\n");
    print (
"</form>\n");
    print (
"</div>\n");
?>
<script>
        $("ENetArch_Navigation").style.width = $("ENetArch_People").offsetWidth - 6;
    </script>
<?
}
?>