function detail($album_id) { $detail = M('photo_album')->find(intval($album_id)); if ($detail) { $detail['type_name'] = ConfigModel::album_types($detail['type'], true); if (empty($detail['type_name'])) { $detail['type_name'] = '其它'; } } return $detail; }
public function index() { $vars = $_REQUEST; if (!isset($vars['original'])) { $vars['original'] = -1; } $size = 16; $total = PhotoAModel::visiable($vars, true); $Page = new Newpage($total, $size); $photos = PhotoAModel::visiable($vars, false, $Page->limit); foreach ($photos as &$row) { $row['user'] = model('User')->formatForApi($row, $row['userId']); } //$this->ajaxReturn($photos); $this->assign('photos', $photos); $this->assign('album_types', ConfigModel::album_types()); $this->assign($vars); $this->assign('page', $Page->getPage()); $this->display(); }
/** * 编辑专辑 * @return void */ public function album_edit() { $id = intval($_REQUEST['id']); $uid = $this->mid; // 获取图片信息 $album = D('Album', 'photo')->where(" id='{$id}' AND userId='{$uid}' ")->find(); $this->assign('album', $album); $albumlist = D('Album')->where(" userId='{$uid}' ")->findAll(); $this->assign('albumlist', $albumlist); $this->assign('album_type', ConfigModel::album_types()); if (!$album) { $this->error('专辑不存在或已被删除!'); } else { // 获取图片数据 $map['albumId'] = $id; $photos = D('Photo')->where($map)->findAll(); $this->assign('photos', $photos); } $this->display(); }