noalyss Version-9
Public Member Functions | Static Public Member Functions | Private Attributes
Tag_Operation Class Reference

concerns the tags linked to an accountancy writing More...

+ Inheritance diagram for Tag_Operation:
+ Collaboration diagram for Tag_Operation:

Public Member Functions

 __construct ($p_cn, $p_id=-1)
 
 get_jrn_id ()
 
 select ($p_prefix="")
 let select a tag to add More...
 
 select_search ($p_prefix)
 let select a tag to add to the search More...
 
 set_jrn_id ($jrn_id)
 
 tag_add ($p_tag_id)
 Links a tag to an operation. More...
 
 tag_cell ($p_div)
 show the cell content in Display for the tags More...
 
 tag_get ()
 get the tags of the current objet More...
 
 tag_remove ($p_tag_id)
 Remove a tag. More...
 
 update_search_cell ($p_prefix)
 In the screen search add this data to the cell. More...
 
- Public Member Functions inherited from Tag
 __construct ($p_cn, $id=-1)
 
 form_add ()
 Display a inner window with the detail of a tag. More...
 
 get_data ()
 
 query_active_tag ()
 
 remove ($p_array)
 
 save ($p_array)
 
 set_data ($data)
 
 show_form_add ()
 Show the tag you can add to a document. More...
 
 show_list ()
 Show the list of available tag. More...
 

Static Public Member Functions

static add_clear_button ($p_prefix)
 clear the search cell More...
 
static button_search ($p_jr, $p_div)
 Show a button to select tag for Search. More...
 
static select_tag_search ($p_prefix)
 Show a button to select tag for Search. More...
 

Private Attributes

 $jrn_id =-1
 

Additional Inherited Members

- Protected Attributes inherited from Tag
 $cn
 

Detailed Description

concerns the tags linked to an accountancy writing

Definition at line 34 of file tag_operation.class.php.

Constructor & Destructor Documentation

◆ __construct()

Tag_Operation::__construct (   $p_cn,
  $p_id = -1 
)

Reimplemented from Tag.

Definition at line 39 of file tag_operation.class.php.

40 {
41 parent::__construct($p_cn, $p_id);
42 }

References $p_id.

Member Function Documentation

◆ add_clear_button()

static Tag_Operation::add_clear_button (   $p_prefix)
static

clear the search cell

Definition at line 81 of file tag_operation.class.php.

82 {
83 $clear=HtmlInput::button('clear', 'X', 'onclick="search_clear_tag('.Dossier::id().',\''.$p_prefix.'\');"',
84 'smallbutton');
85 return $clear;
86 }
static id()
return the 'gDossier' value after a check
static button($p_name, $p_value, $p_javascript="", $p_class="smallbutton")

References HtmlInput\button(), and Dossier\id().

+ Here is the call graph for this function:

◆ button_search()

static Tag_Operation::button_search (   $p_jr,
  $p_div 
)
static

Show a button to select tag for Search.

Parameters
$p_jrjr_id of the operation
$p_divprefix of the dialog box
Returns
HTML

Definition at line 70 of file tag_operation.class.php.

