Exemplo n.º 1
0
 /**
  * 监考首页
  */
 public function index()
 {
     require_once APPPATH . 'config/app/exam/log_type_desc.php';
     $data = $this->_data;
     $data['page_title'] = '监考人员监控平台';
     $data['current_exam'] = $data['exams'][0];
     //获取操作日志类型
     $log_types = Log_type_desc::$logs;
     $data['log_types'] = $log_types;
     //获取当前场次考生数
     $this->load->model('exam/exam_place_model');
     $place_id = $this->session->userdata('exam_i_place_id');
     $students = $this->exam_place_model->get_exam_place_student_list($place_id, true);
     $data['students'] = $students;
     //将考生按照拼音首字母归档
     $pinyin_students = array();
     $tmp_students = array();
     foreach ($students as $student) {
         $first_letter = string_to_pinyin($student['truename']);
         $first_char = substr($first_letter, 0, 1);
         $student['py'] = $first_letter;
         $student['uid'] = $student['uid'];
         $pinyin_students[$first_char][] = $student;
         $tmp_students[] = $student;
     }
     $data['pinyin_students'] = $pinyin_students;
     $data['students'] = $tmp_students;
     $this->load->view('invigilate/index', $data);
 }
Exemplo n.º 2
0
 /**
  * 提示搜索接口
  */
 public function public_suggest_search($q)
 {
     // 关键词转换为拼音
     $pinyin = string_to_pinyin($q);
     $this->keyword_db = Loader::model('search_keyword_model');
     $suggest = $this->keyword_db->where(array('pinyin' => array('like', "{$pinyin}%")))->order('searchnums DESC')->limit(10)->select();
     foreach ($suggest as $v) {
         echo $v['keyword'] . "\n";
     }
 }
Exemplo n.º 3
0
 /**
  * 批量修改
  */
 public function batch_edit()
 {
     $categorys = S('common/category_content');
     if (isset($_POST['dosubmit'])) {
         $catid = intval($_POST['catid']);
         $post_setting = $_POST['setting'];
         // 栏目生成静态配置
         $infos = $info = array();
         $infos = $_POST['info'];
         if (empty($infos)) {
             showmessage(L('operation_success'));
         }
         $this->attachment_db = Loader::model('attachment_model');
         foreach ($infos as $catid => $info) {
             $setting = string2array($categorys[$catid]['setting']);
             if ($_POST['type'] != 2) {
                 if ($post_setting[$catid]['ishtml']) {
                     $setting['category_ruleid'] = $_POST['category_html_ruleid'][$catid];
                 } else {
                     $setting['category_ruleid'] = $_POST['category_php_ruleid'][$catid];
                     $info['url'] = '';
                 }
             }
             foreach ($post_setting[$catid] as $_k => $_setting) {
                 $setting[$_k] = $_setting;
             }
             // 内容生成静态配置
             if ($post_setting[$catid]['content_ishtml']) {
                 $setting['show_ruleid'] = $_POST['show_html_ruleid'][$catid];
             } else {
                 $setting['show_ruleid'] = $_POST['show_php_ruleid'][$catid];
             }
             if ($setting['repeatchargedays'] < 1) {
                 $setting['repeatchargedays'] = 1;
             }
             $info['sethtml'] = isset($post_setting[$catid]['create_to_html_root']) && !empty($post_setting[$catid]['create_to_html_root']) ? $post_setting[$catid]['create_to_html_root'] : 0;
             $info['setting'] = array2string($setting);
             $info['application'] = 'content';
             $info['letter'] = strtolower(string_to_pinyin($info['catname']));
             $this->db->where(array('catid' => $catid))->update($info);
             // 更新附件状态
             if ($info['image'] && C('attachment', 'stat')) {
                 $this->attachment_db->api_update($info['image'], 'catid-' . $catid, 1);
             }
         }
         $this->public_cache();
         showmessage(L('operation_success'), U('admin/category/init'));
     } else {
         if (isset($_POST['catids'])) {
             $template_list = template_list(0);
             foreach ($template_list as $k => $v) {
                 $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
                 unset($template_list[$k]);
             }
             $show_validator = '';
             $catid = intval($_GET['catid']);
             $type = isset($_POST['type']) ? intval($_POST['type']) : 0;
             if (empty($_POST['catids'])) {
                 showmessage(L('illegal_parameters'));
             }
             $batch_array = $workflows = array();
             foreach ($categorys as $catid => $cat) {
                 if ($cat['type'] == $type && in_array($catid, $_POST['catids'])) {
                     $batch_array[$catid] = $cat;
                 }
             }
             if (empty($batch_array)) {
                 showmessage(L('please_select_category'));
             }
             $workflows = S('common/workflow');
             if ($workflows) {
                 $workflows_datas = array();
                 foreach ($workflows as $_k => $_v) {
                     $workflows_datas[$_v['workflowid']] = $_v['workname'];
                 }
             }
             $show_header = true;
             if ($type == 1) {
                 include $this->view('category_batch_edit_page');
             } else {
                 include $this->view('category_batch_edit');
             }
         } else {
             $type = isset($_GET['select_type']) ? intval($_GET['select_type']) : 0;
             $tree = Loader::lib('Tree');
             $tree->icon = array('&nbsp;&nbsp;│ ', '&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;└─ ');
             $tree->nbsp = '&nbsp;&nbsp;';
             $category = array();
             foreach ($categorys as $catid => $r) {
                 if ($r['type'] == 2 && $r['child'] == 0) {
                     continue;
                 }
                 $category[$catid] = $r;
             }
             $str = "<option value='\$catid' \$selected>\$spacer \$catname</option>";
             $tree->init($category);
             $string .= $tree->get_tree(0, $str);
             include $this->view('category_batch_select');
         }
     }
 }