public function actionList() { $cond = new CDbCriteria(); $cond->order = 'groupid asc'; $model = BasicGroup::model()->findAll($cond); $rows = array(); foreach ($model as $value) { $rows[] = array('text' => mb_convert_encoding($value->groupname, 'UTF8', 'GBK'), 'id' => $value->groupid, 'leaf' => TRUE); } echo json_encode($rows); }
public function actionIndex() { //获取所有的组 $groupRs = BasicGroup::model()->findAll(array('select' => 'groupid,groupname', 'order' => 'groupid asc')); $group = array(); foreach ($groupRs as $value) { $group[] = array('id' => $value['groupid'], 'name' => mb_convert_encoding($value['groupname'], 'UTF-8', 'GBK')); } //获取所有的团队 $deptRs = BasicDept::model()->findAll(array('select' => 'deptid,deptname', 'order' => 'deptid asc')); $dept = array(); foreach ($deptRs as $value) { $dept[] = array('id' => $value['deptid'], 'name' => mb_convert_encoding($value['deptname'], 'UTF-8', 'GBK')); } $this->render('index', array('group' => $group, 'dept' => $dept)); }