Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 require_once 'class_tag_sql.php';
00021
00022 class Tag
00023 {
00024 function __construct($p_cn,$id=-1)
00025 {
00026 $this->cn=$p_cn;
00027 $this->data=new Tag_SQL($p_cn,$id);
00028 }
00029
00030
00031
00032
00033 function show_list()
00034 {
00035 $ret=$this->data->seek(' order by t_tag');
00036 if ( $this->cn->count($ret) == 0) return "";
00037 require_once 'template/tag_list.php';
00038 }
00039
00040
00041
00042 function select()
00043 {
00044 $ret=$this->data->seek(' order by t_tag');
00045 require_once 'template/tag_select.php';
00046 }
00047
00048
00049
00050 function form_add()
00051 {
00052 $data=$this->data;
00053 require_once 'template/tag_detail.php';
00054 }
00055
00056
00057
00058 function show_form_add()
00059 {
00060 echo '<h2>'.' Ajout d\'un dossier (ou tag)'.'</h2>';
00061
00062 $this->form_add();
00063 }
00064 function save($p_array)
00065 {
00066 if ( trim($p_array['t_tag'])=="" ) return ;
00067 $this->data->t_id=$p_array['t_id'];
00068 $this->data->t_tag= strip_tags($p_array['t_tag']);
00069 $this->data->t_description=strip_tags($p_array['t_description']);
00070 $this->data->save();
00071 }
00072 function remove($p_array)
00073 {
00074 $this->data->t_id=$p_array['t_id'];
00075 $this->data->delete();
00076 }
00077
00078
00079
00080
00081 static function button_search($p_prefix)
00082 {
00083 $r="";
00084 $r.=HtmlInput::button("choose_tag", "Etiquette", 'onclick="search_display_tag('.Dossier::id().',\''.$p_prefix.'\')"', "smallbutton");
00085 return $r;
00086 }
00087
00088
00089
00090 function select_search($p_prefix)
00091 {
00092 $ret=$this->data->seek(' order by t_tag');
00093 require_once 'template/tag_search_select.php';
00094 }
00095
00096
00097
00098 function update_search_cell($p_prefix) {
00099 echo '<span id="sp_'.$p_prefix.$this->data->t_id.'" style="border:1px solid black;margin-right:5px;">';
00100 echo h($this->data->t_tag);
00101 echo HtmlInput::hidden($p_prefix.'tag[]', $this->data->t_id);
00102 $js=sprintf("$('sp_".$p_prefix.$this->data->t_id."').remove();");
00103 echo '<span style="background-color:red;text-align:center;border-top:1px solid black; border-right:1px solid black;border-bottom:1px solid black;">';
00104 echo HtmlInput::anchor('X', "javascript:void(0)", "onclick=\"$js\"");
00105 echo '</span>';
00106 echo '</span>';
00107 }
00108
00109
00110
00111 static function add_clear_button($p_prefix) {
00112 $clear=HtmlInput::button('clear', 'X', 'onclick="search_clear_tag('.Dossier::id().',\''.$p_prefix.'\');"', 'smallbutton');
00113 return $clear;
00114 }
00115 }
00116
00117 ?>