71 {
72 $r="";
73 $js=sprintf("onclick=\"new operation_tag('%s').select('%s','%s')\"", $p_div, dossier::id(), $p_jr);
74 $r.=HtmlInput::button('tag_bt', _('Ajout étiquette'), $js, 'smallbutton');
75 return $r;
76 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$input_from id
Definition: balance.inc.php:63

References $js, $r, HtmlInput\button(), and id.

+ Here is the call graph for this function:

◆ get_jrn_id()

Tag_Operation::get_jrn_id ( )

Definition at line 44 of file tag_operation.class.php.

45 {
46 return $this->jrn_id;
47 }

References $jrn_id.

◆ select()

Tag_Operation::select (   $p_prefix = "")

let select a tag to add

Definition at line 58 of file tag_operation.class.php.

59 {
60 $ret=parent::query_active_tag();
61 require_once NOALYSS_TEMPLATE.'/tag_select.php';
62 }

References $ret.

◆ select_search()

Tag_Operation::select_search (   $p_prefix)

let select a tag to add to the search

Definition at line 183 of file tag_operation.class.php.

184 {
185 $res="";
186 $ret=$this->get_data()->seek(' order by t_tag');
187 require_once NOALYSS_TEMPLATE.'/tag_search_select.php';
188 return HtmlInput::title_box('Tag', $p_prefix.'tag_div').$res;
189 }
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
get_data()
Definition: tag.class.php:41

◆ select_tag_search()

static Tag_Operation::select_tag_search (   $p_prefix)
static

Show a button to select tag for Search.

Returns
HTML

Definition at line 194 of file tag_operation.class.php.

195 {
196 $r="";
197 $r.=HtmlInput::button("choose_tag", _("Etiquette"),
198 'onclick="search_display_tag('.Dossier::id().',\''.$p_prefix.'\',\'Tag_Operation\')"', "smallbutton");
199 return $r;
200 }

◆ set_jrn_id()

Tag_Operation::set_jrn_id (   $jrn_id)

Definition at line 49 of file tag_operation.class.php.

50 {
51 $this->jrn_id=$jrn_id;
52 return $this;
53 }

References $jrn_id.

◆ tag_add()

Tag_Operation::tag_add (   $p_tag_id)

Links a tag to an operation.

Parameters
int$p_tag_idtag.t_id

Definition at line 106 of file tag_operation.class.php.

107 {
108 if ($this->jrn_id==-1)
109 {
110 throw new Exception("TO99 jrn_id unset");
111 }
112 $count=$this->cn->get_value('select count(*) from operation_tag'.
113 ' where jrn_id=$1 and tag_id=$2', array($this->jrn_id, $p_tag_id));
114 if ($count>0)
115 return;
116 $sql=' insert into operation_tag (jrn_id,tag_id) values ($1,$2)';
117 $this->cn->exec_sql($sql, array($this->jrn_id, $p_tag_id));
118 }
$input_from cn
Definition: balance.inc.php:66
$count

◆ tag_cell()

Tag_Operation::tag_cell (   $p_div)

show the cell content in Display for the tags

Parameters
$divprefix of the DOM id called also by ajax

Definition at line 125 of file tag_operation.class.php.

126 {
127 global $g_user;
128 $a_tag=$this->tag_get();
129 $c=count($a_tag);
130 $ledger=$this->cn->get_value("select jr_def_id from jrn where jr_id=$1", [$this->jrn_id]);
131 $access=$g_user->get_ledger_access($ledger);
132 for ($e=0; $e<$c; $e++)
133 {
134 echo '<span class="tagcell tagcell-color'.$a_tag[$e]['t_color'].'">';
135 echo $a_tag[$e]['t_tag'];
136 if ($access=='W')
137 {
138 $js_remove=sprintf("new operation_tag('%s').remove('%s','%s','%s')", $p_div, dossier::id(),
139 $this->jrn_id, $a_tag[$e]['t_id']);
140 echo Icon_Action::trash(uniqid(), $js_remove);
141 }
142 echo '</span>';
143 echo '&nbsp;';
144 echo '&nbsp;';
145 }
146 }
global $g_user
if no group available , then stop
if($ledger=="") $access
static trash($p_id, $p_javascript)
Display the icon of a trashbin.
tag_get()
get the tags of the current objet

◆ tag_get()

Tag_Operation::tag_get ( )

get the tags of the current objet

Returns
an array idx [ag_id,t_id,at_id,t_tag]

Definition at line 152 of file tag_operation.class.php.

153 {
154 if ($this->jrn_id==-1)
155 {
156 throw new Exception("TO01 jrn_id unset");
157 }
158 $sql='select b.jrn_id,a.t_id,a.t_id,a.t_tag,a.t_color'
159 .' from '
160 .' tags as a join operation_tag as b on (a.t_id=b.tag_id)'
161 .' where jrn_id=$1 '
162 .' order by a.t_tag';
163 $array=$this->cn->get_array($sql, array($this->jrn_id));
164 return $array;
165 }

◆ tag_remove()

Tag_Operation::tag_remove (   $p_tag_id)

Remove a tag.

Parameters
int$p_tag_idtag id

Definition at line 171 of file tag_operation.class.php.

172 {
173 if ($this->jrn_id==-1)
174 {
175 throw new Exception("TO01 jrn_id unset");
176 }
177 $this->cn->exec_sql("delete from operation_tag where jrn_id=$1 and tag_id=$2", [$this->jrn_id, $p_tag_id]);
178 }

◆ update_search_cell()

Tag_Operation::update_search_cell (   $p_prefix)

In the screen search add this data to the cell.

Definition at line 91 of file tag_operation.class.php.

92 {
93 $data=$this->get_data();
94 echo '<span id="sp_'.$p_prefix.$data->t_id.'" class="tagcell">';
95 echo h($data->t_tag);
96 echo HtmlInput::hidden($p_prefix.'tag[]', $data->t_id);
97 $js=sprintf("$('sp_".$p_prefix.$data->t_id."').remove();");
98 echo Icon_Action::trash(uniqid(), $js);
99 echo '</span>';
100 }
h( $row[ 'oa_description'])
static hidden($p_name, $p_value, $p_id="")
$data
Definition: tag.class.php:33

Field Documentation

◆ $jrn_id

Tag_Operation::$jrn_id =-1
private

Definition at line 37 of file tag_operation.class.php.

Referenced by get_jrn_id(), and set_jrn_id().


The documentation for this class was generated from the following file: