예제 #1
0
파일: index.php 프로젝트: rair/yacs
// load the skin
load_skin('locations');
// the maximum number of locations per page
if (!defined('LOCATIONS_PER_PAGE')) {
    define('LOCATIONS_PER_PAGE', 20);
}
// the title of the page
$context['page_title'] = i18n::s('Locations');
// this page is really only for associates
if (!Surfer::is_associate()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // display the index
} else {
    // count locations in the database
    $stats = Locations::stat();
    if ($stats['count']) {
        $context['page_menu'] += array('_count' => sprintf(i18n::ns('%d location', '%d locations', $stats['count']), $stats['count']));
    }
    // navigation commands for locations, if necessary
    if ($stats['count'] > LOCATIONS_PER_PAGE) {
        $home = 'locations/';
        if ($context['with_friendly_urls'] == 'Y') {
            $prefix = $home . 'index.php/';
        } elseif ($context['with_friendly_urls'] == 'R') {
            $prefix = $home;
        } else {
            $prefix = $home . '?page=';
        }
        $context['page_menu'] += Skin::navigate($home, $prefix, $stats['count'], LOCATIONS_PER_PAGE, $page);
    }