<?php
foreach ($this->artists as $role => $data) {
?>
<table class="data localization-table" id="tblArtists">
	<tr style="width: 25%;">
		<th class="center"><?php echo ucfirst($role);?> </th>
		<th class="center">Localization Language</th>
		<th class="center">Localization Text</th>
	</tr>
	<?php   foreach ($data as $artistId => $artist) { ?>
	<tr>
		<td align="center"><?php echo $artist['artistName']; //original artist name?></td>
		<td colspan="2" class="locale-items">
			<ul class="<?php echo $role;?>" id="<?php echo $artistId;?>">
				<!-- @todo: this has to loop with api response -->
				<?php if(isset($this->localizationArtists[$role][$artistId])) {
						foreach ($this->localizationArtists[$role][$artistId] as $localizationArtist) { ?>
							<li>
								<div class="locale-item">
								<?php 
								$defaultLanguage = '';
								if(isset($localizationArtist['languageId'])) { 
					   				$defaultLanguage = $localizationArtist['languageId'];
								}
								echo $this->formSelect("artists[{$role}][languageId][]", $defaultLanguage, array('multiple' => false), $this->languages);
								?>
								</div>
								<div class="locale-item">
								<?php 
								$defaultLocalizationText = '';
								if(isset($localizationArtist['artistName'])) {
						    		$defaultLocalizationText =  $localizationArtist['artistName']; 
                    			} 
                    			?>
								<input type="text" value="<?php echo htmlentities($defaultLocalizationText, ENT_QUOTES, 'UTF-8');?>" name="artists[<?php echo $role;?>][languageValue][]"/>
								</div>
								<div class="locale-remove">
									<a href="#">&times;</a>
								</div>
							</li>
						<?php }
					}?>
			</ul>
		</td>
	</tr>
	<?php } ?>
	<tr>
		<td colspan="3" align="right"><a
			href="javascript:localization.add('<?php echo $role;?>','artists');">Add Localization</a></td>
	</tr>
</table>
<?php } ?>
