Pastoid

The page you are looking at now is at this URL: http://pastoid.com/amg

This paste was last updated on February 5, 2009 at 7:15 pm.

Pasted Coderaw

<?php
// $Id$
 
/**
* @file
* Displays student FERPA Waiver Information  
* 
*
*/
 
/**
* Implement hook_menu().
*
*/
function ferpa_waiver_menu($may_cache){
	$items = array();
	if ($may_cache) {
	} else {
		$items[] = array(
			'path' => 'ferpa_waiver/view',
			'title' => t('FERPA Waiver Info'),
			'description' => t('FERPA Waiver Information'),
			'type' => MENU_NORMAL_ITEM,
			'callback' => 'ferpa_waiver_page',
			'access' => user_access('view FERPA info')
		);
	}	
	return $items;
}
 
/**
* Implementation of hook_perm().
*/
function ferpa_waiver_perm() {
	return array('view FERPA info');
}
 
/**
* Get my data from the DB.
*/
function ferpa_waiver_detail() {
	if (user_access('view FERPA info')) {
 
    $dbConnect = mssql_connect_estab($conn);
 
    $pid = ldap_pbu_id_get_id();
 
    $sql = "select a.address_line_3 as contact_person, a.address_line_1 as address_line_1, a.address_line_2 as address_line_2, a.city as city, a.state as state, a.zip_code as zipcode, a.email_address as email_address, a.evening_phone as evening_phone, a.day_phone as day_phone, a.main_fax as main_fax from addressschedule a where a.people_org_code_id= 'P{$pid}' and a.address_type LIKE 'FRP%' and a.status='A'";
    $result = mssql_query($sql);
 
    if(!mssql_num_rows($result)) {
	    drupal_set_message(t('ERROR: No FERPA File on File for you.'), 'error');
    } else {
	    $content .= theme('ferpa_waiver_detail', $result);
 
			//mssql_close($conn);
      }
      return $content;
  }
}
 
/**
* Page to support the form
*/
function ferpa_waiver_page() {
	$output .= t('<p>This is my data</p>');
	$output .= drupal_get_form('ferpa_waiver_search_form');
 
	return $output;
}
 
 
/**
* Implemetation of form API
*
*/
function ferpa_waiver_search_form() {
	$form['studentname'] = array(
		'#title' = t('Student'),
		'#type' => 'textfield',
		'#description' => t('Enter a student name to search'),
		);
 
	return $form;
}
 
/**
* Form actions go here.
*/
function ferpa_waiver_search_form_submit($form, $form_values) {
	$dbConnect = mssql_connect_estab($conn);
 
  $sqlS = "SELECT p.last_name, p.first_name, p.people_id FROM people p WHERE p.last_name='{$form_values['studentname']}' or p.first_name='{$form_values['studentname']}'";
  $resultS = mssql_query($sqlS);
 
  if(!mssql_num_rows($resultS) OR empty($resultS)) {
    	$output = '<h3>There are no students by that name.</h3>'; 
	    drupal_set_message(t('ERROR: No matches found.'), 'error');
 
	    return $output;
    } else {
	    $content .= theme('ferpa_waiver_search', $resultS);
      }
      return $content;
 
  	watchdog('debug', $sqlS);
}
 
/**
* Implementation of theme_mytheme()
*
*/
function theme_ferpa_waiver_search($resultS) {
	//Initialize HTML table header titles.
	$header = array('Last Name', 'First Name', 'ID Number');
	$rows = array();
	//Iterate through the query result rows
	while ($record = mssql_fetch_array($resultS)) {
		//Clear the row variable.
		$row = array();
		//Put the data into the row in the correct order to synce with header titles.
		foreach (array('last_name','first_name','people_id') as $field) {
			$row[] = $record[$field];
		}
		//put our newly built table into the rows array.
		$rows[] = $row;
	}
	//Turn control over to the theme_table() to do the firsty work.
	return theme('table', $header, $rows);
}
 
function theme_ferpa_waiver_detail($result) {
	//Intialize HTML table header titles.
	$header = array('Contact Name', 'Address Line 1', 'Address Line 2', 'City', 'State', 'Zip Code', 'Email Address', 'Evening Phone', 'Day Phone', 'Main Fax');
	$rows = array();
	//Iterate through query result rows.
	while ($record = mssql_fetch_array($result)) {
		//Clear the row variable.
		$row = array();
		//Put the data into the row in the right order to sync with header titles.
		foreach (array('contact_person', 'address_line_1','address_line_2','city', 'state', 'zipcode', 'email_address', 'evening_phone', 'day_phone', 'main_fax') as $field) {
			$row[] = $record[$field];
		}
		//Put our newly-built table into the rows array.
		$rows[] = $row;
	}
	//Turn over control to theme_table() to do the dirty work.
	return theme('table', $header, $rows);
}
 
?>

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 8
Is this paste spam?
<Hide