| 
					
				 | 
			
			
				@@ -428,23 +428,83 @@ class MainController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$longle = new longle (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Doo::loadModel ( 'L_category' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$lcategory = new L_category (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Doo::loadModel ( 'department' ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$department = new department (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$staffCondition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$categorylist2 = array (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($this->staff [0] ['cid'] != 12) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$staffCondition = " and cid=" . $this->staff [0] ['cid']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			array_push ( $categorylist2, array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					'cid' => $this->staff [0] ['cid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					'title' => $this->staff [0] ['category']  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 			array_push ( $categorylist2, array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 					'cid' => $this->staff [0] ['cid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 					'title' => $this->staff [0] ['category']  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 			) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$otherC=$lcategory->getCategoryById($this->staff [0] ['cid'],$this->staff [0] ['othercid']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			foreach ($otherC as $value){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				array_push ( $categorylist2, array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'cid' => $value ['cid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'title' => $value ['title'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				) ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$sql = 'SELECT `CLD_L_category`.cid,`CLD_L_category`.title,count(`CLD_staff`.sid) as count FROM `CLD_L_category` left join `CLD_staff` on `CLD_L_category`.cid=`CLD_staff`.cid group by `CLD_staff`.cid HAVING count(`CLD_staff`.sid)>0 order by count(`CLD_staff`.sid) desc'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$query = Doo::db ()->query ( $sql ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$result = $query->fetchAll (); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$categorylist2 = $result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//$otherC=$lcategory->getCategoryById($this->staff [0] ['cid'],$this->staff [0] ['othercid']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if (! empty ( $cid )) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			$staffCondition = " and cid=" . $cid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//print_r($categorylist2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//有待优化 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$categorylist3=$categorylist2;$bakCategory=array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach ($categorylist3 as $key=>$value){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$departList=$department->getDepartmentBycid($value['cid']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (!empty($departList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//$bakCategory=$categorylist2[$key]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				array_unshift($bakCategory,$value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				unset($categorylist2[$key]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				foreach ($departList as $v){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				array_unshift($bakCategory,array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'cid'=>$v['cid'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'title'=>$value['title'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'count'=>$value['count'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'did'=>$v['did'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						'departmentName'=>$v['departmentName'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach ($bakCategory as $value){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			array_unshift($categorylist2,$value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//array_unshift($categorylist2,$bakCategory); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//print_r($categorylist2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$did=$data ['did']=''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$othercateSql=''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (!empty($this->staff [0] ['othercid'])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$othercateSql=" or (othercid like '".$this->staff [0] ['othercid']."')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (! empty ( $cid )){// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(is_numeric($cid)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$staffCondition = " and cid=" . $cid.$othercateSql; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$cdid=explode('-', $cid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$cid=$cdid[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$data ['did'] =$did= $cdid[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				$staffCondition = " and cid=" . $cdid[0]." and departmentID=".$cdid[1].$othercateSql; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//echo $staffCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//echo $staffCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// Doo::db()->beginTransaction(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$staffList = $staff->find ( array ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				'where' => ' username !="admin"' . $staffCondition, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -520,14 +580,17 @@ class MainController extends DooController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$categoryCondition = " and cid=" . $this->staff [0] ['cid']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$sidCondition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if (! empty ( $cid )) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (! empty ( $cid )){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$categoryCondition = " and cid=" . $cid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 			if (!empty($did)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 				$categoryCondition .= " and departmentID=" . $did; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (! empty ( $sid )) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$sidCondition = " and sid=" . $sid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($this->staff [0] ['cid'] == 12 && empty ( $cid )) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			$categoryCondition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//echo $categoryCondition; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// Year(updatetime)=".date('Y')." and Month(updatetime)=".date('m')." date_format(updatetime,"%m-%d") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$actionLogClient = $action_log->find ( array ( 
			 |