move code up one directory
[atutor.git] / mods / _standard / photos / index.php
1 <?php
2 /***********************************************************************/
3 /* ATutor                                                                                                                          */
4 /***********************************************************************/
5 /* Copyright (c) 2002-2010                                             */
6 /* Inclusive Design Institute                                          */
7 /* http://atutor.ca                                                                                                        */
8 /*                                                                                                                                         */
9 /* This program is free software. You can redistribute it and/or           */
10 /* modify it under the terms of the GNU General Public License             */
11 /* as published by the Free Software Foundation.                                           */
12 /***********************************************************************/
13 // $Id$
14 $_user_location = 'public';
15
16 define('AT_INCLUDE_PATH', '../../../include/');
17 require (AT_INCLUDE_PATH.'vitals.inc.php');
18 include (AT_PA_INCLUDE.'lib.inc.php');
19 include (AT_PA_INCLUDE.'classes/PhotoAlbum.class.php');
20 //$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet
21
22 //instantiate obj
23 $pa = new PhotoAlbum();
24 $type = AT_PA_TYPE_MY_ALBUM;
25 $album_count = sizeof($pa->getAlbums($_SESSION['member_id'], $type));
26
27 //paginator settings
28 $page = intval($_GET['p']);
29 $last_page = ceil($album_count/AT_PA_ALBUMS_PER_PAGE);
30
31 if (!$page || $page < 0) {
32         $page = 1;
33 } elseif ($page > $last_page){
34         $page = $last_page;
35 }
36
37 $count  = (($page-1) * AT_PA_ALBUMS_PER_PAGE) + 1;
38 $offset = ($page-1) * AT_PA_ALBUMS_PER_PAGE;
39
40 $albums = $pa->getAlbums($_SESSION['member_id'], $type, $offset);
41
42 include (AT_INCLUDE_PATH.'header.inc.php'); 
43 $savant->assign('albums', $albums);
44 $savant->assign('page', $page);
45 $savant->assign('type', $type);
46 $savant->assign('num_rows', $album_count);
47 $savant->display('photos/pa_index.tmpl.php');
48 include (AT_INCLUDE_PATH.'footer.inc.php'); 
49 ?>