PHP Classes
elePHPant
Icontem

File: Security/Admin/Policy/add.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michael J. Fuhrman  >  Security  >  Security/Admin/Policy/add.php  >  Download  
File: Security/Admin/Policy/add.php
Role: Example script
Content type: text/plain
Description: Adds a Policy to a Policy Folder
Class: Security
Manage user accounts and access controls
Author: By
Last change:
Date: 4 years ago
Size: 2,114 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).
    www.ENetArch.net
    ======================================= */

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

    include_once (
dirPath() . "Marketing/Security/rootFolder.php");
    Include_Once (
dirPath() . "Shared/Classes/Ladder/Ladder_Ladder.cls");
    Include_Once (
dirPath() . "Marketing/Security/Classes/Site_Policy.cls");
    Include_Once (
dirPath() . "Marketing/Security/Classes/Site_Policies.cls");
    Include_Once (
dirPath() . "Marketing/Security/Panels/Panel_Panel.cls");
    Include_Once (
dirPath() . "Marketing/Security/Panels/Panel_Ladder_Item.cls");
    Include_Once (
dirPath() . "Marketing/Security/Panels/Panel_Site_Policy.cls");
    Include_Once (
dirPath() . "Shared/_app.inc");

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

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

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

   
$szNameSpace = "ENetArch_Panel_Content";
    if (isset (
$_REQUEST["szNameSpace"]))
       
$szNameSpace = $_REQUEST["szNameSpace"];

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

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

    // ==========================================
    // Get Policies Folder

   
$fldrTarget = gblLadder()->getItem ($nID);
   
$fldrPolicies = New ENetArch_Site_Policies();
   
$fldrPolicies->setState ($fldrTarget);

   
// ==========================================
    // Create New Instance

   
$itmPolicy = $fldrPolicies->Create_Policy("New Policy", "This is a New Policy");

    if (
$itmPolicy == null) return;

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

   
$pnlPolicy = new ENetArch_Panels_Site_Policy();
   
$pnlPolicy->setPanelName ($szNameSpace. ".Policy");
   
$pnlPolicy->getPost ();
   
$pnlPolicy->updateObject ($itmPolicy);

   
$itmPolicy->Store();
}
?>