| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -468,53 +468,40 @@ class ExerciseResult | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $hotpotato_name | 
					 | 
					 | 
					 | 
					            $hotpotato_name | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ); | 
					 | 
					 | 
					 | 
					        ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $now = api_get_local_time(); | 
					 | 
					 | 
					 | 
					        $now = api_get_local_time(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $filename = 'exercise_results_'.$now.'.xlsx'; | 
					 | 
					 | 
					 | 
					        $filename = 'exercise_results_'.$now; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (!empty($user_id)) { | 
					 | 
					 | 
					 | 
					        if (!empty($user_id)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $filename = 'exercise_results_user_'.$user_id.'_'.$now.'.xlsx'; | 
					 | 
					 | 
					 | 
					            $filename = 'exercise_results_user_'.$user_id.'_'.$now; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $spreadsheet = new PHPExcel(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $spreadsheet->setActiveSheetIndex(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet = $spreadsheet->getActiveSheet(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $line = 1; // Skip first line | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column = 0; //skip the first column (row titles) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // check if exists column 'user' | 
					 | 
					 | 
					 | 
					        // check if exists column 'user' | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $with_column_user = false; | 
					 | 
					 | 
					 | 
					        $withColumnUser = false; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        foreach ($this->results as $result) { | 
					 | 
					 | 
					 | 
					        foreach ($this->results as $result) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (!empty($result['last_name']) && !empty($result['first_name'])) { | 
					 | 
					 | 
					 | 
					            if (!empty($result['last_name']) && !empty($result['first_name'])) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $with_column_user = true; | 
					 | 
					 | 
					 | 
					                $withColumnUser = true; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                break; | 
					 | 
					 | 
					 | 
					                break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $officialCodeInList = api_get_setting('show_official_code_exercise_result_list'); | 
					 | 
					 | 
					 | 
					        $officialCodeInList = api_get_setting('show_official_code_exercise_result_list'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        $list = []; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if ($with_column_user) { | 
					 | 
					 | 
					 | 
					        if ($withColumnUser) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (api_is_western_name_order()) { | 
					 | 
					 | 
					 | 
					            if (api_is_western_name_order()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName')); | 
					 | 
					 | 
					 | 
					                $list[0][] = get_lang('FirstName'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column++; | 
					 | 
					 | 
					 | 
					                $list[0][] = get_lang('LastName'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName')); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else { | 
					 | 
					 | 
					 | 
					            } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName')); | 
					 | 
					 | 
					 | 
					                $list[0][] = get_lang('LastName'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column++; | 
					 | 
					 | 
					 | 
					                $list[0][] = get_lang('FirstName'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName')); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if ($officialCodeInList === 'true') { | 
					 | 
					 | 
					 | 
					            if ($officialCodeInList === 'true') { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('OfficialCode')); | 
					 | 
					 | 
					 | 
					                $list[0][] = get_lang('OfficialCode'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column++, $line, get_lang('LoginName')); | 
					 | 
					 | 
					 | 
					            $list[0][] = get_lang('LoginName'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Email')); | 
					 | 
					 | 
					 | 
					            $list[0][] = get_lang('Email'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Groups')); | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('Groups'); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if ($export_user_fields) { | 
					 | 
					 | 
					 | 
					        if ($export_user_fields) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //show user fields section with a big th colspan that spans over all fields | 
					 | 
					 | 
					 | 
					            //show user fields section with a big th colspan that spans over all fields | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -529,192 +516,117 @@ class ExerciseResult | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //show the fields names for user fields | 
					 | 
					 | 
					 | 
					            //show the fields names for user fields | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            foreach ($extra_user_fields as $field) { | 
					 | 
					 | 
					 | 
					            foreach ($extra_user_fields as $field) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                $list[0][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column, | 
					 | 
					 | 
					 | 
					                    strip_tags($field[3]), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $line, | 
					 | 
					 | 
					 | 
					                    ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                    $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        strip_tags($field[3]), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ); | 
					 | 
					 | 
					 | 
					                ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Title')); | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('Title'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('StartDate'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('StartDate')); | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('EndDate'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('Duration').' ('.get_lang('MinMinutes').')'; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('EndDate')); | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('Score'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('Total'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Duration').' ('.get_lang('MinMinutes').')'); | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('Status'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('ToolLearnpath'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Score')); | 
					 | 
					 | 
					 | 
					        $list[0][] = get_lang('UserIsCurrentlySubscribed'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					        $column = 1; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Total')); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Status')); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('ToolLearnpath')); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $worksheet->setCellValueByColumnAndRow($column, $line, get_lang('UserIsCurrentlySubscribed')); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $line++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        foreach ($this->results as $row) { | 
					 | 
					 | 
					 | 
					        foreach ($this->results as $row) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column = 0; | 
					 | 
					 | 
					 | 
					            if ($withColumnUser) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if ($with_column_user) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (api_is_western_name_order()) { | 
					 | 
					 | 
					 | 
					                if (api_is_western_name_order()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                    $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $column, | 
					 | 
					 | 
					 | 
					                        strip_tags($row['first_name']), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $line, | 
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                        $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            strip_tags($row['first_name']), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ); | 
					 | 
					 | 
					 | 
					                    ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column++; | 
					 | 
					 | 
					 | 
					                    $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                        strip_tags($row['last_name']), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $column, | 
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $line, | 
					 | 
					 | 
					 | 
					                        $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        api_html_entity_decode( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            strip_tags($row['last_name']), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ); | 
					 | 
					 | 
					 | 
					                    ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } else { | 
					 | 
					 | 
					 | 
					                } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                    $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $column, | 
					 | 
					 | 
					 | 
					                        strip_tags($row['last_name']), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $line, | 
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                        $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            strip_tags($row['last_name']), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ); | 
					 | 
					 | 
					 | 
					                    ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column++; | 
					 | 
					 | 
					 | 
					                    $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                        strip_tags($row['first_name']), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $column, | 
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $line, | 
					 | 
					 | 
					 | 
					                        $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        api_html_entity_decode( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            strip_tags($row['first_name']), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ); | 
					 | 
					 | 
					 | 
					                    ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if ($officialCodeInList === 'true') { | 
					 | 
					 | 
					 | 
					                if ($officialCodeInList === 'true') { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                    $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $column, | 
					 | 
					 | 
					 | 
					                        strip_tags($row['official_code']), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $line, | 
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                        $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            strip_tags($row['official_code']), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ); | 
					 | 
					 | 
					 | 
					                    ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column++, | 
					 | 
					 | 
					 | 
					                    strip_tags($row['username']), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $line, | 
					 | 
					 | 
					 | 
					                    ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                    $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        strip_tags($row['username']), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ); | 
					 | 
					 | 
					 | 
					                ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column, | 
					 | 
					 | 
					 | 
					                    strip_tags($row['email']), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $line, | 
					 | 
					 | 
					 | 
					                    ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                    $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        strip_tags($row['email']), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ); | 
					 | 
					 | 
					 | 
					                ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					            $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column, | 
					 | 
					 | 
					 | 
					                strip_tags( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $line, | 
					 | 
					 | 
					 | 
					                    implode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                        ', ', | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    strip_tags( | 
					 | 
					 | 
					 | 
					                        GroupManager:: get_user_group_name($row['user_id']) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        implode( | 
					 | 
					 | 
					 | 
					                    ) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            ", ", | 
					 | 
					 | 
					 | 
					                ), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            GroupManager:: get_user_group_name($row['user_id']) | 
					 | 
					 | 
					 | 
					                ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ) | 
					 | 
					 | 
					 | 
					                $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            ); | 
					 | 
					 | 
					 | 
					            ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if ($export_user_fields) { | 
					 | 
					 | 
					 | 
					            if ($export_user_fields) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //show user fields data, if any, for this user | 
					 | 
					 | 
					 | 
					                // show user fields data, if any, for this user | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $user_fields_values = UserManager::get_extra_user_data( | 
					 | 
					 | 
					 | 
					                $values = UserManager::get_extra_user_data( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $row['user_id'], | 
					 | 
					 | 
					 | 
					                    $row['user_id'], | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    false, | 
					 | 
					 | 
					 | 
					                    false, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    false, | 
					 | 
					 | 
					 | 
					                    false, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    false, | 
					 | 
					 | 
					 | 
					                    false, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    true | 
					 | 
					 | 
					 | 
					                    true | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ); | 
					 | 
					 | 
					 | 
					                ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                foreach ($user_fields_values as $value) { | 
					 | 
					 | 
					 | 
					                foreach ($values as $value) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					                    $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $column, | 
					 | 
					 | 
					 | 
					                        strip_tags($value), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        $line, | 
					 | 
					 | 
					 | 
					                        ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                        $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            strip_tags($value), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ); | 
					 | 
					 | 
					 | 
					                    ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow( | 
					 | 
					 | 
					 | 
					            $list[$column][] = api_html_entity_decode( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $column, | 
					 | 
					 | 
					 | 
					                strip_tags($row['title']), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $line, | 
					 | 
					 | 
					 | 
					                ENT_QUOTES, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                api_html_entity_decode( | 
					 | 
					 | 
					 | 
					                $charset | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    strip_tags($row['title']), | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ENT_QUOTES, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $charset | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            ); | 
					 | 
					 | 
					 | 
					            ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					            $list[$column][] = $row['start_date']; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, $row['start_date']); | 
					 | 
					 | 
					 | 
					            $list[$column][] = $row['end_date']; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, $row['end_date']); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $duration = !empty($row['duration']) ? round($row['duration'] / 60) : 0; | 
					 | 
					 | 
					 | 
					            $duration = !empty($row['duration']) ? round($row['duration'] / 60) : 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, $duration); | 
					 | 
					 | 
					 | 
					            $list[$column][] = $duration; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					            $list[$column][] = $row['result']; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, $row['result']); | 
					 | 
					 | 
					 | 
					            $list[$column][] = $row['max']; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					            $list[$column][] = $row['status']; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, $row['max']); | 
					 | 
					 | 
					 | 
					            $list[$column][] = $row['lp_name']; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            $list[$column][] = $row['is_user_subscribed']; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					            $column++; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, $row['status']); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, $row['lp_name']); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $column++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $worksheet->setCellValueByColumnAndRow($column, $line, $row['is_user_subscribed']); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $line++; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        Export::arrayToXls($list, $filename); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $writer = new PHPExcel_Writer_Excel2007($spreadsheet); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $writer->save($file); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        DocumentManager::file_send_for_download($file, true, $filename); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return true; | 
					 | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |