public function index()
 {
     $order = 'create_time desc';
     $event = D('Event')->order($order)->select();
     foreach ($event as &$v) {
         $v['user'] = query_user(array('nickname', 'avatar32'), $v['uid']);
         $v['cover_url'] = getThumbImageByCoverId($v['cover_id']);
         //    $v['eTime']=friendlyDate($v['eTime']);
     }
     $this->assign('event', $event);
     // dump($event);exit;
     $order = 'create_time desc';
     $event = D('Event')->order($order)->select();
     foreach ($event as &$v) {
         $v['user'] = query_user(array('nickname', 'avatar32'), $v['uid']);
         $v['cover_url'] = getThumbImageByCoverId($v['cover_id']);
         //    $v['eTime']=friendlyDate($v['eTime']);
     }
     $this->assign('event', $event);
     // dump($event);exit;
     $this->display();
 }
 /**
  * @param $id
  * 群组ID
  *渲染编辑群组页面内容
  */
 public function groupAdmin($id)
 {
     $editGroup = D('Group')->where(array('status' => 1, 'id' => $id))->find();
     $editGroup['logo_id'] = getThumbImageByCoverId($editGroup['logo']);
     $editGroup['background_id'] = getThumbImageByCoverId($editGroup['background']);
     $groupType = $this->assignGroupTypes();
     //分类信息内容
     foreach ($groupType['parent'] as $k => $v) {
         $child = $groupType['child'][$v['id']];
         //获取数组中第一父级的位置
         $key_name = array_search($v, $groupType['parent']);
         foreach ($child as $key => $val) {
             $val['title'] = '------' . $val['title'];
             //在父级后面添加数组
             array_splice($groupType['parent'], $key_name + 1, 0, array($val));
         }
     }
     $this->assign('groupTypeAll', $groupType['parent']);
     //  dump($editGroup);exit;
     $this->assign('editGroup', $editGroup);
     $this->display();
 }
 public function getIssueDetail()
 {
     $aId = I('id', 0, 'intval');
     $map['status'] = 1;
     $width = I('width', 160, 'intval');
     $height = I('height', 210, 'intval');
     $aId && ($map['id'] = $aId);
     $IssueDetail = D('Issue/IssueContent')->where($map)->select();
     foreach ($IssueDetail as &$v) {
         $v['user'] = query_user(array('uid', 'username', 'nickname', 'avatar128', 'signature'), $v['uid']);
         $v['content'] = op_h($v['content']);
         $v['cover_url'] = getThumbImageByCoverId($v['cover_id'], $width, $height);
         $v['issue'] = D('Issue/Issue')->where(array('id' => $v['issue_id']))->select();
         foreach ($v['issue'] as &$c) {
             $c['create_time'] = friendlyDate($c['create_time']);
             $c['update_time'] = friendlyDate($c['update_time']);
         }
         $v['support_count'] = D('support')->where(array('appname' => 'Issue', 'table' => 'issue_content', 'row' => $aId))->count();
         if (empty($v['support_count'])) {
             $v['is_supported'] = '0';
         } else {
             $v['is_supported'] = '1';
         }
         $v['create_time'] = friendlyDate($v['create_time']);
         $v['update_time'] = friendlyDate($v['update_time']);
         if (is_login() == $v['uid']) {
             $v['is_author'] = '1';
         } else {
             $v['is_author'] = '0';
         }
     }
     unset($v);
     $list = array('list' => $IssueDetail);
     $this->apiSuccess('返回成功', $list);
 }
 /**
  * 编辑专辑时里面选项的内容
  */
 public function addIssue($id = 0)
 {
     $tree = D('Issue')->getTree();
     $issue = D('IssueContent')->where(array('status' => 1, 'id' => $id))->find();
     $issue['cover_url'] = getThumbImageByCoverId($issue['cover_id']);
     if ($id != 0) {
         $issue['is_edit'] = 1;
     } else {
         $issue['is_edit'] = 0;
     }
     //  dump($tree);exit;
     //  dump($issue);exit;
     $this->assign('issue', $issue);
     $this->assign('tree', $tree);
     $this->display();
 }
 public function getWeGroupAll()
 {
     $this->requireLogin();
     $aPage = I('page', 1, 'intval');
     $aCount = I('count', 10, 'intval');
     $width = I('width', 160, 'intval');
     $height = I('height', 210, 'intval');
     $member = D('GroupMember')->where(array('uid' => is_login(), 'status' => 1))->field('group_id')->select();
     $group_ids = getSubByKey($member, 'group_id');
     $myattend = D('Group/Group')->where(array('id' => array('in', $group_ids), 'status' => 1))->page($aPage, $aCount)->order('uid = ' . is_login() . ' desc ,uid asc')->select();
     foreach ($myattend as &$g) {
         $g['create_time'] = friendlyDate($g['create_time']);
         if (!$width) {
             $g['background'] = get_cover($g['cover_id']);
         } else {
             $g['background'] = getThumbImageByCoverId($g['cover_id'], $width, $height);
         }
         if (!$width) {
             $g['logo'] = get_cover($g['cover_id']);
         } else {
             $g['logo'] = getThumbImageByCoverId($g['cover_id'], $width, $height);
         }
         $g['title'] = op_t($g['title']);
         $g['detail'] = op_t($g['detail']);
         $g['user'] = query_user(array('uid', 'username', 'nickname', 'avatar128'), $g['uid']);
         $g['menmber'] = D('GroupMember')->where(array('group_id' => $g['id']))->order('create_time asc')->count();
         foreach ($g['menmber'] as &$user) {
             $user['user'] = query_user(array('avatar128', 'uid', 'nickname', 'fans', 'following', 'weibocount', 'space_url', 'title'), $user['uid']);
             /*$user['isCreator'] = checkIsCreator($user['uid'], 'Group', $user['group_id']);*/
         }
     }
     unset($g);
     $list = array('list' => $myattend);
     $this->apiSuccess('返回成功', $list);
 }
 public function doAddComment()
 {
     if (!is_login()) {
         $this->error('请您先进行登录', U('Mob/index/index'), 1);
     }
     $aContent = I('post.content', '', 'op_t');
     //获取评论内容
     $aBlogId = I('post.blogId', 0, 'intval');
     //获取当前专辑ID
     $uid = is_login();
     $result = D('LocalComment')->addBlogComment($uid, $aBlogId, $aContent);
     action_log('add_issue_comment', 'local_comment', $result, $uid);
     // dump($result);exit;
     $blog_comment = D('LocalComment')->where(array('app' => 'News', 'mod' => 'index', 'status' => 1, 'id' => $result))->order('create_time desc')->select();
     foreach ($blog_comment as &$v) {
         $v['user'] = query_user(array('nickname', 'avatar32'), $v['uid']);
         $v['cover_url'] = getThumbImageByCoverId($v['cover']);
     }
     if ($blog_comment) {
         $data['html'] = "";
         foreach ($blog_comment as $val) {
             $this->assign("vl", $val);
             $data['html'] .= $this->fetch("_blogcomment");
             $data['status'] = 1;
         }
     } else {
         $data['stutus'] = 0;
         $data['info'] = '评论失败!';
     }
     $this->ajaxReturn($data);
 }