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


PHP Course::enumerate方法代码示例

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


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

示例1: displayBody

    function displayBody()
    {
        parent::displayBody();
        $translator = new Translator();
        $course = new Course();
        $page = $_GET['page'];
        $offset = intval($page) * ITEMS_IN_PAGE;
        if (isset($_GET['search'])) {
            $search = $_GET['search'];
            unset($_GET['search']);
            unset($_GET['page']);
        } else {
            $search = null;
        }
        $cnt = $course->getCount(array('search' => $search));
        if ($cnt > ITEMS_IN_PAGE) {
            $pagination = $this->addPaginator($cnt, $page);
        }
        echo <<<EOF
<div class="container-fluid">
<div class="col-md-10 col-lg-8 col-lg-offset-2 ">
\t<h4 class="page-header">{$translator->Search_result}: <span class="badge">{$cnt}</span></h4>
\t{$pagination}
EOF;
        $enum = $course->enumerate(array('search' => $search), $offset, ITEMS_IN_PAGE);
        if (isset($enum)) {
            foreach ($enum as $data) {
                echo <<<EOF
\t\t<h4>{$data[name]}</h4>
\t\t<h6>{$data[category_name]}</h6>
\t\t<p>{$data[describe]}</p>
\t\t<p><a href="/course/{$data[id]}">{$translator->Go_to}...</a></p>
EOF;
            }
        } else {
            $search = htmlspecialchars($search);
            echo <<<EOF
\t\t<h4>{$translator->no_results} по "{$search}"</h4>\t\t
EOF;
        }
        echo <<<EOF
\t{$pagination}
\t</div>
</div> <!-- /container -->

EOF;
    }
开发者ID:jedaika,项目名称:Trainings,代码行数:47,代码来源:search.php

示例2: displayBody

    function displayBody()
    {
        parent::displayBody();
        $translator = new Translator();
        $category = new Category();
        $course = new Course();
        $cnt = $course->getCount();
        $enum = $category->enumerate(array('active' => true));
        foreach ($enum as $key => $val) {
            if ($val['id'] != 0) {
                $this->items[$val['parent_id']][] = $val;
            }
        }
        foreach ($this->items as $key => $val) {
            asort($this->items[$key]);
        }
        $enum = $course->enumerate(array('active' => true));
        if (isset($enum)) {
            foreach ($enum as $key => $val) {
                $this->courses[$val['category_id']][] = $val;
            }
        }
        foreach ($this->items as $key => $val) {
            asort($this->items[$key]);
        }
        echo <<<EOF
<h2  class="page-header">{$translator->Courses_header} <span class="badge">{$cnt}</span></h2>
<div class="col-lg-8">
    <ul class="list-group category-list" index="0">

EOF;
        $this->put_list();
        echo <<<EOF
    </ul>
</div>

EOF;
    }
开发者ID:jedaika,项目名称:Trainings,代码行数:38,代码来源:courses.php

示例3: init

 function init()
 {
     $this->func = array_shift($this->param);
     switch ($this->func) {
         case 'courses':
             $category_id = array_shift($this->param);
             $course = new Course();
             $data = $course->enumerate(array('category_id' => $category_id), null, null, 'name');
             foreach ($data as $key => $val) {
                 $items[] = array($val['id'], $val['name']);
             }
             echo json_encode($items);
             exit;
             break;
         case 'finduser':
             $id = array_shift($this->param);
             $search = $_GET['search'];
             $user = new User();
             try {
                 foreach ($user->find($search, 5) as $data) {
                     $json[] = array('id' => $data['id'], 'name' => $data['name'], 'email' => $data['email'], 'company' => $data['company'], 'city' => $data['city']);
                 }
                 echo json_encode($json);
             } catch (Exception $e) {
             }
             exit;
             break;
         case 'adduser':
             $plan_id = array_shift($this->param);
             $user_id = array_shift($this->param);
             $user = new User();
             try {
                 $data = $user->get(array('id' => $user_id));
                 $plan = new Plan();
                 $plan->adduser($plan_id, $user_id);
                 $json = array('id' => $data['id'], 'name' => $data['name'], 'email' => $data['email'], 'company' => $data['company'], 'city' => $data['city']);
                 echo json_encode($json);
             } catch (Exception $e) {
                 echo $e;
             }
             exit;
             break;
         case 'removeuser':
             $plan_id = array_shift($this->param);
             $user_id = array_shift($this->param);
             $training = new Training();
             $t_data = $training->get(array('plan_id' => $plan_id, 'user_id' => $user_id));
             $training->delete($t_data['id']);
             try {
                 echo json_encode('');
             } catch (Exception $e) {
                 echo $e;
             }
             exit;
             break;
     }
 }
开发者ID:jedaika,项目名称:Trainings,代码行数:57,代码来源:admin_training.php


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