/** * Process incoming parameters and display the page. * * @return void * @access public */ public function launch() { global $interface; global $configArray; $interface->assign('id', $_GET['id']); // Check if user is logged in if (!$this->_user) { $interface->assign('recordId', $_GET['id']); $interface->assign('followupModule', 'Record'); $interface->assign('followupAction', 'AddTag'); if (isset($_GET['lightbox'])) { $interface->assign('title', $_GET['message']); $interface->assign('message', 'You must be logged in first'); Login::setupLoginFormVars(); return $interface->fetch('AJAX/login.tpl'); } else { $interface->assign('followup', true); $interface->setPageTitle('You must be logged in first'); Login::setupLoginFormVars(); $interface->assign('subTemplate', '../MyResearch/login.tpl'); $interface->setTemplate('view-alt.tpl'); $interface->display('layout.tpl', 'AddTag' . $_GET['id']); } exit; } if (isset($_POST['submit'])) { $result = $this->save($this->_user); header("Location: " . $configArray['Site']['url'] . '/Record/' . urlencode($_GET['id']) . '/Home'); } else { return $this->_displayForm(); } }
/** * Process parameters and display the page. * * @return void * @access public */ public function launch() { global $interface; global $configArray; // Depending on context, we may get the record ID that initiated the "add // list" action in a couple of different places -- make sure we check all // necessary options before giving up! if (!isset($_GET['id']) && isset($_REQUEST['recordId'])) { $_GET['id'] = $_REQUEST['recordId']; } $interface->assign('recordId', isset($_GET['id']) ? $_GET['id'] : false); $interface->assign('bulkIDs', isset($_REQUEST['ids']) ? $_REQUEST['ids'] : false); // Check if user is logged in if (!$this->_user) { if (isset($_GET['lightbox'])) { $interface->assign('title', $_GET['message']); $interface->assign('message', 'You must be logged in first'); Login::setupLoginFormVars(); return $interface->fetch('AJAX/login.tpl'); } else { include_once 'Login.php'; Login::launch(); } exit; } // Display Page if (isset($_GET['lightbox'])) { $interface->assign('title', $_GET['message']); return $interface->fetch('MyResearch/list-form.tpl'); } else { if (isset($_REQUEST['submit'])) { $result = $this->addList(); if (PEAR::isError($result)) { $interface->assign('listError', $result->getMessage()); } else { if (!empty($_REQUEST['recordId'])) { $url = '../Record/' . urlencode($_REQUEST['recordId']) . '/Save'; } if (isset($_REQUEST['ids']) && !empty($_REQUEST['ids'])) { $parts = array(); foreach ($_REQUEST['ids'] as $id) { $parts[] = urlencode('ids[]') . '=' . urlencode($id); } $url = '../Cart/Home?saveCart=&' . implode('&', $parts); } else { $url = 'Favorites'; } header('Location: ' . $url); die; } } $interface->setPageTitle('Create a List'); $interface->assign('subTemplate', 'list-form.tpl'); $interface->setTemplate('view-alt.tpl'); $interface->display('layout.tpl'); } }
/** * Load a list of organizations whose library services are active * in this view. * * @return void * @access public */ public function launch() { global $interface; Login::setupLoginFormVars(); $file = 'aboutfinna.' . $interface->getLanguage() . '.tpl'; $interface->setPageTitle(translate("content-aboutfinna")); $interface->setTemplate($file); $interface->display('layout.tpl'); }
/** * Process incoming parameters and display the page. * * @return void * @access public */ public function launch() { global $interface; global $user; global $configArray; // Process Delete Comment if (isset($_GET['delete']) && is_object($user)) { $this->deleteComment($_GET['delete'], $user); } // Process Inappropriate Comment if (isset($_GET['inappropriate'])) { if (isset($_GET['lightbox'])) { $interface->assign('commentId', $_GET['inappropriate']); $interface->display('Record/report-inappropriate.tpl'); exit; } else { //TODO: non ajax functionality exit; } } if (isset($_REQUEST['comment'])) { if (!$user) { $interface->assign('recordId', $_GET['id']); // Use "extraParams" mechanism to make sure that user comment gets // passed safely through login process: $interface->assign('extraParams', array(array('name' => 'comment', 'value' => $_REQUEST['comment']))); $interface->assign('followup', true); $interface->assign('followupModule', 'Record'); $interface->assign('followupAction', 'UserComments'); $interface->setPageTitle('You must be logged in first'); Login::setupLoginFormVars(); $interface->assign('subTemplate', '../MyResearch/login.tpl'); $interface->setTemplate('view-alt.tpl'); $interface->display('layout.tpl', 'UserComments' . $_GET['id']); exit; } $result = $this->saveComment($user); } // Get number of comments for this record $comments = new Comments(); $commentCount = $comments->getCommentCount($_REQUEST['id']); $interface->assign(compact('commentCount')); $interface->setPageTitle(translate('Comments') . ': ' . $this->recordDriver->getBreadcrumb()); // Set Messages $interface->assign('infoMsg', $this->infoMsg); $interface->assign('errorMsg', $this->errorMsg); $this->assignComments(); $interface->assign('user', $user); $interface->assign('subTemplate', 'view-comments.tpl'); $interface->setTemplate('view.tpl'); // Display Page $interface->display('layout.tpl'); }
/** * Load a list of organizations whose library services are active * in this view. * * @return void * @access public */ public function launch() { global $interface; Login::setupLoginFormVars(); // Try language-specific file first $file = "about.{$interface->lang}.tpl"; if (!$interface->template_exists("Content/{$file}")) { $file = "about.tpl"; } $interface->setPageTitle(translate("content-about")); $interface->setTemplate($file); $interface->display('layout.tpl'); }
/** * Process parameters and display the page. * * @return void * @access public */ public function launch() { global $configArray; global $interface; // Assign the ID of the last search so the user can return to it. if (isset($_SESSION['lastSearchURL'])) { $interface->assign('lastsearch', $_SESSION['lastSearchURL']); } // Get My Fines if ($patron = UserAccount::catalogLogin()) { if (PEAR::isError($patron)) { $this->handleCatalogError($patron); } else { $fines = $this->catalog->getMyFines($patron); if (PEAR::isError($fines)) { PEAR::raiseError($fines); } $loans = $this->catalog->getMyTransactions($patron); $sum = 0; $fines = $this->processFines($fines, $loans, $sum); $this->handleOnlinePayment($patron, $fines); $interface->assign('rawFinesData', $fines); $interface->assign('sum', $sum); $profile = $this->catalog->getMyProfile($patron); if (!PEAR::isError($profile)) { $interface->assign('profile', $profile); } $driver = isset($patron['driver']) ? $patron['driver'] : ''; $interface->assign('driver', $driver); } } Login::setupLoginFormVars(); $interface->setTemplate('fines.tpl'); $interface->setPageTitle('My Fines'); $interface->display('layout.tpl'); }
/** * Process parameters and display the page. * * @return void * @access public */ public function launch() { global $interface; // Get My Transactions if ($patron = UserAccount::catalogLogin()) { if (PEAR::isError($patron)) { $this->handleCatalogError($patron); } else { // Renew Items if (isset($_POST['renewAll']) || isset($_POST['renewSelected'])) { $renewResult = $this->_renewItems($patron); } $result = $this->catalog->getMyTransactions($patron); if (PEAR::isError($result)) { PEAR::raiseError($result); } $transList = array(); foreach ($result as $data) { $current = array('ils_details' => $data); if ($record = $this->db->getRecord($data['id'])) { $formats = isset($record['format']) ? $record['format'] : ''; if (!is_array($formats)) { $formats = array($formats); } foreach ($formats as &$format) { $format = preg_replace('/^\\d\\//', '', $format); $format = rtrim($format, "/"); } $driver = RecordDriverFactory::initRecordDriver($record); if (!empty($data['title'])) { $title = $data['title']; } else { $title = isset($record['title']) ? $record['title'] : null; } $current += array('id' => $record['id'], 'isbn' => isset($record['isbn']) ? $record['isbn'] : null, 'author' => isset($record['author']) ? $record['author'] : null, 'title' => $title, 'format' => $formats, 'summImages' => $driver ? $driver->getAllImages() : null, 'summThumb' => $driver ? $driver->getThumbnail() : null); } $transList[] = $current; } if ($this->checkRenew) { $transList = $this->_addRenewDetails($transList); } $interface->assign('transList', $transList); $profile = $this->catalog->getMyProfile($patron); if (!PEAR::isError($profile)) { $interface->assign('profile', $profile); } } } Login::setupLoginFormVars(); $interface->setTemplate('checkedout.tpl'); $interface->setPageTitle('Checked Out Items'); $interface->display('layout.tpl'); }
/** * Process incoming parameters and display the page. * * @return void * @access public */ public function launch() { global $interface; global $configArray; // Check if the request is an ajax request $isAjax = false; if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { $isAjax = true; } // Check if user is logged in if (!$this->_user) { // Needed for "back to record" link in view-alt.tpl: $interface->assign('id', $_GET['id']); // Needed for login followup: $interface->assign('recordId', $_GET['id']); if (isset($_GET['lightbox'])) { $interface->assign('title', $_GET['message']); $interface->assign('message', 'You must be logged in first'); $interface->assign('followup', true); $interface->assign('followupModule', 'MetaLib'); $interface->assign('followupAction', 'Save'); Login::setupLoginFormVars(); return $interface->fetch('AJAX/login.tpl'); } else { $interface->assign('followup', true); $interface->assign('followupModule', 'MetaLib'); $interface->assign('followupAction', 'Save'); $interface->setPageTitle('You must be logged in first'); Login::setupLoginFormVars(); $interface->assign('subTemplate', '../MyResearch/login.tpl'); $interface->setTemplate('view-alt.tpl'); $interface->display('layout.tpl', 'RecordSave' . $_GET['id']); } exit; } if (isset($configArray['Site']['quickAddToFavorites']) && $configArray['Site']['quickAddToFavorites'] && $isAjax) { $this->saveRecord($this->_user); exit; } if (isset($_GET['submit'])) { $this->saveRecord($this->_user); header('Location: ' . $configArray['Site']['url'] . '/MetaLib/Record?id=' . urlencode($_GET['id'])); exit; } // Setup Search Engine Connection $db = ConnectionManager::connectToIndex('MetaLib'); // Get Record Information $record = $db->getRecord($_GET['id']); $interface->assign('record', $record); // Find out if the item is already part of any lists; save list info/IDs $saved = $this->_user->getSavedData($_GET['id']); $containingLists = array(); $containingListIds = array(); foreach ($saved as $current) { $containingLists[] = array('id' => $current->list_id, 'title' => $current->list_title); $containingListIds[] = $current->list_id; } $interface->assign('containingLists', $containingLists); // Create a list of all the lists that do NOT already contain the item: $lists = $this->_user->getLists(); $nonContainingLists = array(); foreach ($lists as $current) { if (!in_array($current->id, $containingListIds)) { $nonContainingLists[] = array('id' => $current->id, 'title' => $current->title); } } $interface->assign('nonContainingLists', $nonContainingLists); // Display Page $interface->assign('id', $_GET['id']); $interface->assign('lastListUsed', User_list::getLastUsed()); if (isset($_GET['lightbox'])) { $interface->assign('title', $_GET['message']); return $interface->fetch('MetaLib/save.tpl'); } else { $interface->setPageTitle('Add to favorites'); $interface->assign('subTemplate', 'save.tpl'); $interface->setTemplate('view-alt.tpl'); $interface->display('layout.tpl', 'RecordSave' . $_GET['id']); } }
/** * Output the HTML to be used in a dialog box (aka 'lightbox'). * NOTE: this method outputs HTML instead of JSON so it can be $.load() into * any div. * * @return void * @access public */ public function getLightbox() { global $configArray; global $interface; // Assign our followup $interface->assign('followupModule', $_GET['followupModule']); $interface->assign('followupAction', $_GET['followupAction']); $interface->assign('followupId', $_GET['followupId']); // Sanitize incoming parameters $module = preg_replace('/[^\\w]/', '', $_GET['submodule']); $action = preg_replace('/[^\\w]/', '', $_GET['subaction']); // Assign updated module/action to interface so lightbox can be more // self-aware -- we don't want everything treated as AJAX/JSON! $interface->assign('module', $module); $interface->assign('action', $action); // Use our version of login lightbox if ($module == 'AJAX' && $action == 'Login') { Login::setupLoginFormVars(); $page = $interface->fetch('AJAX/login.tpl'); $interface->assign('title', $_GET['message']); $interface->assign('page', $page); $interface->display('AJAX/lightbox.tpl'); exit; } // Call Action $path = 'services/' . $module . '/' . $action . '.php'; if (is_readable($path)) { include_once $path; if (class_exists($action)) { $service = new $action(); $page = $service->launch(); $interface->assign('page', $page); } else { echo translate('Unknown Action'); } } else { echo translate('Cannot Load Action'); } return $interface->display('AJAX/lightbox.tpl'); }
/** * Process incoming parameters and display the page. * * @return void * @access public */ public function launch() { global $configArray; global $interface; global $user; // Are UB Requests Allowed? $this->checkUBRequests = $this->catalog->checkFunction("UBRequests", $this->recordDriver->getUniqueID()); if ($this->checkUBRequests != false) { // Do we have valid information? // Sets $this->logonURL and $this->gatheredDetails $validate = $this->_validateUBRequestData($this->checkUBRequests['HMACKeys']); if (!$validate) { if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); $interface->assign('results', array('status' => 'ub_request_error_blocked')); $interface->display('Record/ub-request-submit.tpl'); } else { header('Location: ../../Record/' . urlencode($this->recordDriver->getUniqueID())); } return false; } // Assign FollowUp Details required for login and catalog login $interface->assign('followup', true); $interface->assign('recordId', $this->recordDriver->getUniqueID()); $interface->assign('followupModule', 'Record'); $interface->assign('followupAction', 'UBRequest' . $this->logonURL); // User Must be logged In to Place Holds if (UserAccount::isLoggedIn()) { if ($patron = UserAccount::catalogLogin()) { // Block invalid requests: $result = PEAR::isError($patron) ? false : $this->catalog->checkUBRequestIsValid($this->recordDriver->getUniqueID(), $this->gatheredDetails, $patron); if (!$result) { $errorMsg = PEAR::isError($patron) ? $patron->getMessage() : 'ub_request_error_blocked'; if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); $interface->assign('results', array('status' => $errorMsg)); $interface->display('Record/ub-request-submit.tpl'); } else { header('Location: ../../Record/' . urlencode($this->recordDriver->getUniqueID()) . "?errorMsg={$errorMsg}#top"); } return false; } $interface->assign('items', $result['items']); $interface->assign('libraries', $result['libraries']); $interface->assign('locations', $result['locations']); $interface->assign('requiredBy', $result['requiredBy']); $interface->assign('formURL', $this->logonURL); $interface->assign('gatheredDetails', $this->gatheredDetails); $extraFields = isset($this->checkUBRequests['extraFields']) ? explode(":", $this->checkUBRequests['extraFields']) : array(); $interface->assign('extraFields', $extraFields); $language = $interface->getLanguage(); if (isset($this->checkUBRequests['helpText'][$language])) { $interface->assign('helpText', $this->checkUBRequests['helpText'][$language]); } elseif (isset($this->checkUBRequests['helpText'])) { $interface->assign('helpText', $this->checkUBRequests['helpText']); } if (isset($_POST['placeRequest'])) { if ($this->_placeRequest($patron)) { // If we made it this far, we're ready to place the request; // if successful, we will redirect and can stop here. return; } } } $interface->setPageTitle(translate('ub_request_place_text') . ': ' . $this->recordDriver->getBreadcrumb()); // Display Form if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); $interface->display('Record/ub-request-submit.tpl'); } else { $interface->assign('subTemplate', 'ub-request-submit.tpl'); // Main Details $interface->setTemplate('view.tpl'); // Display Page $interface->display('layout.tpl'); } } else { // User is not logged in // Display Login Form Login::setupLoginFormVars(); if (isset($_REQUEST['lightbox'])) { $interface->assign('title', $_GET['message']); $interface->assign('message', 'You must be logged in first'); $interface->assign('followup', true); $interface->assign('followupModule', 'Record'); $interface->assign('followupAction', 'UBRequest'); $interface->display('AJAX/login.tpl'); } else { $interface->setTemplate('../MyResearch/login.tpl'); // Display Page $interface->display('layout.tpl'); } } } else { // Shouldn't Be Here if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); $interface->assign('results', array('status' => 'ub_request_error_blocked')); $interface->display('Record/ub-request-submit.tpl'); } else { header('Location: ../../Record/' . urlencode($this->recordDriver->getUniqueID())); } return false; } }
/** * Present User Login * Display Login * * @return void * @access public */ private function _userNonLightBox() { global $interface; // Assign IDs if (isset($_REQUEST['selectAll']) && is_array($_REQUEST['idsAll'])) { $ids = $_REQUEST['idsAll']; } else { if (isset($_REQUEST['ids'])) { $ids = $_REQUEST['ids']; } } // Without IDs, we can't continue if (empty($ids)) { header("Location: " . $this->followupUrl . "?errorMsg=bulk_noitems_advice"); exit; } foreach ($ids as $id) { $extraParams[] = array('name' => "ids[]", 'value' => $id); } $extraParams[] = array('name' => "saveCart", 'value' => 1); Login::setupLoginFormVars(); $interface->assign('extraParams', $extraParams); $interface->assign('followup', true); $interface->assign('followupModule', 'Cart'); $interface->assign('followupAction', 'Home'); $interface->assign('infoMsg', 'You must be logged in first'); $interface->assign('subTemplate', '../MyResearch/login.tpl'); $interface->setTemplate('view.tpl'); $interface->display('layout.tpl'); }
/** * Process parameters and display the page. * * @param string $msg Message to display on the page (optional). * * @return void * @access public */ function launch($msg = null) { global $interface; global $configArray; global $module; global $action; // We should never access this module directly -- this is called by other // actions as a support function. If accessed directly, just redirect to // the MyResearch home page. if ($module == 'MyResearch' && $action == 'Login') { header('Location: Home'); die; } // Assign the followup task to come back to after they login -- note that // we need to check for a pre-existing followup task in case we've // looped back here due to an error (bad username/password, etc.). $followup = isset($_REQUEST['followup']) ? $_REQUEST['followup'] : $action; // Don't go to the trouble if we're just logging in to the Home action if ($followup != 'Home') { $interface->assign('followup', $followup); $interface->assign('followupModule', isset($_REQUEST['followupModule']) ? $_REQUEST['followupModule'] : $module); // Special case -- if user is trying to view a private list, we need to // attach the list ID to the action: $finalAction = $action; if ($finalAction == 'MyList' || $finalAction == 'EditList') { $finalAction .= '/' . $_GET['id']; } $interface->assign('followupAction', isset($_REQUEST['followupAction']) ? $_REQUEST['followupAction'] : $finalAction); // If we have a save or delete action, create the appropriate recordId // parameter. If we've looped back due to user error and already // have a recordId parameter, remember it for future reference. if (isset($_REQUEST['delete'])) { $mode = !isset($_REQUEST['mode']) ? '' : '&mode=' . urlencode($_REQUEST['mode']); $interface->assign('recordId', 'delete=' . urlencode($_REQUEST['delete']) . $mode); } else { if (isset($_REQUEST['save'])) { $mode = !isset($_REQUEST['mode']) ? '' : '&mode=' . urlencode($_REQUEST['mode']); $interface->assign('recordId', 'save=' . urlencode($_REQUEST['save']) . $mode); } else { if (isset($_REQUEST['recordId'])) { $interface->assign('recordId', $_REQUEST['recordId']); } } } // comments and tags also need to be preserved if present if (isset($_REQUEST['comment'])) { $interface->assign('comment', $_REQUEST['comment']); } } $interface->assign('message', $msg); if (isset($_REQUEST['username'])) { $interface->assign('username', $_REQUEST['username']); } if (isset($_REQUEST['extraParams']) && is_array($_REQUEST['extraParams'])) { foreach ($_REQUEST['extraParams'] as $param) { $pair = explode("|", $param, 2); $extraParams[] = array('name' => $pair[0], 'value' => $pair[1]); } $interface->assign('extraParams', $extraParams); } Login::setupLoginFormVars(); $interface->setPageTitle('Login'); $interface->setTemplate('login.tpl'); $interface->display('layout.tpl'); }
/** * Process incoming parameters and display the page. * * @return void * @access public */ public function launch() { global $configArray; global $interface; global $user; if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); } // Are Holds Allowed? $this->checkHolds = $this->catalog->checkFunction("Holds", $this->recordDriver->getUniqueID()); if ($this->checkHolds != false) { // Do we have valid information? // Sets $this->logonURL and $this->gatheredDetails $validate = $this->_validateHoldData($this->checkHolds['HMACKeys']); if (!$validate) { if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); $interface->assign('results', array('status' => 'hold_error_blocked')); $interface->display('Record/hold-submit.tpl'); } else { header('Location: ../../Record/' . urlencode($this->recordDriver->getUniqueID())); } return false; } // Assign FollowUp Details required for login and catalog login $interface->assign('followup', true); $interface->assign('recordId', $this->recordDriver->getUniqueID()); $interface->assign('followupModule', 'Record'); $interface->assign('followupAction', 'Hold' . $this->logonURL); // User Must be logged In to Place Holds if (UserAccount::isLoggedIn()) { if ($patron = UserAccount::catalogLogin()) { // Block invalid requests: $result = PEAR::isError($patron) ? false : $this->catalog->checkRequestIsValid($this->recordDriver->getUniqueID(), $this->gatheredDetails, $patron); if (!$result || $result === 'block') { $errorMsg = PEAR::isError($patron) ? $patron->getMessage() : 'hold_error_blocked'; // This might display login form, so setup login vars Login::setupLoginFormVars(); if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); $interface->assign('results', array('status' => $errorMsg)); $interface->display('Record/hold-submit.tpl'); } else { header('Location: ../../Record/' . urlencode($this->recordDriver->getUniqueID()) . "?errorMsg={$errorMsg}#top"); } return false; } $interface->assign('formURL', $this->logonURL); $interface->assign('gatheredDetails', $this->gatheredDetails); // Get List of PickUp Libraries $libs = $this->catalog->getPickUpLocations($patron, $this->gatheredDetails); $interface->assign('pickup', $libs); $interface->assign('home_library', $user->home_library); if ($this->gatheredDetails['level'] != 'item') { // Get list of request groups $requestGroups = $this->catalog->getRequestGroups($this->recordDriver->getUniqueID(), $patron['id']); if (PEAR::isError($requestGroups)) { PEAR::raiseError($requestGroups); } $interface->assign('requestGroups', $requestGroups); } $interface->assign('defaultDuedate', $this->getDefaultDueDate()); $extraHoldFields = isset($this->checkHolds['extraHoldFields']) ? explode(":", $this->checkHolds['extraHoldFields']) : array(); $interface->assign('extraHoldFields', $extraHoldFields); $defaultPickUpLoc = $this->catalog->getDefaultPickUpLocation($patron, $this->gatheredDetails); $interface->assign('defaultPickUpLocation', $defaultPickUpLoc); $defaultRequestGroup = $this->catalog->getDefaultRequestGroup($patron, $this->gatheredDetails); $interface->assign('defaultRequestGroup', $defaultRequestGroup); $language = $interface->getLanguage(); if (isset($this->checkHolds['helpText'][$language])) { $interface->assign('helpText', $this->checkHolds['helpText'][$language]); } elseif (isset($this->checkHolds['helpText'])) { $interface->assign('helpText', $this->checkHolds['helpText']); } if (isset($_POST['placeHold'])) { // If the form contained a pickup location, make sure that // the value has not been tampered with: if (!$this->validatePickUpInput($extraHoldFields, $libs)) { $this->assignError(array('status' => 'hold_invalid_pickup')); } else { if ($this->_placeHold($patron)) { // If we made it this far, we're ready to place the hold; // if successful, we will redirect and can stop here. return; } } } } $interface->setPageTitle(translate('request_place_text') . ': ' . $this->recordDriver->getBreadcrumb()); // Display Hold Form if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); $interface->display('Record/hold-submit.tpl'); } else { $interface->assign('subTemplate', 'hold-submit.tpl'); // Main Details $interface->setTemplate('view.tpl'); // Display Page $interface->display('layout.tpl'); } } else { // User is not logged in // Display Login Form Login::setupLoginFormVars(); if (isset($_REQUEST['lightbox'])) { $interface->assign('title', $_GET['message']); $interface->assign('message', 'You must be logged in first'); $interface->assign('followup', true); $interface->assign('followupModule', 'Record'); $interface->assign('followupAction', 'Hold'); $interface->display('AJAX/login.tpl'); } else { $interface->setTemplate('../MyResearch/login.tpl'); // Display Page $interface->display('layout.tpl'); } } } else { // Shouldn't Be Here if (isset($_REQUEST['lightbox'])) { $interface->assign('lightbox', true); $interface->assign('results', array('status' => 'hold_error_blocked')); $interface->display('Record/hold-submit.tpl'); } else { header('Location: ../../Record/' . urlencode($this->recordDriver->getUniqueID())); } return false; } }
/** * Add or edit an account * * @param int $id Account ID (null to add a new account) * * @return void */ protected function editAccount($id) { global $user; global $interface; if (isset($id)) { $account = new User_account(); $account->id = $id; $account->user_id = $user->id; if (!$account->find(true)) { header('Location: Accounts'); die; } $date = new VuFindDate(); $interface->assign('id', $account->id); $interface->assign('account_name', isset($_REQUEST['account_name']) ? $_REQUEST['account_name'] : $account->account_name); $interface->assign('description', isset($_REQUEST['description']) ? $_REQUEST['description'] : $account->description); list($login_target, $cat_username) = explode('.', $account->cat_username, 2); $interface->assign('login_target', isset($_REQUEST['login_target']) ? $_REQUEST['login_target'] : $login_target); $interface->assign('cat_username', isset($_REQUEST['username']) ? $_REQUEST['username'] : $cat_username); $interface->assign('cat_password', $account->cat_password); $interface->assign('home_library', $account->home_library); $interface->assign('created', $date->convertToDisplayDate('Y-m-d H:i:s', $account->created)); $interface->assign('changed', $date->convertToDisplayDate('Y-m-d H:i:s', $account->saved)); } else { $interface->assign('account_name', isset($_REQUEST['account_name']) ? $_REQUEST['account_name'] : ''); $interface->assign('description', isset($_REQUEST['description']) ? $_REQUEST['description'] : ''); $interface->assign('login_target', isset($_REQUEST['login_target']) ? $_REQUEST['login_target'] : ''); $interface->assign('cat_username', isset($_REQUEST['username']) ? $_REQUEST['username'] : ''); } Login::setupLoginFormVars(); $interface->setTemplate('editAccount.tpl'); $interface->setPageTitle('Library Cards'); $interface->display('layout.tpl'); }
/** * Process parameters and display the page. * * @return void * @access public */ public function launch() { global $configArray; global $interface; global $user; // Collect all messages so that nothing is overwritten $userMessages = array(); $userErrors = array(); // These require just a login if (UserAccount::isLoggedIn()) { // Update email address if (isset($_POST['email'])) { if ($user->changeEmailAddress($_POST['email'])) { $userMessages[] = 'profile_update'; } } $interface->assign('email', $user->email); // Update due date reminder if (isset($_POST['due_date_reminder'])) { $interval = $_POST['due_date_reminder']; if (is_numeric($interval) && $interval >= 0) { if ($user->changeDueDateReminder($_POST['due_date_reminder'])) { $userMessages[] = 'profile_update'; } } } $interface->assign('dueDateReminder', $user->due_date_reminder); } // Get My Profile if ($patron = UserAccount::catalogLogin()) { if (PEAR::isError($patron)) { $this->handleCatalogError($patron); } else { // Address change request form if (isset($_POST['changeAddressRequest'])) { $profile = $this->catalog->getMyProfile($patron); if (!PEAR::isError($profile)) { $interface->assign('address1', isset($profile['address1']) ? $profile['address1'] : ''); $interface->assign('zip', isset($profile['zip']) ? $profile['zip'] : ''); } $interface->display('/MyResearch/change-address.tpl'); return; } // Address change request if (isset($_POST['changeAddressLine1']) && isset($_POST['changeAddressZip'])) { $profile = $this->catalog->getMyProfile($patron); $data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $data['oldAddress1'] = isset($profile['address1']) ? $profile['address1'] : ''; $data['oldZip'] = isset($profile['zip']) ? $profile['zip'] : ''; $result = $this->sendEmail($patron, $data, 'Osoitteenmuutospyyntö', 'Emails/change-address.tpl'); if (!PEAR::isError($result)) { $userMessages[] = 'request_change_email_sent'; } else { error_log('Sending of address change request mail failed: ' . $result->getMessage()); $userErrors[] = 'request_change_email_failed'; } } // Messaging settings request form if (isset($_POST['changeMessagingSettingsRequest'])) { $profile = $this->catalog->getMyProfile($patron); if (isset($profile['messagingServices'])) { $interface->assign('services', $profile['messagingServices']); $emailDays = array(); foreach (array(1, 2, 3, 4, 5) as $day) { if ($day == 1) { $label = translate("messaging_settings_num_of_days"); } else { $label = translate("messaging_settings_num_of_days_plural"); $label = str_replace('{1}', $day, $label); } $emailDays[] = $label; } $interface->assign('emailDays', $emailDays); $interface->assign('days', array(1, 2, 3, 4, 5)); $interface->display('/MyResearch/change-messaging-settings.tpl'); return; } } // Messaging settings request if (isset($_POST['changeMessagingSettings'])) { // Translator for email message (always in Finnish) $translator = new I18N_Translator(array('lang', 'lang_local'), 'fi', $configArray['System']['debug']); $data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $data['pickUpNotice'] = $translator->translate('messaging_settings_method_' . $data['pickUpNotice']); $data['overdueNotice'] = $translator->translate('messaging_settings_method_' . $data['overdueNotice']); if ($data['dueDateAlert'] == 0) { $data['dueDateAlert'] = $translator->translate('messaging_settings_method_none'); } else { if ($data['dueDateAlert'] == 1) { $data['dueDateAlert'] = $translator->translate('messaging_settings_num_of_days'); } else { $txt = $translator->translate('messaging_settings_num_of_days_plural'); $txt = str_replace('{1}', $data['dueDateAlert'], $txt); $data['dueDateAlert'] = $txt; } } $result = $this->sendEmail($patron, $data, 'Viestiasetusten muutospyyntö', 'Emails/change-messaging-settings.tpl'); if (!PEAR::isError($result)) { $userMessages[] = 'request_change_email_sent'; } else { error_log('Sending of messaging settings change request mail failed: ' . $result->getMessage()); $userErrors[] = 'request_change_email_failed'; } } // Change home library if (isset($_POST['home_library']) && $_POST['home_library'] != "") { $home_library = $_POST['home_library']; if ($user->changeHomeLibrary($home_library)) { $userMessages[] = 'profile_update'; } else { $userErrors[] = 'profile_update_failed'; } } // Change Password if (isset($_POST['oldPassword']) && isset($_POST['newPassword']) && isset($_POST['newPassword2'])) { if ($_POST['newPassword'] !== $_POST['newPassword2']) { $userErrors[] = 'change_password_error_verification'; } else { $result = $this->changePassword($_POST['oldPassword'], $_POST['newPassword']); if (PEAR::isError($result)) { $userErrors[] = $result->getMessage(); } else { if ($result['success']) { $userMessages[] = 'change_password_ok'; $user->changeCatalogPassword($_POST['newPassword']); // Re-retrieve patron to make sure it's up to date $patron = UserAccount::catalogLogin(); } else { $userErrors[] = $result['status']; } } } } // Change phone number if (isset($_POST['phone_number'])) { $phoneNumber = trim($_POST['phone_number']); if (preg_match('/^[\\+]?[ \\d\\-]+\\d+$/', $phoneNumber)) { $result = $this->catalog->setPhoneNumber($patron, $phoneNumber); if ($result['success']) { $userMessages[] = 'phone_updated'; // Re-retrieve patron to make sure it's up to date $patron = UserAccount::catalogLogin(); } else { $userErrors[] = $result['sys_message']; } } else { $userErrors[] = 'Phone Number is invalid'; } } // Change email address if (isset($_POST['email_address'])) { $email = trim($_POST['email_address']); if (Mail_RFC822::isValidInetAddress($email)) { $result = $this->catalog->setEmailAddress($patron, $email); if ($result['success']) { $userMessages[] = 'email_updated'; // Re-retrieve patron to make sure it's up to date $patron = UserAccount::catalogLogin(); } else { $userErrors[] = $result['sys_message']; } } else { $userErrors[] = 'Email address is invalid'; } } $result = $this->catalog->getMyProfile($patron); if (!PEAR::isError($result)) { $result['home_library'] = $user->home_library; $libs = $this->catalog->getPickUpLocations($patron); $defaultPickUpLocation = $this->catalog->getDefaultPickUpLocation($patron); $interface->assign('defaultPickUpLocation', $defaultPickUpLocation); $interface->assign('pickup', $libs); $interface->assign('profile', $result); } else { $userErrors[] = $result->getMessage(); } $result = $this->catalog->checkFunction('changePassword'); if ($result !== false) { $interface->assign('changePassword', $result); } $driver = isset($patron['driver']) ? $patron['driver'] : ''; $interface->assign('driver', $driver); } } $interface->assign('userMsg', array_unique($userMessages)); $interface->assign('userError', array_unique($userErrors)); $interface->assign('hideDueDateReminder', isset($configArray['Site']['hideDueDateReminder']) && (bool) $configArray['Site']['hideDueDateReminder']); $interface->assign('hideProfileEmailAddress', isset($configArray['Site']['hideProfileEmailAddress']) && (bool) $configArray['Site']['hideProfileEmailAddress']); Login::setupLoginFormVars(); $interface->setTemplate('profile.tpl'); $interface->setPageTitle('My Profile'); $interface->display('layout.tpl'); }
/** * Process parameters and display the page. * * @return void * @access public */ public function launch() { global $interface; // Get My Holds if ($patron = UserAccount::catalogLogin()) { if (PEAR::isError($patron)) { $this->handleCatalogError($patron); } else { // Get Message from Hold.php if (isset($_GET['success']) && $_GET['success'] != "") { $this->holdResults = array('success' => true, 'status' => "hold_place_success"); $interface->assign('holdResults', $this->holdResults); } // Get Message from CallSlip.php if (isset($_GET['callslip_success']) && $_GET['callslip_success'] != "") { $this->callSlipResults = array('success' => true, 'status' => "call_slip_success"); $interface->assign('callSlipResults', $this->callSlipResults); } // Get Message from UBRequest.php if (isset($_GET['ub_request_success']) && $_GET['ub_request_success'] != "") { $this->UBRequestResults = array('success' => true, 'status' => "ub_request_success"); $interface->assign('UBRequestResults', $this->UBRequestResults); } // Is cancelling Holds Available if ($this->cancelHolds != false) { // Process Submitted Form if (isset($_POST['cancelSelected']) || isset($_POST['cancelAll'])) { $cancelRequest = $this->_cancelHolds($patron); } $interface->assign('cancelResults', $this->cancelResults); } if (isset($_POST['cancelSelectedCallSlips']) || isset($_POST['cancelAllCallSlips'])) { $cancelCallSlipRequest = $this->_cancelCallSlips($patron); $interface->assign('cancelCallSlipResults', $this->cancelCallSlipResults); } // Get List of PickUp Libraries based on patrons home library $libs = $this->catalog->getPickUpLocations($patron); $interface->assign('pickup', $libs); $result = $this->catalog->getMyHolds($patron); if (!PEAR::isError($result)) { if (count($result)) { $recordList = array(); foreach ($result as $row) { $record = $this->db->getRecord($row['id']); $record['ils_details'] = $row; $formats = array(); foreach (isset($record['format']) ? $record['format'] : array() as $format) { $formatRaw = preg_replace('/^\\d\\//', '', $format); $format = rtrim($formatRaw, "/"); $formats[] = $format; } $record['format'] = $formats; $driver = RecordDriverFactory::initRecordDriver($record); if ($driver) { $record['summImages'] = $driver->getAllImages(); $record['summThumb'] = $driver->getThumbnail(); } $recordList[] = $record; } if ($this->cancelHolds != false) { $recordList = $this->_addCancelDetails($recordList); } $interface->assign('recordList', $recordList); } else { $interface->assign('recordList', false); } } else { PEAR::raiseError($result); } $result = $this->catalog->getMyCallSlips($patron); if (!PEAR::isError($result)) { if ($result !== false && count($result)) { $recordList = array(); foreach ($result as $row) { if ($row['id']) { $record = $this->db->getRecord($row['id']); $record['ils_details'] = $row; $formats = array(); foreach (isset($record['format']) ? $record['format'] : array() as $format) { $formatRaw = preg_replace('/^\\d\\//', '', $format); $format = rtrim($formatRaw, "/"); $formats[] = $format; } $record['format'] = $formats; $driver = RecordDriverFactory::initRecordDriver($record); if ($driver) { $record['summImages'] = $driver->getAllImages(); $record['title'] = $driver->getTitle(); $record['summThumb'] = $driver->getThumbnail(); } } else { $record = array(); $record['ils_details'] = $row; } $recordList[] = $record; } $recordList = $this->_addCallSlipCancelDetails($recordList, $patron); $interface->assign('callSlipList', $recordList); } else { $interface->assign('callSlipList', false); } } else { PEAR::raiseError($result); } $profile = $this->catalog->getMyProfile($patron); if (!PEAR::isError($profile)) { $interface->assign('profile', $profile); } } $driver = isset($patron['driver']) ? $patron['driver'] : ''; $interface->assign('driver', $driver); } Login::setupLoginFormVars(); $interface->setTemplate('holds.tpl'); $interface->setPageTitle('Holds and Requests'); $interface->display('layout.tpl'); }