本文整理汇总了PHP中PSU::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PSU::get方法的具体用法?PHP PSU::get怎么用?PHP PSU::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSU
的用法示例。
在下文中一共展示了PSU::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStudents
/**
* Get all accounts with the els_student role.
*/
public static function getStudents()
{
$idm = PSU::get('idmobject');
$search = array(array('pa.attribute' => 'els_student'), array('pa.type_id' => '2'));
$return = 'i.pid,i.psu_id,i.username,i.first_name,i.last_name,l.start_date,l.end_date';
$students = $idm->getUsersByAttribute($search, 'AND', $return);
array_walk($students, array('ELS', 'dates2timestamp'));
array_walk($students, array('ELS', 'load_psuperson'));
usort($students, array('ELS', 'student_sort'));
return $students;
}
示例2: testShortcutsReflection
function testShortcutsReflection()
{
PSU::get()->add_shortcut('shortcut_foo_r1', array('shortcut_foo', '__construct'));
PSU::get()->add_shortcut('shortcut_foo_r2', array('shortcut_foo', 'shortcut_foo'));
$a = PSU::get('shortcut_foo_r1/1Joe12');
$b = PSU::get('shortcut_foo_r1/1Joe12');
$c = PSU::get('shortcut_foo_r1/1Joe13');
$this->assertSame($a, $b);
$this->assertNotSame($a, $c);
$a = PSU::get('shortcut_foo_r2/1Joe14');
$b = PSU::get('shortcut_foo_r2/1Joe14');
$c = PSU::get('shortcut_foo_r2/1Joe15');
$this->assertSame($a, $b);
$this->assertNotSame($a, $c);
}
示例3: sight
/**
* sight
*
* Function called to loop over an array of users and mark them as
* sighted in moodle in Banner.
*
* @param array $args (Optional) args for population selection
*/
public static function sight($args = NULL)
{
$defaults = array('timestamp' => time(), 'termcode' => \PSU\Student::getCurrentTerm('UG'));
$args = \PSU::params($args, $defaults);
$BannerStudent = new \BannerStudent(\PSU::db('banner'));
$successes = array();
foreach ((array) self::get_active_users($args) as $idnumber) {
$pidm = \PSU::get('idmobject')->getIdentifier($idnumber, 'psu_id', 'pid');
if (\PSU::db('psc1')->GetOne("SELECT 1 FROM v_student_active WHERE pidm = :pidm", array('pidm' => $pidm))) {
if ($BannerStudent->sightStudent($pidm, 'MC')) {
$successes[] = $idnumber;
}
//end if
}
//end if
}
//end foreach
return $successes;
}
示例4: getApplicant
/**
* Get a specific applicant.
*
* @param int $pidm the pidm to get deets for
* @return array
*/
function getApplicant($pidm)
{
if (!isset($GLOBALS['BannerGeneral'])) {
require_once 'BannerGeneral.class.php';
$GLOBALS['BannerGeneral'] = new BannerGeneral(PSU::db('banner'));
}
$return = array();
$return['email'] = self::getApplicantEmail($pidm);
$return['name_first'] = ucwords(PSU::get('idmobject')->getName($pidm, 'f'));
$return['username'] = PSU::get('idmobject')->getIdentifier($pidm, 'pid', 'login_name');
$return['ldap_user'] = PSU::get('idmobject')->getIdentifier($pidm, 'pid', 'username');
if (preg_match('/^app\\./i', $return['username'])) {
$return['username'] = preg_replace('/^app\\./i', '', $return['username']);
$return['password'] = $GLOBALS['BannerGeneral']->getPin($pidm);
}
$return['psuid'] = PSU::get('idmobject')->getIdentifier($pidm, 'pidm', 'id');
$return['pidm'] = $pidm;
$v_ug_app = PSU::db('banner')->GetRow('SELECT * FROM v_ug_app WHERE pidm = :pidm', compact('pidm'));
$return['term_code_entry'] = $v_ug_app['term_code_entry'];
$return['apdc_code'] = $v_ug_app['apdc_code'];
return $return;
}
示例5: Workflow
$GLOBALS['ITS4'] = PSUDatabase::connect('mysql/data_mart-admin');
$GLOBALS['CALLLOG'] = PSUDatabase::connect('mysql/calllog');
$GLOBALS['USER_DB'] = PSUDatabase::connect('mysql/user_info-admin');
//$GLOBALS['EPO'] = PSUDatabase::connect('mssql/epo_mercury');
$GLOBALS['ASTER'] = PSUDatabase::connect('mysql/aster-misuser');
$GLOBALS['MYPLYMOUTH'] = PSUDatabase::connect('mysql/myplymouth');
/*******************[End Database Connections]*****************/
// which portal we are working in, for now there is only one, and we hardcode it!
$GLOBALS['Workflow'] = new Workflow();
$GLOBALS['BannerGeneral'] = new BannerGeneral($GLOBALS['BANNER']);
$GLOBALS['BannerStudent'] = new BannerStudent($GLOBALS['BANNER']);
$GLOBALS['PWMAN'] = new PasswordManager($GLOBALS['MYPLYMOUTH'], $_ = false, $GLOBALS['USER_DB']);
$GLOBALS['LOG'] = new PSULog('ape', $_SESSION['username']);
$GLOBALS['ZimbraAdmin'] = new zimbraAdmin();
/*******************[Authorization Stuff]*****************/
$GLOBALS['user_roles'] = PSU::get('idmobject')->getAllBannerRoles($_SESSION['username']);
$path_parts = pathinfo($_SERVER['SCRIPT_FILENAME']);
if (!IDMObject::authZ('role', 'staff') && !IDMObject::authZ('role', 'ape') && !APEAuthZ::infodesk() && !APEAuthZ::family() && !APEAuthZ::student() && !APEAuthZ::advancement() && !$_SESSION['impersonate']) {
echo 'You (' . $_SESSION['username'] . ') do not have access to use this application. If ' . $_SESSION['username'] . ' is not your username, please log in to <a href="http://go.plymouth.edu/logout">myPlymouth</a> and try again.';
exit;
}
//end if
/*******************[End Authorization Stuff]*****************/
if ($_GET['mobile']) {
$_SESSION['psu_mobile'] = true;
} elseif ($_GET['nomobile']) {
$_SESSION['psu_mobile'] = false;
}
//end else
$GLOBALS['myuser'] = new PSUPerson($_SESSION['username']);
// first-time init. of error and message vars
示例6: set_layout
/**
* Allow a user to view another person's layout.
*/
public function set_layout($wp_id = null)
{
$this->_force_admin();
if ($wp_id === null) {
$wp_id = $_REQUEST['wp_id'];
}
//
// is this user too privileged to be simulated?
//
$p = new PSUPerson($wp_id);
if (PSU::get('idmobject')->hasAttribute($person->pidm, 'role', 'myplymouth')) {
$_SESSION['errors'][] = "You cannot login as a portal administrator.";
PSU::redirect($GLOBALS['BASE_URL'] . '/admin');
}
$session_stashed = $_SESSION;
$_SESSION['wp_id'] = $wp_id;
// if editing the default layout (i.e. $wp_id = 0), make sure the username and pidm are both 0
$_SESSION['username'] = $p->username ?: 0;
$_SESSION['pidm'] = $p->pidm ?: 0;
$_SESSION['portal']['session_stashed'] = $session_stashed;
$_SESSION['messages'][] = "You are now logged in as {$wp_id}.";
PSU::redirect($GLOBALS['BASE_URL']);
}
示例7: function
<?php
PSU::get()->banner = PSU::db('psc1');
respond('/?', function ($request, $response, $app) {
$ecommerce_running = shell_exec('ps ef | grep ecommerce_process.php | grep -v grep');
if ($ecommerce_running) {
$_SESSION['messages'][] = 'The ECommerce processing script is currently running. Reload to check the status.';
$app->tpl->assign('ecommerce_processing', true);
}
//end if
$app->tpl->assign('ecommerce_pending_files', \PSU\Ecommerce::pending_files());
$app->tpl->assign('ecommerce_pending', \PSU\Ecommerce::pending());
$app->tpl->assign('ecommerce_files', \PSU\Ecommerce::file_info());
$app->tpl->assign('ecommerce_report', \PSU\Ecommerce::report());
$app->tpl->display('ecommerce.tpl');
});
respond('/process', function ($request, $response, $app) {
$user = PSU::isDev() ? 'nrporter' : 'webguru';
if (PSU::isDev() && !IDMObject::authN('mis')) {
return;
}
//end if
$command = '~' . $user . '/scripts/ecommerce_process.php --instance=' . strtolower(PSU::db('banner')->database) . ' &';
exec($command);
$_SESSION['successes'][] = 'The ECommerce processing script has begun. Please check back shortly.';
PSU::redirect($GLOBALS['BASE_URL']);
});
示例8: foreach
foreach ((array) $_SESSION['AUTHZ']['permission'] as $key => $value) {
if (strpos($key, 'ape_') === 0) {
unset($_SESSION['AUTHZ']['permission'][$key]);
}
//end if
}
//end foreach
$message = 'Now impersonating: ' . $_SESSION['username'] . ' (' . $_SESSION['wp_id'] . ')';
$_SESSION['messages'][] = $message;
} elseif ($action == 'cancel') {
if (isset($_SESSION['impersonate'])) {
$GLOBALS['LOG']->write('Finished impersonating account', $_SESSION['username']);
$_SESSION['wp_id'] = $_SESSION['impersonate_store']['wp_id'];
$_SESSION['username'] = $_SESSION['impersonate_store']['username'];
$_SESSION['pidm'] = $_SESSION['impersonate_store']['pidm'];
$_SESSION['fullname'] = $_SESSION['impersonate_store']['fullname'];
$_SESSION['phpCAS']['user'] = $_SESSION['impersonate_store']['username'];
unset($_SESSION['AUTHZ']);
PSU::get('idmobject')->loadAuthZ($_SESSION['pidm']);
unset($_SESSION['impersonate_store'], $_SESSION['impersonate']);
}
//end if
PSU::redirect($_SERVER['HTTP_REFERER']);
} else {
throw new Exception('Stop trying to sneak in here!!!');
}
//end else
} catch (Exception $e) {
$_SESSION['errors'][] = sprintf("%s (%d)", $e->GetMessage(), $e->GetCode());
}
PSUHTML::redirect($GLOBALS['BASE_URL'] . '/user/' . $redirect_id);
示例9: simple_search
//.........这里部分代码省略.........
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;
示例10: mail
/**
* Send mail, similar to PHP's mail.
*
* @section multipart Sending HTML mail
*
* To send a multipart message with text and HTML parts, set <var>$message</var> to <code>array($text, $html)</code>. To
* send HTML only, set <code>$message = 'some html'</code>, and include a <var>$header</var> where <code>array('Content-type' => 'text/html')</code>.
*
* @since 1.11.0
*
* @param $to Email address to send message
* @param $subject Email subject
* @param $message Message contents
* @param $headers Optional. Additional headers.
* @param $attachments Optional. Files to attach.
* @return True if mail was sent, false otherwise.
*/
public static function mail($to, $subject, $message, $headers = '', $attachments = array())
{
if (!is_array($attachments)) {
$attachments = explode("\n", $attachments);
}
$phpmailer = PSU::get('phpmailer');
// Headers
if (empty($headers)) {
$headers = array();
} elseif (!is_array($headers)) {
// Explode the headers out, so this function can take both
// string headers and an array of headers.
$tempheaders = (array) explode("\n", $headers);
$headers = array();
// If it's actually got contents
if (!empty($tempheaders)) {
// Iterate through the raw headers
foreach ((array) $tempheaders as $header) {
if (strpos($header, ':') === false) {
continue;
}
// Explode them out
list($name, $content) = explode(':', trim($header), 2);
// Cleanup crew
$name = trim($name);
$content = trim($content);
// Add it to our grand headers array
$headers[trim($name)] = trim($content);
}
//end foreach
}
//end if
}
//end function mail
// Now that $headers is for-sure full, pull out things that belong elsewhere
$tempheaders = array();
foreach ($headers as $name => $content) {
if ('from' == strtolower($name)) {
if (strpos($content, '<') !== false) {
// So... making my life hard again?
$from_name = substr($content, 0, strpos($content, '<') - 1);
$from_name = str_replace('"', '', $from_name);
$from_name = trim($from_name);
$from_email = substr($content, strpos($content, '<') + 1);
$from_email = str_replace('>', '', $from_email);
$from_email = trim($from_email);
} else {
$from_name = trim($content);
}
//end else
} elseif ('content-type' == strtolower($name)) {
if (strpos($content, ';') !== false) {
list($type, $charset) = explode(';', $content);
$content_type = trim($type);
$charset = trim(str_replace(array('charset=', '"'), '', $charset));
} else {
$content_type = trim($content);
}
//end else
} elseif ('cc' == strtolower($name)) {
$cc = explode(",", $content);
} elseif ('bcc' == strtolower($name)) {
$bcc = explode(",", $content);
} else {
$tempheaders[$name] = $content;
}
//end else
}
//end foreach
// Headers are everything that's left after the last foreach
$headers = $tempheaders;
// Empty out the values that may be set
$phpmailer->ClearAddresses();
$phpmailer->ClearAllRecipients();
$phpmailer->ClearAttachments();
$phpmailer->ClearBCCs();
$phpmailer->ClearCCs();
$phpmailer->ClearCustomHeaders();
$phpmailer->ClearReplyTos();
// From email and name
// If we don't have a name from the input headers
if (!isset($from_name)) {
$from_name = 'Plymouth State University';
//.........这里部分代码省略.........
示例11: get
<?php
class PeopleFu
{
public static function get()
{
return new self();
}
}
// add api instance shortcut
PSU::get()->add_shortcut('peoplefu', array('PeopleFu', 'get'));
// add database shortcut
PSU::get()->add_database('peopledb', 'oracle/peopledb/fixcase');
示例12: setUser
/**
* Set the portal user.
*/
public function setUser($identifier)
{
$this->wp_id = $identifier;
$this->person = new PSUPerson($_SESSION['username']);
if ($ad_info = PSU::get('ad')->user_info($this->person->username, array('pwdlastset'))) {
$ad_stamp = round(($ad_info[0]['pwdlastset'][0] - 116444736000000000) / 10000000);
$this->password_info = array('changed' => date('F j, Y', $ad_stamp), 'days' => round((time() - $ad_stamp) / 60 / 60 / 24));
if ($this->password_info['days'] > 160) {
$this->password_info['class'] = 'password-alarm';
} elseif ($this->password_info['days'] > 120) {
$this->password_info['class'] = 'password-warning';
}
//end elseif
}
//end if
}
示例13: array
<?php
PSU::get()->banner = PSU::db('test');
PSU::db('banner')->debug = true;
$args = array('pidm' => $_REQUEST['pidm'], 'term_code' => $_REQUEST['term_code'], 'comment_text' => $_REQUEST['note']);
$query = "INSERT INTO sgrscmt(\n\t\t\t\t\tsgrscmt_pidm,\n\t\t\t\t\tsgrscmt_seq_no,\n\t\t\t\t\tsgrscmt_term_code,\n\t\t\t\t\tsgrscmt_comment_text,\n\t\t\t\t\tsgrscmt_activity_date\n\t\t\t\t)\n\t\t\t\tVALUES\n\t\t\t\t(\n\t\t\t\t\t:pidm,\n\t\t\t\t\t(SELECT MAX(NVL(sgrscmt_seq_no,0))+1 FROM sgrscmt WHERE sgrscmt_pidm=:pidm),\n\t\t\t\t\t:term_code,\n\t\t\t\t\t:comment_text,\n\t\t\t\t\tSYSDATE\n\t\t\t\t)";
$action = PSU::db('banner')->Execute($query, $args);
PSUHTML::redirect($GLOBALS['BASE_URL'] . '/student/' . $person->pidm);
示例14: passwordAge
/**
* Return the age, in days, of a user's password.
* @param $ident an identifier to pass to PSUPerson::get()
* @return int the password age
*/
function passwordAge($ident)
{
$person = PSUPerson::get($ident);
$ad_info = PSU::get('ad')->user_info($person->login_name, array('pwdlastset'));
// 116444736000000000 = 10000000 * 60 * 60 * 24 * 365 * 369 + 89 leap days huh.
$ad_stamp = round(($ad_info[0]['pwdlastset'][0] - 116444736000000000) / 10000000);
$change_date = date('F j, Y', $ad_stamp);
$seconds = time() - $ad_stamp;
$days = round($seconds / 60 / 60 / 24);
return $days;
}
示例15: array
<?php
$response = array();
$response['messages'] = array();
$response['errors'] = array();
$is_ajax = isset($_REQUEST['ajax']) ? true : false;
$pidm = (int) $_GET['pidm'];
// check for invalid pidm
if (!$GLOBALS['BannerGeneral']->isValidPidm($pidm)) {
$response['errors'] = sprintf('PIDM "%d" is invalid.', $pidm);
}
// where should redirects go?
$redirect_url = $GLOBALS['BASE_URL'] . '/user/' . $pidm;
if ($_GET['synchronize_ldi'] == 1) {
// TODO: replace LDI sync code with REST API call to POST user/sync/ldi/[:id]/[:source] Where ":source" is the username of the synchronizer
$person = new PSUPerson($pidm);
if ($person->sync_ldi($_SESSION['username'] ?: 'ape')) {
$response['messages'][] = 'Synchronization has been queued.';
} else {
$response['errors'][] = 'LDISync() failed, contact MIS.';
}
action_cleanup($redirect_url, $response, $is_ajax);
} elseif ($_GET['synchronize_ad']) {
$GLOBALS['LOG']->write('Active Directory Sync', PSU::get('idmobject')->getIdentifier($pidm, 'pid', 'username'));
require_once 'PSUadLDAP.class.php';
$GLOBALS['AD'] = new PSUadLDAP();
$GLOBALS['AD']->syncGroups($pidm);
$response['messages'][] = 'Synchronization has been queued.';
action_cleanup($redirect_url, $response, $is_ajax);
}
//end elseif