Ejemplo n.º 1
0
 function delete()
 {
     //先找出要删除的所有ID,然后一个个删
     $grpid = $_POST['grpid'];
     $grp = M('grp');
     ///
     $grpo = $grp->where('grpid=' . $grpid)->find();
     $grppid = $grpo['grppid'];
     $grpls = $grp->order('grpodr ASC')->select();
     import('@.TREE.TreeAction');
     $tree = new TreeAction();
     //找他的子嗣
     $sons = $tree->unlimitedForListID($grpls, $grpid, 'grpid', 'grpnm', 'grppid', 'grpodr');
     $grpidu = '-' . $grpid . '-' . $sons;
     $epldgrpidu = explode('-', $grpidu);
     for ($i = 1; $i < count($epldgrpidu) - 1; $i++) {
         //通过grp建立的usr-rl 关系也应该不复存在
         //有多少员工usrs
         $usrgrp = M('usrgrp');
         $usrgrpls = $usrgrp->where('f_usrgrp_grpid=' . $epldgrpidu[$i])->select();
         //重点在usrs
         //下头有多少岗位rl
         $grprl = M('grprl');
         $grprlls = $grprl->where('f_grprl_grpid=' . $epldgrpidu[$i])->select();
         //重点在rls
         //管他三七二十一删删删
         $usrrl = M('usrrl');
         for ($i = 0; $i < count($usrgrpls); $i++) {
             for ($j = 0; $j < count($grprlls); $j++) {
                 $usrrl->where('f_usrrl_usrid=' . $usrgrpls[$i]['f_usrgrp_usrid'] . ' AND f_usrrl_rlid=' . $grprlls[$j]['f_grprl_rlid'])->delete();
             }
         }
         $usrgrp = M('usrgrp');
         $usrgrp->where('f_usrgrp_grpid=' . $epldgrpidu[$i])->delete();
         $grprl = M('grprl');
         $grprl->where('f_grprl_grpid=' . $epldgrpidu[$i])->delete();
         if ($grp->delete($epldgrpidu[$i])) {
             //$this->success('删除成功');
             $data['status'] = 1;
         } else {
             $data['status'] = 2;
             //$this->error($u->getLastSql());
         }
         ///给剩下的进行排序
         $grpls = $grp->where('grppid=' . $grppid)->order('grpodr ASC')->select();
         for ($i = 0; $i < count($grpls); $i++) {
             $dt = array('grpodr' => $i + 1);
             $grp->where('grpid=' . $grpls[$i]['grpid'])->setField($dt);
         }
     }
     $this->ajaxReturn($data, 'json');
 }
Ejemplo n.º 2
0
 public function index()
 {
     //处理ss
     import('@.SS.SSAction');
     $ss = new SSAction();
     $ss->setss();
     //设置 导航 bd
     import('@.TREE.TreeAction');
     $tree = new TreeAction();
     // 		import('@.NTF.NTFAction');
     // 		$ntf = new NTFAction();
     // 		$ntf->setntf();
     import('@.NV.NVAction');
     $nv = new NVAction();
     $nv->setnv();
     $atc = M('atc');
     //获得焦点图
     $atcfcsls = $atc->join('tb_bd ON f_atc_bdid=bdid')->where("atcps=1 AND atcvw=1 AND atcnw=0 AND atcdnmc=1 AND atccv<>'dflt'")->order('atctp DESC,atcmdftm DESC')->limit(0, 5)->select();
     for ($i = 0; $i < count($atcfcsls); $i++) {
         if (mb_strlen($atcfcsls[$i]['atctpc'], 'utf-8') > 10) {
             $atcfcsls[$i]['atctpcsrk'] = mb_substr($atcfcsls[$i]['atctpc'], 0, 10, 'utf-8') . '...';
         } else {
             $atcfcsls[$i]['atctpcsrk'] = $atcfcsls[$i]['atctpc'];
         }
         if ($i == 0) {
             $atcfcsls[$i]['class'] = 'active';
         } else {
             $atcfcsls[$i]['class'] = '';
         }
     }
     $this->assign('atcfcsls', $atcfcsls);
     //左侧部分的文章
     //首先找出所有第一级的bd
     $bd = M('bd');
     $bdls = $bd->order('bdodr ASC')->select();
     //在按照这个顺序前提下,使用tree方法就能有序的得到
     $bdlsnog = $bd->where('bdpid=0')->order('bdodr ASC')->select();
     //NO 1 generation
     for ($i = 0; $i < count($bdlsnog); $i++) {
         $bdidall = $tree->unlimitedForListID($bdls, $bdlsnog[$i]['bdid'], 'bdid', 'bdnm', 'bdpid', 'bdodr');
         //设置搜索条件
         $sccdt = 'f_atc_bdid=' . $bdlsnog[$i]['bdid'];
         $tmp = explode('-', $bdidall);
         for ($j = 0; $j < count($tmp); $j++) {
             if ($tmp[$j] != '') {
                 $sccdt = $sccdt . ' OR f_atc_bdid=' . $tmp[$j];
             }
         }
         $atcls = $atc->field('atcid,atctpc,atcmdftm,atctp')->where("atcps=1 AND atcvw=1 AND atcnw='n' AND (" . $sccdt . ")")->order('atctp DESC,atcmdftm DESC')->limit(0, 6)->select();
         for ($j = 0; $j < count($atcls); $j++) {
             if (mb_strlen($atcls[$j]['atctpc'], 'utf-8') > 15) {
                 $atcls[$j]['atctpcsrk'] = mb_substr($atcls[$j]['atctpc'], 0, 15, 'utf-8') . '...';
             } else {
                 $atcls[$j]['atctpcsrk'] = $atcls[$j]['atctpc'];
             }
             $time = strtotime($atcls[$j]['atcmdftm']);
             $atcls[$j]['atcmdftm'] = date("Y/m/d", $time);
             if ($atcls[$j]['atctp'] == 1) {
                 $atcls[$j]['atcstyle'] = 'font-weight:bold';
                 $atcls[$j]['atcflag'] = 'glyphicon glyphicon-equalizer';
             }
         }
         //$this->assign('atcls'.$bdlsnog[$i]['bdid'],$atcls);
         $bdlsnog[$i]['atcls'] = $atcls;
     }
     $this->assign('bdlsnog', $bdlsnog);
     //获得通知公告
     $atcls = $atc->field('atcid,atctpc,atcmdftm,atctp')->where("atcps=1 AND atcvw=1 AND atcnw=0 AND atcanc=1")->order('atctp DESC,atcmdftm DESC')->limit(0, 6)->select();
     for ($j = 0; $j < count($atcls); $j++) {
         $time = strtotime($atcls[$j]['atcmdftm']);
         $atcls[$j]['atcmdftm'] = date("Y/m/d", $time);
         if ($atcls[$j]['atctp'] == 1) {
             $atcls[$j]['atcstyle'] = 'font-weight:bold';
             $atcls[$j]['atcflag'] = 'glyphicon glyphicon-equalizer';
         }
     }
     $this->assign('atclsanc', $atcls);
     //获得院校动态
     $atcls = $atc->field('atcid,atctpc,atcmdftm,atctp')->where("atcps=1 AND atcvw=1 AND atcnw=0 AND atcdnmc=1")->order('atctp DESC,atcmdftm DESC')->limit(0, 6)->select();
     for ($j = 0; $j < count($atcls); $j++) {
         $time = strtotime($atcls[$j]['atcmdftm']);
         $atcls[$j]['atcmdftm'] = date("Y/m/d", $time);
         if ($atcls[$j]['atctp'] == 1) {
             $atcls[$j]['atcstyle'] = 'font-weight:bold';
             $atcls[$j]['atcflag'] = 'glyphicon glyphicon-equalizer';
         }
     }
     $this->assign('atclsdnmc', $atcls);
     //获得二维码
     //首先获得服务器的广域网域名
     $sys = M('sys');
     $syso = $sys->find();
     $url = 'http://' . $syso['sysip'] . '/' . $syso['sysnm'] . '/wap.php';
     $this->assign('url', $url);
     import('@.QR.QRAction');
     $qr = new QRAction();
     $qrimgurl = $qr->getQR($url);
     $qr = $qrimgurl;
     $this->assign('qr', $qr);
     //通用部分
     $this->assign('title', 'Geek标准');
     $this->assign('theme', 'Geek主题');
     $this->display('index');
 }
