function showContents($folder, $name, &$data) { $n = $name; //splitLast($name) . "/x"; $data[$n] = array(); //$data[$n[count($n) - 1]] = array(); $dirs = array(); foreach ($folder as $key) { if (is_dir($key) && $key != "condos" && $key != "properties") { array_push($dirs, $key); } else { $k = $key; //splitLast($key); $data[$n][$k] = $k; } } if (count($dirs) > 0) { foreach ($dirs as $dir) { $files = array_merge(glob("{$dir}/.htaccess"), glob("{$dir}/.htpasswd")); $files = array_merge(glob("{$dir}/*"), $files); showContents($files, $dir, $data[$n]); } } }
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); } }