Exemple #1
0
 public function index()
 {
     $vars = array_merge(array('cid' => -1, 'original' => -1, 'order' => 'hot'), $_GET);
     $total = BlogModel::blogs($vars, true);
     $Page = new Newpage($total, 10);
     $this->assign('page', $Page->getPage());
     $this->assign($vars);
     $categories = CategoryModel::categories();
     $this->assign('categories', $categories);
     $blogs = BlogModel::blogs($vars, false, $Page->limit);
     foreach ($blogs as &$row) {
         $row['content'] = strip_tags($row['content']);
         $row['user'] = model('User')->formatForApi($row, $row['uid']);
     }
     $this->assign('blogs', $blogs);
     $hot = BlogModel::hotBlogs(5);
     foreach ($hot as &$row) {
         $row['user'] = model('User')->formatForApi($row, $row['uid']);
     }
     $this->assign('hot_blogs', $hot);
     //$hot_users = UserModel::hotUsers(5);
     $hot_users = BlogModel::hotUsers(5);
     if (is_array($hot_users) and $hot_users) {
         foreach ($hot_users as &$user) {
             $user = model('User')->formatForApi($user, $user['uid']);
         }
     }
     //$this->ajaxReturn($hot_users);
     $this->assign('hot_users', $hot_users);
     $this->display();
 }
 public function index()
 {
     $vars = array_merge(array('type' => -1, 'original' => -1, 'order' => 'new'), $_GET);
     $total = M('V')->all($vars, true);
     $Page = new Newpage($total, 16);
     $this->assign('page', $Page->getPage());
     $list = M('V')->all($vars, false, $Page->limit);
     foreach ($list as &$row) {
         $row['user'] = model('User')->formatForApi($row, $row['uid']);
     }
     //$this->ajaxReturn($list);
     $this->assign('list', $list);
     $this->assign($vars);
     $this->display();
 }
 public function index()
 {
     $vars = $_REQUEST;
     $total = EventModel::_list($vars, true);
     $Page = new Newpage($total, 9);
     $list = EventModel::_list($vars, false, $Page->limit);
     $types = EventModel::types();
     $recommend = EventModel::recommend(3);
     $this->assign('recommend', $recommend);
     $this->assign(array('list' => $list, 'page' => $Page->getPage(), 'types' => $types));
     $area = M('area')->where(array('pid' => 0))->field('area_id id,title')->order('sort asc')->limit(50)->select();
     array_unshift($area, array('id' => 0, 'title' => '全部'));
     $this->assign('areas', $area);
     $this->assign($vars);
     $this->display();
 }
 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();
 }
