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 $_user_location = 'public';
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
17 include (AT_PA_INCLUDE.'classes/PhotoAlbum.class.php');
18 include (AT_PA_INCLUDE.'lib.inc.php');
19 //$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet
21 $aid = intval($_REQUEST['id']);
22 $pa = new PhotoAlbum($aid);
24 if (!$pa->checkAlbumPriv($_SESSION['member_id'])){
25 $msg->addError('ACCESS_DENIED');
26 header('location: index.php');
31 if (admin_authenticate(AT_ADMIN_PRIV_PHOTO_ALBUM, true)) {
33 $_pages[AT_PA_BASENAME.'edit_album.php']['parent'] = AT_PA_BASENAME.'index_admin.php';
37 $album_info = $pa->getAlbumInfo();
39 //handle Edit album info.
40 if(isset($_POST['submit'])){
41 $pa = new PhotoAlbum($_POST['aid']); //new object
42 if (isset($_POST['album_type'])){
43 $album_type = (intval($_POST['album_type'])==AT_PA_TYPE_MY_ALBUM)?AT_PA_TYPE_MY_ALBUM:AT_PA_TYPE_COURSE_ALBUM;
45 //default is "my album" 'cause normally user can't create course album.
46 $album_type = AT_PA_TYPE_MY_ALBUM;
49 //private or shared album?
50 if (isset($_POST['album_permission'])){
51 $album_permission = ($_POST['album_permission']==AT_PA_SHARED_ALBUM)?AT_PA_SHARED_ALBUM:AT_PA_PRIVATE_ALBUM;
53 $album_permission = AT_PA_PRIVATE_ALBUM;
56 if (isset($_POST['album_name']) && $_POST['album_name']!=''){
57 //TODO: photo_id = 0, should default to use the first one after multi-file uploader works
58 $result = $pa->editAlbum($_POST['album_name'], $_POST['album_location'], $_POST['album_description'], $album_type, $album_permission);
61 $msg->addError('PA_EDIT_ALBUM_FAILED');
64 //album name can't be empty
65 $msg->addError('EMPTY_ALBUM_NAME');
68 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
69 if (admin_authenticate(AT_ADMIN_PRIV_PHOTO_ALBUM, true)) {
71 header('Location: index_admin.php');
74 //header('Location: albums.php?id='.intval($_POST['aid']));
75 header('Location: index.php');
77 } elseif (isset($_POST['cancel'])){
78 $msg->addFeedback('CANCELLED');
79 if (admin_authenticate(AT_ADMIN_PRIV_PHOTO_ALBUM, true)) {
81 header('Location: index_admin.php');
84 header('Location: '.AT_PA_BASE);
89 include (AT_INCLUDE_PATH.'header.inc.php');
90 $savant->assign('album_info', $album_info);
91 $savant->display('photos/pa_edit_album.tmpl.php');
92 include (AT_INCLUDE_PATH.'footer.inc.php');