当前位置: 首页>>代码示例>>PHP>>正文


PHP Catalog::getMenu方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $this->_seoTitle = '我要去上课 - 课程汇总';
     $criteria = new CDbCriteria();
     //根据分类查找课程信息
     $cat = Yii::app()->request->getParam('cat');
     $city = Yii::app()->request->getParam('city');
     $sex = Yii::app()->request->getParam('sex');
     //课程分类
     $catalogs = Catalog::getMenu();
     if (!empty($city)) {
         $criteria->addCondition("city = '{$city}'");
     }
     if (!empty($cat)) {
         $criteria->addCondition("catalog_id = '{$cat}'");
     }
     if (!empty($sex)) {
         $criteria->addCondition("sex = '{$sex}'");
     }
     $criteria->addCondition("check_status = :check_status");
     $criteria->params[':check_status'] = 1;
     //分页
     $count = Lesson::model()->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = 5;
     $pager->applyLimit($criteria);
     $lessons = Lesson::model()->findAll($criteria->addCondition("check_status = 1"));
     $this->render('index', array('lessons' => $lessons, 'count' => $count, 'pager' => $pager, 'cat' => $cat, 'sex' => $sex, 'catalogs' => $catalogs, 'city' => $city, 'food' => $_GET['food']));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:29,代码来源:LessonController.php

示例2: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $this->_seoTitle = '我要去上课 - 名师库';
     $criteria = new CDbCriteria();
     //根据分类查找导师信息
     $cat = Yii::app()->request->getParam('cat');
     $district = Yii::app()->request->getParam('district');
     //$areas = Area::model()->findAll();
     $city = Yii::app()->request->getParam('city');
     if (!empty($city)) {
         $criteria->addCondition("t.city = '{$city}'");
     }
     if (!empty($cat)) {
         $criteria->addCondition("t.catalog_id = '{$cat}'");
     }
     if (!empty($district)) {
         $criteria->addCondition("t.district = '{$district}'");
     }
     //导师分类
     $catalogs = Catalog::getMenu();
     if (!empty($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 'id':
                 $criteria->order = 't.id DESC';
                 break;
             case 'review':
                 $criteria->order = 't.review DESC';
                 break;
             case 'popularity':
                 $criteria->order = 't.popularity DESC';
                 break;
         }
     } else {
         $criteria->order = 't.popularity DESC';
     }
     //导师搜索
     $nameStripTags = strip_tags(Yii::app()->request->getParam('name'));
     $name = addslashes($nameStripTags);
     if (!empty($name)) {
         $teacherName = '%' . $name . '%';
         $criteria->addCondition("t.name like '{$teacherName}'");
     }
     //分页
     $count = Teacher::model()->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = 5;
     $pager->applyLimit($criteria);
     $teachers = Teacher::model()->findAll($criteria);
     $this->render('index', array('teachers' => $teachers, 'city' => $city, 'count' => $count, 'pager' => $pager, 'cat' => $cat, 'catalogs' => $catalogs, 'name' => $name, 'sort' => $_GET['sort']));
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:53,代码来源:TeacherController.php

示例3: array

<!--/*==========================▼site-category▼=========================*/-->
<nav class="site-category" role="navigation">
    <div class="container">
    	<h3 class="clear-m">
            <small>Category</small>
            <span>课程分类</span>
        </h3>
        <!--课程分类-->
        <ul class="list-unstyled clearfix col-xs-offset-1 text-center category" role="list">
                    <?php 
$catalogs = Catalog::getMenu();
?>
                    <?php 
foreach ($catalogs as $catalog) {
    ?>
                        <li role="listitem">
                            <a href="<?php 
    echo Yii::app()->createUrl('lesson', array('cat' => $catalog->id));
    ?>
"  title="<?php 
    echo $catalog->catalog_name;
    ?>
"><?php 
    echo $catalog->catalog_name;
    ?>
</a>
                        </li>
                    <?php 
}
?>
开发者ID:tecshuttle,项目名称:51qsk,代码行数:30,代码来源:site_nav.php


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