PageRenderTime 37ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/common/include/fun.html_forms.php

https://github.com/tematres/TemaTres-Vocabulary-Server
PHP | 2889 lines | 2502 code | 235 blank | 152 comment | 184 complexity | ec18625ddca6123ad7e5f8cb0ca9005d MD5 | raw file
Possible License(s): LGPL-2.1, MIT, CC-BY-3.0
  1. <?php
  2. if ((stristr($_SERVER['REQUEST_URI'], "session.php") ) || ( !defined('T3_ABSPATH') )) {
  3. die("no access");
  4. }
  5. // TemaTres : aplicación para la gestión de vocabularios controlados# #
  6. // TemaTres : web application to manage controlled vocabularies
  7. //
  8. // Copyright (C) 2004-2021 Diego Ferreyra tematres@r020.com.ar
  9. // Distribuido bajo Licencia GNU Public License, versión 2 (de junio de 1.991) Free Software Foundation
  10. //
  11. //
  12. // Funciones para presentar formularios HTML. #
  13. //
  14. function HTMLformAssociateFreeTerms($ARRAYterm_id = array(), $taskterm = "")
  15. {
  16. if (count($ARRAYterm_id)==0) {
  17. return HTMLformVerTerminosLibres();
  18. }
  19. //list terms_id
  20. foreach ($ARRAYterm_id as $term_id) {
  21. if (is_numeric($term_id)) {
  22. $tema_id_list.=$term_id.',';
  23. }
  24. }
  25. //fetch free terms
  26. $sqlTerms=SQLlistaTema_id($tema_id_list);
  27. $cantFreeTerms=SQLcount($sqlTerms);
  28. if ($cantFreeTerms==0) {
  29. return HTMLformVerTerminosLibres();
  30. }
  31. while ($arrayFreeTerms=$sqlTerms->FetchRow()) {
  32. $freeTerms.=HTMLlinkTerm($arrayFreeTerms).', ';
  33. $freeTermsHiddenTag.= '<input type="hidden" name="freeTerms_id[]" id="freeTerm_'.$arrayFreeTerms["tema_id"].'" value="'.$arrayFreeTerms["tema_id"].'" />';
  34. }
  35. $HTMLfreeTerms=substr($freeTerms, 0, -2);
  36. if (doValue($_POST, FORM_LABEL_buscarTermino)) {
  37. $expresBusca=doValue($_POST, FORM_LABEL_buscarTermino);
  38. //seleccionar SQL adecuado a la operacion
  39. $sql_busca=SQLsearchPrefTermsNotInList($tema_id_list, $expresBusca);
  40. $cant_result=SQLcount($sql_busca);
  41. $search_leyenda='<h3>'.$cant_result.' '.MSG_ResultBusca.' <i>'.$expresBusca.'</i>.</h3>'."\n\r";
  42. if ($cant_result>0) {
  43. $rows_busca.='<div><input id="filter" type="text" class="form-control" placeholder="'.ucfirst(LABEL_type2filter).'"></div>';
  44. $rows_busca.='<form role="form" class="form-inline" role="form" name="addRelations" id="addRelations" action="index.php?taskrelations=freeTermsAssoc" method="post">';
  45. $rows_busca.='<div class="table-responsive"> ';
  46. $rows_busca.='<table class="table table-striped table-bordered table-condensed table-hover"">';
  47. $rows_busca.='<thead> <tr><th>';
  48. $rows_busca.='</th><th>'.ucfirst(LABEL_Termino).'</th><th>'.ucfirst(LABEL_Fecha).'</th> </tr></thead> <tbody class="searchable">';
  49. while ($resulta_busca=$sql_busca->FetchRow()) {
  50. $css_class_MT=($resulta_busca["isMetaTerm"]==1) ? ' class="metaTerm" ' : '';
  51. $alert_MT=($resulta_busca["isMetaTerm"]==1) ? ' ('.LABEL_meta_term.') ' : '';
  52. $rows_busca.= '<tr>';
  53. $rows_busca.= ' <td align="center"><input type="radio" name="rema_id" id="rema_'.$resulta_busca["tema_id"].'" title="'.$resulta_busca["tema"].'" value="'.$resulta_busca["tema_id"].'" /> </td>';
  54. $rows_busca.= ' <td><label for="rema_'.$resulta_busca["tema_id"].'" '.$css_class_MT.'> '.$resulta_busca["tema"].'</label> '.$alert_MT.' </td>';
  55. $rows_busca.= ' <td>'.$resulta_busca["cuando"].'</td>';
  56. $rows_busca.= '</tr>';
  57. }
  58. $rows_busca.=' </tbody>';
  59. $rows_busca.='<tfoot>
  60. <tr>
  61. <td colspan=3>';
  62. $rows_busca.=' <input type="hidden" name="taskterm" id="taskterm" value="aaa"/> ';
  63. $rows_busca.=' <input type="hidden" name="taskrelations" id="taskrelations" value="'.$taskterm.'"/> ';
  64. $rows_busca.=$freeTermsHiddenTag;
  65. $rows_busca.= ' </td>
  66. </tr>
  67. </tfoot>
  68. </table> </div>';
  69. //no es subordinar término y hay resultados
  70. if ($cant_result>0) {
  71. $rows_busca.='<div class="form-group"><label for="rel_free_term" accesskey="r">'.ucfirst(LABEL_selectRelation).' ';
  72. $rows_busca.='<select class="form-control" id="rel_free_term" name="rel_free_term">';
  73. $rows_busca.=doSelectForm(array('2#'.ucfirst(TR_termino),'3#'.ucfirst(TE_termino),'4#'.ucfirst(UP_termino)), "");
  74. $rows_busca.='</select>';
  75. $rows_busca.=' <button type="submit" class="btn btn-primary">'.LABEL_Enviar.'</button>';
  76. $rows_busca.='</div>';
  77. }
  78. $rows_busca.='</form>';
  79. }//if cant
  80. $rows_busca.='</div>';
  81. };//fin de if buscar
  82. $rows.='<div class="container" id="bodyText">
  83. <a class="topOfPage" href="'.URL_BASE.'index.php?verT=L" title="'.LABEL_Anterior.'">'.LABEL_Anterior.'</a>
  84. <h3>'.LABEL_EditorTermino.'</h3>';
  85. if ($new_relacion["log"]==true) {
  86. $rows.='<p class="success">'.ucfirst(LABEL_saved).'</p>';
  87. }
  88. $rows.=' <form class="form-inline" role="form" name="busca_rel" action="index.php?verT=LA" method="post">';
  89. $rows.=' <fieldset> <legend>'.$nombre_pantalla.'</legend>';
  90. $rows.='<div class="well">'.ucfirst(LABEL_associateFreeTerms).' ('.$cantFreeTerms.'): '.$HTMLfreeTerms.'. <p class="bg-warning">'.ucfirst(MSG_associateFreeTerms).'</p></div>';
  91. $rows.='<input class="form-inline input_ln form-control" name="'.FORM_LABEL_buscarTermino.'" type="search" id="addExistTerm" maxlength="50"/>
  92. <button type="submit" class="btn btn-primary">'.LABEL_Buscar.'</button>
  93. <button type="button" class="btn btn-default" onClick="location.href=\'index.php?verT=L\'">'.ucfirst(LABEL_Cancelar).'</button>';
  94. $rows.=$freeTermsHiddenTag;
  95. $rows.='</form>';
  96. $rows.='</fieldset>';
  97. $rows.=$search_leyenda;
  98. $rows.=$rows_busca;
  99. $rows.=' </div>';
  100. return $rows;
  101. }
  102. function HTMLformAssociateExistTerms($taskterm, $ARRAYtermino, $term_id = "0")
  103. {
  104. global $new_relacion;
  105. $link_term=HTMLlinkTerm(array("tema_id"=>$ARRAYtermino["tema_id"],"tema"=>$ARRAYtermino["titTema"]));
  106. switch ($taskterm) {
  107. case 'addRT':
  108. $nombre_pantalla=ucfirst(LABEL_AgregarRTexist).$link_term;
  109. break;
  110. case 'addBT':
  111. $nombre_pantalla=sprintf(LABEL_AgregarTG, $link_term);
  112. break;
  113. case 'addFreeUF':
  114. $nombre_pantalla=sprintf(LABEL_existAgregarUP, $link_term);
  115. break;
  116. case 'addFreeNT':
  117. $nombre_pantalla=sprintf(LABEL_existAgregarTE, $link_term);
  118. break;
  119. case 'addNT':
  120. $nombre_pantalla=sprintf(MENU_selectExistTerm, $link_term);
  121. break;
  122. default:
  123. '';
  124. }
  125. if (in_array($_GET["showTerms"], array('free','nt','tt'))) {
  126. if ($_GET["showTerms"]=="free") {
  127. $sql_busca=SQLverTerminosLibres();
  128. $cant_result=SQLcount($sql_busca);
  129. $search_leyenda='<h3>'.$cant_result.' '.LABEL_terminosLibres.'</h3>'."\n\r";
  130. }//seleccionar SQL adecuado a la operacion
  131. if (($_GET["showTerms"]=='tt') && (in_array($taskterm, array('addBT','addFreeNT')))) {
  132. $sql_busca=SQLverTopTerm();
  133. $cant_result=SQLcount($sql_busca);
  134. $search_leyenda='<h3>'.$cant_result.' '.LABEL_TTTerms.'</h3>'."\n\r";
  135. }
  136. } else {
  137. if ((doValue($_POST, FORM_LABEL_buscarTermino))) {
  138. $expresBusca=doValue($_POST, FORM_LABEL_buscarTermino);
  139. $expresBusca=trim($expresBusca);
  140. if (($taskterm=='addFreeNT') || ($taskterm=='addFreeUF')) {
  141. //if enable polijerarquia
  142. //$sql_busca = ($array_vocabulario["polijerarquia"]==1) ? SQLsearchTerms4NT($expresBusca, $ARRAYtermino["idTema"]) : SQLsearchFreeTerms($expresBusca, $ARRAYtermino["idTema"]);
  143. $sql_busca = SQLsearchTerms4NT($expresBusca, $ARRAYtermino["idTema"],$_SESSION["CFGPolijerarquia"]);
  144. $cant_result=SQLcount($sql_busca);
  145. $search_leyenda='<h3>'.$cant_result.' '.MSG_ResultBusca.' <i>'.$expresBusca.'</i>.</h3>'."\n\r";
  146. } else {
  147. $sql_busca=SQLbuscaTR($ARRAYtermino["idTema"], "$expresBusca");
  148. $cant_result=SQLcount($sql_busca);
  149. $search_leyenda='<h3>'.$cant_result.' '.MSG_ResultBusca.' <i>'.$expresBusca.'</i>.</h3>'."\n\r";
  150. }
  151. }
  152. }
  153. if ($cant_result>0) {
  154. $rows_busca.='<div><input id="filter" type="text" class="form-control" placeholder="'.ucfirst(LABEL_type2filter).'"></div>';
  155. $rows_busca.='<form role="form" class="form-inline" role="form" name="addRelations" id="addRelations" action="index.php" method="get" >';
  156. $rows_busca.='<div class="table-responsive"> ';
  157. $rows_busca.='<table class="table table-striped table-bordered table-condensed table-hover"">';
  158. $rows_busca.='<thead>
  159. <tr><th>';
  160. $rows_busca.='</th><th>'.ucfirst(LABEL_Termino).'</th>
  161. <th>'.ucfirst(LABEL_Fecha).'</th>
  162. </tr>
  163. </thead>
  164. <tbody class="searchable">';
  165. while ($resulta_busca=$sql_busca->FetchRow()) {
  166. $css_class_MT=($resulta_busca["isMetaTerm"]==1) ? ' class="metaTerm" ' : '';
  167. $alert_MT=($resulta_busca["isMetaTerm"]==1) ? ' ('.LABEL_meta_term.') ' : '';
  168. //prevenir que no seleccione el mismo término que esta mirando
  169. if ($resulta_busca["tema_id"]!==$ARRAYtermino["idTema"]) {
  170. if ($taskterm=='addBT') {
  171. $rows_busca.= '<tr>';
  172. $rows_busca.= ' <td align="center"><input type="radio" name="rema_id" id="rema_'.$resulta_busca["tema_id"].'" title="'.$resulta_busca["tema"].'" value="'.$resulta_busca["tema_id"].'" /> </td>';
  173. $rows_busca.= ' <td><label for="rema_'.$resulta_busca["tema_id"].'" '.$css_class_MT.'> '.$resulta_busca["tema"].'</label> '.$alert_MT.' </td>';
  174. $rows_busca.= ' <td>'.$resulta_busca["cuando"].'</td>';
  175. $rows_busca.= ' </tr>';
  176. } else {
  177. $rows_busca.= '<tr>';
  178. $rows_busca.= ' <td align="center"><input type="checkbox" name="rema_id[]" id="rema_'.$resulta_busca["tema_id"].'" title="'.$resulta_busca["tema"].'" value="'.$resulta_busca["tema_id"].'" /> </td>';
  179. $rows_busca.= ' <td><label class="check_label" for="rema_'.$resulta_busca["tema_id"].'" '.$css_class_MT.'> '.$resulta_busca["tema"].'</label> '.$alert_MT.' </td>';
  180. $rows_busca.= ' <td>'.$resulta_busca["cuando"].'</td>';
  181. $rows_busca.= ' </tr>';
  182. }
  183. };
  184. }
  185. $rows_busca.=' </tbody>';
  186. $rows_busca.='<tfoot>
  187. <tr>
  188. <td colspan=3>';
  189. $rows_busca.=' <input type="hidden" name="tema" id="tema" value="'.$ARRAYtermino["idTema"].'"/>';
  190. $rows_busca.=' <input type="hidden" name="taskterm" id="taskterm" value="'.$taskterm.'"/> ';
  191. $rows_busca.=' <input type="hidden" name="taskrelations" id="taskrelations" value="'.$taskterm.'"/> ';
  192. $rows_busca.= ' </td>
  193. </tr>
  194. </tfoot>
  195. </table> </div>';
  196. //no es subordinar término y hay resultados
  197. if ($cant_result>0) {
  198. $rows_busca.='<div class="submit_form" align="center">';
  199. $rows_busca.=' <button type="submit" class="btn btn-primary">'.LABEL_Agregar.'</button>';
  200. $rows_busca.='</div>';
  201. }
  202. $rows_busca.='</form>';
  203. }//if cant
  204. $rows_busca.='</div>';
  205. $rows_busca.='<script type="text/javascript">
  206. $(document).ready(function(){
  207. //Checkbox
  208. $("input[name=checktodos]").change(function(){
  209. $("input[type=checkbox]").each( function() {
  210. if($("input[name=checktodos]:checked").length == 1){
  211. this.checked = true;
  212. } else {
  213. this.checked = false;
  214. }
  215. });
  216. });
  217. });
  218. </script>';
  219. $rows.='<div class="container" id="bodyText">
  220. <a class="topOfPage" href="'.URL_BASE.'index.php?tema='.$ARRAYtermino["idTema"].'" title="'.LABEL_Anterior.' ('.$ARRAYtermino["tema"].')">'.LABEL_Anterior.'</a>
  221. <h3>'.LABEL_EditorTermino.'</h3>';
  222. if ($new_relacion["log"]==true) {
  223. $rows.='<p class="success">'.ucfirst(LABEL_saved).'</p>';
  224. }
  225. $rows.=' <form class="form-inline" role="form" name="busca_rel" action="index.php?taskterm='.$taskterm.'&amp;tema='.$ARRAYtermino["idTema"].'" method="post">';
  226. $rows.=' <fieldset>
  227. <legend>'.$nombre_pantalla.'</legend>
  228. <input class="form-inline input_ln form-control" name="'.FORM_LABEL_buscarTermino.'" type="search" id="addExistTerm" maxlength="50"/>
  229. <button type="submit" class="btn btn-primary">'.LABEL_Buscar.'</button>
  230. <button type="button" class="btn btn-info" onClick="location.href=\'index.php?tema='.$ARRAYtermino["idTema"].'&amp;taskterm='.$taskterm.'&amp;showTerms=free\'"/>'.ucfirst(LABEL_showFreeTerms).'</button>';
  231. if (in_array($taskterm, array('addBT','addFreeNT'))) {
  232. $rows.=' <button type="button" class="btn btn-info" onClick="location.href=\'index.php?tema='.$ARRAYtermino["idTema"].'&amp;taskterm='.$taskterm.'&amp;showTerms=tt\'"/>'.ucfirst(LABEL_TTTerms).'</button>';
  233. }
  234. $rows.=' <button type="button" class="btn btn-default" onClick="location.href=\'index.php?tema='.$ARRAYtermino["idTema"].'\'">'.ucfirst(LABEL_Cancelar).'</button>
  235. <input type="hidden" name="tema" value="'.$ARRAYtermino["idTema"].'"/>
  236. <input type="hidden" name="taskterm" value="'.$taskterm.'"/>
  237. </form>';
  238. //if(in_array($taskterm, array("addFreeUF","addFreeNT"))) $rows.='<p class="text-warning">'.LABEL_helpSearchFreeTerms.'</p>';
  239. $rows.='</fieldset>';
  240. $rows.=$search_leyenda;
  241. $rows.=$rows_busca;
  242. $rows.=' </div>';
  243. return $rows;
  244. }
  245. /*
  246. * Form for edit or add terms
  247. 3 casos:
  248. - Alta y edici�n de un t�rmino nuevo.
  249. - Alta de un t�rmino no preferido de un t�rmino preferido.
  250. - Alta de un t�rmino subordinado a un t�rmino.
  251. *
  252. */
  253. function HTMLformEditTerms($taskterm, $ARRAYtermino = "0")
  254. {
  255. //SEND_KEY to prevent duplicated
  256. session_start();
  257. $_SESSION['SEND_KEY']=md5(uniqid(rand(), true));
  258. switch ($taskterm) {
  259. case 'addTerm':// add term
  260. $nombre_pantalla=LABEL_AgregarT;
  261. $hidden='<input type="hidden" name="alta_t" value="new" />';
  262. $hidden.='<div><input type="checkbox" name="estado_id" id="estado_id" value="12" alt="'.ucfirst(LABEL_Candidato).'" /> <label for="estado_id" accesskey="e">'.ucfirst(LABEL_Candidato).'</label></div>';
  263. $hidden.='<div><input type="checkbox" name="isMetaTerm" id="isMetaTerm" value="1" alt="'.ucfirst(LABEL_meta_term).'" /> <label for="isMetaTerm" accesskey="e">'.ucfirst(LABEL_meta_term).'</label>
  264. <div class="alert alert-info" role="alert">'.NOTE_isMetaTermNote.'</div>
  265. </div>';
  266. $help_rows='<p class="text-primary">'.HELP_variosTerminos.'</p>';
  267. $extra_button='<a class="btn btn-second btn-xs" role="button" href="'.URL_BASE.'index.php?taskterm=addTermSuggested" title="'.ucfirst(LABEL__getForRecomendation).'">'.ucfirst(LABEL__getForRecomendation).'</a>';
  268. break;
  269. case 'editTerm'://Edici�n de un t�rmino $edit_id
  270. $nombre_pantalla=LABEL_editT.HTMLlinkTerm(array("tema_id"=>$ARRAYtermino["idTema"],"tema"=>$ARRAYtermino["titTema"]));
  271. $vista_titulo_tema=$ARRAYtermino["titTema"];
  272. $vista_desc_tema=$ARRAYtermino["descTema"];
  273. $hidden='<input type="hidden" name="edit_id_tema" value="'.$ARRAYtermino["idTema"].'" />';
  274. break;
  275. case 'addNT':// add narowwer term
  276. $nombre_pantalla=LABEL_AgregarTE.HTMLlinkTerm(array("tema_id"=>$ARRAYtermino["idTema"],"tema"=>$ARRAYtermino["titTema"]));
  277. $hidden.='<input type="hidden" name="id_termino_sub" value="'.$ARRAYtermino["idTema"].'" />';
  278. $help_rows='<p class="text-primary">'.HELP_variosTerminos.'</p>';
  279. $extra_button='<a class="btn btn-second btn-xs" role="button" href="'.URL_BASE.'index.php?taskterm=addFreeNT&amp;tema='.$ARRAYtermino["idTema"].'" title="'.ucfirst(MENU_selectExistTerm).'">'.ucfirst(MENU_selectExistTerm).'</a>';
  280. $extra_button.=' <a class="btn btn-second btn-xs" role="button" href="'.URL_BASE.'index.php?taskterm=findSuggestionTargetTerm&amp;tema='.$ARRAYtermino["idTema"].'&amp;t_relation=3" title="'.ucfirst(LABEL__getForRecomendation).'">'.ucfirst(LABEL__getForRecomendation).'</a>';
  281. $t_relation='3';
  282. break;
  283. case 'addUF'://Alta de un t�rmino no preferido a $id_uf
  284. $nombre_pantalla=LABEL_AgregarUP.HTMLlinkTerm(array("tema_id"=>$ARRAYtermino["idTema"],"tema"=>$ARRAYtermino["titTema"]));
  285. $hidden='<input type="hidden" name="id_termino_uf" value="'.$ARRAYtermino["idTema"].'" />';
  286. $help_rows='<p class="text-primary">'.HELP_variosTerminos.'</p>';
  287. $extra_button='<a class="btn btn-second btn-xs" role="button" href="'.URL_BASE.'index.php?taskterm=addFreeUF&amp;tema='.$ARRAYtermino["idTema"].'" title="'.ucfirst(MENU_AgregarUPexist).'">'.ucfirst(MENU_AgregarUPexist).'</a>';
  288. $extra_button.=' <a class="btn btn-second btn-xs" role="button" href="'.URL_BASE.'index.php?taskterm=findSuggestionTargetTerm&amp;tema='.$ARRAYtermino["idTema"].'&amp;t_relation=4" title="'.ucfirst(LABEL__getForRecomendation).'">'.ucfirst(LABEL__getForRecomendation).'</a>';
  289. $t_relation='4';
  290. break;
  291. case 'addRTnw'://Alta de un término RT
  292. $nombre_pantalla=LABEL_AgregarTR.HTMLlinkTerm(array("tema_id"=>$ARRAYtermino["idTema"],"tema"=>$ARRAYtermino["titTema"]));
  293. $hidden='<input type="hidden" name="id_termino_rt" value="'.$ARRAYtermino["idTema"].'" />';
  294. $help_rows='<p class="text-primary">'.HELP_variosTerminos.'</p>';
  295. $extra_button='<a class="btn btn-second btn-xs" role="button" href="'.URL_BASE.'index.php?taskterm=addRT&amp;tema='.$ARRAYtermino["idTema"].'" title="'.ucfirst(MENU_selectExistTerm).'">'.ucfirst(MENU_selectExistTerm).'</a>';
  296. $extra_button.=' <a class="btn btn-second btn-xs" role="button" href="'.URL_BASE.'index.php?taskterm=findSuggestionTargetTerm&amp;tema='.$ARRAYtermino["idTema"].'&amp;t_relation=2" title="'.ucfirst(LABEL__getForRecomendation).'">'.ucfirst(LABEL__getForRecomendation).'</a>';
  297. $t_relation='2';
  298. break;
  299. };
  300. $rows.='<div class="container" id="bodyText">';
  301. $rows.='<div class="row">';
  302. $rows.='<a class="topOfPage" href="'.URL_BASE.'index.php?tema='.$ARRAYtermino["idTema"].'" title="'.LABEL_Anterior.'">'.LABEL_Anterior.'</a>
  303. <h3>'.LABEL_EditorTermino .'</h3>';
  304. $rows.='<form class="form-horizontal col-xs-12 col-md-8" role="form" id="alta_t" name="alta_t" action="index.php" method="post">
  305. <fieldset>
  306. <legend>'.$nombre_pantalla.'</legend>
  307. <div class="form-group form-group-chk">
  308. <label for="'.FORM_LABEL_termino .'" accesskey="t">'.LABEL_Termino.'</label>
  309. '.$extra_button.'
  310. <textarea class="form-control" type="text" required autofocus rows="2" cols="60" name="'.FORM_LABEL_termino.'" id="addTerms">'.$vista_titulo_tema.'</textarea>';
  311. $rows.=$help_rows;
  312. $rows.=$extra_tag;
  313. $rows.='</div>';
  314. if (in_array($t_relation, array(2,3,4))) {
  315. $SQLtypeRelations=SQLtypeRelations($t_relation);
  316. if (SQLcount($SQLtypeRelations)>0) {
  317. while ($ARRAYtypeRelations=$SQLtypeRelations->FetchRow()) {
  318. $arraySelectTypeRelations[]=$ARRAYtypeRelations["rel_rel_id"].'#'.$ARRAYtypeRelations["rr_value"];
  319. $neutralLabel=LABELrelTypeSYS($ARRAYtypeRelations["t_relation"]);
  320. }
  321. $rows.='<div class="form-group"><label for="rel_rel_id" accesskey="r">'.ucfirst(LABEL_relationSubType).'<span class="small">('.LABEL_optative.')</span></label>';
  322. $rows.='<select class="form-control" id="t_rel_rel_id" name="t_rel_rel_id"><option>'.ucfirst(LABEL_seleccionar).'</option>';
  323. $rows.=doSelectForm($arraySelectTypeRelations, "");
  324. $rows.='</select>';
  325. $rows.='</div>';
  326. }
  327. }
  328. $rows.='<div class="text-center">';
  329. $rows.='<input type="submit" class="btn btn-primary" role="button" name="boton" value="'.LABEL_Enviar.'"/>';
  330. $rows.=' <input type="button" class="btn btn-default" role="button" name="cancelar" type="button" onClick="location.href=\'index.php?tema='.$ARRAYtermino["idTema"].'\'" value="'.ucfirst(LABEL_Cancelar).'"/>';
  331. $rows.='</div>';
  332. $rows.=$hidden;
  333. $rows.='<input type="hidden" name="ks" id="ks" value="'.$_SESSION["SEND_KEY"].'"/>';
  334. $rows.=' </fieldset>';
  335. $rows.='</form>';
  336. $rows.=' </div>';//row
  337. $rows.='</div>';//container
  338. return $rows;
  339. }
  340. /*
  341. * Form for edit or add terms
  342. 1 caso:
  343. - Alta de un t�rmino nuevo.
  344. *
  345. */
  346. function HTMLformSuggestTerms($ARRAYtargetVocabulary = array())
  347. {
  348. global $CFG;
  349. //SEND_KEY to prevent duplicated
  350. session_start();
  351. $_SESSION['SEND_KEY']=md5(uniqid(rand(), true));
  352. $sql=SQLtargetVocabulary("1");
  353. $rows='<div class="container" id="bodyText">';
  354. $rows.='<a class="topOfPage" href="'.URL_BASE.'index.php?taskterm=addTerm" title="'.LABEL_Anterior.'">'.LABEL_Anterior.'</a>';
  355. if (SQLcount($sql)=='0') {
  356. //No hay vocabularios de referencia, solo vocabulario principal
  357. $rows.=HTMLalertNoTargetVocabulary();
  358. } else {
  359. //Hay vobularios de referencia
  360. $array_vocabularios=array();
  361. while ($array=$sql->FetchRow()) {
  362. if ($array["vocabulario_id"]!=='1') {
  363. //vocabularios que no sean el vocabulario principal
  364. array_push($array_vocabularios, $array["tvocab_id"].'#'.FixEncoding($array["tvocab_label"].' - '.$CFG["ISO639-1"][$array["tvocab_lang"]][1]));
  365. }
  366. };
  367. $searchType=(!$_GET["tvocab_id"]) ? 1 : $_GET["searchType"];
  368. $string2search = XSSprevent(trim($_GET["string2search"]));
  369. $rows.='<form class="" role="form" name="alta_tt" id="alta_tt" action="index.php#suggestResult" method="get">';
  370. $rows.=' <div class="row">
  371. <div>
  372. <legend>'.ucfirst(LABEL_EditorTermino).'</legend>
  373. </div>
  374. <!-- panel -->
  375. <div class="col-lg-10">
  376. <h4>'.ucfirst(LABEL__getForRecomendation).'</h4>
  377. <div class="panel panel-default">
  378. <div class="panel-body form-horizontal">
  379. <div class="form-group">
  380. <label for="tvocab_id" class="col-sm-3 control-label">'.ucfirst(FORM_LABEL_nombre_vocabulario).'</label>
  381. <div class="col-sm-9">
  382. <select class="form-control" id="tvocab_id" name="tvocab_id">
  383. '.doSelectForm($array_vocabularios, $_GET["tvocab_id"]).'
  384. </select>
  385. </div>
  386. </div>
  387. <div class="form-group">
  388. <label for="string2search" class="col-sm-3 control-label">'.ucfirst(LABEL_Buscar).'</label>
  389. <div class="col-sm-9">
  390. <input type="text" class="form-control" required autofocus type="search" id="string2search" name="string2search" value="">
  391. </div>
  392. </div>
  393. <div class="col-sm-3 control-label">
  394. <label for="searchType">'.ucfirst(LABEL_esFraseExacta).'</label>
  395. </div>
  396. <div class="class="col-sm-9" form-group">
  397. <input type="checkbox" name="searchType" id="searchType" value="1" alt="'.ucfirst(LABEL_esFraseExacta).'" '.do_check(1, $searchType, 'checked').' />
  398. </div>
  399. <div class="form-group">
  400. <div class="col-sm-12 text-right">
  401. <button type="submit" class="btn btn-primary" value="'.LABEL_Buscar.'"/>'.ucfirst(LABEL_Buscar).'</button>
  402. <button type="button" class="btn btn" name="cancelar" type="button" onClick="location.href=\'index.php?taskterm=addTerm&tema=0\'" value="'.ucfirst(LABEL_Cancelar).'"/>'.ucfirst(LABEL_Cancelar).'</button>
  403. </div>
  404. </div>
  405. </div>
  406. </div>
  407. </div> <!-- / panel -->';
  408. $rows.='<input type="hidden" name="taskterm" value="addTermSuggested"/>';
  409. $rows.='</form>';
  410. }
  411. if (($string2search) && ($_GET["tvocab_id"])) {
  412. include_once T3_ABSPATH . 'common/include/vocabularyservices.php' ;
  413. $arrayVocab=ARRAYtargetVocabulary($_GET["tvocab_id"]);
  414. $task=($_GET["searchType"]==1) ? 'fetch' : 'search';
  415. $dataTterm=getURLdata($arrayVocab["tvocab_uri_service"].'?task='.$task.'&arg='.urlencode($string2search));
  416. if ($dataTterm->resume->cant_result > "0") {
  417. $arrayTtermData = array();
  418. foreach ($dataTterm->result->term as $value) {
  419. $i=++$i;
  420. $term_id=(int) $value->term_id;
  421. $string=(string) $value->string;
  422. $source_date= ($value->date_mod>0) ? $value->date_mod : $value->date_create ;
  423. $arrayTtermData[$term_id]=array("term_id"=>$term_id,
  424. "string"=>$string,
  425. "source_string"=>$string,
  426. "source_term_id"=>$term_id,
  427. "source_date"=> $source_date
  428. );
  429. };
  430. }
  431. //null for t_relation
  432. $t_relation=0;
  433. $rows.=' </div>';//row
  434. $rows.=HTMLformTargetVocabularySuggested($arrayTtermData, $t_relation, $string2search, $arrayVocab, $ARRAYtermino["idTema"]);
  435. };//fin de if buscar
  436. $rows.=' </div>';//container
  437. return $rows;
  438. }
  439. /*
  440. * Form for edit or add terms
  441. 3 casos:
  442. - Alta y edici�n de un t�rmino relacionado.
  443. - Alta de un t�rmino no preferido de un t�rmino preferido.
  444. - Alta de un t�rmino subordinado a un t�rmino.
  445. *
  446. */
  447. function HTMLformSuggestTermsXRelations($ARRAYtermino, $ARRAYtargetVocabulary = array())
  448. {
  449. //SEND_KEY to prevent duplicated
  450. session_start();
  451. $_SESSION['SEND_KEY']=md5(uniqid(rand(), true));
  452. $rows='<div class="container" id="bodyText">';
  453. $rows.='<a class="topOfPage" href="'.URL_BASE.'index.php?tema='.$ARRAYtermino["idTema"].'" title="'.LABEL_Anterior.'">'.LABEL_Anterior.'</a>';
  454. $rows.='<h3>'.HTMLlinkTerm(array("tema_id"=>$ARRAYtermino["idTema"],"tema"=>$ARRAYtermino["titTema"])).'</h3>';
  455. $sql=SQLtargetVocabulary("1");
  456. if (SQLcount($sql)=='0') {
  457. //No hay vocabularios de referencia, solo vocabulario principal
  458. $rows.=HTMLalertNoTargetVocabulary();
  459. } else {
  460. //Hay vobularios de referencia
  461. while ($array=$sql->FetchRow()) {
  462. if ($array["vocabulario_id"]!=='1') {
  463. //vocabularios que no sean el vocabulario principal
  464. $array_vocabularios[]=$array["tvocab_id"].'#'.FixEncoding($array["tvocab_label"]);
  465. }
  466. };
  467. //Configurar opcion búsqueda por código
  468. $arrayOptions= array('3#'.ucfirst(TE_termino),'4#'.ucfirst(UP_termino),'2#'.ucfirst(TR_termino));
  469. $string2search = ($_GET["string2search"]) ? XSSprevent(trim($_GET["string2search"])) : $ARRAYtermino["titTema"];
  470. $searchType=(!$_GET["tvocab_id"]) ? 1 : $_GET["searchType"];
  471. $rows.='<form class="" role="form" name="alta_tt" id="alta_tt" action="index.php#suggestResult" method="get">';
  472. $rows.=' <div class="row">
  473. <div class="col-sm-12">
  474. <legend>'.ucfirst(LABEL_EditorTermino).'</legend>
  475. </div>
  476. <!-- panel -->
  477. <div class="col-lg-7">
  478. <h4>'.ucfirst(LABEL__getForRecomendation).'</h4>
  479. <div class="panel panel-default">
  480. <div class="panel-body form-horizontal">
  481. <div class="form-group">
  482. <label for="tvocab_id" class="col-sm-3 control-label">'.ucfirst(FORM_LABEL_nombre_vocabulario).'</label>
  483. <div class="col-sm-9">
  484. <select class="form-control" id="tvocab_id" name="tvocab_id">
  485. '.doSelectForm($array_vocabularios, $_GET["tvocab_id"]).'
  486. </select>
  487. </div>
  488. </div>
  489. <div class="form-group">
  490. <label for="t_relation" class="col-sm-3 control-label">'.ucfirst(LABEL_relationSubType).'</label>
  491. <div class="col-sm-9">
  492. <select class="form-control" id="t_relation" name="t_relation">
  493. '.doSelectForm($arrayOptions, $_GET["t_relation"]).'
  494. </select>
  495. </div>
  496. </div>
  497. <div class="form-group">
  498. <label for="string2search" class="col-sm-3 control-label">'.ucfirst(LABEL_Buscar).'</label>
  499. <div class="col-sm-9">
  500. <input type="text" class="form-control" type="search" required autofocus id="string2search" name="string2search" value="'.$ARRAYtermino["titTema"].'">
  501. </div>
  502. </div>
  503. <div class="form-group">
  504. <input type="checkbox" name="searchType" id="searchType" value="1" alt="'.ucfirst(LABEL_esFraseExacta).'" '.do_check(1, $searchType, 'checked').' />
  505. <div class="col-sm-4">
  506. <label for="searchType">'.ucfirst(LABEL_esFraseExacta).'</label>
  507. </div>
  508. </div>
  509. <div class="form-group">
  510. <div class="col-sm-12 text-right">
  511. <button type="submit" class="btn btn-primary" value="'.LABEL_Buscar.'"/>'.ucfirst(LABEL_Buscar).'</button>
  512. <button type="button" class="btn btn" name="cancelar" type="button" onClick="location.href=\'index.php?tema='.$ARRAYtermino["idTema"].'\'" value="'.ucfirst(LABEL_Cancelar).'"/>'.ucfirst(LABEL_Cancelar).'</button>
  513. </div>
  514. </div>
  515. </div>
  516. </div>
  517. </div> <!-- / panel -->';
  518. $rows.='<input type="hidden" name="tema" value="'.$ARRAYtermino["idTema"].'"/>';
  519. $rows.='<input type="hidden" name="taskterm" value="findSuggestionTargetTerm"/>';
  520. $rows.='</form>';
  521. }
  522. $rows.='</div>';
  523. $t_relation=(in_array($_GET["t_relation"], array("4","3","2","0"))) ? $_GET["t_relation"] : '';
  524. if (($string2search) && ($_GET["tvocab_id"])) {
  525. include_once T3_ABSPATH . 'common/include/vocabularyservices.php' ;
  526. $arrayVocab=ARRAYtargetVocabulary($_GET["tvocab_id"]);
  527. $task=($_GET["searchType"]==1) ? 'fetch' : 'search';
  528. $dataTterm=getURLdata($arrayVocab["tvocab_uri_service"].'?task='.$task.'&arg='.urlencode($string2search));
  529. if ($dataTterm->resume->cant_result > "0") {
  530. foreach ($dataTterm->result->term as $value) {
  531. $array_terms[]=array("term_id"=>(int) $value->term_id,"string"=>(string) $value->string);
  532. $tterms_id.=(int) $value->term_id.',';
  533. };
  534. }
  535. switch ($t_relation) {
  536. case '2'://RT
  537. $arrayTterm=getForeingStrings($arrayVocab["tvocab_uri_service"], 'fetchRelated', $array_terms);
  538. break;
  539. case '3'://BT/NT
  540. $arrayTterm=getForeingStrings($arrayVocab["tvocab_uri_service"], 'fetchDown', $array_terms);
  541. break;
  542. case '4'://UF
  543. $arrayTterm=getForeingStrings($arrayVocab["tvocab_uri_service"], 'fetchAlt', $array_terms);
  544. break;
  545. default:
  546. break;
  547. }
  548. $rows.=HTMLformTargetVocabularySuggested($arrayTterm, $t_relation, $string2search, $arrayVocab, $ARRAYtermino["idTema"]);
  549. };//fin de if buscar
  550. $rows.=' </div>';
  551. return $rows;
  552. }
  553. /*
  554. Advanced search form
  555. *
  556. */
  557. function HTMLformAdvancedSearch($array)
  558. {
  559. global $CFG;
  560. $array=XSSpreventArray($array);
  561. $rows.='<div class="row">';
  562. $rows.=' <div class="col-md-6 col-md-offset-3">';
  563. $rows.=' <h3>'.ucfirst(LABEL_BusquedaAvanzada).'</h3>';
  564. $rows.='<form class="col-xs-8 form-horizontal" role="form" name="advancedsearch" action="index.php#xstring" method="get">';
  565. $rows.='<fieldset>';
  566. $arrayWS=array('t#'.ucfirst(LABEL_Termino),'mt#'.ucfirst(LABEL_meta_term));
  567. $arrayVocabStats=ARRAYresumen($_SESSION["id_tesa"], "G", "");
  568. if ($arrayVocabStats["cant_up"]>0) {
  569. array_push($arrayWS, 'uf#'.ucfirst(LABEL_esNoPreferido));
  570. }
  571. if ($arrayVocabStats["cant_notas"]>0) {
  572. array_push($arrayWS, 'n#'.ucfirst(LABEL_nota));
  573. }
  574. if ($CFG["_SHOW_CODE"]=='1') {
  575. array_push($arrayWS, 'c#'.ucfirst(LABEL_CODE));
  576. }
  577. if ($arrayVocabStats["cant_term2tterm"]) {
  578. array_push($arrayWS, 'tgt#'.ucfirst(LABEL_TargetTerm));
  579. }
  580. /*
  581. solo si hay m�s de un opci�n
  582. */
  583. if (count($arrayWS)>1) {
  584. $rows.='<div class="form-group"><label class="label_ttl control-label" for="ws" accesskey="f">'.ucfirst(LABEL_QueBuscar).'</label>';
  585. $rows.='<select class="select_ttl form-control" id="ws" name="ws">';
  586. $rows.=doSelectForm($arrayWS, $_GET["ws"]);
  587. $rows.='</select>';
  588. $rows.='</div>';
  589. }
  590. $rows.='<div class="form-group"><label class="label_ln control-label" for="xstring" accesskey="s">'.ucfirst(LABEL_BuscaTermino).'</label>';
  591. $rows.='<input name="xstring" class="input_ln form-control" required type="search" id="xstring" size="25" maxlength="50" value=""/>';
  592. $rows.=' <div class="checkbox-inline" ><label class="btn btn-default" for="isExactMatch" accesskey="f">';
  593. $rows.=' <input name="isExactMatch" type="checkbox" id="isExactMatch" value="1" '.do_check('1', $_GET["isExactMatch"], "checked").'/>'.ucfirst(LABEL_esFraseExacta).'</label>';
  594. $rows.=' </div>';
  595. $rows.='</div>';
  596. $rows.='<div class="collapse" id="masOpcionesBusqueda">';
  597. //Evaluar si hay top terms
  598. $sqlTopTerm=SQLverTopTerm();
  599. if (SQLcount($sqlTopTerm)>0) {
  600. while ($arrayTopTerms=$sqlTopTerm->FetchRow()) {
  601. $formSelectTopTerms[]=$arrayTopTerms["tema_id"].'#'.$arrayTopTerms["tema"];
  602. }
  603. $rows.='<div class="form-group"><label class="label_ttl control-label" for="hasTopTerm" accesskey="t">'.ucfirst(LABEL_TopTerm).'</label>';
  604. $rows.='<select class="select_ttl form-control" id="hasTopTerm" name="hasTopTerm">';
  605. $rows.='<option value="">'.ucfirst(LABEL_Todos).'</option>';
  606. $rows.=doSelectForm($formSelectTopTerms, $_GET["hasTopTerm"]);
  607. $rows.='</select>';
  608. $rows.='</div>';
  609. }
  610. //Evaluar si hay notas
  611. if (is_array($arrayVocabStats["cant_notas"])) {
  612. $LabelNB='NB#'.LABEL_NB;
  613. $LabelNH='NH#'.LABEL_NH;
  614. $LabelNA='NA#'.LABEL_NA;
  615. $LabelNP='NP#'.LABEL_NP;
  616. $LabelNC='NC#'.LABEL_NC;
  617. $sqlNoteType=SQLcantNotas();
  618. while ($arrayNotes=$sqlNoteType->FetchRow()) {
  619. if ($arrayNotes["cant"]>0) {
  620. //nota privada no
  621. if (($_SESSION[$_SESSION["CFGURL"]]["ssuser_nivel"]) || ($arrayNotes["value_id"]!=='11')) {
  622. $varNoteType=(in_array($arrayNotes["value_id"], array(8,9,10,11,15))) ? arrayReplace(array(8,9,10,11,15), array($LabelNA,$LabelNH,$LabelNB,$LabelNP,$LabelNC), $arrayNotes["value_id"]) : $arrayNotes["value_code"].'#'.$arrayNotes["value"];
  623. $varNoteType.=' ('.$arrayNotes["cant"].')';
  624. $arrayNoteType[]=$varNoteType;
  625. }
  626. }
  627. };
  628. /*
  629. Si hay m�s de un tipo de nota
  630. */
  631. if (count($arrayVocabStats["cant_notas"])>0) {
  632. $rows.='<div class="form-group"><label class="label_ttl control-label" for="hasNote" accesskey="n">'.ucfirst(LABEL_tipoNota).'</label>';
  633. $rows.='<select class="select_ttl form-control" id="hasNote" name="hasNote">';
  634. $rows.='<option value="">'.ucfirst(LABEL_Todos).'</option>';
  635. $rows.=doSelectForm($arrayNoteType, $_GET["hasNote"]);
  636. $rows.='</select>';
  637. $rows.='</div>';
  638. }
  639. }
  640. //Evaluar si hay terminos
  641. $sqlTermsByDates=SQLtermsByDate();
  642. if (SQLcount($sqlTermsByDates)>0) {
  643. global $MONTHS;
  644. while ($arrayTermsByDates=$sqlTermsByDates->FetchRow()) {
  645. //normalizacion de fechas
  646. $arrayTermsByDates["months"]=(strlen($arrayTermsByDates["months"])==1) ? '0'.$arrayTermsByDates["months"] : $arrayTermsByDates["months"];
  647. $formSelectByDate[]=$arrayTermsByDates["years"].'-'.$arrayTermsByDates["months"].'#'.$MONTHS["$arrayTermsByDates[months]"].'/'.$arrayTermsByDates["years"].' ('.$arrayTermsByDates["cant"].')';
  648. }
  649. $rows.='<div class="form-group"><label class="label_ttl control-label" for="fromDate" accesskey="d">'.ucfirst(LABEL_DesdeFecha).'</label>';
  650. $rows.='<select class="select_ttl form-control" id="fromDate" name="fromDate">';
  651. $rows.='<option value="">'.ucfirst(LABEL_Todos).'</option>';
  652. $rows.=doSelectForm($formSelectByDate, $_GET["fromDate"]);
  653. $rows.='</select>';
  654. $rows.='</div>';
  655. };
  656. //terms by deep
  657. $sqlTermsByDeep=SQLTermDeep();
  658. if (SQLcount($sqlTermsByDeep)>1) {
  659. while ($arrayTermsByDeep=$sqlTermsByDeep->FetchRow()) {
  660. $formSelectByDeep[]=$arrayTermsByDeep["tdeep"].'#'.$arrayTermsByDeep["tdeep"].' ('.$arrayTermsByDeep["cant"].')';
  661. }
  662. $rows.='<div class="form-group"><label class="label_ttl control-label" for="termDeep" accesskey="e">'.ucfirst(LABEL_ProfundidadTermino).'</label>';
  663. $rows.='<select class="select_ttl form-control" id="termDeep" name="termDeep">';
  664. $rows.='<option value="">'.ucfirst(LABEL_Todos).'</option>';
  665. $rows.=doSelectForm($formSelectByDeep, $_GET["termDeep"]);
  666. $rows.='</select>';
  667. $rows.='</div>';
  668. };
  669. $rows.='</div>';//hide div
  670. $rows.='<div class="btn-group">';
  671. $rows.='<input type="submit" id="boton" name="boton" class="btn btn-primary" value="'.LABEL_Enviar.'"/>';
  672. $rows.=' <button class="btn btn-default" type="button" data-toggle="collapse" data-target="#masOpcionesBusqueda" aria-expanded="false" aria-controls="masOpcionesBusqueda">'.ucfirst(LABEL_Opciones).'</button>';
  673. $rows.='</div>';
  674. $rows.='<input type="hidden" name="xsearch" id="xsearch" value="1"/>';
  675. $rows.=' </fieldset>';
  676. $rows.='</form>';
  677. $rows.='</div>';//div row
  678. $rows.='</div>';//div col
  679. $rows.='<div class="push"></div>';
  680. if ($_GET["boton"]==LABEL_Enviar) {
  681. $rows.=HTMLadvancedSearchResult($array);
  682. }
  683. return $rows;
  684. }
  685. /*
  686. Term Report form
  687. *
  688. */
  689. function HTMLformAdvancedTermReport($array)
  690. {
  691. global $CFG;
  692. $LABEL_Termino=ucfirst(LABEL_Termino);
  693. $LABEL_esNoPreferido=ucfirst(LABEL_esNoPreferido);
  694. $LABEL_CODE=ucfirst(LABEL_CODE);
  695. $LABEL_NOTE=ucfirst(LABEL_nota);
  696. $LABEL_TARGET_TERM=ucfirst(LABEL_TargetTerm);
  697. $LABEL_haveEQ=LABEL_haveEQ;
  698. $LABEL_nohaveEQ=LABEL_nohaveEQ;
  699. $LABEL_start=LABEL_start;
  700. $LABEL_end=LABEL_end;
  701. $LABEL_equalThisWord=LABEL_equalThisWord;
  702. $arrayVocabStats=ARRAYresumen($_SESSION["id_tesa"], "G", "");
  703. $arrayWS=array("t#$LABEL_Termino");
  704. if ($arrayVocabStats["cant_up"]>0) {
  705. array_push($arrayWS, "uf#$LABEL_esNoPreferido");
  706. }
  707. //Notes
  708. if ($arrayVocabStats["cant_notas"]>0) {
  709. array_push($arrayWS, "n#$LABEL_NOTE");
  710. $LabelNB='NB#'.LABEL_NB;
  711. $LabelNH='NH#'.LABEL_NH;
  712. $LabelNA='NA#'.LABEL_NA;
  713. $LabelNP='NP#'.LABEL_NP;
  714. $LabelNC='NC#'.LABEL_NC;
  715. $sqlNoteType=SQLcantNotas();
  716. $arrayNoteType=array();
  717. while ($array=$sqlNoteType->FetchRow()) {
  718. $varNoteType=(in_array($array["value_id"], array(8,9,10,11,15))) ? arrayReplace(array(8,9,10,11,15), array($LabelNA,$LabelNH,$LabelNB,$LabelNP,$LabelNC), $array["value_id"]) : $array["value_code"].'#'.$array["value"];
  719. if ($array["cant"]>0) {
  720. $varNoteType.=' ('.$array["cant"].')';
  721. array_push($arrayNoteType, $varNoteType);
  722. }
  723. };
  724. }
  725. //target vocabularies
  726. if ($arrayVocabStats["cant_term2tterm"]) {
  727. $sql=SQLtargetVocabulary("1");
  728. $array_vocabularios=array();
  729. while ($array=$sql->FetchRow()) {
  730. //vocabularios que no sean el vocabulario principal
  731. array_push($array_vocabularios, $array["tvocab_id"].'#'.FixEncoding($array["tvocab_label"]));
  732. };
  733. }
  734. //Evaluar si hay top terms
  735. $sqlTopTerm=SQLverTopTerm();
  736. if (SQLcount($sqlTopTerm)>0) {
  737. while ($arrayTopTerms=$sqlTopTerm->FetchRow()) {
  738. $formSelectTopTerms[]=$arrayTopTerms["tema_id"].'#'.$arrayTopTerms["tema"];
  739. }
  740. }
  741. //Evaluar si hay terminos
  742. $sqlTermsByDates=SQLtermsByDate();
  743. if (SQLcount($sqlTermsByDates)>0) {
  744. global $MONTHS;
  745. while ($arrayTermsByDates=$sqlTermsByDates->FetchRow()) {
  746. //normalizacion de fechas
  747. $arrayTermsByDates["months"]=(strlen($arrayTermsByDates["months"])==1) ? '0'.$arrayTermsByDates["months"] : $arrayTermsByDates["months"];
  748. $formSelectByDate[]=$arrayTermsByDates["years"].'-'.$arrayTermsByDates["months"].'#'.$MONTHS["$arrayTermsByDates[months]"].'/'.$arrayTermsByDates["years"].' ('.$arrayTermsByDates["cant"].')';
  749. }
  750. };
  751. //internal reference vocabularies
  752. $sql=SQLdatosVocabulario();
  753. if (SQLcount($sql)>'1') {
  754. //Hay vobularios de referencia
  755. $array_ivocabularios=array();
  756. while ($array=$sql->FetchRow()) {
  757. if ($array["vocabulario_id"]!=='1') {
  758. //vocabularios que no sean el vocabulario principal
  759. array_push($array_ivocabularios, $array["vocabulario_id"].'#'.$array["titulo"]);
  760. }
  761. };
  762. };
  763. $rows='<form class="form-horizontal" role="form" name="advancedreport" action="index.php#csv" method="get">
  764. <fieldset>
  765. <!-- Form Name -->
  766. <legend>'.ucfirst(LABEL_FORM_advancedReport).'</legend>';
  767. if (SQLcount($sqlTopTerm)>0) {
  768. $rows.='<!-- Select Basic -->
  769. <div class="form-group">
  770. <label class="col-md-4 control-label" for="hasTopTerm">'.ucfirst(LABEL_TopTerm).'</label>
  771. <div class="col-md-5">
  772. <select id="hasTopTerm" name="hasTopTerm" class="form-control">
  773. <option value="">'.ucfirst(LABEL_FORM_nullValue).'</option>
  774. '.doSelectForm($formSelectTopTerms, $_GET["hasTopTerm"]).'
  775. </select>
  776. </div>
  777. </div>';
  778. };
  779. if ($arrayVocabStats["cant_notas"]>0) {
  780. $rows.='<!-- Select Basic -->
  781. <div class="form-group">
  782. <label class="col-md-4 control-label" for="hasNote">'.ucfirst(LABEL_FORM_haveNoteType).'</label>
  783. <div class="col-md-4">
  784. <select id="hasNote" name="hasNote" class="form-control">
  785. <option value="">'.ucfirst(LABEL_FORM_nullValue).'</option>
  786. '.doSelectForm($arrayNoteType, $_GET["hasNote"]).'
  787. </select>
  788. </div>
  789. </div>';
  790. };
  791. $rows.='<!-- Select Basic -->
  792. <div class="form-group">
  793. <label class="col-md-4 control-label" for="fromDate">'.ucfirst(LABEL_DesdeFecha).'</label>
  794. <div class="col-md-3">
  795. <select id="fromDate" name="fromDate" class="form-control">
  796. <option value="">'.ucfirst(LABEL_FORM_nullValue).'</option>
  797. '.doSelectForm($formSelectByDate, $_GET["fromDate"]).' </select>
  798. </div>
  799. </div>';
  800. //target vocabularies
  801. if ($arrayVocabStats["cant_term2tterm"]) {
  802. $rows.='<!-- Select Basic -->
  803. <div class="form-group">
  804. <label class="col-md-4 control-label" for="csv_tvocab_id">'.ucfirst(LABEL_TargetTerms).'</label>
  805. <div class="col-md-3">
  806. <select id="csv_tvocab_id" name="csv_tvocab_id" class="form-control">
  807. <option value="">'.ucfirst(LABEL_FORM_nullValue).'</option>
  808. '.doSelectForm($array_vocabularios, $_GET["csv_tvocab_id"]).'
  809. </select>
  810. </div>
  811. <div class="col-md-3">
  812. <select id="mapped" name="mapped" class="form-control">
  813. '.doSelectForm(array("y#$LABEL_haveEQ","n#$LABEL_nohaveEQ"), $_GET["mapped"]).'
  814. </select>
  815. </div>
  816. </div>';
  817. };
  818. if (SQLcount($sql)>'1') {
  819. $rows.='<!-- Select Basic -->
  820. <div class="form-group">
  821. <label class="col-md-4 control-label" for="csv_itvocab_id">'.ucfirst(LABEL_vocabulario_referencia).'</label>
  822. <div class="col-md-3">
  823. <select id="csv_itvocab_id" name="csv_itvocab_id" class="form-control">
  824. <option value="">'.ucfirst(LABEL_FORM_nullValue).'</option>
  825. '.doSelectForm($array_ivocabularios, $_GET["csv_itvocab_id"]).'
  826. </select>
  827. </div>
  828. <div class="col-md-3">
  829. <select id="int_mapped" name="int_mapped" class="form-control">
  830. '.doSelectForm(array("y#$LABEL_haveEQ","n#$LABEL_nohaveEQ"), $_GET["int_mapped"]).'
  831. </select>
  832. </div>
  833. </div>';
  834. };
  835. //only for admin
  836. if ($_SESSION[$_SESSION["CFGURL"]]["ssuser_nivel"]=='1') {
  837. $sqlUsers=SQLdatosUsuarios();
  838. if (SQLcount($sqlUsers)>1) {
  839. while ($arrayUsers=$sqlUsers->FetchRow()) {
  840. $formSelectUsers[]=$arrayUsers["id"].'#'.$arrayUsers["apellido"].', '.$arrayUsers["nombres"];
  841. }
  842. $rows.='<!-- Select Basic -->
  843. <div class="form-group">
  844. <label class="col-md-4 control-label" for="byuser_id">'.ucfirst(MENU_Usuarios).'</label>
  845. <div class="col-md-4">
  846. <select id="user_id" name="byuser_id" class="form-control">
  847. <option value="">'.ucfirst(LABEL_FORM_nullValue).'</option>
  848. '.doSelectForm($formSelectUsers, $_GET["byuser_id"]).'
  849. </select>
  850. </div>
  851. </div>';
  852. }
  853. }
  854. $rows.='<div class="form-group">
  855. <label class="col-md-4 control-label" for="w_string">'.ucfirst(LABEL_haveWords).'</label>
  856. <div class="col-md-3">
  857. <select id="w_string" name="w_string" class="form-control">
  858. '.doSelectForm(array("x#$LABEL_equalThisWord","s#$LABEL_start","e#$LABEL_end"), $_GET["w_string"]).'
  859. </select>
  860. </div>
  861. <div class="col-md-3">
  862. <input id="csvstring" name="csvstring" class="form-control" placeholder="'.LABEL_haveWords.'" type="text">
  863. </div>
  864. </div>
  865. <!-- Checkboxes (inline) -->
  866. <div class="form-group">
  867. <label class="col-md-4 control-label" for="csv_encodeAdvance">'.ucfirst(LABEL_encode).' latin1</label>
  868. <div class="col-md-4">
  869. <input name="csv_encode" id="csv_encodeAdvance" value="latin1" type="checkbox">
  870. </div>
  871. </div>
  872. <!-- Button -->
  873. <div class="form-group">
  874. <div class="text-center">
  875. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Guardar).'"/>
  876. </div>
  877. </div>
  878. <input type="hidden" name="mod" id="mod" value="csv"/><input type="hidden" name="task" id="mod" value="csv1"/>
  879. </fieldset>
  880. </form>
  881. ';
  882. return $rows;
  883. }
  884. /*
  885. Simple Term report by
  886. */
  887. function HTMLformSimpleTermReport($array)
  888. {
  889. global $CFG;
  890. $arraySimpleReports=array('csv2#'.ucfirst(LABEL_terminosLibres),
  891. 'csv3#'.ucfirst(LABEL_terminosRepetidos),
  892. 'csv4#'.ucfirst(LABEL_poliBT),
  893. 'csv7#'.ucfirst(LABEL_termsxNTterms),
  894. 'csv8#'.ucfirst(LABEL_termsXcantWords),
  895. 'csv9#'.ucfirst(LABEL_meta_terms),
  896. 'csv13#'.ucfirst(LABEL_preferedTerms),
  897. 'csv10#'.ucfirst(LABEL_relatedTerms),
  898. 'csv11#'.ucfirst(LABEL_nonPreferedTerms),
  899. 'csv18#'.ucfirst(LABEL_sources4vocab),
  900. 'csv5#'.ucfirst(LABEL_Candidato),
  901. 'csv6#'.ucfirst(LABEL_Rechazado));
  902. //admin reports
  903. if (checkValidRol($_SESSION[$_SESSION["CFGURL"]]["user_data"], "adminReports")) {
  904. array_push($arraySimpleReports, 'csv15#'.ucfirst(LABEL_allTerms), 'csv16#'.ucfirst(LABEL_allRelations), 'csv17#'.ucfirst(LABEL_allNotes), 'csv19#'.ucfirst(LABEL_source4term));
  905. }
  906. $rows.='<form role="form" name="simprereport" id="simprereport" action="index.php" method="get">';
  907. $rows.=' <div class="row">
  908. <div class="col-sm-12">
  909. <legend>'.ucfirst(LABEL_FORM_simpleReport).'</legend>
  910. </div>
  911. <!-- panel -->
  912. <div class="col-lg-7">
  913. <div class="panel panel-default">
  914. <div class="panel-body form-horizontal">';
  915. $rows.='<div class="form-group">
  916. <label for="simpleReport" accesskey="s" class="col-sm-3 control-label">'.ucfirst(LABEL_seleccionar).'</label>';
  917. $rows.=' <div class="col-sm-9"><select class="form-control" id="task" name="task">';
  918. $rows.=' <option value="">'.ucfirst(LABEL_seleccionar).'</option>';
  919. $rows.=doSelectForm($arraySimpleReports, secure_data($_GET["task"], "int"));
  920. $rows.=' </select></div>';
  921. $rows.='</div>';
  922. if ($CFG["_CHAR_ENCODE"]=='utf-8') {
  923. $rows.='<div class="form-group">
  924. <input type="checkbox" name="csv_encode" id="csv_encodeSimple" value="latin1"/>
  925. <div class="col-sm-4">
  926. <label for="csv_encodeSimple">'.ucfirst(LABEL_encode).' latin1</label>
  927. </div>
  928. </div>';
  929. }
  930. $rows.='<div class="form-group">
  931. <div class="col-sm-12 text-center">
  932. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Guardar).'"/>
  933. </div>
  934. </div>';
  935. $rows.=' </div>
  936. </div>
  937. </div>
  938. </div> <!-- / panel -->';
  939. $rows.='<input type="hidden" name="mod" id="mod" value="csv"/>';
  940. $rows.='</form>';
  941. return $rows;
  942. }
  943. /*
  944. Simple Term report for mapped terms
  945. */
  946. function HTMLformMappedTermReport($array)
  947. {
  948. global $CFG;
  949. $rows.='<form class="" role="form" name="mappedreport" id="mappedreport" action="index.php" method="get">';
  950. $rows.=' <div class="row">
  951. <div class="col-sm-12">
  952. <legend>'.ucfirst(LABEL_FORM_mappedTermReport).'</legend>
  953. </div>
  954. <!-- panel -->
  955. <div class="col-lg-7">
  956. <div class="panel panel-default">
  957. <div class="panel-body form-horizontal">';
  958. $SQLtvocabs=SQLtargetVocabulary();
  959. while ($ARRAYtvocabs=$SQLtvocabs->FetchRow()) {
  960. $i_tvocab=++$i_tvocab;
  961. $rows.='<div class="form-group">
  962. <input name="tvocabs[]" type="checkbox" id="tvocab_id'.$ARRAYtvocabs["tvocab_id"].'" value="'.$ARRAYtvocabs["tvocab_id"].'" />
  963. <div class="col-sm-4">
  964. <label for="tvocab_id'.$ARRAYtvocabs["tvocab_id"].'">'.$ARRAYtvocabs["tvocab_label"].'</label>
  965. </div>
  966. </div>';
  967. }
  968. $rows.=' <div class="form-group">
  969. <label class="col-md-4 control-label" for="csv_encodeTargetVocab">'.ucfirst(LABEL_encode).' latin1</label>
  970. <div class="col-md-4">
  971. <input name="csv_encode" id="csv_encodeTargetVocab" value="latin1" type="checkbox">
  972. </div>
  973. </div>';
  974. $rows.='<div class="form-group">
  975. <div class="col-sm-12 text-center">
  976. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Guardar).'"/>
  977. </div>
  978. </div>';
  979. $rows.=' </div>
  980. </div>
  981. </div>
  982. </div> <!-- / panel -->';
  983. $rows.='<input type="hidden" name="mod" id="mod" value="csv"/>';
  984. $rows.='<input type="hidden" name="task" id="simpleMappedTermReport" value="csv12"/>';
  985. $rows.='</form>';
  986. if ($i_tvocab>0) {
  987. return $rows;
  988. }
  989. }
  990. /*
  991. Simple Term report for notes
  992. */
  993. function HTMLformNullNotesTermReport($array)
  994. {
  995. global $CFG;
  996. $LabelNB=LABEL_NB;
  997. $LabelNH=LABEL_NH;
  998. $LabelNA=LABEL_NA;
  999. $LabelNP=LABEL_NP;
  1000. $LabelNC=LABEL_NC;
  1001. $rows.='<form class="" role="form" name="NULLnotesreport" id="NULLnotesreport" action="index.php" method="get">';
  1002. $rows.=' <div class="row">
  1003. <div class="col-sm-12">
  1004. <legend>'.ucfirst(LABEL_FORM_NULLnotesTermReport).'</legend>
  1005. </div>
  1006. <!-- panel -->
  1007. <div class="col-lg-7">
  1008. <div class="panel panel-default">
  1009. <div class="panel-body form-horizontal"><div class="panel-heading">'.ucfirst(MSG_FORM_NULLnotesTermReport).'</div>';
  1010. $sqlNoteType=SQLcantNotas();
  1011. while ($ARRAYnoteType=$sqlNoteType->FetchRow()) {
  1012. $i_note=++$i_note;
  1013. $varNoteType=(in_array($ARRAYnoteType["value_id"], array(8,9,10,11,15))) ? arrayReplace(array(8,9,10,11,15), array($LabelNA,$LabelNH,$LabelNB,$LabelNP,$LabelNC), $ARRAYnoteType["value_id"]) : $ARRAYnoteType["value"];
  1014. $rows.='<div class="form-group">
  1015. <div class="col-sm-4">
  1016. <label for="note_type'.$ARRAYnoteType["value_id"].'">'.$varNoteType.'</label>
  1017. </div>
  1018. <div class="col-sm-2">
  1019. <input name="note_type_null" type="radio" id="note_type'.$ARRAYnoteType["value_id"].'" value="'.$ARRAYnoteType["value_code"].'" />
  1020. </div>
  1021. </div>';
  1022. }
  1023. $rows.='<div class="form-group">
  1024. <div class="col-sm-4">
  1025. <label for="note_typeNULL0">'.ucfirst(LABELnoNotes).'</label>
  1026. </div>
  1027. <div class="col-sm-2">
  1028. <input name="note_type_null" type="radio" id="note_typeNULL0" value="0" />
  1029. </div>
  1030. </div>';
  1031. $rows.=' <div class="form-group">
  1032. <label class="col-md-4 control-label" for="csv_encodeNotes">'.ucfirst(LABEL_encode).' latin1</label>
  1033. <div class="col-md-4">
  1034. <input name="csv_encode" id="csv_encodeNotes" value="latin1" type="checkbox">
  1035. </div>
  1036. </div>';
  1037. $rows.='<div class="form-group">
  1038. <div class="col-sm-12 text-center">
  1039. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Guardar).'"/>
  1040. </div>
  1041. </div>';
  1042. $rows.=' </div>
  1043. </div>
  1044. </div>
  1045. </div> <!-- / panel -->';
  1046. $rows.='<input type="hidden" name="mod" id="mod" value="csv"/>';
  1047. $rows.='<input type="hidden" name="task" id="simpleMappedTermReport" value="csv14"/>';
  1048. $rows.='</form>';
  1049. return $rows;
  1050. }
  1051. /*
  1052. Register web services provider
  1053. *
  1054. */
  1055. function HTMLformTargetVocabulary($tvocab_id = "0")
  1056. {
  1057. global $CFG;
  1058. $array=($tvocab_id>0) ? ARRAYtargetVocabulary($tvocab_id) : array();
  1059. $array["tvocab_status"] = (is_numeric($array["tvocab_status"])) ? $array["tvocab_status"] : '1';
  1060. $doAdmin= ($array["tvocab_id"]>0) ? 'saveTargetVocabulary' : 'addTargetVocabulary';
  1061. // Preparado de datos para el formulario ///
  1062. foreach ($CFG["ISO639-1"] as $langs) {
  1063. $arrayLang[]=$langs[0].'#'.$langs[1];
  1064. };
  1065. //SEND_KEY to prevent duplicated
  1066. session_start();
  1067. $_SESSION['TGET_SEND_KEY']=md5(uniqid(rand(), true));
  1068. $rows.='<form role="form" id="form-tvocab" data-toggle="validator" name="abmTargetVocabulary" action="admin.php" method="post">';
  1069. $rows.=' <div class="row">
  1070. <div class="col-sm-12">
  1071. <legend><a href="admin.php?vocabulario_id=list">'.ucfirst(LABEL_lcConfig).'</a> &middot; '.ucfirst(LABEL_TargetVocabularyWS).'</legend>
  1072. </div>
  1073. <!-- panel -->
  1074. <div class="col-lg-7">
  1075. <div class="panel panel-default">
  1076. <div class="panel-body form-horizontal">';
  1077. if ($array["tvocab_id"]) {
  1078. $link2tterms='(<a href="admin.php?doAdmin=seeTermsTargetVocabulary&amp;tvocab_id='.$array["tvocab_id"].'">'.$array["cant"].' '.LABEL_Terminos.'</a>)';
  1079. $rows.='<div class="form-group"><label class="col-sm-3 control-label" for="tvocab_label">'.ucfirst(LABEL_Titulo).'</label>';
  1080. $rows.=' <div class="col-sm-9"><a id="tvocab_title" href="'.$array["tvocab_url"].'">'.$array["tvocab_title"].'</a> '.$link2tterms.' ';
  1081. $rows.=' </div>';
  1082. $rows.='</div>';
  1083. }
  1084. $rows.=' <div class="form-group">
  1085. <label for="tvocab_label" accesskey="l" class="col-sm-3 control-label">'.ucfirst(LABEL_tvocab_label).'</label>
  1086. <div class="col-sm-9">
  1087. <input type="text" required placeholder="'.LABEL_tvocab_label.'" class="form-control" name="tvocab_label" id="tvocab_label" value="'.$array["tvocab_label"].'"/>
  1088. </div>
  1089. </div>
  1090. <div class="form-group">
  1091. <label for="tvocab_lang" class="col-sm-3 control-label">'.ucfirst(LABEL_Idioma).'</label>
  1092. <div class="col-sm-9">
  1093. <select class="form-control" id="tvocab_lang" name="tvocab_lang">
  1094. '.doSelectForm($arrayLang, $array["tvocab_lang"]).'
  1095. </select>
  1096. </div>
  1097. </div>
  1098. <div class="form-group">
  1099. <label for="tvocab_tag" accesskey="l" class="col-sm-3 control-label">'.ucfirst(LABEL_tvocab_tag).'a</label>
  1100. <div class="col-sm-9">
  1101. <input type="text" class="form-control" required placeholder="'.ucfirst(LABEL_tvocab_tag).'" name="tvocab_tag" id="tvocab_tag" value="'.$array["tvocab_tag"].'"/>
  1102. <span class="help-block">'.ucfirst(LABEL_defaultEQmap).'</span>
  1103. </div>
  1104. </div>
  1105. <div class="form-group">
  1106. <label for="tvocab_uri_service" accesskey="l" class="col-sm-3 control-label">'.ucfirst(LABEL_tvocab_uri_service).'</label>
  1107. <div class="col-sm-9">';
  1108. if ($array["tvocab_id"]) {
  1109. $rows.='<span id="tvocab_uri_service">'.$array["tvocab_uri_service"].'</span>';
  1110. } else {
  1111. $rows.='<input type="url" required placeholder="'.LABEL_tvocab_uri_service.'" class="form-control" name="tvocab_uri_service" id="tvocab_uri_service" value="'.$array["tvocab_uri_service"].'"/>';
  1112. $rows.='<span class="help-block">'.ucfirst(LABEL__example).' (demo): <a href="https://r020.com.ar/tematres/demo/services.php" target="_blanck">https://r020.com.ar/tematres/demo/services.php</span>';
  1113. $rows.='<span class="help-block">'.ucfirst(LINK_publicKnownVocabularies).'</span>';
  1114. };
  1115. $rows.=' </div>
  1116. </div>
  1117. <div class="form-group">
  1118. <input type="checkbox" name="tvocab_status" id="tvocab_status" value="1" alt="'.ucfirst(LABEL_enable).'" '.do_check(1, $array["tvocab_status"], 'checked').' />
  1119. <div class="col-sm-4">
  1120. <label for="tvocab_status">'.ucfirst(LABEL_enable).'</label>
  1121. </div>
  1122. </div>
  1123. <div class="form-group">
  1124. <div class="col-sm-12 text-right">
  1125. <button type="submit" class="btn btn-primary" id="boton" name="botonTargetVocabulary" value="'.LABEL_Enviar.'"/>'.ucfirst(LABEL_Enviar).'</button>
  1126. <a type="button" class="btn btn" name="cancelar" type="button" href="admin.php" title="'.ucfirst(LABEL_Cancelar).'">'.ucfirst(LABEL_Cancelar).'</a>
  1127. </div>
  1128. </div>
  1129. </div>
  1130. </div>
  1131. </div> <!-- / panel -->';
  1132. $rows.='<input type="hidden" id="tvocab_id" name="tvocab_id" value="'.$array["tvocab_id"].'"/>';
  1133. $rows.='<input type="hidden" name="doAdmin" id="doAdmin" value="'.$doAdmin.'"/>';
  1134. $rows.='<input type="hidden" name="ks" id="ks" value="'.$_SESSION["TGET_SEND_KEY"].'"/>';
  1135. $rows.='</form>';
  1136. return $rows;
  1137. }
  1138. /*
  1139. Asociaci�n con datos provistos por web services terminol�gicos TemaTres
  1140. */
  1141. function HTMLformAssociateTargetTerms($ARRAYtermino, $term_id = "0")
  1142. {
  1143. global $CFG;
  1144. $sql=SQLtargetVocabulary("1");
  1145. $rows='<div class="container" id="bodyText">';
  1146. $rows.='<a class="topOfPage" href="'.URL_BASE.'index.php?tema='.$ARRAYtermino["idTema"].'" title="'.LABEL_Anterior.'">'.LABEL_Anterior.'</a>';
  1147. if (SQLcount($sql)=='0') {
  1148. //No hay vocabularios de referencia, solo vocabulario principal
  1149. $rows.=HTMLalertNoTargetVocabulary();
  1150. } else {
  1151. //Hay vobularios de referencia
  1152. while ($array=$sql->FetchRow()) {
  1153. if ($array["vocabulario_id"]!=='1') {
  1154. //vocabularios que no sean el vocabulario principal
  1155. $array_vocabularios[]=$array["tvocab_id"].'#'.FixEncoding($array["tvocab_label"].' - '.$CFG["ISO639-1"][$array["tvocab_lang"]][1]);
  1156. }
  1157. };
  1158. $arrayOptions=(strlen($ARRAYtermino["code"])>0) ? array('string#'.ucfirst(LABEL_string2search),'reverse#'.ucfirst(LABEL_reverseMappign),'code#'.LABEL_CODE) : array('string#'.ucfirst(LABEL_string2search),'reverse#'.ucfirst(LABEL_reverseMappign));
  1159. $display=(in_array($_GET["search_by"], array('reverse','code'))) ? 'style="display: none;"' : '';
  1160. $string2search = ($_GET["string2search"]) ? XSSprevent($_GET["string2search"]) : $ARRAYtermino["titTema"];
  1161. $rows.='<form class="" role="form" name="alta_tt" id="alta_tt" action="index.php" method="get">';
  1162. $rows.=' <div class="row">
  1163. <div class="col-sm-12">
  1164. <legend>'.ucfirst(LABEL_relacion_vocabulario).' '.HTMLlinkTerm(array("tema_id"=>$ARRAYtermino["idTema"],"tema"=>$ARRAYtermino["titTema"])).'</legend>
  1165. </div>
  1166. <!-- panel -->
  1167. <div class="col-lg-7">
  1168. <div class="panel panel-default">
  1169. <div class="panel-body form-horizontal">
  1170. <div class="form-group">
  1171. <label for="tvocab_id" class="col-sm-3 control-label">'.ucfirst(FORM_LABEL_nombre_vocabulario).'</label>
  1172. <div class="col-sm-9">
  1173. <select class="form-control" id="tvocab_id" name="tvocab_id">
  1174. '.doSelectForm($array_vocabularios, $_GET["tvocab_id"]).'
  1175. </select>
  1176. </div>
  1177. </div>';
  1178. //Configurar opcion búsqueda por código
  1179. $rows.='<div class="form-group">
  1180. <label for="search_by" class="col-sm-3 control-label">'.ucfirst(LABEL_selectMapMethod).'</label>
  1181. <div class="col-sm-9">
  1182. <select class="form-control" id="search_by" name="search_by" onChange="mostrar(this.value);">
  1183. '.doSelectForm($arrayOptions, $_GET["search_by"]).'
  1184. </select>
  1185. </div>
  1186. </div>';
  1187. $rows.='<div id="by_string" class="form-group" '.$display.'>
  1188. <label for="string2search" class="col-sm-3 control-label">'.ucfirst(LABEL_Buscar).'</label>
  1189. <div class="col-sm-9">
  1190. <input type="text" class="form-control" required type="search" required id="string2search" name="string2search" value="">
  1191. </div>
  1192. </div>
  1193. <div class="form-group">
  1194. <div class="col-sm-12 text-right">
  1195. <button type="submit" class="btn btn-primary" value="'.LABEL_Buscar.'"/>'.ucfirst(LABEL_Buscar).'</button>
  1196. <button type="button" class="btn btn" name="cancelar" type="button" onClick="location.href=\'index.php?tema='.$ARRAYtermino["idTema"].'\'" value="'.ucfirst(LABEL_Cancelar).'"/>'.ucfirst(LABEL_Cancelar).'</button>
  1197. </div>
  1198. </div>
  1199. </div>
  1200. </div>
  1201. </div> <!-- / panel -->';
  1202. $rows.='<input type="hidden" name="tema" value="'.$ARRAYtermino["idTema"].'"/>
  1203. <input type="hidden" name="taskterm" value="findTargetTerm"/>';
  1204. $rows.='</form>';
  1205. }
  1206. $rows.='</div>';
  1207. $string2search = toASCII($string2search);
  1208. if (($string2search) && ($_GET["tvocab_id"])) {
  1209. include_once T3_ABSPATH . 'common/include/vocabularyservices.php' ;
  1210. $arrayVocab=ARRAYtargetVocabulary($_GET["tvocab_id"]);
  1211. switch ($_GET["search_by"]) {
  1212. case 'string':
  1213. $dataTerm=getURLdata($arrayVocab["tvocab_uri_service"].'?task=search&arg='.urlencode($string2search));
  1214. break;
  1215. case 'code':
  1216. $dataTerm=getURLdata($arrayVocab["tvocab_uri_service"].'?task=fetchCode&arg='.urlencode($ARRAYtermino["code"]));
  1217. break;
  1218. case 'reverse':
  1219. $dataTerm=getURLdata($arrayVocab["tvocab_uri_service"].'?task=fetchSourceTerms&arg='.rawurlencode($ARRAYtermino["titTema"]));
  1220. break;
  1221. default:
  1222. $dataTerm=getURLdata($arrayVocab["tvocab_uri_service"].'?task=search&arg='.urlencode($string2search));
  1223. break;
  1224. }
  1225. $rows.=HTMLtargetVocabularySearchResult($dataTerm, $_GET["string2search"], $arrayVocab, $ARRAYtermino["idTema"]);
  1226. };//fin de if buscar
  1227. $rows.=' </div>';
  1228. $rows.='<script type="text/javascript">
  1229. function mostrar(id) {
  1230. ((id == "string") ? $("#by_string").show() : $("#by_string").hide());
  1231. }
  1232. </script>';
  1233. return $rows;
  1234. }
  1235. function HTMLtargetVocabularySearchResult($dataTerm, $string_search, $arrayVocab, $tema_id)
  1236. {
  1237. global $CFG;
  1238. //SEND_KEY to prevent duplicated
  1239. session_start();
  1240. $_SESSION['SEND_KEY']=md5(uniqid(rand(), true));
  1241. $tag_type='ol';
  1242. $rows.='<h3>'.$dataTerm->resume->cant_result.' '.MSG_ResultBusca.' <i>'.$string_search.'</i> ('.FixEncoding($arrayVocab["tvocab_title"]).' - '.$CFG["ISO639-1"][$arrayVocab["tvocab_lang"]][1].')</h3>'."\n\r";
  1243. if ($dataTerm->resume->cant_result > "0") {
  1244. $rows.='<'.$tag_type.'>';
  1245. foreach ($dataTerm->result->term as $value) {
  1246. $rows.='<li class="btn-block">';
  1247. $rows.='<a class="btn btn-primary btn-sm" role="button" title="'.FixEncoding((string) $value->string).'" href="'.URL_BASE.'index.php?tema='.$tema_id.'&amp;tvocab_id='.$arrayVocab["tvocab_id"].'&amp;tgetTerm_id='.(int) $value->term_id.'&amp;taskrelations=addTgetTerm&amp;ks='.$_SESSION["SEND_KEY"].'">'.ucfirst(LABEL_seleccionar).'</a> ';
  1248. $rows.='<a class="modalTrigger" title="'.LABEL_Detalle.' '.FixEncoding((string) $value->string).'" href="'.URL_BASE.'modal.php?tvocab_id='.$arrayVocab["tvocab_id"].'&term_id='.(int) $value->term_id.'">'.FixEncoding((string) $value->string).'</a>';
  1249. $rows.='</li>';
  1250. };
  1251. $rows.='</'.$tag_type.'>';
  1252. }
  1253. return $rows;
  1254. }
  1255. function HTMLformTargetVocabularySuggested($arrayTterm, $t_relation, $string_search, $arrayVocab, $tema_id)
  1256. {
  1257. global $CFG;
  1258. //SEND_KEY to prevent duplicated
  1259. session_start();
  1260. $_SESSION['SEND_KEY']=md5(uniqid(rand(), true));
  1261. $label_relation=ucfirst(arrayReplace(array('0','2','3','4'), array(LABEL_Termino,TR_termino,TE_termino,UP_termino), $t_relation));
  1262. $flag_allow_duplicated=($_SESSION[$_SESSION["CFGURL"]]["CFG_ALLOW_DUPLICATED"]==1) ? 1 : 0;
  1263. $rows.='<h3 id="suggestResult">'.FixEncoding($arrayVocab["tvocab_title"]).' ('.$CFG["ISO639-1"][$arrayVocab["tvocab_lang"]][1].')</h3>';
  1264. if (count($arrayTterm) > 0) {
  1265. $rows.='<form role="form" name="select_multi_term" action="index.php" method="post">';
  1266. $rows.=' <div class="row">
  1267. <div class="col-lg-10">
  1268. <legend class="alert alert-info"> '.$label_relation.': '.count($arrayTterm).' '.MSG_ResultBusca.' <i>'.$string_search.'</i></legend>
  1269. </div>
  1270. <!-- panel -->
  1271. <div class="col-lg-10">
  1272. <div class="panel panel-default">
  1273. <div class="panel-body form-horizontal">';
  1274. $rows.='<div><input id="filter" type="text" class="form-control" placeholder="'.ucfirst(LABEL_type2filter).'"></div>';
  1275. $rows.='<div class="table-responsive"> ';
  1276. $rows.='<table class="table table-striped table-bordered table-condensed table-hover">
  1277. <thead>
  1278. <tr>
  1279. <th class="text-center"><input name="checktodos" type="checkbox" title="'.LABEL_selectAll.'"/></th>
  1280. <th>'.ucfirst(LABEL_Termino).'</th>
  1281. <th>'.ucfirst(LABEL_lastChangeDate).'</th>
  1282. </tr>
  1283. </thead>
  1284. <tbody class="searchable">';
  1285. foreach ($arrayTterm as $value) {
  1286. //check for duplicated term
  1287. $SQLcheck_term=SQLbuscaExacta($value["string"]);
  1288. $is_duplicated=(SQLcount($SQLcheck_term)>0) ? true : false;
  1289. $rows.= '<tr>';
  1290. //duplicated term & allowed duplicated
  1291. if (($is_duplicated) && ($flag_allow_duplicated==1)) {
  1292. $rows.= ' <td align="center"><input type="checkbox" name="selectedTerms[]" id="tterm_'.$value["term_id"].'" title="'.$value["source_string"].' ('.$label_relation.')" value="'.$value["string"].'|tterm_|'.$value["term_id"].'" /> </td>';
  1293. $rows.= ' <td><label class="check_label" title="'.$value["source_string"].' ('.$label_relation.')" for="tterm_'.$value["term_id"].'">'.$value["string"].' <span style="font-weight:normal;">[<a href="modal.php?tvocab_id='.$arrayVocab["tvocab_id"].'&term_id='.$value["source_term_id"].'" class="modalTrigger" title="'.$value["source_string"].' ('.$label_relation.')" target="_blank">'.LABEL_Detalle.'</a>]</span> <span style="color:red">'.LABEL_terminoExistente.'</span></label></td>';
  1294. $rows.= ' <td>'.$value["source_date"].'</td>';
  1295. //duplicated term & nos allowed d
  1296. } elseif (($is_duplicated) && ($flag_allow_duplicated==0)) {
  1297. $rows.= ' <td align="center"> </td>';
  1298. $rows.= ' <td><label class="check_label" title="'.$value["source_string"].' ('.$label_relation.')" for="tterm_'.$value["term_id"].'">'.$value["string"].' <span style="font-weight:normal;">[<a href="modal.php?tvocab_id='.$arrayVocab["tvocab_id"].'&term_id='.$value["source_term_id"].'" class="modalTrigger" title="'.$value["source_string"].' ('.$label_relation.')" target="_blank">'.LABEL_Detalle.'</a>]</span> <span style="color:red">'.LABEL_terminoExistente.'</span></label></td>';
  1299. $rows.= ' <td>'.$value["source_date"].'</td>';
  1300. } else {
  1301. $rows.= ' <td align="center"><input type="checkbox" name="selectedTerms[]" id="tterm_'.$value["term_id"].'" title="'.$value["source_string"].' ('.$label_relation.')" value="'.$value["string"].'|tterm_|'.$value["term_id"].'" /> </td>';
  1302. $rows.= ' <td><label class="check_label" title="'.$value["source_string"].' ('.$label_relation.')" for="tterm_'.$value["term_id"].'">'.$value["string"].' <span style="font-weight:normal;">[<a href="modal.php?tvocab_id='.$arrayVocab["tvocab_id"].'&term_id='.$value["source_term_id"].'" class="modalTrigger" title="'.$value["source_string"].' ('.$label_relation.')" target="_blank">'.LABEL_Detalle.'</a>]</span> </label></td>';
  1303. $rows.= ' <td>'.$value["source_date"].'</td>';
  1304. }
  1305. $rows.= '</tr>';
  1306. };
  1307. $rows.=' </tbody> </table>';
  1308. $rows.=' </div>';
  1309. if ($t_relation!=="4") {
  1310. $ARRAYuriReference=ARRAYfetchValue("URI_TYPE", "exactMatch");
  1311. $rows.='<div class="form-group">
  1312. <input type="checkbox" name="addLinkReference" id="addLinkReference" value="'.$ARRAYuriReference["value_id"].'" alt="'.ucfirst(LABEL_addExactLink).'" />
  1313. <div class="col-sm-4">
  1314. <label for="addLinkReference">'.ucfirst(LABEL_addExactLink).'</label>
  1315. </div>
  1316. </div>';
  1317. $rows.='<div class="form-group">
  1318. <input type="checkbox" name="addMappReference" id="addMappReference" value="1" alt="'.ucfirst(LABEL_addMapLink).' ('.ucfirst($arrayVocab["tvocab_label"]).'" checked />
  1319. <div class="col-sm-4">
  1320. <label for="addMappReference">'.ucfirst(LABEL_addMapLink).'</label>
  1321. </div>
  1322. </div>';
  1323. $rows.='<div class="form-group">
  1324. <input type="checkbox" name="addNoteReference" id="addNoteReference" value="1" alt="'.ucfirst(LABEL_addSourceNote).'" checked />
  1325. <div class="col-sm-4">
  1326. <label for="addNoteReference">'.ucfirst(LABEL_addSourceNote).'</label>
  1327. </div>
  1328. </div>';
  1329. }
  1330. $rows.=' <div class="form-group">
  1331. <div class="col-sm-12 text-center">
  1332. <button type="submit" class="btn btn-primary" value="'.LABEL_Enviar.'"/>'.ucfirst(LABEL_Enviar).'</button>
  1333. <button type="button" class="btn btn" name="cancelar" type="button" onClick="location.href=\'index.php?tema='.$ARRAYtermino["idTema"].'\'" value="'.ucfirst(LABEL_Cancelar).'"/>'.ucfirst(LABEL_Cancelar).'</button>
  1334. </div>
  1335. </div>
  1336. </div>
  1337. </div>
  1338. </div> <!-- / panel -->';
  1339. $rows.='<input type="hidden" name="ks" id="ks" value="'.$_SESSION["SEND_KEY"].'"/>';
  1340. $rows.='<input type="hidden" name="tema" value="'.$tema_id.'" />';
  1341. $rows.='<input type="hidden" id="t_relation" name="t_relation" value="'.$t_relation.'"/>';
  1342. $rows.='<input type="hidden" id="taskterm" name="taskterm" value="addSuggestedTerms"/>';
  1343. $rows.='<input type="hidden" name="tvocab_id" name="tvocab_id" value="'.$arrayVocab["tvocab_id"].'"/>';
  1344. $rows.='</form>';
  1345. } //end of if result
  1346. else {
  1347. $rows.='<p class="alert alert-danger"> '.$label_relation.': '.count($arrayTterm).' '.MSG_ResultBusca.' <i>'.$string_search.'</i></p>';
  1348. }
  1349. return $rows;
  1350. }
  1351. function HTMLformAltaEquivalenciaTermino($ARRAYTermino)
  1352. {
  1353. $sql=SQLdatosVocabulario();
  1354. //SEND_KEY to prevent duplicated
  1355. session_start();
  1356. $_SESSION['SEND_KEY']=md5(uniqid(rand(), true));
  1357. $rows='<div class="container" id="bodyText">';
  1358. $rows.='<script type="text/javascript">$("#form-tvocab").validate({});</script>';
  1359. $rows.='<a class="topOfPage" href="'.URL_BASE.'index.php?tema='.$ARRAYtermino["idTema"].'" title="'.LABEL_Anterior.'">'.LABEL_Anterior.'</a>';
  1360. if (SQLcount($sql)=='1') {
  1361. //No hay vocabularios de referencia, solo vocabulario principal
  1362. $rows.=HTMLalertNoTargetVocabularyPivotModel();
  1363. } else {
  1364. //Hay vobularios de referencia
  1365. $array_vocabularios=array();
  1366. while ($array=$sql->FetchRow()) {
  1367. if ($array["vocabulario_id"]!=='1') {
  1368. //vocabularios que no sean el vocabulario principal
  1369. array_push($array_vocabularios, $array["vocabulario_id"].'#'.$array["titulo"]);
  1370. }
  1371. };
  1372. $rows.='<form class="" role="form" name="alta_eqt" id="alta_eqt" action="index.php" method="post">';
  1373. $rows.=' <div class="row">
  1374. <div class="col-sm-12">
  1375. <legend>'.ucfirst(LABEL_relacion_vocabulario).' '.HTMLlinkTerm(array("tema_id"=>$ARRAYTermino["idTema"],"tema"=>$ARRAYTermino["titTema"])).'</legend>
  1376. </div>
  1377. <!-- panel -->
  1378. <div class="col-lg-7">
  1379. <div class="panel panel-default">
  1380. <div class="panel-body form-horizontal">
  1381. <div class="form-group">
  1382. <label for="ref_vocabulario_id" accesskey="v" class="col-sm-3 control-label">'.ucfirst(FORM_LABEL_nombre_vocabulario).'</label>
  1383. <div class="col-sm-9">
  1384. <select class="form-control" id="ref_vocabulario_id" name="ref_vocabulario_id">
  1385. '.doSelectForm($array_vocabularios, $_GET["tvocab_id"]).'
  1386. </select>
  1387. </div>
  1388. </div>
  1389. <div class="form-group">
  1390. <label class="col-sm-3 control-label" for="'.FORM_LABEL_termino.'" accesskey="t">'.ucfirst(LABEL_Termino).'</label>
  1391. <div class="col-sm-9">
  1392. <input type="text" class="form-control" required name="'.FORM_LABEL_termino.'" id="'.FORM_LABEL_termino.'"/>
  1393. </div>
  1394. </div>
  1395. <div class="form-group">
  1396. <label for="tipo_equivalencia" accesskey="q" class="col-sm-3 control-label">'.ucfirst(FORM_LABEL_tipo_equivalencia).'</label>
  1397. <div class="col-sm-9">
  1398. <select class="form-control" id="tipo_equivalencia" name="tipo_equivalencia">
  1399. '.doSelectForm(array(id_EQ.'#'.LABEL_termino_equivalente,id_EQ_PARCIAL.'#'.LABEL_termino_parcial_equivalente), id_EQ).'
  1400. </select>
  1401. </div>
  1402. </div>
  1403. <div class="form-group">
  1404. <div class="col-sm-12 text-right">
  1405. <button type="submit" class="btn btn-primary" value="'.LABEL_Enviar.'"/>'.ucfirst(LABEL_Enviar).'</button>
  1406. <button type="button" class="btn btn" name="cancelar" type="button" onClick="location.href=\'index.php?tema='.$ARRAYTermino["idTema"].'\'" value="'.ucfirst(LABEL_Cancelar).'"/>'.ucfirst(LABEL_Cancelar).'</button>
  1407. </div>
  1408. </div>
  1409. </div>
  1410. </div>
  1411. </div> <!-- / panel -->';
  1412. $rows.='<input type="hidden" name="id_termino_eq" value="'.$ARRAYTermino["idTema"].'" />';
  1413. $rows.='<input type="hidden" name="ks" id="ks" value="'.$_SESSION["SEND_KEY"].'"/>';
  1414. $rows.='</form>';
  1415. $rows.='<script id="tvocab_script" type="text/javascript">
  1416. $(document).ready(function() {
  1417. var validator = $("#alta_eqt").validate({
  1418. rules: {\''.FORM_LABEL_termino.'\': {required: true},
  1419. },
  1420. debug: true,
  1421. errorElement: "label",
  1422. submitHandler: function(form) {
  1423. form.submit();
  1424. }
  1425. });
  1426. });
  1427. </script> ';
  1428. }
  1429. $rows.='</div>';
  1430. return $rows;
  1431. }
  1432. //View and edit config options
  1433. function HTMLformConfigValues($array_vocabulario)
  1434. {
  1435. global $arrayCFGs;
  1436. $sql=SQLconfigValues();
  1437. $NEWarrayCFGs=array();
  1438. while ($array=$sql->FetchRow()) {
  1439. $NEWarrayCFGs[$array["value"]]= $array["value_code"];
  1440. }
  1441. $rows.='<div class="form-group">';
  1442. $rows.='<label class="col-sm-3 control-label" for="'.FORM_LABEL_jeraquico.'">'.ucfirst(FORM_LABEL_jeraquico).'</label>';
  1443. $rows.='<div class="col-sm-9"> <select id="'.FORM_LABEL_jeraquico.'" name="'.FORM_LABEL_jeraquico.'">';
  1444. $rows.= doSelectForm(array('1#'.LABEL_SI,'00#'.LABEL_NO), $array_vocabulario["polijerarquia"]);
  1445. $rows.='</select><span class="help-block">'.ucfirst(LABEL_jeraquico).'</span></div>';
  1446. $rows.='</div>';
  1447. foreach ($arrayCFGs as $key => $value) {
  1448. switch ($key) {
  1449. case 'CFG_PUBLISH':
  1450. $rows.='<div class="form-group">';
  1451. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1452. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1453. $rows.= doSelectForm(array('1#'.LABEL_SI,'00#'.LABEL_NO), $NEWarrayCFGs[$key]);
  1454. $rows.='</select>';
  1455. $rows.='<span class="help-block">'.ucfirst(LABEL_CFG_PUBLISH).'</span></div>';
  1456. $rows.='</div>';
  1457. break;
  1458. case 'CFG_ALLOW_DUPLICATED':
  1459. $rows.='<div class="form-group">';
  1460. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1461. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1462. $rows.= doSelectForm(array('1#'.LABEL_SI,'00#'.LABEL_NO), $NEWarrayCFGs[$key]);
  1463. $rows.='</select>';
  1464. $rows.='<span class="help-block">'.ucfirst(LABEL_ALLOW_DUPLICATED).'</span></div>';
  1465. $rows.='</div>';
  1466. break;
  1467. case '_SHOW_RANDOM_TERM':
  1468. $ARRAYnoteType=ARRAYnoteTypes(array('NP'));
  1469. foreach ($ARRAYnoteType as $noteType => $noteData) {
  1470. //exclude private notes
  1471. $flagSelected=($NEWarrayCFGs[$key]==$noteData["value_code"]) ? 'SELECTED':"";
  1472. $noteOption.='<option value="'.$noteData["value_code"].'" '.$flagSelected.'>'.$noteData["value"].' ('.$noteData["cant"].')</option>';
  1473. };
  1474. $noteSelect.='<option value="00">'.LABEL_NO.'</option>';
  1475. $noteSelect.=' <optgroup label="'.ucfirst(LABEL_opt_show_rando_term).'">'.$noteOption.'</optgroup>';
  1476. $rows.='<div class="form-group">';
  1477. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1478. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1479. $rows.= $noteSelect;
  1480. $rows.='</select>';
  1481. $rows.='<span class="help-block">'.ucfirst(LABEL_SHOW_RANDOM_TERM).'</span></div>';
  1482. $rows.='</div>';
  1483. empty($noteData);
  1484. empty($noteType);
  1485. break;
  1486. case '_GLOSS_NOTES':
  1487. foreach ($ARRAYnoteType as $noteType => $noteData) {
  1488. //exclude private notes
  1489. $flagSelected=($NEWarrayCFGs[$key]==$noteData["value_code"]) ? 'SELECTED':"";
  1490. $_GLOSS_NOTESOptions.='<option value="'.$noteData["value_code"].'" '.$flagSelected.'>'.$noteData["value"].' ('.$noteData["cant"].')</option>';
  1491. };
  1492. $rows.='<div class="form-group">';
  1493. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1494. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1495. $rows.= $_GLOSS_NOTESOptions;
  1496. $rows.='</select>';
  1497. $rows.='<span class="help-block">'.ucfirst(LABEL_GLOSS_NOTES).'</span></div>';
  1498. $rows.='</div>';
  1499. break;
  1500. case 'CFG_MAX_TREE_DEEP':
  1501. $rows.='<div class="form-group">';
  1502. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1503. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1504. $rows.= doSelectForm(array("1#1","2#2","3#3","4#4","5#5","6#6"), $NEWarrayCFGs[$key]);
  1505. $rows.='</select>';
  1506. $rows.='<span class="help-block">'.ucfirst(LABEL_CFG_MAX_TREE_DEEP).'</span></div>';
  1507. $rows.='</div>';
  1508. break;
  1509. case 'CFG_MIN_SEARCH_SIZE':
  1510. $rows.='<div class="form-group">';
  1511. $rows.='<label class="col-sm-5 control-label" for="'.$key.'" >'.$key.'</label>';
  1512. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1513. $rows.= doSelectForm(array("1#1","2#2","3#3","4#4","5#5","6#6"), $NEWarrayCFGs[$key]);
  1514. $rows.='</select>';
  1515. $rows.='<span class="help-block">'.ucfirst(LABEL_CFG_MIN_SEARCH_SIZE).'</span></div>';
  1516. $rows.='</div>';
  1517. break;
  1518. case 'CFG_NUM_SHOW_TERMSxSTATUS':
  1519. $rows.='<div class="form-group">';
  1520. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1521. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1522. $rows.= doSelectForm(array("50#50","100#100","150#150","200#200","250#250"), $NEWarrayCFGs[$key]);
  1523. $rows.='</select>';
  1524. $rows.='<span class="help-block">'.ucfirst(LABEL_CFG_NUM_SHOW_TERMSxSTATUS).'</span></div>';
  1525. $rows.='</div>';
  1526. break;
  1527. case 'CFG_SEARCH_METATERM':
  1528. $rows.='<div class="form-group">';
  1529. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1530. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1531. $rows.= doSelectForm(array('1#'.LABEL_SI,'00#'.LABEL_NO), $NEWarrayCFGs[$key]);
  1532. $rows.='</select>';
  1533. $rows.='<span class="help-block">'.ucfirst(NOTE_isMetaTermNote).'</span></div>';
  1534. $rows.='</div>';
  1535. break;
  1536. case 'CFG_SUGGESTxWORD':
  1537. $rows.='<div class="form-group">';
  1538. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1539. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1540. $rows.= doSelectForm(array('1#'.LABEL_SI,'00#'.LABEL_NO), $NEWarrayCFGs[$key]);
  1541. $rows.='</select>';
  1542. $rows.='<span class="help-block">'.ucfirst(LABEL_CFG_SUGGESTxWORD).'</span></div>';
  1543. $rows.='</div>';
  1544. break;
  1545. default:
  1546. $rows.='<div class="form-group">';
  1547. $rows.='<label class="col-sm-5 control-label" for="'.$key.'">'.$key.'</label>';
  1548. $rows.='<div class="col-sm-5"> <select id="'.$key.'" name="'.$key.'">';
  1549. $rows.= doSelectForm(array('1#'.LABEL_SI,'00#'.LABEL_NO), $NEWarrayCFGs[$key]);
  1550. $rows.='</select>';
  1551. $rows.='<span class="help-block">'.ucfirst(arrayReplace(array('_USE_CODE','_SHOW_CODE','CFG_VIEW_STATUS','CFG_SIMPLE_WEB_SERVICE','_SHOW_TREE','_PUBLISH_SKOS','CFG_ENABLE_SPARQL','COPY_CLICK'), array(LABEL__USE_CODE,LABEL__SHOW_CODE,LABEL_CFG_VIEW_STATUS,LABEL_CFG_SIMPLE_WEB_SERVICE,LABEL__SHOW_TREE,LABEL__PUBLISH_SKOS,LABEL__ENABLE_SPARQL,LABEL__ENABLE_COPY_CLICK), $key)).'</span></div>';
  1552. $rows.='</div>';
  1553. }
  1554. }
  1555. return $rows;
  1556. }
  1557. function HTMLformImport()
  1558. {
  1559. $LABEL_importTab=ucfirst(LABEL_importTab);
  1560. $LABEL_importTag=ucfirst(LABEL_importTag);
  1561. $LABEL_importSkos=ucfirst(LABEL_importSkos);
  1562. $rows.='<form enctype="multipart/form-data" role="form" method="post" action="admin.php?doAdmin=import">';
  1563. $rows.=' <div class="row">
  1564. <div class="col-sm-12">
  1565. <legend>'.ucfirst(IMPORT_form_legend).'</legend>
  1566. </div>
  1567. <!-- panel -->
  1568. <div class="col-lg-7">
  1569. <div class="panel panel-default">
  1570. <div class="panel-body form-horizontal">';
  1571. $rows.=' <div class="form-group">
  1572. <label for="simpleReport" class="col-sm-3 control-label">'.ucfirst(FORM_LABEL_format_import).'</label>
  1573. <div class="col-sm-9">
  1574. <select class="form-control" id="taskAdmin" name="taskAdmin">
  1575. '.doSelectForm(array("importTab#$LABEL_importTab","importTag#$LABEL_importTag","importSkos#$LABEL_importSkos","importXML#MARC 21 XML Schema (MarcXML)"), $_POST["doAdmin"]).'
  1576. </select>
  1577. </div>
  1578. </div>';
  1579. $rows.='<div class="form-group">
  1580. <label for="reclave" class="col-sm-3 control-label">'.ucfirst(IMPORT_form_label).'</label>
  1581. <div class="col-sm-9">
  1582. <input placeholder="'.LABEL_repass.'"
  1583. class="form-control"
  1584. type="file"
  1585. id="file"
  1586. name="file">
  1587. <div class="help-block with-errors"></div>
  1588. </div>
  1589. </div>';
  1590. $rows.='<div class="form-group">
  1591. <div class="col-sm-12 text-right">
  1592. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Guardar).'"/>
  1593. </div>
  1594. </div>';
  1595. $rows.=' </div>
  1596. </div>
  1597. </div>
  1598. </div> <!-- / panel -->';
  1599. $rows.='<input type="hidden" name="doAdmin" id="taskterm" value="import"/>';
  1600. $rows.='<input type="hidden" name="doAdmin" id="sendfile" value="Ok"/>';
  1601. $rows.='</form>';
  1602. $rows.='<p>'.ucfirst(LABEL_importTab).':<pre>
  1603. South America
  1604. Argentina
  1605. Buenos Aires = Bs As
  1606. Brazil
  1607. Uruguay</pre></p>';
  1608. $rows.='<p>'.ucfirst(LABEL_importTag).':<pre>
  1609. South America
  1610. BT: America
  1611. NT: Argentina
  1612. UF: South-america
  1613. RT: Latin America</pre></p>';
  1614. $rows.='<p>'.ucfirst(LABEL_importSkos).': <a href="http://www.w3.org/TR/skos-reference/" title="SKOS Simple Knowledge Organization System">http://www.w3.org/TR/skos-reference/</a></p>';
  1615. return $rows;
  1616. }
  1617. function HTMLformURI4term($ARRAYtermino)
  1618. {
  1619. //SEND_KEY to prevent duplicated
  1620. session_start();
  1621. $_SESSION['SEND_KEY']=md5(uniqid(rand(), true));
  1622. $SQLURIdefinition=SQLURIdefinition();
  1623. if (SQLcount($SQLURIdefinition)>0) {
  1624. while ($ARRAYURIdefinition=$SQLURIdefinition->FetchRow()) {
  1625. $arraySelectURItype[]=$ARRAYURIdefinition["uri_type_id"].'#'.$ARRAYURIdefinition["uri_value"];
  1626. if ($ARRAYURIdefinition["uri_value"]=='exactMatch') {
  1627. $value_default= $ARRAYURIdefinition["uri_type_id"];
  1628. }
  1629. }
  1630. $rows.='<div class="container" id="bodyText">';
  1631. $rows.='<a class="topOfPage" href="'.URL_BASE.'index.php?tema='.$ARRAYtermino["idTema"].'" title="'.LABEL_Anterior.'">'.LABEL_Anterior.'</a>';
  1632. $rows.='<form class="" role="form" name="altaURI" id="altaURI" action="index.php" method="post">';
  1633. $rows.=' <div class="row">
  1634. <div class="col-sm-12">
  1635. <legend>'.ucfirst(LABEL_URIEditor).' '.HTMLlinkTerm(array("tema_id"=>$ARRAYtermino["idTema"],"tema"=>$ARRAYtermino["titTema"])).'</legend>
  1636. </div>
  1637. <!-- panel -->
  1638. <div class="col-lg-7">
  1639. <div class="panel panel-default">
  1640. <div class="panel-body form-horizontal">
  1641. <div class="form-group">
  1642. <label for="uri_type_id" class="col-sm-3 control-label accesskey="u">'.ucfirst(LABEL_URItype).'</label>
  1643. <div class="col-sm-9">
  1644. <select class="form-control" id="uri_type_id" name="uri_type_id">
  1645. '.doSelectForm($arraySelectURItype, $value_default).'
  1646. </select>
  1647. </div>
  1648. </div>
  1649. <div class="form-group">
  1650. <label for="uri" class="col-sm-3 control-label">'.ucfirst(LABEL_URI2termURL).'</label>
  1651. <div class="col-sm-9">
  1652. <input type="text" class="form-control" type="url" required autofocus id="uri" name="uri"/>
  1653. </div>
  1654. </div>
  1655. </div>
  1656. <div class="form-group">
  1657. <div class="col-sm-12 text-right">
  1658. <button type="submit" class="btn btn-primary" value="'.LABEL_Enviar.'"/>'.ucfirst(LABEL_Enviar).'</button>
  1659. <button type="button" class="btn btn" name="cancelar" type="button" onClick="location.href=\'index.php?tema='.$ARRAYtermino["idTema"].'\'" value="'.ucfirst(LABEL_Cancelar).'"/>'.ucfirst(LABEL_Cancelar).'</button>
  1660. </div>
  1661. </div>
  1662. </div>
  1663. </div>
  1664. </div> <!-- / panel -->';
  1665. $rows.='<input type="hidden" name="ks" id="ks" value="'.$_SESSION["SEND_KEY"].'"/>';
  1666. $rows.='<input type="hidden" name="tema_id" value="'.$ARRAYtermino["idTema"].'" />';
  1667. $rows.='<input type="hidden" name="taskURI" value="addURI" />';
  1668. $rows.='</form>';
  1669. }
  1670. $rows.='</div>';
  1671. return $rows;
  1672. }
  1673. function HTMLconfirmDeleteTerm($ARRAYtermino)
  1674. {
  1675. $rows.='<form class="form-inline" role="form" name="deleteTerm" action="index.php" method="post">';
  1676. $rows.=' <fieldset id="borrart" style="display:none;">';
  1677. $rows.=' <legend>'.ucfirst(MENU_BorrarT).'</legend>';
  1678. $rows.= '<p class="alert alert-danger" role="alert">'.sprintf(MSG__warningDeleteTerm, $ARRAYtermino["titTema"]).'</p>';
  1679. $rows.= '<p class="alert alert-warning" role="alert">'.MSG__warningDeleteTerm2row.'</p>';
  1680. $rows.='<div class="submit_form" align="center" role="group">';
  1681. $rows.='<button type="submit" class="btn btn-danger" name="boton" value="'.ucfirst(MENU_BorrarT).'">'.ucfirst(MENU_BorrarT).'</button>';
  1682. $rows.=' <button type="button" class="btn btn-default" name="cancelar" onClick="javascript:expandLink(\'borrart\')" value="'.ucfirst(LABEL_Cancelar).'">'.ucfirst(LABEL_Cancelar).'</button>';
  1683. $rows.='</div>';
  1684. $rows.='<input type="hidden" name="tema_id" value="'.$ARRAYtermino["tema_id"].'" />';
  1685. $rows.='<input type="hidden" name="task" value="remterm" />';
  1686. $rows.=' </fieldset>';
  1687. $rows.='</form>';
  1688. return $rows;
  1689. }
  1690. function HTMLformMasiveDelete()
  1691. {
  1692. $rows.='<form class="" role="form" name="massive_delete" action="admin.php" method="post">';
  1693. $rows.=' <div class="row">
  1694. <div class="col-sm-12">
  1695. <legend>'.ucfirst(MENU_massiverem).'</legend>
  1696. </div>
  1697. <!-- panel -->
  1698. <div class="col-lg-7">
  1699. <p class="alert alert-danger" role="alert">'.LABEL_warningMassiverem.'.</p>
  1700. <div class="panel panel-default">
  1701. <div class="panel-body form-horizontal">';
  1702. $rows.='<div class="form-group">';
  1703. $rows.='<input type="checkbox" name="massrem_teqterms" id="massrem_teqterms" value="1" alt="'.ucfirst(LABEL_target_terms).'" /> ';
  1704. $rows.='<div class="col-sm-4"><label for="massrem_teqterms">'.ucfirst(LABEL_target_terms).'</label></div>';
  1705. $rows.='</div>';
  1706. $rows.='<div class="form-group">';
  1707. $rows.='<input type="checkbox" name="massrem_url" id="massrem_url" value="1" alt="'.ucfirst(LABEL_URI2terms).'" /> ';
  1708. $rows.='<div class="col-sm-4"><label for="massrem_url">'.ucfirst(LABEL_URI2terms).'</label></div>';
  1709. $rows.='</div>';
  1710. $rows.='<div class="form-group">';
  1711. $rows.='<input type="checkbox" name="massrem_notes" id="massrem_notes" value="1" alt="'.ucfirst(LABEL_notes).'" /> ';
  1712. $rows.='<div class="col-sm-4"><label for="massrem_notes">'.ucfirst(LABEL_notes).'</label></div>';
  1713. $rows.='</div>';
  1714. $rows.='<div class="form-group">';
  1715. $rows.='<input class="checkall" type="checkbox" name="massrem_terms" id="massrem_terms" value="1" alt="'.ucfirst(LABEL_Terminos).'" /> ';
  1716. $rows.='<div class="col-sm-4"><label for="massrem_terms">'.ucfirst(LABEL_Terminos).'</label></div>';
  1717. $rows.='</div>';
  1718. $rows.='<div class="form-group">
  1719. <div class="col-sm-12 text-center">
  1720. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Enviar).'"/>
  1721. <a href="'.URL_BASE.'index.php" class="btn btn-default" id="boton_cancelar" title="'.ucfirst(LABEL_Cancelar).'">'.ucfirst(LABEL_Cancelar).'</a>
  1722. </div>
  1723. </div>';
  1724. $rows.=' </div>
  1725. </div>
  1726. </div>';
  1727. $rows.='</div> <!-- / panel -->';
  1728. $rows.='<input type="hidden" name="doAdmin" id="doAdmin" value="massrem"/>';
  1729. $rows.='</form>';
  1730. return $rows;
  1731. }
  1732. function HTMLformUpdateEndpoit()
  1733. {
  1734. $ARRAYlastUpdateEndpoint=fetchlastUpdateEndpoint();
  1735. $msg_update=($ARRAYlastUpdateEndpoint["value"]) ? '<br/>'.MSG__dateUpdatedEndpoint.': '.$ARRAYlastUpdateEndpoint["value"].'.' : '';
  1736. $rows.='<form class="" role="form" name="updateEndpoint" action="admin.php" method="post">';
  1737. $rows.=' <div class="row">
  1738. <div class="col-sm-12">
  1739. <legend>'.ucfirst(LABEL_updateEndpoint).'</legend>
  1740. </div>
  1741. <!-- panel -->
  1742. <div class="col-lg-7">
  1743. <p class="alert alert-warning" role="alert">'.MSG__updateEndpoint.' '.$msg_update.'</p>
  1744. <div class="panel panel-default">
  1745. <div class="panel-body form-horizontal">';
  1746. $rows.='<div class="form-group">
  1747. <div class="col-sm-12 text-center">
  1748. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_actualizar).'"/>
  1749. <a href="'.URL_BASE.'index.php" class="btn btn-default" id="boton_cancelar" title="'.ucfirst(LABEL_Cancelar).'">'.ucfirst(LABEL_Cancelar).'</a>
  1750. </div>
  1751. </div>';
  1752. $rows.=' </div>
  1753. </div>
  1754. </div>';
  1755. $rows.='</div> <!-- / panel -->';
  1756. $rows.='<input type="hidden" name="doAdmin" id="doAdmin" value="updateEndpointNow"/>';
  1757. $rows.='</form>';
  1758. return $rows;
  1759. }
  1760. function HTMLformLogin($task_result)
  1761. {
  1762. $rows='';
  1763. if (is_array($task_result)) {
  1764. $rows='<div>'.$task_result["msg"].'</div>';
  1765. }
  1766. $rows.=' <form class="form-horizontal form-signin" role="form" id="mylogin" name="mylogin" action="login.php" method="post">';
  1767. $rows.='<h2 class="form-signin-heading">'.ucfirst(LABEL_login).'</h2>';
  1768. $rows.='<div class="form-group"><label class="sr-only" for="mail" accesskey="u">'.ucfirst(LABEL_mail).'</label>';
  1769. $rows.='<input type="email" class="form-control" name="id_correo_electronico" placeholder="'.ucfirst(LABEL_mail).'" required autofocus id="mail" size="11"/>';
  1770. $rows.='</div>';
  1771. $rows.='<div class="form-group"><label for="id_password" class="sr-only" accesskey="p">'.ucfirst(LABEL_pass).'</label>';
  1772. $rows.='<input type="password" name="id_password" class="form-control" placeholder="'.ucfirst(LABEL_pass).'" required id="id_password" size="11"/>';
  1773. $rows.=' </div>';
  1774. $rows.='<div class="col-lg-offset-2 col-lg-10 style="margin-left:15em" align="center">';
  1775. $rows.='<input type="hidden" name="task" value="login" />';
  1776. $rows.='<button class="btn btn-lg btn-primary btn-block" type="submit">'.LABEL_Enviar.'</button>';
  1777. $rows.='</div>';
  1778. $rows.=' <div class="form-group">
  1779. <div class="row">
  1780. <div class="col-lg-12">
  1781. <div class="text-center">
  1782. <a href="login.php?task=recovery" tabindex="5" class="forgot-password" title="'.LABEL_user_lost_password.'">'.LABEL_user_lost_password.'</a>
  1783. </div>
  1784. </div>
  1785. </div>
  1786. </div> ';
  1787. $rows.='</form>';
  1788. return $rows;
  1789. }
  1790. function HTMLformRecoveryPassword($user_name = "")
  1791. {
  1792. $rows='<form class="form-horizontal" id="myRecovery" name="myRecovery" action="login.php" method="post">
  1793. <fieldset>
  1794. <legend>'.LABEL_user_recovery_password.'</legend>
  1795. <div class="form-group">
  1796. <label class="col-md-4 control-label" for="id_correo_electronico_recovery" >'.ucfirst(LABEL_mail).'</label>
  1797. <div class="col-md-4">
  1798. <input id="id_correo_electronico_recovery" name="id_correo_electronico_recovery" placeholder="'.ucfirst(LABEL_mail).'" class="form-control input-md" required="" type="email">
  1799. </div>
  1800. </div>
  1801. <div class="form-group">
  1802. <div class="col-md-8 text-center">
  1803. <button id="button1id" type="submit" name="button1id" class="btn btn-primary">'.LABEL_Enviar.'</button>
  1804. <a href="login.php" class="btn btn-inverse">'.ucfirst(LABEL_Cancelar).'</a>
  1805. </div>
  1806. </div>
  1807. <input type="hidden" name="task" value="user_recovery" />
  1808. </fieldset>
  1809. </form>';
  1810. return $rows;
  1811. }
  1812. //
  1813. // Vista de términos libres
  1814. //
  1815. function HTMLformVerTerminosLibres($taskterm = 'null', $freeTerms_id = array())
  1816. {
  1817. switch ($taskterm) {
  1818. case 'deleteFreeTerms':
  1819. if (count($freeTerms_id)==0) {
  1820. return HTMLformVerTerminosLibres();
  1821. }
  1822. $task=REMTerms($freeTerms_id, 1);
  1823. break;
  1824. case 'rejectFreeTerms':
  1825. if (count($freeTerms_id)==0) {
  1826. return HTMLformVerTerminosLibres();
  1827. }
  1828. $task=REJECTterms($freeTerms_id, 1);
  1829. break;
  1830. case 'makeMetaTermsFreeTerms':
  1831. if (count($freeTerms_id)==0) {
  1832. return HTMLformVerTerminosLibres();
  1833. }
  1834. $task=makeMetaTerms($freeTerms_id);
  1835. break;
  1836. default:
  1837. break;
  1838. }
  1839. $sql=SQLverTerminosLibres();
  1840. $rows.='<div>';
  1841. $rows.='<h3>'.ucfirst(LABEL_terminosLibres).' ('.SQLcount($sql).') </h3>';
  1842. if (is_array($task)) {
  1843. if ($task["error"]>0) {
  1844. $rows.='<p class="error">'.$task["error"].' '.MSG_termsErrorTask.' </p>';
  1845. } else {
  1846. $rows.='<p class="success">'.$task["success"].' '.MSG_termsSuccessTask.' </p>';
  1847. }
  1848. }
  1849. if (SQLcount($sql)>0) {
  1850. $rows.='<div><input id="filter" type="text" class="form-control" placeholder="'.ucfirst(LABEL_type2filter).'"></div>';
  1851. $rows.='<form role="form" id="delete_free_terms" name="delete_free_terms" action="index.php?verT=L" method="post">';
  1852. $rows.='<div class="table-responsive"> ';
  1853. $rows.='<table class="table table-striped table-bordered table-condensed table-hover">
  1854. <thead>
  1855. <tr>
  1856. <th></th>
  1857. <th>'.ucfirst(LABEL_Termino).'</th>
  1858. <th>'.ucfirst(LABEL_Fecha).'</th>
  1859. </tr>
  1860. </thead>
  1861. <tbody class="searchable">';
  1862. while ($array = $sql->FetchRow()) {
  1863. $alert_MT=($resulta_busca["isMetaTerm"]==1) ? ' ('.LABEL_meta_term.') ' : '';
  1864. $rows.= '<tr>';
  1865. $rows.= ' <td align="center"><input type="checkbox" name="deleteFreeTerms_id[]" id="freeTerm_'.$array["tema_id"].'" title="'.ucfirst(MENU_BorrarT).' '.$array["tema"].' " value="'.$array["tema_id"].'" /></td>';
  1866. $rows.= ' <td><label class="check_label" value="'.$value["tema_id"].' title="'.$value["tema"].' " for="freeTerm_'.$array["tema_id"].'">'.HTMLlinkTerm($array, array("modal"=>1)).'</label> '.$alert_MT.' </td>';
  1867. $rows.= ' <td>'.$array["cuando"].'</td>';
  1868. $rows.= ' </tr>';
  1869. };
  1870. $rows.=' </tbody> </table>';
  1871. $rows.=' </div>';
  1872. $rows.='<div class="submit_form" align="center">';
  1873. $rows.='<div class="col-md-4 control-label form-group">';
  1874. $rows.='<select class="form-control" id="massive_task_freeterms" name="massive_task_freeterms"><option>'.ucfirst(LABEL_withSelected).'</option>';
  1875. $rows.=doSelectForm(array('deleteFreeTerms#'.ucfirst(LABEL_eliminar),'rejectFreeTerms#'.ucfirst(LABEL_RechazarTermino),'makeMetaTermsFreeTerms#'.ucfirst(LABEL_turnOnMetaTerm),'assocfreeTerm#'.ucfirst(LABEL_associateFreeTerms)), "");
  1876. $rows.='</select>';
  1877. $rows.='</div>';
  1878. $rows.='<div class="col-md-12 control-label form-group">';
  1879. // $rows.=' <input type="hidden" id="taskterm" name="taskterm" value="deleteFreeTerms"/>';
  1880. $rows.=' <input type="hidden" id="taskterm" name="taskterm" value=""/>';
  1881. $rows.=' <button type="submit" class="btn btn-primary">'.LABEL_Enviar.'</button>';
  1882. $rows.='</div>';
  1883. $rows.='</div>';
  1884. $rows.='</form>';
  1885. }//if cant
  1886. $rows.='</div>';
  1887. return $rows;
  1888. };
  1889. //
  1890. // Vista de términos repetidos
  1891. //
  1892. function HTMLformVerTerminosRepetidos()
  1893. {
  1894. $sql=SQLverTerminosRepetidos();
  1895. $rows.='<div><h3>'.ucfirst(LABEL_terminosRepetidos).' ('.SQLcount($sql).') </h3>';
  1896. $rows.='<ul>';
  1897. if (SQLcount($sql)==0) {
  1898. $rows.='<li>'.ucfirst(MSG_noTerminosRepetidos).'</li>';
  1899. } else {
  1900. while ($array = $sql->FetchRow()) {
  1901. $i=++$i;
  1902. if ($string_term!==$array["string_term"]) {
  1903. if (!$i!==0) {
  1904. $rows.='</ul></li>';
  1905. }
  1906. $rows.='<li>'.$array["string_term"].' ('.$array["cant"].')<ul>';
  1907. }
  1908. $alert_MT=($resulta_busca["isMetaTerm"]==1) ? ' ('.LABEL_meta_term.') ' : '';
  1909. $rows.='<li>'.HTMLlinkTerm($array, array("modal"=>1)).' '.$alert_MT.' </li>';
  1910. $string_term=$array["string_term"];
  1911. }
  1912. $rows.='</ul></li>';
  1913. };
  1914. $rows.='</ul>';
  1915. $rows.='</div>';
  1916. return $rows;
  1917. };
  1918. //
  1919. // Vista de términos sin relaciones jer�rquicas // preferred and accepted terms without hierarchical relationships
  1920. //
  1921. function HTMLformVerTerminosSinBT($taskterm = 'null', $terms_id = array())
  1922. {
  1923. //borrado masivo de términos libres
  1924. if ($taskterm=='deleteTerms') {
  1925. $task=REMTerms($terms_id, 0);
  1926. }
  1927. //tesauro_id = 1;
  1928. $sql=SQLtermsNoBT(1);
  1929. $rows.='<div>';
  1930. $rows.='<h3>'.ucfirst(LABEL_termsNoBT).' ('.SQLcount($sql).') </h3>';
  1931. if (is_array($task)) {
  1932. if ($task["error"]>0) {
  1933. $rows.='<p class="error">'.$task["error"].' '.MSG_termsNoDeleted.' </p>';
  1934. } else {
  1935. $rows.='<p class="success">'.$task["success"].' '.MSG_termsDeleted.' </p>';
  1936. }
  1937. }
  1938. if (SQLcount($sql)>0) {
  1939. $rows.='<div><input id="filter" type="text" class="form-control" placeholder="'.ucfirst(LABEL_type2filter).'"></div>';
  1940. $rows.='<form role="form" id="delete_free_terms" name="delete_free_terms" action="index.php?verT=NBT" method="post">';
  1941. $rows.='<div class="table-responsive"> ';
  1942. $rows.='<table class="table table-striped table-bordered table-condensed table-hover">
  1943. <thead>
  1944. <tr>
  1945. <th></th>
  1946. <th>'.ucfirst(LABEL_Termino).'</th>
  1947. <th>'.ucfirst(LABEL_nonPreferedTerms).'</th>
  1948. <th>'.ucfirst(LABEL_relatedTerms).'</th>
  1949. </tr>
  1950. </thead>
  1951. <tbody class="searchable">';
  1952. while ($array = $sql->FetchRow()) {
  1953. $alert_MT=($array["isMetaTerm"]==1) ? ' ('.LABEL_meta_term.') ' : '';
  1954. $rows.= '<tr>';
  1955. $rows.= ' <td align="center"><input type="checkbox" name="deleteTerms_id[]" id="term_'.$array["tema_id"].'" title="'.ucfirst(MENU_BorrarT).' '.$array["tema"].' " value="'.$array["tema_id"].'" /></td>';
  1956. $rows.= ' <td><label class="check_label" title="'.$value["tema"].' " for="term_'.$array["tema_id"].'">'.HTMLlinkTerm($array, array("modal"=>1)).'</label> '.$alert_MT.' </td>';
  1957. $rows.= ' <td>'.$array["cant_UF"].'</td>';
  1958. $rows.= ' <td>'.$array["cant_RT"].'</td>';
  1959. $rows.= ' </tr>';
  1960. };
  1961. $rows.=' </tbody></table>';
  1962. $rows.='</div>';
  1963. $rows.= '<p class="warning">'.MSG__warningDeleteTerm2row.'</p>';
  1964. $rows.='<div class="submit_form" align="center">';
  1965. $rows.=' <input type="hidden" id="taskterm" name="taskterm" value="deleteTerms"/>';
  1966. $rows.=' <button type="submit" class="btn btn-danger">'.ucfirst(MENU_BorrarT).'</button>';
  1967. $rows.='</div>';
  1968. $rows.='</form>';
  1969. }//if cant
  1970. $rows.='</div>';
  1971. return $rows;
  1972. };
  1973. function HTMLalertNoTargetVocabulary()
  1974. {
  1975. if ($_SESSION[$_SESSION["CFGURL"]]["ssuser_nivel"]=='1') {
  1976. $help_msg='<a href="admin.php?tvocabulario_id=0&doAdmin=seeformTargetVocabulary" title="'.ucfirst(LABEL_addTargetVocabulary).'">'.ucfirst(LABEL_addTargetVocabulary).'</a>.';
  1977. } else {
  1978. $help_msg=ucfirst(MSG_contactAdmin).'.';
  1979. }
  1980. return '<p class="alert alert-danger" role="alert">'.ucfirst(LABEL_NO_vocabulario_referencia).'. '.$help_msg.'</p>';
  1981. }
  1982. function HTMLalertNoTargetVocabularyPivotModel()
  1983. {
  1984. if ($_SESSION[$_SESSION["CFGURL"]]["ssuser_nivel"]=='1') {
  1985. $help_msg='<a href="admin.php?vocabulario_id=0" title="'.ucfirst(LABEL_vocabulario_referencia).'">'.ucfirst(LABEL_vocabulario_referencia).'</a>.';
  1986. } else {
  1987. $help_msg=ucfirst(MSG_contactAdmin).'.';
  1988. }
  1989. return '<p class="alert alert-danger" role="alert">'.ucfirst(LABEL_NO_vocabulario_referencia).'. '.$help_msg.'</p>';
  1990. }
  1991. function HTMLAlertDuplicateTerm($arrayDuplicateTerms)
  1992. {
  1993. $rows='<h4>'.count($arrayDuplicateTerms).' '.LABEL__duplicatedTerms.'</h4>';
  1994. foreach ($arrayDuplicateTerms as $term_id => $term) {
  1995. $rows.='<p>'.$term.'</p>';
  1996. }
  1997. return $rows;
  1998. }
  1999. function HTMLformBulkReplace($params = array())
  2000. {
  2001. $rows.='<div class="row">';
  2002. $rows.=' <div class="col-md-6 col-md-offset-3">';
  2003. $rows.=' <h3>'.ucfirst(LABEL_bulkReplace).'</h3>';
  2004. $rows.='<form class="col-xs-8 form-horizontal" role="form" name="bulkReplace" action="admin.php?doAdmin=bulkReplace" method="post">';
  2005. $rows.='<fieldset>';
  2006. $LABEL_Termino=ucfirst(LABEL_Terminos);
  2007. $LABEL_NOTE=ucfirst(LABEL_notes);
  2008. $arrayWS=array("t#$LABEL_Termino");
  2009. $arrayVocabStats=ARRAYresumen($_SESSION["id_tesa"], "G", "");
  2010. if ($arrayVocabStats["cant_notas"]>0) {
  2011. array_push($arrayWS, "n#$LABEL_NOTE");
  2012. }
  2013. /*
  2014. solo si hay m�s de un opci�n
  2015. */
  2016. if (count($arrayWS)>1) {
  2017. $rows.='<div class="form-group"><label class="label_ttl control-label" for="ws" accesskey="f">'.ucfirst(LABEL_QueBuscar).'</label>';
  2018. $rows.='<select class="select_ttl form-control" id="ws" name="ws">';
  2019. $rows.=doSelectForm($arrayWS, "$_POST[ws]");
  2020. $rows.='</select>';
  2021. $rows.='</div>';
  2022. }
  2023. $rows.='<div class="form-group"><label class="label_ln control-label" for="search_string" accesskey="s">'.ucfirst(LABEL_searchFor).'</label>';
  2024. $rows.='<input name="search_string" class="input_ln form-control" placeholder="'.MSG_searchFor.'" required type="search" id="search_string" size="25" maxlength="50" value=""/>';
  2025. $rows.='</div>';
  2026. $rows.='<div class="form-group"><label class="label_ln control-label" for="replace_string" accesskey="r">'.ucfirst(LABEL_replaceWith).'</label>';
  2027. $rows.='<input name="replace_string" class="input_ln form-control" placeholder="'.MSG_replaceWith.'" id="replace_string" size="25" maxlength="50" value=""/>';
  2028. $rows.='</div>';
  2029. $rows.='<div class="text-center">';
  2030. $rows.='<input type="submit" class="btn btn-primary" role="button" name="boton" value="'.ucfirst(LABEL_Preview).'"/>';
  2031. $rows.=' <input type="button" class="btn btn-default" role="button" name="cancelar" type="button" onClick="location.href=\'index.php\'" value="'.ucfirst(LABEL_Cancelar).'"/>';
  2032. $rows.='</div>';
  2033. $rows.='<input type="hidden" name="taskAdmin" id="taskAdmin" value="bulkReplace"/>';
  2034. $rows.='<input type="hidden" name="replaceStep" id="replaceStep" value="bulkReplaceTest"/>';
  2035. $rows.='<input type="hidden" name="doAdmin" id="doAdmin" value="bulkReplace"/>';
  2036. $rows.=' </fieldset>';
  2037. $rows.='</form>';
  2038. $rows.='</div>';//div row
  2039. $rows.='</div>';//div col
  2040. $rows.='<div class="push"></div>';
  2041. if ($params["taskAdmin"]=='bulkReplace') {
  2042. $rows.=($params["ws"]=='t') ? HTMLbulkReplaceResultsTerms($params) : HTMLbulkReplaceResultsNotes($params);
  2043. }
  2044. return $rows;
  2045. }
  2046. function HTMLbulkReplaceResultsTerms($params)
  2047. {
  2048. $search_string=XSSprevent($params["search_string"]);
  2049. $replace_string=XSSprevent($params["replace_string"]);
  2050. if ($params["replaceStep"]=='bulkReplaceTest') {
  2051. $label=ucfirst(LABEL_bulkTermsWillReplace);
  2052. $sql=SQLbulkReplaceTermTest($search_string, $replace_string, $search_string);
  2053. $cantTermsAffected=SQLcount($sql);
  2054. } else {
  2055. $label=ucfirst(LABEL_bulkTermsReplaced);
  2056. $sql=SQLbulkReplaceTerm($search_string, $replace_string, $search_string, $params["blkmod_id"]);
  2057. $cantTermsAffected=$sql["cant"];
  2058. }
  2059. $rows='<h3><i>'.$search_string.'</i> X <i>'.$replace_string.'</i>: '.$cantTermsAffected.' '.$label.'</h3>';
  2060. if (($cantTermsAffected>0) && ($params["replaceStep"]=='bulkReplaceTest')) {
  2061. $rows.='<form class="form-inline" role="form" name="confirmBulkReplace" action="admin.php?doAdmin=bulkReplace" method="post">';
  2062. $rows.=' <fieldset id="bulkReplaceDiv">';
  2063. $rows.= '<p class="alert alert-warning" role="alert">'.LABEL_warningBulkEditor.'</p>';
  2064. $rows.='<div class="table-responsive"> ';
  2065. $rows.='<table class="table table-striped table-bordered table-condensed table-hover"">';
  2066. $rows.='<thead><tr>';
  2067. $rows.='<th><input name="checktodos" type="checkbox" title="'.LABEL_selectAll.'"/></th>
  2068. <th>'.ucfirst(LABEL_termMOD).'</th><th>'.ucfirst(LABEL_Termino).'</th></tr>
  2069. </thead><tbody>';
  2070. while ($result=$sql->FetchRow()) {
  2071. $text = (strlen($replace_string)>0) ? preg_replace("|($replace_string)|", "<mark>".$replace_string."</mark>", $result["tema_mod"]) : $result["tema_mod"];
  2072. $alert_MT=($result["isMetaTerm"]==1) ? ' ('.LABEL_meta_term.') ' : '';
  2073. $rows.= '<tr>';
  2074. $rows.= ' <td align="center"><input type="checkbox" name="blkmod_id[]" id="blkmod_id'.$result["tema_id"].'" title="'.LABEL_seleccionar.'" value="'.$result["tema_id"].'" checked/></td>';
  2075. $rows.= ' <td><label for="blkmod_id'.$result["tema_id"].'" '.$css_class_MT.'>'.$text.'</label> </td>';
  2076. $rows.= ' <td>'.HTMLlinkTerm($result, array("modal"=>1)).' '.$alert_MT.' </td>';
  2077. $rows.= ' </tr>';
  2078. }
  2079. $rows.=' </tbody>';
  2080. $rows.='<tfoot> <tr><td colspan=3>';
  2081. $rows.= '</td></tr></tfoot></table></div>';
  2082. $rows.='<div class="submit_form" align="center" role="group">';
  2083. $rows.='<button type="submit" class="btn btn-danger" name="boton" value="'.ucfirst(LABEL_Enviar).'">'.ucfirst(LABEL_Enviar).'</button>';
  2084. $rows.=' <input type="button" class="btn btn-default" role="button" name="cancelar" type="button" onClick="location.href=\'index.php\'" value="'.ucfirst(LABEL_Cancelar).'"/>';
  2085. $rows.='</div>';
  2086. $rows.='<input type="hidden" name="replaceStep" id="replaceStep" value="bulkReplaceConfirm"/>';
  2087. $rows.='<input type="hidden" name="search_string" id="search_string" value="'.$search_string.'"/>';
  2088. $rows.='<input type="hidden" name="replace_string" id="replace_string" value="'.$replace_string.'"/>';
  2089. $rows.='<input type="hidden" name="taskAdmin" id="taskAdmin" value="bulkReplace"/>';
  2090. $rows.='<input type="hidden" name="ws" id="ws" value="'.$params["ws"].'"/>';
  2091. $rows.='<input type="hidden" name="doAdmin" id="doAdmin" value="bulkReplace"/>';
  2092. $rows.=' </fieldset>';
  2093. $rows.='</form>';
  2094. }
  2095. return $rows;
  2096. }
  2097. function HTMLbulkReplaceResultsNotes($params)
  2098. {
  2099. $search_string=XSSprevent($params["search_string"]);
  2100. $replace_string=XSSprevent($params["replace_string"]);
  2101. if ($params["replaceStep"]=='bulkReplaceTest') {
  2102. $label=ucfirst(LABEL_bulkNotesWillReplace);
  2103. $sql=SQLbulkReplaceNoteTest($search_string, $replace_string, $search_string);
  2104. $cantTermsAffected=SQLcount($sql);
  2105. } else {
  2106. $label=ucfirst(LABEL_bulkNotesReplaced);
  2107. $sql=SQLbulkReplaceNote($search_string, $replace_string, $search_string, $params["blkmod_id"]);
  2108. $cantTermsAffected=$sql["cant"];
  2109. }
  2110. $rows='<h3><i>'.$search_string.'</i> X <i>'.$replace_string.'</i>: '.$cantTermsAffected.' '.$label.'</h3>';
  2111. if (($cantTermsAffected>0) && ($params["replaceStep"]=='bulkReplaceTest')) {
  2112. $rows.='<form class="form-inline" role="form" name="confirmBulkReplace" action="admin.php?doAdmin=bulkReplace" method="post">';
  2113. $rows.=' <fieldset id="bulkReplaceDiv">';
  2114. $rows.= '<p class="alert alert-warning" role="alert">'.LABEL_warningBulkEditor.'</p>';
  2115. $rows.='<div class="table-responsive"> ';
  2116. $rows.='<table class="table table-striped table-bordered table-condensed table-hover"">';
  2117. $rows.='<thead><tr>';
  2118. $rows.='<th><input name="checktodos" type="checkbox" title="'.LABEL_selectAll.'"/></th>
  2119. <th>'.ucfirst(LABEL_noteMOD).'</th><th>'.ucfirst(LABEL_Termino).'</th></tr>
  2120. </thead><tbody>';
  2121. while ($result=$sql->FetchRow()) {
  2122. $text = (strlen($replace_string)>0) ? preg_replace("|($replace_string)|", "<mark>".$replace_string."</mark>", $result["nota_mod"]): $result["nota_mod"];
  2123. $rows.= '<tr>';
  2124. $rows.= ' <td align="center"><input type="checkbox" name="blkmod_id[]" id="blkmod_id'.$result["nota_id"].'" title="'.LABEL_seleccionar.'" value="'.$result["nota_id"].'" checked/></td>';
  2125. $rows.= ' <td><label for="blkmod_id'.$result["nota_id"].'">'.$text.'</label></td>';
  2126. $rows.= ' <td>'.HTMLlinkTerm($result, array("modal"=>1)).'</td>';
  2127. $rows.= ' </tr>';
  2128. }
  2129. $rows.=' </tbody>';
  2130. $rows.='<tfoot> <tr><td colspan=3>';
  2131. $rows.= '</td></tr></tfoot></table></div>';
  2132. $rows.='<div class="submit_form" align="center" role="group">';
  2133. $rows.='<button type="submit" class="btn btn-danger" name="boton" value="'.ucfirst(LABEL_Enviar).'">'.ucfirst(LABEL_Enviar).'</button>';
  2134. $rows.=' <button type="button" class="btn btn-default" name="cancelar" onClick="\'index.php\')" value="'.ucfirst(LABEL_Cancelar).'">'.ucfirst(LABEL_Cancelar).'</button>';
  2135. $rows.='</div>';
  2136. $rows.='<input type="hidden" name="replaceStep" id="replaceStep" value="bulkReplaceConfirm"/>';
  2137. $rows.='<input type="hidden" name="search_string" id="search_string" value="'.$search_string.'"/>';
  2138. $rows.='<input type="hidden" name="replace_string" id="replace_string" value="'.$replace_string.'"/>';
  2139. $rows.='<input type="hidden" name="taskAdmin" id="taskAdmin" value="bulkReplace"/>';
  2140. $rows.='<input type="hidden" name="ws" id="ws" value="'.$params["ws"].'"/>';
  2141. $rows.='<input type="hidden" name="doAdmin" id="doAdmin" value="bulkReplace"/>';
  2142. $rows.=' </fieldset>';
  2143. $rows.='</form>';
  2144. }
  2145. return $rows;
  2146. }
  2147. function HTMLformExportGlossary()
  2148. {
  2149. global $CFG;
  2150. $rows.='<form class="" role="form" name="configGlossary" id="configGlossary" action="xml.php" method="get">';
  2151. $rows.=' <div class="row">
  2152. <div class="col-sm-12">
  2153. <legend>'.ucfirst(LABEL_configGlossary).'</legend>
  2154. </div>
  2155. <!-- panel -->
  2156. <div class="col-lg-7">
  2157. <div class="panel panel-default">
  2158. <div class="panel-body form-horizontal"><div class="panel-heading">'.ucfirst(MSG_includeNotes).'</div>';
  2159. $sqlNoteType=SQLcantNotas();
  2160. while ($ARRAYnoteType=$sqlNoteType->FetchRow()) {
  2161. $i_note=++$i_note;
  2162. if ($ARRAYnoteType["cant"]>0) {
  2163. $rows.='<div class="form-group">
  2164. <div class="col-sm-4">
  2165. <label for="note4gloss'.$ARRAYnoteType["value_id"].'">'.$ARRAYnoteType["value"].' ('.$ARRAYnoteType["cant"].')</label>
  2166. </div>
  2167. <div class="col-sm-2">
  2168. <input name="note4gloss[]" type="checkbox" id="note4gloss'.$ARRAYnoteType["value_id"].'" value="'.$ARRAYnoteType["tipo_nota"].'" />
  2169. </div>
  2170. </div>';
  2171. }
  2172. }
  2173. $rows.='<div class="form-group alert alert-info">
  2174. <div class="col-sm-4" >
  2175. <label for="includeAltLabel">'.ucfirst(MSG__GLOSSincludeAltLabel).'</label>
  2176. </div>
  2177. <div class="col-sm-2">
  2178. <input name="includeAltLabel" type="checkbox" id="includeAltLabel" value="1" />
  2179. </div>
  2180. </div>';
  2181. $rows.='<div class="form-group">
  2182. <div class="col-sm-12 text-center">
  2183. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Guardar).'"/>
  2184. </div>
  2185. </div>';
  2186. $rows.='<div class="col-sm-12 panel panel-default"><div class="panel-body">'.ucfirst(MSG__GLOSSdocumentationJSON).'</div></div>';
  2187. $rows.=' </div>
  2188. </div>
  2189. </div>
  2190. </div> <!-- / panel -->';
  2191. $rows.='<input type="hidden" name="dis" id="dis" value="jglossary"/>';
  2192. $rows.='<input type="hidden" name="task" id="task" value="exportGlossary"/>';
  2193. $rows.='</form>';
  2194. return $rows;
  2195. }
  2196. function HTMLformExport()
  2197. {
  2198. $LABEL_jtxt=MENU_ListaSis.' (txt)';
  2199. $LABEL_abctxt=MENU_ListaAbc.' (txt)';
  2200. $rows.='<form class="" role="form" name="export" action="xml.php" method="get">';
  2201. $rows.='<div class="row">
  2202. <div class="col-sm-12">
  2203. <legend>'.ucfirst(LABEL_Admin).'</legend>
  2204. </div>
  2205. <!-- panel -->
  2206. <div class="col-lg-7">
  2207. <h4>'.ucfirst(LABEL_export).'</h4>
  2208. <div class="panel panel-default">
  2209. <div class="panel-body form-horizontal">';
  2210. $rows.='<div class="form-group"><label class="col-sm-3 control-label" for="report_tvocab_id" accesskey="t">'.ucfirst(FORM_LABEL_format_export).'</label>';
  2211. $rows.=' <div class="col-sm-9">';
  2212. $rows.='<select class="form-control" id="dis" name="dis">';
  2213. $rows.=doSelectForm(array("jtxt#$LABEL_jtxt","txt#$LABEL_abctxt",'spdf#'.LABEL_SystPDF,'rpdf#'.LABEL_AlphaPDF,"moodfile#Moodle","zline#Zthes","rfile#Skos-Core","rxtm#TopicMap","BSfile#BS8723","madsFile#Metadata Authority Description Schema (MADS)","marc#MARC 21 XML Schema (MarcXML)","vfile#IMS Vocabulary Definition Exchange (VDEX)","wxr#WXR (Wordpress XML)","siteMap#SiteMap","rsql#SQL (Backup)"), $_GET["dis"]);
  2214. $rows.='</select>';
  2215. $rows.=' </div>'; // col-sm
  2216. $rows.='</div>'; // form group
  2217. $rows.='<div style="display:none;" id="skos_config">';
  2218. $sqlTopTerm=SQLverTopTerm();
  2219. if (SQLcount($sqlTopTerm)>0) {
  2220. while ($arrayTopTerms=$sqlTopTerm->FetchRow()) {
  2221. $formSelectTopTerms[]=$arrayTopTerms["tema_id"].'#'.$arrayTopTerms["tema"];
  2222. }
  2223. $rows.='<div class="form-group">
  2224. <label class="col-sm-3 control-label" for="hasTopTermSKOS" accesskey="t">'.ucfirst(LABEL_TopTerm).'</label>';
  2225. $rows.=' <div class="col-sm-9">';
  2226. $rows.='<select class="form-control" id="hasTopTermSKOS" name="hasTopTermSKOS">';
  2227. $rows.='<option value="">'.ucfirst(LABEL_Todos).'</option>';
  2228. $rows.=doSelectForm($formSelectTopTerms, $_GET["hasTopTermSKOS"]);
  2229. $rows.='</select>';
  2230. $rows.=' </div>'; // col-sm
  2231. $rows.='</div>'; // form group
  2232. }
  2233. $rows.='</div>';
  2234. $rows.='<div style="display:none;" id="txt_config">';
  2235. $arrayVocabStats=ARRAYresumen($_SESSION["id_tesa"], "G", "");
  2236. if (SQLcount($sqlTopTerm)>0) {
  2237. $rows.='<div class="form-group">
  2238. <label class="col-sm-3 control-label" for="hasTopTerm" accesskey="t">'.ucfirst(LABEL_TopTerm).'</label>';
  2239. $rows.='<div class="col-sm-9">';
  2240. $rows.='<select class="form-control" id="hasTopTerm" name="hasTopTerm">';
  2241. $rows.='<option value="">'.ucfirst(LABEL_Todos).'</option>';
  2242. $rows.=doSelectForm($formSelectTopTerms, $_GET["hasTopTerm"]);
  2243. $rows.='</select>';
  2244. $rows.=' </div>'; // col-sm
  2245. $rows.='</div>'; // form group
  2246. }
  2247. $rows.='</div>';// invisible
  2248. $rows.='<div style="display:none;" id="txt_config2"> <fieldset> <legend>'.ucfirst(LABEL_include_data).'</legend>';
  2249. //Evaluar si hay notas
  2250. if (is_array($arrayVocabStats["cant_notas"])) {
  2251. $LabelNB=array('NB',LABEL_NB);
  2252. $LabelNH=array('NH',LABEL_NH);
  2253. $LabelNA=array('NA',LABEL_NA);
  2254. $LabelNP=array('NP',LABEL_NP);
  2255. $LabelNC=array('NC',LABEL_NC);
  2256. $sqlNoteType=SQLcantNotas();
  2257. $arrayNoteType=array();
  2258. while ($arrayNotes=$sqlNoteType->FetchRow()) {
  2259. if ($arrayNotes["cant"]>0) {
  2260. //nota privada no
  2261. if ($arrayNotes["value_id"]!=='11') {
  2262. $varNoteType=(in_array($arrayNotes["value_id"], array(8,9,10,11,15))) ? arrayReplace(array(8,9,10,11,15), array($LabelNA[1],$LabelNH[1],$LabelNB[1],$LabelNP[1],$LabelNC[1]), $arrayNotes["value_id"]) : $arrayNotes["value"];
  2263. $varNoteTypeCode=(in_array($arrayNotes["value_id"], array(8,9,10,11,15))) ? arrayReplace(array(8,9,10,11,15), array($LabelNA[0],$LabelNH[0],$LabelNB[0],$LabelNP[0],$LabelNC[0]), $arrayNotes["value_id"]) : $arrayNotes["value_code"];
  2264. $rows_notes.='<div class="form-group">
  2265. <div class="col-sm-4"><label for="includeNote'.$arrayNotes["value_id"].'" accesskey="d">'.ucfirst($varNoteType).'</label></div>';
  2266. $rows_notes.='<input name="includeNote[]" type="checkbox" id="includeNote'.$arrayNotes["value_id"].'" value="'.$varNoteTypeCode.'" />';
  2267. $rows_notes.='</div>';
  2268. }
  2269. }
  2270. };
  2271. $rows.='<div class="form-group">
  2272. <div class="col-sm-4"><label for="includeTopTerm" accesskey="t">'.ucfirst(TT_terminos).'</label></div>';
  2273. $rows.='<input name="includeTopTerm" type="checkbox" id="includeTopTerm" value="1" />';
  2274. $rows.='</div>';
  2275. /* Si hay m�s de un tipo de nota */
  2276. if (count($arrayVocabStats["cant_notas"])>0) {
  2277. $rows.=$rows_notes;
  2278. }
  2279. }
  2280. $rows.='<div class="form-group">
  2281. <div class="col-sm-4"><label for="includeCreatedDate" accesskey="d">'.ucfirst(LABEL_Fecha).'</label></div>';
  2282. $rows.='<input name="includeCreatedDate" type="checkbox" id="includeCreatedDate" value="1" />';
  2283. $rows.='</div>';
  2284. $rows.='<div class="form-group">
  2285. <div class="col-sm-4"><label for="includeModDate" accesskey="m">'.ucfirst(LABEL_lastChangeDate).'</label></div>';
  2286. $rows.='<input name="includeModDate" type="checkbox" id="includeModDate" value="1" />';
  2287. $rows.=' </div>';
  2288. $rows.='</div>';// invisible
  2289. $rows.='<div class="form-group">
  2290. <div class="text-center">
  2291. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Guardar).'"/>
  2292. </div>
  2293. </div>';
  2294. $rows.=' </div> <!--panel-body form-horizontal-->
  2295. </div> <!--panel panel-default -->
  2296. </div> <!--class="col-lg-7" -->
  2297. </div> <!-- / panel -->';
  2298. $rows.='</form>';
  2299. return $rows;
  2300. };
  2301. // Form for config bulk replace to auto-gloss
  2302. function HTMLbulkGlossTerms($params)
  2303. {
  2304. global $CFG;
  2305. $params["replaceType"]=($params["replaceType"]!==0) ? 1 : $params["replaceType"];
  2306. $params["note4gloss"]=($params["note4gloss"]) ? $params["note4gloss"] : $_SESSION[$_SESSION["CFGURL"]]["_GLOSS_NOTES"];
  2307. if ($params["makeAutoGloss"]==1) {
  2308. SQLnoteshtml2chars();
  2309. $sql=SQLreportTerminosPreferidos();
  2310. $i_replace=0;
  2311. while ($result=$sql->FetchRow()) {
  2312. $search_string=' '.$result["tema"].' ';
  2313. $replace_string=' [['.$result["tema"].']] ';
  2314. $sql2=SQLbulkGlossNote($search_string, $replace_string, $search_string, $params["note4gloss"], $result["id"]);
  2315. if ($sql2["cant"]>0) {
  2316. $i_replace=++$i_replace;
  2317. $arrayLog[$result["id"]]=$sql2["cant"];
  2318. $rowsLog.='<tr><td><a href="'.URL_BASE.'index.php?tema='.$result["id"].'" title="'.$result["id"].'">'.$result["tema"].'</a></td><td>'.$sql2["cant"].'</td></tr>';
  2319. }
  2320. }
  2321. SQLfixDobleChar4Notes($params["note4gloss"], "[[", "[[[[");
  2322. SQLfixDobleChar4Notes($params["note4gloss"], "]]", "]]]]");
  2323. $rowsResult='<div class="panel-body"><h4>'.ucfirst(MSG_cantTermsFound).': '.$i_replace.'</h4>';
  2324. if ($i_replace>0) {
  2325. $rowsResult.='<div class="table-responsive"> ';
  2326. $rowsResult.='<table class="table table-striped table-bordered table-condensed table-hover"">';
  2327. $rowsResult.='<thead><tr>';
  2328. $rowsResult.='<th>'.ucfirst(LABEL_Termino).'</th><th>'.ucfirst(MSG_notesAffected).'</th></tr></thead><tbody>';
  2329. $rowsResult.=$rowsLog;
  2330. $rowsResult.='</tbody></table></div></div>';
  2331. }
  2332. }
  2333. $ARRAYnoteType=ARRAYnoteTypes(array('NP'));
  2334. foreach ($ARRAYnoteType as $noteType => $noteData) {
  2335. //exclude private notes
  2336. $flagSelected=($params["note4gloss"]==$noteData["value_code"]) ? 'SELECTED':"";
  2337. $_GLOSS_NOTESOptions.='<option value="'.$noteData["value_code"].'" '.$flagSelected.'>'.$noteData["value"].' ('.$noteData["cant"].')</option>';
  2338. };
  2339. $rows.='<form class="" role="form" name="configGlossary" id="configGlossary" action="admin.php" method="get">';
  2340. $rows.=' <div class="row">
  2341. <div class="col-sm-12">
  2342. <legend>'.ucfirst(LABEL_generateAutoGlossary).'</legend>
  2343. </div>
  2344. <!-- panel -->';
  2345. $rows.=$rowsResult;
  2346. $rows.=' <div class="col-lg-7">
  2347. <div class="col-sm-12 alert alert-info"><div class="panel-body">'.ucfirst(MSG__autoGlossInfo).'</div></div>
  2348. <div class="panel panel-default">
  2349. <div class="panel-body form-horizontal">';
  2350. $rows.=' <div class="form-group">';
  2351. $rows.='<label for="simpleReport" class="col-sm-3 control-label">'.ucfirst(LABEL_bulkGlossNotes).'</label>
  2352. <div class="col-sm-9">
  2353. <select class="form-control" id="note4gloss" name="note4gloss">
  2354. '.$_GLOSS_NOTESOptions.'
  2355. </select>
  2356. </div>
  2357. </div>';
  2358. $rows.='<div class="col-sm-12 alert alert-danger"><div class="panel-body">'.ucfirst(MSG__autoGlossDanger).'</div></div>';
  2359. $rows.='<div class="form-group">
  2360. <div class="col-sm-12 text-center">
  2361. <input type="submit" class="btn btn-primary" id="boton" name="boton" value="'.ucfirst(LABEL_Enviar).'"/>
  2362. <input type="hidden" id="makeAutoGloss" name="makeAutoGloss" value="1"/>
  2363. <input type="hidden" id="doAdmin" name="doAdmin" value="glossConfig"/>
  2364. </div>
  2365. </div>';
  2366. $rows.=' </div>
  2367. </div>
  2368. </div>
  2369. </div> <!-- / panel -->';
  2370. $rows.='<input type="hidden" name="dis" id="dis" value="jglossary"/>';
  2371. $rows.='<input type="hidden" name="task" id="task" value="exportGlossary"/>';
  2372. $rows.='</form>';
  2373. return $rows;
  2374. }
  2375. /*
  2376. terms form one char to translate
  2377. */
  2378. function FORMtransterm4char4map($tvocab_id, $filterEQ, $letra)
  2379. {
  2380. $ARRAYvocabulario=ARRAYvocabulario($tvocab_id);
  2381. $LabelEE=id_EQ.'#'.LABEL_termino_equivalente;
  2382. $LabelIE=id_EQ_PARCIAL.'#'.LABEL_termino_parcial_equivalente;
  2383. $LabelNE=id_EQ_NO.'#'.LABEL_termino_no_equivalente;
  2384. $cantLetra=numPrefTerms2Letter($tvocab_id, $letra);
  2385. $cantLetra["cant_no_eq"]=$cantLetra["cant"]-$cantLetra["cant_eq"];
  2386. $letra_label= (!ctype_digit($letra)) ? $letra : '0-9';
  2387. //panel data
  2388. $rows.='<div class="panel panel-default">
  2389. <div class="panel-heading">
  2390. <h4><a title="'.LABEL_bulkTranslate.'" href="'.URL_BASE.'index.php?mod=trad">'.ucfirst(LABEL_bulkTranslate).'</a> &middot; '.$ARRAYvocabulario["titulo"].'</h4>';
  2391. $rows.=' </div>';
  2392. if ($letra) {
  2393. $rows.='<div class="panel-body">';
  2394. $rows.='<p><em>'.MSG_ResultLetra.' '.$letra_label.': </em><a href="'.URL_BASE.'index.php?letra2trad='.$letra.'&amp;filterEQ=0&amp;tvocab_id='.$ARRAYvocabulario["vocabulario_id"].'&mod=trad">'.$cantLetra["cant"].' '.LABEL_Terminos.'</a>';
  2395. if (($cantLetra["cant_no_eq"]!=$cantLetra["cant"]) && ($cantLetra["cant_no_eq"]>0)) {
  2396. $rows.='<ul>';
  2397. $rows.='<li class="active">'.ucfirst(LABEL_termsEQ).': <a href="'.URL_BASE.'index.php?letra2trad='.$letra.'&amp;filterEQ=2&amp;tvocab_id='.$ARRAYvocabulario["vocabulario_id"].'&mod=trad">'.$cantLetra["cant_eq"].' '.LABEL_Terminos.'</a></li>';
  2398. $rows.='<li class="active">'.ucfirst(LABEL_termsNoEQ).': <a href="'.URL_BASE.'index.php?letra2trad='.$letra.'&amp;filterEQ=1&amp;tvocab_id='.$ARRAYvocabulario["vocabulario_id"].'&mod=trad">'.$cantLetra["cant_no_eq"].' '.LABEL_Terminos.'</a></li>';
  2399. $rows.='</ul>';
  2400. }
  2401. $rows.=' </p></div>';
  2402. }// if $letra
  2403. $rows.=' <div class="panel-footer">'.HTMLalphaListTerms4map($ARRAYvocabulario["vocabulario_id"], $filterEQ, $letra).'</div>';
  2404. $rows.=' </div>';
  2405. $paginado_letras='';
  2406. $pag= (secure_data($_GET["p"])<1) ? 1 : $_GET["p"] ;
  2407. $cantLetra2Paginador=$cantLetra["cant"];
  2408. if ($filterEQ>0) {
  2409. $cantLetra2Paginador=($filterEQ==2) ? $cantLetra["cant_eq"] : $cantLetra["cant_no_eq"];
  2410. }
  2411. if ($cantLetra2Paginador>0) {
  2412. if ($cantLetra2Paginador>CFG_NUM_SHOW_TERMSxTRAD) {
  2413. $paginado_letras=paginate_links(
  2414. array(
  2415. 'type' => 'list',
  2416. 'show_all' => (($cantLetra2Paginador/CFG_NUM_SHOW_TERMSxTRAD)<15) ? true : false,
  2417. 'base' => 'index.php?letra2trad='.$letra.'&amp;filterEQ='.$filterEQ.'&amp;tvocab_id='.$ARRAYvocabulario["vocabulario_id"].'%_%',
  2418. 'format' => '&amp;mod=trad&amp;p=%#%',
  2419. 'current' => max(1, $pag),
  2420. 'total' => $cantLetra2Paginador/CFG_NUM_SHOW_TERMSxTRAD
  2421. )
  2422. );
  2423. };
  2424. $limit=CFG_NUM_SHOW_TERMSxTRAD;
  2425. $min= ($pag-1)*$limit;
  2426. //modificar => sólo debe traer términos preferidos. Los términos alternativos no se traducen
  2427. $sqlDatosLetra=SQLterms2map4char($ARRAYvocabulario["vocabulario_id"],$letra, array("min"=>$min,"limit"=>$limit,"filterEQ"=>$filterEQ));
  2428. $num_terms=($min>0) ? $min+1 :0;
  2429. $rows.='<div id="listaLetras">';
  2430. $rows.='<form role="form" class="form-inline" role="form" name="form2map" id="form2map" action="'.URL_BASE.'index.php?mod=trad&amp;tvocab_id='.$ARRAYvocabulario["vocabulario_id"].'&amp;letra2trad='.$letra.'&amp;p='.$pag.'" method="post" >';
  2431. $rows.=' <table id="myTable" class=" table order-list">
  2432. <thead>
  2433. <tr>
  2434. <th>#</th>
  2435. <td>'.ucfirst(FORM_LABEL_tipo_equivalencia).'</td>
  2436. <td>'.ucfirst(LABEL_OpcionesTermino).'</td>
  2437. <td>'.ucfirst($ARRAYvocabulario["titulo"]).' ('.strtoupper($ARRAYvocabulario["idioma"]).')</td>
  2438. </tr>
  2439. </thead>
  2440. <tbody>';
  2441. while ($datosLetra= $sqlDatosLetra->FetchRow()) {
  2442. $i=++$i;
  2443. $num_terms=++$num_terms;
  2444. //edit term
  2445. if ($datosLetra["tterm_id"]) {
  2446. $rows.='<tr>
  2447. <td class="col-sm-2">'.$num_terms.'</td>';
  2448. $rows.=' <td class="col-sm-2">'.arrayReplace(array(id_EQ,id_EQ_PARCIAL,id_EQ_NO), array(LABEL_termino_equivalente,LABEL_termino_parcial_equivalente,LABEL_termino_no_equivalente), $datosLetra["t_relacion"]).'</td>';
  2449. $rows.=' <td class="col-sm-4"><a href="modal.php?tema='.$datosLetra["tema_id"].'" class="modalTrigger">'.$datosLetra["tema"].'</a></td>';
  2450. $rows.=' <td class="col-sm-4">
  2451. <input type="hidden" name="tterm_id[]" value="'.$datosLetra["tterm_id"].'" />
  2452. <span id="edit_tema'.$datosLetra["tterm_id"].'" class="edit_area_term">'.$datosLetra["tterm"].'</span></td>
  2453. <td class="col-sm-2"><input tabindex="'.$i.'" type="checkbox" name="remove_tterm_rel[]" value="'.$datosLetra["r_id"].'" id="remove_tterm_id'.$datosLetra["tterm_id"].'"> <label for="remove_tterm_id'.$datosLetra["tterm_id"].'" class="deleteRow">'.LABEL_borraRelacion.'</label></td>';
  2454. $rows.='</tr>';
  2455. //create term
  2456. } else {
  2457. $rows.='<tr><td class="col-sm-2">'.$num_terms.'</td>';
  2458. $rows.='<td class="col-sm-2">
  2459. <select class="form-control" id="tipo_equivalencia" name="tipo_equivalencia[]">'.doSelectForm(array("$LabelEE","$LabelIE","$LabelNE"), $datosLetra["t_relacion"]).'</select></td>';
  2460. $rows.='<td class="col-sm-4"><a href="modal.php?tema='.$datosLetra["tema_id"].'" class="modalTrigger">'.$datosLetra["tema"].'</a></td>';
  2461. $rows.='<td class="col-sm-4"><input type="text" tabindex="'.$i.'" name="tterm_string[]" value="" class="form-control"/><input type="hidden" name="term_id[]" value="'.$datosLetra["tema_id"].'" /></td>
  2462. <td class="col-sm-2"></td>';
  2463. $rows.='</tr>';
  2464. }
  2465. }
  2466. $rows.=' </tbody>
  2467. <tfoot>
  2468. <tr>
  2469. <td colspan="5" style="text-align: left;">';
  2470. $rows.='<input type="hidden" name="tvocab_id" value="'.$ARRAYvocabulario["vocabulario_id"].'">';
  2471. $rows.='<input type="hidden" name="task" value="map4localTargetVocab">';
  2472. $rows.=' <button type="submit" class="btn btn-primary">'.LABEL_Enviar.'</button>';
  2473. $rows.=' </td>
  2474. </tr>
  2475. </tfoot></table>';
  2476. $rows.='</form>';
  2477. $rows.='</div>';
  2478. };
  2479. $rows.='<div class="row">'.$paginado_letras.'</div>';
  2480. return $rows;
  2481. }
  2482. function HTMLformSource($source_id = "0")
  2483. {
  2484. $array=($source_id>0) ? ARRAYsource($source_id) : array();
  2485. $array["tvocab_status"] = (is_numeric($array["src_status"])) ? $array["src_status"] : '1';
  2486. $doAdmin= ($array["src_id"]>0) ? 'saveSourceNote' : 'addSourceNote';
  2487. $rows.='<form role="form" id="form-sources" data-toggle="validator" name="abm_sources" action="admin.php#source_list" method="post">';
  2488. $rows.=' <div class="row">
  2489. <div class="col-sm-12">
  2490. <legend><a href="admin.php?vocabulario_id=list">'.ucfirst(LABEL_lcConfig).'</a> &middot; '.ucfirst(LABEL_source).'</legend>
  2491. </div>
  2492. <!-- panel -->
  2493. <div class="col-lg-7">
  2494. <div class="panel panel-default">
  2495. <div class="panel-body form-horizontal">';
  2496. $rows.=' <div class="form-group">
  2497. <label for="tvocab_label" accesskey="l" class="col-sm-3 control-label">'.ucfirst(LABEL_alias).'</label>
  2498. <div class="col-sm-9">
  2499. <input type="text" required placeholder="'.ucfirst(LEGEND_alias).'" class="form-control" name="src_alias" id="src_alias" value="'.$array["src_alias"].'"/>
  2500. </div>
  2501. </div>';
  2502. $rows.=' <div class="form-group">
  2503. <label for="tvocab_label" accesskey="l" class="col-sm-3 control-label">'.ucfirst(LABEL_src_note).'</label>
  2504. <div class="col-sm-9">
  2505. <textarea class="form-control" type="text" required rows="4" cols="50" placeholder="'.ucfirst(LEGEND_src_note).'" class="form-control" name="src_note" id="src_note">'.$array["src_note"].'</textarea>
  2506. </div>
  2507. </div>';
  2508. $rows.=' <div class="form-group">
  2509. <label for="tvocab_label" accesskey="l" class="col-sm-3 control-label">'.ucfirst(LABEL_URI2termURL).'</label>
  2510. <div class="col-sm-9">
  2511. <input type="text" type="url" placeholder="'.ucfirst(LABEL_URI2termURL).'" class="form-control" name="src_url" id="src_url" value="'.$array["src_url"].'"/>
  2512. </div>
  2513. </div>';
  2514. $rows.=' <div class="form-group">
  2515. <input type="checkbox" name="src_status" id="src_status" value="1" alt="'.ucfirst(LABEL_enable).'" '.do_check(1, $array["src_status"], 'checked').' />
  2516. <div class="col-sm-4">
  2517. <label for="src_status">'.ucfirst(LABEL_enable).'</label>
  2518. </div>
  2519. </div>
  2520. <div class="form-group">
  2521. <div class="col-sm-12 text-right">
  2522. <a type="button" class="btn btn" name="cancelar" type="button" href="admin.php" title="'.ucfirst(LABEL_Cancelar).'">'.ucfirst(LABEL_Cancelar).'</a>
  2523. <button type="submit" class="btn btn-primary" id="boton" name="boton_src" value="'.LABEL_Guardar.'"/>'.ucfirst(LABEL_Guardar).'</button>';
  2524. if (($array["src_id"]>0) && ($array["src_cant"]==0)) {
  2525. $rows.=' <input type="button" class="btn btn-danger" id="boton" name="boton" onclick="document.getElementById(\'delete-src_note\').submit();" value="'.ucfirst(LABEL_eliminar).'"/>';
  2526. }
  2527. $rows.=' </div>
  2528. </div>
  2529. </div>
  2530. </div>
  2531. </div> <!-- / panel -->';
  2532. $rows.='<input type="hidden" id="src_id" name="src_id" value="'.$array["src_id"].'"/>';
  2533. $rows.='<input type="hidden" name="doAdmin" id="doAdmin" value="'.$doAdmin.'"/>';
  2534. $rows.='</form>';
  2535. $rows.='</div>';
  2536. $rows.='<form id="delete-src_note" name="delete-src_note" action="admin.php" method="post"><input type="hidden" name="rem_src_id" id="rem_src_id" value="'.$array["src_id"].'"/><input type="hidden" name="doAdmin" id="doAdmin" value="remSourceNote"/></form>';
  2537. return $rows;
  2538. }
  2539. function HTMLlistSources()
  2540. {
  2541. $sql=SQLlistSources(0);
  2542. $rows='<div class="table-responsive" id="source_list">';
  2543. $rows.='<h3>'.ucfirst(LABEL_source).' <a type="button" class="btn btn-primary btn-xs" name="crear" type="button" href="admin.php?editsrc_id=0" title="'.ucfirst(LABEL_add_new).'">'.ucfirst(LABEL_add_new).'</a> <a href="#list-config" title="'.ucfirst(LABEL_lcConfig).' &middot; '.strtolower(LABEL_Opciones).'"><svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-caret-up-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
  2544. <path d="M7.247 4.86l-4.796 5.481c-.566.647-.106 1.659.753 1.659h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z"/>
  2545. </svg></a></h3> ';
  2546. $rows.='<div><input id="filter" type="text" class="form-control" placeholder="'.ucfirst(LABEL_type2filter).'"> </div>';
  2547. $rows.='<div class="table-responsive"> ';
  2548. $rows.='<table class="table table-striped table-bordered table-condensed table-hover"">';
  2549. $rows.='<thead> <tr>';
  2550. $rows.='<th>'.ucfirst(LABEL_alias).'</th><th>'.ucfirst(LABEL_source).'</th><th>'.ucfirst(LABEL_notes).'</th></tr></thead> <tbody class="searchable">';
  2551. while ($array=$sql->FetchRow()) {
  2552. $rows.= '<tr>';
  2553. $rows.= ' <td><a href="admin.php?editsrc_id='.$array["src_id"].'" title="'.ucfirst(LABEL_Detalle).'">'.$array["src_alias"].'</a></td>';
  2554. $rows.= ' <td>'.$array["src_note"].'</td>';
  2555. $rows.= ' <td align="center">'.$array["src_cant"].'</td>';
  2556. $rows.= '</tr>';
  2557. }
  2558. $rows.=' </tbody>';
  2559. $rows.='</table> </div>';
  2560. $rows.='</div>'; //end div
  2561. return $rows;
  2562. }
  2563. /*
  2564. * Form for edit or add terms
  2565. 1 caso:
  2566. - Alta de un t�rmino nuevo.
  2567. *
  2568. */
  2569. function HTMLformTermsNews($tvocab_id = 0)
  2570. {
  2571. global $CFG;
  2572. //SEND_KEY to prevent duplicated
  2573. session_start();
  2574. $_SESSION['SEND_KEY']=md5(uniqid(rand(), true));
  2575. $sql=SQLtargetVocabulary("1");
  2576. $rows='<div class="container" id="bodyText">';
  2577. if (SQLcount($sql)=='0') {
  2578. //No hay vocabularios de referencia, solo vocabulario principal
  2579. $rows.=HTMLalertNoTargetVocabulary();
  2580. } else {
  2581. //Hay vobularios de referencia
  2582. $array_vocabularios=array();
  2583. while ($array=$sql->FetchRow()) {
  2584. if ($array["vocabulario_id"]!=='1') {
  2585. //vocabularios que no sean el vocabulario principal
  2586. array_push($array_vocabularios, $array["tvocab_id"].'#'.FixEncoding($array["tvocab_label"].' - '.$CFG["ISO639-1"][$array["tvocab_lang"]][1]));
  2587. }
  2588. };
  2589. $searchType=(!$_GET["tvocab_id"]) ? 1 : $_GET["searchType"];
  2590. $string2search = XSSprevent(trim($_GET["string2search"]));
  2591. $rows.='<form class="" role="form" name="alta_tt" id="alta_tt" action="index.php#suggestResult" method="get">';
  2592. $rows.=' <div class="row">
  2593. <div>
  2594. <legend>'.ucfirst(LABEL__getForTargetVocabularyNews).'</legend>
  2595. </div>
  2596. <!-- panel -->
  2597. <div class="col-lg-10">
  2598. <div class="panel panel-default">
  2599. <div class="panel-body form-horizontal">
  2600. <div class="form-group">
  2601. <label for="tvocab_id" class="col-sm-3 control-label">'.ucfirst(FORM_LABEL_nombre_vocabulario).'</label>
  2602. <div class="col-sm-9">
  2603. <select class="form-control" id="tvocab_id" name="tvocab_id">
  2604. '.doSelectForm($array_vocabularios, $_GET["tvocab_id"]).'
  2605. </select>
  2606. </div>
  2607. </div>
  2608. <div class="form-group">
  2609. <div class="col-sm-12 text-right">
  2610. <button type="submit" class="btn btn-primary" value="'.LABEL_Buscar.'"/>'.ucfirst(LABEL_Buscar).'</button>
  2611. <button type="button" class="btn btn" name="cancelar" type="button" onClick="location.href=\'index.php\'" value="'.ucfirst(LABEL_Cancelar).'"/>'.ucfirst(LABEL_Cancelar).'</button>
  2612. </div>
  2613. </div>
  2614. </div>
  2615. </div>
  2616. </div> <!-- / panel -->';
  2617. $rows.='<input type="hidden" name="taskterm" value="findTermNews"/>';
  2618. $rows.='</form>';
  2619. }
  2620. if ($tvocab_id>0) {
  2621. include_once T3_ABSPATH . 'common/include/vocabularyservices.php' ;
  2622. $arrayVocab=ARRAYtargetVocabulary($_GET["tvocab_id"]);
  2623. $dataTterm=getURLdata($arrayVocab["tvocab_uri_service"].'?task=fetchLast');
  2624. if ($dataTterm->resume->cant_result > "0") {
  2625. $arrayTtermData = array();
  2626. foreach ($dataTterm->result->term as $value) {
  2627. $i=++$i;
  2628. $term_id=(int) $value->term_id;
  2629. $string=(string) $value->string;
  2630. $source_date= ($value->date_mod>0) ? $value->date_mod : $value->date_create ;
  2631. $arrayTtermData[$term_id]=array("term_id"=>$term_id,
  2632. "string"=>$string,
  2633. "source_string"=>$string,
  2634. "source_term_id"=>$term_id,
  2635. "source_date"=> $source_date
  2636. );
  2637. };
  2638. }
  2639. //null for t_relation
  2640. $t_relation=0;
  2641. $rows.=' </div>';//row
  2642. $rows.=HTMLformTargetVocabularySuggested($arrayTtermData, $t_relation, $string2search, $arrayVocab, $ARRAYtermino["idTema"]);
  2643. };//fin de if buscar
  2644. $rows.=' </div>';//container
  2645. return $rows;
  2646. }