You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
	
	
		
		
			
	
	
		
			
				
					
						
							|  |  |  | <?php
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * Created by Error202
 | 
					
						
							|  |  |  |  * Date: 13.08.2018
 | 
					
						
							|  |  |  |  */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace backend\widgets;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use yii\base\Widget;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class NotificationCountWidget extends Widget
 | 
					
						
							|  |  |  | {
 | 
					
						
							|  |  |  | 	public function run()
 | 
					
						
							|  |  |  | 	{
 | 
					
						
							|  |  |  | 		$count = 0;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (isset(\Yii::$app->params['notifications'])) {
 | 
					
						
							|  |  |  | 			foreach ( \Yii::$app->params['notifications'] as $notification ) {
 | 
					
						
							|  |  |  | 				$count += $notification['count'];
 | 
					
						
							|  |  |  | 			}
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		return $this->render('notification-count', [
 | 
					
						
							|  |  |  | 			'notifications' => isset(\Yii::$app->params['notifications']) ? \Yii::$app->params['notifications'] : [],
 | 
					
						
							|  |  |  | 			'count' => $count,
 | 
					
						
							|  |  |  | 		]);
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 |