/**    
 * function viewer_guid_conenct
 * <pre>
 * 
 * If user has an exisitng intranet login ($new_viewer == false):
 * Given GUID and viewer_id, inject GUID into existing viewer
 *
 * If user never had an intranet login ($new_viewer == true):
 * Given a GUID, create new viewer, person, put into access group, etc.
 *
 * @param $guid [String] [user's GUID]
 * @param $viewer [Int] [user's view_id]
 * @param $new_viewer [BOO] [true when user never had an intranet login]
 * </pre>
 * @return [void]
 *
 *
 */
function viewer_guid_connect($guid, $viewer, $new_viewer)
{
    if ($new_viewer) {
        // 1. create new viewer
        $viewerManager = new RowManager_ViewerManager();
        $viewerManager->setGUID($guid);
        // GUID
        $viewerManager->setLanguageID(1);
        // english
        // TODO this value should not be hard-coded for the account group
        $viewerManager->setAccountGroupID(15);
        // the 'unknown' group
        $viewerManager->setIsActive(true);
        $viewerManager->createNewEntry();
        $viewerID = $viewerManager->getID();
        // get the ID of the newly created viewer
        // 2. put into the 'all' access group
        // PART A
        $viewerAccessGroupManager = new RowManager_ViewerAccessGroupManager();
        $viewerAccessGroupManager->setViewerID($viewerID);
        $viewerAccessGroupManager->setAccessGroupID(ALL_ACCESS_GROUP);
        // add to the 'all' access group
        $viewerAccessGroupManager->createNewEntry();
        // PART B
        $viewerAccessGroupManager = new RowManager_ViewerAccessGroupManager();
        $viewerAccessGroupManager->setViewerID($viewerID);
        $viewerAccessGroupManager->setAccessGroupID(SPT_APPLICANT_ACCESS_GROUP);
        // add to the 'SPT-Student' access group
        $viewerAccessGroupManager->createNewEntry();
        // 3. create new person (or grab person_id from existing record)
        $personManager = new RowManager_PersonManager();
        $personManager->setFirstName('');
        $personManager->setLastName('');
        $personManager->setEmail('');
        $personManager->setSortOrder('person_id');
        $personManager->setAscDesc('DESC');
        // sort by descending person IDs
        $personList = $personManager->getListIterator();
        $personArray = $personList->getDataList();
        //create new entry
        $personManager->createNewEntry();
        $personID = $personManager->getID();
        // get the ID of the newly created person
        // 4. create an access table entry for this (viewer,person) combo
        $accessManager = new RowManager_AccessManager();
        $accessManager->setViewerID($viewerID);
        $accessManager->setPersonID($personID);
        $accessManager->createNewEntry();
    } else {
        $viewerManager = new RowManager_ViewerManager($viewer);
        //echo ($viewerManager->getID());
        $viewerManager->setGUID($guid);
        // GUID
        $viewerManager->updateDBTable();
    }
}
Ejemplo n.º 2
0
 /**
  * function __construct
  * <pre>
  * Initialize the Class ...
  * </pre>
  * @param $accountgroup_id [INTEGER] value used to initialize the list.
  * @param $sortBy [STRING] the field name to sort list by
  * @return [void]
  */
 function __construct($accountgroup_id = -1, $sortBy = '')
 {
     $searchManager = new RowManager_ViewerManager();
     // NOTE: if you need to narrow the field of the search then uncommnet
     // the following and set the proper search criteria.
     $searchManager->setValueByFieldName("accountgroup_id", $accountgroup_id);
     //$searchManager->setValueByFieldName('module_isCommonLook', '1' );
     $searchManager->setSortOrder($sortBy);
     $this->resultSet = $searchManager->find();
 }
