noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
ISelect Class Reference

Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label corresponding to the selected value You can use also $this->rowsize to specify the number of lines to display. More...

+ Inheritance diagram for ISelect:
+ Collaboration diagram for ISelect:

Public Member Functions

 __construct ($p_name="", $p_value="", $p_id="")
 Constructor , $p_value is supposed to be an array.
 
 display ()
 print in html the readonly value of the widget
 
 get_value ()
 print in html the readonly value of the widget
 
 input ($p_name=null, $p_value=null)
 show the html input of the widget
 
 set_value ($p_string)
 Set the value of input (IText, INum,...)
 
 transform ($p_array)
 set the value of an ISelect with the array , this array is bidimensional , the first dimension is the code to store and the second is the label to display.
 
- Public Member Functions inherited from HtmlInput
 __toString ()
 
 get_js_attr ()
 you can add attribute to this in javascript this function is a wrapper and create a script (in js) to modify "this" (in javascript) with the value of obj->attribute from PHP.
 
 get_node_attribute ()
 Insert attribute inside a INPUT TYPE, these attribute can be retrieved in javascript with element.getAttribute or changed with element.setAttribute example insert my_attribute into a checkbox <input type="checkbox" "my_attribute"="XX">
 
 get_placeholder ()
 
 make_object_deprecated ($p_name=null)
 Make a JSON object, this method create a javascript object with the attribute set, it returns a javascript string with the object.
 
 set_attribute ($p_name, $p_value)
 add an HTML attribute for the INPUT field
 
 set_placeholder ($placeholder)
 set HTML placeholder attribut
 
 setReadOnly ($p_read)
 

Static Public Member Functions

static test_me ()
 
- Static Public Member Functions inherited from HtmlInput
static anchor ($p_text, $p_url="", $p_js="", $p_style=' class="line" ', $p_title="click", array $p_attribute=[])
 Return a simple LINK with a url or a javascript if $p_js is not null then p_url will be javascript:void(0) we don't add the event onclick.
 
