| 
<?
/*    =======================================
 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'];
 
 // ==========================================
 // Validations
 
 if ($nFolderID == 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();
 
 // ==========================================
 // 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);
 
 // ==========================================
 // Store View
 
 
 $pnlPerson->getPOST();
 
 $fldrPerson = $fldrPeople->Create_Person ("New Person", "Person");
 $pnlPerson->updateObject ($fldrPerson);
 $fldrPerson->Store();
 $fldrPerson->Init_Folder();
 
 $itmName = $fldrPerson->get_Name();
 $pnlName->updateObject ($itmName);
 $itmName->Store();
 
 $itmAddress = $fldrPerson->get_Address();
 $pnlAddress->updateObject ($itmAddress);
 $itmAddress->Store();
 
 $fldrContacts = $fldrPerson->get_Contacts();
 $fldrContacts->Store();
 
 for ($t=0; $t<3; $t++)
 {
 $fldrContact = $fldrContacts->Create_Contact();
 $fldrContact->Store();
 
 $fldrContact->Init_Folder();
 
 $pnlContacts->updateContact ($t, $fldrContact);
 }
 
 header ("Location:list.php?nFolderID=" . $nFolderID . "&");
 
 return;
 
 // ==========================================
 // for testing
 
 print ("<HR>");
 foreach ($_REQUEST as $key => $value)
 print ($key . " = " . $value . "<BR>\n");
 
 
 }
 ?>
 |