2 /***********************************************************************/
4 /***********************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
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 /***********************************************************************/
14 if (!defined('AT_INCLUDE_PATH')) { exit; }
16 include (AT_PA_INCLUDE.'classes/PhotoAlbum.class.php');
17 include (AT_PA_INCLUDE.'lib.inc.php');
19 $aid = intval($_REQUEST['id']);
20 $pa = new PhotoAlbum($aid);
22 if (!$pa->checkAlbumPriv($_SESSION['member_id'])){
23 $msg->addError('ACCESS_DENIED');
24 header('location: index.php');
32 $_pages[AT_PA_BASENAME.'edit_album.php']['parent'] = AT_PA_BASENAME.'index_admin.php';
36 $album_info = $pa->getAlbumInfo();
38 //handle Edit album info.
39 if(isset($_POST['submit'])){
40 $pa = new PhotoAlbum($_POST['aid']); //new object
41 if (isset($_POST['album_type'])){
42 $album_type = (intval($_POST['album_type'])==AT_PA_TYPE_MY_ALBUM)?AT_PA_TYPE_MY_ALBUM:AT_PA_TYPE_COURSE_ALBUM;
44 //default is "my album" 'cause normally user can't create course album.
45 $album_type = AT_PA_TYPE_MY_ALBUM;
48 //private or shared album?
49 if (isset($_POST['album_permission'])){
50 $album_permission = ($_POST['album_permission']==AT_PA_SHARED_ALBUM)?AT_PA_SHARED_ALBUM:AT_PA_PRIVATE_ALBUM;
52 $album_permission = AT_PA_PRIVATE_ALBUM;
55 if (isset($_POST['album_name']) && $_POST['album_name']!=''){
56 //TODO: photo_id = 0, should default to use the first one after multi-file uploader works
57 $result = $pa->editAlbum($_POST['album_name'], $_POST['album_location'], $_POST['album_description'], $album_type, $album_permission);
60 $msg->addError('PA_EDIT_ALBUM_FAILED');
63 //album name can't be empty
64 $msg->addError('EMPTY_ALBUM_NAME');
67 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
70 header('Location: '.AT_PA_INCLUDE.'../index_admin.php');
73 //header('Location: albums.php?id='.intval($_POST['aid']));
74 header('Location: index.php');
76 } elseif (isset($_POST['cancel'])){
77 $msg->addFeedback('CANCELLED');
80 header('Location: '.AT_PA_INCLUDE.'../index_admin.php');
83 header('Location: '.AT_PA_BASE);
88 $savant->assign('album_info', $album_info);
89 $savant->display('photos/pa_edit_album.tmpl.php');