Ejemplo n.º 3
0
function process_Form($sqlResult, $template, $agID, $errorMessages)
{
    $agID = $_REQUEST['agID'];
    $viewerM = new RowManager_ViewerManager();
    $viewerAccessGroupM = new RowManager_ViewerAccessGroupManager();
    $join = new JoinPair($viewerM->getJoinOnFieldX('viewer_id'), $viewerAccessGroupM->getJoinOnFieldX('viewer_id'));
    $MTM = new MultiTableManager();
    $MTM->addRowManager($viewerAccessGroupM);
    $MTM->addRowManager($viewerM, $join);
    $MTM->constructSearchCondition('accessgroup_id', '=', $agID, true);
    $MTM->addSortField('viewer_userID');
    $sqlResult = $MTM->find();
    if (!isset($sqlResult)) {
        $errorMessages = 'Failed to join database to get label';
        $template->set('sqlResult', null);
    } else {
        $template->set('sqlResult', $sqlResult);
    }
}
Ejemplo n.º 4
0
  *
  * staff_id [INTEGER]  The id for the staff member.
  * person_id [INTEGER]  The id of the person who is staff.
  */
 $Staff = new RowManager_StaffManager();
 $Staff->dropTable();
 $Staff->createTable();
 /*
  * Viewer Table
  *
  * This is to use the accountadmin_viewer table to add an admin to the hrdb module.
  *
  * viewer_userID [STRING]  This stored the user id of the viewer.
  * viewer_id [INTEGER]  This is the id number for the viewer.
  */
 $Viewer = new RowManager_ViewerManager();
 $Viewer->dropTable();
 $Viewer->createTable();
 /*
  * Staff Table
  *
  * DAObj to manage the staff table.
  *
  * staff_id [INTEGER]  The id for the staff member.
  * person_id [INTEGER]  The id of the person who is staff.
  */
 $Staff = new RowManager_StaffManager();
 $Staff->dropTable();
 $Staff->createTable();
 /*
  * Assignments Table
Ejemplo n.º 5
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     // Otherwise use the standard Templates for the site:
     $path = SITE_PATH_TEMPLATES;
     /*
      * store the link values
      */
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     // store the link labels
     //$this->linkLabels[ 'edit' ] = $this->labels->getLabel( '[Edit]' );
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     /*
      * store any additional link Columns
      */
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     // NOTE:  this parent method prepares the $this->template with the
     // common AdminBox data.
     $this->prepareTemplate($path);
     // store the statevar id to edit
     $this->template->set('editEntryID', $this->superadmin_id);
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     /*
      * Insert the date start/end values for the following date fields:
      */
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*
      * List related Template variables :
      */
     // Store the XML Node name for the Data Access Field List
     $xmlNodeName = RowManager_SuperAdminAssignmentManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'superadmin_id');
     // store data list to the template
     // NOTE: we initialize it here to make sure we capture any new data
     // from a recent processData() call.
     $dataAccessManager = new RowManager_SuperAdminAssignmentManager();
     $dataAccessManager->setSortOrder($this->sortBy);
     //        $this->dataList = new SuperAdminAssignmentList( $this->sortBy );
     $this->dataList = $dataAccessManager->getListIterator();
     $this->template->setXML('dataList', $this->dataList->getXML());
     /*
      * Add any additional data required by the template here
      */
     // get a list of all viewer_id's
     $viewer = new RowManager_ViewerManager();
     $viewer->setSortOrder('viewer_userID');
     $viewerList = new ListIterator($viewer);
     $viewerArray = $viewerList->getDropListArray();
     // set the two arrays (making sure they are properly fliped back to
     // normal)
     // $viewerArray = array();
     //  $viewerArray['812'] = "Russ";
     //   $viewerArray['2878'] = "Hobbe";
     //   $viewerArray['2931'] = "DC";
     $this->template->set('list_viewer_id', $viewerArray);
     //array_flip(
     $templateName = 'siteAdminBox.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_AddSuperAdmin.php';
     return $this->template->fetch($templateName);
 }
