public function index()
 {
     $map = $this->setMap();
     $map['status'] = 1;
     $map['last_login_time'] = array('neq', 0);
     $peoples = S('People_peoples_' . I('page', 0, 'intval') . '_' . serialize($map));
     if (empty($peoples)) {
         $peoples = M('Member')->where($map)->field('uid', 'reg_time', 'last_login_time')->order('last_login_time desc')->findPage(20);
         $userConfigModel = M('Ucenter/UserConfig');
         $titleModel = M('Ucenter/Title');
         foreach ($peoples['data'] as &$v) {
             $v = query_user(array('title', 'avatar128', 'nickname', 'uid', 'space_url', 'score', 'title', 'fans', 'following', 'rank_link'), $v['uid']);
             $v['level'] = $titleModel->getCurrentTitleInfo($v['uid']);
             //获取用户封面id
             $where = getUserConfigMap('user_cover', '', $v['uid']);
             $where['role_id'] = 0;
             $model = $userConfigModel;
             $cover = $model->findData($where);
             $v['cover_id'] = $cover['value'];
             $v['cover_path'] = getThumbImageById($cover['value'], 273, 80);
         }
         unset($v);
         S('People_peoples_' . serialize($map), $peoples, 300);
     }
     $this->assign('tab', 'index');
     $this->assign('lists', $peoples);
     $this->display();
 }
 /**
  * 根据角色获取默认头像
  * @param $role_id
  * @param $size
  * @return mixed|string
  * @author 郑钟良<*****@*****.**>
  */
 private function getImageUrlByRoleId($role_id, $size)
 {
     $avatar_id = S('Role_Avatar_Id_' . $role_id);
     if (!$avatar_id) {
         $map = getRoleConfigMap('avatar', $role_id);
         $avatar_id = M('RoleConfig')->where($map)->field('value')->find();
         S('Role_Avatar_Id_' . $role_id, $avatar_id, 600);
     }
     if ($avatar_id) {
         if ($size != 0) {
             $path = getThumbImageById($avatar_id['value'], $size, $size);
         } else {
             $path = getThumbImageById($avatar_id['value']);
         }
     } else {
         //角色没有默认
         if ($size != 0) {
             $default_avatar = "Public/images/default_avatar.jpg";
             $path = $this->getImageUrlByPath($default_avatar, $size, false);
         } else {
             $path = get_pic_src("Public/images/default_avatar.jpg");
         }
     }
     return $path;
 }
 public function render($attributes = array())
 {
     $attributes_id = $attributes['id'];
     $config = $attributes['config'];
     $class = $attributes['class'];
     $value = $attributes['value'];
     $images = explode(',', $value);
     $name = $attributes['name'];
     $attributes['width'] = $width = $attributes['width'] ? $attributes['width'] : 100;
     $attributes['height'] = $height = $attributes['height'] ? $attributes['height'] : 100;
     $isLoadScript = $attributes['isLoadScript'] ? 1 : 0;
     //$filetype = $this->rules['filetype'];
     $config = $config['config'];
     $id = $attributes_id;
     if (empty($attributes['config']['text'])) {
         $attributes['config'] = array('text' => L('_FILE_SELECT_'));
     }
     if (intval($value) != 0) {
         $url = getThumbImageById($value, $width, $height);
         $img = '<img src="' . $url . '"/>';
     } else {
         $img = '';
     }
     $this->assign('isLoadScript', $isLoadScript);
     $this->assign('img', $img);
     $this->assign('images', $images);
     $this->assign($attributes);
     $this->display(T('Application://Common@Widget/uploadmultiimage'));
 }
 public function index($page = 1, $keywords = '')
 {
     $map = $this->setMap();
     $map['status'] = 1;
     $map['last_login_time'] = array('neq', 0);
     $page = I('page', 1, 'intval');
     $page < 1 && ($page = 1);
     $cachedPage = 10;
     $cachedId = 'People_peoples_' . $page . '_' . serialize($map);
     $peoples = $page > $cachedPage || !empty($_REQUEST['keywords']) || !empty($_REQUEST['tag']) ? null : S($cachedId);
     #$peoples = null;
     if (empty($peoples)) {
         $peoples = D('Member')->where($map)->field('uid,reg_time,last_login_time')->order('last_login_time desc')->findPage(20);
         $userConfigModel = D('Ucenter/UserConfig');
         $titleModel = D('Ucenter/Title');
         foreach ($peoples['data'] as &$v) {
             $v['user'] = query_user(array('title', 'avatar128', 'nickname', 'uid', 'space_url', 'icons_html', 'score', 'title', 'fans', 'following', 'rank_link', 'is_following'), $v['uid']);
             $v['level'] = $titleModel->getCurrentTitleInfo($v['uid']);
             //获取用户封面id
             $where = getUserConfigMap('user_cover', '', $v['uid']);
             $where['role_id'] = 0;
             $model = $userConfigModel;
             $cover = $model->where($where)->find();
             $v['cover_id'] = $cover['value'];
             $v['cover_path'] = getThumbImageById($cover['value'], 273, 80);
         }
         $page <= $cachedPage && S($cachedId, $peoples, 300);
     }
     #dump($peoples);exit;
     $this->assign('tab', 'index');
     $this->assign('lists', $peoples);
     $this->display();
 }
 public function getForumList($map_type = array('status' => 1))
 {
     $tag = 'forum_list_' . serialize($map_type);
     $forum_list = S($tag);
     $cache_time = modC('CACHE_TIME', 300, 'Forum');
     if (empty($forum_list)) {
         //读取板块列表
         $forum_list = D('Forum/Forum')->where($map_type)->order('sort asc')->select();
         $forumPostModel = D('ForumPost');
         $forumPostReplyModel = D('ForumPostReply');
         $forumLzlReplyModel = D('ForumLzlReply');
         foreach ($forum_list as &$f) {
             $map['status'] = 1;
             $map['forum_id'] = $f['id'];
             $f['background'] = $f['background'] ? getThumbImageById($f['background'], 800, 'auto') : C('TMPL_PARSE_STRING.__IMG__') . '/default_bg.jpg';
             $f['logo'] = $f['logo'] ? getThumbImageById($f['logo'], 128, 128) : C('TMPL_PARSE_STRING.__IMG__') . '/default_logo.png';
             $f['topic_count'] = $forumPostModel->where($map)->count();
             $post_id = $forumPostModel->where(array('forum_id' => $f['id']))->field('id')->select();
             $p_id = getSubByKey($post_id, 'id');
             $map['post_id'] = array('in', implode(',', $p_id));
             $f['total_count'] = $f['topic_count'] + $forumPostReplyModel->where($map)->count();
             // + $forumLzlReplyModel->where($map)->count();
         }
         unset($f);
         S($tag, $forum_list, $cache_time);
     }
     return $forum_list;
 }
 /**
  * 初始化查询数据
  * @param $list
  * @return mixed
  * @author 郑钟良<*****@*****.**>
  */
 private function _initSelect($list)
 {
     foreach ($list as &$val) {
         $val['path'] = getThumbImageById($val['image'], 745, 280);
     }
     unset($val);
     return $list;
 }
 function decodeGallary($gallary)
 {
     $gallary = json_decode($gallary, true);
     foreach ($gallary as $g) {
         $gallary_array[] = array('id' => $g['id'], 'img' => getThumbImageById($g['id'], 80, 80));
     }
     return $gallary_array;
 }
 /**
  * fetchImage  渲染图片轻博客
  * @param $weibo
  * @return string
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function fetchImage($weibo)
 {
     $weibo_data = unserialize($weibo['data']);
     $weibo_data['attach_ids'] = explode(',', $weibo_data['attach_ids']);
     foreach ($weibo_data['attach_ids'] as $k_i => $v_i) {
         $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 100, 100);
         $bi = D('Picture')->where(array('status' => 1))->getById($v_i);
         $weibo_data['image'][$k_i]['big'] = get_pic_src($bi['path']);
         $param['weibo'] = $weibo;
         $param['weibo']['weibo_data'] = $weibo_data;
     }
     $this->assign($param);
     return $this->fetch(T('Application://Mob@Type/fetchimage'));
 }
 private function userInfo($uid = null)
 {
     $user_info = query_user(array('avatar128', 'nickname', 'uid', 'space_url', 'score', 'title', 'fans', 'following', 'weibocount', 'rank_link', 'signature'), $uid);
     //获取用户封面id
     $map = getUserConfigMap('user_cover', '', $uid);
     $map['role_id'] = 0;
     $model = D('Ucenter/UserConfig');
     $cover = $model->findData($map);
     $user_info['cover_id'] = $cover['value'];
     $user_info['cover_path'] = getThumbImageById($cover['value'], 1140, 230);
     $user_info['tags'] = D('Ucenter/UserTagLink')->getUserTag($uid);
     $this->assign('user_info', $user_info);
     return $user_info;
 }
Example #10
0
function display_cover($cover, $width = 90, $height = 90, $class = '')
{
    if (intval($cover) == 0) {
        $img = C('TMPL_PARSE_STRING.__IMG__');
        echo <<<Eof
 <img class="appstore_cover{$class}" src="{$img}/no_icon.png"/>
Eof;
    } else {
        $cover = getThumbImageById($cover, $width, $height);
        echo <<<Eof
<img class="appstore_cover{$class}" src = "{$cover}"/>
Eof;
    }
}
 public function render($data)
 {
     $content = '<span class="bld">' . $data['field']['alias'] . '</span>:';
     //检测是否过期隐藏
     if ($data['overed'] && $data['field']['over_hidden']) {
         $content .= '<span class="cred" id="' . $data['data']['field']['name'] . '">过期隐藏</span>';
         return $content;
     }
     $content .= '<span  id="' . $data['data']['field']['name'] . '">';
     switch ($data['field']['input_type']) {
         case IT_SINGLE_TEXT:
             //单行文本
         //单行文本
         case IT_MULTI_TEXT:
             //多行文本
             $content .= op_h($data['data']['data'][0]);
             break;
         case IT_EDITOR:
             //编辑器
             $content .= "<br/>" . op_h($data['data']['data'][0]);
             break;
         case IT_DATE:
             //日期
             $content .= date('Y-m-d', $data['data']['data'][0]);
             //dump($data['data']['data'][0]);exit;
             break;
             //选择框
         //选择框
         case IT_SELECT:
             //下拉框
             $content .= op_t($data['data']['data'][0]);
             break;
         case IT_RADIO:
             //单选框
             $content .= op_t($data['data']['data'][0]);
             break;
         case IT_PIC:
             //单图片
             if (intval($data['data']['data'][0]) == 0) {
                 return '';
             }
             $content .= '<a class="pic_field" target="_blank" href="' . get_cover($data['data']['data'][0], 'path') . '"><img title="点击查看大图"  class="pic_size" src="' . getThumbImageById($data['data']['data'][0], 100, 100) . '"></a>';
             break;
         case IT_CHECKBOX:
             $content .= $data['data']['data'][0] . '&nbsp;&nbsp;';
             break;
     }
     $content .= '</span>';
     echo $content;
 }
 /**
  * fetchImage  渲染图片微博
  * @param $weibo
  * @return string
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function fetchImage($weibo)
 {
     $weibo_data = unserialize($weibo['data']);
     $weibo_data['attach_ids'] = explode(',', $weibo_data['attach_ids']);
     foreach ($weibo_data['attach_ids'] as $k_i => $v_i) {
         $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 100, 100);
         $bi = M('Picture')->where(array('status' => 1))->getById($v_i);
         if (!is_bool(strpos($bi['path'], 'http://'))) {
             $weibo_data['image'][$k_i]['big'] = $bi['path'];
         } else {
             $weibo_data['image'][$k_i]['big'] = getRootUrl() . substr($bi['path'], 1);
         }
         $param['weibo'] = $weibo;
         $param['weibo']['weibo_data'] = $weibo_data;
     }
     $this->assign($param);
     return $this->fetch(T('Application://Weibo@Type/fetchimage'));
 }
Example #13
0
 public function getInfo($id)
 {
     $info = $this->find($id);
     $field_list = D('CatField')->where(array('entity_id' => $info['entity_id']))->select();
     $field_list_l = array_column($field_list, 'name');
     $field_list = array_combine($field_list_l, $field_list);
     foreach ($field_list as &$v) {
         $v['data'] = D('CatData')->where(array('field_id' => $v['id'], 'info_id' => $info['id']))->find();
         $v['data'] = $v['data']['value'];
         if (strpos($v['name'], 'zhaopian') === 0) {
             if (empty($v['data'])) {
                 $v['data'] = NUll;
             } else {
                 $v['data'] = getThumbImageById($v['data']);
             }
         }
     }
     return $field_list;
 }
Example #14
0
 public function getTags($order, $field, $row, $limit, $type)
 {
     $map['type'] = array('in', $type);
     $p = I(C('VAR_PAGE'));
     if ($limit) {
         $data = $this->model->where($map)->order($order)->limit($row)->select();
     } else {
         $data = $this->model->where($map)->order($order)->page(!empty($p) ? $p : 1, $row)->select();
     }
     foreach ($data as $key => $vo) {
         $data[$key]['path'] = getThumbImageById($vo['img']);
         $data[$key]['tagcolor'] = colorCallback();
         $data[$key]['tagback'] = colorbackCallback();
     }
     if ($data == null) {
         $this->apiError("获取标签列表失败", null);
     } else {
         $this->apiSuccess("获取标签列表成功", null, array('data' => $data));
     }
 }
Example #15
0
 public function fetchImage($weibo)
 {
     $weibo_data = unserialize($weibo['data']);
     $weibo_data['attach_ids'] = explode(',', $weibo_data['attach_ids']);
     foreach ($weibo_data['attach_ids'] as $k_i => $v_i) {
         if (strtolower(C('PICTURE_UPLOAD_DRIVER')) == 'sae') {
             $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 100, 100);
             // dump( $weibo_data['image'][$k_i]['small']);exit;
             $bi = M('Picture')->where(array('status' => 1))->getById($v_i);
             $weibo_data['image'][$k_i]['big'] = $bi['path'];
         } else {
             $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 100, 100);
             $bi = M('Picture')->where(array('status' => 1))->getById($v_i);
             $weibo_data['image'][$k_i]['big'] = getRootUrl() . substr($bi['path'], 1);
         }
         $param['weibo'] = $weibo;
         $param['weibo']['weibo_data'] = $weibo_data;
     }
     $this->assign($param);
     return $this->fetch('display');
 }
 public function getForumList($map_type = array('status' => 1))
 {
     $tag = 'forum_list_' . serialize($map_type);
     $forum_list = S($tag);
     $cache_time = modC('CACHE_TIME', 300, 'Forum');
     if (empty($forum_list)) {
         //读取板块列表
         $forum_list = D('Forum/Forum')->where($map_type)->order('sort asc')->select();
         $forumPostModel = D('ForumPost');
         $forumPostReplyModel = D('ForumPostReply');
         $forumLzlReplyModel = D('ForumLzlReply');
         foreach ($forum_list as &$f) {
             $map['status'] = 1;
             $map['forum_id'] = $f['id'];
             $f['background'] = intval($f['background']) != 0 ? getThumbImageById($f['background'], 1160, 180) : C('TMPL_PARSE_STRING.__IMG__') . '/default_head.jpg';
             $f['logo'] = intval($f['logo']) != 0 ? getThumbImageById($f['logo'], 128, 128) : C('TMPL_PARSE_STRING.__IMG__') . '/default_logo.jpg';
             $f['topic_count'] = $forumPostModel->where($map)->count();
             $f['admin'] = explode(',', str_replace('[', '', str_replace(']', '', $f['admin'])));
             $post_id = $forumPostModel->where(array('forum_id' => $f['id']))->field('id')->select();
             $p_id = getSubByKey($post_id, 'id');
             $map['post_id'] = array('in', implode(',', $p_id));
             $f['total_count'] = $f['topic_count'] + $forumPostReplyModel->where($map)->count();
         }
         unset($f);
         S($tag, $forum_list, $cache_time);
     }
     foreach ($forum_list as &$f) {
         if (count($f['admin']) > 0) {
             foreach ($f['admin'] as $a) {
                 if ($a != '') {
                     $f['admins'][] = query_user(array('nickname', 'space_link'), $a);
                 }
             }
         }
     }
     unset($f);
     return $forum_list;
 }
Example #17
0
 public function render($attributes = array())
 {
     $attributes_id = $attributes['id'];
     $config = $attributes['config'];
     $class = $attributes['class'];
     $value = $attributes['value'];
     $name = $attributes['name'];
     $width = $attributes['width'] ? $attributes['width'] : 100;
     $height = $attributes['height'] ? $attributes['height'] : 100;
     //$filetype = $this->rules['filetype'];
     $config = $config['config'];
     $id = $attributes_id;
     $attributes['config'] = array('text' => '选择文件');
     if (intval($value) != 0) {
         $url = getThumbImageById($value, $width, $height);
         $img = '<img src="' . $url . '"/>';
     } else {
         $img = '';
     }
     $this->assign('img', $img);
     $this->assign($attributes);
     $this->display(T('Application://Common@Widget/uploadimage'));
 }
 public function render($data)
 {
     $rs = $data['str'];
     $field = $data['field'];
     $value = '';
     switch ($field['field']['input_type']) {
         case IT_SINGLE_TEXT:
             //单行文本
         //单行文本
         case IT_MULTI_TEXT:
             $value = op_t($field['data'][0]);
             break;
         case IT_EDITOR:
             $value = op_h($field['data'][0]);
             break;
             //选择框
         //选择框
         case IT_SELECT:
             $value = op_t($field['data'][0]);
             break;
         case IT_PIC:
             $value = getThumbImageById($field['data'][0]);
             break;
         case IT_RADIO:
             $value = op_t($field['data'][0]);
             break;
         case IT_CHECKBOX:
             $value = $field['data'][0];
             //$value =  t($field['values']['data'][$field['data'][0]]);
             break;
     }
     if ($data['only_value']) {
         return $value;
     }
     $rs = str_replace('{$' . $field['field']['name'] . '}', $value, $rs);
     return $rs;
 }
Example #19
0
 public function getTag($uid, $row, $limit)
 {
     $mapfocus['id'] = $uid;
     $mapfocus['type'] = 2;
     $count = $this->model->where($mapfocus)->count();
     if ($count > 0) {
         $p = I(C('VAR_PAGE'));
         if ($limit) {
             $data = $this->model->where($mapfocus)->order('rowid desc')->limit($row)->select();
         } else {
             $data = $this->model->where($mapfocus)->order('rowid desc')->page(!empty($p) ? $p : 1, $row)->select();
         }
     }
     if ($data == null) {
         $this->apiError("获取标签关注列表失败", null);
     } else {
         foreach ($data as $key => $vo) {
             $data[$key]['tag'] = gettaginfo($vo['rowid']);
             $data[$key]['tag']['path'] = getThumbImageById($data[$key]['tag']['img']);
             $data[$key]['hasfocustag'] = hasguanzhu($vo['rowid'], $uid, 2);
         }
         $this->apiSuccess("获取标签关注列表成功", null, array('data' => $data));
     }
 }
Example #20
0
function thumb($cover_id, $width = 100, $height = 'auto', $type = 0, $replace = false)
{
    return getThumbImageById($cover_id, $width, $height, $type, $replace);
}
 /**
  * 上传图片(上传默认头像)
  * @author huajie <*****@*****.**>
  */
 public function uploadPicture()
 {
     //TODO: 用户登录检测
     /* 返回标准数据 */
     $return = array('status' => 1, 'info' => L('_UPLOAD_SUCCESS_'), 'data' => '');
     /* 调用文件上传组件上传文件 */
     $Picture = D('Picture');
     $pic_driver = C('PICTURE_UPLOAD_DRIVER');
     $info = $Picture->upload($_FILES, C('PICTURE_UPLOAD'), C('PICTURE_UPLOAD_DRIVER'), C("UPLOAD_{$pic_driver}_CONFIG"));
     //TODO:上传到远程服务器
     /* 记录图片信息 */
     if ($info) {
         $return['status'] = 1;
         empty($info['download']) && ($info['download'] = $info['file']);
         $return = array_merge($info['download'], $return);
         $return['path256'] = getThumbImageById($return['id'], 256, 256);
         $return['path128'] = getThumbImageById($return['id'], 128, 128);
         $return['path64'] = getThumbImageById($return['id'], 64, 64);
         $return['path32'] = getThumbImageById($return['id'], 32, 32);
     } else {
         $return['status'] = 0;
         $return['info'] = $Picture->getError();
     }
     /* 返回JSON数据 */
     $this->ajaxReturn($return);
 }
 /**
  * $solist 判断是否属于选择返回数据的列表页,如果是在列表页->display('admin_solist');@mingyangliu
  * */
 public function display($solist = '')
 {
     //key类型的等价转换
     //map转换成text
     $this->convertKey('map', 'text', function ($value, $key) {
         return $key['opt'][$value];
     });
     //uid转换成text
     $this->convertKey('uid', 'text', function ($value) {
         $value = query_user(array('nickname', 'uid', 'space_url'), $value);
         return "<a href='" . $value['space_url'] . "' target='_blank'>[{$value[uid]}]" . $value['nickname'] . '</a>';
     });
     //nickname转换成text
     $this->convertKey('nickname', 'text', function ($value) {
         $value = query_user(array('nickname', 'uid', 'space_url'), $value);
         exit;
         return "<a href='" . $value['space_url'] . "' target='_blank'>[{$value[uid]}]" . $value['nickname'] . '</a>';
     });
     //time转换成text
     $this->convertKey('time', 'text', function ($value) {
         if ($value != 0) {
             return time_format($value);
         } else {
             return '-';
         }
     });
     //trunctext转换成text
     $this->convertKey('trunktext', 'text', function ($value, $key) {
         $length = $key['opt'];
         return msubstr($value, 0, $length);
     });
     //text转换成html
     $this->convertKey('text', 'html', function ($value) {
         return $value;
     });
     //link转换为html
     $this->convertKey('link', 'html', function ($value, $key, $item) {
         $value = htmlspecialchars($value);
         $getUrl = $key['opt'];
         $url = $getUrl($item);
         //允许字段为空,如果字段名为空将标题名填充到A变现里
         if (!$value) {
             return "<a href=\"{$url}\" target=\"_blank\">" . $key['title'] . "</a>";
         } else {
             return "<a href=\"{$url}\" target=\"_blank\">{$value}</a>";
         }
     });
     //如果icon为空
     $this->convertKey('icon', 'html', function ($value, $key, $item) {
         $value = htmlspecialchars($value);
         if ($value == '') {
             $html = "无";
         } else {
             $html = "<i class=\"{$value}\"></i> {$value}";
         }
         return $html;
     });
     //image转换为图片
     $this->convertKey('image', 'html', function ($value, $key, $item) {
         if (intval($value)) {
             //value是图片id
             $value = htmlspecialchars($value);
             $sc_src = get_cover($value, 'path');
             $src = getThumbImageById($value, 80, 80);
             $sc_src = $sc_src == '' ? $src : $sc_src;
             $html = "<div class='popup-gallery'><a title=\"查看大图\" href=\"{$sc_src}\"><img src=\"{$sc_src}\"/ style=\"width:80px;height:80px\"></a></div>";
         } else {
             //value是图片路径
             $sc_src = $value;
             $html = "<div class='popup-gallery'><a title=\"查看大图\" href=\"{$sc_src}\"><img src=\"{$sc_src}\"/ style=\"border-radius:100%;\"></a></div>";
         }
         return $html;
     });
     //doaction转换为html
     $this->convertKey('doaction', 'html', function ($value, $key, $item) {
         $actions = $key['opt']['actions'];
         $result = array();
         foreach ($actions as $action) {
             $getUrl = $action['get_url'];
             $linkText = $action['text'];
             $url = $getUrl($item);
             if (isset($action['opt'])) {
                 $content = array();
                 foreach ($action['opt'] as $key => $value) {
                     $value = htmlspecialchars($value);
                     $content[] = "{$key}=\"{$value}\"";
                 }
                 $content = implode(' ', $content);
                 if (isset($action['opt']['data-role']) && $action['opt']['data-role'] == "modal_popup") {
                     //模态弹窗
                     $result[] = "<a href=\" javascrapt:void(0);\" modal-url=\"{$url}\" " . $content . ">{$linkText}</a>";
                 } else {
                     $result[] = "<a href=\"{$url}\" " . $content . ">{$linkText}</a>";
                 }
             } else {
                 $result[] = "<a href=\"{$url}\">{$linkText}</a>";
             }
         }
         return implode(' ', $result);
     });
     //Join转换为html
     $this->convertKey('Join', 'html', function ($value, $key) {
         if ($value != 0) {
             $val = get_table_field($value, $key['opt']['mate'], $key['opt']['return'], $key['opt']['model']);
             if (!$key['opt']['url']) {
                 return $val;
             } else {
                 $urld = U($key['opt']['url'], array($key['opt']['return'] => $value));
                 return "<a href=\"{$urld}\">{$val}</a>";
             }
         } else {
             return '-';
         }
     });
     //status转换为html
     $setStatusUrl = $this->_setStatusUrl;
     $that =& $this;
     $this->convertKey('status', 'html', function ($value, $key, $item) use($setStatusUrl, $that) {
         //如果没有设置修改状态的URL,则直接返回文字
         $map = $key['opt'];
         $text = $map[$value];
         if (!$setStatusUrl) {
             return $text;
         }
         //返回带链接的文字
         $switchStatus = $value == 1 ? 0 : 1;
         $url = $that->addUrlParam($setStatusUrl, array('status' => $switchStatus, 'ids' => $item['id']));
         return "<a href=\"{$url}\" class=\"ajax-get\">{$text}</a>";
     });
     //如果html为空
     $this->convertKey('html', 'html', function ($value) {
         if ($value === '') {
             return '<span style="color:#bbb;">(空)</span>';
         }
         return $value;
     });
     //编译buttonList中的属性
     foreach ($this->_buttonList as &$button) {
         $button['tag'] = isset($button['attr']['href']) ? 'a' : 'button';
         $this->addDefaultCssClass($button);
         $button['attr'] = $this->compileHtmlAttr($button['attr']);
     }
     //生成翻页HTML代码
     C('VAR_PAGE', 'page');
     $pager = new \Think\Page($this->_pagination['totalCount'], $this->_pagination['listRows'], $_REQUEST);
     $pager->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     $paginationHtml = $pager->show();
     //显示页面
     $this->assign('title', $this->_title);
     $this->assign('suggest', $this->_suggest);
     $this->assign('keyList', $this->_keyList);
     $this->assign('buttonList', $this->_buttonList);
     $this->assign('pagination', $paginationHtml);
     $this->assign('list', $this->_data);
     /*加入搜索 陈一枭*/
     $this->assign('searches', $this->_search);
     $this->assign('searchPostUrl', $this->_searchPostUrl);
     /*加入筛选select 郑钟良*/
     $this->assign('selects', $this->_select);
     $this->assign('selectPostUrl', $this->_selectPostUrl);
     //如果是选择返回数据的列表页就调用admin_solist模板文件,否则编译原有模板
     if ($solist) {
         parent::display('admin_solist');
     } else {
         parent::display('admin_list');
     }
 }
 /**
  * @param string $tab
  * @param int $id
  * 编辑群组内容渲染
  */
 public function admin($tab = 'edit', $id = 0)
 {
     switch ($tab) {
         case 'edit':
             $editGroup = M('Group')->where(array('status' => 1, 'id' => $id))->find();
             $editGroup['logo_id'] = getThumbImageById($editGroup['logo']);
             $editGroup['background_id'] = getThumbImageById($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->setMobTitle('编辑群组');
             $this->settopTitle('基本信息');
             $this->assign('groupTypeAll', $groupType['parent']);
             $this->assign('editGroup', $editGroup);
             break;
         case 'posttype':
             $postType = M('GroupPostCategory')->where(array('group_id' => $id, 'status' => 1))->select();
             $this->setMobTitle('帖子分类');
             $this->settopTitle('帖子分类管理');
             $this->assign('postType', $postType);
             $this->assign('group_id', $id);
             break;
         case 'member':
             $member = M('GroupMember')->where(array('group_id' => $id, 'status' => 1))->select();
             foreach ($member as &$v) {
                 $v['user'] = query_user(array('nickname', 'avatar64', 'space_mob_url'), $v['uid']);
             }
             $notAuditMember = M('GroupMember')->where(array('group_id' => $id, 'status' => 0))->select();
             foreach ($notAuditMember as &$a) {
                 $a['user'] = query_user(array('nickname', 'avatar64', 'space_mob_url'), $a['uid']);
             }
             $this->setMobTitle('成员');
             $this->settopTitle('成员管理');
             $this->assign('group_id', $id);
             $this->assign('member', $member);
             $this->assign('memberCount', count($member));
             $this->assign('notAuditMember', $notAuditMember);
             $this->assign('notAuditMemberCount', count($notAuditMember));
             break;
         case 'notic':
             $this->setMobTitle('公告');
             $this->settopTitle('公告管理');
             $notic = $this->assignNotice($id);
             $this->assign('group_id', $id);
             $this->assign('notic', $notic);
             break;
     }
     $this->assign('id', $id);
     $this->display();
 }
Example #24
0
    /**
     *  Generates the control's HTML code.
     *
     *  <i>This method is automatically called by the {@link Zebra_Form::render() render()} method!</i>
     *
     * @return string  The control's HTML code
     */
    function toHTML()
    {
        $attributes = $this->get_attributes(array('name', 'value', 'id', 'config', 'class', 'text', 'width', 'height'));
        $attributes_id = $attributes['id'];
        $config = $attributes['config'];
        $class = $attributes['class'];
        $value = $attributes['value'];
        $name = $attributes['name'];
        $width = $attributes['width'] ? $attributes['width'] : 100;
        $height = $attributes['height'] ? $attributes['height'] : 100;
        $filetype = $this->rules['filetype'];
        $config = $config['config'];
        $id = $attributes_id;
        $config = array('text' => '选择文件');
        if (intval($value) != 0) {
            $url = getThumbImageById($value, $width, $height);
            $img = '<img src="' . $url . '"/>';
        } else {
            $img = '请选择图片';
        }
        $control = <<<Eof
       <span  id="web_uploader_wrapper_{$id}">{$config['text']}</span>

        <input id="web_uploader_input_{$id}" name="{$name}"  type="hidden"  value="{$value}">
        <div id="web_uploader_picture_list_{$id}"  class="web_uploader_picture_list">
    {$img}
        </div>
Eof;
        $script = <<<Eof
 <script>
           var id="#web_uploader_wrapper_{$id}";
        var uploader_{$id} = WebUploader.create({
            // swf文件路径
            swf: 'Uploader.swf',
            // 文件接收服务端。
            server: U('Core/File/uploadPicture'),
            fileNumLimit: 5,
            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建,可能是input元素,也可能是flash.
            pick: {'id':id , 'multi': false}
        });
        uploader_{$id}.on('fileQueued', function (file) {
        uploader_{$id}.upload();
            \$("#web_uploader_file_name_{$id}").text('正在上传...');
        });

        /*上传成功*/
        uploader_{$id}.on('uploadSuccess', function (file, ret) {
        if (ret.status == 0) {
            \$("#web_uploader_file_name_{$id}").text(ret.info);
        } else {
            \$('#web_uploader_input_{$id}').val(ret.data.file.id);

            \$("#web_uploader_picture_list_{$id}").html('<img src="'+ret.data.file.path+'"/>');
        }
    });
    </script>
Eof;
        return $control . $script;
        // return '<input ' . $this->_render_attributes() . ($this->form_properties['doctype'] == 'xhtml' ? '/' : '') . '>';
    }
Example #25
0
 public function getByInfoId($info_id)
 {
     $map['info_id'] = $info_id;
     $data = array();
     $dataRows = $this->where($map)->order('data_id asc')->select();
     foreach ($dataRows as $v) {
         $profile = D('cat_field')->where('id=' . $v['field_id'])->find();
         if (strpos($profile['name'], 'zhaopian') === 0) {
             if (empty($v['value'])) {
                 $data[$profile['name']]['data'] = NULL;
             } else {
                 $data[$profile['name']]['data'] = getThumbImageById($v['value']);
             }
         } else {
             $data[$profile['name']]['data'] = $v['value'];
         }
         $data[$profile['name']]['field'] = $profile;
         $data[$profile['name']]['values'] = $values = json_decode($profile['option'], true);
     }
     return $data;
 }
Example #26
0
 /**
  * 编辑专辑时里面选项的内容
  */
 public function addIssue($id = 0)
 {
     $tree = D('Issue')->getTree();
     $issue = D('IssueContent')->where(array('status' => 1, 'id' => $id))->find();
     $issue['cover_url'] = getThumbImageById($issue['cover_id'], 72, 72);
     if ($id != 0) {
         $issue['is_edit'] = 1;
         $this->_top_menu_list = array('left' => array(array('type' => 'back', 'need_confirm' => 1, 'confirm_info' => '确定要返回?', 'a_class' => '', 'span_class' => '')));
         // dump($this->_top_menu_list);exit;
         $this->assign('top_menu_list', $this->_top_menu_list);
         $this->setTopTitle('编辑专辑');
     } else {
         $issue['is_edit'] = 0;
         $this->_top_menu_list = array('left' => array(array('type' => 'back', 'need_confirm' => 1, 'confirm_info' => '确定要返回?', 'a_class' => '', 'span_class' => '')));
         // dump($this->_top_menu_list);exit;
         $this->assign('top_menu_list', $this->_top_menu_list);
         $this->setTopTitle('发布专辑');
     }
     //  dump($tree);exit;
     //  dump($issue);exit;
     $this->assign('issue', $issue);
     $this->assign('tree', $tree);
     $this->display();
 }
Example #27
0
 /**
  * 活动成员
  * @param int $id
  * @param string $tip
  * autor:xjw129xjt
  */
 public function member($id = 0, $tip = 'all')
 {
     if ($tip == 'sign') {
         $map['status'] = 0;
     }
     if ($tip == 'attend') {
         $map['status'] = 1;
     }
     $event_content = $this->eventModel->where(array('status' => 1, 'id' => $id))->find();
     if (!$event_content) {
         $this->error('活动不存在!');
     }
     $map['event_id'] = $id;
     $member = $this->eventAttendModel->where($map)->select();
     foreach ($member as &$v) {
         $v['user_info'] = query_user(array('uid', 'nickname', 'space_url', 'avatar32', 'avatar64'), $v['uid']);
         if ($v['image']) {
             $v['image_info'] = '<div class="popup-gallery"><a class="popup" href="' . get_cover($v['image'], 'path') . '"><img src="' . getThumbImageById($v['image'], 50, 50) . '"/></a></div>';
         }
         $v['attach_info'] = D('File')->find($v['attach']);
         $v['attach_info']['link'] = get_pic_src($v['attach_info']['savepath'] . $v['attach_info']['savename']);
         if ($v['status'] == 0) {
             $v['status_info'] = '待审核';
         }
         if ($v['status'] == 1) {
             $v['status_info'] = '已审核';
         }
     }
     unset($v);
     $this->assign('all_count', $this->eventAttendModel->where(array('event_id' => $id))->count());
     $this->assign('sign_count', $this->eventAttendModel->where(array('event_id' => $id, 'status' => 0))->count());
     $this->assign('attend_count', $this->eventAttendModel->where(array('event_id' => $id, 'status' => 1))->count());
     $this->assign('event_member', $member);
     $this->assign('event_content', $event_content);
     $this->assign('tip', $tip);
     $this->setTitle($event_content['title'] . '——活动');
     $this->setKeywords($event_content['title'] . ',活动');
     $tmp = 'attend';
     $this->display($tmp);
 }
 public function detail($id, $page = 1, $sr = null, $sp = 1)
 {
     $id = intval($id);
     $page = intval($page);
     $sr = intval($sr);
     $sp = intval($sp);
     $limit = 10;
     //读取帖子内容
     $post = D('ForumPost')->where(array('id' => $id, 'status' => 1))->find();
     if (!$post) {
         $this->error('找不到该帖子');
     }
     $post['forum'] = D('Forum')->find($post['forum_id']);
     $post['content'] = op_h($post['content'], 'html');
     //增加浏览次数
     D('ForumPost')->where(array('id' => $id))->setInc('view_count');
     //读取回复列表
     $map = array('post_id' => $id, 'status' => 1);
     $replyList = D('ForumPostReply')->getReplyList($map, 'create_time', $page, $limit);
     $replyTotalCount = D('ForumPostReply')->where($map)->count();
     //判断是否需要显示1楼
     if ($page == 1) {
         $showMainPost = true;
     } else {
         $showMainPost = false;
     }
     foreach ($replyList as &$reply) {
         $reply['content'] = op_h($reply['content'], 'html');
     }
     unset($reply);
     //判断是否已经收藏
     $isBookmark = D('ForumBookmark')->exists(is_login(), $id);
     //显示页面
     $post['forum']['background'] = $post['forum']['background'] ? getThumbImageById($post['forum']['background'], 800, 'auto') : C('TMPL_PARSE_STRING.__IMG__') . '/default_bg.jpg';
     $this->assign('forum', $post['forum']);
     $this->assign('forum_id', $post['forum_id']);
     $this->assignAllowPublish();
     $this->assign('isBookmark', $isBookmark);
     $this->assign('post', $post);
     $this->setTitle('{$post.title|op_t} —— 论坛');
     $this->assign('limit', $limit);
     $this->assign('sr', $sr);
     $this->assign('sp', $sp);
     $this->assign('page', $page);
     $this->assign('replyList', $replyList);
     $this->assign('replyTotalCount', $replyTotalCount);
     $this->assign('showMainPost', $showMainPost);
     $this->display();
 }
 private function math_images($weibo)
 {
     if ($weibo['type'] == 'image') {
         //如果是图片微博则解析图片
         $attach_ids = explode(',', $weibo['data']['attach_ids']);
         foreach ($attach_ids as $data_id) {
             $weibo['images'][] = getThumbImageById($data_id, 100, 100);
         }
     } else {
         if ($weibo['type'] == 'repost') {
             //处理转发中的图片微博
             if ($weibo['data']['sourse']['type'] == 'image') {
                 $source = $weibo['data']['sourse'];
                 $attach_ids = explode(',', $source['data']['attach_ids']);
                 foreach ($attach_ids as $data_id) {
                     $source['images'][] = getThumbImageById($data_id, 100, 100);
                 }
                 $weibo['data']['sourse'] = $source;
             }
         }
     }
     return $weibo;
 }
 /**
  * fetchImage  渲染图片轻博客
  * @param $weibo
  * @return string
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function fetchImage($weibo)
 {
     $weibo_data = unserialize($weibo['data']);
     $weibo_data['attach_ids'] = explode(',', $weibo_data['attach_ids']);
     $tag = 'ttp:';
     switch (count($weibo_data['attach_ids'])) {
         case 1:
             foreach ($weibo_data['attach_ids'] as $k_i => $v_i) {
                 $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 1000, 1000);
                 $bi = D('Picture')->where(array('status' => 1))->getById($v_i);
                 $weibo_data['image'][$k_i]['big'] = get_pic_src($bi['path']);
                 $pi = $weibo_data['image'][$k_i]['big'];
                 $param['weibo'] = $weibo;
                 if (!strpos($pi, $tag)) {
                     $pi = '.' . $pi;
                 }
                 $hv = getimagesize($pi);
                 $weibo_data['image'][$k_i]['size'] = $hv[0] . 'x' . $hv[1];
                 $param['weibo']['weibo_data'] = $weibo_data;
             }
             break;
         case 2:
             foreach ($weibo_data['attach_ids'] as $k_i => $v_i) {
                 $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 350, 350);
                 $bi = D('Picture')->where(array('status' => 1))->getById($v_i);
                 $weibo_data['image'][$k_i]['big'] = get_pic_src($bi['path']);
                 $pi = $weibo_data['image'][$k_i]['big'];
                 $param['weibo'] = $weibo;
                 if (!strpos($pi, $tag)) {
                     $pi = '.' . $pi;
                 }
                 $hv = getimagesize($pi);
                 $weibo_data['image'][$k_i]['size'] = $hv[0] . 'x' . $hv[1];
                 $param['weibo']['weibo_data'] = $weibo_data;
             }
             break;
         case 3:
             foreach ($weibo_data['attach_ids'] as $k_i => $v_i) {
                 $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 300, 300);
                 $bi = D('Picture')->where(array('status' => 1))->getById($v_i);
                 $weibo_data['image'][$k_i]['big'] = get_pic_src($bi['path']);
                 $pi = $weibo_data['image'][$k_i]['big'];
                 $param['weibo'] = $weibo;
                 if (!strpos($pi, $tag)) {
                     $pi = '.' . $pi;
                 }
                 $hv = getimagesize($pi);
                 $weibo_data['image'][$k_i]['size'] = $hv[0] . 'x' . $hv[1];
                 $param['weibo']['weibo_data'] = $weibo_data;
             }
             break;
         case 4:
             foreach ($weibo_data['attach_ids'] as $k_i => $v_i) {
                 $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 300, 300);
                 $bi = D('Picture')->where(array('status' => 1))->getById($v_i);
                 $weibo_data['image'][$k_i]['big'] = get_pic_src($bi['path']);
                 $pi = $weibo_data['image'][$k_i]['big'];
                 $param['weibo'] = $weibo;
                 if (!strpos($pi, $tag)) {
                     $pi = '.' . $pi;
                 }
                 $hv = getimagesize($pi);
                 $weibo_data['image'][$k_i]['size'] = $hv[0] . 'x' . $hv[1];
                 $param['weibo']['weibo_data'] = $weibo_data;
             }
             break;
         default:
             foreach ($weibo_data['attach_ids'] as $k_i => $v_i) {
                 $weibo_data['image'][$k_i]['small'] = getThumbImageById($v_i, 200, 200);
                 $bi = D('Picture')->where(array('status' => 1))->getById($v_i);
                 $weibo_data['image'][$k_i]['big'] = get_pic_src($bi['path']);
                 $pi = $weibo_data['image'][$k_i]['big'];
                 $param['weibo'] = $weibo;
                 if (!strpos($pi, $tag)) {
                     $pi = '.' . $pi;
                 }
                 $hv = getimagesize($pi);
                 $weibo_data['image'][$k_i]['size'] = $hv[0] . 'x' . $hv[1];
                 $param['weibo']['weibo_data'] = $weibo_data;
             }
     }
     $this->assign('img_num', count($weibo_data['attach_ids']));
     $this->assign($param);
     return $this->fetch(T('Application://Weibo@Type/fetchimage'));
 }