123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <?php
- Doo::loadCore ( 'db/DooModel' );
- class L_category extends DooModel {
- public $cid;
- public $title;
- public $defult;
- public $districtid;
- public $_table = 'CLD_L_category';
- public $_primarykey = 'cid';
- public $_fields = array (
- 'cid',
- 'title',
- 'defult',
- 'districtid'
- );
- public function checkUser($uid, $passwork) {
- return $this->find ( array (
- 'where' => "uid= '" . $uid . "' and passwork = '" . addslashes ( $passwork ) . "'",
- 'asArray' => TRUE
- ) );
- }
-
- public function getCategoryInCid($cidString = '') {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- if (empty ( $cidString ))
- return array ();
-
- $list= $this->find ( array (
- 'where' => "cid in ( " .$cidString . ") ",
- 'asArray' => TRUE
- ) );
- foreach ( $list as $key => $value ) {
- $list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
- }
- return $list;
- }
-
- public function getCategoryById($cid = 0, $othercid = "") {
- if (! empty ( $othercid ))
- return $this->find ( array (
- 'where' => "cid in ( " . $cid . "," . $othercid . ") ",
- 'asArray' => TRUE
- ) );
- else
- return $this->find ( array (
- 'where' => "cid= '" . $cid . "' ",
- 'asArray' => TRUE
- ) );
- }
-
- /**
- * 软件获取办事处
- * @return string
- */
- public function getCategoryBySoft() {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'department' );
- $department = new department ();
-
- $list = $this->find ( array (
- 'asc' => 'cid',
- 'asArray' => TRUE
- ) );
-
- foreach ( $list as $key => $value ) {
- $list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
- }
-
- return $list;
- }
-
- public function getCategory() {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'department' );
- $department = new department ();
-
- $list = $this->find ( array (
- 'asc' => 'cid',
- 'asArray' => TRUE
- ) );
-
- foreach ( $list as $key => $value ) {
- $list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
- $list [$key] ['department'] =$department->getDepartmentBycid($value ['cid']);
- }
-
- return $list;
- }
-
- /**
- * 获得办事处和部门
- * @return unknown
- */
- public function getCategoryDepartment(){
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'department' );
- $department = new department ();
- $categorylist2 = $this->find ( array (
- 'desc' => 'cid',
- 'asArray' => TRUE
- ) );
-
- $categorylist3=$categorylist2;
- $bakCategory = array ();
- foreach ( $categorylist3 as $key => $value ) {
- $departList = $department->getDepartmentBycid ( $value ['cid'] );
- if (! empty ( $departList )) {
- array_unshift ( $bakCategory, $value );
-
- unset ( $categorylist2 [$key] );
- foreach ( $departList as $v ) {
- array_unshift ( $bakCategory, array (
- 'cid' => $v ['cid'],
- 'cidKey'=> $XDeode->encode ( $v ['cid'] ),
- 'title' => $value ['title'],
- 'did' => $v ['did'],
- 'didKey'=>$XDeode->encode ( $v ['did'] ),
- 'departmentName' => $v ['departmentName']
- ) );
- }
- }
- }
-
- foreach ( $bakCategory as $value ) {
- array_unshift ( $categorylist2, $value );
- }
-
- foreach ($categorylist2 as $key=>$value){
- $categorylist2 [$key]['cidKey']=$XDeode->encode ( $value ['cid'] );
- if(!isset($categorylist2 [$key]['didKey'])||empty($categorylist2 [$key]['didKey']))
- $categorylist2 [$key]['didKey']='';
-
- }
-
- return $categorylist2;
- }
-
-
- public function getUserByIdList($puid) {
- return $this->find ( array (
- 'where' => "uid= '" . $puid . "'",
- 'asArray' => TRUE
- ) );
- }
- public function getCategoryStaff() {
- $list = $this->find ( array (
- 'asArray' => TRUE
- ) );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- foreach ( $list as $key => $value ) {
- $list [$key] ['staff'] = $staff->getStaffByCid ( $value ['cid'] );
- }
- return $list;
- }
- }
- ?>
|