Ejemplo n.º 6
0
 /** 
  * function __construct
  * This is the class constructor for Viewer class
  * Initialize a Viewer and determine if they are properly authenticated. 	
  * <pre><code>
  * Save the DB connection Info
  * If no session ID is set then
  *    set the Session ID to empty string
  * end if
  * Get current viewer ID from session ID
  * If viewer ID is empty then
  *    if isDestroySession is set then
  *        Destroy the Session
  *    end if
  *    initialize Empty UnAuthorized Viewer ID
  * else 
  *     User Credientials are valid so ...
  *	 Mark as Valid Authentication	
  *     
  *	 Prepare an SQL statement to lookup the viewer info from the DB
  *	 Now load the Data from the DB
  * end if
  * </pre>
  * @param $isDestroySession [BOOL] Should we destroy the session data if not authenticated?
  * @param $dbName [STRING] The name of the database the viewer info is stored in
  * @param $dbPath [STRING] The path of the database the viewer info is stored in
  * @param $dbUser [STRING] The login ID for the database the viewer info is stored in
  * @param $dbPassword [STRING] The password of the database the viewer info is stored in
  */
 function __construct($isDestroySession = true, $dbName = SITE_DB_NAME, $dbPath = SITE_DB_PATH, $dbUser = SITE_DB_USER, $dbPassword = SITE_DB_PWORD)
 {
     // if no session ID is set then
     if (!isset($_SESSION[SESSION_ID_ID])) {
         // set the Session ID to empty string
         $_SESSION[SESSION_ID_ID] = '';
     }
     if ($_SESSION[SESSION_ID_ID] == '') {
         $_SESSION[SESSION_ID_ID] = 0;
     }
     // Get current viewer ID from session ID
     $this->viewerID = $_SESSION[SESSION_ID_ID];
     // attempt to load a viewerManager object with current viewerID
     $this->viewerManager = new RowManager_ViewerManager($this->viewerID);
     if ($this->viewerManager->isLoaded()) {
         // Update current Session ID with current ViewerID
         $_SESSION[SESSION_ID_ID] = $this->viewerID;
         if ($this->viewerManager->isActive()) {
             $this->isAuthenticated = true;
         } else {
             $this->isAuthenticated = false;
         }
     } else {
         // Info not stored in session, get from GCX
         $this->isAuthenticated = false;
         if (CASUser::checkAuth()) {
             if (!empty($_SESSION['phpCAS']['guid'])) {
                 if ($this->validateLogin($_SESSION['phpCAS']['guid'])) {
                     // a user with this GUID exists in our system
                     $this->isAuthenticated = true;
                 } else {
                     // code added by Russ September 11, 2009
                     // a user with this GUID does not exist in our system - create them
                     $guid = $_SESSION['phpCAS']['guid'];
                     // echo "The GUID[".$guid."]<br/>";
                     $gcxUsername = $_SESSION['phpCAS']['user'];
                     // echo "The gcxUsername[".$gcxUsername."]<br/>";
                     // the gcxUsername is (supposed to be) an email
                     // check to see if there is a cim_hrdb_person record with this email
                     // the comparison needs to be case insensitive (since mysql is insensitive by default, no special doctoring is needed)
                     // search for person record
                     $personManager = new RowManager_PersonManager();
                     $foundPerson = $personManager->loadByEmail($gcxUsername);
                     // get the personID of the person that was searched
                     $personID = $personManager->getID();
                     // if record does not exist
                     // create one
                     // update the personID
                     if (!$foundPerson) {
                         // create a new person record
                         $newpersonManager = new RowManager_PersonManager();
                         $newpersonManager->setEmail($gcxUsername);
                         $newpersonManager->createNewEntry();
                         $personID = $newpersonManager->getID();
                     }
                     // link the personID to the GUID/viewer in the cim_hrdb_access table
                     // first, check to see if any entry already exists in the access table
                     // if foundPerson is true above, it's possible (may have been linked to old viewer/username but not promoted to GCX account yet)
                     $accessManager = new RowManager_AccessManager();
                     $accessEntryFound = $accessManager->loadByPersonID($personID);
                     $viewerID = -1;
                     $createNewViewer = true;
                     if ($accessEntryFound) {
                         $viewerID = $accessManager->getViewerID();
                         $viewerManager = new RowManager_ViewerManager($viewerID);
                         // double check to make sure the viewer referenced in the access table actually exists
                         $viewerAlreadyExists = $viewerManager->isLoaded();
                         if ($viewerAlreadyExists) {
                             // no need to create a new viewer
                             $createNewViewer = false;
                             // update the existing viewer with the GUID and gcxUsername
                             $viewerManager->setGUID($guid);
                             $viewerManager->setUserID($gcxUsername);
                             $viewerManager->setLastLogin();
                             $viewerManager->updateDBTable();
                         }
                         // viewerAlreadyExists
                     }
                     // accessEntryFound
                     if ($createNewViewer) {
                         // create new viewer (user)
                         $newviewerManager = new RowManager_ViewerManager();
                         $newviewerManager->setPassWord('xxx');
                         $newviewerManager->setUserID($gcxUsername);
                         $newviewerManager->setLanguageID(1);
                         // english
                         // TODO this value should not be hard-coded for the account group
                         $newviewerManager->setAccountGroupID(15);
                         // the 'unknown' group
                         $newviewerManager->setIsActive(true);
                         $newviewerManager->setGUID($guid);
                         $newviewerManager->setLastLogin();
                         $newviewerManager->createNewEntry();
                         $viewerID = $newviewerManager->getID();
                         // get the ID of the newly created viewer
                         if ($accessEntryFound) {
                             // update the access table to reference the newly created viewer for the persoa
                             // this is the case where an access table entry may have been orphaned due to the deletion of a viewer
                             $accessManager->setViewerID($viewerID);
                             $accessManager->updateDBTable();
                         } else {
                             // create an access table entry
                             $newaccessManager = new RowManager_AccessManager();
                             $newaccessManager->setViewerID($viewerID);
                             $newaccessManager->setPersonID($personID);
                             $newaccessManager->createNewEntry();
                         }
                     }
                     // put into the 'all' access group
                     $viewerAccessGroupManager = new RowManager_ViewerAccessGroupManager();
                     $viewerAccessGroupManager->setViewerID($viewerID);
                     $viewerAccessGroupManager->setAccessGroupID(ALL_ACCESS_GROUP);
                     // add to the 'all' access group
                     $viewerAccessGroupManager->createNewEntry();
                     // Debugging code added by Russ Martin
                     // echo "validate login failed<br/>";
                     // echo "<pre>".print_r($_SESSION,true)."</pre>";
                     // try again to see if everything updated correctly
                     if ($this->validateLogin($guid)) {
                         // a user/viewer with this GUID now exists in our system
                         $this->isAuthenticated = true;
                     } else {
                         echo "Something has gone wrong: gcxUsername[" . $gcxUsername . "], guid[" . $guid . "]<br/>";
                     }
                 }
             } else {
                 // Debugging code added by Russ Martin
                 // echo "session variable for storing GUID is empty<br/>";
             }
         } else {
             // Debugging code added by Russ Martin
             // echo "CASUser::checkAuth() failed<br/>";
         }
     }
     // set hasSession
     $this->hasSession = $this->viewerID != '';
     // if no session
     if (!$this->hasSession) {
         // User Credentials are invalid so
         // if they want me to destroy the session then
         if ($isDestroySession == true) {
             // Remove session
             // session_destroy();
         }
     }
 }
 protected function getConfirmEmailInfo($regID)
 {
     $infoArray = array();
     $email = '';
     $admEmail = '';
     $confirmNum = '';
     $person_fname = '';
     $person_lname = '';
     $campus_name = '';
     $event_name = '';
     $confirm_text = '';
     // determine if parameter has been set
     if (isset($regID)) {
         // get admin's e-mail
         $viewers = new RowManager_ViewerManager();
         $viewers->setID($this->viewer->getViewerID());
         $view_person = new RowManager_AccessManager();
         $person = new RowManager_PersonManager();
         $viewerInfo = new MultiTableManager();
         $viewerInfo->addRowManager($viewers);
         $viewerInfo->addRowManager($view_person, new JoinPair($viewers->getJoinOnViewerID(), $view_person->getJoinOnViewerID()));
         $viewerInfo->addRowManager($person, new JoinPair($person->getJoinOnPersonID(), $view_person->getJoinOnPersonID()));
         $personInfoList = $viewerInfo->getListIterator();
         $personInfoArray = $personInfoList->getDataList();
         //        echo "<pre>".print_r($personInfoArray,true)."</pre>";
         $person_id = '';
         reset($personInfoArray);
         foreach (array_keys($personInfoArray) as $k) {
             $record = current($personInfoArray);
             $admEmail = $record['person_email'];
             // NOTE: should only be one person per viewer ID (ENFORCE??)
             next($personInfoArray);
         }
         $infoArray['adminEmail'] = $admEmail;
         // get registration info for in confirmation e-mail (and get registrant's e-mail address)
         $regs = new RowManager_RegistrationManager();
         $regs->setRegID($regID);
         $people = new RowManager_PersonManager();
         $assign = new RowManager_AssignmentsManager();
         $campus = new RowManager_CampusManager();
         $event = new RowManager_EventManager();
         $personRegs = new MultiTableManager();
         $personRegs->addRowManager($people);
         $personRegs->addRowManager($regs, new JoinPair($regs->getJoinOnPersonID(), $people->getJoinOnPersonID()));
         $personRegs->addRowManager($assign, new JoinPair($people->getJoinOnPersonID(), $assign->getJoinOnPersonID()));
         $personRegs->addRowManager($campus, new JoinPair($assign->getJoinOnCampusID(), $campus->getJoinOnCampusID()));
         $personRegs->addRowManager($event, new JoinPair($regs->getJoinOnEventID(), $event->getJoinOnEventID()));
         $personList = $personRegs->getListIterator();
         $personArray = $personList->getDataList();
         // 	        echo "<pre>".print_r($personArray,true)."</pre>";
         reset($personArray);
         foreach (array_keys($personArray) as $k) {
             $person = current($personArray);
             $email = $person['person_email'];
             $person_fname = $person['person_fname'];
             // NOTE: should only be one person per registration (ENFORCE??)
             $person_lname = $person['person_lname'];
             $campus_name = $person['campus_desc'];
             $confirmNum = $person['registration_confirmNum'];
             $event_name = $person['event_name'];
             $confirm_text = $person['event_emailConfirmText'];
             $event_basePrice = $person['event_basePrice'];
             $event_contactEmail = $person['event_contactEmail'];
             next($personArray);
         }
         $infoArray['event_email'] = $event_contactEmail;
         $infoArray['email'] = $email;
         $infoArray['person_fname'] = $person_fname;
         $infoArray['person_lname'] = $person_lname;
         $infoArray['campus_name'] = $campus_name;
         $infoArray['confirmNum'] = $confirmNum;
         $infoArray['event_name'] = $event_name;
         $infoArray['confirm_text'] = $confirm_text;
         $infoArray['event_basePrice'] = $event_basePrice;
     }
     return $infoArray;
     //$email.','.$event_name.','.$confirmNum.','.$event_basePrice.','.$person_fname.','.$person_lname.','.$campus_desc.','.$admEmail;
 }
 /**
  * function getListViewerAccounts
  * <pre>
  * Returns a ListIterator for the list of web site accounts this viewer 
  * has access to modify.
  * </pre>
  * @param $sortBy [STRING] the name of the field to sort by (can be a
  * comma seperated list).
  * @return [OBJECT]
  */
 function getListViewerAccounts($sortBy = '')
 {
     $genViewer = new RowManager_ViewerManager();
     // if the current viewer is limited to the Group Access scope then
     // filter list based on current group.
     if (!$this->hasSitePriv()) {
         $viewerMgr = $this->getViewerManager();
         $genViewer->setAccountGroupID($viewerMgr->getAccountGroupID());
     }
     return $genViewer->getListIterator($sortBy);
 }
Ejemplo n.º 9
0
function process_Form($sqlResult, $template, $errorMessages)
{
    //get the names that are being searched
    $fName = $_REQUEST['fName'];
    $lName = $_REQUEST['lName'];
    //create the needed row managers
    $personM = new RowManager_PersonManager();
    $accessM = new RowManager_AccessManager();
    $viewerM = new RowManager_ViewerManager();
    //setup the join pair needed
    $join = new JoinPair($personM->getJoinOnFieldX('person_id'), $accessM->getJoinOnFieldX('person_id'));
    //create the multi table manager and initialize it
    $MTM = new MultiTableManager();
    $MTM->addRowManager($personM);
    $MTM->addRowManager($accessM, $join);
    //if there is a first name being searched - add that as a condition
    if ($fName != "") {
        $MTM->constructSearchCondition('person_fname', ' LIKE ', '%' . $fName . '%', true);
        $personM->constructSearchCondition('person_fname', ' LIKE ', '%' . $fName . '%', true);
    }
    //if there is a last name being searched - add that as a condition
    if ($lName != "") {
        $MTM->constructSearchCondition('person_lname', ' LIKE ', '%' . $lName . '%', true);
        $personM->constructSearchCondition('person_lname', ' LIKE ', '%' . $lName . '%', true);
    }
    //jump to a display function to show what was reteived from the person database
    //$sqlResult = $personM->find();
    //$rows = showContents($sqlResult, $personM, $personM->getFields());
    //jump to a display function to show what was reteived after joining the databases
    $sqlResult = $MTM->find();
    //$rows = showContents($sqlResult, $personM, $personM->getFields());
    $sqlResult->setFirst();
    //create a new viewer manager to keep data pure
    $viewM = new RowManager_ViewerManager();
    //loop through the results saving them to be displayed
    for ($i = 0; $i < $sqlResult->getRowCount(); $i++) {
        //get the next result and the values
        $sqlResult->getNext($personM);
        $f_name[] = $personM->getValueByFieldName('person_fname');
        $l_name[] = $personM->getValueByFieldName('person_lname');
        $person_id[] = $personM->getValueByFieldName('person_id');
        //get the current accessManager values
        $sqlResult->getCurrent($accessM);
        //create the join for access table -> viewer table and search the database for the record
        $join = new JoinPair($accessM->getJoinOnFieldX('viewer_id'), $viewerM->getJoinOnFieldX('viewer_id'));
        $MTM = new MultiTableManager();
        $MTM->addRowManager($accessM);
        $MTM->addRowManager($viewerM, $join);
        $MTM->constructSearchCondition('viewer_id', '=', $accessM->getValueByFieldName('viewer_id'), true);
        $sqlResult2 = $MTM->find();
        //add the needed information to the arrays to be displayed in the template file
        $sqlResult2->getNext($viewM);
        $viewer_id[] = $viewM->getValueByFieldName('viewer_id');
        $user_id[] = $viewM->getValueByFieldName('viewer_userID');
    }
    //check if there was any result from the initial database query, if not add an error message
    if ($sqlResult->getRowCount() < 1) {
        $errorMessages = 'Failed to join database to get label';
        $template->set('f_name', null);
    } else {
        //add the needed information to the template
        $template->set('f_name', $f_name);
        $template->set('l_name', $l_name);
        $template->set('viewer_id', $viewer_id);
        $template->set('person_id', $person_id);
        $template->set('user_id', $user_id);
    }
}
Ejemplo n.º 10
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     // Otherwise use the standard Templates for the site:
     $path = SITE_PATH_TEMPLATES;
     /*
      * store the link values
      */
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     // store the link labels
     $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]');
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     /*
      * store any additional link Columns
      */
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     /*
      * Update any label tags ...
      */
     // example:
     $linkManager = new RowManager_NavBarLinksManager($this->navbarlink_id);
     $seriesKey = moduleNavBar::MULTILINGUAL_SERIES_KEY;
     $pageKey = $linkManager->getXMLNodeName();
     $groupMultiLingual = new MultilingualManager($this->viewer->getLanguageID(), $seriesKey, $pageKey);
     $bridgeManager = $linkManager->getRowLabelBridge($groupMultiLingual);
     $name = $bridgeManager->getLabel();
     $this->labels->setLabelTag('[Title]', '[linkName]', $name);
     // NOTE:  this parent method prepares the $this->template with the
     // common AdminBox data.
     $this->prepareTemplate($path);
     // store the statevar id to edit
     $this->template->set('editEntryID', $this->navlinkviewer_id);
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     /*
      * Insert the date start/end values for the following date fields:
      */
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*
      * List related Template variables :
      */
     // Store the XML Node name for the Data Access Field List
     $xmlNodeName = RowManager_NavLinkViewerManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'navlinkviewer_id');
     // store data list to the template
     // NOTE: we initialize it here to make sure we capture any new data
     // from a recent processData() call.
     //        $this->dataList = new NavLinkViewerList( $this->navbarlink_id, $this->sortBy );
     $viewerGroup = new RowManager_NavLinkViewerManager();
     $this->dataList = $viewerGroup->getListIterator();
     $this->template->setXML('dataList', $this->dataList->getXML());
     /*
      * Add any additional data required by the template here
      */
     $accountGroup = new RowManager_AccountGroupManager();
     $multiLingual = new MultilingualManager($this->viewer->getLanguageID());
     $rowLabelBridge = $accountGroup->getRowLabelBridge($multiLingual);
     $viewerMgr = new RowManager_ViewerManager();
     $joinPair = new JoinPair($viewerMgr->getJoinOnAccountGroupID(), $accountGroup->getJoinOnAccountGroupID());
     $rowLabelBridge->addRowManager($viewerMgr, $joinPair);
     $rowLabelBridge->setSortOrder('label_label,viewer_userID');
     $rowLabelBridge->setLabelTemplate('viewer_userID,label_label', '[label_label]-[viewer_userID]');
     $rowLabelBridge->setPrimaryKeyField($viewerMgr->getPrimaryKeyField());
     $viewerList = $rowLabelBridge->getListIterator();
     $this->template->set('list_viewer_id', $viewerList->getDropListArray());
     $templateName = 'siteAdminBox.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_LinkViewer.php';
     return $this->template->fetch($templateName);
 }
Ejemplo n.º 11
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     $path = $this->pathModuleRoot . 'templates/';
     $this->template = new Template($path);
     // store the form action information
     $this->template->set('formAction', $this->formAction);
     // store the page labels in XML format...
     // NOTE: use this location to update any label tags ...
     // example:
     $account = new RowManager_ViewerManager($this->viewer_id);
     $name = $account->getUserID();
     $this->labels->setLabelTag('[Title]', '[viewerUserID]', $name);
     $this->labels->setLabelTag('[Instr]', '[viewerUserID]', $name);
     $this->template->setXML('pageLabels', $this->labels->getLabelXML());
     /*
      * Form related Template variables:
      */
     // compile list of Access Categories and Related Access Groups
     $categoryArray = array();
     $categoryManager = new RowManager_AccessCategoryManager();
     $seriesKey = moduleAccountAdmin::MULTILINGUAL_SERIES_KEY;
     $pageKey = $categoryManager->getXMLNodeName();
     $multilingualContext = new MultilingualManager($this->viewer->getLanguageID(), $seriesKey, $pageKey);
     $bridgeManager = new RowLabelBridge($categoryManager, $multilingualContext);
     $groupMultiLingualContext = new MultilingualManager($this->viewer->getLanguageID(), $seriesKey, RowManager_AccessGroupManager::XML_NODE_NAME);
     $accessCategoryList = $bridgeManager->getListIterator();
     //        $accessCategoryList = new AccessCategoryList();
     $accessCategoryList->setFirst();
     while ($accessCategory = $accessCategoryList->getNext()) {
         //            $accessGroupList = new AccessGroupList( $accessCategory->getID() );
         $name = $accessCategory->getLabel();
         $groupManager = new RowManager_AccessGroupManager();
         $groupManager->setAccessCategoryID($accessCategory->getID());
         $bridgeManager = $groupManager->getRowLabelBridge($groupMultiLingualContext);
         $accessGroupList = $bridgeManager->getListIterator();
         $categoryArray[$name] = $accessGroupList->getDropListArray();
     }
     $this->template->set('accessCategories', $categoryArray);
     // load the current Groups associated with this account
     $this->template->set('currentGroups', $this->currentGroupList);
     $this->template->set('buttonText', $this->labels->getLabel('[Update]'));
     // return the HTML content for this page
     $templateName = 'page_AccountAccess.php';
     return $this->template->fetch($templateName);
 }
