/** * 分类标签列表 * @param array * @param string * @return array * @author MaWei (http://www.phpyrb.com) * @date 2014-8-12 下午11:02:42 */ function index() { $tp = empty($_REQUEST['type']) ? 'cate' : $_REQUEST['type']; switch ($tp) { case 'cate': $list = $this->CateTag->level(); $count = count($list); break; case 'tag': $where = array(); $_REQUEST['tid'] && ($where['id'] = intval($_REQUEST['tid'])); $_REQUEST['keyword'] && ($where['name'] = array('LIKE', '%' . text($_REQUEST['keyword']) . '%')); $count = $this->CateTag->taglist('count', $where); $page = new Page($count, 50); $list = $this->CateTag->taglist("{$page->firstRow},{$page->listRows}", $where); $this->assign('page', $page->show()); break; case 'type': $list = $this->CateTag->sourctype(); $count = count($list); break; default: exit; } $this->assign('search', array('tid' => $_REQUEST['tid'], 'keyword' => $_REQUEST['keyword'])); $this->assign('list', $list); $this->assign('tp', $tp); $this->assign('count', $count); $this->assign('action', $tp ? $tp : 'cate'); $this->display(); }
/** * 评论回复 * @param array * @param string * @return array * @author MaWei (http://www.phpyrb.com) * @date 2014-8-12 下午10:15:51 */ function reply() { $count = $this->comment->reply(); $page = new Page($count, 20); $list = $this->comment->reply("{$page->firstRow},{$page->listRows}"); $this->assign('list', $list); $this->assign('page', $page->show()); $this->assign('count', $count); $this->display(); }
/** * 书籍列表 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-9 下午2:46:17 */ function index() { $where = array(); $_REQUEST['bid'] && ($where['id'] = $search['bid'] = intval($_REQUEST['bid'])); $_REQUEST['keyword'] && ($where['name'] = $search['keyword'] = text($_REQUEST['keyword'])); $count = $this->Sourc->sourc('count', $where); $page = new Page($count, 30); $list = $this->Sourc->sourc("{$page->firstRow},{$page->listRows}", $where); $list = $this->Sourc->tagtoarrray($list); $this->assign('list', $list); $this->assign('count', $count); $this->assign('page', $page->show()); $this->display(); }
/** * 会员列表显示 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-4 下午3:24:03 */ function index() { $where = array(); $_REQUEST['uid'] && ($seach['uid'] = $where['id'] = intval($_REQUEST['uid'])); $_REQUEST['keyword'] && ($where['uname|email'] = array('LIKE', '%' . text($_REQUEST['keyword']) . '%')); $_REQUEST['keyword'] && ($seach['keyword'] = text($_REQUEST['keyword'])); // $where['email'] = array('LIKE','%'.text($_REQUEST['keyword']).'%'); $countuser = $this->member->getMemberList('count', $where); $page = new Page($countuser, 4); $userlist = $this->member->getMemberList("{$page->firstRow},{$page->listRows}", $where); $this->assign('ulist', $userlist); $this->assign('page', $page->show()); $this->assign('sex', array('男', '女')); $this->assign('count', $countuser); $this->assign('action', 'index'); $this->assign('seach', $seach); $this->display(); }
function comment() { $sid = intval($_REQUEST['sid']); //资源评论 $count = $this->Sourc->comment('count', array('sourc_id' => $sid)); $page = new Page($count, 10, array('ajax' => true, 'url' => U('Home/Content/comment', array('sid' => $sid)))); $comment = $this->Sourc->comment("{$page->firstRow},{$page->listRows}", array('sourc_id' => $sid, 'reply_id' => 0)); // dump($comment); //返回评论用户信息 $uids = arr2to1($comment, 'uid', 'reply'); $userinfo = $this->member->getMemberInfo($uids, 'id,uname,avatar'); $this->assign('comment', $comment); $this->assign('userinfo', $userinfo); $this->assign('mulit', true); $html = $this->fetch(); $data = array(); $data['html'] = $html; $data['show'] = $page->show(); echo json_encode($data); }
/** * 搜索 * @author MaWei (http://www.phpyrb.com) * @date 2014-10-7 上午1:36:58 */ function search() { //分类筛选条件 $where = array(); $cid = $_REQUEST['cid'] ? intval($_REQUEST['cid']) : null; if ($cid) { $cateid = array(); $children = $cateid = $this->CateTag->getCateChildren($cid); array_push($cateid, "{$cid}"); $where['cateid'] = array('IN', implode(',', $cateid)); } //标签 if ($_REQUEST['tid']) { $tid = intval($_REQUEST['tid']); $where['_string'] = 'FIND_IN_SET(' . $tid . ',`tagid`)'; } //关键字 $keyword = text($_REQUEST['keyword']); $keyword && ($where['title'] = array('LIKE', '%' . $keyword . '%')); //筛选条件 $cond = array(); $cond['keyword'] = $keyword; //筛选结果分页 $count = $this->Sourc->sourc('count', $where); $page = new Page($count, 20); $list = $this->Sourc->sourc("{$page->firstRow},{$page->listRows}", $where); $list = $this->Sourc->tagtoarrray($list); $this->assign('children', $children); $this->assign('list', $list); $this->assign('cid', $cid); $this->assign('tid', $tid); $this->assign('page', $page->show()); $this->assign('count', $count); $this->assign('keyword', $keyword); $this->display(); }