• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CategoryModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CategoryModel的典型用法代码示例。如果您正苦于以下问题:PHP CategoryModel类的具体用法?PHP CategoryModel怎么用?PHP CategoryModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CategoryModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: actionActive

 protected static function actionActive()
 {
     $category = new CategoryModel($_GET['id']);
     $category->active = $category->active ? '0' : '1';
     $category->save();
     self::redirect(App::getLink('AdminCategories'));
 }
开发者ID:swash13,项目名称:shop,代码行数:7,代码来源:AdminCategories.php


示例2: indexAction

 public function indexAction()
 {
     $categoryObj = new CategoryModel();
     $list = $categoryObj->getCategoryList();
     var_dump($list);
     // 		exit;
 }
开发者ID:lfq618,项目名称:yafdemo,代码行数:7,代码来源:Category.php


示例3: addAction

 public function addAction()
 {
     $model_category = new CategoryModel();
     $category_list = $model_category->getTreeList(0);
     $this->view->assign('category_list', $category_list);
     $this->view->display('add.tpl');
 }
开发者ID:dab1993,项目名称:myeshop,代码行数:7,代码来源:GoodsController.class.php


示例4: index

 public function index()
 {
     if (IS_POST) {
         if (empty($_POST['catid'])) {
             $this->error("请选择数据来源");
         }
         $map['catid'] = array('in', $_POST['catid']);
         $map['status'] = array('eq', 1);
         $article = M('Article');
         $articlelist = $article->where($map)->order('create_time desc')->select();
         $download = M('Download');
         $downloadlist = $download->where($map)->order('create_time desc')->select();
         $photo = M('Photo');
         $photolist = $photo->where($map)->order('create_time desc')->select();
         if (isset($_POST['sitemaptype'])) {
             $type = $_POST['sitemaptype'];
         }
         $sitemapstr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
         switch ($type) {
             case 0:
                 $sitemapstr .= "<urlset>\r\n";
                 break;
             case 1:
                 $sitemapstr .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\r\n";
                 break;
         }
         foreach ($articlelist as $value) {
             $sitemapstr .= "<url>\r\n";
             $sitemapstr .= "<loc>Article/show?id=" . $value['id'] . "</loc>\r\n";
             $sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n";
             $sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n";
             $sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n";
             $sitemapstr .= "</url>\r\n\r\n";
         }
         foreach ($downloadlist as $value) {
             $sitemapstr .= "<url>\r\n";
             $sitemapstr .= "<loc>Download/show?id=" . $value['id'] . "</loc>\r\n";
             $sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n";
             $sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n";
             $sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n";
             $sitemapstr .= "</url>\r\n\r\n";
         }
         foreach ($photolist as $value) {
             $sitemapstr .= "<url>\r\n";
             $sitemapstr .= "<loc>Photo/show?id=" . $value['id'] . "</loc>\r\n";
             $sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n";
             $sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n";
             $sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n";
             $sitemapstr .= "</url>\r\n\r\n";
         }
         $sitemapstr .= "</urlset>";
         file_put_contents("../sitemap.xml", $sitemapstr);
         $this->success("sitemap在线生成完成");
     } else {
         $cate = new CategoryModel();
         $this->list = $cate->getMyCategory();
         //加载栏目
         $this->display();
     }
 }
开发者ID:echenxin-company,项目名称:YTBT,代码行数:60,代码来源:SitemapAction.class.php


示例5: CategoryController_ToggleFollow_Create

 /**
  * ToggleFollow toggles the hidden/unhidden state of categories
  *
  * it has been adopted from function Follow in
  * /applications/vanilla/controllers/class.categorycontroller.php
  * Redirection had to be fixed
  */
 public function CategoryController_ToggleFollow_Create($CategoryID, $Value, $TKey, $Target)
 {
     if (Gdn::Session()->ValidateTransientKey($TKey)) {
         $CategoryModel = new CategoryModel();
         $CategoryModel->SaveUserTree($CategoryID, array('Unfollow' => !(bool) $Value));
         if (!(bool) $Value) {
             // switch to "view only followed" when hiding a category
             $this->CategoriesController_SetToggle_Create(1, $Target);
         } else {
             // and to "view all" when no category is hidden
             $NoFollowing = TRUE;
             $Categories = $CategoryModel::Categories();
             foreach ($Categories as $Category) {
                 if ($Category['Following'] == '') {
                     $NoFollowing = FALSE;
                     break;
                 }
             }
             if ($NoFollowing) {
                 $this->CategoriesController_SetToggle_Create(0, $Target);
             }
         }
     }
     Redirect($Target);
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:32,代码来源:class.categoriesmoduleplus.plugin.php


示例6: addAction

 /**
  * 增加商品跳转动作
  */
 public function addAction()
 {
     //得到所有分类
     $model_category = new CategoryModel();
     $cat_list = $model_category->getList();
     require CURR_VIEW_DIR . 'goodsAdd.html';
 }
开发者ID:holyCoco,项目名称:phpdemo,代码行数:10,代码来源:GoodsController.class.php


示例7: _before_edit

 public function _before_edit()
 {
     $cate = new CategoryModel();
     $menu = $cate->getModelCategory('Article');
     //加载栏目
     $menu1 = arrToMenu($menu, 0);
     $this->categorylist = $menu1;
 }
开发者ID:zhezhisama,项目名称:zz,代码行数:8,代码来源:ArticleAction.class.php


示例8: detailAction

 public function detailAction()
 {
     $Category = new CategoryModel((int) $this->_request->value);
     $Category->load();
     $View = new DetailView();
     $View->setModel($Category);
     $View->display();
 }
开发者ID:jesusnazarethgh,项目名称:TianguisCabal,代码行数:8,代码来源:CategoryController.php


示例9: Base_Render_Before

    /**
     * Hack the Base Render in order to achieve our goal
     * 
     * @since 1.0
     * @version 1.7.2
     */
    public function Base_Render_Before(&$Sender)
    {
        // Attach the Plugin's CSS to the site
        $Sender->AddCssFile($this->GetResource('categories2menu.css', FALSE, FALSE));
        $Cat2MenuJQuerySource = '<script type="text/javascript">
var ddmenuitem = 0;
var menustyles = { "visibility":"visible", "display":"block", "z-index":"9"}

function Menu_close()
{  if(ddmenuitem) { ddmenuitem.css("visibility", "hidden"); } }

function Menu_open()
{  Menu_close();
   ddmenuitem = $(this).find("ul").css(menustyles);
}

jQuery(document).ready(function()
{  $("ul#Menu > li").bind("mouseover", Menu_open);
   $("ul#Menu > li").bind("mouseout", Menu_close);
});

document.onclick = Menu_close;</script>
';
        // Add the jQuery JavaScript to the page
        $Sender->Head->AddString($Cat2MenuJQuerySource);
        if ($Sender->Menu) {
            // Set this to FALSE|TRUE whether you want to display the Discussion-Counter next to each Category or not
            $DisplayCounter = TRUE;
            // Build the Categories Model & load Categories Data
            $CategoryModel = new CategoryModel();
            $_CategoryData = $CategoryModel->GetFull();
            // If there are any Categories...
            if ($_CategoryData != FALSE) {
                // Add a link to the Category overview as first menuitem
                $Sender->Menu->AddLink('Discussions', T('→ All Categories'), '/categories/all');
                // If $DisplayCounter is set to TRUE, get Count discussions per Category separately
                $CountDiscussions = 0;
                foreach ($_CategoryData->Result() as $Category) {
                    // (will ignore root node)
                    if ($Category->Name != 'Root') {
                        $CountDiscussions = $CountDiscussions + $Category->CountDiscussions;
                    }
                }
                // Fetch every single Category...
                foreach ($_CategoryData->Result() as $Category) {
                    if ($Category->Name != 'Root') {
                        if ($DisplayCounter == TRUE) {
                            // Build the Categories-Menu with Discussions-Counter
                            $Sender->Menu->AddLink('Discussions', $Category->Name . ' <span>' . $Category->CountDiscussions . '</span>', '/categories/' . $Category->UrlCode, FALSE);
                        } else {
                            // Build the Categories-Menu
                            $Sender->Menu->AddLink('Discussions', $Category->Name, '/categories/' . $Category->UrlCode, FALSE);
                        }
                    }
                }
            }
        }
    }
开发者ID:ru4,项目名称:arabbnota,代码行数:64,代码来源:class.categories2menu.plugin.php


示例10: viewMainPage

 public function viewMainPage()
 {
     $postmodel = new PostModel();
     $categorymodel = new CategoryModel();
     $categories = $categorymodel->getAllPublicCategories();
     $page_title = 'Forums';
     include BASE_URI . 'app/view/template/header.php';
     include BASE_URI . 'app/view/main/public.php';
     include BASE_URI . 'app/view/template/footer.php';
 }
开发者ID:sandervanmook,项目名称:forums,代码行数:10,代码来源:Main.php


示例11: deleteUser

 public function deleteUser($id)
 {
     $db = new Database();
     $db->execute('DELETE FROM accounts WHERE id = ?', array($id));
     $db->execute('DELETE FROM passwords WHERE account = ?', array($id));
     $db->execute('DELETE FROM articlesfavoris WHERE account = ?', array($id));
     $db->execute('DELETE FROM categories WHERE account = ?', array($id));
     $categoryModel = new CategoryModel();
     $categoryModel->deleteAllCategoriesByAccount($id);
 }
开发者ID:alexandre-le-borgne,项目名称:-PHP-DUT-S3-Projet,代码行数:10,代码来源:AdminModel.php


示例12: deleteAction

 public function deleteAction()
 {
     $category_model = new CategoryModel();
     $result = $category_model->delByID($_GET['id']);
     if (!$result) {
         $this->redirect('category.php?act=list', $category_model->error_info, 3);
     } else {
         $this->redirect('category.php?act=list');
     }
 }
开发者ID:dab1993,项目名称:myeshop,代码行数:10,代码来源:CategoryController.class.php


示例13: deleteAction

 public function deleteAction()
 {
     $catmodel = new CategoryModel("category");
     $catmodel = new CategoryModel("category");
     $cat_id = $_GET["cat_id"];
     if ($catmodel->delete($cat_id)) {
         $this->jump("index.php?p=admin&c=Category&a=index", "删除成功", $wait = 1);
     } else {
         $this->jump("index.php?p=admin&c=Category&a=index", "删除失败", $wait = 1);
     }
 }
开发者ID:tanhuiya,项目名称:shop,代码行数:11,代码来源:CategoryController.class.php


示例14: _before_edit

 public function _before_edit()
 {
     $cate = new CategoryModel();
     //        $this->list=$cate->getMyCategory();//加载栏目
     $menu = $cate->getMyCategory1();
     //加载栏目
     $menu = arrToMenu($menu, 0);
     $this->list = $menu;
     $this->mdldata = $cate->getMyModel();
     //加载模型
 }
开发者ID:echenxin-company,项目名称:YTBT,代码行数:11,代码来源:CategoryAction.class.php


示例15: menu

 public function menu()
 {
     $this->checkUser();
     if (isset($_SESSION[C('USER_AUTH_KEY')])) {
         //显示菜单项
         $menu = array();
         if (isset($_SESSION['menu' . $_SESSION[C('USER_AUTH_KEY')]])) {
             //如果已经缓存,直接读取缓存
             $menu = $_SESSION['menu' . $_SESSION[C('USER_AUTH_KEY')]];
         } else {
             //读取数据库模块列表生成菜单项
             $node = M("Node");
             $map['level'] = 2;
             $map['status'] = 1;
             $list = $node->where($map)->field('id,name,pid,title')->order('sort asc')->select();
             $accessList = $_SESSION['_ACCESS_LIST'];
             foreach ($list as $key => $module) {
                 if (isset($accessList[strtoupper(APP_NAME)][strtoupper($module['name'])]) || $_SESSION['administrator']) {
                     //设置模块访问权限
                     $module['access'] = 1;
                     $menu[$key] = $module;
                 }
             }
             //缓存菜单访问
             $_SESSION['menu' . $_SESSION[C('USER_AUTH_KEY')]] = $menu;
         }
         if (isset($_GET['tag'])) {
             $tag = $_GET['tag'];
             if (0 == $tag) {
                 $this->assign('menuTitle', '扩展功能');
             } else {
                 $mapid['id'] = array('eq', $tag);
                 $node = M("Node");
                 $title = $list = $node->where($mapid)->getField('title');
                 $this->assign('menuTitle', $title);
             }
             $this->assign('menuTag', $tag);
         } else {
             $this->assign('menuTitle', '内容管理');
         }
         $this->assign('menu', $menu);
     }
     //显示站点栏目
     $cate = new CategoryModel();
     $this->cate = $list = $cate->getMyCategory();
     //加载栏目
     $menu = $cate->getMyCategory1();
     //加载栏目
     $menu = arrToTree($menu, 0);
     $tree = outMenuNode($menu);
     $this->assign('tree', $tree);
     $this->display();
 }
开发者ID:zhezhisama,项目名称:zz,代码行数:53,代码来源:PublicAction.class+(2).php


示例16: search

 public function search($params)
 {
     $category = new CategoryModel();
     $result = $category->request($params);
     $output = "";
     if (!empty($params["output"])) {
         $output = $params["output"];
     }
     $html = Converter::generate($result, $output);
     Header::append($result["status"]["code"]);
     Header::append($output);
     echo $html;
 }
开发者ID:vtlabo,项目名称:vtlabo-training-php-api,代码行数:13,代码来源:CategoryController.php


示例17: updateAction

 public function updateAction()
 {
     $data['cat_id'] = $_POST['cat_id'];
     $data['parent_id'] = $_POST['parent_id'];
     $data['sort_order'] = $_POST['sort_order'];
     $data['cat_name'] = $_POST['cat_name'];
     $model_name = new CategoryModel();
     if ($model_name->updateCat($data)) {
         $this->jump('index.php?p=back&c=Category&a=list');
     } else {
         $this->jump('index.php?p=back&c=Category&a=list', '修改失败' . $model_name->error_info);
     }
 }
开发者ID:holyCoco,项目名称:phpdemo,代码行数:13,代码来源:CategoryController.class.php


示例18: loadData

 public function loadData($categoryId)
 {
     $model = new FrontMasterModel();
     $body = new CategoryModel();
     $filter = new FilterSelectedModel();
     $filter->categoryId = $categoryId;
     $sort = 'OLD_NEW';
     $paging = new PagingModel(1, 12);
     $body->init($filter, $sort, $paging);
     $model->setCategoryId($categoryId);
     $model->init($body);
     $result = json_encode($model);
     echo $result;
 }
开发者ID:hopdq,项目名称:taka,代码行数:14,代码来源:Category.php


示例19: delAction

 public function delAction()
 {
     $p = $_REQUEST;
     $pId = empty($p['id']) ? die('ID不能为空') : intval($p['id']);
     $tMO = new CategoryModel();
     $tRow = $tMO->field('count(0) c')->where('id = ' . $pId)->fRow();
     if (empty($tRow['c'])) {
         Tool_Fnc::ajaxMsg('分类不存在');
     }
     $tSql = 'delete from ' . $tMO->table . ' where id=' . $pId;
     if (!$tMO->exec($tSql)) {
         Tool_Fnc::ajaxMsg('删除失败');
     }
     Tool_Fnc::ajaxMsg('删除成功', 1);
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:15,代码来源:Category.php


示例20: add

 /**
  *  添加新的子菜单,但是要选择是 哪种类型(Article,Category,Section).
  *  从组件中找出存在的组建
  */
 function add()
 {
     //查找出子菜单,并且显示分配在左侧菜单中
     $menus = new MenuModel();
     $menu_list = $menus->select();
     $this->assign('menulist', $menu_list);
     //导入分页类
     import("ORG.Util.Page");
     //查询组件,相当于哪几种类型
     $component = new ComponentModel();
     $where = array('enabled' => 1);
     $list = $component->where($where)->select();
     $this->assign('comlist', $list);
     //得到类型
     $link = strtolower($_REQUEST['link']);
     //查询数据,如果默认为空,则显示文章列表
     if (empty($link) || $link == 'article') {
         $art = new ArticleModel();
         $count = $art->count();
         $page = new Page($count, C("PAGESIZE"));
         //完成分页
         $show = $page->show();
         //查询分页数据
         $list = $art->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
     } else {
         if ($link == 'category') {
             $cat = new CategoryModel();
             $count = $cat->count();
             $page = new Page($count, C("PAGESIZE"));
             //完成分页
             $show = $page->show();
             //查询分页数据
             $list = $cat->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
         } else {
             $sec = new SectionModel();
             $count = $sec->count();
             $page = new Page($count, C("PAGESIZE"));
             //完成分页
             $show = $page->show();
             //查询分页数据
             $list = $sec->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
         }
     }
     $this->assign('show', $show);
     $this->assign('list', $list);
     $this->assign('link', $link);
     $this->display();
 }
开发者ID:omusico,项目名称:AndyCMS,代码行数:52,代码来源:MenuItemAction.class.php



注:本文中的CategoryModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CategoryPeer类代码示例发布时间:2022-05-20
下一篇:
PHP Category类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap