コード例 #1
0
 function _thumb_media_id($cover_id)
 {
     $cover = get_cover($cover_id);
     $driver = C('PICTURE_UPLOAD_DRIVER');
     if ($driver != 'Local' && !file_exists(SITE_PATH . $cover['path'])) {
         // 先把图片下载到本地
         $pathinfo = pathinfo(SITE_PATH . $cover['path']);
         mkdirs($pathinfo['dirname']);
         $content = wp_file_get_contents($cover['url']);
         $res = file_put_contents(SITE_PATH . $cover['path'], $content);
         if ($res) {
             return '';
         }
     }
     $path = $cover['path'];
     if (!$path) {
         return '';
     }
     $param['type'] = 'thumb';
     $param['media'] = '@' . realpath(SITE_PATH . $path);
     $url = 'https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=' . get_access_token();
     $res = post_data($url, $param, true);
     if (isset($res['errcode']) && $res['errcode'] != 0) {
         return '';
     }
     $map['cover_id'] = $cover_id;
     $map['manager_id'] = $this->mid;
     $this->where($map)->setField('thumb_media_id', $res['media_id']);
     return $res['media_id'];
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 function reformatData($project)
 {
     $data['project_index'] = $project['id'];
     //项目编号
     $data['project_name'] = $project['project_name'];
     //项目名称
     $data['project_stage'] = $this->stageConvertor($project['stage']);
     //项目阶段
     $data['project_type'] = get_code_name($project['industry']);
     //项目类型
     $data['project_abstract'] = $project['abstract'];
     //项目简介
     $data['project_cover'] = 'http://' . $_SERVER['HTTP_HOST'] . get_cover($project['cover'], 'path');
     //封面url
     $data['project_province'] = getDistrict($project['province']);
     //省
     $data['project_city'] = getDistrict($project['city']);
     //市
     $data['project_companyname'] = $project['company_name'];
     //公司名称
     $data['project_leader'] = get_membername($project['leader_id']);
     //项目发起人
     $data['project_financinglimit'] = $project['need_fund'];
     //目标融资额
     if ($data['project_stage'] == 1) {
         $data['project_valuation'] = 0;
         //项目最终估值
     } else {
         $data['project_valuation'] = M('ProjectFund')->where(array('project_id' => $project['id']))->getField('final_valuation');
         //项目最终估值
     }
     $data['project_mininvestment'] = $project['follow_fund'];
     //起投额
     $data['project_raisedfund'] = $project['has_fund'];
     //完成金额
     $data['project_investornumber'] = $project['investor_count'];
     //投资人数
     $data['project_detailurl'] = 'http://' . $_SERVER['HTTP_HOST'] . '/project/detail/id/' . $project['id'];
     //项目url
     $data['project_details'] = M('ProjectInfo')->where(array('project_id' => $project['id']))->getField('description');
     //项目详细详情
     $data['project_details'] = str_replace('"/Uploads', '"http://' . $_SERVER['HTTP_HOST'] . "/Uploads/", $data['project_details']);
     if ($project['team']) {
         $data['project_team'] = $project['team'];
     }
     return $data;
 }
コード例 #4
0
 public function update()
 {
     $id = $_GET['id'];
     if (!$id) {
         echo '非法操作';
         exit;
     }
     $v = D('ProjectInfoView')->where(array('p.stage' => array('egt', 1), 'p.status' => 9, 'p.id' => $id))->find();
     if (!$v) {
         echo '指定项目不存在。';
         exit;
     }
     include_once APP_PATH . 'Admin/zczj/zczj.api.php';
     //===============初始化==================//
     $options = array('debug' => true, 'UserName' => 'jumuzhongchou', 'PassWord' => 'jumuzhongchou123', 'PlatId' => 2);
     $zczj = new \zczj($options);
     $var = get_cover($v['cover']);
     $filename = basename(APP_PATH . substr($var['path'], 1));
     //echo $filename;
     //echo getimagesize(substr($var['path'], 1)); die();
     //echo @file_get_contents(substr($var['path'], 1)); die();
     if ($v['stage'] == 1) {
         $state = 1;
     } else {
         if ($v['stage'] == 4) {
             $state = 2;
         } else {
             if ($v['stage'] >= 8) {
                 $state = 3;
             }
         }
     }
     $desc = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $v['description']);
     $pics = M('ProjectTemp')->where(array('project_id' => $id, 'temp_type' => 1))->order('sort')->limit(6)->select();
     foreach ($pics as $k1 => $v1) {
         $path = get_cover($v1['info_key'], 'path');
         $desc = $desc . '<p><img src="http://www.dreammove.cn' . $path . '"/></p>';
     }
     $projects = array('PlatProjectID' => $v['id'], 'projectName' => $v['project_name'], 'description' => $desc, 'currentAmount' => $v['has_fund'], 'targetAmount' => $v['need_fund'], 'endTime' => NULL, 'targetDay' => 30, 'projectSponsor' => get_membername($v['uid']), 'support' => $v['follow'], 'state' => $state, 'projectCategoryId' => 23673, 'fileBytes' => @file_get_contents(substr($var['path'], 1)), 'fileName' => $filename, 'url' => "http://www.dreammove.cn/Project/detail/id/" . $v['id'] . '.html');
     $ret = $zczj->projectsAdd($projects);
     //dump($ret); die();
     if ($ret->Result) {
         echo "处理成功.";
     } else {
         echo $ret->Message;
     }
 }
コード例 #5
0
 public function show()
 {
     $visa_id = I('get.id');
     if (empty($visa_id)) {
         $this->error();
     }
     $Visa = M('Visa');
     $map = array();
     $map['visa_id'] = $visa_id;
     $map['status'] = 1;
     $detail = $Visa->where($map)->find();
     $detail['image'] = get_cover($detail['cover_id'], 'path');
     $detail['is_yaoqing'] = $detail['is_yaoqing'] ? '需要' : '不需要';
     $detail['is_mianshi'] = $detail['is_mianshi'] ? '需要' : '不需要';
     $this->assign('detail', $detail);
     $this->display();
 }
コード例 #6
0
ファイル: UserModel.class.php プロジェクト: applemin/tangguo
 /**
  * 查找后置操作
  * @author jry <*****@*****.**>
  */
 protected function _after_find(&$result, $options)
 {
     $result['avatar_url'] = get_cover($result['avatar'], 'avatar');
     // 用户识别label
     if (D('Admin/Module')->where('name="User" and status="1"')->count()) {
         $cert_info = D('User/Cert')->isCert($result['id']);
     }
     if ($cert_info) {
         $result['label'] = $cert_info['cert_title'] . '(' . $result['id'];
     } else {
         $result['label'] = $result['nickname'] . '(' . $result['id'];
     }
     if ($result['email']) {
         $result['label'] = $result['label'] . '-' . $result['email'];
     }
     $result['label'] = $result['label'] . ')';
 }
コード例 #7
0
 public function show($id = 0)
 {
     if (empty($id)) {
         $this->error('无效参数');
     }
     $Line = M('Line');
     $line_info = $Line->find($id);
     // 线路信息
     $line_info['images'] = explode(',', $line_info['images']);
     foreach ($line_info['images'] as $key => $val) {
         $line_info['images'][$key] = get_cover($val, 'path');
     }
     $line_info['xingcheng'] = unserialize($line_info['xingcheng']);
     $line_info['remark'] = unserialize($line_info['remark']);
     // 套餐信息
     $map = array('line_id' => $id, 'end_time' => array('egt', strtotime('+' . $line_info['earlier_date'] . 'day')));
     $line_tc = M('LineTc')->where($map)->select();
     if (empty($line_tc)) {
         $this->error('没有报价方案');
     }
     $default_tc = array();
     foreach ($line_tc as $key => $value) {
         if ($value['is_default']) {
             $default_tc = $value;
             break;
         }
     }
     if (empty($default_tc)) {
         $default_tc = $line_tc[0];
     }
     $map = array('product_id' => $id, 'status' => 1);
     $comment_lists = M('Comment')->where($map)->select();
     $this->assign('comment_lists', $comment_lists);
     $this->assign('line_info', $line_info);
     $this->assign('line_tc', $line_tc);
     $this->assign('default_tc', $default_tc);
     $this->display();
 }
コード例 #8
0
 public function detail($id = 0)
 {
     if (!($id && is_numeric($id))) {
         echo json_e('', 2);
         exit;
     }
     $Document = D('Document');
     $info = $Document->detail($id);
     //        多张图片预留处理
     /*        if(!empty($info['pics'])){
                 $pics= explode(',',$info['pics']);
             }else {
                 $pics = "";
             }*/
     $pic = get_cover($info['cover_id']);
     $info['path'] = $pic['path'];
     if (!$info) {
         echo json_e();
         exit;
     } else {
         echo json_e($info);
         exit;
     }
 }
