/**
  * returns the persons name replacing a pidm
  */
 public static function get_name($pidm, $format = 'l, f')
 {
     $person = new PSUPerson($pidm);
     $name = $person->formatName($format);
     $person->destroy();
     return $name;
 }
     $prev_response = $record['response'];
     $pdf->Cell(25, 5, '     Marked as', 0, 0, 'L');
     if ($record['response'] == 'incomplete') {
         $pdf->Cell(20, 5, 'incomplete', 0, 0, 'L');
         $no_answer = 'f';
     } elseif ($record['response'] == 'complete') {
         $pdf->Cell(20, 5, 'complete', 0, 0, 'L');
         $no_answer = 'f';
     } elseif ($record['response'] == 'n/a') {
         $pdf->Cell(20, 5, 'n/a', 0, 0, 'L');
         $no_answer = 'f';
     }
     $pdf->Cell(5, 5, 'by', 0, 0, 'L');
     $responder = new PSUPerson($record['updated_by']);
     $record['updated_by'] = $responder->formatName('f m l');
     $responder->destroy();
     $pdf->Cell(80, 5, $record['updated_by'] . ' at ' . $record['activity_date'], 0, 1, 'L');
     $pdf->setTextColor(0, 0, 0);
     if ($no_answer == 't') {
         $pdf->setTextColor(120, 7, 41);
         $pdf->Cell(190, 5, '     No action taken', 0, 1, 'L');
         $pdf->setTextColor(0, 0, 0);
         $no_answer = 'f';
     }
     if ($record['notes']) {
         $pdf->setTextColor(0, 0, 0);
         $pdf->Cell(95, 5, 'Do you have more details or anything else to add?', 0, 1, 'L');
         $pdf->setTextColor(120, 7, 41);
         $pdf->Cell(190, 5, "     " . $record['notes'], 0, 1, 'L');
     }
 }
 function setUpPeopleList($people)
 {
     foreach ($people as $p) {
         $person = new PSUPerson($p['r_pidm'], array('address'));
         $p['username'] = $person->username;
         $p['city'] = $person->address['MA'][0]->city;
         $p['state'] = $person->address['MA'][0]->stat_code;
         $p['birthdate'] = date("m/d/Y", $person->birth_date);
         $p['hash'] = $this->createHash($p['r_pidm']);
         $peeps[] = $p;
         $person->destroy();
     }
     return $peeps;
 }