Ejemplo n.º 12
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     //$path = $this->pathModuleRoot.'[RAD_PATH_TEMPLATES]';
     // Otherwise use the standard Templates for the site:
     $path = SITE_PATH_TEMPLATES;
     $this->template = new Template($path);
     // store the form action information
     $this->template->set('formAction', $this->formAction);
     // store the link values
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     $this->template->set('linkValues', $this->linkValues);
     // store the link labels
     $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]');
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     $this->template->set('linkLabels', $this->linkLabels);
     // store any additional link Columns
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     $this->template->set('linkColumns', $this->linkColumns);
     // store the statevar id to edit
     $this->template->set('editEntryID', $this->accountadminaccess_id);
     // store the current op type
     $this->template->set('opType', $this->opType);
     // store the page labels in XML format...
     // NOTE: use this location to update any label tags ...
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $this->template->setXML('pageLabels', $this->labels->getLabelXML());
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     // save the list of form fields
     $this->template->set('formFieldList', $this->formFields);
     // store the field types being displayed
     $fieldTypes = explode(',', FormProcessor_AdminPriv::FORM_FIELD_TYPES);
     $this->template->set('formFieldType', $fieldTypes);
     // Insert the date start/end values for the following date fields:
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*[RAD_DAOBJ_FIELD_DATE_PARAM]*/
     /*
      * List related Template variables :
      */
     // Store the XML Node name for the Data Access Field List
     $this->dataList = $this->accessPrivilegeManager->getListAccountPriviledgeAccess($this->sortBy);
     $xmlNodeName = $this->dataList->getRowManagerXMLNodeName();
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'accountadminaccess_id');
     // store data list to the template
     // NOTE: we initialize it here to make sure we capture any new data
     // from a recent processData() call.
     $this->template->setXML('dataList', $this->dataList->getXML());
     // store the field names being displayed
     $fieldNames = explode(',', FormProcessor_AdminPriv::DISPLAY_FIELDS);
     $this->template->set('dataFieldList', $fieldNames);
     /*
      * Add any additional data required by the template here
      */
     // get a list of viewer_id's that are currently in the table
     $this->dataList = new AccountAdminAccessList($this->sortBy);
     $entryArray = $this->dataList->getDropListArray();
     // get a list of all viewer_id's
     $viewer = new RowManager_ViewerManager();
     $viewer->setSortOrder('viewer_userID');
     $viewerList = $this->accessPrivilegeManager->getListViewerAccounts('viewer_userID');
     $viewerArray = $viewerList->getDropListArray();
     // since list from dataList has viewer_id as value we need to
     // flip the array from the viewerList so that viewer_id is also
     // in values (we'll return the resulting array's back to the
     // proper positions later)
     $flippedArray = array_flip($viewerArray);
     // The difference between the two arrays defines the droplist box
     // e.g. we remove the entries already in the table from the
     // whole list of viewers
     $dropListArray = array_diff($flippedArray, $entryArray);
     // The intersection of the 2 arrays defines the list for displaying
     // the account names for the entries in the list.
     $rowListArray = array_intersect($flippedArray, $entryArray);
     // set the two arrays (making sure they are properly fliped back to
     // normal)
     $this->template->set('list_viewer_id', array_flip($rowListArray));
     // if there is an entry to edit/delete then
     if ($this->accountadminaccess_id != '') {
         // pass the row list for the dropList
         $this->template->set('list_account', array_flip($rowListArray));
     } else {
         // else pass the dropList array
         $this->template->set('list_account', array_flip($dropListArray));
     }
     // get Access Privilege List
     $privList = $this->dataManager->getAccessPrivilegeArray($this->labels, $this->accessPrivilegeManager->getAccessPrivilege());
     $this->template->set('list_accountadminaccess_privilege', $privList);
     $templateName = 'siteAdminBox.php';
     return $this->template->fetch($templateName);
 }
