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


PHP UserList::fetch方法代码示例

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


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

示例1: getUserLists

 /**
  * Get all lists that a particular user has created.
  * includes id, title, description, number of titles, and whether or not the list is public
  */
 function getUserLists()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if (!isset($_REQUEST['username']) || !isset($_REQUEST['password'])) {
         return array('success' => false, 'message' => 'The username and password must be provided to load lists.');
     }
     $userId = $user->id;
     $list = new UserList();
     $list->user_id = $userId;
     $list->find();
     $results = array();
     if ($list->N > 0) {
         while ($list->fetch()) {
             $query = "SELECT count(resource_id) as numTitles FROM user_resource where list_id = " . $list->id;
             $numTitleResults = mysql_query($query);
             $numTitles = mysql_fetch_assoc($numTitleResults);
             $results[] = array('id' => $list->id, 'title' => $list->title, 'description' => $list->description, 'numTitles' => $numTitles['numTitles'], 'public' => $list->public == 1);
         }
     }
     require_once ROOT_DIR . '/services/MyResearch/lib/Suggestions.php';
     $suggestions = Suggestions::getSuggestions($userId);
     if (count($suggestions) > 0) {
         $results[] = array('id' => 'recommendations', 'title' => 'User Recommendations', 'description' => 'Personalized Recommendations based on ratings.', 'numTitles' => count($suggestions), 'public' => false);
     }
     return array('success' => true, 'lists' => $results);
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:33,代码来源:ListAPI.php

