function photos_create_group($group_id) { global $db; $group_id = intval($group_id); //get group name $sql = 'SELECT title FROM ' . TABLE_PREFIX . "groups WHERE group_id=$group_id"; $result = mysql_query($sql, $db); $group_info = mysql_fetch_assoc($result); $pa = new PhotoAlbum(); $album_name = $group_info['title'] . '(' . _AT('group') . ')'; $album_location = _AT('na'); $album_description = _AT('na'); $album_type = AT_PA_TYPE_COURSE_ALBUM; $album_permission = AT_PA_PRIVATE_ALBUM; $album_id = $pa->createAlbum($album_name, $album_location, $album_description, $album_type, $album_permission, $_SESSION['member_id'], 0); if ($album_id === false){ //TODO: sql failure. $msg->addError('PA_CREATE_ALBUM_FAILED'); $result = false; } else { $sql = 'INSERT INTO '.TABLE_PREFIX."pa_groups (group_id, album_id) VALUES ($group_id, $album_id)"; $result = mysql_query($sql, $db); } }
function photos_create_group($group_id) { $group_id = intval($group_id); //get group name $sql = "SELECT title FROM %sgroups WHERE group_id=%d"; $group_info = queryDB($sql, array(TABLE_PREFIX, $group_id), TRUE); $pa = new PhotoAlbum(); $album_name = $group_info['title'] . '(' . _AT('group') . ')'; $album_location = _AT('na'); $album_description = _AT('na'); $album_type = AT_PA_TYPE_COURSE_ALBUM; $album_permission = AT_PA_PRIVATE_ALBUM; $album_id = $pa->createAlbum($album_name, $album_location, $album_description, $album_type, $album_permission, $_SESSION['member_id'], 0); if ($album_id === false) { //TODO: sql failure. $msg->addError('PA_CREATE_ALBUM_FAILED'); $result = false; } else { $sql = "INSERT INTO %spa_groups (group_id, album_id) VALUES (%d, %d)"; $result = queryDB($sql, array(TABLE_PREFIX, $group_id, $album_id)); } }
// TA and Instructors can if (isset($_POST['album_type'])) { $album_type = intval($_POST['album_type']) == AT_PA_TYPE_MY_ALBUM ? AT_PA_TYPE_MY_ALBUM : AT_PA_TYPE_COURSE_ALBUM; } else { //default is "my album" 'cause normally user can't create course album. $album_type = AT_PA_TYPE_MY_ALBUM; } //private or shared album? if (isset($_POST['album_permission'])) { $album_permission = $_POST['album_permission'] == AT_PA_SHARED_ALBUM ? AT_PA_SHARED_ALBUM : AT_PA_PRIVATE_ALBUM; } else { $album_permission = AT_PA_PRIVATE_ALBUM; } if (isset($_POST['album_name']) && $_POST['album_name'] != '') { //TODO: photo_id = 0, should default to use the first one after multi-file uploader works $result = $pa->createAlbum($_POST['album_name'], $_POST['album_location'], $_POST['album_description'], $album_type, $album_permission, $_SESSION['member_id'], 0); if (!$result) { //TODO: sql failure. $msg->addError('PA_CREATE_ALBUM_FAILED'); } } else { //album name can't be empty //TODO: user input failure $msg->addError('PA_EMTPY_ALBUM_NAME'); } $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); if ($_POST['album_type'] == AT_PA_TYPE_COURSE_ALBUM) { header('Location: course_albums.php'); exit; } else { header('Location: index.php');
include (AT_PA_INCLUDE.'lib.inc.php'); include (AT_PA_INCLUDE.'classes/PhotoAlbum.class.php'); //$_custom_css = $_base_path . AT_PA_BASENAME . 'module.css'; // use a custom stylesheet $_custom_head .= '<script src="'.$_base_path . AT_PA_BASENAME . 'include/ajaxupload.js" type="text/javascript"></script>'; $member_id = intval($_GET['member_id']); $member_id = ($member_id==0)? $_SESSION['member_id']: $member_id; //run a check to see if any personal album exists, if not, create one. $sql = 'SELECT * FROM '.TABLE_PREFIX.'pa_albums WHERE member_id='.$_SESSION['member_id'].' AND type_id='.AT_PA_TYPE_PERSONAL; $result = mysql_query($sql, $db); if ($result){ $rows = mysql_num_rows($result); if ($rows==0){ //create one. $pa = new PhotoAlbum(); $result = $pa->createAlbum(_AT('pa_profile_album'), '', '', AT_PA_TYPE_PERSONAL, AT_PA_PRIVATE_ALBUM, $_SESSION['member_id']); $id = mysql_insert_id(); } else { $row = mysql_fetch_assoc($result); //album info. $id = $row['id']; } } //instantiate obj $pa = new PhotoAlbum($id); $info = $pa->getAlbumInfo(); //paginator settings $page = intval($_GET['p']); $photos_count = sizeof($pa->getAlbumPhotos()); $last_page = ceil($photos_count/AT_PA_PHOTOS_PER_PAGE);