Commit ae200756 authored by Brett Bieber's avatar Brett Bieber
Browse files

But wakeup doesn't exist any more! Fix call to undefined function.

parent 72a14e3c
......@@ -12,6 +12,7 @@
*/
class UNL_Peoplefinder_Record
{
public $dn; // distinguished name
public $cn;
public $ou;
public $eduPersonAffiliation;
......@@ -25,6 +26,7 @@ class UNL_Peoplefinder_Record
public $telephoneNumber;
public $title;
public $uid;
public $unlHROrgUnitNumber;
public $unlHRPrimaryDepartment;
public $unlHRAddress;
public $unlSISClassLevel;
......@@ -42,7 +44,7 @@ class UNL_Peoplefinder_Record
// public $unlSISPermZip;
public $unlSISMajor;
public $unlEmailAlias;
function __construct($options = array())
{
if (isset($options['uid'])
......@@ -50,9 +52,9 @@ class UNL_Peoplefinder_Record
return $options['peoplefinder']->getUID($options['uid']);
}
}
/**
* Takes in a string from the LDAP directory, usually formatted like:
* ### ___ UNL 68588-####
......@@ -71,12 +73,12 @@ class UNL_Peoplefinder_Record
$address['locality'] = '';
$address['region'] = 'NE';
$address['postal-code'] = '';
if (count($parts) == 3) {
// Assume we have a street address, city, zip.
$address['locality'] = trim($parts[1]);
}
// Now lets find some important bits.
foreach ($parts as $part) {
if (preg_match('/([\d]{5})(\-[\d]{4})?/', $part)) {
......@@ -84,7 +86,7 @@ class UNL_Peoplefinder_Record
$address['postal-code'] = trim($part);
}
}
switch (substr($address['postal-code'], 0, 3)) {
case '681':
$address['locality'] = 'Omaha';
......@@ -93,15 +95,15 @@ class UNL_Peoplefinder_Record
$address['locality'] = 'Lincoln';
break;
}
return $address;
}
/**
/**
* Formats a major subject code into a text description.
*
* @param string $subject Subject code for the major eg: MSYM
*
*
* @return string
*/
public function formatMajor($subject)
......@@ -109,7 +111,7 @@ class UNL_Peoplefinder_Record
$c = new UNL_Cache_Lite();
if ($subject_xml = $c->get('catalog subjects')) {
} else {
if ($subject_xml = file_get_contents('http://bulletin.unl.edu/?view=subjects&format=xml')) {
$c->save($subject_xml);
......@@ -118,13 +120,13 @@ class UNL_Peoplefinder_Record
$c->get('catalog subjects');
}
}
$d = new DOMDocument();
$d->loadXML($subject_xml);
if ($subject_el = $d->getElementById($subject)) {
return $subject_el->textContent;
}
switch ($subject) {
case 'UNDL':
return 'Undeclared';
......@@ -134,12 +136,12 @@ class UNL_Peoplefinder_Record
return $subject;
}
}
/**
* Format a three letter college abbreviation into the full college name.
*
* @param string $college College abbreviation = FPA
*
*
* @return string College of Fine & Performing Arts
*/
public function formatCollege($college)
......@@ -149,7 +151,7 @@ class UNL_Peoplefinder_Record
if (isset($colleges->colleges[$college])) {
return htmlentities($colleges->colleges[$college]);
}
return $college;
}
......@@ -172,19 +174,15 @@ class UNL_Peoplefinder_Record
return 'http://planetred.unl.edu/pg/icon/unl_'.str_replace('-', '_', $this->uid).'/'.$size.'/';
}
function __wakeup()
function getRoles()
{
foreach ($this as $var=>$val) {
if ($val instanceof UNL_LDAP_Entry_Attribute) {
$this->$var->__wakeup();
}
}
return new UNL_Peoplefinder_Person_Roles(array('dn'=>$this->dn));
}
function __toString()
{
return $this->uid;
return (string)$this->uid;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment