コード例 #1
0
 /**
  * updateEmployees
  *
  * loops over employees generated by generatePopulations() and
  *   modifies/updates those people within the DATA_MART
  *
  * @since		version 1.0.0
  */
 function updateEmployees($emeritus = false)
 {
     $person_type = $emeritus ? 'Emeriti' : 'Employees';
     echo $this->line . ":: Updating {$person_type} (count: " . $this->count['emps'] . ")" . $this->line;
     $i = 0;
     $people = $emeritus ? $this->emeritus : $this->emps;
     foreach ($people as $row) {
         $person = new PSUPerson($row['pidm']);
         if ($person->pidm) {
             $person->_load_address();
             $person->_load_phone();
             $classifications = $this->idm->getPersonAttributesByMeta($person->pidm, 'classification');
             $person->classification = $emeritus ? 'RM' : key($classifications['role']);
             $person->_load_ssn('//');
             $person->attributes = $this->idm->getPersonAttributes($person->pidm);
             $person->data['flags'] = array();
             $person->data['flags']['emp'] = isset($person->attributes['permission']['employee_list']) ? 1 : '';
             $person->data['flags']['pat'] = isset($person->attributes['permission']['pat_list']) ? 1 : '';
             $person->data['flags']['os'] = isset($person->attributes['permission']['os_list']) ? 1 : '';
             $person->data['flags']['faculty'] = isset($person->attributes['permission']['faculty_list']) ? 1 : '';
             $person->data['flags']['pa'] = isset($person->attributes['permission']['pa_list']) ? 1 : '';
             $person->data['flags']['lecturer'] = isset($person->attributes['permission']['lecturer_list']) ? 1 : '';
             $person->data['flags']['hourly'] = isset($person->attributes['permission']['hourly_list']) ? 1 : '';
             $person->data['flags']['supervisor'] = isset($person->attributes['permission']['supervisor_list']) ? 1 : '';
             $person->data['flags']['chair'] = isset($person->attributes['permission']['chair_list']) ? 1 : '';
             $person->data['flags']['dept_contact'] = isset($person->attributes['permission']['dept_contact_list']) ? 1 : '';
             $person->department = @key($person->attributes['department']);
             $person->title = @key($person->attributes['display_title']);
             $of_address = $this->banner_general->getAddress($person->pidm, 'OF');
             $ca_address = $this->banner_general->getAddress($person->pidm, 'CA');
             $of_phone = $this->banner_general->getPhone($person->pidm, 'OF');
             $of_address = @current($of_address);
             $ca_address = @current($ca_address);
             $of_phone = @current($of_phone);
             $of_building_room = explode('Rm', $of_address['r_street_line2']);
             $person->msc = addslashes(trim($ca_address['r_street_line1']));
             $person->building = addslashes(trim($of_building_room[0]));
             $person->room = addslashes(trim($of_building_room[1]));
             $person->of_phone = preg_replace('/^535/', '', $of_phone['r_phone_number']);
             $person->ug_gr = 'NA';
             $person->confidential = 'NA';
             if ($emeritus) {
                 $this->createTempRecord($person, 'ALUMNI');
             } else {
                 $this->createTempRecord($person, 'EMP');
             }
             $this->updateDatamart($person);
         }
         //end if
         unset($person);
         $person = null;
         $i++;
         if ($i % 10 == 9) {
             gc_collect_cycles();
         }
         //end if
     }
     //end foreach
     echo $this->line . ":: Finished Updating {$person_type}" . $this->line;
 }