Ejemplo n.º 3
0
 function query()
 {
     header("Content-Type:text/html; charset=utf-8");
     //处理ss
     import('@.SS.SSAction');
     $ss = new SSAction();
     $ss->setss();
     //设置 导航 bd
     import('@.TREE.TreeAction');
     $tree = new TreeAction();
     // 		import('@.NTF.NTFAction');
     // 		$ntf = new NTFAction();
     // 		$ntf->setntf();
     import('@.NV.NVAction');
     $nv = new NVAction();
     $nv->setnv();
     $atc = M('atc');
     $bd = M('bd');
     //设置每页多少条
     $lmt = 10;
     if ($_GET['atcanc']) {
         $sccdt = "atcanc=1";
         $bdo['bdnm'] = "<ol class='breadcrumb'><li><a href='" . __APP__ . "'>首页</a></li><li><a href='#'>通知公告</a></li></ol>";
         $this->assign('bdo', $bdo);
     } else {
         if ($_GET['atcdnmc']) {
             $sccdt = "atcdnmc=1";
             $bdo['bdnm'] = "<ol class='breadcrumb'><li><a href='" . __APP__ . "'>首页</a></li><li><a href='#'>动态</a></li></ol>";
             $this->assign('bdo', $bdo);
         } else {
             if ($_GET['atckw']) {
                 //考虑到show里面会有get现象
                 $atckw = $_GET['atckw'];
                 $tmp = explode(' ', $atckw);
                 $sccdt = '1=2';
                 foreach ($tmp as $v) {
                     $ctt = trim($v);
                     if ($ctt != '') {
                         $sccdt = $sccdt . " OR atcctt LIKE '%" . $ctt . "%'";
                         $sccdt = $sccdt . " OR atctpc LIKE '%" . $ctt . "%'";
                     }
                 }
                 $bdo['bdnm'] = "<ol class='breadcrumb'><li><a href='" . __APP__ . "'>首页</a></li><li><a href='#'>“" . $atckw . "”&nbsp;&nbsp;的搜索结果</a></li></ol>";
                 $this->assign('bdo', $bdo);
             } else {
                 $bdid = $_GET['bdid'];
                 $bdo = $bd->where('bdid=' . $bdid)->find();
                 $bdls = $bd->order('bdodr ASC')->select();
                 //在按照这个顺序前提下,使用tree方法就能有序的得到
                 $str = $tree->findF($bdls, $bdid, 'bdid', 'bdnm', 'bdpid');
                 $bdo['bdnm'] = "<ol class='breadcrumb'><li><a href='" . __APP__ . "'>首页</a></li>" . $str . "</ol>";
                 $this->assign('bdo', $bdo);
                 $bdidall = $tree->unlimitedForListID($bdls, $bdid, 'bdid', 'bdnm', 'bdpid', 'bdodr');
                 //设置搜索条件
                 $sccdt = 'f_atc_bdid=' . $bdid;
                 $tmp = explode('-', $bdidall);
                 for ($j = 0; $j < count($tmp); $j++) {
                     if ($tmp[$j] != '') {
                         $sccdt = $sccdt . ' OR f_atc_bdid=' . $tmp[$j];
                     }
                 }
             }
         }
     }
     $count = $atc->field('atctpc,atcmdftm,atctp')->where("atcps=1 AND atcvw=1 AND atcnw=0  AND (" . $sccdt . ")")->order('atctp DESC,atcmdftm DESC')->count();
     //分页显示列表,每页10条
     import('ORG.Util.Page');
     $page = new Page($count, $lmt);
     //后台管理页面默认一页显示N条记录
     $page->rollPage = $count;
     $page->setConfig('prev', "&laquo; 上一页");
     //上一页
     $page->setConfig('next', '下一页 &raquo;');
     //下一页
     $page->setConfig('first', '&laquo; 首页');
     //第一页
     $page->setConfig('last', '末页 &raquo;');
     //最后一页
     $page->setConfig('theme', '共%totalPage%页/%totalRow%%header% %first% %upPage%  %linkPage%  %downPage% ');
     //设置分页回调方法
     $show = $page->show();
     $show = str_replace("<a>", "&nbsp;<a>", $show);
     $show = str_replace("</a>", "</a>&nbsp;", $show);
     $show = str_replace("<span>", "&nbsp;<span>", $show);
     $show = str_replace("</span>", "</span>&nbsp;", $show);
     $show = $show . '&nbsp;&nbsp;每页' . $lmt . '条';
     $this->assign('show', $show);
     $atcls = $atc->field('atcid,atctpc,atcmdftm,atctp')->where("atcps=1 AND atcvw=1 AND atcnw=0 AND (" . $sccdt . ")")->order('atctp DESC,atcmdftm DESC')->limit($page->firstRow . ',' . $page->listRows)->select();
     for ($j = 0; $j < count($atcls); $j++) {
         if (mb_strlen($atcls[$j]['atctpc'], 'utf-8') > 45) {
             $atcls[$j]['atctpcsrk'] = mb_substr($atcls[$j]['atctpc'], 0, 45, 'utf-8') . '...';
         } else {
             $atcls[$j]['atctpcsrk'] = $atcls[$j]['atctpc'];
         }
         $time = strtotime($atcls[$j]['atcmdftm']);
         $atcls[$j]['atcmdftm'] = date("Y/m/d", $time);
         if ($atcls[$j]['atctp'] == 1) {
             $atcls[$j]['atcstyle'] = 'font-weight:bold';
             $atcls[$j]['atcflag'] = 'glyphicon glyphicon-equalizer';
         }
     }
     $this->assign('atcls', $atcls);
     //通用部分
     $this->assign('title', '文章浏览');
     $this->assign('theme', 'Geek主题');
     $this->display('query');
 }