Exemplo n.º 4
0
 public static function simple_search($search, $type = 'all')
 {
     global $db;
     $phonebook_search = array('all', 'name_first', 'name_last', 'email', 'phone');
     $search_data = array();
     $search_data['search_string'] = $_SESSION['search_string'] = stripslashes($search);
     $search_data['search_type'] = $_SESSION['search_type'] = $type;
     if (in_array($type, $phonebook_search)) {
         $search_results = phonebookSearch($search, $type);
     }
     switch ($search_data['search_type']) {
         case 'closed':
             $sql = "\n\t\t\t\t\tSELECT * \n\t\t\t\t\t\tFROM call_view \n\t\t\t\t\t WHERE caller_username = ?\n\t\t\t\t\t\t AND current='1' \n\t\t\t\t\t\t AND call_status = 'closed' \n\t\t\t\t\t ORDER BY call_date DESC, \n\t\t\t\t\t\t\t\t call_time DESC\n\t\t\t\t";
             $results = $db->GetAll($sql, array($search_data['search_string']));
             foreach ($results as $key) {
                 $key['comments'] = substr($key['comments'], 0, 23) . '...';
                 $search_data['results'][] = array('key' => $key, 'search_string' => $search_data['search_string'], 'search_type' => $search_data['search_type']);
             }
             $search_data['fields'][1] = 'Call ID';
             $search_data['fields'][2] = 'Name';
             $search_data['fields'][3] = 'Call Date';
             $search_data['fields'][4] = 'Call Time';
             $search_data['fields'][5] = 'Comments';
             $search_data['search_results_text'] = 'Calls By';
             break;
         case 'computer':
             $hardware = searchHardwareInformation($search_data['search_string']);
             $username = explode("@", $hardware[0]['email']);
             $username = $username[0];
             foreach ($hardware as $hardware_info) {
                 $search_data['results'][] = array('HW_Key' => $hardware_info['id'], 'HW_IPName' => $hardware_info['computer_name'], 'HW_Username' => $username, 'MACAddress' => $hardware_info['mac_address'], 'IPAddress' => $hardware_info['ip_address'], 'search_string' => $search_data['search_string'], 'location' => $hardware_info['NodeName'], 'search_type' => $search_data['search_type']);
             }
             $search_data['fields'][1] = 'Computer Name';
             $search_data['fields'][2] = 'MAC Address';
             $search_data['fields'][3] = 'IP Address';
             $search_data['fields'][4] = 'Location';
             $search_data['search_results_text'] = 'Computer Name';
             break;
         case 'ip':
             $HardwareInfo = $db->GetAll("SELECT * FROM hardware_inventory WHERE ip_address = ?", array($search_data['search_string']));
             $username = explode("@", $HardwareInfo[0]['email']);
             $username = $username[0];
             $search_results = phonebookSearch($username);
             $search_results = current($search_results);
             $search_data['results'][] = array('HW_Key' => $HardwareInfo[0]['id'], 'HW_IPName' => $HardwareInfo[0]['computer_name'], 'HW_Username' => $search_results['email'], 'HW_Name' => $search_results['name_full'], 'MACAddress' => $HardwareInfo[0]['mac_address'], 'IPAddress' => $HardwareInfo[0]['ip_address'], 'search_string' => $search_data['search_string'], 'search_type' => $search_data['search_type']);
             $search_data['fields'][1] = 'IP Address';
             $search_data['fields'][2] = 'Name';
             $search_data['fields'][3] = 'Username';
             $search_data['fields'][4] = 'MAC Address';
             $search_data['fields'][5] = 'Computer Name';
             $search_data['search_results_text'] = 'IP Address';
             break;
         case 'mac':
             $HardwareInfo = $db->GetAll("SELECT * FROM hardware_inventory WHERE upper(mac_address) = ?", array(strtoupper($search_data['search_string'])));
             $username = explode("@", $HardwareInfo[0]['email']);
             $username = $username[0];
             $search_results = phonebookSearch($username);
             $search_results = current($search_results);
             $search_data['results'][] = array('HW_Key' => $HardwareInfo[0]['id'], 'HW_IPName' => $HardwareInfo[0]['computer_name'], 'HW_Username' => $search_results['email'], 'HW_Name' => $search_results['name_full'], 'MACAddress' => $HardwareInfo[0]['mac_address'], 'IPAddress' => $HardwareInfo[0]['ip_address'], 'search_string' => $search_data['search_string'], 'search_type' => $search_data['search_type']);
             $search_data['fields'][1] = 'MAC Address';
             $search_data['fields'][2] = 'Name';
             $search_data['fields'][3] = 'Username';
             $search_data['fields'][4] = 'Computer Name';
             $search_data['search_results_text'] = 'MAC Address';
             break;
         case 'ticket':
             $ticket_number_results = searchTicketNumber($search_data['search_string']);
             if ($ticket_number_results['call_id'] != '') {
                 $search_data['results'][] = array('call_id' => $ticket_number_results['call_id'], 'caller_username' => $ticket_number_results['caller_username'], 'caller_first_name' => $ticket_number_results['caller_first_name'], 'caller_last_name' => $ticket_number_results['caller_last_name'], 'caller_phone_number' => $ticket_number_results['caller_phone_number'], 'call_date' => $ticket_number_results['call_date'], 'call_time' => $ticket_number_results['call_time'], 'calllog_username' => $ticket_number_results['calllog_username'], 'search_string' => $search_data['search_string'], 'search_type' => $search_data['search_type'], $search_data['search_type'] . '_selected' => 'SELECTED');
             } else {
                 $tpl->assign('no_ticket', 'NO TICKET FOUND');
                 $tpl->parse('main.searchResults.no_ticket');
             }
             $search_data['fields'][1] = 'Call ID';
             $search_data['fields'][2] = 'Name';
             $search_data['fields'][3] = 'Username';
             $search_data['fields'][4] = 'Call Date/Time';
             $search_data['fields'][5] = 'Call Log User';
             $search_data['search_results_text'] = 'Ticket #';
             break;
         case 'user':
             $results = $db->GetAll("SELECT * FROM call_log, call_history WHERE call_log.call_id = call_history.call_id AND call_log.calllog_username = '******'search_string']}' AND current='1' ORDER BY call_date DESC, call_time DESC");
             foreach ($results as $key) {
                 if ($key['comments'] != "") {
                     $key['comments'] = substr($key['comments'], 0, 23) . '...';
                 } else {
                     $key['comments'] = "Closed on Submit";
                 }
                 $search_data['results'][] = array('key' => $key, 'search_string' => $search_data['search_string'], 'search_type' => $search_data['search_type']);
             }
             $search_data['fields'][1] = 'Call ID';
             $search_data['fields'][2] = 'Name';
             $search_data['fields'][3] = 'Call Date';
             $search_data['fields'][4] = 'Call Time';
             $search_data['fields'][5] = 'Comments';
             $search_data['search_results_text'] = 'Calls By';
             break;
         case 'wp_id':
         case 'all':
         case 'name_last':
         case 'name_first':
         case 'email':
         case 'phone':
             if ($search_data['search_type'] == 'wp_id') {
                 $sql = "\n\t\t\t\t\t\tSELECT * \n\t\t\t\t\t\t\tFROM wp_users \n\t\t\t\t\t\t WHERE user_login LIKE ?\n\t\t\t\t\t";
                 $search_results = PSU::db('connect')->GetAll($sql, array($search_data['search_string'] . '%'));
                 foreach ($search_results as &$record) {
                     $person = new PSUPerson($record['user_login']);
                     $record['identifier'] = $record['wp_id'] = $person->wp_id;
                     $record['name_full'] = $person->formatName('f l');
                     $record['email'] = $person->username;
                     $record['dept'] = 'Family Portal';
                     $person->destroy();
                     unset($person);
                 }
                 //end foreach
             }
             //end if
             foreach ($search_results as $k => $key) {
                 $class_prepend = '';
                 if ($key['email']) {
                     $display = "user_info";
                     if (!$key['identifier']) {
                         $key['identifier'] = $key['email'];
                     }
                     //end if
                 } else {
                     $display = "no_username";
                     if (!$key['identifier']) {
                         $key['identifier'] = $key['pidm'];
                     }
                     //end if
                 }
                 //end else
                 $portal_roles = PSU::get('idmobject')->GetAllBannerRoles($key['pidm']);
                 if (is_array($portal_roles) && in_array('alumni', $portal_roles)) {
                     $class_prepend = 'Alumni' . ($class_prepend ? '/ ' . $class_prepend : '');
                 }
                 //end if
                 if (is_array($portal_roles) && in_array('student_account_active', $portal_roles)) {
                     $class_prepend = 'Student' . ($class_prepend ? '/ ' . $class_prepend : '');
                 }
                 //end if
                 $key['dept'] = $class_prepend . ($key['dept'] ? '/ ' . $key['dept'] : '');
                 if ($key['pidm'] || $key['username'] || $key['wp_id']) {
                     $where = array();
                     $args = array();
                     if ($key['pidm']) {
                         $where[] = "call_log.pidm = ?";
                         $args[] = $key['pidm'];
                     }
                     //end if
                     if ($key['username']) {
                         $where[] = "call_log.caller_username = ?";
                         $args[] = $key['username'];
                     }
                     //end if
                     if ($key['wp_id']) {
                         $where[] = "call_log.wp_id = ?";
                         $args[] = $key['wp_id'];
                     }
                     //end if
                     $where = implode(" OR ", $where);
                     $getOpenCallInfo = $db->GetOne("SELECT * FROM call_log, call_history WHERE call_log.call_id = call_history.call_id AND call_history.call_status = 'open' AND ({$where}) AND call_history.current='1'", $args);
                     $num_open_calls = $db->GetOne("SELECT count(*) FROM call_log, call_history WHERE call_log.call_id = call_history.call_id AND call_history.call_status = 'open' AND ({$where}) AND call_history.current='1'", $args);
                     if ($num_open_calls >= 1) {
                         $key['call_id'] = $getOpenCallInfo;
                         $key['open_call'] = "(" . $num_open_calls . " Open)";
                     }
                     //end if
                     if ($key['major'] && $key['title']) {
                         $key['major_title'] = substr($key['major'] . ' / ' . $key['title'], 0, 20);
                         $key['major_title_full'] = $key['major'] . ' / ' . $key['title'];
                     } else {
                         $key['major_title'] = substr($key['major'] . ' ' . $key['title'], 0, 20);
                         $key['major_title_full'] = $key['major'] . ' ' . $key['title'];
                     }
                     //end else
                 }
                 //end if
                 $search_data['results'][] = array('key' => $key, 'search_string' => $search_data['search_string'], 'search_type' => $search_data['search_type']);
             }
             // end foreach
             $search_data['fields'][1] = 'Name';
             $search_data['fields'][2] = 'Username';
             $search_data['fields'][3] = 'Phone';
             $search_data['fields'][4] = 'Major/Title';
             $search_data['fields'][5] = 'Class/Dept';
             switch ($search_data['search_type']) {
                 case 'email':
                     $search_data['search_results_text'] = 'User Name';
                     $search_data['five_selected'] = 'SELECTED';
                     break;
                 case 'name_last':
                     $search_data['search_results_text'] = 'Last Name';
                     $search_data['2_selected'] = 'SELECTED';
                     break;
                 case 'name_first':
                     $search_data['search_results_text'] = 'First Name';
                     $search_data['1_selected'] = 'SELECTED';
                     break;
             }
             //end switch
             break;
     }
     //end switch
     return $search_data;
 }
