public function photos()
 {
     $pid = I('get.pid', 1);
     $catamodel = M('catagory');
     $catalist = $catamodel->field('id,name')->select();
     $projmodel = M('project');
     $preview = $projmodel->where(array('id' => $pid))->getField('preview');
     $projphotomodel = M('projectphoto');
     $projphotomodelmap = array('pid' => $pid);
     $count = $projphotomodel->where($projphotomodelmap)->count();
     $p = new \Org\Util\Page($count, 9);
     $p->setConfig('prev', '<img src="' . SITE_PATH . 'Public/Img/GC/prev_button.png"></img>');
     $p->setConfig('next', '<img src="' . SITE_PATH . 'Public/Img/GC/next_button.png"></img>');
     $p->setConfig('last', 'the last Page');
     $p->setConfig('first', 'the first Page');
     $p->setConfig('theme', '%upPage% %first%  %prePage% %linkPage%  %downPage%  %nextPage% %end%');
     $list = $projphotomodel->where($projphotomodelmap)->order('`id` DESC')->limit($p->firstRow . "," . $p->listRows)->select();
     $show = $p->show();
     $this->assign("show", $show);
     $this->assign('catalist', $catalist);
     $this->assign('photolist', $list);
     $this->assign('preview', $preview);
     $this->assign('pid', $pid);
     $this->assign('refurl', 'Public/Img/GC/banners/banner_clientlist.png');
     $this->display('index');
 }
 public function index()
 {
     //列出产品、分页
     $cid = intval(I('get.cid', 0));
     $pagecid = '';
     //分页用
     $cond = '';
     //新闻查询条件
     $cate_id = 0;
     if ($cid) {
         $pagecid = '/cid/' . $cid;
         $cond = 'cid=' . $cid;
         $artcate = M('artcates')->where("cid=%d", $cid)->find();
         if ($artcate['pid'] != '0') {
             $cate_id = $artcate['pid'];
         }
     }
     $this->assign('cid', $cid);
     $this->assign('cate_id', $cate_id);
     $totalRows = M('articles')->where($cond)->count();
     import("Org.Util.Page");
     $listcount = M('setting')->find();
     $Page = new \Org\Util\Page($totalRows, $listcount['list_news'], '', 'article/index' . $pagecid);
     //分页语种自定义
     $Page->setConfig('header', '');
     $Page->setConfig('first', '<<');
     $Page->setConfig('last', '>>');
     $Page->setConfig('theme', '<ul class="pagination"><li>%header%</li><li>%first%</li><li>%prePage%</li>%linkPage%<li>%nextPage%</li><li>%end%</li></ul>');
     $show = $Page->show();
     $articles = M('articles')->where($cond)->field("aid,cid,posttime,title,author,content")->order("ordernum,aid")->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $this->assign('articles', $articles);
     $this->assign('pageStr', $show);
     //seo信息
     $seo = M('channels')->where("name='article'")->field('title,seotitle,metakeywords,metadesc')->find();
     $this->assign('seo', $seo);
     //location位置信息
     if ($cid) {
         if ($artcate['seotitle']) {
             $seo['seotitle'] = $artcate['seotitle'];
         }
         if ($artcate['metakeywords']) {
             $seo['metakeywords'] = $artcate['metakeywords'];
         }
         if ($artcate['metadesc']) {
             $seo['metadesc'] = $artcate['metadesc'];
         }
         $location = "<li><a href='/article.html'>" . $seo['title'] . "</a></li><li class='active'>" . $artcate['title'] . "</li>";
     } else {
         $location = "<li class='active'>" . $seo['title'] . "</li>";
     }
     $this->assign('location', $location);
     $this->display('list');
 }
 public function index()
 {
     //列出产品、分页
     $Cases = D('cases');
     $catetype = 0;
     $catequery = "protype=all";
     $pagecid = "";
     if (I('get.protype')) {
         $cond = intval(I('get.protype'));
         $this->assign('activetype', $cond);
         $cond = "protype={$cond}";
         $catequery = $cond;
         $pagecid = "/protype/" . I("get.protype");
     } elseif (I('get.areatype')) {
         $cond = intval(I('get.areatype'));
         $this->assign('activetype', $cond);
         $cond = "areatype={$cond}";
         $catequery = $cond;
         $catetype = 1;
         $pagecid = "/areatype/" . I("get.areatype");
     }
     $this->assign('catequery', $catequery);
     $this->assign('catetype', $catetype);
     $totalRows = $Cases->where($cond)->count();
     import("Org.Util.Page");
     $Page = new \Org\Util\Page($totalRows, 36, "", "cases/index{$pagecid}");
     //分页语种自定义
     $Page->setConfig('header', '');
     $Page->setConfig('first', '<<');
     $Page->setConfig('last', '>>');
     $Page->setConfig('theme', '<ul class="pagination"><li>%header%</li><li>%first%</li><li>%prePage%</li>%linkPage%<li>%nextPage%</li><li>%end%</li></ul>');
     $show = $Page->show();
     $cases = $Cases->where($cond)->field("caseid,protype,areatype,posttime,title,picpath")->order('posttime desc,caseid')->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $this->assign('cases', $cases);
     $this->assign('pageStr', $show);
     //左侧产品分类
     $Procates = D('Procates');
     $pars = $Procates->where('pid=0')->order('ordernum,cid')->select();
     $this->assign('procates', $pars);
     //seo信息
     $seo = D('channels')->where("name='case'")->field('title,seotitle,metakeywords,metadesc')->find();
     $this->assign('seo', $seo);
     //location位置信息
     $location = "<li class='active'><a href='/cases.html'>工程案例</a></li>";
     $this->assign('location', $location);
     $this->display('list', 'utf-8');
 }
 public function manage()
 {
     $cid = intval(I('get.cid'));
     $keyword = trim(I('get.k'));
     $orderby = I('get.orderby');
     $orderby = empty($orderby) ? "ordernum,id" : $orderby;
     $orderbystr = '';
     $keyword = str_replace("*", "%", $keyword);
     if (!empty($cid)) {
         $cond .= "cid={$cid}";
     }
     if (!empty($keyword)) {
         if ($cond != "") {
             $cond .= " and ";
         }
         $cond .= "(title like '%{$keyword}%' or  content like '%{$keyword}%')";
     }
     if (in_array($orderby, array('ordernum,aid', 'posttime', 'hits'))) {
         $orderbystr = $orderby . ' desc';
     }
     $Articles = D('articles');
     $totalRows = $Articles->count();
     import("Org.Util.Page");
     $Page = new \Org\Util\Page($totalRows, '18');
     $Page->setConfig('theme', '<ul class="pagination"><li><a href="javascript:;">%totalRow% %header% %nowPage%/%totalPage% 页</a></li><li> %upPage%</li><li>%downPage%</li><li>%first%</li><li>%prePage%</li>%linkPage%<li>%nextPage%</li><li>%end%</li></ul>');
     $show = $Page->show();
     $articles = $Articles->where($cond)->order($orderbystr)->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $cache_artcates = F('artcates_option');
     $artcates = F('artcates');
     $this->assign('artcates', $artcates);
     $this->assign('options', $cache_artcates);
     $this->assign('articles', $articles);
     $this->assign('pageStr', $show);
     $this->assign('cid', $cid);
     $this->assign('keyword', $keyword);
     $this->assign('orderby', $orderby);
     $this->display();
 }