Ejemplo n.º 4
0
 function appendatc()
 {
     header("Content-Type:text/html; charset=utf-8");
     //设置 导航 bd
     import('@.TREE.TreeAction');
     $tree = new TreeAction();
     $pg = $_POST['pg'];
     $pg = (int) $pg + 1;
     $data['pg'] = $pg;
     $atc = M('atc');
     $bd = M('bd');
     //设置每页多少条//由于采用下拉方案,因此无法享受show方案的参数值续传,得自己来设置
     $lmt = 10;
     if ($_GET['atcanc']) {
         $sccdt = "atcanc=1";
         // 			$bdo['bdnm']="<h1 class='page-header' style='font-size:30px'>通知公告</h1>";
         // 			$this->assign('bdo',$bdo);
         // 			$csm='atcanc';$csz=$_GET['atcanc'];
     } else {
         if ($_GET['atcdnmc']) {
             $sccdt = "atcdnmc=1";
             // 			$bdo['bdnm']="<h1 class='page-header' style='font-size:30px'>动态</h1>";
             // 			$this->assign('bdo',$bdo);
             // 			$csm='atcdnmc';$csz=$_GET['atcdnmc'];
         } else {
             if ($_GET['atckw']) {
                 //考虑到show里面会有get现象
                 $atckw = $_GET['atckw'];
                 $tmp = explode(' ', $atckw);
                 $sccdt = '1=2';
                 foreach ($tmp as $v) {
                     $ctt = trim($v);
                     if ($ctt != '') {
                         $sccdt = $sccdt . " OR atcctt LIKE '%" . $ctt . "%'";
                         $sccdt = $sccdt . " OR atctpc LIKE '%" . $ctt . "%'";
                     }
                 }
                 // 			$bdo['bdnm']="<h1 class='page-header' style='font-size:30px'>“".$atckw."”&nbsp;&nbsp;的搜索结果</h1>";
                 // 			$this->assign('bdo',$bdo);
                 // 			$csm='atckw';$csz=$_GET['atckw'];
             } else {
                 if ($_GET['bdid']) {
                     $bdid = $_GET['bdid'];
                     $bdo = $bd->where('bdid=' . $bdid)->find();
                     $bdls = $bd->order('bdodr ASC')->select();
                     //在按照这个顺序前提下,使用tree方法就能有序的得到
                     // 				$str=$tree->findF($bdls, $bdid, 'bdid','bdnm','bdpid');
                     // 				$bdo['bdnm']="<ol class='breadcrumb'><li><a href='".__APP__."'>首页</a></li>".$str."</ol>";
                     // 				$this->assign('bdo',$bdo);
                     $bdidall = $tree->unlimitedForListID($bdls, $bdid, 'bdid', 'bdnm', 'bdpid', 'bdodr');
                     //设置搜索条件
                     $sccdt = 'f_atc_bdid=' . $bdid;
                     $tmp = explode('-', $bdidall);
                     for ($j = 0; $j < count($tmp); $j++) {
                         if ($tmp[$j] != '') {
                             $sccdt = $sccdt . ' OR f_atc_bdid=' . $tmp[$j];
                         }
                     }
                     // 				$csm='bdid';$csz=$_GET['bdid'];
                 } else {
                     // 				$bdo['bdnm']="<ol class='breadcrumb'><li><a href='".__APP__."'>首页</a></li><li><a href='#'>所有文章</a></li></ol>";
                     // 				$this->assign('bdo',$bdo);
                     $sccdt = '1=1';
                 }
             }
         }
     }
     $atcls = $atc->field('atcid,atctpc,atcmdftm,atctp,atccv,atczn,atctc,atccnt')->where("atcps=1 AND atcvw=1 AND atcnw=0 AND (" . $sccdt . ")")->order('atctp DESC,atcmdftm DESC')->limit(($pg - 1) * $lmt . ',' . $lmt)->select();
     for ($j = 0; $j < count($atcls); $j++) {
         //处理封面
         if ($atcls[$j]['atccv'] == 'dflt') {
             $atcls[$j]['atccv'] = C('PUBLIC') . '/IMG/atcdflt.png';
         }
         //处理题目长度
         if (mb_strlen($atcls[$j]['atctpc'], 'utf-8') > 30) {
             $atcls[$j]['atctpcsrk'] = mb_substr($atcls[$j]['atctpc'], 0, 30, 'utf-8') . '...';
         } else {
             $atcls[$j]['atctpcsrk'] = $atcls[$j]['atctpc'];
         }
         $time = strtotime($atcls[$j]['atcmdftm']);
         $atcls[$j]['atcmdftm'] = date("Y/m/d", $time);
         if ($atcls[$j]['atctp'] == 1) {
             $atcls[$j]['atcstyle'] = 'font-weight:bold';
             $atcls[$j]['atcflag'] = 'glyphicon glyphicon-equalizer';
         }
         //获得评论数
         $cstmcmt = M('cstmcmt');
         $cstmcmtcnt = $cstmcmt->where('f_cstmcmt_atcid=' . $atcls[$j]['atcid'])->count();
         $atcls[$j]['cstmcmtcnt'] = $cstmcmtcnt;
     }
     if ($atc->where("atcps=1 AND atcvw=1 AND atcnw=0 AND (" . $sccdt . ")")->order('atctp DESC,atcmdftm DESC')->limit($pg * $lmt . ',1')->select()) {
         $hsnxt = 'y';
     } else {
         $hsnxt = 'n';
     }
     $data['hsnxt'] = $hsnxt;
     $imax = count($atcls);
     for ($i = 0; $i < $imax; $i++) {
         //书写html
         $htmltxt = $htmltxt . "<div class='panel panel-default'>" . "<div>" . "<div class='panel-body'>" . "<div class='pull-left col-xs-5' style='padding-left:0px'>" . "<img src='" . $atcls[$i]['atccv'] . "' style='width:120px;height:90px' />" . "</div>" . "<div class='pull-left col-xs-7' style='padding-right:0px'>" . "<div>" . "<span><a href='" . __APP__ . "/Atc/view/atcid/" . $atcls[$i]['atcid'] . "' class='pull-left' style='color:#000; " . $atcls[$i]['atcstyle'] . "'><i class='" . $atcls[$i]['atcflag'] . "'></i> " . $atcls[$i]['atctpcsrk'] . "</a></span>" . "</div>" . "<div>" . "<span class='tag' style='color:#ccc'><i class='glyphicon glyphicon-comment'></i> " . $atcls[$i]['cstmcmtcnt'] . "&nbsp;&nbsp;<i class='glyphicon glyphicon-thumbs-up'></i> " . $atcls[$i]['atczn'] . "&nbsp;&nbsp;<i class='glyphicon glyphicon-thumbs-down'></i> " . $atcls[$i]['atctc'] . "&nbsp;&nbsp;<i class='glyphicon glyphicon-eye-open'></i> " . $atcls[$i]['atccnt'] . "</span>" . "</div>" . "<div>" . "<span class='tag' style='color:#ccc'>" . $atcls[$i]['atcmdftm'] . "</span>" . "</div>" . "</div>" . "</div>" . "</div>" . "</div>";
     }
     $data['htmltxt'] = $htmltxt;
     $data['status'] = 1;
     $this->ajaxReturn($data, 'json');
 }
