/** * 分组下拉框 - 班级 * @param $clsArr 班级范围数组 * @return array */ public static function getClassOptg($clsArr) { $where = array('college_id' => ss_clgid(), 'status' => 1); if (isset($clsArr)) { $where['id'] = array('in', $clsArr); } $arr = M('class')->where($where)->order('grade asc')->getField('id,name,grade'); $data = array(); if (is_array($arr)) { foreach ($arr as $k => $v) { $data[$v['grade'] . '级'][$k] = $v['name']; } } return $data; }
/** * @overrides */ protected function initSqlOptions() { return array('associate' => array('user|creator_id|id||`college_id`=' . ss_clgid()), 'where' => array('_string' => "to_users LIKE '%," . ss_uid() . ",%'", 'status' => 1)); }
/** * 检索 - 自动完成 */ public function ajax_serachTypeahead(&$json) { $val = trim(I('filter')); if (!preg_match('/^([\\x{4e00}-\\x{9fa5}]+|\\d{10})$/u', $val)) { die; } $collegeId = ss_clgid(); $lists = $this->query("SELECT hy.name,hy.user_no AS `no`,class.name AS `className` FROM `stusys_user` `hy` INNER JOIN `stusys_student` AS `student` ON hy.id = student.user_id INNER JOIN `stusys_class` AS `class` ON student.class_id = class.id WHERE ( hy.name LIKE '%{$val}%' OR hy.user_no='{$val}' ) AND hy.status = 1 AND class.college_id={$collegeId} ORDER BY class.grade desc LIMIT 6"); if (!$lists) { die; } $json = $lists; }
/** * @overrides */ protected function initFieldsOptions() { return array('name' => array('title' => '姓名', 'table' => 'user', 'list' => array('order' => 'CONVERT(user.name USING gbk)', 'callback' => array('tplReplace', '{callback}' => array('val_decrypt'), C('TPL_DETAIL_BTN'), '{#}'), 'search' => array('query' => 'like')), 'form' => array('validate' => array('required' => true, 'minlength' => 2))), 'roles' => array('form' => array('fill' => array('add' => array('value', ',31,')))), 'job' => array('title' => '职务', 'form' => array('type' => 'text', 'validate' => array('required' => true))), 'user_no' => array('title' => '教工号', 'table' => 'user', 'list' => array('hidden' => true), 'form' => array('validate' => array('required' => true))), 'sex' => array('title' => '性别', 'table' => 'user', 'list' => array('search' => array('type' => 'select')), 'form' => array('type' => 'select', 'validate' => array('required' => true))), 'phone' => array('title' => '电话', 'table' => 'user', 'list' => array('order' => false, 'callback' => array('val_decrypt')), 'form' => array('validate' => array('number' => true, 'minlength' => 7, 'maxlength' => 11), 'fill' => array('both' => array('val_encrypt')), 'callback' => array('val_decrypt'))), 'login_last_time' => array('title' => '上次登录', 'list' => array('callback' => array('to_time'))), 'avatar_file' => array('table' => 'user', 'form' => array('title' => '头像', 'type' => 'file', 'file' => array('ext' => 'jpg,png'), 'fill' => array('both' => array('val_encrypt', '{callback}' => array('writeFile'), '{#}')))), 'remark' => array('form' => array('title' => '备注', 'type' => 'textarea')), 'college_id' => array('table' => 'user', 'form' => array('fill' => array('both' => array('value', ss_clgid())))), 'password' => array('table' => 'user', 'form' => array('title' => '密码', 'add' => false, 'fill' => array('edit' => array('pwdEncrypt'), 'add' => array('value', 'da3RZTZoQzhjcY0n4lboRUSCatsskH7lzZrVxUZpmy84Pv16lWfDUVSoTNqSC3G4Nc7cvJIS43MHMJ9GYwXHyqIW62HGag2NKwFZ1rhJ_5bFdzjp845gwChjkzz6sIaM')))), 'user_status' => array('list' => array('title' => '账号状态', 'width' => '30', 'callback' => array('status'), 'orderdir' => 'hy.status')), 'status' => array('table' => 'user', 'form' => array('title' => '账号状态', 'callback' => array('value', '{:user_status}'), 'type' => 'select', 'options' => array(1 => '正常', '00' => '禁用'), 'style' => 'no-bs-select'))); }
/** * 图表汇总 * @return json */ protected function detail_chart() { $grades = $this->associate(array('student|id|class_id'))->where(array('student.status' => 1, 'status' => 1, 'college_id' => ss_clgid()))->field(array('grade' => 'name', 'count(grade)' => 'value'))->group('grade')->order('grade asc')->select(); $classes = $this->associate(array('student|id|class_id'))->where(array('student.status' => 1, 'status' => 1, 'college_id' => ss_clgid()))->field(array('name', 'count(hy.id)' => 'value'))->group('hy.id')->order('grade asc')->select(); return array('json' => json_encode(array('grades' => $grades, 'classes' => $classes))); }
/** * @overrides */ protected function initSqlOptions() { return array('associate' => array('user|user_id|id|name,user_no,sex,phone,login_last_time'), 'where' => array('user.college_id' => ss_clgid(), 'status' => 1)); }
/** * @overrides */ protected function initSqlOptions() { return array('associate' => array('user|user_id|id|id user_id,name user_id_text,avatar_file|`college_id`=' . ss_clgid()), 'field' => 'id,content,create_time'); }