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


PHP Stats::get_top方法代码示例

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


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

示例1: getalbumlist

 /**
  * getAlbumList
  * Get a list of random, newest, highest rated etc. albums.
  * Takes the list type with optional size and offset in parameters.
  */
 public static function getalbumlist($input, $elementName = "albumList")
 {
     self::check_version($input, "1.2.0");
     $type = self::check_parameter($input, 'type');
     $size = $input['size'];
     $offset = $input['offset'];
     $musicFolderId = $input['musicFolderId'] ?: 0;
     // Get albums from all catalogs by default
     // Catalog filter is not supported for all request type for now.
     $catalogs = null;
     if ($musicFolderId > 0) {
         $catalogs = array();
         $catalogs[] = $musicFolderId;
     }
     $r = Subsonic_XML_Data::createSuccessResponse();
     $errorOccured = false;
     $albums = array();
     if ($type == "random") {
         $albums = Album::get_random($size);
     } else {
         if ($type == "newest") {
             $albums = Stats::get_newest("album", $size, $offset, $musicFolderId);
         } else {
             if ($type == "highest") {
                 $albums = Rating::get_highest("album", $size, $offset);
             } else {
                 if ($type == "frequent") {
                     $albums = Stats::get_top("album", $size, '', $offset);
                 } else {
                     if ($type == "recent") {
                         $albums = Stats::get_recent("album", $size, $offset);
                     } else {
                         if ($type == "starred") {
                             $albums = Userflag::get_latest('album');
                         } else {
                             if ($type == "alphabeticalByName") {
                                 $albums = Catalog::get_albums($size, $offset, $catalogs);
                             } else {
                                 if ($type == "alphabeticalByArtist") {
                                     $albums = Catalog::get_albums_by_artist($size, $offset, $catalogs);
                                 } else {
                                     if ($type == "byYear") {
                                         $fromYear = $input['fromYear'];
                                         $toYear = $input['toYear'];
                                         if ($fromYear || $toYear) {
                                             $search = array();
                                             $search['limit'] = $size;
                                             $search['offset'] = $offset;
                                             $search['type'] = "album";
                                             $i = 0;
                                             if ($fromYear) {
                                                 $search['rule_' . $i . '_input'] = $fromYear;
                                                 $search['rule_' . $i . '_operator'] = 0;
                                                 $search['rule_' . $i . ''] = "year";
                                                 ++$i;
                                             }
                                             if ($toYear) {
                                                 $search['rule_' . $i . '_input'] = $toYear;
                                                 $search['rule_' . $i . '_operator'] = 1;
                                                 $search['rule_' . $i . ''] = "year";
                                                 ++$i;
                                             }
                                             $query = new Search(null, 'album');
                                             $albums = $query->run($search);
                                         }
                                     } else {
                                         if ($type == "byGenre") {
                                             $genre = self::check_parameter($input, 'genre');
                                             $tag_id = Tag::tag_exists($genre);
                                             if ($tag_id) {
                                                 $albums = Tag::get_tag_objects('album', $tag_id, $size, $offset);
                                             }
                                         } else {
                                             $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_GENERIC, "Invalid list type: " . scrub_out($type));
                                             $errorOccured = true;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$errorOccured) {
         Subsonic_XML_Data::addAlbumList($r, $albums, $elementName);
     }
     self::apiOutput($input, $r);
 }
开发者ID:bl00m,项目名称:ampache,代码行数:95,代码来源:subsonic_api.class.php

示例2: array

 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
?>
<div>
<?php 
$objects = Stats::get_top('album');
$headers = array('f_link' => T_('Most Popular Albums'));
UI::show_box_top('', 'info-box box_popular_albums');
require AmpConfig::get('prefix') . UI::find_template('show_objects.inc.php');
UI::show_box_bottom();
$objects = Stats::get_top('artist');
$headers = array('f_link' => T_('Most Popular Artists'));
UI::show_box_top('', 'info-box box_popular_artists');
require AmpConfig::get('prefix') . UI::find_template('show_objects.inc.php');
UI::show_box_bottom();
if (AmpConfig::get('allow_video')) {
    $objects = Stats::get_top('video');
    $headers = array('f_link' => T_('Most Popular Videos'));
    UI::show_box_top('', 'info-box box_popular_videos');
    require AmpConfig::get('prefix') . UI::find_template('show_objects.inc.php');
    UI::show_box_bottom();
}
?>
</div>
开发者ID:cheese1,项目名称:ampache,代码行数:30,代码来源:show_stats_popular.inc.php

示例3: stats

 public static function stats($input)
 {
     $type = $input['type'];
     $offset = $input['offset'];
     $limit = $input['limit'];
     if ($type == "newest") {
         $albums = Stats::get_newest("album", $limit, $offset);
     } else {
         if ($type == "highest") {
             $albums = Rating::get_highest("album", $limit, $offset);
         } else {
             if ($type == "frequent") {
                 $albums = Stats::get_top("album", $limit, '', $offset);
             } else {
                 if ($type == "recent") {
                     $albums = Stats::get_recent("album", $limit, $offset);
                 } else {
                     if ($type == "flagged") {
                         $albums = Userflag::get_latest('album');
                     } else {
                         if (!$limit) {
                             $limit = AmpConfig::get('popular_threshold');
                         }
                         $albums = Album::get_random($limit);
                     }
                 }
             }
         }
     }
     ob_end_clean();
     echo XML_Data::albums($albums);
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:32,代码来源:api.class.php

示例4: getalbumlist

 /**
  * getAlbumList
  * Get a list of random, newest, highest rated etc. albums.
  * Takes the list type with optional size and offset in parameters.
  */
 public static function getalbumlist($input, $elementName = "albumList")
 {
     self::check_version($input, "1.2.0");
     $type = self::check_parameter($input, 'type');
     $size = $input['size'];
     $offset = $input['offset'];
     $albums = array();
     if ($type == "random") {
         $albums = Album::get_random($size);
     } else {
         if ($type == "newest") {
             $albums = Stats::get_newest("album", $size, $offset);
         } else {
             if ($type == "highest") {
                 $albums = Rating::get_highest("album", $size, $offset);
             } else {
                 if ($type == "frequent") {
                     $albums = Stats::get_top("album", $size, '', $offset);
                 } else {
                     if ($type == "recent") {
                         $albums = Stats::get_recent("album", $size, $offset);
                     } else {
                         if ($type == "starred") {
                             $albums = Userflag::get_latest('album');
                         } else {
                             if ($type == "alphabeticalByName") {
                                 $albums = Catalog::get_albums($size, $offset);
                             } else {
                                 if ($type == "alphabeticalByArtist") {
                                     $albums = Catalog::get_albums_by_artist($size, $offset);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (count($albums)) {
         $r = Subsonic_XML_Data::createSuccessResponse();
         Subsonic_XML_Data::addAlbumList($r, $albums, $elementName);
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
     }
     self::apiOutput($input, $r);
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:51,代码来源:subsonic_api.class.php

示例5: stats

 /**
  * This get library stats.
  * @param array $input
  */
 public static function stats($input)
 {
     $type = $input['type'];
     $offset = $input['offset'];
     $limit = $input['limit'];
     $username = $input['username'];
     $albums = null;
     if ($type == "newest") {
         $albums = Stats::get_newest("album", $limit, $offset);
     } else {
         if ($type == "highest") {
             $albums = Rating::get_highest("album", $limit, $offset);
         } else {
             if ($type == "frequent") {
                 $albums = Stats::get_top("album", $limit, '', $offset);
             } else {
                 if ($type == "recent") {
                     if (!empty($username)) {
                         $user = User::get_from_username($username);
                         if ($user !== null) {
                             $albums = $user->get_recently_played($limit, 'album');
                         } else {
                             debug_event('api', 'User `' . $username . '` cannot be found.', 1);
                         }
                     } else {
                         $albums = Stats::get_recent("album", $limit, $offset);
                     }
                 } else {
                     if ($type == "flagged") {
                         $albums = Userflag::get_latest('album');
                     } else {
                         if (!$limit) {
                             $limit = AmpConfig::get('popular_threshold');
                         }
                         $albums = Album::get_random($limit);
                     }
                 }
             }
         }
     }
     if ($albums !== null) {
         ob_end_clean();
         echo XML_Data::albums($albums);
     }
 }
开发者ID:nioc,项目名称:ampache,代码行数:49,代码来源:api.class.php

示例6: array

 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
?>
<div>
<?php 
$objects = Stats::get_top('album');
$headers = array('f_link' => T_('Most Popular Albums'));
UI::show_box_top('', 'info-box box_popular_albums');
require AmpConfig::get('prefix') . '/templates/show_objects.inc.php';
UI::show_box_bottom();
$objects = Stats::get_top('artist');
$headers = array('f_name_link' => T_('Most Popular Artists'));
UI::show_box_top('', 'info-box box_popular_artists');
require AmpConfig::get('prefix') . '/templates/show_objects.inc.php';
UI::show_box_bottom();
?>
</div>
开发者ID:axelsimon,项目名称:ampache,代码行数:30,代码来源:show_stats_popular.inc.php


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