Example #1
0
 function GetCategoryAlias($Alias, $offset = 0, $limit = 10)
 {
     $DB = new DB();
     $Category = new ArticlesCategoryModule();
     $CategoryDetail = $Category->GetByAlias($Alias);
     if (!$CategoryDetail) {
         return false;
     }
     $CategoryID = $CategoryDetail['CategoryID'];
     $sql = 'select ArticleID, Title,PictureThumb, Picture, Keywords, Updated from tbl_Articles where CategoryID=' . $CategoryID . ' ORDER BY ArticleID DESC';
     return $DB->Select($sql, $offset, $limit);
 }
Example #2
0
 public function Delete()
 {
     $CategoryID = _intval($this->_GET['CategoryID'], true);
     if (!$CategoryID) {
         return $this->__ArrJsonMessage(__ERROR__, '很抱歉,您未指定的分类!');
     }
     $Category = new ArticlesCategoryModule();
     $Detail = $Category->Get($CategoryID);
     if (!$Detail) {
         return $this->__ArrJsonMessage(__ERROR__, '很抱歉,您指定的分类不存在!');
     }
     if ($Category->GetSubs($CategoryID)) {
         return $this->__ArrJsonMessage(__ERROR__, '很抱歉,您指定的分类下还有子分类,不允许删除!');
     }
     if ($Category->Delete($CategoryID)) {
         return $this->__ArrJsonMessage(__SUCC__, '删除分类“' . $Detail['CategoryName'] . '”成功!');
     } else {
         return $this->__ArrJsonMessage(__SUCC__, '删除分类“' . $Detail['CategoryName'] . '”失败! 请重试!');
     }
 }
Example #3
0
 public function Setting()
 {
     $ArticleIDs = $this->_GET['ArticleID'];
     $Page = _intval($this->_GET['Page']);
     $CategoryID = _intval($this->_GET['CategoryID'], true);
     $Category = new ArticlesCategoryModule();
     $CategoryDetail = $Category->Get($CategoryID);
     if (!$CategoryDetail) {
         $this->__Message('您没有选择的分类不存在!');
     }
     if (is_array($ArticleIDs)) {
         $articles = new ArticlesModule();
         foreach ($ArticleIDs as $ArticleID) {
             $articles->UpdateCategoryID($ArticleID, $CategoryID, $CategoryDetail['CategoryIDS']);
         }
         $this->__Message('已完成分类设置操作!', UrlRewriteSimple('Articles', 'Lists', true) . '&Page=' . $Page, '继续操作');
     } else {
         $this->__Message('您没有选择准备分类设置的记录!');
     }
 }