コード例 #1
0
function get_AG($template, $errorMessages)
{
    $accessGroupM = new RowManager_AccessGroupManager();
    $multilingualLabelL = new RowManager_MultilingualLabelManager();
    $join = new JoinPair($multilingualLabelL->getJoinOnFieldX('label_key'), $accessGroupM->getJoinOnFieldX('accessgroup_key'));
    $MTM = new MultiTableManager();
    $MTM->addRowManager($multilingualLabelL);
    $MTM->addRowManager($accessGroupM, $join);
    $MTM->constructSearchCondition('language_id', '=', '1', true);
    $result = $MTM->find();
    if (!isset($result)) {
        $errorMessages = 'Failed to join database to get label';
    } else {
        $result->setFirst();
        $count = 0;
        while ($resultMLM = $result->getNext($multilingualLabelL)) {
            $resultAGM = $result->getCurrent($accessGroupM);
            $agLabel[] = $resultMLM->getLabel();
            $agID[] = $resultAGM->getID();
        }
        $template->set('agLabel', $agLabel);
        $template->set('agID', $agID);
    }
    return $errorMessages;
}
コード例 #2
0
 /**
  * function __construct
  * <pre>
  * Initialize the Class ...
  * </pre>
  * @param $personyear_id [INTEGER] value used to initialize the list.
  * @param $sortBy [STRING] the field name to sort list by
  * @return [void]
  */
 function __construct($campus_id = -1, $assignment_status_list = '', $sortBy = '')
 {
     // NOTE: if you need to narrow the field of the search then uncommnet
     // the following and set the proper search criteria.
     if ($campus_id == '') {
         $campus_id = -1;
     }
     if ($sortBy == '') {
         $sortBy = 'personyear_id';
     }
     $personYearManager = new RowManager_PersonYearManager();
     $campusAssignments = new RowManager_AssignmentsManager();
     $campusAssignments->setCampusID($campus_id);
     $person = new RowManager_PersonManager();
     $searchManager = new MultiTableManager();
     //new RowManager_PersonYearManager();
     $searchManager->addRowManager($campusAssignments);
     $searchManager->addRowManager($personYearManager, new JoinPair($personYearManager->getJoinOnPersonID(), $campusAssignments->getJoinOnPersonID(), JOIN_TYPE_LEFT));
     $searchManager->addRowManager($person, new JoinPair($person->getJoinOnPersonID(), $personYearManager->getJoinOnPersonID()));
     if ($assignment_status_list != '') {
         $searchManager->addSearchCondition('assignmentstatus_id in (' . $assignment_status_list . ')');
         // filter results by student-campus status
     }
     $searchManager->setSortOrder($sortBy);
     //         $this->resultSet = $searchManager->find();
     $foundIterator = $searchManager->getListIterator();
     $foundArray = $foundIterator->getDataList();
     /** Add new person year entries as required **/
     reset($foundArray);
     foreach (array_keys($foundArray) as $k) {
         $record = current($foundArray);
         $person_id = $record['person_id'];
         // person_id must exist given join condition, personyear_id and/or year_id may not
         $personyear_id = $record['personyear_id'];
         /** Add new person year entry if person doesn't have one yet **/
         if ($personyear_id == "") {
             $newPersonYear = new RowManager_PersonYearManager();
             $newPersonYear->setPersonID($person_id);
             $newPersonYear->setYear(RowManager_PersonYearManager::OTHER);
             $newPersonYear->createNewEntry();
         }
         next($foundArray);
     }
     $keepList = 'campus_id';
     $searchManager->deleteValuesExceptSome($keepList);
     $this->resultSet = $searchManager->find();
     //         echo "record array  = <pre>".print_r($foundArray,true)."</pre>";
     // 	     $searchManager->setValueByFieldName("campus_id", $campus_id );
     //$searchManager->setValueByFieldName('module_isCommonLook', '1' );
 }
コード例 #3
0
ファイル: VP.php プロジェクト: andrewroth/c4c_intranet
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);
    }
}
コード例 #4
0
ファイル: VP.php プロジェクト: andrewroth/c4c_intranet
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);
    }
}