本文整理汇总了PHP中UserAccount::softLogout方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::softLogout方法的具体用法?PHP UserAccount::softLogout怎么用?PHP UserAccount::softLogout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::softLogout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: placeHold
//.........这里部分代码省略.........
require_once ROOT_DIR . '/Drivers/marmot_inc/PType.php';
$maxHolds = -1;
//Determine if we should show a warning
$ptype = new PType();
$ptype->pType = $user->patronType;
if ($ptype->find(true)) {
$maxHolds = $ptype->maxHolds;
}
$currentHolds = $profile['numHolds'];
if ($maxHolds != -1 && $currentHolds + 1 > $maxHolds) {
$interface->assign('showOverHoldLimit', true);
$interface->assign('maxHolds', $maxHolds);
$interface->assign('currentHolds', $currentHolds);
}
global $locationSingleton;
//Get the list of pickup branch locations for display in the user interface.
$locations = $locationSingleton->getPickupBranches($profile, $profile['homeLocationId']);
$interface->assign('pickupLocations', $locations);
//set focus to the submit button if the user is logged in since the campus will be correct most of the time.
$interface->assign('focusElementId', 'submit');
} else {
//set focus to the username field by default.
$interface->assign('focusElementId', 'username');
}
global $library;
$patronHomeBranch = Library::getPatronHomeLibrary();
if ($patronHomeBranch != null) {
if ($patronHomeBranch->defaultNotNeededAfterDays > 0) {
$interface->assign('defaultNotNeededAfterDays', date('m/d/Y', time() + $patronHomeBranch->defaultNotNeededAfterDays * 60 * 60 * 24));
} else {
$interface->assign('defaultNotNeededAfterDays', '');
}
$interface->assign('showHoldCancelDate', $patronHomeBranch->showHoldCancelDate);
} else {
if ($library) {
//Show the hold cancellation date for now. It may be hidden later when the user logs in.
if ($library->defaultNotNeededAfterDays > 0) {
$interface->assign('defaultNotNeededAfterDays', date('m/d/Y', time() + $library->defaultNotNeededAfterDays * 60 * 60 * 24));
} else {
$interface->assign('defaultNotNeededAfterDays', '');
}
$interface->assign('showHoldCancelDate', $library->showHoldCancelDate);
} else {
//Show the hold cancellation date for now. It may be hidden later when the user logs in.
$interface->assign('showHoldCancelDate', 1);
$interface->assign('defaultNotNeededAfterDays', '');
}
}
$activeLibrary = Library::getActiveLibrary();
if ($activeLibrary != null) {
$interface->assign('holdDisclaimer', $activeLibrary->holdDisclaimer);
} else {
//Show the hold cancellation date for now. It may be hidden later when the user logs in.
$interface->assign('holdDisclaimer', '');
}
}
$record = RecordDriverFactory::initRecordDriverById('ils:' . $_GET['id']);
if ($record) {
$interface->assign('record', $record);
} else {
PEAR_Singleton::raiseError('Cannot find record ' . $_GET['id']);
}
$interface->assign('id', $_GET['id']);
if ($showMessage && isset($return)) {
$hold_message_data = array('successful' => $return['result'] == true ? 'all' : 'none', 'error' => isset($return['error']) ? $return['error'] : '', 'titles' => array($return), 'campus' => $_REQUEST['campus']);
//Check to see if there are item level holds that need follow-up by the user
if (isset($return['items']) && count($return['items']) > 0) {
$hold_message_data['showItemForm'] = true;
$hold_message_data['items'] = $return['items'];
}
$_SESSION['hold_message'] = $hold_message_data;
if (isset($_SESSION['hold_referrer'])) {
$logger->log('Hold Referrer is set, redirecting to there. location ' . $_SESSION['hold_referrer'], PEAR_LOG_INFO);
if ($_REQUEST['type'] != 'recall' && $_REQUEST['type'] != 'cancel' && $_REQUEST['type'] != 'update') {
header("Location: " . $_SESSION['hold_referrer']);
} else {
//Redirect for hold cancellation or update
$section = isset($_REQUEST['section']) ? $_REQUEST['section'] : 'unavailable';
header("Location: " . '/MyResearch/Holds?section=' . $section);
}
if (!isset($hold_message_data['showItemForm']) || $hold_message_data['showItemForm'] == false) {
unset($_SESSION['hold_referrer']);
if (isset($_SESSION['autologout'])) {
unset($_SESSION['autologout']);
UserAccount::softLogout();
}
}
} else {
$logger->log('No referrer set, but there is a message to show, go to the main holds page', PEAR_LOG_INFO);
header("Location: " . '/MyResearch/Holds');
die;
}
} else {
//$logger->log('placeHold finished, do not need to show a message', PEAR_LOG_INFO);
$interface->setPageTitle('Request an Item');
$interface->assign('subTemplate', 'hold.tpl');
$interface->setTemplate('hold.tpl');
$interface->display('layout.tpl', 'RecordHold' . $_GET['id']);
}
}
示例2: placeHolds
function placeHolds()
{
$selectedTitles = $_REQUEST['title'];
global $interface;
global $configArray;
global $user;
global $logger;
$holdings = array();
$ids = array();
foreach ($selectedTitles as $recordId => $itemNumber) {
$ids[] = $recordId;
}
$interface->assign('ids', $ids);
$hold_message_data = array('successful' => 'all', 'campus' => $_REQUEST['campus'], 'titles' => array());
$atLeast1Successful = false;
foreach ($selectedTitles as $recordId => $itemNumber) {
$return = $this->catalog->placeItemHold($recordId, $itemNumber, $user->password, '', $_REQUEST['type']);
$hold_message_data['titles'][] = $return;
if (!$return['result']) {
$hold_message_data['successful'] = 'partial';
} else {
$atLeast1Successful = true;
}
//Check to see if there are item level holds that need follow-up by the user
if (isset($return['items'])) {
$hold_message_data['showItemForm'] = true;
}
$showMessage = true;
}
if (!$atLeast1Successful) {
$hold_message_data['successful'] = 'none';
}
$class = $configArray['Index']['engine'];
$db = new $class($configArray['Index']['url']);
$_SESSION['hold_message'] = $hold_message_data;
if (isset($_SESSION['hold_referrer'])) {
$logger->log('Hold Referrer is set, redirecting to there. type = ' . $_REQUEST['type'], PEAR_LOG_INFO);
//Redirect for hold cancellation or update
header("Location: " . $_SESSION['hold_referrer']);
unset($_SESSION['hold_referrer']);
if (isset($_SESSION['autologout'])) {
unset($_SESSION['autologout']);
UserAccount::softLogout();
}
} else {
$logger->log('No referrer set, but there is a message to show, go to the main holds page', PEAR_LOG_INFO);
header("Location: " . $configArray['Site']['path'] . '/MyResearch/Holds');
}
}
示例3: launch
function launch()
{
global $interface;
global $configArray;
global $user;
$driver = new EContentDriver();
$id = strip_tags($_REQUEST['id']);
$interface->assign('id', $id);
global $logger;
//Get title information for the record.
$eContentRecord = new EContentRecord();
$eContentRecord->id = $id;
if (!$eContentRecord->find(true)) {
PEAR_Singleton::raiseError("Unable to find eContent record for id: {$id}");
}
if (isset($_REQUEST['autologout'])) {
$_SESSION['autologout'] = true;
}
if (isset($_POST['submit']) || $user) {
if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
//Log the user in
$user = UserAccount::login();
}
if (!PEAR_Singleton::isError($user) && $user) {
//The user is already logged in
$return = $driver->placeHold($id, $user);
$interface->assign('result', $return['result']);
$message = $return['message'];
$interface->assign('message', $message);
$showMessage = true;
} else {
$message = 'Incorrect Patron Information';
$interface->assign('message', $message);
$interface->assign('focusElementId', 'username');
$showMessage = true;
}
} else {
//Get the referrer so we can go back there.
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
$_SESSION['hold_referrer'] = $referer;
}
//Showing place hold form.
if (!PEAR_Singleton::isError($user) && $user) {
//set focus to the submit button if the user is logged in since the campus will be correct most of the time.
$interface->assign('focusElementId', 'submit');
} else {
//set focus to the username field by default.
$interface->assign('focusElementId', 'username');
}
}
if (isset($return) && $showMessage) {
$hold_message_data = array('successful' => $return['result'] ? 'all' : 'none', 'error' => $return['error'], 'titles' => array($return));
$_SESSION['hold_message'] = $hold_message_data;
if (isset($_SESSION['hold_referrer'])) {
$logger->log('Hold Referrer is set, redirecting to there. type = ' . $_REQUEST['type'], PEAR_LOG_INFO);
header("Location: " . $_SESSION['hold_referrer']);
unset($_SESSION['hold_referrer']);
if (isset($_SESSION['autologout'])) {
unset($_SESSION['autologout']);
UserAccount::softLogout();
}
} else {
$logger->log('No referrer set, but there is a message to show, go to the main holds page', PEAR_LOG_INFO);
header("Location: " . $configArray['Site']['path'] . '/MyResearch/EContentHolds?section=unavailable');
}
} else {
$logger->log('placeHold finished, do not need to show a message', PEAR_LOG_INFO);
$interface->setPageTitle('Request an Item');
$interface->assign('subTemplate', 'hold.tpl');
$interface->setTemplate('hold.tpl');
$interface->display('layout.tpl', 'RecordHold' . $_GET['id']);
}
}
示例4: placeHolds
//.........这里部分代码省略.........
if (!$return['result']) {
$hold_message_data['successful'] = 'partial';
} else {
$atLeast1Successful = true;
}
//Check to see if there are item level holds that need follow-up by the user
if (isset($return['items'])) {
$hold_message_data['showItemForm'] = true;
}
$showMessage = true;
}
if (!$atLeast1Successful) {
$hold_message_data['successful'] = 'none';
}
}
} else {
//Get the referrer so we can go back there.
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
$_SESSION['hold_referrer'] = $referer;
}
//Showing place hold form.
if ($user) {
$profile = $this->catalog->getMyProfile($user);
$interface->assign('profile', $profile);
//Get information to show a warning if the user does not have sufficient holds
require_once ROOT_DIR . '/Drivers/marmot_inc/PType.php';
$maxHolds = -1;
//Determine if we should show a warning
$ptype = new PType();
$ptype->pType = $user->patronType;
if ($ptype->find(true)) {
$maxHolds = $ptype->maxHolds;
}
$currentHolds = $profile['numHolds'];
if ($maxHolds != -1 && $currentHolds + count($selectedIds) > $maxHolds) {
$interface->assign('showOverHoldLimit', true);
$interface->assign('maxHolds', $maxHolds);
$interface->assign('currentHolds', $currentHolds);
}
global $locationSingleton;
//Get the list of pickup branch locations for display in the user interface.
$locations = $locationSingleton->getPickupBranches($profile, $profile['homeLocationId']);
$interface->assign('pickupLocations', $locations);
//set focus to the submit button if the user is logged in since the campus will be correct most of the time.
$interface->assign('focusElementId', 'submit');
} else {
//set focus to the username field by default.
$interface->assign('focusElementId', 'username');
}
global $librarySingleton;
$patronHomeBranch = $librarySingleton->getPatronHomeLibrary();
if ($patronHomeBranch != null) {
if ($patronHomeBranch->defaultNotNeededAfterDays > 0) {
$interface->assign('defaultNotNeededAfterDays', date('m/d/Y', time() + $patronHomeBranch->defaultNotNeededAfterDays * 60 * 60 * 24));
} else {
$interface->assign('defaultNotNeededAfterDays', '');
}
$interface->assign('showHoldCancelDate', $patronHomeBranch->showHoldCancelDate);
} else {
//Show the hold cancellation date for now. It may be hidden later when the user logs in.
$interface->assign('showHoldCancelDate', 1);
$interface->assign('defaultNotNeededAfterDays', '');
}
$activeLibrary = $librarySingleton->getActiveLibrary();
if ($activeLibrary != null) {
$interface->assign('holdDisclaimer', $activeLibrary->holdDisclaimer);
} else {
//Show the hold cancellation date for now. It may be hidden later when the user logs in.
$interface->assign('holdDisclaimer', '');
}
}
}
if ($showMessage) {
$hold_message_data['fromCart'] = isset($_REQUEST['fromCart']);
$_SESSION['hold_message'] = $hold_message_data;
if (isset($_SESSION['hold_referrer'])) {
if ($_REQUEST['type'] != 'recall' && $_REQUEST['type'] != 'cancel' && $_REQUEST['type'] != 'update') {
header("Location: " . $_SESSION['hold_referrer']);
} else {
//Redirect for hold cancellation or update
header("Location: " . $configArray['Site']['path'] . '/MyResearch/Holds');
}
if (!isset($hold_message_data['showItemForm']) || $hold_message_data['showItemForm'] == false) {
unset($_SESSION['hold_referrer']);
if (isset($_SESSION['autologout'])) {
unset($_SESSION['autologout']);
UserAccount::softLogout();
}
}
} else {
header("Location: " . $configArray['Site']['path'] . '/MyResearch/Holds');
}
} else {
$interface->assign('fromCart', isset($_REQUEST['fromCart']));
$interface->setPageTitle('Request Items');
$interface->setTemplate('holdMultiple.tpl');
$interface->display('layout.tpl', 'RecordHolds');
}
}
示例5: placeHold
function placeHold()
{
global $user;
global $configArray;
global $interface;
global $analytics;
$analytics->enableTracking();
$recordId = $_REQUEST['id'];
if ($user) {
//The user is already logged in
$barcodeProperty = $configArray['Catalog']['barcodeProperty'];
$catalog = CatalogFactory::getCatalogConnectionInstance();
if (isset($_REQUEST['selectedItem'])) {
$return = $catalog->placeItemHold($recordId, $_REQUEST['selectedItem'], $user->{$barcodeProperty}, '', '');
} else {
$return = $catalog->placeHold($recordId, $user->{$barcodeProperty}, '', '');
}
if (isset($return['items'])) {
$campus = $_REQUEST['campus'];
$interface->assign('campus', $campus);
$items = $return['items'];
$interface->assign('items', $items);
$interface->assign('message', $return['message']);
$interface->assign('id', $recordId);
global $library;
$interface->assign('showDetailedHoldNoticeInformation', $library->showDetailedHoldNoticeInformation);
$interface->assign('treatPrintNoticesAsPhoneNotices', $library->treatPrintNoticesAsPhoneNotices);
//Need to place item level holds.
$results = array('success' => true, 'needsItemLevelHold' => true, 'message' => $interface->fetch('Record/item-hold-popup.tpl'), 'title' => $return['title']);
} else {
// Completed Hold Attempt
$interface->assign('message', $return['message']);
$success = $return['result'];
$interface->assign('success', $success);
//Get library based on patron home library since that is what controls their notifications rather than the active interface.
//$library = Library::getPatronHomeLibrary();
global $library;
$canUpdateContactInfo = $library->allowProfileUpdates == 1;
// set update permission based on active library's settings. Or allow by default.
$canChangeNoticePreference = $library->showNoticeTypeInProfile == 1;
// when user preference isn't set, they will be shown a link to account profile. this link isn't needed if the user can not change notification preference.
$interface->assign('canUpdate', $canUpdateContactInfo);
$interface->assign('canChangeNoticePreference', $canChangeNoticePreference);
$interface->assign('showDetailedHoldNoticeInformation', $library->showDetailedHoldNoticeInformation);
$interface->assign('treatPrintNoticesAsPhoneNotices', $library->treatPrintNoticesAsPhoneNotices);
$results = array('success' => $success, 'message' => $interface->fetch('Record/hold-success-popup.tpl'), 'title' => $return['title']);
if (isset($_REQUEST['autologout'])) {
UserAccount::softLogout();
$results['autologout'] = true;
}
}
} else {
$results = array('success' => false, 'message' => 'You must be logged in to place a hold. Please close this dialog and login.', 'title' => 'Please login');
if (isset($_REQUEST['autologout'])) {
UserAccount::softLogout();
$results['autologout'] = true;
}
}
return $this->json_utf8_encode($results);
}
示例6: launch
function launch()
{
global $interface;
global $configArray;
global $user;
$driver = new EContentDriver();
$id = strip_tags($_REQUEST['id']);
$interface->assign('id', $id);
global $logger;
//Get title information for the record.
$eContentRecord = new EContentRecord();
$eContentRecord->id = $id;
if (!$eContentRecord->find(true)) {
PEAR_Singleton::raiseError("Unable to find eContent record for id: {$id}");
}
if (isset($_POST['submit']) || $user) {
if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
//Log the user in
$user = UserAccount::login();
}
if (!PEAR_Singleton::isError($user) && $user) {
//The user is already logged in
$return = $driver->checkoutRecord($id, $user);
$interface->assign('result', $return['result']);
$message = $return['message'];
$interface->assign('message', $message);
global $logger;
$logger->log("Result of checkout " . print_r($return, true), PEAR_LOG_DEBUG);
$showMessage = true;
} else {
$message = 'Incorrect Patron Information';
$interface->assign('message', $message);
$interface->assign('focusElementId', 'username');
$showMessage = true;
}
} else {
//Get the referrer so we can go back there.
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
$_SESSION['checkout_referrer'] = $referer;
}
//Showing checkout form.
if (!PEAR_Singleton::isError($user) && $user) {
//set focus to the submit button if the user is logged in since the campus will be correct most of the time.
$interface->assign('focusElementId', 'submit');
} else {
//set focus to the username field by default.
$interface->assign('focusElementId', 'username');
}
}
if (isset($return) && $showMessage) {
$hold_message_data = array('successful' => $return['result'] ? 'all' : 'none', 'error' => isset($return['error']) ? $return['error'] : null, 'titles' => array($return));
$_SESSION['checkout_message'] = $hold_message_data;
if (isset($_SESSION['checkout_referrer'])) {
$logger->log('Checkout Referrer is set, redirecting to there. referrer = ' . $_SESSION['checkout_referrer'], PEAR_LOG_INFO);
header("Location: " . $_SESSION['checkout_referrer']);
unset($_SESSION['checkout_referrer']);
if (isset($_SESSION['autologout'])) {
unset($_SESSION['autologout']);
UserAccount::softLogout();
}
} else {
$logger->log('No referrer set, but there is a message to show, go to the main eContent page', PEAR_LOG_INFO);
header("Location: /MyResearch/EContentCheckedOut");
}
} else {
//Var for the IDCLREADER TEMPLATE
$interface->assign('ButtonBack', true);
$interface->assign('ButtonHome', true);
$interface->assign('MobileTitle', 'Login to your account');
$logger->log('eContent checkout finished, do not need to show a message', PEAR_LOG_INFO);
$interface->setPageTitle('Checkout Item');
$interface->assign('subTemplate', 'checkout.tpl');
$interface->setTemplate('checkout.tpl');
$interface->display('layout.tpl', 'RecordHold' . $_GET['id']);
}
}