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