public static function unlimitedForListSLCT($cate, $pid, $idzd, $nmzd, $pidzd, $odrzd) { $str = ''; foreach ($cate as $v) { if ($v[$pidzd] == $pid) { $hg = TreeAction::henggang($cate, $v[$idzd], $idzd, $pidzd); $str = $str . "<option value='" . $v[$idzd] . "'>" . $hg . $v[$nmzd] . '</option>'; $str = $str . self::unlimitedForListSLCT($cate, $v[$idzd], $idzd, $nmzd, $pidzd, $odrzd); } } if ($str == '') { return ''; } else { return $str; // } }
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'); }
function query() { header("Content-Type:text/html; charset=utf-8"); //先给hd设置好些东西,他自身是无法提取的 import('@.SS.SSAction'); $ss = new SSAction(); $ss->setss(); //鉴权 如果OK的就正常显示,或者出现查看神马的,否则就呵呵了,query he gtxpg两处 $mdII = M('md'); $mdo = $mdII->where("mdmk='Cstmusrcstmrl'")->find(); import('@.IDTATH.IdtathAction'); $Idtath = new IdtathAction(); $athofn = $Idtath->identify($mdo['mdid'], 'qry'); import('@.NTF.NTFAction'); $ntf = new NTFAction(); $ntf->setntf(); import('@.KZMB.KZMBAction'); $kzmb = new KZMBAction(); $kzmb->setkzmb($mdo['mdid']); //NB初始化,开始 $cstmusrcstmrl = M('cstmusrcstmrl'); $fldint = '-cstmusrcstmrlid-cstmusrnm-cstmusrnn-cstmgrpid-cstmgrpnm-cstmrlnm-'; $cdtint = "-sp-"; $spccdtint = '-sp-'; //// $odrint = ''; $lmtint = 20; $jn = 'tb_cstmusr ON f_cstmusrcstmrl_cstmusrid=cstmusrid-jn-tb_cstmrl ON f_cstmusrcstmrl_cstmrlid=cstmrlid-jn-tb_cstmgrpcstmrl ON f_cstmusrcstmrl_cstmrlid=f_cstmgrpcstmrl_cstmrlid-jn-tb_cstmgrp ON f_cstmgrpcstmrl_cstmgrpid=cstmgrpid'; //$jn='tb_cstmusr ON f_cstmusrcstmrl_cstmusrid=cstmusrid-jn-tb_atc ON f_cstmusrcstmrl_cstmusrid=atcid';//若出现多个join import('@.NB.NBAction'); $NB = new NBAction(); $arr = $NB->NB($cstmusrcstmrl, $fldint, $cdtint, $spccdtint, $odrint, $lmtint, $jn); //// // $arr=NB($u,$fldint,$cdtint,$odrint,$lmtint,$jn); $this->assign('fstrw', $arr['fstrw']); $this->assign('sqlstc', $arr['sqlstc']); $this->assign('fld', $arr['fld']); $this->assign('cdt', $arr['cdt']); $this->assign('spccdt', $arr['spccdt']); //// $this->assign('odr', $arr['odr']); $this->assign('lmt', $arr['lmt']); $this->assign('count', $arr['count']); $this->assign('mls', $arr['mls']); $this->assign('page_method', $arr['page_method']); //NB初始化,结束 //q特殊 $cstmusrcstmgrp = M('cstmusrcstmgrp'); $cstmusrcstmgrpls = $cstmusrcstmgrp->Distinct(true)->field('cstmusrid,cstmusrnm')->join('tb_cstmusr ON f_cstmusrcstmgrp_cstmusrid=cstmusrid')->join('tb_cstmgrp ON f_cstmusrcstmgrp_cstmgrpid=cstmgrpid')->select(); $this->assign('cstmusrls', $cstmusrcstmgrpls); import('@.TREE.TreeAction'); $tree = new TreeAction(); $cstmgrp = M('cstmgrp'); $cstmgrpls = $cstmgrp->order('cstmgrpodr ASC')->select(); //在按照这个顺序前提下,使用tree方法就能有序的得到 $str = $tree->unlimitedForListSLCT($cstmgrpls, 0, 'cstmgrpid', 'cstmgrpnm', 'cstmgrppid', 'cstmgrpodr'); $this->assign('tree', $str); //若cstmgrpid 有限制的话,那么cstmrl必须是要 该相应的cstmgrp下面 //q特殊 $cdt = $arr['cdt']; $cstmgrp = M('cstmgrp'); $where = '1=1'; if (preg_match('/cstmgrpid/', $cdt)) { //获取该键的值 $tmp = explode('cstmgrpid', $cdt); $tmp = explode('-eq-', $tmp[1]); $tmp = explode('-sp-', $tmp[1]); $where = $where . ' AND cstmgrpid=' . $tmp[0]; } $cstmgrpo = $cstmgrp->where($where)->find(); $cstmgrpcstmrl = M('cstmgrpcstmrl'); $cstmgrpcstmrlls = $cstmgrpcstmrl->join('tb_cstmgrp ON f_cstmgrpcstmrl_cstmgrpid=cstmgrpid')->join('tb_cstmrl ON f_cstmgrpcstmrl_cstmrlid=cstmrlid')->where($where)->select(); $this->assign('cstmrlls', $cstmgrpcstmrlls); $cstmusr = M('cstmusr'); $cstmsucstmrls = $cstmusr->join('tb_cstmusrcstmgrp ON cstmusrid=f_cstmusrcstmgrp_cstmusrid')->select(); $this->assign('cstmusrls', $cstmsucstmrls); //q特殊 $this->assign('title', '浏览客户用户-客户角色列表'); $this->assign('theme', '客户用户-客户角色管理'); $this->display('query'); }
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'); }
function query() { header("Content-Type:text/html; charset=utf-8"); //先给hd设置好些东西,他自身是无法提取的 import('@.SS.SSAction'); $ss = new SSAction(); $ss->setss(); //鉴权 如果OK的就正常显示,或者出现查看神马的,否则就呵呵了,query he gtxpg两处 $mdII = M('md'); $mdo = $mdII->where("mdmk='Cstmgrpcstmrl'")->find(); import('@.IDTATH.IdtathAction'); $Idtath = new IdtathAction(); $athofn = $Idtath->identify($mdo['mdid'], 'qry'); import('@.NTF.NTFAction'); $ntf = new NTFAction(); $ntf->setntf(); import('@.KZMB.KZMBAction'); $kzmb = new KZMBAction(); $kzmb->setkzmb($mdo['mdid']); //NB初始化,开始 $cstmgrpcstmrl = M('cstmgrpcstmrl'); $fldint = '-cstmgrpcstmrlid-cstmgrpnm-cstmrlnm-'; $cdtint = "-sp-"; $spccdtint = '-sp-'; //// $odrint = ''; $lmtint = 20; $jn = 'tb_cstmgrp ON f_cstmgrpcstmrl_cstmgrpid=cstmgrpid-jn-tb_cstmrl ON f_cstmgrpcstmrl_cstmrlid=cstmrlid'; //$jn='tb_cstmgrp ON f_cstmgrpcstmrl_cstmgrpid=cstmgrpid-jn-tb_atc ON f_cstmgrpcstmrl_cstmgrpid=atcid';//若出现多个join import('@.NB.NBAction'); $NB = new NBAction(); $arr = $NB->NB($cstmgrpcstmrl, $fldint, $cdtint, $spccdtint, $odrint, $lmtint, $jn); //// // $arr=NB($u,$fldint,$cdtint,$odrint,$lmtint,$jn); $this->assign('fstrw', $arr['fstrw']); $this->assign('sqlstc', $arr['sqlstc']); $this->assign('fld', $arr['fld']); $this->assign('cdt', $arr['cdt']); $this->assign('spccdt', $arr['spccdt']); //// $this->assign('odr', $arr['odr']); $this->assign('lmt', $arr['lmt']); $this->assign('count', $arr['count']); $this->assign('mls', $arr['mls']); $this->assign('page_method', $arr['page_method']); //NB初始化,结束 //q特殊 import('@.TREE.TreeAction'); $tree = new TreeAction(); $cstmgrp = M('cstmgrp'); $cstmgrpls = $cstmgrp->order('cstmgrpodr ASC')->select(); //在按照这个顺序前提下,使用tree方法就能有序的得到 $str = $tree->unlimitedForListSLCT($cstmgrpls, 0, 'cstmgrpid', 'cstmgrpnm', 'cstmgrppid', 'cstmgrpodr'); $this->assign('tree', $str); $cstmrl = M('cstmrl'); $cstmrlls = $cstmrl->select(); $this->assign('cstmrlls', $cstmrlls); //q特殊 $this->assign('title', '浏览团队-客户角色列表'); $this->assign('theme', '团队-客户角色管理'); $this->display('query'); }
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."” 的搜索结果</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'] . " <i class='glyphicon glyphicon-thumbs-up'></i> " . $atcls[$i]['atczn'] . " <i class='glyphicon glyphicon-thumbs-down'></i> " . $atcls[$i]['atctc'] . " <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'); }
function query() { header("Content-Type:text/html; charset=utf-8"); //先给hd设置好些东西,他自身是无法提取的 import('@.SS.SSAction'); $ss = new SSAction(); $ss->setss(); //鉴权 如果OK的就正常显示,或者出现查看神马的,否则就呵呵了,query he gtxpg两处 $mdII = M('md'); $mdo = $mdII->where("mdmk='Atc'")->find(); import('@.IDTATH.IdtathAction'); $Idtath = new IdtathAction(); $athofn = $Idtath->identify($mdo['mdid'], 'qry'); import('@.NTF.NTFAction'); $ntf = new NTFAction(); $ntf->setntf(); import('@.KZMB.KZMBAction'); $kzmb = new KZMBAction(); $kzmb->setkzmb($mdo['mdid']); //NB初始化,开始 $atc = M('atc'); $fldint = '-atcid-bdnm-atctpc-atcath-atcaddtm-atcmdftm-atctp-atcps-atcanc-atcdnmc-atccnt-atcnw-atczn-atctc-atcvw-atczs-'; if ($athofn['athm'] == 1 || $athofn['aths'] == 1) { $cdtint = "-sp-"; } else { $cdtint = '-sp-atcps-eq-1-sp-atcvw-eq-1-sp-'; } $spccdtint = '-sp-'; //// $odrint = '-atctp DESC-atcmdftm DESC-'; $lmtint = 20; $jn = 'tb_bd ON f_atc_bdid=bdid'; //$jn='tb_ath ON f_atc_athid=athid-jn-tb_atc ON f_atc_athid=atcid';//若出现多个join import('@.NB.NBAction'); $NB = new NBAction(); $arr = $NB->NB($atc, $fldint, $cdtint, $spccdtint, $odrint, $lmtint, $jn); //// // $arr=NB($u,$fldint,$cdtint,$odrint,$lmtint,$jn); //1、0是否化 $mls = $arr['mls']; $mlsfn = array(); foreach ($mls as $v) { if ($v['atctp'] == 1) { $v['atctp'] = '是'; } else { $v['atctp'] = '否'; } if ($v['atcps'] == 1) { $v['atcps'] = '是'; } else { $v['atcps'] = '否'; } if ($v['atcanc'] == 1) { $v['atcanc'] = '是'; } else { $v['atcanc'] = '否'; } if ($v['atcdnmc'] == 1) { $v['atcdnmc'] = '是'; } else { $v['atcdnmc'] = '否'; } if ($v['atcnw'] == 1) { $v['atcnw'] = '是'; } else { $v['atcnw'] = '否'; } if ($v['atcvw'] == 1) { $v['atcvw'] = '是'; } else { $v['atcvw'] = '否'; } if ($v['atczs'] == 1) { $v['atczs'] = '是'; } else { $v['atczs'] = '否'; } array_push($mlsfn, $v); } $this->assign('fstrw', $arr['fstrw']); $this->assign('sqlstc', $arr['sqlstc']); $this->assign('fld', $arr['fld']); $this->assign('cdt', $arr['cdt']); $this->assign('spccdt', $arr['spccdt']); //// $this->assign('odr', $arr['odr']); $this->assign('lmt', $arr['lmt']); $this->assign('count', $arr['count']); $this->assign('mls', $mlsfn); $this->assign('page_method', $arr['page_method']); //NB初始化,结束 //q特殊 $bd = M('bd'); $bdls = $bd->select(); $this->assign('bdls', $bdls); // import('@.TREE.TreeAction'); $tree = new TreeAction(); $bd = M('bd'); $bdls = $bd->order('bdodr ASC')->select(); //在按照这个顺序前提下,使用tree方法就能有序的得到 $str = $tree->unlimitedForListSLCT($bdls, 0, 'bdid', 'bdnm', 'bdpid', 'bdodr'); $this->assign('tree', $str); //q特殊 $this->assign('title', '浏览文章列表'); $this->assign('theme', '文章管理'); $this->display('query'); }
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 . "” 的搜索结果</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', "« 上一页"); //上一页 $page->setConfig('next', '下一页 »'); //下一页 $page->setConfig('first', '« 首页'); //第一页 $page->setConfig('last', '末页 »'); //最后一页 $page->setConfig('theme', '共%totalPage%页/%totalRow%%header% %first% %upPage% %linkPage% %downPage% '); //设置分页回调方法 $show = $page->show(); $show = str_replace("<a>", " <a>", $show); $show = str_replace("</a>", "</a> ", $show); $show = str_replace("<span>", " <span>", $show); $show = str_replace("</span>", "</span> ", $show); $show = $show . ' 每页' . $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'); }
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'); }