noalyss Version-9
tag_search_select.php
Go to the documentation of this file.
1<?php
2//This file is part of NOALYSS and is under GPL
3//see licence.txt
4?><?php
5
6
7$max=$this->cn->count($ret);
8if ( $max == 0 ) {
9 $res=h2(_("Aucune étiquette disponible"),' class="notice"').
10 HtmlInput::button_close($p_prefix.'tag_div');
11 return $res;
12
13}
14$tab_tag=new Html_Tab($p_prefix."tab_tag",_("Etiquettes"));
15ob_start();
16?>
17<?php echo _("Cherche")." ".HtmlInput::filter_table($p_prefix.'tag_tb_id', '0,1', 1); ?>
18<?php echo HtmlInput::button_action(_('Uniquement actif'), 'show_only_row(\''.$p_prefix.'tag_tb_id'.'\',\'tag_status\',\'Y\')');?>
19<?php echo HtmlInput::button_action(_('Tous'), 'show_all_row(\''.$p_prefix.'tag_tb_id'.'\')');?>
20<table class="result" id="<?php echo $p_prefix;?>tag_tb_id">
21 <tr>
22 <th>
23 <?php echo _("Tag")?>
24 </th>
25 <th>
26 <?php echo _("Description")?>
27 </th>
28 </tr>
29<?php
30$gDossier=Dossier::id();
31 for ($i=0;$i<$max;$i++):
32 $row=Database::fetch_array($ret, $i);
33 $attr=sprintf('tag_status="%s"',$row['t_actif']);
34?>
35 <tr <?=$attr?> class="<?php echo (($i%2==0)?'even':'odd');?>">
36 <td>
37 <?php
38 $js=sprintf("search_add_tag('%s','%s','%s','t')",$gDossier,$row['t_id'],$p_prefix);
39 echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
40 ?>
41 </td>
42 <td>
43 <?php
44 echo h($row['t_description']);
45 ?>
46 </td>
47 <td>
48 <?php
49 if ( $row['t_actif'] == 'N') {
50 echo _('non actif');
51 }
52 ?>
53 </td>
54 </tr>
55<?php
56 endfor;
57 ?>
58</table>
59
60<?php
61 $tab_tag->set_content(ob_get_contents());
62 ob_end_clean();
63// Tab for the groups
64//
65ob_start();
66$tab_tag_group=new Html_Tab($p_prefix."tab_tag_group",_("Groupe"));
67$aGroup=$this->cn->get_array("select tg_id, tg_name from tag_group order by 2 desc");
68$nb_agroup=count($aGroup);
69?>
70<table class="result">
71 <tr>
72 <th><?=_("Groupe")?></th>
73 </tr>
74 <?php for ($i=0;$i<$nb_agroup;$i++):?>
75 <tr>
76 <td>
77 <?php
78 $js=sprintf("search_add_tag('%s','%s','%s','g')",$gDossier,$aGroup[$i]['tg_id'],$p_prefix);
79 echo HtmlInput::anchor($aGroup[$i]['tg_name'], "", "onclick=\"$js\"");
80 ?>
81 </td>
82
83 </tr>
84 <?php endfor;?>
85</table>
86<?php
87
88
89$tab_tag_group->set_content(ob_get_contents());
90ob_end_clean();
91
92// Both tab
93$output=new Output_Html_Tab();
94$output->add($tab_tag);
95$output->add($tab_tag_group);
96ob_start();
97$output->output();
98
99?>
100
101<?=HtmlInput::button_close($p_prefix.'tag_div')?>
102
103<script>
104 show_only_row('<?=$p_prefix?>tag_tb_id','tag_status','Y');
105 <?=$output->build_js($p_prefix."tab_tag");?>
106</script>
107<?php
108$res =ob_get_contents();
109ob_end_clean();
110return $res;
111?>
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
$data t_id
$input_from cn
Definition: balance.inc.php:66
Tab Element.
static button_close($div_name, $class='smallbutton')
close button for the HTML popup
static filter_table($p_table_id, $p_col, $start_row)
filter the rows in a table and keep the colored row in alternance
static button_action($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
button Html with javascript
if( $max==0) $tab_tag