9 # SomeMethod($SomeParameter, $AnotherParameter)
10 # - short description of method
12 # AUTHOR: Edward Almasy
14 # Part of the Collection Workflow Integration System
15 # Copyright 2007 Edward Almasy and Internet Scout
16 # http://scout.wisc.edu
26 # ---- PUBLIC INTERFACE --------------------------------------------------
39 global $G_PrivDescriptions;
41 # if caller requested creation of new entry
44 # get highest current ID
46 $HighestId = $DB->Query(
"SELECT Id FROM CustomPrivileges"
47 .
" ORDER BY Id DESC LIMIT 1",
"Id");
50 $this->
Id = max(100, ($HighestId + 1));
52 # add new entry to database
53 $DB->Query(
"INSERT INTO CustomPrivileges (Id, Name)"
54 .
" VALUES (".$this->
Id.
", '".addslashes($Name).
"')");
60 $this->
Id = intval($Id);
62 # if ID indicates predefined privilege
65 # load privilege info from predefined priv array
66 $this->
Name = $G_PrivDescriptions[$this->Id];
70 # load privilege info from database
72 $this->
Name = $DB->Query(
"SELECT Name FROM CustomPrivileges"
73 .
" WHERE Id = ".$this->
Id,
"Name");
87 $DB->Query(
"DELETE FROM CustomPrivileges"
88 .
" WHERE Id = ".$this->
Id);
98 function Id() {
return $this->Id; }
104 function Name($NewValue = NULL)
109 $DB->Query(
"UPDATE CustomPrivileges"
110 .
" SET Name = '".addslashes($NewValue).
"'"
111 .
" WHERE Id = ".$this->
Id);
112 $this->
Name = $NewValue;
129 return (($Id > 0) && ($Id < 100)) ? TRUE : FALSE;
134 # ---- PRIVATE INTERFACE -------------------------------------------------