Exemple #1
2
include_once '../lib/classes/PhotoView.class.php';
// view
// set default value so page loads without passing params
$station = safeParam('station', '7adl');
if (!isset($TEMPLATE)) {
    $TITLE = 'GPS Station ' . strtoupper($station) . ' Photos';
    $NAVIGATION = true;
    $HEAD = '<link rel="stylesheet" href="' . $MOUNT_PATH . '/css/photos.css" />';
    $FOOT = '';
    include 'template.inc.php';
}
$db = new Db();
// Db query result: station details for selected station
$rsStation = $db->queryStation($station);
$station_exists = $rsStation->fetch();
if ($station_exists) {
    // Get a list of photos for selected station
    $dir = sprintf('%s/stations/%s.dir/%s/photos/screen', $DATA_DIR, substr($station, 0, 1), $station);
    $files = getDirContents($dir);
    // Add photos to collection
    $photoCollection = new PhotoCollection($station);
    foreach ($files as $file) {
        $photoModel = new Photo($file);
        $photoCollection->add($photoModel);
    }
    // Render HTML
    $view = new PhotoView($photoCollection);
    $view->render();
} else {
    print '<p class="alert error">ERROR: Station Not Found</p>';
}
Exemple #2
0
 public static function getPhotoBottomList($user_id, $album_id, $login)
 {
     $photo_model = new PhotoModel();
     $list = $photo_model->loadByAlbumUser($user_id, $album_id);
     foreach ($list as &$item) {
         $item['thumbnail'] = self::checkFile($login, $item['thumbnail'], $thumb_file = true);
     }
     $info = array();
     $info['photo_list'] = $list;
     $view = new PhotoView();
     $view->BottomList($info);
     return $view->parse();
 }