Ejemplo n.º 13
0
echo 'Primary Key after createNewEntry = ' . $viewer->getID() . '<br>';
/* 
 * Using RowManager to update a row in the table
 */
echo '<br><br>Updating Row in Table<br>';
// Updating An entry in the Table:
// get the ID of the entry we just created
$viewerID = $viewer->getID();
// create a new ViewerManager with the viewerID as the primarykey of the row we
// want to work with.
$newViewer = new RowManager_ViewerManager($viewerID);
echo 'languageID before update = ' . $newViewer->getLanguageID() . '<br>';
$newViewer->setLanguageID(1);
$newViewer->updateDBTable();
// now reload the object to get the value from the DB
$updatedViewer = new RowManager_ViewerManager($viewerID);
echo 'languageID after update = ' . $updatedViewer->getLanguageID() . '<br>';
/*
 * Using a List iterator to step through a selection of rows
 */
// now lookup the MC region Access Group
// first create a list iterator based on that table
$groupManager = new RowManager_AccountGroupManager();
$accountGroups = $groupManager->getListIterator();
$accountGroups->setFirst();
$groupID = -1;
while ($group = $accountGroups->getNext()) {
    if ($group->getLabel() == "MC") {
        echo '---> Found MC account group!<br>';
        $groupID = $group->getID();
    }
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     $path = $this->pathModuleRoot . 'templates/';
     // Otherwise use the standard Templates for the site:
     //$path = SITE_PATH_TEMPLATES;
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $this->dataManager = new RowManager_ViewerManager($this->viewer_id);
     $changedViewer = new RowManager_ViewerManager($this->changedViewerID);
     $userID = $changedViewer->getUserID();
     $this->labels->setLabelTag('[Instr]', '[viewerUserID]', $userID);
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // NOTE:  this parent method prepares the $this->template with the
     // common Display data.
     $this->prepareTemplate($path);
     // uncomment this line if you are creating a template for this page
     $templateName = 'page_PasswordChanged.php';
     // otherwise use the generic site template
     //$templateName = '';
     return $this->template->fetch($templateName);
 }