示例2: getObjectStructure

 static function getObjectStructure()
 {
     global $user;
     // Get All User Lists
     require_once ROOT_DIR . '/sys/LocalEnrichment/UserList.php';
     $userLists = new UserList();
     $userLists->public = 1;
     $userLists->orderBy('title asc');
     $userLists->find();
     $sourceLists = array();
     $sourceLists[-1] = 'Generate from search term and filters';
     while ($userLists->fetch()) {
         if ($userLists->num_titles() > 0) {
             $sourceLists[$userLists->id] = "({$userLists->id}) {$userLists->title} - {$userLists->num_titles()} titles";
         }
     }
     // Get Structure for Sub-categories
     $browseSubCategoryStructure = SubBrowseCategories::getObjectStructure();
     unset($browseSubCategoryStructure['weight']);
     unset($browseSubCategoryStructure['browseCategoryId']);
     $structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of this association'), 'label' => array('property' => 'label', 'type' => 'text', 'label' => 'Label', 'description' => 'The label to show to the user', 'maxLength' => 50, 'required' => true), 'textId' => array('property' => 'textId', 'type' => 'text', 'label' => 'textId', 'description' => 'A textual id to identify the category', 'serverValidation' => 'validateTextId', 'maxLength' => 50), 'userId' => array('property' => 'userId', 'type' => 'label', 'label' => 'userId', 'description' => 'The User Id who created this category', 'default' => $user->id), 'sharing' => array('property' => 'sharing', 'type' => 'enum', 'values' => array('private' => 'Just Me', 'location' => 'My Home Branch', 'library' => 'My Home Library', 'everyone' => 'Everyone'), 'label' => 'Share With', 'description' => 'Who the category should be shared with', 'default' => 'everyone'), 'description' => array('property' => 'description', 'type' => 'html', 'label' => 'Description', 'description' => 'A description of the category.', 'hideInLists' => true), 'subBrowseCategories' => array('property' => 'subBrowseCategories', 'type' => 'oneToMany', 'label' => 'Browse Sub-Categories', 'description' => 'Browse Categories that will be displayed as sub-categories of this Browse Category', 'keyThis' => 'id', 'keyOther' => 'browseCategoryId', 'subObjectType' => 'SubBrowseCategories', 'structure' => $browseSubCategoryStructure, 'sortable' => true, 'storeDb' => true, 'allowEdit' => false, 'canEdit' => false), 'catalogScoping' => array('property' => 'catalogScoping', 'type' => 'enum', 'label' => 'Catalog Scoping', 'values' => array('unscoped' => 'Unscoped', 'library' => 'Current Library', 'location' => 'Current Location'), 'description' => 'What scoping should be used for this search scope?.', 'default' => 'unscoped'), 'searchTerm' => array('property' => 'searchTerm', 'type' => 'text', 'label' => 'Search Term', 'description' => 'A default search term to apply to the category', 'default' => '', 'hideInLists' => true), 'defaultFilter' => array('property' => 'defaultFilter', 'type' => 'textarea', 'label' => 'Default Filter(s)', 'description' => 'Filters to apply to the search by default.', 'hideInLists' => true, 'rows' => 3, 'cols' => 80), 'sourceListId' => array('property' => 'sourceListId', 'type' => 'enum', 'values' => $sourceLists, 'label' => 'Source List', 'description' => 'A public list to display titles from'), 'defaultSort' => array('property' => 'defaultSort', 'type' => 'enum', 'label' => 'Default Sort', 'values' => array('relevance' => 'Best Match', 'popularity' => 'Popularity', 'newest_to_oldest' => 'Newest First', 'oldest_to_newest' => 'Oldest First', 'author' => 'Author', 'title' => 'Title', 'user_rating' => 'Rating'), 'description' => 'The default sort for the search if none is specified', 'default' => 'relevance', 'hideInLists' => true), 'numTimesShown' => array('property' => 'numTimesShown', 'type' => 'label', 'label' => 'Times Shown', 'description' => 'The number of times this category has been shown to users'), 'numTitlesClickedOn' => array('property' => 'numTitlesClickedOn', 'type' => 'label', 'label' => 'Titles Clicked', 'description' => 'The number of times users have clicked on titles within this category'));
     // used by Object Editor to make a list of Browse Categories for Admin interface
     foreach ($structure as $fieldName => $field) {
         if (isset($field['property'])) {
             $field['propertyOld'] = $field['property'] . 'Old';
             $structure[$fieldName] = $field;
         }
     }
     return $structure;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:30,代码来源:BrowseCategory.php

示例3: getSaveToListForm

 function getSaveToListForm()
 {
     global $interface;
     global $user;
     $id = $_REQUEST['id'];
     $interface->assign('id', $id);
     require_once ROOT_DIR . '/sys/LocalEnrichment/UserListEntry.php';
     //Get a list of all lists for the user
     $containingLists = array();
     $nonContainingLists = array();
     $userLists = new UserList();
     $userLists->user_id = $user->id;
     $userLists->deleted = 0;
     $userLists->find();
     while ($userLists->fetch()) {
         //Check to see if the user has already added the title to the list.
         $userListEntry = new UserListEntry();
         $userListEntry->listId = $userLists->id;
         $userListEntry->groupedWorkPermanentId = $id;
         if ($userListEntry->find(true)) {
             $containingLists[] = array('id' => $userLists->id, 'title' => $userLists->title);
         } else {
             $nonContainingLists[] = array('id' => $userLists->id, 'title' => $userLists->title);
         }
     }
     $interface->assign('containingLists', $containingLists);
     $interface->assign('nonContainingLists', $nonContainingLists);
     $results = array('title' => 'Add To List', 'modalBody' => $interface->fetch("GroupedWork/save.tpl"), 'modalButtons' => "<span class='tool btn btn-primary' onclick='VuFind.GroupedWork.saveToList(\"{$id}\"); return false;'>Save To List</span>");
     return json_encode($results);
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:30,代码来源:AJAX.php

示例4: loadUserData

function loadUserData()
{
    global $user;
    global $interface;
    //Load profile information
    $catalog = CatalogFactory::getCatalogConnectionInstance();
    $profile = $catalog->getMyProfile($user);
    if (!PEAR_Singleton::isError($profile)) {
        $interface->assign('profile', $profile);
    }
    //Load a list of lists
    $lists = array();
    require_once ROOT_DIR . '/sys/LocalEnrichment/UserList.php';
    $tmpList = new UserList();
    $tmpList->user_id = $user->id;
    $tmpList->deleted = 0;
    $tmpList->orderBy("title ASC");
    $tmpList->find();
    if ($tmpList->N > 0) {
        while ($tmpList->fetch()) {
            $lists[$tmpList->id] = array('name' => $tmpList->title, 'url' => '/MyAccount/MyList/' . $tmpList->id, 'id' => $tmpList->id, 'numTitles' => $tmpList->num_titles());
        }
    }
    $interface->assign('lists', $lists);
    // Get My Tags
    $tagList = $user->getTags();
    $interface->assign('tagList', $tagList);
    if ($user->hasRole('opacAdmin') || $user->hasRole('libraryAdmin') || $user->hasRole('cataloging')) {
        $variable = new Variable();
        $variable->name = 'lastFullReindexFinish';
        if ($variable->find(true)) {
            $interface->assign('lastFullReindexFinish', date('m-d-Y H:i:s', $variable->value));
        } else {
            $interface->assign('lastFullReindexFinish', 'Unknown');
        }
        $variable = new Variable();
        $variable->name = 'lastPartialReindexFinish';
        if ($variable->find(true)) {
            $interface->assign('lastPartialReindexFinish', date('m-d-Y H:i:s', $variable->value));
        } else {
            $interface->assign('lastPartialReindexFinish', 'Unknown');
        }
    }
}
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:44,代码来源:index.php

示例5: getLists

 function getLists()
 {
     require_once ROOT_DIR . '/sys/LocalEnrichment/UserList.php';
     $lists = array();
     $sql = "SELECT user_list.* FROM user_list " . "WHERE user_list.user_id = '{$this->id}' " . "ORDER BY user_list.title";
     $list = new UserList();
     $list->query($sql);
     if ($list->N) {
         while ($list->fetch()) {
             $lists[] = clone $list;
         }
     }
     return $lists;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:14,代码来源:User.php


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