Exemple #5
0
 public function index()
 {
     $vars = $_REQUEST;
     $total = BbsModel::_list($vars, true);
     $Page = new Newpage($total, 30);
     $this->assign('page', $Page->getPage());
     $list = BbsModel::_list($vars, false, $Page->limit);
     foreach ($list as &$row) {
         $row['user'] = model('User')->formatForApi($row, $row['post_uid']);
         $row['last_reply_user'] = model('User')->formatForApi($row, $row['last_reply_uid']);
     }
     $this->assign('list', $list);
     $categories = BbsModel::categories();
     $this->assign('categories', $categories);
     $act_users = BbsModel::act_users(10);
     foreach ($act_users as &$user) {
         $user = model('User')->formatForApi($user, $user['uid']);
     }
     $this->assign('act_users', $act_users);
     //$this->ajaxReturn($list);
     $this->assign($vars);
     $this->display();
 }
 public function index()
 {
     $vars = $_REQUEST;
     $map = array();
     if (empty($vars['ugid'])) {
         $vars['ugid'] = self::USER_GROUP_PERSON;
         //机构|个人认证
     } else {
         $map['v.usergroup_id'] = intval($vars['ugid']);
     }
     if (empty($vars['vid'])) {
         $vars['vid'] = 0;
         //认证分类
     } else {
         $map['v.user_verified_category_id'] = intval($vars['vid']);
     }
     if (empty($vars['area'])) {
         $vars['area'] = 0;
     } else {
         $map['u.area'] = intval($vars['area']);
     }
     if (empty($vars['vtype'])) {
         $vars['vtype'] = 0;
     } else {
         $map['_string'] = 'u.uid in(select distinct(uid) from ts_video where ts_video.type=' . intval($vars['vtype']) . ')';
     }
     if (empty($vars['sort'])) {
         $vars['sort'] = 'recommend';
     }
     $usergroup_category = $this->usergroup_category($vars['ugid']);
     $usergroup_category = array_merge(array(array('title' => '全部', 'id' => '0')), $usergroup_category);
     $this->assign('usergroup_category', $usergroup_category);
     $video_type = M('video_type')->select();
     $video_type = array_merge(array(array('name' => '全部', 'id' => 0)), $video_type);
     $this->assign('video_type', $video_type);
     $area = M('area')->where(array('pid' => 0))->field('area_id id,title')->order('sort asc')->limit(50)->select();
     array_unshift($area, array('id' => 0, 'title' => '全部'));
     $this->assign('areas', $area);
     $this->assign('sort_type', array(array('name' => '编辑推荐', 'value' => 'recommend'), array('name' => '最新加入', 'value' => 'new'), array('name' => '最受喜欢', 'value' => 'weibo'), array('name' => '点评数', 'value' => 'comment'), array('name' => '最受关注', 'value' => 'follower'), array('name' => '作品数', 'value' => 'publish')));
     $table_user_data = C('DB_PREFIX') . 'user_data';
     $query = M('user_verified v')->join(C('DB_PREFIX') . 'user u on u.uid=v.uid');
     $fields = array('u.uid', 'v.user_verified_category_id vid');
     switch ($vars['sort']) {
         case 'recommend':
             $map['u.is_recommend'] = 1;
             $order = 'u.is_recommend desc';
             break;
         case 'new':
             $order = 'u.ctime desc';
             break;
         case 'weibo':
             $order = 'weibo_count desc';
             $map['weibo.key'] = 'weibo_count';
             $fields[] = 'weibo.value weibo_count';
             $query = $query->join($table_user_data . ' weibo on weibo.uid=u.uid');
             break;
         case 'comment':
             break;
         case 'follower':
             $order = 'follower_count desc';
             $map['follower.key'] = 'follower_count';
             $fields[] = 'follower.value follower_count';
             $query = $query->join($table_user_data . ' follower on follower.uid=u.uid');
             break;
     }
     $query = $query->where($map);
     $query2 = clone $query;
     $total = $query2->count();
     $Page = new Newpage($total, 10);
     $this->assign('page', $Page->getPage());
     $list = $query->field($fields)->order($order)->limit($Page->limit)->select();
     //echo $query->getLastSql();
     foreach ($list as &$row) {
         $row = model('User')->formatForApi($row, $row['uid']);
         $row['verified_name'] = $this->get_user_verified_category_name($row['vid']);
         $row['videos'] = M('V')->getVideoByUid($row['uid']);
         $row['albums'] = M('PhotoA')->getByUid($row['uid']);
         $row['blogs'] = M('Blog')->getByUid($row['uid']);
     }
     //$this->ajaxReturn($list);
     $this->assign('list', $list);
     $this->assign($vars);
     $this->display();
 }
Exemple #7
0
 function photo()
 {
     $map = array('userId' => $this->uid);
     $total = $this->space->photo($map, true);
     $this->assign('total', $total);
     $type = 'new';
     if ($_REQUEST['type'] and in_array($_REQUEST['type'], array('new', 'all'))) {
         $type = $_REQUEST['type'];
     }
     $this->assign('type', $type);
     $order = 'commentCount desc';
     if ($type == 'new') {
         $order = 'cTime desc';
     } else {
     }
     $count = intval($this->space->photo($map, true));
     $Page = new Newpage($count, 8);
     $this->assign('page', $Page->getPage());
     $list = $this->space->photo($map, false, $order, $Page->limit);
     //$this->ajaxReturn($list);
     $this->assign('list', $list);
     if ($this->isAjax()) {
         $this->display('_photo_load');
         exit;
     }
     $this->display();
 }