/**
  * 删除数据
  */
 function del()
 {
     //implode序列化主键Id为:1,2,3,...以便批量删除
     $del_id = $_POST['del_id'];
     $catid = implode($del_id, ',');
     //实例化模型
     $category = new CategoryModel();
     $article = new ArticleModel();
     $menu_items = new MenuItemModel();
     //删除分类
     if ($category->delete($catid)) {
         //删除文章的where语句
         $where = array('catid' => array('in', $catid));
         //删除文章
         $article->where($where)->delete();
         //删除类别后删除菜单项中的类别
         $menu_where = array('type_id' => array('in', $catid), 'type' => 'Category');
         $menu_items->where($menu_where)->delete();
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->success('分类,下属文章以及相应的菜单项删除成功~~~~');
     } else {
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->error('分类删除失败!' . $category->getError());
     }
 }
 /**
  * 删除文章页面
  */
 function del()
 {
     //序列化主键Id为:1,2,3,...以便批量删除
     $del_id = $_POST['del_id'];
     $str = implode($del_id, ',');
     //实例化
     $article = new ArticleModel();
     //删除了文章的同时删除掉菜单中的文章,其中type_id为外键
     $menu_items = new MenuItemModel();
     //删除文章
     if ($article->delete($str)) {
         //删除文章后删除菜单项中的文章
         $where = array('type_id' => array('in', $str), 'type' => 'Article');
         $menu_items->where($where)->delete();
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->success('文章以及相应菜单中文章已删除成功');
     } else {
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->error('文章删除失败');
     }
 }
Exemple #3
0
 public static function getMenuInMenuStore($meuStoreId)
 {
     $doctrine = self::$servicelocator->get('doctrine');
     $menuItemTable = new MenuItemModel($doctrine);
     $menuItems = $menuItemTable->findBy(array('menuStoreId' => $meuStoreId));
     $html = '<ul>';
     foreach ($menuItems as $menuItem) {
         $menuInfo = self::getMenuInfo($menuItem->getMenuId());
         $html .= '<li><b><a href="/admin/index/add/' . $menuInfo->getId() . '" target="_blank"> ' . $menuInfo->getName() . '</a></b>: ' . $menuItem->getQuantity() . '(' . $menuItem->getUnit() . ')</li>';
     }
     $html .= '</ul>';
     return $html;
 }
 /**
  * 删除子菜单
  */
 function del()
 {
     $delid = implode($_POST['del_id'], ',');
     $menuitem = new MenuItemModel();
     if ($menuitem->delete($delid)) {
         $this->assign('jumpUrl', __APP__ . '/Menu/index');
         $this->success('子菜单删除成功');
     } else {
         $this->assign("jumpUrl", __APP__ . '/Menu/index');
         $this->error('更新菜单失败!!!!' . $menuitem->getError());
     }
 }
 /**
  * 单元删除页面
  */
 function del()
 {
     //因为删除一个单元,就要删除其手下的分类类别,而删除分类类别后就要删除该类别下面的文章
     //所有必须使用关联操作来执行
     //序列化主键Id为:1,2,3,...以便批量删除
     $del_id = $_POST['del_id'];
     $section_id = implode($del_id, ',');
     //实例化
     $section = new SectionModel();
     $category = new CategoryModel();
     $article = new ArticleModel();
     $menu_items = new MenuItemModel();
     //如果单元删除成功
     if ($section->delete($section_id)) {
         //删除下属分类以及分类下属文章
         $where = array('sectionid' => array('in', $section_id));
         //删除分类
         $category->where($where)->delete();
         //删除文章
         $article->where($where)->delete();
         //删除单元后删除菜单项中的单元
         $menu_where = array('type_id' => array('in', $section_id), 'type' => 'Section');
         $menu_items->where($menu_where)->delete();
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->success('单元,菜单项以及所有相关文章类别已删除~~~~');
     } else {
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->error('删除失败~~~~' . $category->getError());
     }
 }
Exemple #6
0
 /**
  * 删除菜单项
  */
 function del()
 {
     //序列化主键Id为:1,2,3,...以便批量删除
     $del_id = $_POST['del_id'];
     $str = implode($del_id, ',');
     //实例化
     $menu = new MenuModel();
     //删除文章
     if ($menu->delete($str)) {
         //同时删除其下属子菜单
         $menu_items = new MenuItemModel();
         $where = array('menuid' => array('in', $del_id));
         $menu_items->where($where)->delete();
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->success('菜单删除成功~~');
     } else {
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->error('删除失败');
     }
 }