Updating The Graduate Faculty Web Listing

  1. Open FacultyWebListingMailMerge.doc from I:\Information Technology\Systems\Faculty\FacultyWebListing
  2. Click yes at the first popup. It asks if you will like to continue with running the SQL command to get the data
  3. Select Data Source: I:\Information Technology\Systems\Faculty\FacultyWebListing\GraduateFaculty.mdb
  4. Go to Tools > Letters and Mailings > Mail Merge... Will brings up a sidebar
  5. Step through the steps on the sidebar until you get to step 6. Merge all records to new document. Save the document created as a text page. I use the following naming convention: faculty_listmmddyyyy.txt for example faculty_list05062010.txt.
  6. Edit the http://www.umbc.edu/gradschool/about/faculty.html page, adding the neccessary HTML header parts between letters. TODO: Come up with a script of some sort that will automate this step. Here’s what I’ve programmed in PHP which can be ran at: http://www.umbc.edu/gradschool/_gradschool_archive_/test/facultyweblisting/index.php
<?php
/*	
 *  This php program inserts the alphabets and anchor links into the faculty list.
 *  Written by Mahmud F. (mf4@umbc.edu) on 7/7/2009
 *  
 *    1) Run the MailMerge, instructions at: 
 *    http://www.umbc.edu/gradbusiness/techdocuments/system/faculty/faculty_web_listing 
 *    and save a text file (faculty_list.txt) of the output with no insertion of new lines,
 *    windows(default) / West European, End lines with CR/LF and upload it to this directory.
 *    
 *    2) Run this page and copy and paste the source into faculty_output.php
 *    
 *    3) Verify the faculty page: http://www.umbc.edu/gradschool/about/faculty.html
 */
 
$file_array = file("faculty_list05062010.txt"); // Change this to whatever you named the file from the 
$arr = array();
 
function get_string_between($string, $start, $end){
        $string = " ".$string;
        $ini = strpos($string,$start);
        if ($ini == 0) return "";
        $ini += strlen($start);   
        $len = strpos($string,$end,$ini)-$ini;
        return substr($string,$ini,$len);
}
 
foreach ($file_array as $v) {
	$parsed = get_string_between($v, "<p>", "</p>");
	array_push($arr,"<p>".$parsed."</p>");
}
 
 
$all = "";
$all .= "<a name=\"A\"></a><h3>A</h3>";
 
