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


PHP AdminController::getRange方法代码示例

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


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

示例1: index

 public function index()
 {
     $field = array('pkid as id', 'title', 'type', 'range', 'create_time', 'modify_time', 'is_delete');
     $param_form = I('post.') ? I('post.') : I('get.');
     //获取查询字
     I('get.tag') ? $param_form['tag'] = I('get.tag') : '';
     $param_form['title'] ? $where['title'] = array('like', "%" . $param_form['title'] . "%") : '';
     $param_form['range'] ? $where['range'] = array('like', "%" . $param_form['range'] . "%") : '';
     $param_form['tag'] == 'user' ? $where['type'] = 2 : ($where['type'] = 1);
     $begin_time = trim(I('post.time') ? I('post.time') : I('get.time'));
     $end_time = trim(I('post.end') ? I('post.end') : I('get.end'));
     if (!empty($begin_time) && !empty($end_time)) {
         $where['create_time'] = array(array('egt', $begin_time . ' 00:00:00'), array('elt', $end_time . ' 23:59:59'), 'and');
     }
     if (!empty($begin_time) && empty($end_time)) {
         $where['create_time'] = array('egt', $begin_time . ' 00:00:00');
     }
     if (empty($begin_time) && !empty($end_time)) {
         $where['create_time'] = array('elt', $end_time . ' 23:59:59');
     }
     $where['is_delete'] = 2;
     $tagTotal = $this->TagModel->getTagTotal($where);
     //列表总数量
     $page = isset($_GET['p']) ? intval(htmlspecialchars(strip_tags($_GET['p']))) : '';
     //获取url的分页参数
     $page = max(1, $page);
     $page = min($page, ceil($tagTotal / $this->page_number));
     // 获取合法的分页数
     $tagList = $this->TagModel->getTagList($where, $field, $page, $this->page_number);
     if (!empty($tagList)) {
         foreach ($tagList as $key => $value) {
             switch ($value['type']) {
                 case '2':
                     if ($value['range'] == 1) {
                         $tagList[$key]['typer'] = D('Enterprise')->where(array('account_id' => $value['account_id']))->getField('full_name');
                     }
                     if ($value['range'] == 2) {
                         $tagList[$key]['typer'] = D('Enterprise')->where(array('account_id' => $value['account_id']))->getField('full_name');
                     }
                     if ($value['range'] == 3) {
                         $tagList[$key]['typer'] = D('Student')->where(array('account_id' => $value['account_id']))->getField('name');
                     }
                     if ($value['range'] == 4) {
                         $tagList[$key]['typer'] = D('Student')->where(array('account_id' => $value['account_id']))->getField('name');
                     }
                     break;
                 default:
                     if ($value['account_id'] == 0) {
                         $tagList[$key]['typer'] = "系统";
                     }
                     break;
             }
             if (strpos($value['range'], ',')) {
                 $rangeArr = explode(',', $value['range']);
                 $bb = "";
                 foreach ($rangeArr as $k => $v) {
                     if ($v == 1) {
                         $bb .= "职位,";
                     }
                     if ($v == 2) {
                         $bb .= "企业,";
                     }
                     if ($v == 3) {
                         $bb .= "简历,";
                     }
                     if ($v == 4) {
                         $bb .= "学生,";
                     }
                 }
                 $aa = rtrim($bb, ',');
                 $tagList[$key]['rangeInfo'] = $aa;
             } else {
                 switch ($value['range']) {
                     case '1':
                         $cc = "职位";
                         break;
                     case '2':
                         $cc = "企业";
                         break;
                     case '3':
                         $cc = "简历";
                         break;
                     case '4':
                         $cc = "学生";
                         break;
                 }
                 $tagList[$key]['rangeInfo'] = $cc;
             }
         }
     }
     $map = $param_form ? $param_form : array();
     //生成分页连接参数
     $Page = new PageAdmin($tagTotal, $this->page_number, $map);
     //分页类实例化
     $this->assign('page', $Page->show());
     // 分页显示输出
     $this->assign('param_form', $param_form);
     // 查询关键字
     $this->assign('tagList', $tagList);
     $this->assign('rangeList', AdminController::getRange());
//.........这里部分代码省略.........
开发者ID:cy520win,项目名称:yunchao,代码行数:101,代码来源:TagController.class.php


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