PageRenderTime 73ms CodeModel.GetById 31ms RepoModel.GetById 1ms app.codeStats 1ms

/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

Large files files are truncated, but you can click here to view the full file

  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'.$ARRA…

Large files files are truncated, but you can click here to view the full file