智软工作室主要是为宁波公司提供宁波网站建设,宁波网站制作,宁波做网站公司,宁波外贸网站建设公司,宁波网站优化等项目,以优质的服务,优惠的价格,深的客户信赖。相信有你的加入我们的明天会更有动力!期待与你合作!
  • 宁波智软设计工作室,打造宁波网站制作工作室顶级品牌
  • 智软拥有专业的设计团队
  • 多年网站建设团队为你服务
  • 智软期待与你合作
  • 我们的技能
  • 我们掌握的技能有:dreamweaver,flash,photoshop
  • 宁波高端网站建设服务公司
    2014已经悄然到来,在新的一年我们恭贺所有客户事业蒸蒸日上,同事庆祝智软设计工作室成立5周年,在5周年为众多客户提供了保质量的网站设计与网站制作。 我们在新的一年质量与服务将会更加进一步为更多的客户带来高端的网站设计与服务!期待与你合作
  • 企业网站制作建设原因与服务介绍

    智软设计工作室多年为宁波企业网站制作建设服务一直以来我们以最优惠价格,最优质的质量,最突出的设计!得到了客户的一致认可,我们的服务包括:宁波网站设计,宁波网站建设,宁波网站制作,宁波网站优化,宁波英文网站制作我们会以优质的服务,最低的价格来报答客户!

  • 点击链接网站优化推广介绍

    点击连接网站优化推广-对企业的网站优化和网站推广--对企业的重要性-点击进行详细了解

  • 2014开幕,宁波网站设计服务全面优惠.

    2014开幕,宁波智软设计为宁波企业提供更加优秀的设计和实惠的价格

  • 链接到网站案例展示平台
    智软设计工作为宁波客户网站设计案例展示平台-案例均为定期更新,让新老客户更好的看到我们做的案例,点击查看我们做的网站案例吧!
  • 我们宁波网络公司提供网站一站式解决方案
    智软(宁波网络公司)帮你轻松解决网络问题,网站一站式解决方案
你当前的位置:智软工作室 > 营销与网络 >

dedecms织梦加入多选复制产品,多选更新时间按钮-图集模型为案例

2020-06-06 15:35

 最近帮客户制作网站。客户要求加入多选复制产品,多选更新时间,网上找的都有错误。我修复了下。 

多选复制产品。我是采用的图集模型,写入的sql不一样,然后也修复了 不能复制到同一个栏目的问题。以及复制ajax窗口不能关闭返回的问题,

 

现在先说下更新时间:

list.js加入:

function updatetime(aid){

  var qstr=getCheckboxItem();

  if(aid==0) aid = getOneItem();

  location="archives_do.php?aid="+aid+"&dopost=updatetime&qstr="+qstr;  }

content_i_list.html加入:

       <a href="javascript:updatetime(0)" class="coolbg">&nbsp;更新时间&nbsp;</a>

archives_do.php加入:

/*--------------------------

//更新时间

function updatetime() {   }

---------------------------*/

 

else if($dopost=="updatetime")

{

$pubdate =GetMkTime(GetDateTimeMk(time()));

$senddate = time();

$sortrank =AddDay($pubdate,$sortup);

if(!empty($aid) && empty($qstr))

{

$qstr = $aid;

}

if($qstr=='')

{

ShowMsg("参数无效!",$ENV_GOBACK_URL);

exit();

}

$qstrs = ereg_replace('[^0-9,]','',ereg_replace('`',',',$qstr));

 

$hghsql="Update `it_archives` set `pubdate`='$pubdate',`sortrank`='$sortrank' where id in ($qstrs)";

 

 

if(!$dsql->ExecuteNoneQuery($hghsql))

{

$gerr = $dsql->GetError();

//ShowMsg("把数据保存到数据库主表 `dede_archives` 时出错,请把相关信息提交给DedeCms官方。".str_replace('"','',$gerr),"javascript:;");");

exit();

}

else{

//生成html

require_once(DEDEADMIN.'/inc/inc_archives_functions.php');

    $qstrs = explode('`',$qstr);

    $i = 0;

    foreach($qstrs as $aid)

    {

        $i++;

        $pageurl = MakeArt($aid,false);

    }

//echo($hghsql);

ShowMsg("成功更新指定文件。..",$ENV_GOBACK_URL);

exit();

}

 

然后是加入复制功能,我这里是图集模型:

 

 list.js加入:

function copyArc(e, obj, cid){

    var qstr=getCheckboxItem();

    if(qstr=='')

    {

        alert('必须选择一个或多个文档!');

        return;

    }

    LoadQuickDiv(e, 'archives_do.php?dopost=copyArchives&qstr='+qstr+'&channelid='+cid+'&rnd='+Math.random(), 'copyArchives', '450px', '180px');

    ChangeFullDiv('show');

}

content_i_list.html加入:

  <a href="javascript:;" onClick="copyArc(event,this,<?php echo (empty($channelid) ? 0 : $channelid); ?>);" class="coolbg">&nbsp;复制&nbsp;</a>

archives_do.php加入:

 

/*-----------------------------

//复制文档

------------------------------*/

elseif ($dopost == 'copyArchives') {

    CheckPurview('sys_ArcBatch');

    if (empty($totype)) {

        require_once(DEDEINC . '/typelink.class.php');

        if (!empty($aid) && empty($qstr)) $qstr = $aid;

 

        AjaxHead();

        $channelid = empty($channelid) ? 0 : $channelid;

        $tl = new TypeLink($aid);

        $typeOptions = $tl->GetOptionArray(0, $admin_catalogs, $channelid);

        $typeOptions = "<select name='totype' style='width:90%'>

        <option value='0'>请选择复制到的位置...</option>\r\n

        $typeOptions

        </select>";

 

        //输出AJAX可移动窗体

        $divname = 'copyArchives';

echo "<div class='title' οnmοusemοve=\"DropMoveHand('{$divname}', 225);\" οnmοusedοwn=\"DropStartHand();\" οnmοuseup=\"DropStopHand();\">\r\n";

echo "    <div class='titLeft'>复制文档</div>\r\n";

//echo "    <div class='titRight'><img src='images/ico-close.gif' style='cursor:pointer;' οnclick='HideObj(\"{$divname}\");ChangeFullDiv(\"hide\");' alt='关闭' title='关闭' /></div>\r\n";

echo "</div>\r\n";

echo "<form name='quickeditform' action='archives_do.php' method='post'>\r\n";

echo "<input type='hidden' name='dopost' value='{$dopost}' />\r\n";

echo "<input type='hidden' name='qstr' value='{$qstr}' />\r\n";

echo "<table width='100%' style='margin-top:6px;z-index:9000;'>\r\n";

        ?>

       

        <tr height='28'>

            <td width="80" class='bline'> 目标栏目:</td>

            <td class='bline'>

                <?php echo $typeOptions; ?>

            </td>

        </tr>

        <tr height='32'>

            <td width="80" class='bline'> 文档ID:</td>

            <td class='bline'>

                <input type='text' name='tmpids' value="<?php echo $qstr; ?>" style='width:310px;overflow:hidden;'/>

                <br/>

                复制到的目标栏目必须和选定的文档频道类型一致,否则程序会自动勿略不符合的文档。

            </td>

        </tr>

        <tr height='32'>

            <td colspan='2' align='center' style='padding-top:12px'>

                <input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" class="np"

                       border="0" style="cursor:pointer"/>

                <a href="javascript:HideObj('copyArchives');ChangeFullDiv('hide');"><img src="images/button_back.gif" width="60" height="22" border="0"  style="cursor:pointer" /> </a>

                

            </td>

            </td>

        </tr>

        </table>

 

        </form>

        <?php

        //AJAX窗体结束

    } else {

        $totype = preg_replace("#[^0-9]#", '', $totype);

        $typeInfos = $dsql->GetOne("SELECT tp.channeltype,tp.ispart,tp.channeltype,ch.maintable,ch.addtable,ch.issystem FROM `it_arctype` tp LEFT JOIN `it_channeltype` ch on ch.id=tp.channeltype WHERE tp.id='$totype' ");

        $idtype = "id";

        if (!is_array($typeInfos)) {

            ShowMsg('参数错误!', '-1');

            exit();

        }

        if ($typeInfos['ispart'] != 0) {

            ShowMsg('文档保存的栏目必须为最终列表栏目!', '-1');

            exit();

        }

        if (empty($typeInfos['addtable'])) {

            $typeInfos['maintable'] = '`it_archives`';

        }

        //增加单表模型判断

        if ($typeInfos['issystem'] == -1) {

            $typeInfos['maintable'] = $typeInfos['addtable'];

            $idtype = "aid";

        }

        $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));

        $arc = '';

        $j = 0;

        $okids = array();

        $dsql->SetQuery("SELECT {$idtype},typeid FROM `{$typeInfos['maintable']}` WHERE {$idtype} in($arcids) AND channel='{$typeInfos['channeltype']}' ");

// echo("SELECT {$idtype},typeid FROM `{$typeInfos['maintable']}` WHERE {$idtype} in($arcids) AND channel='{$typeInfos['channeltype']}' ");

// echo($totype);

//exit();

        $dsql->Execute();

        while ($row = $dsql->GetArray()) {

          //取消判断同栏目不能复制,  if ($row['typeid'] != $totype) {

              

                $dsql->ExecuteNoneQuery("insert into `it_arctiny` (typeid,typeid2,arcrank,channel,senddate,sortrank,mid) select typeid,typeid2,arcrank,channel,senddate,sortrank,mid from `it_arctiny` where id='{$row[$idtype]}'");

                

                $xid = $dsql->GetLastID();

                

                $dsql->ExecuteNoneQuery("insert into `{$typeInfos['maintable']}`(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,color,writer,source,litpic,pubdate,senddate,mid,keywords,lastpost,scores,goodpost,badpost,voteid,notpost,description,filename,dutyadmin,tackid,mtype,weight) select case when id>'0' then '$xid'  else '' end, case when typeid>'0' then '$totype'  else '' end,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,color,writer,source,litpic,pubdate,senddate,mid,keywords ,lastpost,scores,goodpost,badpost,voteid,notpost,description,filename,dutyadmin,tackid,mtype,weight from `{$typeInfos['maintable']}` WHERE id='{$row[$idtype]}' ");

                //就适合图集,如果需要文章 ,用这个

//$dsql->ExecuteNoneQuery("insert into `{$typeInfos['addtable']}`(aid,typeid,body,redirecturl,templet,userip) select case when aid>'0' then '$xid'  else '' end,$totype,body,redirecturl,templet,userip from `{$typeInfos['addtable']}` WHERE aid='{$row[$idtype]}' ");

 

                $dsql->ExecuteNoneQuery("insert into `{$typeInfos['addtable']}`(aid,typeid,body,redirecturl,templet,userip,imgurls,row,col,isrm,pagestyle,maxwidth) select case when aid>'0' then '$xid'  else '' end,$totype,body,redirecturl,templet,userip,imgurls,row,col,isrm,pagestyle,maxwidth from `{$typeInfos['addtable']}` WHERE aid='{$row[$idtype]}' ");

                

                $okids[] = $row[$idtype];

                $j++;

           // }

        }

 

        

    UpDateCatCache();

    $sql = " TRUNCATE TABLE `it_arctiny`";

    $dsql->ExecuteNoneQuery($sql);

    

    //导入普通模型微数据

    $sql = "INSERT INTO `it_arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid)  

            SELECT id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid FROM `it_archives` ";

    $dsql->ExecuteNoneQuery($sql);

    

    //导入单表模型微数据

    $dsql->SetQuery("SELECT id,addtable FROM `it_channeltype` WHERE id < -1 ");

    $dsql->Execute();

    $doarray = array();

    while($row = $dsql->GetArray())

    {

        $tb = str_replace('it_', $cfg_dbprefix, $row['addtable']);

        if(empty($tb) || isset($doarray[$tb]) )

        {

            continue;

        }

        else

        {

            $sql = "INSERT INTO `it_arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid)  

                    SELECT aid, typeid, 0, arcrank, channel, senddate, 0, mid FROM `$tb` ";

            $rs = $dsql->executenonequery($sql);

            $doarray[$tb]  = 1;

        }

    }

        //更新HTML

        foreach ($okids as $aid) {

            $arc = new Archives($aid);

            $arc->MakeHtml();

        }

        ShowMsg("成功复制 $j 个文档!", $ENV_GOBACK_URL);

        exit();

    }

 

}

大家如果改文章模型或者其他模型。对于的模板加入按钮就行了。但是要特别注意不同模型  表写入问题。 

 

 

更多

【责任编辑:小戴工程师】

上一篇:win10 iis 重装系统出现 ADODB.Recordset 错误 '800a0e7d' 的解 下一篇:织梦网站制作之后台自定义字段里添加style全部都变成st<x>yle

最新文章

2020-06-06 15:35

相关文章

2020-06-06 15:35
网站制作咨询:
QQ:277728291
电话:18668277799
邮箱:277728291@qq.com
期待你来电咨询
回顶部
Copyright 2010 智软工作室 版权所有    智软为宁波公司提供最优惠的网络服务【宁波网站建设,宁波网站制作公司,宁波做网站公司,宁波外贸网站建设公司】我们竭诚为你服务!