Exemplo n.º 5
0
IDMObject::authN();
if (!IDMObject::authZ('role', 'myplymouth')) {
    die('no access');
}
echo '<pre>';
PSU::get()->portal = PSU::db('portal_dev');
$sql = "SELECT DISTINCT wpid1 FROM relsearch WHERE substr(wpid1, 1, 1) <> 't'";
$wpids = PSU::db('portal')->GetCol($sql);
$sql = "SELECT DISTINCT wp_id FROM usertabs WHERE wp_id != 0 AND substr(wp_id, 1, 1) <> 't'";
$wpids2 = PSU::db('portal')->GetCol($sql);
$wpids = array_merge($wpids, $wpids2);
$wpids = array_unique($wpids);
sort($wpids);
if (!$_GET['simple']) {
    echo "// append ?simple=1 to url to hide names\n\n";
}
foreach ($wpids as $wpid) {
    $p = new PSUPerson($wpid);
    if ($_GET['simple'] == 1) {
        if ($p->wp_email) {
            echo $p->wp_email . ", ";
        }
    } else {
        if (PSU::is_wpid($wpid, PSU::MATCH_TEMPID)) {
            printf("%30s [%s] %s\n", "", $wpid, $p->wp_email);
        } else {
            printf("%30s [%s] %s\n", $p->first_name . " " . $p->last_name, $wpid, $p->wp_email);
        }
    }
    $p->destroy();
}
 /**
  * displays a ticket's public updates
  */
 public function ticket($ticket)
 {
     IDMObject::authN();
     $sql = "SELECT *,\n\t\t\t\t\t\t\t\t\t CONCAT(date_assigned, ' ', time_assigned) update_date\n\t\t\t        FROM call_history\n\t\t\t\t\t\t WHERE call_id = ?\n               AND (updated_by = ?\n\t\t\t\t\t\t        OR\n\t\t\t\t\t\t        tlc_assigned_to = ?\n\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\tupdated_by = ?\n\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\ttlc_assigned_to = ?\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t ORDER BY date_assigned, time_assigned";
     $args = array($ticket, $this->myuser->login_name, $this->myuser->login_name, $this->myuser->wp_id, $this->myuser->wp_id);
     $details = PSU::db('calllog')->GetAll($sql, $args);
     foreach ($details as &$detail) {
         $p = new PSUPerson($detail['updated_by']);
         $detail['updated_by_name'] = $p->wp_id == $_SESSION['wp_id'] ? 'You' : $p->formatName('f');
         $p->destroy();
         unset($p);
     }
     //end foreach
     $sql = "SELECT call_status\n\t\t\t        FROM call_history\n\t\t\t\t\t\t WHERE call_id = ? AND current = 1";
     $args = array($ticket);
     $this->tpl->assign('call_status', PSU::db('calllog')->GetOne($sql, $args));
     $this->tpl->assign('details', $details);
     $this->tpl->assign('ticket', $ticket);
     $tpl = new PSUSmarty();
     $tpl->assign('hide_checklist', true);
     $tpl->assign('details_title', 'Update Ticket');
     $form = $tpl->fetch(PSU_BASE_DIR . '/webapp/calllog/templates/ticket_form.tpl');
     $this->tpl->assign('form', $form);
     $this->tpl->display('ticket.tpl');
 }
 /**
  * synchronize banner roles with luminis
  *
  * @param $person mixed person identifier or person object
  * @param $portal_roles array person's existing portal roles
  */
 public function syncLuminisRoles($person, $portal_roles = null)
 {
     /**
      * We DONT HAVE AN LDAP
      */
     return;
     // if $person isn't a PSUPerson, instantiate
     if (!$person instanceof PSUPerson) {
         $person = new PSUPerson($person);
     }
     //end if
     // if the person doesn't have a pidm, they won't exist in luminis
     if (!$person->pidm) {
         return;
     }
     // force a banner role calc
     PSU::get('idmobject')->maintainBannerRoles($person->pidm);
     // get the user's banner roles
     $banner_roles = PSU::get('idmobject')->getAllBannerRoles($person->pidm);
     $managed_roles = array('alumni', 'developmentofficer', 'employee', 'faculty', 'finance', 'friends', 'student', 'sysadmin', 'syssupport', 'creator', 'accountadmin', 'user', 'prospectivestudent', 'guest', 'administrator', 'observer', 'prospect', 'applicant', 'institutionaccept', 'applicantaccept', 'bannerinb', 'loadtester', 'newstudent', 'activestudent', 'student_active', 'student_grad', 'student_undergrad', 'student_exiting', 'student_pending', 'student_expected', 'psu_friend', 'student_ug_grad_candidate', 'student_enrolled', 'student_ug_first_year', 'student_ug_junior', 'student_ug_senior', 'student_ug_sophomore', 'student_ug_transfer', 'ug_app', 'ug_app_accept', 'ug_app_denied', 'ug_app_withdrawn', 'student_account_active', 'employee_os', 'employee_pat', 'employee_pa', 'alumni_campus', 'alumni_emeritus', 'staff', 'personal_email_collected', 'student_former', 'ug_app_accept_fall', 'faculty_services', 'student_worker', 'finaid', 'pds_authenticate', 'zimbra');
     $intended_roles = array();
     // figure out which roles the user should have
     if (is_array($banner_roles)) {
         $managed_banner_roles = array_intersect($banner_roles, $managed_roles);
     }
     if ($intended_roles) {
         // determine roles to delete
         $roles_to_delete = array_diff($portal_roles, $intended_roles);
         // determine roles to add
         $roles_to_add = array_diff($intended_roles, $portal_roles);
         // if there are roles to delete or add, update the role
         if ($roles_to_delete || $roles_to_add) {
             $array = array();
             $array['pdsrole'] = $intended_roles;
             PSU::get('luminisportal')->changeAttribute($person->login_name, $array);
         }
         //end if
     }
     //end if
     $person->destroy();
 }