function content_52661634228078_50365984($_smarty_tpl) { echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?> <script type="text/javascript" src="./js/cate.js"></script> <div class="fourvar"> <div class="pathvar"> <?php echo $_smarty_tpl->getSubTemplate('pcNav.htm', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?> </div> <div class="texvar"> </div> <div class="pagination"> <?php echo $_smarty_tpl->tpl_vars['show_page']->value; ?> </div> </div> <div class="servar products-servar"> <span> <a href="index.php?mod=category&act=addCategory">增加类别</a> </span> <span style="color: red;" id="error"><?php echo $_GET['status']; ?> </span> </div> <div class="main feedback-main"> <table class="products-action" cellspacing="0" width="100%"> <tr class="title"> <td>编号</td> <td>名称</td> <td>所属类级</td> <td>父类</td> <td>操作</td> </tr> <?php $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['value']->_loop = false; $_from = $_smarty_tpl->tpl_vars['categoryList']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) { $_smarty_tpl->tpl_vars['value']->_loop = true; ?> <tr class="odd" id="<?php echo $_smarty_tpl->tpl_vars['value']->value['id']; ?> "> <td><?php echo $_smarty_tpl->tpl_vars['value']->value['id']; ?> </td> <td><?php echo $_smarty_tpl->tpl_vars['value']->value['name']; ?> </td> <td><?php echo $_smarty_tpl->tpl_vars['value']->value['file']; ?> </td> <td><?php echo getAllCateNameByPath(CategoryModel::getCategoryPathById($_smarty_tpl->tpl_vars['value']->value['pid'])); ?> </td> <td> <input type="button" value="修改" tid="<?php echo $_smarty_tpl->tpl_vars['value']->value['id']; ?> " class="mod"/> <input type="button" value="删除" tid="<?php echo $_smarty_tpl->tpl_vars['value']->value['id']; ?> " class="del"/> </td> </tr> <?php } ?> </table> </div> <div class="bottomvar"> <div class="texvar"> </div> <div class="pagination"> <?php echo $_smarty_tpl->tpl_vars['show_page']->value; ?> </div> </div> <?php echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); }
function act_addInput() { //$pidNew = $_POST['pidNew']?post_check($_POST['pidNew']):'';//类别 $finalIdArr = $_POST['finalIdStr']; //新建属性-类别4 $inputName = $_POST['inputName'] ? post_check($_POST['inputName']) : ''; //类别 $textStatus = $_POST['textStatus'] ? post_check($_POST['textStatus']) : ''; //文本方式 if (empty($finalIdArr) || empty($inputName)) { self::$errCode = 101; self::$errMsg = '类别或属性名不能为空'; return false; } if (intval($textStatus) <= 0) { self::$errCode = 102; self::$errMsg = '文本方式有误'; return false; } $tmpArr = array(); if (!is_array($finalIdArr)) { $tmpArr[] = $finalIdArr; $finalIdArr = $tmpArr; } $finalPathArr = array(); foreach ($finalIdArr as $cid) { $catePath = CategoryModel::getCategoryPathById($cid); if (empty($catePath)) { self::$errCode = 109; self::$errMsg = '类别有误'; return false; } $finalPathArr[] = $catePath; } $tName = 'pc_goods_category'; foreach ($finalPathArr as $value) { $where = "WHERE path like'%{$value}-%' and is_delete=0"; $count = OmAvailableModel::getTNameCount($tName, $where); if ($count) { self::$errCode = 105; self::$errMsg = '只能在最小分类进行复制'; return false; } } try { $pidNewStr = ''; BaseModel::begin(); $tName = 'pc_archive_input'; foreach ($finalPathArr as $value) { $where = "WHERE inputName='{$inputName}' AND categoryPath='{$value}'"; $countIN = OmAvailableModel::getTNameCount($tName, $where); if (!$countIN) { $pidNewStr .= CategoryModel::getCategoryNameByPath($value) . ' '; $set = "SET inputName='{$inputName}',categoryPath='{$value}',textStatus='{$textStatus}'"; OmAvailableModel::addTNameRow($tName, $set); } } BaseModel::commit(); BaseModel::autoCommit(); self::$errCode = 200; self::$errMsg = "{$inputName} 添加到 {$pidNewStr} 成功"; return true; } catch (Exception $e) { BaseModel::rollback(); BaseModel::autoCommit(); self::$errCode = 201; self::$errMsg = $e->getMessage(); return false; } }