本文整理汇总了PHP中get_document_model函数的典型用法代码示例。如果您正苦于以下问题:PHP get_document_model函数的具体用法?PHP get_document_model怎么用?PHP get_document_model使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_document_model函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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();
}
示例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);
}
示例5: logic
/**
* 获取扩展模型对象
* @param integer $model 模型编号
* @return object 模型对象
*/
private function logic($model)
{
return D(get_document_model($model, 'name'), 'Logic');
}
示例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" >新 增
示例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);
/** 好评率 **/
//.........这里部分代码省略.........
示例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']);
示例9: merge
/**
* 合并分类
* @author huajie <banhuajie@163.com>
*/
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('合并分类失败!');
}
}
示例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);
}
示例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;
}
}
示例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);
}
示例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']);
示例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;
}
}
示例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);
}