for($i=0;$i<=count($arr);$i++) { //count($arr)
	if($arr[$i] != "") {
		$aFaculty = $arr[$i];
		$aFaculty2 = $arr[$i-1];
		$aLetter1 = $aFaculty[11];
		$aLetter2 = $aFaculty2[11];
		
		
		if ( strpos($aLetter1, "A") !== false ){
			$all .= $aFaculty;
			$boolB = false;
		}
		
		
		if ( strpos($aLetter1, "B") !== false ){
			
			if ($boolB == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolB = true;
			}
			$all .= $aFaculty;
			$boolC = false;
		}
		
		
		if ( strpos($aLetter1, "C") !== false ){
			
			if ($boolC == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolC = true;
			}
			$all .= $aFaculty;
			$boolD = false;
		}
		
		
		if ( strpos($aLetter1, "D") !== false ){
			
			if ($boolD == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolD = true;
			}
			$all .= $aFaculty;
			$boolE = false;
		}
		
		
		if ( strpos($aLetter1, "E") !== false ){
			
			if ($boolE == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolE = true;
			}
			$all .= $aFaculty;
			$boolF = false;
		}
		
		
		if ( strpos($aLetter1, "F") !== false ){
			
			if ($boolF == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolF = true;
			}
			$all .= $aFaculty;
			$boolG = false;
		}
		
		
		if ( strpos($aLetter1, "G") !== false ){
			
			if ($boolG == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolG = true;
			}
			$all .= $aFaculty;
			$boolH = false;
		}
		
		
		if ( strpos($aLetter1, "H") !== false ){
			
			if ($boolH == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolH = true;
			}
			$all .= $aFaculty;
			$boolI = false;
		}
		
		
		if ( strpos($aLetter1, "I") !== false ){
			
			if ($boolI == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolI = true;
			}
			$all .= $aFaculty;
			$boolJ = false;
		}
		
		
		if ( strpos($aLetter1, "J") !== false ){
			
			if ($boolJ == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolJ = true;
			}
			$all .= $aFaculty;
			$boolK = false;
		}
		
		
		if ( strpos($aLetter1, "K") !== false ){
			
			if ($boolK == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolK = true;
			}
			$all .= $aFaculty;
			$boolL = false;
		}
		
		
		if ( strpos($aLetter1, "L") !== false ){
			
			if ($boolL == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolL = true;
			}
			$all .= $aFaculty;
			$boolM = false;
		}
		
		
		if ( strpos($aLetter1, "M") !== false ){
			
			if ($boolM == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolM = true;
			}
			$all .= $aFaculty;
			$boolN = false;
		}
		
		
		if ( strpos($aLetter1, "N") !== false ){
			
			if ($boolN == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolN = true;
			}
			$all .= $aFaculty;
			$boolO = false;
		}
		
		
		if ( strpos($aLetter1, "O") !== false ){
			
			if ($boolO == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolO = true;
			}
			$all .= $aFaculty;
			$boolP = false;
		}
		
		
		if ( strpos($aLetter1, "P") !== false ){
			
			if ($boolP == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolP = true;
			}
			$all .= $aFaculty;
			$boolQ = false;
		}
		
		
		if ( strpos($aLetter1, "Q") !== false ){
			
			if ($boolQ == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolQ = true;
			}
			$all .= $aFaculty;
			$boolR = false;
		}
		
		
		if ( strpos($aLetter1, "R") !== false ){
			
			if ($boolR == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolR = true;
			}
			$all .= $aFaculty;
			$boolS = false;
		}
		
		
		if ( strpos($aLetter1, "S") !== false ){
			
			if ($boolS == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolS = true;
			}
			$all .= $aFaculty;
			$boolT = false;
		}
		
		
		if ( strpos($aLetter1, "T") !== false ){
			
			if ($boolT == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolT = true;
			}
			$all .= $aFaculty;
			$boolU = false;
		}
		
		
		if ( strpos($aLetter1, "U") !== false ){
			
			if ($boolU == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolU = true;
			}
			$all .= $aFaculty;
			$boolV = false;
		}
		
		
		if ( strpos($aLetter1, "V") !== false ){
			
			if ($boolV == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolV = true;
			}
			$all .= $aFaculty;
			$boolW = false;
		}
		
		
		if ( strpos($aLetter1, "W") !== false ){
			
			if ($boolW == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolW = true;
			}
			$all .= $aFaculty;
			$boolX = false;
		}
		
		
		if ( strpos($aLetter1, "X") !== false ){
			
			if ($boolX == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolX = true;
			}
			$all .= $aFaculty;
			$boolY = false;
		}
		
		
		if ( strpos($aLetter1, "Y") !== false ){
			
			if ($boolY == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolY = true;
			}
			$all .= $aFaculty;
		}
		
		
		if ( strpos($aLetter1, "Z") !== false ){
			
			if ($boolZ == false){
				$all .= "<a href=\"#top\">back to top</a><br /><a name=\"$aLetter1\"></a><h3>$aLetter1</h3>";
				$boolZ = true;
			}
			$all .= $aFaculty;
		}
 
	}
	
}
 
$all .= "<a href=\"#top\">back to top</a><br /><br />";	
 
printf($all) ;
 
?>

Probably not the most efficient code but it works :D

  1. copy and paste the contents the above outputs into http://www.umbc.edu/gradschool/includes/faculty_list_output.php
  2. verify the faculty page to see and correct any mistakes.
 
system/faculty/faculty_web_listing.txt · Last modified: 05.06.2010 11:22 by 130.85.181.172
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki