本文整理汇总了PHP中get_document_model函数的典型用法代码示例。如果您正苦于以下问题:PHP get_document_model函数的具体用法?PHP get_document_model怎么用?PHP get_document_model使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_document_model函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: logic
/**
* 获取扩展模型对象
* @param integer $model_id 模型编号
* @return object 模型对象
*/
function logic($model_id)
{
$name = parse_name(get_document_model($model_id, 'name'), 1);
$class = is_file(MODULE_PATH . 'Logic/' . $name . 'Logic' . EXT) ? $name : 'Base';
$class = MODULE_NAME . '\\Logic\\' . $class . 'Logic';
return new $class($name);
}
开发者ID:hanxiansen,项目名称:onethink,代码行数:12,代码来源:function.php
示例2: get_sublist
/**
* 获取子文档列表 Document_
* @param array|num $modelid 模型ID
* @return array 子模型列表
*/
public static function get_sublist($modelid)
{
$model_id = is_array($modelid) ? $modelid[0] : $modelid;
$model_title = get_document_model($model_id);
$sublist = array();
$newsublist = array();
$sublist = M('Document' . ucfirst($model_title['name']))->select();
//读取附属全部字段
foreach ($sublist as $key => $value) {
$newsublist[$value['id']] = $value;
unset($newsublist[$value['id']]['id']);
}
return $newsublist;
}
开发者ID:Luckyseal,项目名称:amango,代码行数:19,代码来源:DocumentApi.class.php
示例3: detail
public function detail($id = 0, $p = 1)
{
/* 标识正确性检测 */
if (!($id && is_numeric($id))) {
$this->error('文档ID错误!');
}
/* 页码检测 */
$p = intval($p);
$p = empty($p) ? 1 : $p;
/* 获取详细信息 */
$Document = D('Document');
$info = $Document->detail($id);
if (!$info) {
$this->error($Document->getError());
}
/* 分类信息 */
$category = $this->category($info['category_id']);
/* 获取模板 */
if (!empty($info['template'])) {
//已定制模板
$tmpl = $info['template'];
} elseif (!empty($category['template_detail'])) {
//分类已定制模板
$tmpl = $category['template_detail'];
} else {
//使用默认模板
$tmpl = 'Article/' . get_document_model($info['model_id'], 'name') . '/detail';
}
/* 更新浏览数 */
$map = array('id' => $id);
$Document->where($map)->setInc('view');
/* 模板赋值并渲染模板 */
$this->assign('category', $category);
$this->assign('info', $info);
$this->assign('page', $p);
//页码
$Catelist = D('category');
$cateList = $Catelist->getTree(2, false);
$this->assign('cateList', $cateList);
// 分类树
$this->display();
}
开发者ID:bjjfsd,项目名称:youweihui,代码行数:42,代码来源:ArticleController.class.php
示例4: detail
public function detail($id = 0, $p = 1)
{
if (!($id && is_numeric($id))) {
$this->error('文档ID错误!');
}
$Document = D('Document');
$p = intval($p);
$p = empty($p) ? 1 : $p;
$Document = D('Document');
$info = $Document->detail($id);
if (!$info) {
$this->error($Document->getError());
}
if (!trim($info['content'])) {
header("Location:" . U("Index/index"));
}
$category = $this->category($info['category_id']);
/* 获取模板 */
if (!empty($info['template'])) {
//已定制模板
$tmpl = $info['template'];
} elseif (!empty($category['template_detail'])) {
//分类已定制模板
$tmpl = $category['template_detail'];
} else {
//使用默认模板
$tmpl = 'Article/' . get_document_model($info['model_id'], 'name') . '/detail';
}
/* 更新浏览数 */
$map = array('id' => $id);
$Document->where($map)->setInc('view');
/* 模板赋值并渲染模板 */
$this->assign('category', $category);
$this->assign('info', $info);
$this->assign('page', $p);
//页码
$this->display($tmpl);
}
开发者ID:Johnzero,项目名称:zero,代码行数:38,代码来源:ArticleController.class.php
示例5: logic
/**
* 获取扩展模型对象
* @param integer $model 模型编号
* @return object 模型对象
*/
private function logic($model)
{
return D(get_document_model($model, 'name'), 'Logic');
}
开发者ID:zqstudio2015,项目名称:myweiphp,代码行数:9,代码来源:DocumentModel.class.php
示例6: foreach
<?php
if (is_array($model)) {
$i = 0;
$__LIST__ = $model;
if (count($__LIST__) == 0) {
echo "";
} else {
foreach ($__LIST__ as $key => $vo) {
$mod = $i % 2;
++$i;
?>
<li><a href="<?php
echo U('article/add', array('cate_id' => $cate_id, 'model_id' => $vo, 'pid' => I('pid', 0), 'group_id' => $group_id));
?>
"><?php
echo get_document_model($vo, 'title');
?>
</a></li><?php
}
}
} else {
echo "";
}
?>
</ul><?php
}
?>
<?php
} else {
?>
<button class="btn disabled" >新 增
开发者ID:www2511550,项目名称:ccBlog-onthink,代码行数:31,代码来源:7a4184ffe8f804b12b2e7f8851dd8f7d.php
示例7: detail
public function detail($id = 0, $p = 1)
{
/* 热词调用*/
$hotsearch = C('HOT_SEARCH');
$this->assign('hotsearch', $hotsearch);
/* 标识正确性检测 */
if (!($id && is_numeric($id))) {
$this->error('不存在该商品!');
}
/* 获取详细信息 */
$Document = D('Document');
$info = $Document->detail($id);
if (!$info) {
$this->error($Document->getError());
}
/* 分类信息 */
$category = $this->category($info['category_id']);
/* 获取模板 */
if (!empty($info['template'])) {
//已定制模板
$tmpl = $info['template'];
} elseif (!empty($category['template_detail'])) {
//分类已定制模板
$tmpl = $category['template_detail'];
} else {
//使用默认模板
$tmpl = 'Article/' . get_document_model($info['model_id'], 'name') . '/detail';
}
/* 更新浏览数 */
$map = array('id' => $id);
$Document->where($map)->setInc('view');
/*内容页统计代码实现,tag=3*/
if (1 == C('IP_TONGJI')) {
$record = IpLookup("", 3, $id);
}
/**获取商品所有评论**/
$comment = M('comment');
$count = $comment->where("status='1' and goodid='{$id}'")->count();
//计算记录数
$this->assign('count', $count);
$limitRows = 5;
// 设置每页记录数
$p = new \Think\AjaxPage($count, $limitRows, "comment");
//第三个参数是你需要调用换页的ajax函数名
$limit_value = $p->firstRow . "," . $p->listRows;
$data = $comment->where("status='1' and goodid='{$id}'")->order('id desc')->limit($limit_value)->select();
// 查询数据
$page = $p->show();
// 产生分页信息,AJAX的连接在此处生成
$this->assign('list', $data);
$this->assign('page', $page);
/**获取商品所有好评**/
$comment = M('comment');
$countbetter = $comment->where("status='1' and goodid='{$id}' and score='3'")->count();
//计算记录数
$this->assign('countbetter', $countbetter);
$limitRowsbetter = 5;
// 设置每页记录数
$pbetter = new \Think\AjaxPage($countbetter, $limitRowsbetter, "commentgood");
//第三个参数是你需要调用换页的ajax函数名
$limitbetter = $pbetter->firstRow . "," . $pbetter->listRows;
$listbetter = $comment->where("status='1' and goodid='{$id}' and score='3'")->order('id desc')->limit($limitbetter)->select();
// 查询数据
$pagebetter = $pbetter->show();
// 产生分页信息,AJAX的连接在此处生成
$this->assign('listbetter', $listbetter);
$this->assign('pagebetter', $pagebetter);
/**获取商品所有中评**/
$comment = M('comment');
$countmiddle = $comment->where("status='1' and goodid='{$id}' and score='2'")->count();
//计算记录数
$this->assign('countmiddle ', $countmiddle);
$limitRows = 5;
// 设置每页记录数
$pmiddle = new \Think\AjaxPage($countmiddle, $limitRows, "commentmiddle");
//第三个参数是你需要调用换页的ajax函数名
$limitmiddle = $pmiddle->firstRow . "," . $pmiddle->listRows;
$datamiddle = $comment->where("status='1' and goodid='{$id}' and score='2'")->order('id desc')->limit($limitmiddle)->select();
// 查询数据
$pagemiddle = $pmiddle->show();
// 产生分页信息,AJAX的连接在此处生成
$this->assign('listmiddle', $datamiddle);
$this->assign('pagemiddle', $pagemiddle);
/**获取商品所有差评**/
$comment = M('comment');
$countworse = $comment->where("status='1' and goodid='{$id}' and score='1'")->count();
//计算记录数
$this->assign('countworse ', $countworse);
$limitRows = 5;
// 设置每页记录数
$pworse = new \Think\AjaxPage($countworse, $limitRows, "commentworse");
//第三个参数是你需要调用换页的ajax函数名
$limitworse = $pworse->firstRow . "," . $pworse->listRows;
$dataworse = $comment->where("status='1' and goodid='{$id}' and score='1'")->order('id desc')->limit($limitworse)->select();
// 查询数据
$pageworse = $pworse->show();
// 产生分页信息,AJAX的连接在此处生成
$this->assign('listworse', $dataworse);
$this->assign('pageworse', $pageworse);
/** 好评率 **/
//.........这里部分代码省略.........
开发者ID:WineShop,项目名称:wine,代码行数:101,代码来源:ArticleController.class.php
示例8: get_document_model
}
}
?>
</div><?php
}
?>
<!-- nav -->
<script type="text/javascript" src="/Public/static/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="/Public/static/UploadImages.js"></script>
<div class="main-title cf">
<h2>
编辑<?php
echo get_document_model($data["model_id"], 'title');
?>
[
<?php
if (is_array($rightNav)) {
$i = 0;
$__LIST__ = $rightNav;
if (count($__LIST__) == 0) {
echo "";
} else {
foreach ($__LIST__ as $key => $nav) {
$mod = $i % 2;
++$i;
?>
<a href="<?php
echo U('goods/index', 'cate_id=' . $nav['id']);
开发者ID:kevins1022,项目名称:tpshop,代码行数:31,代码来源:608b0c961c661bd6d45820311b4b75a7.php
示例9: merge
/**
* 合并分类
* @author huajie <[email protected]>
*/
public function merge()
{
$to = I('post.to');
$from = I('post.from');
$Model = M('Category');
//检查分类绑定的模型
$from_models = explode(',', $Model->getFieldById($from, 'model'));
$to_models = explode(',', $Model->getFieldById($to, 'model'));
foreach ($from_models as $value) {
if (!in_array($value, $to_models)) {
$this->error('请给目标分类绑定' . get_document_model($value, 'title') . '模型');
}
}
//检查分类选择的文档类型
$from_types = explode(',', $Model->getFieldById($from, 'type'));
$to_types = explode(',', $Model->getFieldById($to, 'type'));
foreach ($from_types as $value) {
if (!in_array($value, $to_types)) {
$types = C('DOCUMENT_MODEL_TYPE');
$this->error('请给目标分类绑定文档类型:' . $types[$value]);
}
}
//合并文档
$res = M('Document')->where(array('category_id' => $from))->setField('category_id', $to);
if ($res !== false) {
//删除被合并的分类
$Model->delete($from);
$this->success('合并分类成功!', U('index'));
} else {
$this->error('合并分类失败!');
}
}
开发者ID:WineShop,项目名称:wine,代码行数:36,代码来源:CatearticleController.class.php
示例10: detail
public function detail($id = 0, $p = 1)
{
/* 热词调用*/
$hotsearch = R("Index/getHotsearch");
$this->assign('hotsearch', $hotsearch);
/* 购物车调用*/
$cart = R("Shopcart/usercart");
$this->assign('usercart', $cart);
if (!session('user_auth')) {
$usercart = $_SESSION['cart'];
$this->assign('usercart', $usercart);
}
/* 左侧分类列表*/
$mlist = R('Index/menulist');
$this->assign('categoryq', $mlist);
/* 浏览量排行前7个商品*/
$view = M('Document')->where("display=1")->order("view desc")->select();
$this->assign('viewlist', $view);
/* 标识正确性检测 */
if (!($id && is_numeric($id))) {
$this->error('文档ID错误!');
}
/* 页码检测 */
$p = intval($p);
$p = empty($p) ? 1 : $p;
/* 获取详细信息 */
$Document = D('Document');
$info = $Document->detail($id);
if (!$info) {
$this->error($Document->getError());
}
/* 分类信息 */
$category = $this->category($info['category_id']);
/* 获取模板 */
if (!empty($info['template'])) {
//已定制模板
$tmpl = $info['template'];
} elseif (!empty($category['template_detail'])) {
//分类已定制模板
$tmpl = $category['template_detail'];
} else {
//使用默认模板
$tmpl = 'Article/' . get_document_model($info['model_id'], 'name') . '/detail';
}
/* 更新浏览数 */
$map = array('id' => $id);
$Document->where($map)->setInc('view');
/*内容页统计代码实现,tag=3*/
if (1 == C('IP_TONGJI')) {
$record = IpLookup("", 3, $id);
}
/* 模板赋值并渲染模板 */
$this->assign('category', $category);
$this->assign('info', $info);
$this->assign('page', $p);
//页码
$this->display($tmpl);
}
开发者ID:stonegithubs,项目名称:yershop,代码行数:58,代码来源:ArticleController.class.php
示例11: get_position
/**
* 获取分类的推荐列表
* @param num $cateid 文档分类ID
* @param num $pos 推荐位置ID
* @param num $limit 限制条数
* @param sting $order 排序顺序
* @return array 推荐列表文档
*/
public static function get_position($cateid, $pos, $limit, $order)
{
if (empty($cateid)) {
return false;
} else {
$category = get_category($cateid);
//判断该分类是否为顶级 是 读取顶级下所有的子分类id
if ($category['pid'] == 0) {
$list = M('Category')->where(array('pid' => $cateid, 'status' => 1))->order('create_time desc')->field('id')->select();
foreach ($list as $key => $value) {
$categoryid[] = $value['id'];
}
$top = $cateid;
} else {
$categoryid = $cateid;
$top = self::get_pid($cateid);
}
//表数据模型
$model_info = get_document_model($category['model']);
$submodel = M('Document' . ucfirst($model_info['name']));
$map['status'] = 1;
if (is_numeric($categoryid)) {
$map['category_id'] = $categoryid;
} else {
$map['category_id'] = array('in', $categoryid);
}
$pos = empty($pos) ? 0 : $pos;
if (strpos($pos, ',') !== false) {
$map['position'] = array('in', $pos);
}
$map['create_time'] = array('lt', NOW_TIME);
$map['_string'] = 'deadline = 0 OR deadline > ' . NOW_TIME;
$limit = empty($limit) ? 6 : $limit;
$order = empty($order) ? 'level desc,create_time desc' : $order;
//先读取基础数据
$newlist = array();
$lists = M('Document')->where($map)->order($order)->limit($limit)->select();
//拓展数据合并
foreach ($lists as $key => $value) {
$subinfo = array();
$subinfo = $submodel->where(array('id' => $value['id']))->find();
if (!empty($subinfo)) {
$newlist[$key] = array_merge($value, $subinfo);
}
}
return $newlist;
}
}
开发者ID:wmk223,项目名称:amango_V3,代码行数:56,代码来源:DocumentApi.class.php
示例12: edit
public function edit($category = null, $model = null, $id = 0)
{
$this->login();
//用户登录检测
//TODO: 管理员权限检测,目前测试阶段不做限制
/* 参数正确性检测 */
if ((empty($id) || !is_numeric($id)) && (empty($category) || empty($model))) {
$this->error('缺少参数!');
}
/* 获取被编辑的数据 */
$info = array();
if ($id) {
/* 获取详细信息 */
$Document = D('Document');
$info = $Document->detail($id);
if (!$info) {
$this->error($Document->getError());
}
$category = $info['category_id'];
$model = $info['model'];
}
/* 获取当前分类信息 */
$category = D('Category')->info($category);
if (0 == $category['allow_publish']) {
$this->error('该分类禁止发布内容!');
}
/* 验证绑定模型 */
if (in_array($model, $category['model'])) {
$info['model_id'] = $model;
} else {
$this->error("该分类没有绑定模型:id-{$model}");
}
/* 获取模板 */
if (empty($category['template_edit'])) {
$model = get_document_model($model, 'name');
$tmpl = "Article/{$model}/edit";
} else {
$tmpl = $category['template_edit'];
}
/* 模板赋值并渲染模板 */
$this->assign('info', $info);
$this->assign('category', $category);
$this->display($tmpl);
}
开发者ID:commiunty,项目名称:Mytest,代码行数:44,代码来源:ArticleController.class.php
示例13: get_document_model
$i = $i + 1;
}
}
?>
</div><?php
}
?>
<!-- nav -->
<script type="text/javascript" src="/Public/static/uploadify/jquery.uploadify.min.js"></script>
<div class="main-title cf">
<h2>
新增<?php
echo get_document_model($info["model_id"], 'title');
?>
[
<?php
if (is_array($rightNav)) {
$i = 0;
$__LIST__ = $rightNav;
if (count($__LIST__) == 0) {
echo "";
} else {
foreach ($__LIST__ as $key => $nav) {
$mod = $i % 2;
++$i;
?>
<a href="<?php
echo U('article/index', 'cate_id=' . $nav['id']);
开发者ID:rainly123,项目名称:zs,代码行数:31,代码来源:e16cf278f1c326e72baf6415dbd5ab87.php
示例14: get_sorceDetail
function get_sorceDetail($cateid, $id)
{
$readfields = D('Flycloud')->where(array('data_type' => 'category', 'data_table' => $cateid))->find();
$fields = explode(',', $readfields['data_fields']);
if (!empty($id)) {
/*获取一条记录的详细数据*/
// $document = D('Document');
// $data = $document->detail($id);
$info = D('Document')->field(true)->find($id);
$aimtable = get_document_model($info['model_id'], 'name');
$detail = D('Document' . ucfirst($aimtable))->field(true)->find($id);
$data = array_merge($info, $detail);
foreach ($fields as $value) {
$newdata[] = $data[$value];
}
if (is_numeric($newdata[1])) {
$url = D('Picture')->where(array('id' => $newdata[1]))->getField('path');
$newdata[1] = base64_encode(str_replace('\\/', '/', false !== strpos($url, 'http://') ? $url : HEAD_URL . __ROOT__ . $url));
}
return $newdata;
}
}
开发者ID:wmk223,项目名称:amango_V3,代码行数:22,代码来源:laravel.php
示例15: detail
public function detail($id = 0, $p = 1)
{
global $_K;
/* 标识正确性检测 */
if (!($id && is_numeric($id))) {
$this->error('文档ID错误!');
}
/* 页码检测 */
$p = intval($p);
$p = empty($p) ? 1 : $p;
/* 获取详细信息 */
$info = api('Document/get_detail', array('id' => $id));
if (false === $info['status']) {
$this->error($info['info']);
}
//芒果用户回复
$this->assign('model_id', $info['model_id']);
$model = get_document_model($info['model_id']);
$fields = get_model_attribute($model['id']);
$newfields = array();
foreach ($fields[1] as $k => $v) {
if ($v['reply_show'] == 1) {
$newfields[] = $v;
}
}
/* 分类信息 */
$category = $this->category($info['category_id']);
/* 获取模板 */
if (!empty($info['template'])) {
//已定制模板
$tmpl = $info['template'];
} elseif (!empty($category['template_detail'])) {
//分类已定制模板
$tmpl = $category['template_detail'];
} else {
//使用默认模板
$tmpl = 'Article/' . get_document_model($info['model_id'], 'name') . '/detail';
}
/* 更新浏览数 */
$map = array('id' => $id);
D('Document')->where($map)->setInc('view');
/* 芒果微信分享信息 */
$shareurl = Amango_U('Article/detail?id=' . $id);
$biaoshi = $info['title'] . "来自:" . C('WEB_SITE_TITLE');
$Shareinfo = array('ImgUrl' => get_cover_pic($info['cover_id']), 'TimeLink' => $shareurl, 'FriendLink' => $shareurl, 'WeiboLink' => $shareurl, 'tTitle' => $biaoshi, 'tContent' => $biaoshi, 'fTitle' => $biaoshi, 'fContent' => $biaoshi, 'wContent' => $biaoshi);
$this->assign('Share', $Shareinfo);
//是否允许发表新
$this->assign('reply', $category['reply']);
$this->assign('reply_show', $category['reply_show']);
$this->assign('fields', $newfields);
//一键关注链接
$this->assign('accountsub', $_K['DEFAULT']['account_sub']);
/* 模板赋值并渲染模板 */
$this->assign('category', $category);
$this->assign('info', $info);
$this->assign('page', $p);
//页码
//公共title
$this->assign('Title', $info['title']);
$this->display($tmpl);
}
开发者ID:Luckyseal,项目名称:amango,代码行数:61,代码来源:ArticleController.class.php
示例16: detail
public function detail($id = 0, $p = 1)
{
/* 标识正确性检测 */
if (!($id && is_numeric($id))) {
$this->service_error(L('_DOC_ID_ERROR_'));
}
/* 页码检测 */
$p = intval($p);
$p = empty($p) ? 1 : $p;
/* 获取详细信息 */
$Document = D('Document');
$info = $Document->detail($id);
if (!$info) {
$this->service_error($Document->getError());
}
/* 分类信息 */
$category = $this->_category($info['category_id']);
/* 获取模板 */
if (!empty($info['template'])) {
//已定制模板
$tmpl = $info['template'];
} elseif (!empty($category['template_detail'])) {
//分类已定制模板
$tmpl = $category['template_detail'];
} else {
//使用默认模板
$tmpl = 'Article/' . get_document_model($info['model_id'], 'name') . '/detail';
}
/* 更新浏览数 */
$map = array('id' => $id);
$Document->where($map)->setInc('view');
S('SEO_ARTICLE', $info);
/* 模板赋值并渲染模板 */
$this->assign('category', $category);
$this->assign('info', $info);
$this->assign('page', $p);
//页码
$this->display($tmpl);
}
开发者ID:slpi1,项目名称:onethink_multi_site,代码行数:39,代码来源:ArticleController.class.php
示例17: edit
/**
* 文档编辑页面初始化
* @author huajie <[email protected]>
*/
public function edit()
{
//获取左边菜单
$this->getMenu(array('elt', 1));
$id = I('get.id', '');
if (empty($id)) {
$this->error('参数不能为空!');
}
// 获取详细数据
$Document = D('Document');
$data = $Document->detail($id);
if (!$data) {
$this->error($Document->getError());
}
if ($data['pid']) {
// 获取上级文档
$article = $Document->field('id,title,type')->find($data['pid']);
$this->assign('article', $article);
}
// 获取当前的模型信息
$model = get_document_model($data['model_id']);
$this->assign('data', $data);
$this->assign('model_id', $data['model_id']);
$this->assign('model', $model);
//获取表单字段排序
$fields = get_model_attribute($model['id']);
$this->assign('fields', $fields);
//获取当前分类的文档类型
$this->assign('type_list', get_type_bycate($data['category_id']));
$this->meta_title = '编辑文档';
$this->display();
}
开发者ID:gitchenze,项目名称:soloshop,代码行数:36,代码来源:GoodsController.class.php
示例18: get_document_model
echo $list["title"];
?>
</label><?php
}
}
} else {
echo "";
}
?>
</div>
</div>
<div class="form-item">
<label class="item-label">子文档绑定绑定模型<span class="check-tips">(子文档支持发布的文档模型)</span></label>
<div class="controls">
<?php
$_result = get_document_model();
if (is_array($_result)) {
$i = 0;
$__LIST__ = $_result;
if (count($__LIST__) == 0) {
echo "";
} else {
foreach ($__LIST__ as $key => $list) {
$mod = $i % 2;
++$i;
?>
<label class="checkbox">
<input type="checkbox" name="model_sub[]" value="<?php
echo $list["id"];
?>
"><?php
开发者ID:a1357479,项目名称:techan,代码行数:31,代码来源:dfed54471f23c5cc0f29d10cfac5ae98.php
示例19: paste
/**
* 粘贴文档
* @author huajie <[email protected]>
*/
public function paste()
{
$moveList = session('moveArticle');
$copyList = session('copyArticle');
if (empty($moveList) && empty($copyList)) {
$this->error('没有选择文档!');
}
if (!isset($_POST['cate_id'])) {
$this->error('请选择要粘贴到的分类!');
}
$cate_id = I('post.cate_id');
//当前分类
$pid = I('post.pid', 0);
//当前父类数据id
//检查所选择的数据是否符合粘贴要求
$check = $this->checkPaste(empty($moveList) ? $copyList : $moveList, $cate_id, $pid);
if (!$check['status']) {
$this->error($check['info']);
}
if (!empty($moveList)) {
// 移动 TODO:检查name重复
foreach ($moveList as $key => $value) {
$Model = D('Document');
$map['id'] = $value;
$data['category_id'] = $cate_id;
$data['pid'] = $pid;
//获取root
if ($pid == 0) {
$data['root'] = 0;
} else {
$p_root = $Model->getFieldById($pid, 'root');
$data['root'] = $p_root == 0 ? $pid : $p_root;
}
$res = $Model->where($map)->save($data);
}
session('moveArticle', null);
if (false !== $res) {
$this->success('文档移动成功!');
} else {
$this->error('文档移动失败!');
}
} elseif (!empty($copyList)) {
// 复制
foreach ($copyList as $key => $value) {
$Model = D('Document');
$data = $Model->find($value);
unset($data['id']);
unset($data['name']);
$data['category_id'] = $cate_id;
$data['pid'] = $pid;
$data['create_time'] = NOW_TIME;
$data['update_time'] = NOW_TIME;
//获取root
if ($pid == 0) {
$data['root'] = 0;
} else {
$p_root = $Model->getFieldById($pid, 'root');
$data['root'] = $p_root == 0 ? $pid : $p_root;
}
$result = $Model->add($data);
if ($result) {
$logic = M(get_document_model($data['model_id'], 'name'), 'Logic');
$data = $logic->detail($value);
//获取指定ID的扩展数据
$data['id'] = $result;
$res = $logic->add($data);
}
}
session('copyArticle', null);
if ($res) {
$this->success('文档复制成功!');
} else {
$this->error('文档复制失败!');
}
}
}
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:80,代码来源:ArticleController.class.php
示例20: detail
public function detail($id = 0, $p = 1)
{
global $_K;
/* 标识正确性检测 */
if (!($id && is_numeric($id))) {
$this->error('文档ID错误!');
}
/* 页码检测 */
$p = intval($p);
$p = empty($p) ? 1 : $p;
/* 获取详细信息 */
$info = api('Document/get_detail', array('id' => $id));
if (false === $info['status']) {
$this->error($info['info']);
}
//芒果用户回复
$this->assign('model_id', $info['model_id']);
$model = get_document_model($info['model_id']);
$fields = get_model_attribute($model['id']);
$newfields = array();
foreach ($fields[1] as $k => $v) {
if ($v['reply_show'] == 1) {
$newfields[] = $v;
}
}
$logicname = get_document_model($info['model_id'], 'name');
/* 分类信息 */
$category = $this->category($info['category_id']);
$tmpl = $info['template'];
if (empty($tmpl)) {
$tmpl = empty($category['template_detail']) ? get_category($category['pid'], 'template_detail') : $category['template_detail'];
if (empty($tmpl)) {
$tmpl = 'Article/' . $logicname . '/detail';
}
}
/* 更新浏览数 */
$map = array('id' => $id);
D('Document')->where($map)->setInc('view');
/* 芒果微信分享信息 */
$this->setShare($info['cover_id'], U('Article/detail', array('id' => $id), '', TRUE), $info['title'], $info['description']);
//是否允许发表新
$this->assign('reply', $category['reply']);
$this->assign('reply_show', $category['reply_show']);
$this->assign('fields', $newfields);
//一键关注链接
$this->assign('accountsub', $_K['DEFAULT']['account_sub']);
/* 模板赋值并渲染模板 */
$this->assign('category', $category);
$this->assign('category_id', $category['id']);
$this->assign('info', $info);
$this->assign('page', $p);
//页码
//公共title
$this->assign('Title', $info['title']);
$this->assign('HideFastmenu', '1');
$this->display($tmpl);
}
开发者ID:wmk223,项目名称:amango_V3,代码行数:57,代码来源:ArticleController.class.php
注:本文中的get_document_model函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论