noalyss Version-9
iconcerned.class.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS 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 NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21// Copyright Author Dany De Bontridder danydb@aevalys.eu
22
23/*!
24 * \file
25 * \brief Html Input
26 * - name is the name and id of the input
27 * - extra amount of the operation to reconcile
28 * - extra2 ledger paid
29 */
30/*!
31 * \class IConcerned
32 * \brief Html Input
33 * - name is the name and id of the input
34 * - extra amount of the operation to reconcile
35 * - extra2 ledger paid
36 */
37class IConcerned extends HtmlInput
38{
39
40 private $hideOperation; //!< string of j_id to hide, separated by comma to avoid to reconcile an operation with itself
41 private $singleOperation; //!< do not allow to select several operations
42
43 public function __construct($p_name='', $p_value='', $p_id="")
44 {
45 $this->name=$p_name;
46 $this->value=$p_value;
47 $this->amount_id=null;
48 $this->paid='';
49 $this->id=$p_id;
50 // id of the field for the tiers to be updated
51 $this->tiers="";
52 // Dom Element to show the search result
53 $this->div="";
54 // string of j_id to hide, separated by comma to avoid to reconcile an operation with itself
55 $this->hideOperation="";
56 // by default we can select several operation
57 $this->singleOperation=0;
58 }
59
60 /* !\brief show the html input of the widget */
61
62 public function input($p_name=null, $p_value=null)
63 {
64 $this->name=($p_name==null)?$this->name:$p_name;
65 $this->value=($p_value==null)?$this->value:$p_value;
66 if ($this->readOnly==true)
67 return $this->display();
68
69 $this->id=($this->id=="")?$this->name:$this->id;
70 $javascript=sprintf("search_reconcile(".dossier::id().",'%s','%s','%s','%s','%s')", $this->name,
71 $this->amount_id, $this->paid, $this->div, $this->tiers);
73 $r.=sprintf("
74 <INPUT TYPE=\"text\" style=\"color:black;background:lightyellow;border:solid 1px grey;\" NAME=\"%s\" ID=\"%s\" VALUE=\"%s\" SIZE=\"8\" hide_operation=\"%s\" readonly single_operation=\"%s\">
75 <INPUT class=\"smallbutton\" TYPE=\"button\" onClick=\"$('%s').value=''\" value=\"X\">
76
77 ", $this->name, $this->id, $this->value, $this->hideOperation,$this->singleOperation,
78 $this->id
79 );
80 return $r;
81 }
82
83 /**
84 * setter
85 * @param number $p_string jrn.jr_id of the operation to hide
86 */
87 function set_hideOperation($p_string)
88 {
89 $this->hideOperation=strip_tags($p_string);
90 }
91
92 /**
93 * Set the value of single operation, limit to one operation if TRUE
94 * @param bool $p_value TRUE or false
95 */
96 function set_singleOperation($p_value){
97 if ( $p_value == TRUE ) {
98 $this->singleOperation=1;
99 return;
100 }
101 if ( $p_value == FALSE ) {
102 $this->singleOperation=0;
103 return;
104 }
105 throw new Exception (_("setSingleOperation failed"));
106 }
107
110 }
111
112 /* !\brief print in html the readonly value of the widget */
113
114 public function display()
115 {
116 $r=sprintf("<span><b>%s</b></span>", $this->value);
117 $r.=sprintf('<input type="hidden" name="%s" value="%s">', $this->name, $this->value);
118 return $r;
119 }
120
121 static public function test_me()
122 {
123
124 }
125
126}
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$from_poste name
$input_from id
Definition: balance.inc.php:63
class widget This class is used to create all the HTML INPUT TYPE and some specials which works with ...
Html Input.
__construct($p_name='', $p_value='', $p_id="")
set_singleOperation($p_value)
Set the value of single operation, limit to one operation if TRUE.
set_hideOperation($p_string)
setter
input($p_name=null, $p_value=null)
$hideOperation
string of j_id to hide, separated by comma to avoid to reconcile an operation with itself
$singleOperation
do not allow to select several operations
static test_me()
static icon_magnifier($id, $p_javascript, $p_style="")
Display a icon with a magnify glass.
$icard readOnly
$iconcerned amount_id