迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
这个浏览有分页吗,没找到,如果图片多的话怎么看到以前的图片
public function input_file_list() { $p = $this->_get_upload_params(); $c = (int)\Phpcmf\Service::L('input')->get('ct'); // 当已有数量 $ct = max(1, (int)$p['count']); // 可上传数量 if (IS_AJAX_POST) { $p = (int)\Phpcmf\Service::L('input')->post('is_page'); $ids = \Phpcmf\Service::L('input')->get_post_ids($p ? 'ids1' : 'ids0'); if (!$ids) { $this->_json(0, dr_lang('至少要选择一个文件')); } elseif (dr_count($ids) > $ct - $c) { $this->_json(0, dr_lang('只能选择%s个文件,你已经选择%s个', $ct - $c, dr_count($ids))); } $list = []; $temp = \Phpcmf\Service::M()->table($p ? 'attachment_data' : 'attachment_unused')->where('uid', $this->uid)->where_in('id', $ids)->limit_page(); foreach ($temp as $t) { $list[] = [ 'id' => $t['id'], 'name' => $t['filename'], 'file' => $t['attachment'], 'url' => dr_get_file($t['id']), 'preview' => dr_file_preview_html(dr_get_file_url($t)), 'upload' => '<input type="file" name="file_data"></button>', ]; } $data = [ 'count' => dr_count($ids), 'result' => $list, ]; $this->_json(1, dr_lang('已选择%s个文件', $data['count']), $data); } $num = 14; $exts = dr_safe_replace($p['exts']); $list = [ 'used' => [], 'unused' => $exts ? \Phpcmf\Service::M()->table('attachment_unused')->where('uid', $this->uid)->where_in('fileext', explode(',', $exts))->order_by('id desc')->getAll($num) : \Phpcmf\Service::M()->table('attachment_unused')->order_by('id desc')->getAll($num), ]; $sfield = [ 'id' => dr_lang('附件ID'), 'filename' => dr_lang('附件名称'), ]; // 搜索附件 $search_url = '/index.php?is_ajax=1&s=api&c=file&m=input_file_list&p='.\Phpcmf\Service::L('input')->get('p') .'&fid='.\Phpcmf\Service::L('input')->get('fid').'&ct='.\Phpcmf\Service::L('input')->get('ct').'&page={page}'; $config = require CMSPATH.'Config/Apage.php'; $total = \Phpcmf\Service::M()->table('attachment_data')->where('uid', $this->uid)->where_in('fileext', explode(',', $exts))->order_by('id desc')->limit_page($num)[1]; $name = \Phpcmf\Service::L('input')->get('name'); $value = dr_safe_replace(\Phpcmf\Service::L('input')->get('value')); if ($name && isset($sfield[$name]) && $value) { $db = \Phpcmf\Service::M()->table('attachment_data'); $exts && $db->where_in('fileext', explode(',', $exts)); $where = !$this->member['is_admin'] ? 'uid = '.$this->uid : '1'; if ($name == 'id') { $where.= ' AND id='.intval($value); } else { $where.= ' AND '.$name.' LIKE "%'.$value.'%"'; } $list['used'] = $db->where($where)->order_by('id desc')->limit_page($num); } else { $list['used'] = $exts ? \Phpcmf\Service::M()->table('attachment_data')->where('uid', $this->uid)->where_in('fileext', explode(',', $exts))->order_by('id desc')->limit_page($num)[0] : \Phpcmf\Service::M()->table('attachment_data')->order_by('id desc')->limit_page($num)[0]; } \Phpcmf\Service::V()->admin(); \Phpcmf\Service::V()->assign([ 'form' => dr_form_hidden(), 'list' => $list, 'sfield' => $sfield, 'mypages' => \Phpcmf\Service::L('input')->table_page($search_url, $total, $config, $num), 'param' => [ 'name' => $name, 'value' => $value, ], 'page' => intval($_GET['page']), 'search_url' => $search_url, ]); \Phpcmf\Service::V()->display('api_upload_list.html');exit; }
<div class="files"> {loop $list.used $i $t} {php $url = dr_get_file_url($t, 50, 50);} <div class="template-download yl_files_row files_row"> <label class="mt-table mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline"> <input type="checkbox" class="checkboxes" name="ids1[]" value="{$t.id}" /> <span></span> </label> <label class="files_row_preview preview">{dr_file_preview_html($url, 1)}</label> <label class="label label-sm label-success" style="margin-right: 10px;"> {dr_format_file_size($t.filesize)} </label> <label class="label label-sm label-default" title="{$t.filename}">{dr_strcut($t.filename, 10)}</label> </div> {/loop} </div>
<?php $rule = '/index.php?is_ajax=1&s=api&c=file&m=input_file_list&p='.\Phpcmf\Service::L('input')->get('p') .'&fid='.\Phpcmf\Service::L('input')->get('fid').'&ct='.\Phpcmf\Service::L('input')->get('ct').'&page=1&pp=[page]'; $_GET['page'] = $_GET['pp']; $sfield = [ 'id' => dr_lang('附件ID'), 'filename' => dr_lang('附件名称'), ]; $name = \Phpcmf\Service::L('input')->get('name'); $value = dr_safe_replace(\Phpcmf\Service::L('input')->get('value')); $where = []; $exts && $where[] = "fileext in (".$exts.")"; if ($name && isset($sfield[$name]) && $value) { $this->member['is_admin'] && $where[] = 'uid = '.$this->uid; if ($name == 'id') { $where[] = 'id='.intval($value); } else { $where[]= $name.' LIKE "%'.$value.'%"'; } } $where = urlencode(implode(' AND ', $where)); ?> {table table=attachment_data where=$where page=1 pagesize=10 urlrule=$rule} {php $url = dr_get_file_url($t, 50, 50);} <div class="template-download yl_files_row files_row"> <label class="mt-table mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline"> <input type="checkbox" class="checkboxes" name="ids1[]" value="{$t.id}" /> <span></span> </label> <label class="files_row_preview preview">{dr_file_preview_html($url, 1)}</label> <label class="label label-sm label-success" style="margin-right: 10px;"> {dr_format_file_size($t.filesize)} </label> <label class="label label-sm label-default" title="{$t.filename}">{dr_strcut($t.filename, 10)}</label> </div> {/loop} 分页 {$pages}
这样的控制器能进行重写吗?
通过标签能实现吗?