Ejemplo n.º 5
0
 function delete()
 {
     //先找出要删除的所有ID,然后一个个删
     $bdid = $_POST['bdid'];
     $bd = M('bd');
     ///
     $bdo = $bd->where('bdid=' . $bdid)->find();
     $bdpid = $bdo['bdpid'];
     $bdls = $bd->order('bdodr ASC')->select();
     import('@.TREE.TreeAction');
     $tree = new TreeAction();
     //找他的子嗣
     $sons = $tree->unlimitedForListID($bdls, $bdid, 'bdid', 'bdnm', 'bdpid', 'bdodr');
     $bdidu = '-' . $bdid . '-' . $sons;
     $epldbdidu = explode('-', $bdidu);
     for ($i = 1; $i < count($epldbdidu) - 1; $i++) {
         //删除板块自然删除板块中的文章
         $atc = M('atc');
         $atcls = $atc->where('f_atc_bdid=' . $epldbdidu[$i])->select();
         foreach ($atcls as $v) {
             $atcid = $v['atcid'];
             //用户评论//cstm评论//用户收藏//cstm收藏
             $cmt = M('cmt');
             $cmt->where('f_cmt_atcid=' . $atcid)->delete();
             $cstmcmt = M('cstmcmt');
             $cstmcmt->where('f_cstmcmt_atcid=' . $atcid)->delete();
             $atcclct = M('atcclct');
             $atcclct->where('f_atcclct_atcid=' . $atcid)->delete();
             $cstmatcclct = M('cstmatcclct');
             $cstmatcclct->where('f_cstmatcclct_atcid=' . $atcid)->delete();
         }
         $atc->where('f_atc_bdid=' . $epldbdidu[$i])->delete();
         if ($bd->delete($epldbdidu[$i])) {
             //$this->success('删除成功');
             $data['status'] = 1;
         } else {
             $data['status'] = 2;
             //$this->error($u->getLastSql());
         }
     }
     ///给剩下的进行排序//子孙们都删光光了,也只要对自己或者的弟兄排序就行了
     $bdls = $bd->where('bdpid=' . $bdpid)->order('bdodr ASC')->select();
     for ($i = 0; $i < count($bdls); $i++) {
         $dt = array('bdodr' => $i + 1);
         $bd->where('bdid=' . $bdls[$i]['bdid'])->setField($dt);
     }
     $this->ajaxReturn($data, 'json');
 }