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


PHP Model_Category::getPath方法代码示例

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


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

示例1: getMaterialsByTeacher

 public function getMaterialsByTeacher($pagination, $teacher_id = NULL, $node_id = NULL, $filter = NULL)
 {
     $cat = new Model_Category();
     $qry = DB::select('materials.*', array('users.name', 'name'))->join('users', 'left')->on('users.id', '=', 'materials.teacher_id')->from('materials');
     if ($teacher_id) {
         $qry->where('teacher_id', '=', $teacher_id);
     }
     if ($node_id) {
         $qry->where('node_id', '=', $node_id);
     }
     if (isset($filter['FIO']) && $filter['FIO'] != '') {
         $qry->where('name', 'like', '%' . $filter['FIO'] . '%');
     }
     if (!$teacher_id) {
         $qry->order_by('users.name', 'asc');
     }
     if ($pagination) {
         $data = $qry->order_by('subjectName', 'asc')->order_by('ctime', 'asc')->limit($pagination->items_per_page)->offset($pagination->offset)->execute()->as_array();
     } else {
         $data = $qry->order_by('subjectName', 'asc')->order_by('ctime', 'asc')->execute()->as_array();
     }
     foreach ($data as $key => $item) {
         $data[$key]['path'] = $cat->getPath($item['node_id']);
         $data[$key]['isLeaf'] = $cat->isLeaf($item['node_id']);
         $data[$key]['link'] = $this->getLink($item);
     }
     return $data;
 }
开发者ID:reznikds,项目名称:Reznik,代码行数:28,代码来源:material.php

示例2: action_shownode

 public function action_shownode()
 {
     //Приведение к целому чеслу, если передайотся float то abs() убрать!
     $node_id = abs((int) $this->request->param('id', NULL));
     $teacher_id = abs((int) $this->request->param('id2', NULL));
     $data = array();
     //Настройки навигации
     $count = ORM::factory('material')->count_all();
     $pagination = Pagination::factory(array('total_items' => $count))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
     //Выбор
     $material = ORM::factory('material')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     $cat = new Model_Category();
     $data['path'] = $cat->getPath($node_id);
     $data['materials'] = $material->getMaterialsByTeacher('', $teacher_id, $node_id);
     $data['teachername'] = ORM::factory('user', $teacher_id)->name;
     //Вывод в шаблон
     $content = View::factory('materials/shownode', array('data' => $data, 'pagination' => $pagination));
     $this->tpl->content = array($content);
 }
开发者ID:reznikds,项目名称:Reznik,代码行数:19,代码来源:public.php


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