PrivilegeFactory.php
Go to the documentation of this file.00001 <?PHP
00002
00003 #
00004 # FILE: SPT--PrivilegeFactory.php
00005 #
00006 # METHODS PROVIDED:
00007 # PrivilegeFactory()
00008 # - constructor
00009 # SomeMethod($SomeParameter, $AnotherParameter)
00010 # - short description of method
00011 #
00012 # AUTHOR: Edward Almasy
00013 #
00014 # Part of the Collection Workflow Integration System
00015 # Copyright 2007 Edward Almasy and Internet Scout
00016 # http://scout.wisc.edu
00017 #
00018
00024 class PrivilegeFactory extends ItemFactory {
00025
00026 # ---- PUBLIC INTERFACE --------------------------------------------------
00027
00030
00032 function PrivilegeFactory()
00033 {
00034 $this->ItemFactory("Privilege", "CustomPrivileges", "Id", "Name");
00035 }
00036
00041
00049 function GetPrivileges($IncludePredefined = TRUE, $ReturnObjects = TRUE)
00050 {
00051 # read custom privileges in from DB
00052 $PrivNames = $this->GetItemNames();
00053
00054 # add in predefined privileges if requested
00055 if ($IncludePredefined)
00056 {
00057 global $G_PrivDescriptions;
00058 $PrivNames = $G_PrivDescriptions + $PrivNames;
00059 }
00060
00061 # if caller requested objects to be returned
00062 if ($ReturnObjects)
00063 {
00064 # convert strings to objects and return to caller
00065 foreach ($PrivNames as $Id => $Name)
00066 {
00067 $PrivObjects[$Id] = new Privilege($Id);
00068 }
00069 return $PrivObjects;
00070 }
00071 else
00072 {
00073 # return strings to caller
00074 return $PrivNames;
00075 }
00076 }
00077
00080 # ---- PRIVATE INTERFACE -------------------------------------------------
00081
00082 }
00083
00084
00085 ?>