コード例 #9
0
$(Pic).children("li").eq(CurrentIndex).show();
}
function PicNumClick() {
$("div.LunBo div.LunBoNum span").eq(ToDisplayPicNumber).trigger("click");
ToDisplayPicNumber = (ToDisplayPicNumber + 1) % PicTotal;
setTimeout("PicNumClick()",3000);
}
setTimeout("PicNumClick()",3000);
</script>

 <!--pic over-->


<div  class="rside">
<span><img data-img="2" src="http://img12.360buyimg.com/da/jfs/t307/47/730614248/16617/d99caa4b/542157edN66043046.jpg"  alt=""></span>
<div class="note"><ul><li class="selected">公告</li><li>活动</li></ul></div>
<div id="msg">
<div class="message"><ul><?php 
$__CATE__ = D('Category')->getChildrenId(56);
$__LIST__ = D('Document')->page(!empty($_GET["p"]) ? $_GET["p"] : 1, 10)->lists($__CATE__, '`level` DESC,`id` DESC', 1, true);
if (is_array($__LIST__)) {
    $i = 0;
    $__LIST__ = $__LIST__;
    if (count($__LIST__) == 0) {
        echo "";
    } else {
        foreach ($__LIST__ as $key => $article) {
            $mod = $i % 2;
            ++$i;
            ?>
<li><a href="<?php 
コード例 #10
0
 public function sendIssue()
 {
     $this->requireLogin();
     $aIssue_id = I('issue_id', '', 'intval');
     $aId = I('id', 0, 'intval');
     $aCover_id = I('cover_id', '', 'intval');
     $aTitle = I('title', '', 'op_t');
     $aUrl = I('url', '', 'op_h');
     $aContent = I('content', '', 'op_h');
     $attach_id = I('attach_id', '', 'op_t');
     $attach_ids = explode(',', $attach_id);
     if (!$aCover_id) {
         $this->apiError('请上传封面。');
     }
     if ($aTitle == '') {
         $this->apiError('请输入标题。');
     }
     if ($aIssue_id == 0) {
         $this->apiError('请选择分类。');
     }
     if ($aContent == '') {
         $this->apiError('请输入内容。');
     }
     if ($aUrl == '') {
         $this->apiError('请输入网址。');
     }
     foreach ($attach_ids as $k => $v) {
         $aContent .= "<p><img src='" . get_cover($v, 'path') . "'/></p>";
     }
     unset($v);
     $aContent = str_replace("\\", '', $aContent);
     $isEdit = $aId ? true : false;
     $this->requireIssueAllowPublish($aIssue_id);
     if ($isEdit) {
         $data = array('id' => intval($aId), 'title' => $aTitle, 'content' => $aContent, 'parse' => 0, 'cover_id' => intval($aCover_id), 'issue_id' => intval($aIssue_id), 'url' => $aUrl);
         $result = D('Issue/IssueContent')->where(array('id' => $aId))->save($data);
         if (!$result) {
             $this->apiError('编辑失败:' . $this->getError());
         }
     } else {
         $data = array('uid' => is_login(), 'title' => $aTitle, 'content' => $aContent, 'parse' => 0, 'cover_id' => intval($aCover_id), 'issue_id' => intval($aIssue_id), 'url' => $aUrl);
         /*  $before = getMyScore();
             $tox_money_before = getMyToxMoney();*/
         $data = D('Issue/IssueContent')->create($data);
         if (!$data) {
             return false;
         }
         $result = D('Issue/IssueContent')->add($data);
         /*
                     $after = getMyScore();
                     $tox_money_after = getMyToxMoney();*/
         if (!$result) {
             $this->apiError('发表失败:' . $this->getError());
         }
         $aId = $result;
     }
     //显示成功消息
     /*$message = $isEdit ? '编辑成功。' : '发表成功。' . getScoreTip($before, $after) . getToxMoneyTip($tox_money_before, $tox_money_after);*/
     //返回成功消息
     $row = D('Issue/IssueContent')->where('id=' . $aId)->find();
     $this->apiSuccess($row);
 }
コード例 #11
0
            </div>
        </div>
        
         <div class="form-item">
						<label class="item-label">战队图腾</label>
						<input type="file" id="upload_picture">
						<input type="hidden" name="cover" id="cover" value="<?php 
echo isset($team['cover']) && $team['cover'] !== "" ? $team['cover'] : '';
?>
"/>
						<div class="upload-img-box">
						<?php 
if (!empty($team['cover'])) {
    ?>
<div class="upload-pre-item"><img src="<?php 
    echo get_cover($team["cover"], 'url');
    ?>
"/></div><?php 
}
?>
						</div>
					</div>
					<script type="text/javascript">
					//上传图片
				    /* 初始化上传插件 */
					$("#upload_picture").uploadify({
				        "height"          : 30,
				        "swf"             : "/Public/static/uploadify/uploadify.swf",
				        "fileObjName"     : "download",
				        "buttonText"      : "上传图片",
				        "uploader"        : "<?php 
コード例 #12
0
">
	</div>
</div>

<div class="form-item"><label class="item-label">大赛封面</label> <input
	type="file" id="upload_picture"> <input type="hidden"
	name="cover" id="cover" value="<?php 
echo isset($match['cover']) && $match['cover'] !== "" ? $match['cover'] : '';
?>
" />
<div class="upload-img-box"><?php 
if (!empty($match['cover'])) {
    ?>
<div class="upload-pre-item"><img
	src="<?php 
    echo get_cover($match["cover"], 'url');
    ?>
" /></div><?php 
}
?>
</div>
</div>
<script type="text/javascript">
					//上传图片
				    /* 初始化上传插件 */
					$("#upload_picture").uploadify({
				        "height"          : 30,
				        "swf"             : "/Public/static/uploadify/uploadify.swf",
				        "fileObjName"     : "download",
				        "buttonText"      : "上传图片",
				        "uploader"        : "<?php 
コード例 #13
0
                                <input type="hidden" name="config[<?php 
                    echo $o_key;
                    ?>
]" id="cover_id_<?php 
                    echo $o_key;
                    ?>
" value="<?php 
                    echo $form['value'];
                    ?>
"/>
                                <div class="upload-img-box">
                                  <?php 
                    if (!empty($form['value'])) {
                        ?>
<div class="upload-pre-item"><img width="120" height="120" src="/weiphp2.0<?php 
                        echo get_cover($form['value'], 'path');
                        ?>
"/></div><?php 
                    }
                    ?>
                                </div>
                              </div>
                              <script type="text/javascript">
                                    //上传图片
                                    /* 初始化上传插件 */
                                    $("#upload_picture_<?php 
                    echo $o_key;
                    ?>
").uploadify({
                                        "height"          : 120,
                                        "swf"             : "/weiphp2.0/Public/static/uploadify/uploadify.swf",
コード例 #14
0
<td><?php 
                echo $order["place"];
                ?>
</td>
<td><?php 
                echo $order["url"];
                ?>
</td>

						

						 <td><img src="<?php 
                echo get_cover($order["icon"], 'path');
                ?>
"  width="100" height="50"/>(670*400) <a title="编辑" href="<?php 
                echo get_cover($order["icon"], 'path');
                ?>
" target='_blank'>查看大图</a></td>
                        <td><?php 
                echo $order["status"];
                ?>
</td>
                         <td><?php 
                echo date('Y-m-d H:i:s', $order["create_time"]);
                ?>
</td>
					<td>
                            <a title="编辑" href="<?php 
                echo U('edit?id=' . $order['id']);
                ?>
">编辑</a>
コード例 #15
0
            echo U('Article/detail?id=' . $vo['id']);
            ?>
"> <?php 
            echo get_good_name($vo["id"]);
            ?>
</a>
  <span>¥<?php 
            echo get_good_price($vo["id"]);
            ?>
 </span>
  </li><?php 
        }
    }
} else {
    echo "";
}
?>
</ul>
  
  </div>
  <div class="salesrank">
  <h5><span>最近浏览</span></h5>
 <ul><?php 
if (is_array($recent)) {
    $i = 0;
    $__LIST__ = $recent;
    if (count($__LIST__) == 0) {
        echo "";
    } else {
        foreach ($__LIST__ as $key => $vo) {
            $mod = $i % 2;
コード例 #16
0
 public function show($order_id = '')
 {
     if (empty($order_id)) {
         $this->error('非法参数...');
     }
     $order_info = M('Order')->where(array('order_id' => $order_id))->find();
     if (empty($order_info)) {
         $this->error('订单不存在...');
     }
     $order_info['reserve_info'] = unserialize($order_info['reserve_info']);
     $order_info['order_status_text'] = order_status_text($order_info['order_status']);
     $order_info['pay_status_text'] = pay_status_text($order_info['pay_status']);
     switch ($order_info['order_type']) {
         case 'line':
             $line = M('Line')->field('title,images,starting')->where(array('line_id' => $order_info['product_id']))->find();
             if ($line) {
                 $order_info['title'] = $line['title'];
                 $order_info['image'] = get_cover(array_shift(explode(',', $line['images'])), 'path');
                 $order_info['starting'] = $line['starting'];
             } else {
                 $order_info['title'] = '不存在';
                 $order_info['image'] = '';
                 $order_info['starting'] = '';
             }
             break;
         default:
             break;
     }
     // echo '<pre>'; print_r($order_info); echo '</pre>';
     $this->assign('order_info', $order_info);
     $this->meta_title = '线路列表';
     $this->display();
 }
コード例 #17
0
    $__LIST__ = $viewlist;
    if (count($__LIST__) == 0) {
        echo "";
    } else {
        foreach ($__LIST__ as $key => $vo) {
            $mod = $i % 2;
            ++$i;
            ?>
<dd><a class="details_right_img" href="<?php 
            echo U('Article/detail?id=' . $vo['id']);
            ?>
" title="<?php 
            echo $vo["title"];
            ?>
"><img src="<?php 
            echo get_cover($vo["cover_id"], 'path');
            ?>
"  alt="<?php 
            echo $vo["title"];
            ?>
" style="display: inline-block;"></a><a href="<?php 
            echo U('Article/detail?id=' . $vo['id']);
            ?>
" class="details_right_title" title="<?php 
            echo $vo["title"];
            ?>
"><?php 
            echo $vo["title"];
            ?>
</a><span class="fwb mcm_title_price">¥<span class="red"><?php 
            echo get_good_price($vo["id"]);
コード例 #18
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);
 }
コード例 #19
0
">礼品活动</a></li>
            </ul>
        </div><!--nav end-->
        <div class="clear"></div>
    </div><!--top2 end-->

       
    </div>
    <div class="main">
        <div class="position">
            您现在的位置是:&nbsp;<a href="index.html">积分商城首页</a>&nbsp;&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;&nbsp;<a href="gift.html">积分礼品</a>&nbsp;&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;&nbsp;<a href="product.html">INBIKE骑行头盔</a>
        </div><!--position end-->
        <div class="product">
            <form id="good_form">
            <div class="pic"><img src="<?php 
echo get_cover($info["cover_id"], 'path');
?>
" width="280" height="313"></div>
            <div class="right">
                <div class="price">
                    <p class="tit"><?php 
echo $info["title"];
?>
</p>
                    <p class="old">市场价:
                        <?php 
echo $info["marketprice"];
?>
                    </p>
                    <p class="new">兑换积分:<span><span><?php 
echo $info["jifen"];
コード例 #20
0
 /**
  * 查找后置操作
  * @author jry <*****@*****.**>
  */
 protected function _after_find(&$result, $options)
 {
     if ($result['cover']) {
         $result['cover_url'] = get_cover($result['cover'], 'default');
     }
 }
コード例 #21
0
ファイル: function.php プロジェクト: lipeng-github/corethink
/**
 * 根据用户ID获取用户信息
 * @param  integer $id 用户ID
 * @param  string $field
 * @return array  用户信息
 * @author jry <*****@*****.**>
 */
function get_user_info($id, $field)
{
    $userinfo = D('Admin/User')->find($id);
    $userinfo['avatar_url'] = get_cover($userinfo['avatar'], 'avatar');
    if ($userinfo[$field]) {
        return $userinfo[$field];
    }
    return $userinfo;
}
コード例 #22
0
 /**
  * $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');
     }
 }
コード例 #23
0
        echo "";
    } else {
        foreach ($__LIST__ as $key => $vo) {
            $mod = $i % 2;
            ++$i;
            ?>
<tr>
		 <td align="center"><?php 
            echo $vo["goodid"];
            ?>
</td>
                <td><A href="<?php 
            echo U('Home/Article/detail?id=' . $vo['goodid']);
            ?>
" > <img src="<?php 
            echo get_cover(get_cover_id($vo["goodid"]), 'path');
            ?>
"  width="40" height="40"/><?php 
            echo get_good_name($vo["goodid"]);
            ?>
</A></td>
               <td align="center"> <span class="weight"><?php 
            echo get_weight($vo["goodid"]);
            ?>
</span>g</td>
                <td align="center"><?php 
            echo get_good_price($vo["goodid"]);
            ?>
</td>
                 <td align="center"><?php 
            echo $vo["num"];
コード例 #24
0
 /**
  * 显示页面
  * @author jry <*****@*****.**>
  */
 public function display()
 {
     //编译data_list中的值
     foreach ($this->_table_data_list as &$data) {
         //编译表格右侧按钮
         foreach ($this->_right_button_list as $right_button) {
             //禁用按钮比较特殊,它需要根据数据当前状态判断是显示禁用还是启用
             if ($right_button['type'] === 'forbid') {
                 $right_button = $right_button[$data['status']];
             }
             //将约定的标记[__data_id__]替换成真实的数据ID
             $right_button['href'] = preg_replace('/\\[__data_id__\\]/i', $data[$this->_table_data_list_key], $right_button['href']);
             //编译按钮属性
             $right_button['attribute'] = $this->compileHtmlAttr($right_button);
             $data['right_button'] .= '<a ' . $right_button['attribute'] . '>' . $right_button['title'] . '</a> ';
         }
         //根据表格标题字段指定类型编译列表数据
         foreach ($this->_table_column_list as &$column) {
             switch ($column['type']) {
                 case 'status':
                     switch ($data[$column['name']]) {
                         case '-1':
                             $data[$column['name']] = '<i class="fa fa-trash" style="color:red"></i>';
                             break;
                         case '0':
                             $data[$column['name']] = '<i class="fa fa-ban" style="color:red"></i>';
                             break;
                         case '1':
                             $data[$column['name']] = '<i class="fa fa-check" style="color:green"></i>';
                             break;
                     }
                     break;
                 case 'icon':
                     $data[$column['name']] = '<i class="' . $data[$field['name']] . '"></i>';
                     break;
                 case 'date':
                     $data[$column['name']] = time_format($data[$field['name']], 'Y-m-d');
                     break;
                 case 'time':
                     $data[$column['name']] = time_format($data[$field['name']]);
                     break;
                 case 'image':
                     $data[$column['name']] = '<img src="' . get_cover($data[$field['name']]) . '">';
                     break;
                 case 'type':
                     $form_item_type = C('FORM_ITEM_TYPE');
                     $data[$column['name']] = $form_item_type[$data[$column['name']]][0];
                     break;
             }
         }
     }
     //编译top_button_list中的HTML属性
     foreach ($this->_top_button_list as &$button) {
         $button['attribute'] = $this->compileHtmlAttr($button);
     }
     $this->assign('meta_title', $this->_meta_title);
     //页面标题
     $this->assign('top_button_list', $this->_top_button_list);
     //顶部工具栏按钮
     $this->assign('search', $this->_search);
     //搜索配置
     $this->assign('tab_nav', $this->_tab_nav);
     //页面Tab导航
     $this->assign('table_column_list', $this->_table_column_list);
     //表格的列
     $this->assign('table_data_list', $this->_table_data_list);
     //表格数据
     $this->assign('table_data_list_key', $this->_table_data_list_key);
     //表格数据主键字段名称
     $this->assign('table_data_page', $this->_table_data_page);
     //表示个数据分页
     $this->assign('right_button_list', $this->_right_button_list);
     //表格右侧操作按钮
     $this->assign('extra_html', $this->_extra_html);
     //额外HTML代码
     parent::display($this->_template);
 }
コード例 #25
0
 function _image_media_id($cover_id)
 {
     $cover = get_cover($cover_id);
     $driver = C('PICTURE_UPLOAD_DRIVER');
     if ($driver != 'Local' && !file_exists(SITE_PATH . $cover['path'])) {
         // 先把图片下载到本地
         $pathinfo = pathinfo(SITE_PATH . $cover['path']);
         mkdirs($pathinfo['dirname']);
         $content = wp_file_get_contents($cover['url']);
         $res = file_put_contents(SITE_PATH . $cover['path'], $content);
         if (!$res) {
             $this->error('远程图片下载失败');
         }
     }
     $path = $cover['path'];
     // if (! $path) {
     // $this->error ( '获取图片素材失败' );
     // exit();
     // }
     $param['type'] = 'image';
     $param['media'] = '@' . realpath(SITE_PATH . $path);
     $url = 'https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=' . get_access_token();
     $res = post_data($url, $param, true);
     if (isset($res['errcode']) && $res['errcode'] != 0) {
         $this->error(error_msg($res, '图片上传'));
         exit;
     }
     return $res['media_id'];
 }
コード例 #26
0
 /**
  * 显示页面
  * @author jry <*****@*****.**>
  */
 public function display()
 {
     // 编译data_list中的值
     foreach ($this->_table_data_list as &$data) {
         // 编译表格右侧按钮
         if ($this->_right_button_list) {
             foreach ($this->_right_button_list as $right_button) {
                 // 禁用按钮与隐藏比较特殊,它需要根据数据当前状态判断是显示禁用还是启用
                 if ($right_button['type'] === 'forbid') {
                     $right_button = $right_button['forbid' . $data['status']];
                 }
                 if ($right_button['type'] === 'recycle') {
                     if ($data['status'] === '0' || $data['status'] === '1') {
                         $right_button = $right_button['recycle1'];
                     } else {
                         $right_button = $right_button['recycle' . $data['status']];
                     }
                 }
                 // 将约定的标记__data_id__替换成真实的数据ID
                 $right_button['href'] = preg_replace('/__data_id__/i', $data[$this->_table_data_list_key], $right_button['href']);
                 // 编译按钮属性
                 $right_button['attribute'] = $this->compileHtmlAttr($right_button);
                 $data['right_button'][$right_button['name']] = $right_button;
             }
         }
         /**
          * 修改列表数据
          * 有时候列表数据需要在最终输出前做一次小的修改
          * 比如管理员列表ID为1的超级管理员右侧编辑按钮不显示删除
          */
         if ($this->_alter_data_list) {
             foreach ($this->_alter_data_list as $alter) {
                 if ($data[$alter['condition']['key']] === $alter['condition']['value']) {
                     if ($alter['alter_data']['right_button']) {
                         foreach ($alter['alter_data']['right_button'] as &$val) {
                             if (!$val['attribute']) {
                                 $val['href'] = preg_replace('/__data_id__/i', $data[$this->_table_data_list_key], $val['href']);
                                 $val['attribute'] = $this->compileHtmlAttr($val);
                                 // 编译按钮属性
                             }
                         }
                     }
                     $data = array_merge($data, $alter['alter_data']);
                 }
             }
         }
         // 根据表格标题字段指定类型编译列表数据
         foreach ($this->_table_column_list as &$column) {
             switch ($column['type']) {
                 case 'status':
                     switch ($data[$column['name']]) {
                         case '-1':
                             $data[$column['name']] = '<i class="fa fa-trash text-danger"></i>';
                             break;
                         case '0':
                             $data[$column['name']] = '<i class="fa fa-ban text-danger"></i>';
                             break;
                         case '1':
                             $data[$column['name']] = '<i class="fa fa-check text-success"></i>';
                             break;
                     }
                     break;
                 case 'byte':
                     $data[$column['name']] = $this->formatBytes($data[$column['name']]);
                     break;
                 case 'icon':
                     $data[$column['name']] = '<i class="fa ' . $data[$column['name']] . '"></i>';
                     break;
                 case 'date':
                     $data[$column['name']] = time_format($data[$column['name']], 'Y-m-d');
                     break;
                 case 'datetime':
                     $data[$column['name']] = time_format($data[$column['name']]);
                     break;
                 case 'time':
                     $data[$column['name']] = time_format($data[$column['name']]);
                     break;
                 case 'avatar':
                     $data[$column['name']] = '<img style="width:40px;height:40px;" src="' . get_cover($data[$column['name']]) . '">';
                     break;
                 case 'picture':
                     $data[$column['name']] = '<img class="picture" src="' . get_cover($data[$column['name']]) . '">';
                     break;
                 case 'pictures':
                     if (!is_array($data[$column['name']])) {
                         $temp = explode(',', $data[$column['name']]);
                     }
                     $data[$column['name']] = '<img class="picture" src="' . get_cover($temp[0]) . '">';
                     break;
                 case 'type':
                     $form_item_type = C('FORM_ITEM_TYPE');
                     $data[$column['name']] = $form_item_type[$data[$column['name']]][0];
                     break;
                 case 'callback':
                     // 调用函数
                     if (is_array($column['param'])) {
                         $data[$column['name']] = call_user_func_array($column['param'], array($data[$column['name']]));
                     } else {
                         $data[$column['name']] = call_user_func($column['param'], $data[$column['name']]);
                     }
                     break;
             }
             if (is_array($data[$column['name']]) && $column['name'] !== 'right_button') {
                 $data[$column['name']] = implode(',', $data[$column['name']]);
             }
         }
     }
     //编译top_button_list中的HTML属性
     if ($this->_top_button_list) {
         foreach ($this->_top_button_list as &$button) {
             $button['attribute'] = $this->compileHtmlAttr($button);
         }
     }
     $this->assign('meta_title', $this->_meta_title);
     // 页面标题
     $this->assign('top_button_list', $this->_top_button_list);
     // 顶部工具栏按钮
     $this->assign('search', $this->_search);
     // 搜索配置
     $this->assign('tab_nav', $this->_tab_nav);
     // 页面Tab导航
     $this->assign('table_column_list', $this->_table_column_list);
     // 表格的列
     $this->assign('table_data_list', $this->_table_data_list);
     // 表格数据
     $this->assign('table_data_list_key', $this->_table_data_list_key);
     // 表格数据主键字段名称
     $this->assign('table_data_page', $this->_table_data_page);
     // 表示个数据分页
     $this->assign('right_button_list', $this->_right_button_list);
     // 表格右侧操作按钮
     $this->assign('alter_data_list', $this->_alter_data_list);
     // 表格数据列表重新修改的项目
     $this->assign('extra_html', $this->_extra_html);
     //是否ajax提交
     // 显示页面
     $this->assign('is_builder', 'list');
     // Builder标记
     parent::display($this->_template);
 }
コード例 #27
0
 /**
  * [adjustExpand 格式化操作扩展]
  * @param  [type] &$courseList [操作值]
  * @return [type]              [description]
  */
 private function adjustExpand(&$courseList)
 {
     foreach ($courseList as $key => $value) {
         //图片地址
         $courseList[$key]['img'] = get_cover($courseList[$key]['img'], 'path');
         $courseList[$key]['id'] = U('Video/index?id=' . $courseList[$key]['id']);
         $courseList[$key]['authority'] = U('Teacher/index?id=' . $courseList[$key]['authority']);
     }
 }
コード例 #28
0
                    ?>
                                    </select>
                                </div>
                                <?php 
                    if ($o_key == 'background') {
                        ?>
<!-- 自定义上传背景 -->
                                <div class="controls uploadrow" id="uploadControls" style="display:none">
                                    <input type="file" id="upload_picture_bg">
                                    <input type="hidden" name="config[bg]" id="cover_id_bg"/>
                                    <div class="upload-img-box" rel='img'>
                                      <?php 
                        if (!empty($data[bg])) {
                            ?>
<div class="upload-pre-item"><img width="120" height="120" src="/weiphp2.0<?php 
                            echo get_cover($data[bg], 'path');
                            ?>
"/></div><?php 
                        }
                        ?>
                                    </div>
                                  </div>
                                  <script type="text/javascript">
                                        //上传图片
                                        /* 初始化上传插件 */
                                        $("#upload_picture_bg").uploadify({
                                            "height"          : 120,
                                            "swf"             : "/weiphp2.0/Public/static/uploadify/uploadify.swf",
                                            "fileObjName"     : "download",
                                            "buttonText"      : "上传卡片图片",
                                            "uploader"        : "<?php 
コード例 #29
0
                                    echo $field["name"];
                                    ?>
" id="cover_id_<?php 
                                    echo $field["name"];
                                    ?>
" value="<?php 
                                    echo $data[$field['name']];
                                    ?>
"/>
                            
                            <div class="upload-img-box">
                              <?php 
                                    if (!empty($data[$field['name']])) {
                                        ?>
<div class="upload-pre-item"><img width="120" height="120" src="/weiphp2.0<?php 
                                        echo get_cover($data[$field['name']], 'path');
                                        ?>
"/></div><?php 
                                    }
                                    ?>
                            </div>
                          </div>
                         
                          <script type="text/javascript">
								//上传图片
							    /* 初始化上传插件 */
								$("#upload_picture_<?php 
                                    echo $field["name"];
                                    ?>
").uploadify({
							        "height"          : 120,
コード例 #30
0
ファイル: thumb.php プロジェクト: fishling/chatPro
function get_cover_url($cover_id)
{
    $url = get_cover($cover_id, 'path');
    if (empty($url)) {
        return '';
    }
    return "http://" . $_SERVER['HTTP_HOST'] . $url;
}