<commit_before><?php

	# CONTROLLER TOOL TRANSCRIPTION

	$tipo 					= $this->component_obj->get_tipo();
	$parent 				= $this->component_obj->get_parent();
	$section_id 			= $parent;
	$section_tipo 			= $this->component_obj->get_section_tipo();
	$lang 					= $this->component_obj->get_lang();
	$label 					= $this->component_obj->get_label();
	$section_label 			= RecordObj_dd::get_termino_by_tipo($section_tipo);
	$component_name			= get_class($this->component_obj);
	$tool_locator			= DEDALO_TOOL_INVESTIGATION_SECTION_TIPO.'_'.DEDALO_TOOL_TRANSCRIPTION_ID;//
	$tool_name 				= get_class($this);
	$modo 					= $this->get_modo();
	$file_name 				= $modo;


	switch($modo) {	
		
		case 'button':
				
				break;

		case 'page':				

				# Fix related component (text)
				$this->component_related_obj = $this->get_component_related_obj();
					#dump($this->component_related_obj, ' this->component_related_obj');


				if (!is_object($this->component_related_obj)) {
					return null; 	# media sin transcripción asociada
				}

	
				# Because components are loaded by ajax, we need prepare js/css elements from tool
				#					
				# CSS
					css::$ar_url[] = DEDALO_LIB_BASE_URL.'/component_text_area/css/component_text_area.css';
					css::$ar_url[] = DEDALO_LIB_BASE_URL."/component_publication/css/component_publication.css";
					css::$ar_url[] = DEDALO_LIB_BASE_URL."/$component_name/css/$component_name.css";
					
				#
				# JS includes
					js::$ar_url[] = DEDALO_LIB_BASE_URL.'/component_text_area/js/component_text_area.js';
					js::$ar_url[] = DEDALO_LIB_BASE_URL."/component_publication/js/component_publication.js";	
					js::$ar_url[] = DEDALO_LIB_BASE_URL."/$component_name/js/$component_name.js";

				#
				# JS aditional
					if (defined('DEDALO_LOCK_COMPONENTS') && DEDALO_LOCK_COMPONENTS===true) {
						js::$ar_url[]  = DEDALO_LIB_BASE_URL."/lock_components/js/lock_components.js";
					}
					

				# TEXT (EDITOR) LEFT SIDE
				$this->component_related_obj->set_modo('tool_transcription');
				$original_lang 	= component_text_area::force_change_lang($this->component_related_obj->get_tipo(),
																		 $this->component_related_obj->get_parent(),
																		 $this->component_related_obj->get_modo(),
																		 $this->component_related_obj->get_lang(),
																		 $this->component_related_obj->get_section_tipo());
				$this->component_related_obj->set_lang($original_lang);				
				$component_related_obj_tipo = $this->component_related_obj->get_tipo();
				$html_text 					= $this->component_related_obj->get_html();
				$id_wrapper 				= 'wrapper_'.$this->component_related_obj->get_identificador_unico();

				# TEXTAREA_LANG
				# Note that component_textarea can change his lang ('force_change_lang') in some contexts
				$textarea_lang = $this->component_related_obj->get_lang();					
				

				# MEDIA (PLAYER) RIGHT SIDE
				$this->component_obj->set_modo('player');
				$html_media = $this->component_obj->get_html();
				# Player on iframe
				#$reelID 	= $this->component_obj->get_video_id();		#dump($reelID);
				#$iframe_url = DEDALO_LIB_BASE_URL . '/media_engine/av_media_player.php?reelID=' . $reelID .'&quality=' .DEDALO_AV_QUALITY_DEFAULT ;
				
				$target_tipo = $this->component_related_obj->get_tipo();
				$source_tipo = $this->component_obj->get_tipo();
				$parent   	 = $this->component_obj->get_parent();

				#
				# HEADER
				$component_related_tipo = $this->component_related_obj->get_tipo();	# Tipo del text_area
				# DATA LANGS OF CURRENT SECTION
				/*
				$section_id 			= $parent;
				$section_tipo 			= $this->component_obj->get_section_tipo();
				$section 				= section::get_instance($section_id ,$section_tipo);
				$ar_all_project_langs 	= $section->get_ar_all_project_langs($resolve_termino=true);
				*/
				$ar_all_project_langs 	= common::get_ar_all_langs_resolved(DEDALO_DATA_LANG);


				# INVERSE_CODE
				$inverse_code = tool_common::get_inverse_element('code', $parent, $section_tipo);
					#dump($inverse_code, ' $inverse_code ++ '.to_string());

				#
				# TOP_ID
				# Calculate TOP_ID from inverse data
				# dump(TOP_ID, 'TOP_ID ++ '.to_string());
				#if (!TOP_ID) {
					#dump($this, ' this ++ '.to_string());
					$section = section::get_instance( $parent, $section_tipo );
					$inverse_locators = $section->get_inverse_locators();
						#dump($inverse_locators, ' inverse_locators ++ '."$parent, $section_tipo ".to_string());
					/*
					if (empty($inverse_locators)) {
						//trigger_error("Warning: Indexing resource");
						echo "<div class=\"warning\">".label::get_label('por_favor_indexe_desde_una_seccion_de_inventario')." [2]</div>";
						return ;
					}*/
				#}//end if (!TOP_ID) {
				

				#
				# STATE
				# Create component_state configurated
				$component_state 		= $this->component_obj->get_component_state( $tool_locator, $this->component_obj->get_lang() );
					#dump($component_state, ' component_state ++ '.to_string());
				$component_state_html 	= '';	
				if ( !empty($component_state) && is_object($component_state) ) {
					$component_state_html 	= $component_state->get_html();	
				}

<commit_msg>add SVG support<commit_after><?php

	# CONTROLLER TOOL TRANSCRIPTION

	$tipo 					= $this->component_obj->get_tipo();
	$parent 				= $this->component_obj->get_parent();
	$section_id 			= $parent;
	$section_tipo 			= $this->component_obj->get_section_tipo();
	$lang 					= $this->component_obj->get_lang();
	$label 					= $this->component_obj->get_label();
	$section_label 			= RecordObj_dd::get_termino_by_tipo($section_tipo);
	$component_name			= get_class($this->component_obj);
	$tool_locator			= DEDALO_TOOL_INVESTIGATION_SECTION_TIPO.'_'.DEDALO_TOOL_TRANSCRIPTION_ID;//
	$tool_name 				= get_class($this);
	$modo 					= $this->get_modo();
	$file_name 				= $modo;


	switch($modo) {	
		
		case 'button':
				
				break;

		case 'page':				

				# Fix related component (component_text_area)
				$this->component_related_obj = $this->get_component_related_obj();
					#dump($this->component_related_obj, ' this->component_related_obj');

				$propiedades = $this->component_related_obj->get_propiedades();
					#dump($propiedades, ' $propiedades ++ '.to_string());


				# SVG case check if related to text area
				$text_area_tipo = $this->component_related_obj->get_tipo();
				$ar_svg_related = common::get_ar_related_by_model('component_svg', $text_area_tipo); // $text_area_tipo
				if (!empty($ar_svg_related)) {
					$svg_tipo = reset($ar_svg_related);
					# Search autocomplete
					$ar_autocomplete_hi_related = common::get_ar_related_by_model('component_autocomplete_hi', $text_area_tipo);
					if (empty($ar_autocomplete_hi_related)) {
						debug_log(__METHOD__." Empty related component_autocomplete_hi. Please add related component_autocomplete_hi to text_area ($text_area_tipo)".to_string(), logger::ERROR);
					}else{						
						$autocomplete_hi_tipo 	   = reset($ar_autocomplete_hi_related);
						$component_autocomplete_hi = component_common::get_instance('component_autocomplete_hi',
																					 $autocomplete_hi_tipo,
																					 $parent,
																					 'edit',
																					 DEDALO_DATA_NOLAN,
																					 $section_tipo);
						$editing_svg = true;

						$component_autocomplete_hi_html = $component_autocomplete_hi->get_html();
					}
				}


				if (!is_object($this->component_related_obj)) {
					return null; 	# media sin transcripción asociada
				}
									

				#
				# JS aditional
					if (defined('DEDALO_LOCK_COMPONENTS') && DEDALO_LOCK_COMPONENTS===true) {
						js::$ar_url[]  = DEDALO_LIB_BASE_URL."/lock_components/js/lock_components.js";
					}
					
				#
				# TEXT (EDITOR) LEFT SIDE #######################################################################################################
				# Related object is always a coomponent_text_area. Other components are wellcome but the first is reserved for text_area					
					$this->component_related_obj->set_modo('tool_transcription');
					$original_lang 	= component_text_area::force_change_lang($this->component_related_obj->get_tipo(),
																			 $this->component_related_obj->get_parent(),
																			 $this->component_related_obj->get_modo(),
																			 $this->component_related_obj->get_lang(),
																			 $this->component_related_obj->get_section_tipo());
					$this->component_related_obj->set_lang($original_lang);				
					$component_related_obj_tipo = $this->component_related_obj->get_tipo();
					$id_wrapper 				= 'wrapper_'.$this->component_related_obj->get_identificador_unico();
					$html_component_text_area 	= $this->component_related_obj->get_html();					

					# TEXTAREA_LANG
					# Note that component_textarea can change his lang ('force_change_lang') in some contexts
					$textarea_lang = $this->component_related_obj->get_lang();

					# CSS / JS
					$component_related_name = get_class($this->component_related_obj);
					css::$ar_url[] = DEDALO_LIB_BASE_URL.'/'.$component_related_name.'/css/'.$component_related_name.'.css';
					js::$ar_url[]  = DEDALO_LIB_BASE_URL.'/'.$component_related_name.'/js/' .$component_related_name.'.js';

					# OTHER OPTIONAL COMPONENTS
					$html_other_components = '';
					$ar_related = $this->component_obj->RecordObj_dd->get_relaciones();					
					foreach ($ar_related as $modelo => $related_tipo) {
						$related_tipo = reset($related_tipo);
						if($related_tipo===$this->component_related_obj->get_tipo()) continue; // Skip already used first component
						
						$modelo_name 	= RecordObj_dd::get_modelo_name_by_tipo($related_tipo,true);
						$component 		= component_common::get_instance($modelo_name,
																		 $related_tipo,
																		 $parent,
																		 $tool_name, // Modo : tool_transcription
																		 $lang,
																		 $section_tipo);
						$html_other_components .= $component->get_html();
					}


				
				#
				# MEDIA (PLAYER) RIGHT SIDE #######################################################################################################
					$this->component_obj->set_modo('player');
					$html_media = $this->component_obj->get_html();
					# Player on iframe
					#$reelID 	= $this->component_obj->get_video_id();		#dump($reelID);
					#$iframe_url = DEDALO_LIB_BASE_URL . '/media_engine/av_media_player.php?reelID=' . $reelID .'&quality=' .DEDALO_AV_QUALITY_DEFAULT ;
					
					$target_tipo = $this->component_related_obj->get_tipo();
					$source_tipo = $this->component_obj->get_tipo();
					$parent   	 = $this->component_obj->get_parent();

					# CSS / JS
					css::$ar_url[] = DEDALO_LIB_BASE_URL."/$component_name/css/$component_name.css";
					js::$ar_url[]  = DEDALO_LIB_BASE_URL."/$component_name/js/$component_name.js";



				#
				# HEADER ##########################################################################################################################
				$component_related_tipo = $this->component_related_obj->get_tipo();	# Tipo del text_area
					# DATA LANGS OF CURRENT SECTION
					/*
					$section_id 			= $parent;
					$section_tipo 			= $this->component_obj->get_section_tipo();
					$section 				= section::get_instance($section_id ,$section_tipo);
					$ar_all_project_langs 	= $section->get_ar_all_project_langs($resolve_termino=true);
					*/
					$ar_all_project_langs 	= common::get_ar_all_langs_resolved(DEDALO_DATA_LANG);


					# INVERSE_CODE
					$inverse_code = tool_common::get_inverse_element('code', $parent, $section_tipo);
						#dump($inverse_code, ' $inverse_code ++ '.to_string());

					#
					# TOP_ID
					# Calculate TOP_ID from inverse data
					# dump(TOP_ID, 'TOP_ID ++ '.to_string());
					#if (!TOP_ID) {
						#dump($this, ' this ++ '.to_string());
						$section = section::get_instance( $parent, $section_tipo );
						$inverse_locators = $section->get_inverse_locators();
							#dump($inverse_locators, ' inverse_locators ++ '."$parent, $section_tipo ".to_string());
						/*
						if (empty($inverse_locators)) {
							//trigger_error("Warning: Indexing resource");
							echo "<div class=\"warning\">".label::get_label('por_favor_indexe_desde_una_seccion_de_inventario')." [2]</div>";
							return ;
						}*/
					#}//end if (!TOP_ID) {					

					#
					# STATE
					# Create component_state configurated
					$component_state 		= $this->component_obj->get_component_state( $tool_locator, $this->component_obj->get_lang() );
						#dump($component_state, ' component_state ++ '.to_string());
					$component_state_html 	= '';	
					if ( !empty($component_state) && is_object($component_state) ) {
						$component_state_html 	= $component_state->get_html();	
					}

					# Because components are loaded by ajax, we need prepare js/css elements from tool									
					# CSS / JS includes
					css::$ar_url[] = DEDALO_LIB_BASE_URL."/component_publication/css/component_publication.css";
					js::$ar_url[] = DEDALO_LIB_BASE_URL."/component_publication/js/component_publication.js";


{'fraction_non_alphanumeric': 0.1605772182990482, 'fraction_numerical': 0.00015351550506601167, 'mean_word_length': 3.673242467718795, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 144, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7056935', 'n_tokens_mistral': 5625, 'n_tokens_neox': 4404, 'n_words': 569}