Esempio n. 1
0
function MakeArtistIndexAlphabet(&$manifest, $id, $Category)
{
    global $SQ;
    global $NL;
    // Keep artist after first letter on same page
    //
    $ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $c = 1;
    $end = $manifest->CategoryFirstPreset[$Category] + $manifest->GetCategoryCount($Category);
    $fp = $manifest->CategoryFirstPreset[$Category];
    $FP = array();
    $CNT = array();
    $Index = 1;
    $FP[0] = -1;
    $CNT[0] = 0;
    while ($fp < $end) {
        $cnt = $c;
        if ($fp + $c > $end) {
            $cnt = $end - $fp;
        } else {
            $tmp = $cnt;
            if (is_numeric($manifest->PresetArtistSkip[$fp + $tmp - 1][0])) {
                while (is_numeric($manifest->PresetArtistSkip[$fp + $cnt][0]) && $fp + $cnt < $end) {
                    $cnt++;
                }
            } else {
                while (strcmp(strtoupper($manifest->PresetArtistSkip[$fp + $tmp - 1][0]), strtoupper($manifest->PresetArtistSkip[$fp + $cnt][0])) == 0 && $fp + $cnt < $end) {
                    $cnt++;
                }
            }
        }
        $FP[$Index] = $fp;
        $CNT[$Index] = $cnt;
        $Index = $Index + 1;
        $fp += $cnt;
    }
    $FP[$Index] = -1;
    $CNT[$Index] = 0;
    $str = '<div class="ui-grid-c">' . $NL;
    $class = "ui-block-a";
    $start = 1;
    if (is_numeric($manifest->PresetArtistSkip[$FP[1]][0])) {
        $start = 2;
    }
    $alpha = 0;
    for ($i = $start; $i < $Index; $i++) {
        $letter = strtoupper($manifest->PresetArtistSkip[$FP[$i]][0]);
        while ($alpha < strlen($ALPHABET) && strcmp($ALPHABET[$alpha], $letter) < 0) {
            $class .= " ui-disabled";
            $str .= '<div class="' . $class . '">';
            $href = '#';
            $str .= '<a href="' . $href . '" data-role="button">';
            $str .= strtoupper($ALPHABET[$alpha]);
            $str .= '</a>';
            $str .= "</div>" . $NL;
            $class = "ui-block-b";
            $alpha++;
        }
        $str .= '<div class="' . $class . '">';
        $href = 'presets.php?firstpreset=' . $FP[$i] . '&count=' . $CNT[$i];
        $str .= '<a href="' . $href . '" data-role="button">';
        if (is_numeric($letter)) {
            $str .= '#';
        } else {
            $str .= strtoupper($letter);
        }
        $str .= '</a>';
        $str .= "</div>" . $NL;
        $tmp = MakeOnePreset($manifest, $FP[$i], $CNT[$i]);
        $class = "ui-block-b";
        $alpha++;
    }
    while ($alpha < strlen($ALPHABET)) {
        $class .= " ui-disabled";
        $str .= '<div class="' . $class . '">';
        $href = '#';
        $str .= '<a href="' . $href . '" data-role="button">';
        $str .= strtoupper($ALPHABET[$alpha]);
        $str .= '</a>';
        $str .= "</div>" . $NL;
        $class = "ui-block-b";
        $alpha++;
    }
    if ($start == 2) {
        $class = "ui-block-b";
        $str .= '<div class="' . $class . '">';
        $href = 'presets.php?firstpreset=' . $FP[1] . '&count=' . $CNT[1];
        $str .= '<a href="' . $href . '" data-role="button">';
        $str .= '#';
        $str .= '</a>';
        $str .= "</div>" . $NL;
        $class = "ui-block-b";
        $alpha++;
    }
    $str .= "</div>" . $NL;
    return $str;
}
Esempio n. 2
0
<?php

/*!
* LinnDS-jukebox
*
* Copyright (c) 2011 Henrik Tolbøl, http://tolbøl.dk
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*/
require "header.inc";
require_once "setup.php";
$FirstPreset = $_GET["firstpreset"];
$PresetCount = $_GET["count"];
$cachefilename = $CACHE_DIR . "/presets-" . $FirstPreset . "-" . $PresetCount;
if ($DO_CACHE && file_exists($cachefilename) && filemtime($cachefilename) > filemtime($manifestfile)) {
    echo file_get_contents($cachefilename);
} else {
    require_once "Manifest.php";
    require_once "Functions.php";
    $manifest = new Manifest($manifestfile);
    echo MakeOnePreset($manifest, $FirstPreset, $PresetCount);
}
require "footer.inc";