noalyss Version-9
tag_action.class.php
Go to the documentation of this file.
1<?php
2
3/*
4 * * Copyright (C) 2020 Dany De Bontridder <dany@alchimerys.be>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 *
21 * Author : Dany De Bontridder danydb@noalyss.eu
22 *
23 */
24
25
26/**
27 * @file
28 * @brief concerns the tags linked to an action
29 */
30
31/**
32 * @class Tag_Action
33 * @brief concerns the tags linked to an action
34 */
35class Tag_Action extends Tag
36{
37 function __construct($p_cn, $p_id=-1 )
38 {
39 parent::__construct($p_cn, $p_id);
40 }
41
42 /**
43 * let select a tag to add
44 */
45 function select($p_prefix="")
46 {
47 $ret=parent::query_active_tag();
48 require_once NOALYSS_TEMPLATE.'/tag_select.php';
49 }
50
51 /**
52 * Show a button to select tag for Search
53 * @return HTML
54 */
55 static function select_tag_search($p_prefix)
56 {
57 $r="";
58 $r.=HtmlInput::button("choose_tag", _("Etiquette"),
59 'onclick="search_display_tag('.Dossier::id().',\''.$p_prefix.'\',\'Tag_Action\')"', "smallbutton");
60 return $r;
61 }
62
63 /**
64 * clear the search cell
65 */
66 static function add_clear_button($p_prefix)
67 {
68 $clear=HtmlInput::button('clear', 'X', 'onclick="search_clear_tag('.Dossier::id().',\''.$p_prefix.'\');"',
69 'smallbutton');
70 return $clear;
71 }
72
73 /**
74 * In the screen search add this data to the cell
75 */
76 function update_search_cell($p_prefix)
77 {
78 $data=$this->get_data();
79 printf ('<span id="sp_%s%s" class="tagcell tagcell-color%s">',$p_prefix,$data->t_id,$data->t_color);
80 echo h($data->t_tag);
81 echo HtmlInput::hidden($p_prefix.'tag[]', $data->t_id);
82 $js=sprintf("$('sp_".$p_prefix.$data->t_id."').remove();");
83 echo Icon_Action::trash(uniqid(), $js);
84 echo '</span>';
85 }
86
87 /**
88 * let select a tag to add to the search
89 */
90 function select_search($p_prefix,$title=true)
91 {
92 $res="";
93 $ret=$this->get_data()->seek(' order by t_tag');
94 require_once NOALYSS_TEMPLATE.'/tag_search_select.php';
95 if ($title) return HtmlInput::title_box('Tag', $p_prefix.'tag_div').$res;
96 else return $res;
97 }
98
99}
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
static id()
return the 'gDossier' value after a check
static button($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
concerns the tags linked to an action
select($p_prefix="")
let select a tag to add
static add_clear_button($p_prefix)
clear the search cell
static select_tag_search($p_prefix)
Show a button to select tag for Search.
__construct($p_cn, $p_id=-1)
Tag operations or actions to linked them together.
Definition: tag.class.php:32