public function photoUpdate() { $albumId = $_GET['albumId']; $photo = new PhotosModel(); $photos = $photo->getPhotos($albumId); $album = new AlbumModel(); $albums = $album->getAlbumById($albumId); //var_dump($_POST); if ($_POST) { $arr = array(); foreach ($_POST['photo_description'] as $k => $v) { $newk = trim($k, "'"); //echo $newk; $arr['fileName'] = $newk; $arr['description'] = $v; $data = $photo->getPhotosByFileName($newk); //var_dump($arr); if (!empty($data)) { $row = $photo->updatePhotos($data['photoId'], $arr); } else { $arr['fileName'] = '/asset/upload/' . $arr['fileName']; $arr['albumId'] = $albumId; $row = $photo->addPhotos($arr); } //$this->row=$row; } //var_dump($_POST); $update = array(); $update['albumName'] = $_POST['albumName']; $update['description'] = $_POST['description']; if (isset($_POST['frontCover']) && !empty($_POST['frontCover'])) { $update['frontCover'] = $_POST['frontCover']; } //var_dump($update); $rows = $album->updateAlbum($albumId, $update); S('相册修改成功'); } $album_photos = array(); foreach ($photos as $v) { if ($albums['frontCover'] == $v['fileName']) { $v['frontCover'] = 1; } else { $v['frontCover'] = 0; } $album_photos[] = $v; } //相册的信息 $this->assign('albums', $albums); //该相册下的所有图片 $this->assign('photos', $album_photos); $this->display(); }
public function photoInfo() { $albumId = $_GET['albumId']; //实例化Model $photoModel = new PhotosModel(); $albumModel = new AlbumModel(); $commentModel = new CommentModel(); $userModel = new UserModel(); $articletypeModel = new ArticleTypeModel(); $articleTagModel = new ArticleTagModel(); //用户个人信息 $allUserInfo = $userModel->getAllUserInfo(); //博主个人信息 $blogerInfo = $this->getBlogerInfo($blogerId); //获取所有文章分类 $allTypes = $articletypeModel->getCatrgoryByadminId($blogerId); //var_dump($allTypes); //获取所有文章标签 $allTags = $articleTagModel->getArticleTag(); //最新三条评论 $latestComments = $commentModel->getLatestComments($blogerId, '0,3'); //根据相册id集查询所有评论 $comments = $commentModel->getCommentByAlbumId($ArrAlbumId); //相册评论数 $photoCollectNum = $commentModel->getCommentByArrAlbumId($ArrblogerId); $photo['photoCollectNum'] = $photoCollectNum; //获取该相册的所有照片 $photoNum = $photoModel->getPhotos($blogerId, $limit = ''); $photo['photoNum'] = $photoNum; //某相册的照片数量 $photocount = $photoModel->getPhotosCountByAlbumId($AlbumId); $photo['photocount'] = $photocount; //根据照片id查询照片信息 $photoInfo = $photoModel->getPhotosById($value['photoId']); if ($count > $pagesize) { $page = new Page($count, $p, $pagesize); $str = $page->show('themeuk.php'); } $this->assign('page', $str); $this->assign('photoNum', $photoNum); //某相册所有照片 $this->assign('photoCollectNum', $photoCollectNum); //某相册的评论总数 $this->assign('blogerInfo', $blogerInfo); //某博主信息 $this->assign('allUserInfo', $allUserInfo); //某用户信息 $this->assign('latestComments', $latestComments); //最新三条评论 $this->assign('allTypes', $allTypes); //所有文章分类 $this->assign('photoInfo', $photoInfo); //照片信息 $this->assign("allTags", $allTags); //所有文章标签 $this->assign('photocount', $photocount); //某相册的照片数量 $this->assign('photo', $photo); //照片信息 $this->assign('comments', $comments); $this->display(); }
public function albumInfo() { $blogerId = Data::get($_GET['blogerId'], Data::Int); $albumId = Data::get($_GET['albumId'], Data::Int); if (!is_int($blogerId) && $blogerId <= 0) { R('Index', 'index'); } if (!is_int($albumId) && $albumId <= 0) { R('Index', 'index'); } // $blogerId=$_GET['blogerId']; // $albumId=$_GET['albumId']; $album = new AlbumModel(); $albums = $album->getAlbumById($albumId); $photo = new PhotosModel(); $photos = $photo->getPhotos($albumId); $time = 0; foreach ($photos as $v) { $addtime = strtotime($v['addTime']); if ($time < $addtime) { $time = $addtime; } } $time = date("Y-m-d H:i:s", $time); $photoCount = $photo->getPhotosCountByAlbumId($albumId); $comment = new CommentModel(); $a = $comment->getCommentByAlbumId($albumId); $user = new UserModel(); $comments = array(); foreach ($a as $v) { $users = $v; $users['user'] = $user->getUserById($v['userId']); $comments[] = $users; } //博主个人信息 $blogerInfo = $this->getBlogerInfo($blogerId); $this->assign('blogerInfo', $blogerInfo); //某博主信息 $count = $this->articleCount($blogerId); $this->assign('count', $count); //某博主文章总数 //获取所有文章标签 $allTags = $this->getAllTags(); $this->assign("allTags", $allTags); //所有文章标签 //获取所有文章分类 $allTypes = $this->getAllTypes($blogerId); $this->assign("allTypes", $allTypes); //某人所有文章分类 $latestComments = $this->getLatestComments($blogerId, '0,3'); $this->assign('latestComments', $latestComments); //最新三条评论 //用户个人信息 $allUserInfo = $this->getAllUserInfo(); $this->assign('allUserInfo', $allUserInfo); //某用户信息 //该相册下的所有评论 $this->assign('comments', $comments); //该相册下的所有相片 $this->assign('photos', $photos); //相片最后的添加时间 $this->assign('time', $time); //相册的相片数 $this->assign('photoCount', $photoCount); //相册的部分信息 $this->assign('album', $albums); $this->display(); }