Beispiel #5
0
 public function _select($tname, $map = array(), $order = '', $sort = '', $asc = false, $query = null)
 {
     $model = D($tname);
     if (isset($_REQUEST['_order'])) {
         $order = $_REQUEST['_order'];
     } else {
         $order = !empty($order) ? $order : $model->getPK();
     }
     if (null === $query) {
         $count = $model->where($map)->count();
     } else {
         $count = $model->count();
     }
     if ($count > 0) {
         if (!empty($_REQUEST['listRows'])) {
             $listRows = $_REQUEST['listRows'];
             cookie($tname . "_listRows", $listRows, 3600);
         } elseif (cookie($tname . "_listRows")) {
             $listRows = cookie($tname . "_listRows");
         } else {
             $pageNum = C("PAGENUM");
             $listRows = !empty($pageNum) ? $pageNum : 12;
         }
         $p = new \Org\Util\Page($count, $listRows);
         $p->setConfig('prev', '«');
         $p->setConfig('next', '»');
         $p->setConfig('last', 'the last Page');
         $p->setConfig('first', 'the first Page');
         $p->setConfig('theme', '%upPage% %first%  %prePage% %linkPage%  %downPage%  %nextPage% %end%');
         if (null === $query) {
             $list = $model->where($map)->order("`" . $order . "` " . $sort)->limit($p->firstRow . "," . $p->listRows)->select();
         } else {
             $query .= " ORDER BY `{$order}` {$sort} LIMIT {$p->firstRow},{$p->listRows}";
             $list = $model->query($query);
         }
         $show = $p->show();
         $this->assign("show", $show);
         $this->assign('list', $list);
         $this->assign("listRows", $listRows);
         $fields = $model->getDbFields();
         $this->assign('fields', $fields);
     }
 }
 public function index()
 {
     //列出产品、分页
     $cid = intval(I('get.cid', 0));
     $pagecid = "";
     //分页用
     $cond = '';
     //产品查询条件
     $cate_id = 0;
     if ($cid) {
         $cond = "cid={$cid}";
         $pagecid = "/cid/{$cid}";
         //左侧产品分类
         $procate = M('procates')->where($cond)->find();
         if ($procate['pid'] != '0') {
             $cate_id = $procate['pid'];
         }
     }
     $this->assign('cid', $cid);
     $this->assign('cate_id', $cate_id);
     $pars = M('procates')->where('pid=0 and ishidden=0')->order('ordernum,cid')->select();
     foreach ($pars as &$par) {
         $par['children'] = array();
         $children = M('procates')->where('pid=%d and ishidden=0', $par['cid'])->order('ordernum,cid')->select();
         if (!$children) {
             continue;
         }
         foreach ($children as $child) {
             array_push($par['children'], $child);
         }
     }
     $this->assign('procates', $pars);
     if ($cid && $procate['pid'] == '0') {
         $cids = M('procates')->where("pid={$cid}")->field('cid')->select();
         if ($cids) {
             $c_cids = '';
             foreach ($cids as $c_cid) {
                 $c_cids .= "','" . $c_cid['cid'];
             }
             $cond = "cid in ('" . $cid . $c_cids . "')";
         }
     }
     $totalRows = M('products')->where($cond)->count();
     import("Org.Util.Page");
     $listcount = M('setting')->find();
     $Page = new \Org\Util\Page($totalRows, $listcount['list_pro'], '', 'product/index' . $pagecid);
     //分页语种自定义
     $Page->setConfig('header', '');
     $Page->setConfig('first', '<<');
     $Page->setConfig('last', '>>');
     $Page->setConfig('theme', '<ul class="pagination"><li>%header%</li><li>%first%</li><li>%prePage%</li>%linkPage%<li>%nextPage%</li><li>%end%</li></ul>');
     $show = $Page->show();
     $products = M('products')->where($cond)->field('proid,cid,posttime,title,serialnum,picpaths')->order('ordernum,posttime desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
     foreach ($products as $k => $product) {
         $picpaths = explode("\t", $product['picpaths']);
         foreach ($picpaths as $picpath) {
             if (!empty($picpath)) {
                 $products[$k]['picpath'] = $picpath;
                 break;
             } else {
                 $products[$k]['picpath'] = "default.jpg";
             }
         }
     }
     $this->assign('products', $products);
     $this->assign('pageStr', $show);
     //seo信息
     $seo = M('channels')->field('title,seotitle,metakeywords,metadesc')->where("name='product'")->find();
     //location位置信息
     if ($cid) {
         if ($procate['seotitle']) {
             $seo['seotitle'] = $procate['seotitle'];
         }
         if ($procate['metakeywords']) {
             $seo['metakeywords'] = $procate['metakeywords'];
         }
         if ($procate['metadesc']) {
             $seo['metadesc'] = $procate['metadesc'];
         }
         $location = "<li><a href='/product.html'>" . $seo['title'] . "</a></li><li class='active'>" . $procate['title'] . "</li>";
     } else {
         $location = "<li class='active'>" . $seo['title'] . "</li>";
     }
     $this->assign('seo', $seo);
     $this->assign('location', $location);
     $this->display('list');
 }
 public function _select($tname, $map = array(), $order = '', $sort = '', $asc = false, $query = null)
 {
     $model = D($tname);
     if (isset($_REQUEST['_order'])) {
         $order = $_REQUEST['_order'];
     } else {
         $order = !empty($order) ? $order : $model->getPK();
     }
     if (null === $query) {
         $count = $model->where($map)->count();
     } else {
         $count = $model->count();
     }
     if ($count > 0) {
         if (!empty($_REQUEST['listRows'])) {
             $listRows = $_REQUEST['listRows'];
             cookie($tname . "_listRows", $listRows, 3600);
         } elseif (cookie($tname . "_listRows")) {
             $listRows = cookie($tname . "_listRows");
         } else {
             $pageNum = C("PAGENUM");
             $listRows = !empty($pageNum) ? $pageNum : 12;
         }
         $p = new \Org\Util\Page($count, $listRows);
         $p->setConfig('prev', '«');
         $p->setConfig('next', '»');
         $p->setConfig('last', 'the last Page');
         $p->setConfig('first', 'the first Page');
         $p->setConfig('theme', '%upPage% %first%  %prePage% %linkPage%  %downPage%  %nextPage% %end%');
         if (null === $query) {
             $list = $model->where($map)->order("`" . $order . "` " . $sort)->limit($p->firstRow . "," . $p->listRows)->select();
         } else {
             $query .= " ORDER BY `{$order}` {$sort} LIMIT {$p->firstRow},{$p->listRows}";
             $list = $model->query($query);
         }
         // Special assignments
         if (false !== strpos($tname, 'member_enquiry_details')) {
             $db_property = M('property_' . $this->lang);
             foreach ($list as &$row) {
                 $property_info = $db_property->find($row['property_id']);
                 $row['property'] = $property_info['name'];
             }
         }
         $show = $p->show();
         $this->assign("show", $show);
         $this->assign('list', $list);
         $this->assign("listRows", $listRows);
         $fields = $model->getDbFields();
         $this->assign('fields', $fields);
     }
 }