function __construct($viewerID) { $accessGroupManager = new RowManager_ViewerAccessGroupManager(); // the permissions are scaled if you have n permission you all have any permission < n $this->isNational = $accessGroupManager->loadByViewerAccessGroup($viewerID, PermissionManager::PERMISSION_NATIONAL); // echo 'isNational['.$isNational.']<br/>'; $this->isRegional = $accessGroupManager->loadByViewerAccessGroup($viewerID, PermissionManager::PERMISSION_REGIONAL) || $this->isNational; // echo 'isRegional['.$isRegional.']<br/>'; $this->isCD = $accessGroupManager->loadByViewerAccessGroup($viewerID, PermissionManager::PERMISSION_CAMPUSDIRECTOR) || $this->isRegional; // echo 'isCD['.$isCD.']<br/>'; $this->isStatsCoordinator = $accessGroupManager->loadByViewerAccessGroup($viewerID, PermissionManager::PERMISSION_STATSCOORDINATOR) || $this->isCD; // echo 'isStatsCoordinator['.$isStatsCoordinator.']<br/>'; $this->isAllStaff = $accessGroupManager->loadByViewerAccessGroup($viewerID, PermissionManager::PERMISSION_ALLSTAFF) || $this->isStatsCoordinator; // echo 'isAllStaff['.$isAllStaff.']<br/>'; }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @param $pageContentHTML [STRING] the html generated by the pageDisplay * object. * @return [STRING] HTML Display data. */ function getHTML($pageContentHTML) { // Create a new Template Object $this->template = new Template($this->pathModuleRoot . 'templates/'); // store the page labels $this->template->setXML('pageLabels', $this->labels->getLabelXML()); // store the pageDisplay object's html $this->template->set('pageContent', $pageContentHTML); // store the path to root. Useful for accessing site images and // resources. $this->template->set('pathToRoot', $this->pathModuleRoot); // special variables added by RM $this->template->set('viewerID', $this->viewer->getUserID()); $viewerID = $this->viewer->getViewerID(); // the permissions are scaled if you have n permission you all have any permission < n $accessLevel = 'unknown'; $accessGroupManager = new RowManager_ViewerAccessGroupManager(); if ($accessGroupManager->loadByViewerAccessGroup($viewerID, 45)) { $accessLevel = 'National'; } else { if ($accessGroupManager->loadByViewerAccessGroup($viewerID, 44)) { $accessLevel = 'Regional'; } else { if ($accessGroupManager->loadByViewerAccessGroup($viewerID, 43)) { $accessLevel = 'Campus Director'; } else { if ($accessGroupManager->loadByViewerAccessGroup($viewerID, 42)) { $accessLevel = 'Stats Coordinator'; } else { if ($accessGroupManager->loadByViewerAccessGroup($viewerID, 41)) { $accessLevel = 'Staff Level'; } } } } } $this->template->set('accessLevel', $accessLevel); // return the html from the commong display template return $this->template->fetch('obj_CommonDisplay.php'); }
/** * function processData * <pre> * Processes the data for this form. * </pre> * @return [void] */ function processData() { // now get list of NEW Groups added to this Account $addedList = array(); for ($indx = 0; $indx < count($this->submittedGroups); $indx++) { $id = $this->submittedGroups[$indx]; // if id not in currentGroupList then add to addList if (!isset($this->currentGroupList[$id])) { $addedList[] = $id; } } // foreach added group $viewerAccessGroup = new RowManager_ViewerAccessGroupManager(); $accessGroupManager = new RowManager_AccessGroupManager(); $adminAccessGroupID = $accessGroupManager->getAdminAccessGroupID(); //print($adminAccessGroupID . "<br>"); for ($indx = 0; $indx < count($addedList); $indx++) { // create new entry $viewerAccessGroup->createNewEntry(); // load values $values = array(); $values['viewer_id'] = $this->viewer_id; $values['accessgroup_id'] = $addedList[$indx]; $viewerAccessGroup->loadFromArray($values); // update DB Table $viewerAccessGroup->updateDBTable(); //add to table accountadmin_accountadminaccess if acces group is adminAccesGroup if ($values['accessgroup_id'] == $adminAccessGroupID) { $aam = new RowManager_AccountAdminAccessManager(); $aam->setViewerID($this->viewer_id); $aam->setGroupPrivilege(); $aam->createNewEntry(); } } // next group $languageManager = new RowManager_LanguageManager(); $languageList = $languageManager->getListIterator(); $languageList->setFirst(); while ($language = $languageList->getNext()) { $navbar = new RowManager_NavBarCacheManager(); $navbar->loadByViewerID($this->viewer_id, $language->getID()); if ($navbar->getID() != -1) { $navbar->setCacheInvalid(); $navbar->updateDBTable(); } } // get list of DELETED Groups from this account $deletedList = array(); foreach ($this->currentGroupList as $key => $value) { if (!in_array($key, $this->submittedGroups)) { $deletedList[] = $key; } } // foreach deleted group for ($indx = 0; $indx < count($deletedList); $indx++) { // if we can load a manager for this account with this group then if ($viewerAccessGroup->loadByViewerAccessGroup($this->viewer_id, $deletedList[$indx])) { // delete $viewerAccessGroup->deleteEntry(); if ($deletedList[$indx] == $adminAccessGroupID) { $aam = new RowManager_AccountAdminAccessManager(); $aam->setViewerID($this->viewer_id); //$aam->setGroupPrivilege(); //print("before delete"); $aam->deleteEntry(); } } } // next group // update currentGroupList with submittedGroupList $groupList = new ViewerAccessGroupList($this->viewer_id, $this->sortBy); $this->currentGroupList = $groupList->getAccessGroupArray(); }