Ejemplo n.º 15
0
function process_Form($sqlResult, $template, $errorMessages)
{
    //get the names that are being searched
    $fName = $_REQUEST['fName'];
    $lName = $_REQUEST['lName'];
    //create the needed row managers
    $personM = new RowManager_PersonManager();
    $accessM = new RowManager_AccessManager();
    $viewerM = new RowManager_ViewerManager();
    //setup the join pair needed
    $join = new JoinPair($personM->getJoinOnFieldX('person_id'), $accessM->getJoinOnFieldX('person_id'));
    //create the multi table manager and initialize it
    $MTM = new MultiTableManager();
    $MTM->addRowManager($personM);
    $MTM->addRowManager($accessM, $join);
    //if there is a first name being searched - add that as a condition
    if ($fName != "") {
        $MTM->constructSearchCondition('person_fname', ' LIKE ', '%' . $fName . '%', true);
        $personM->constructSearchCondition('person_fname', ' LIKE ', '%' . $fName . '%', true);
    }
    //if there is a last name being searched - add that as a condition
    if ($lName != "") {
        $MTM->constructSearchCondition('person_lname', ' LIKE ', '%' . $lName . '%', true);
        $personM->constructSearchCondition('person_lname', ' LIKE ', '%' . $lName . '%', true);
    }
    //jump to a display function to show what was reteived from the database
    $rows = showContents($personM->find(), $personM, $personM->getFields());
    echo '<b>' . $rows . ' accounts found in the person table.</b><br><br>';
    //jump to a display function to show what was reteived from the database
    $sqlResult = $MTM->find();
    echo '<b>' . $sqlResult->getRowCount() . ' connections made between person table and access groups.</b><br>';
    $rows = showContents($sqlResult, $personM, $personM->getFields());
    $sqlResult->setFirst();
    $viewM = new RowManager_ViewerManager();
    for ($i = 0; $i < $sqlResult->getRowCount(); $i++) {
        $sqlResult->getNext($personM);
        $f_name[] = $personM->getValueByFieldName('person_fname');
        $l_name[] = $personM->getValueByFieldName('person_lname');
        $person_id[] = $personM->getValueByFieldName('person_id');
        $sqlResult->getCurrent($accessM);
        $join = new JoinPair($accessM->getJoinOnFieldX('viewer_id'), $viewerM->getJoinOnFieldX('viewer_id'));
        $MTM = new MultiTableManager();
        $MTM->addRowManager($accessM);
        $MTM->addRowManager($viewerM, $join);
        $MTM->constructSearchCondition('viewer_id', '=', $accessM->getValueByFieldName('viewer_id'), true);
        $sqlResult2 = $MTM->find();
        $sqlResult2->getNext($viewM);
        $viewer_id[] = $viewM->getValueByFieldName('viewer_id');
        $user_id[] = $viewM->getValueByFieldName('viewer_userID');
    }
    if ($sqlResult->getRowCount() < 1) {
        $errorMessages = 'Failed to join database to get label';
        $template->set('f_name', null);
    } else {
        $template->set('f_name', $f_name);
        $template->set('l_name', $l_name);
        $template->set('viewer_id', $viewer_id);
        $template->set('person_id', $person_id);
        $template->set('user_id', $user_id);
    }
}