Commit 87805f215865e974404d9aa0e92eba472823b294
1 parent
b2b7271c
changed userclass to groupID and added more comments
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@121 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
11 additions
and
14 deletions
lib/SiteMap.inc
| ... | ... | @@ -32,12 +32,12 @@ class SiteMap { |
| 32 | 32 | * the corresponding page for this action |
| 33 | 33 | * @param $sectionName |
| 34 | 34 | * the section this page falls under |
| 35 | - * @param $userClass | |
| 36 | - * the user class with access to this page | |
| 35 | + * @param $groupID | |
| 36 | + * the user group with access to this page | |
| 37 | 37 | */ |
| 38 | - function addPage($action, $page, $sectionName, $userClass) { | |
| 38 | + function addPage($action, $page, $sectionName, $groupID) { | |
| 39 | 39 | // add to map |
| 40 | - $this->siteMapArray[$sectionName][$userClass][$action] = $page; | |
| 40 | + $this->siteMapArray[$sectionName][$groupID][$action] = $page; | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| ... | ... | @@ -45,23 +45,20 @@ class SiteMap { |
| 45 | 45 | * |
| 46 | 46 | * @param $action |
| 47 | 47 | * the action to lookup pages for |
| 48 | - * @param $userGroup | |
| 49 | - * the user group to perform page level validation against | |
| 48 | + * @param $groupID | |
| 49 | + * the user group ID to perform page level validation against | |
| 50 | 50 | * @return |
| 51 | 51 | * the page to redirect to, or false if the user class doesn't |
| 52 | 52 | * have access to the page |
| 53 | 53 | */ |
| 54 | - function getPage($action, $userGroup) { | |
| 55 | - // map incoming userClass to number | |
| 56 | - //$uc = constant($userClass); | |
| 54 | + function getPage($action, $groupID) { | |
| 55 | + global $default; | |
| 57 | 56 | |
| 58 | - // look up the id for this group | |
| 59 | - $groupID = group_to_name($userGroup); | |
| 60 | - | |
| 61 | - // iterate through multidim sitemap array | |
| 57 | + // for each section | |
| 62 | 58 | foreach ($this->siteMapArray as $section => $valArr) { |
| 59 | + // for each group, page array combination | |
| 63 | 60 | foreach ($valArr as $requiredGroup => $pageArr) { |
| 64 | - if ($groupID <= group_to_name($requiredGroup)) { | |
| 61 | + if ($groupID <= lookup_id($default->owl_groups_table, "name", $requiredGroup)) { | |
| 65 | 62 | // now loop through pages until we find the right one |
| 66 | 63 | foreach ($pageArr as $ackshin => $page) { |
| 67 | 64 | if ($ackshin == $action) { | ... | ... |