当前位置: 首页>>代码示例>>PHP>>正文


PHP Resource::staticGet方法代码示例

本文整理汇总了PHP中Resource::staticGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Resource::staticGet方法的具体用法?PHP Resource::staticGet怎么用?PHP Resource::staticGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Resource的用法示例。


在下文中一共展示了Resource::staticGet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: launch

 function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     if (isset($_REQUEST['followup'])) {
         $followupUrl = $configArray['Site']['path'] . "/" . strip_tags($_REQUEST['followupModule']);
         if (!empty($_REQUEST['recordId'])) {
             $followupUrl .= "/" . strip_tags($_REQUEST['recordId']);
         }
         $followupUrl .= "/" . strip_tags($_REQUEST['followupAction']);
         if (isset($_REQUEST['comment'])) {
             $followupUrl .= "?comment=" . urlencode($_REQUEST['comment']);
         }
         header("Location: " . $followupUrl);
     }
     if (isset($_REQUEST['returnUrl'])) {
         $followupUrl = $_REQUEST['returnUrl'];
         header("Location: " . $followupUrl);
     }
     // Delete Resource
     if (isset($_GET['delete'])) {
         $resource = Resource::staticGet('record_id', strip_tags($_GET['delete']));
         $user->removeResource($resource);
     }
     // Narrow by Tag
     if (isset($_GET['tag'])) {
         $interface->assign('tags', strip_tags($_GET['tag']));
     }
     global $library;
     if (isset($library)) {
         $interface->assign('showRatings', $library->showRatings);
     } else {
         $interface->assign('showRatings', 1);
     }
     //Check to see if the user has rated any titles
     $interface->assign('hasRatings', $user->hasRatings());
     // Get My Lists
     $listList = $user->getLists();
     $interface->assign('listList', $listList);
     // Get My Tags
     $tagList = $user->getTags();
     $interface->assign('tagList', $tagList);
     $interface->setPageTitle('Favorites');
     $interface->setTemplate('favorites.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:47,代码来源:Favorites.php

示例2: launch

 function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     //Get all lists for the user
     if ($user) {
         $tmpList = new User_list();
         $tmpList->user_id = $user->id;
         $tmpList->orderBy("title ASC");
         $tmpList->find();
         $allLists = array();
         if ($tmpList->N > 0) {
             while ($tmpList->fetch()) {
                 $allLists[$tmpList->id] = $tmpList->title;
             }
         } else {
             $allList["-1"] = "My Favorites";
         }
         $interface->assign('allLists', $allLists);
     }
     //Figure out if we should show a link to classic opac to pay holds.
     $ecommerceLink = $configArray['Site']['ecommerceLink'];
     if ($user) {
         $homeLibrary = Library::getLibraryForLocation($user->homeLocationId);
     }
     if (strlen($ecommerceLink) > 0 && isset($homeLibrary) && $homeLibrary->showEcommerceLink == 1) {
         $interface->assign('showEcommerceLink', true);
         $interface->assign('minimumFineAmount', $homeLibrary->minimumFineAmount);
         if ($homeLibrary->payFinesLink == 'default' || strlen($homeLibrary->payFinesLink) == 0) {
             $interface->assign('ecommerceLink', $ecommerceLink);
         } else {
             $interface->assign('ecommerceLink', $homeLibrary->payFinesLink);
         }
         $interface->assign('payFinesLinkText', $homeLibrary->payFinesLinkText);
     } else {
         $interface->assign('showEcommerceLink', false);
         $interface->assign('minimumFineAmount', 0);
     }
     // Fetch List object
     if (isset($_GET['id'])) {
         $list = User_list::staticGet($_GET['id']);
     } else {
         //Use the first list.
         if (isset($allLists)) {
             $firstListId = reset(array_keys($allLists));
             if ($firstListId == false || $firstListId == -1) {
                 $list = new User_list();
                 $list->user_id = $user->id;
                 $list->public = false;
                 $list->title = "My Favorites";
             } else {
                 $list = User_list::staticGet($firstListId);
             }
         }
     }
     // Ensure user have privs to view the list
     if (!isset($list) || !$list->public && !UserAccount::isLoggedIn()) {
         require_once 'Login.php';
         Login::launch();
         exit;
     }
     if (!$list->public && $list->user_id != $user->id) {
         PEAR_Singleton::raiseError(new PEAR_Error(translate('list_access_denied')));
     }
     //Reindex can happen by anyone since it needs to be called by cron
     if (isset($_REQUEST['myListActionHead']) && strlen($_REQUEST['myListActionHead']) > 0) {
         $actionToPerform = $_REQUEST['myListActionHead'];
         if ($actionToPerform == 'reindex') {
             $list->updateDetailed(true);
         }
     }
     if (isset($_SESSION['listNotes'])) {
         $interface->assign('notes', $_SESSION['listNotes']);
         unset($_SESSION['listNotes']);
     }
     //Perform an action on the list, but verify that the user has permission to do so.
     $userCanEdit = false;
     if ($user != false) {
         if ($user->id == $list->user_id) {
             $userCanEdit = true;
         } elseif ($user->hasRole('opacAdmin')) {
             $userCanEdit = true;
         } elseif ($user->hasRole('libraryAdmin') || $user->hasRole('contentEditor')) {
             $listUser = new User();
             $listUser->id = $list->user_id;
             $listUser->find(true);
             $listLibrary = Library::getLibraryForLocation($listUser->homeLocationId);
             $userLibrary = Library::getLibraryForLocation($user->homeLocationId);
             if ($userLibrary->libraryId == $listLibrary->libraryId) {
                 $userCanEdit = true;
             }
         }
     }
     if ($userCanEdit && (isset($_REQUEST['myListActionHead']) || isset($_REQUEST['myListActionItem']) || isset($_GET['delete']))) {
         if (isset($_REQUEST['myListActionHead']) && strlen($_REQUEST['myListActionHead']) > 0) {
             $actionToPerform = $_REQUEST['myListActionHead'];
             if ($actionToPerform == 'makePublic') {
                 $list->public = 1;
                 $list->update();
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:MyList.php

示例3: launch

 function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     if (isset($_REQUEST['returnUrl'])) {
         $followupUrl = $_REQUEST['returnUrl'];
         header("Location: " . $followupUrl);
         exit;
     }
     // Delete Resource
     if (isset($_GET['delete'])) {
         $resource = Resource::staticGet('record_id', strip_tags($_GET['delete']));
         $user->removeResource($resource);
     }
     // Narrow by Tag
     if (isset($_GET['tag'])) {
         $interface->assign('tags', strip_tags($_GET['tag']));
     }
     //We are going to the "main page of My Research"
     //Be smart about this depending on the user's information.
     $hasHomeTemplate = $interface->template_exists('MyResearch/home.tpl');
     if (!$user) {
         $action = 'Home';
     } elseif ($hasHomeTemplate) {
         //Var for the IDCLREADER TEMPLATE
         $interface->assign('ButtonBack', false);
         $interface->assign('ButtonHome', true);
         $interface->assign('MobileTitle', ' ');
         $interface->setTemplate('home.tpl');
     } else {
         if ($user && !$interface->isMobile()) {
             // Connect to Database
             $catalog = new CatalogConnection($configArray['Catalog']['driver']);
             $patron = $catalog->patronLogin($user->cat_username, $user->cat_password);
             $profile = $catalog->getMyProfile($patron);
             if ($profile['numCheckedOut'] > 0) {
                 $action = 'CheckedOut';
             } elseif ($profile['numHolds'] > 0) {
                 $action = 'Holds';
             } else {
                 $action = 'Favorites';
             }
             header("Location: /MyResearch/{$action}");
         } else {
             //Go to the login page which is the home page
             $action = 'Home';
         }
         // Build Favorites List
         $favorites = $user->getResources(isset($_GET['tag']) ? strip_tags($_GET['tag']) : null);
         $favList = new FavoriteHandler($favorites, $user);
         $favList->assign();
         // Get My Lists
         $listList = $user->getLists();
         $interface->assign('listList', $listList);
         // Get My Tags
         $tagList = $user->getTags();
         $interface->assign('tagList', $tagList);
         $interface->setPageTitle('Favorites');
         $interface->setTemplate('favorites.tpl');
     }
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:63,代码来源:Home.php


注:本文中的Resource::staticGet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。