static anchor_action ($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
 Anchor Html with javascript.
 
static anchor_close ($div, $p_js="")
 Return a html string with an anchor which close the inside popup.
 
static anchor_empty ($p_text, $p_id, $p_title="")
 let you create only a link and set an id on it.
 
static anchor_hide ($action, $javascript)
 Return a html string with an anchor to hide a div, put it in the right corner.
 
static array_to_hidden ($array, $global_array)
 transform request data to hidden
 
static array_to_string ($array, $global_array, $start="?")
 transform request data to string
 
static button ($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
 
static button_action ($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
 button Html with javascript
 
static button_action_add ()
 
static button_action_remove_operation ($p_operation)
 
static button_anchor ($p_label, $p_value, $p_name="", $p_javascript="", $p_class="smallbutton")
 create a button with a ref
 
static button_choice_ledger ($p_array)
 
static button_close ($div_name, $class='smallbutton')
 close button for the HTML popup
 
static button_hide ($div_name, $class='smallbutton')
 Hide the HTML popup.
 
static button_image ($javascript, $id="xx", $p_class='class="button"', $p_image="")
 button Html image
 
static calendar_zoom ($obj)
 Zoom the calendar.
 
static card_detail ($p_qcode, $pname='', $p_style="", $p_nohistory=false, $nofollowup=false)
 show the detail of a card
 
static default_value ($ind, $default, $array)
 return default if the value if the value doesn't exist in the array
 
static default_value_get ($ind, $default)
 return default if the value if the value doesn't exist in $_GET use HttpInput instead
 
static default_value_post ($ind, $default)
 return default if the value if the value doesn't exist in $_POST use HttpInput instead
 
static default_value_request ($ind, $default)
 return default if the value if the value doesn't exist in $_REQUEST use HttpInput instead
 
static detail_action ($ag_id, $p_mesg, $p_modify=1)
 return an anchor to view the detail of an action
 
static detail_modele_document_deprecated ($p_id, $p_mesg)
 return a string containing the html code for calling the modifyModeleDocument
 
static detail_op ($p_jr_id, $p_mesg)
 return a string containing the html code for calling the modifyOperation
 
static display_periode ($p_id)
 
static errorbulle ($p_comment)
 
static extension ()
 
static filter_list ($p_list_id)
 Display a field for searching an element in a list, the searchable text must be in an element with the className search-content.
 
static filter_table ($p_table_id, $p_col, $start_row)
 filter the rows in a table and keep the colored row in alternance
 
static filter_table_DOM ($p_table_id, $p_col, $start_row, $p_name, $domid)
 filter the rows in a table and keep the colored row in alternance
 
static filter_table_form ($p_table_id, $p_col, $start_row, $p_name, $p_old_value)
 filter the rows in a table and keep the colored row in alternance
 
static followup_card_button ($f_id, $p_mesg)
 display a div with the history of the card
 
static generate_id ($p_prefix)
 generate an unique id for a widget,
 
static get_to_hidden ($array)
 transform $_GET data to hidden
 
static get_to_string ($array, $start="?")
 transform $_GET data to string
 
static hidden ($p_name, $p_value, $p_id="")
 
static history_account ($p_account, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the account
 
static history_anc_account ($p_account, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the analytic account
 
static history_card ($f_id, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the card
 
static history_card_button ($f_id, $p_mesg, $p_exercice="")
 display a div with the history of the card
 
static image_click ($p_image, $p_js, $p_message, $p_class="")
 Image to click ,.
 
static json_to_hidden ($p_json)
 transform a json to hidden
 
static post_to_hidden ($array)
 transform $_POST data to hidden
 
static post_to_string ($array)
 transform $_POST data to string
 
static print_window ()
 Javascript to print the current window.
 
static remove_stock ($p_id, $p_mesg)
 return a string containing the html code for calling the removeStock
 
static request_to_hidden (array $array)
 transform $_REQUEST data to hidden
 
static request_to_string ($array, $start="?")
 transform $_REQUEST data to string
 
static reset ($p_value, $p_class="smallbutton")
 
static select_cat ($array_cat)
 create a hidden plus button to select the cat of ledger
 
static select_stock ($p_cn, $p_name, $p_mode)
 Create an ISelect object containing the available repository for reading or writing.
 
static show_receipt_document ($p_jr_id, $p_name="")
 Returns HTML code for displaying a icon with a link to a receipt document from the ledger.
 
static show_reconcile ($p_div, $let, $span="")
 
static simple_array_to_hidden ($array)
 Transform a double array as a HTML string with hidden html value array has the formarray ["name"]="x",array['value']="y") the key name will be the hidden input name;.
 
static submit ($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
 
static title_box ($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n', $raw="", $refresh='')
 Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
 
static warnbulle ($p_comment)
 

Additional Inherited Members

- Data Fields inherited from HtmlInput
 $attribute
 
 $css_size
 
 $ctrl
 
 $disabled
 
 $extra
 
 $extra2
 
 $heigh
 
 $id
 
 $javascript
 
 $label
 
 $name
 
 $placeholder
 
 $readOnly
 
 $require
 
 $selected
 
 $size
 
 $style
 
 $tabindex
 
 $table
 
 $type
 
 $value
 
 $width
 

Detailed Description

Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label corresponding to the selected value You can use also $this->rowsize to specify the number of lines to display.

See also
Database\make_array
Examples
inplace_edit.test.php.

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

Constructor & Destructor Documentation

◆ __construct()

ISelect::__construct ( $p_name = "",
$p_value = "",
$p_id = "" )

Constructor , $p_value is supposed to be an array.

Parameters
string$p_namename of the element
array$p_value
DOMID$p_id

Reimplemented from HtmlInput.

Definition at line 47 of file iselect.class.php.

48 {
49 parent::__construct($p_name, $p_value, $p_id);
50 if ( $p_value =="" )
51 {
52 $this->value=[];
53 } else {
54 $this->value=$p_value;
55 }
56 }

References $p_id, and value.

Member Function Documentation

◆ display()

ISelect::display ( )

print in html the readonly value of the widget

Definition at line 119 of file iselect.class.php.

120 {
121 $r="";
122 if ($this->value == null) {
123 $this->value=array();
124 }
125 for ( $i=0;$i<sizeof($this->value);$i++)
126 {
127 if ($this->selected==$this->value[$i]['value'] )
128 {
129 $r=htmlentities($this->value[$i]['label'],ENT_QUOTES|ENT_HTML5,'UTF-8',true);
130
131 }
132 }
133 // $r='<span class="input_text_ro">'.$r.'</span>';
134 if ( $this->table == 1 ) $r='<td>'.$r.'</td>';
135 return $r;
136 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$select selected
$all table

References $i, $r, HtmlInput\$value, ENT_QUOTES, selected, table, and value.

Referenced by input().

◆ get_value()

ISelect::get_value ( )

print in html the readonly value of the widget

Reimplemented from HtmlInput.

Definition at line 138 of file iselect.class.php.

139 {
140 $r="";
141 for ( $i=0;$i<sizeof($this->value);$i++)
142 {
143 if ($this->selected==$this->value[$i]['value'] )
144 {
145 $r=$this->value[$i]['label'];
146
147 }
148 }
149 return $r;
150 }

References $i, $r, HtmlInput\$value, selected, and value.

◆ input()

ISelect::input ( $p_name = null,
$p_value = null )

show the html input of the widget

Note
to use a OPTGROUP, the key "value" must be null , it is important to note that it is needed to use for opening and closing the element
$select->value=array(
array ("value"=>null,"label"=>"Groupe 1"),
array ("value"=>1,"label"=>"Element 1"),
array ("value"=>2,"label"=>"Element 2"),
array ("value"=>null,"label"=>"END Groupe 1"), // not displaid
array ("value"=>null,"label"=>"Groupe 2"),
array ("value"=>1,"label"=>"Element 1"),
array ("value"=>2,"label"=>"Element 2"),
array ("value"=>null,"label"=>"END group Groupe 1")// not displaid
);

Definition at line 77 of file iselect.class.php.

78 {
79 $this->name=($p_name==null)?$this->name:$p_name;
80 $this->value=($p_value==null)?$this->value:$p_value;
81 if ( $this->readOnly==true) return $this->display();
82 $style=(isset($this->style))?$this->style:"";
83 $this->id=($this->id=="")?$this->name:$this->id;
84
85 $disabled=($this->disabled==true)?"disabled":"";
86 $rowsize = (isset ($this->rowsize)) ? ' size = "'.$this->rowsize.'"':"";
87
88 $r="";
89
90 $a="<SELECT id=\"$this->id\" NAME=\"$this->name\" $style $this->javascript $disabled $rowsize>";
91 if (empty($this->value)) return '';
92 // var $start_group boolean , true the element OPTGROUP starts, false, it ends
93 $start_group=false;
94 for ( $i=0;$i<sizeof($this->value);$i++)
95 {
96 // open the element optgroup
97 if ($this->value[$i]['value']===null && !$start_group) {
98 $start_group=true;
99 $a.=sprintf('<optgroup label="%s">', htmlspecialchars($this->value[$i]['label']));
100 continue;
101 }
102 // close the element optgroup
103 if ($this->value[$i]['value']==null && $start_group) {
104 $start_group=false;
105 $a.='</optgroup >';
106 continue;
107 }
108 $checked=($this->selected==$this->value[$i]['value'])?"SELECTED":"";
109
110 $a.='<OPTION VALUE="'.$this->value[$i]['value'].'" '.$checked.'>';
111 $a.=strip_tags($this->value[$i]['label']);
112 }
113 $a.="</SELECT>";
114 if ( $this->table == 1 ) $a='<td>'.$a.'</td>';
115
116 return $r.$a;
117 }
$opd_description style
$from_poste name
$input_from id
display()
print in html the readonly value of the widget
$icard readOnly
$action rowsize
$all disabled

References $a, $checked, HtmlInput\$disabled, $i, HtmlInput\$id, $r, HtmlInput\$style, HtmlInput\$value, disabled, display(), name, readOnly, rowsize, selected, style, table, and value.

+ Here is the call graph for this function:

◆ set_value()

ISelect::set_value ( $p_string)

Set the value of input (IText, INum,...)

Parameters
string$p_string

Reimplemented from HtmlInput.

Definition at line 172 of file iselect.class.php.

172 {
173 $this->selected=$p_string;
174 }

References selected.

◆ test_me()

static ISelect::test_me ( )
static

Definition at line 175 of file iselect.class.php.

176 {
177 }

◆ transform()

ISelect::transform ( $p_array)

set the value of an ISelect with the array , this array is bidimensional , the first dimension is the code to store and the second is the label to display.

Example

array(array('M'=>'Mister'),array('Ms'=>'Miss'));
// will be turned into
array( array("value"=>'M,"label"=>"Mister")...)
Parameters
array$p_array

Definition at line 163 of file iselect.class.php.

163 {
164 if (! is_array($p_array) || count($p_array)==0) return ;
165 $a_ret=array();
166 foreach ($p_array as $key=>$value) {
167 $a_ret['value']=$key;
168 $a_ret['label']=$value;
169 $this->value[]=$a_ret;
170 }
171 }

References $p_array, HtmlInput\$value, return, and value.


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