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.
		
		
		
		
		
			
		
			
				
					
					
						
							47 lines
						
					
					
						
							1.3 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							47 lines
						
					
					
						
							1.3 KiB
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								use App\Dataclasses\DatabaseFolkTuneDetails;
							 | 
						|
								use App\Dataclasses\TuneVariant;
							 | 
						|
								use App\Wrappers\DatabaseInteractions;
							 | 
						|
								use App\Wrappers\SQLQueryBuilderWrapper;
							 | 
						|
								
							 | 
						|
								require_once __DIR__ . "/../../../vendor/autoload.php";
							 | 
						|
								
							 | 
						|
								$tuneDir = __DIR__ . '/../../../LocalStorage/Tunes';
							 | 
						|
								$targetTuneVariantID = $_GET['tune-variant-id'];
							 | 
						|
								
							 | 
						|
								$db = new DatabaseInteractions();
							 | 
						|
								
							 | 
						|
								$tuneDetails = $db->RunOneSelect(
							 | 
						|
								    queryBuilder: SQLQueryBuilderWrapper::SELECT_ONE(
							 | 
						|
								        table: 'Tunes',
							 | 
						|
								        id: $targetTuneVariantID
							 | 
						|
								    )
							 | 
						|
								        ->cols([
							 | 
						|
								            'T.ID AS TuneID',
							 | 
						|
								            "CONCAT('[', GROUP_CONCAT(
							 | 
						|
								                CONCAT(
							 | 
						|
								                    '{\"TimeSignature\":', JSON_QUOTE(T_TP.TimeSignature), ',',
							 | 
						|
								                    '\"KeySignature\":', JSON_QUOTE(T_TP.KeySignature), ',',
							 | 
						|
								                    '\"PartLetter\":', JSON_QUOTE(T_TP.PartLetter), ',',
							 | 
						|
								                    '\"ABCNotation\":', JSON_QUOTE(T_TP.ABCNotation), '}'
							 | 
						|
								                )
							 | 
						|
								            ), ']') AS Parts"
							 | 
						|
								        ])
							 | 
						|
								        ->join(
							 | 
						|
								            join: 'INNER',
							 | 
						|
								            spec: 'TuneParts AS T_TP',
							 | 
						|
								            cond: 'T.ID = T_TP.TuneID'
							 | 
						|
								        )
							 | 
						|
								        ->groupBy(spec: [
							 | 
						|
								            'T.ID',
							 | 
						|
								        ])
							 | 
						|
								);
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								$tuneDetails = new DatabaseFolkTuneDetails($tuneDetails);
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								header(header: "Content-type: text/text");
							 | 
						|
								echo $tuneDetails->Build();
							 | 
						|
								die();
							 | 
						|
								
							 |