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

show a switch, when you click on it an hidden field is changed, the value is 1 or 0 More...

+ Inheritance diagram for InputSwitch:
+ Collaboration diagram for InputSwitch:

Public Member Functions

 __construct ($name='', $value='', $p_id="")
 
 display ()
 
 input ($p_name=NULL, $p_value=NULL)
 
- 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 ()
 
 get_value ()
 Return the value of input (IText, INum,...)
 
 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
 
 set_value ($p_string)
 Set the value of input (IText, INum,...)
 
 setReadOnly ($p_read)
 

Data Fields

 $icon
 
 $value
 
 $value_container
 
- 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
 

Additional Inherited Members

- 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)
 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_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)
 
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="")
 Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
 
static warnbulle ($p_comment)
 

Detailed Description

show a switch, when you click on it an hidden field is changed, the value is 1 or 0

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

Constructor & Destructor Documentation

◆ __construct()

InputSwitch::__construct ( $name = '',
$value = '',
$p_id = "" )

Reimplemented from HtmlInput.

Definition at line 41 of file input_switch.class.php.

42 {
43 $this->name=$name;
44 $this->value_container=uniqid();
45 $this->value=$value;
46 $this->icon=$p_id;
47 $this->javascript="";
48 }
$ret javascript
$from_poste name

References HtmlInput\$name, $p_id, $value, javascript, name, and value.

Member Function Documentation

◆ display()

InputSwitch::display ( )

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

78 {
79 if ($this->value=='1') {
80 return Icon_Action::iconon($this->icon, "");
81 } else {
82 return Icon_Action::iconoff($this->icon, "");
83 }
84 }
static iconoff($p_id, $p_javascript, $p_style="")
Display a icon OFF.
static iconon($p_id, $p_javascript, $p_style="")
Display a icon ON.

References Icon_Action\iconoff(), Icon_Action\iconon(), and value.

Referenced by input().

+ Here is the call graph for this function:

◆ input()

InputSwitch::input ( $p_name = NULL,
$p_value = NULL )

Definition at line 50 of file input_switch.class.php.

51 {
52 $r="";
53 if ($p_name!=NULL)
54 $this->name=$p_name;
55 if ($p_value!=NULL)
56 $this->value=$p_value;
57
58 if ( $this->icon=="") $this->icon=uniqid ("inputSwitch");
59
60 if ( trim($this->value_container) ==="" || trim($this->value) === "") {
61 throw new Exception(_("Valeur invalide"),1);
62 }
63 if ($this->readOnly == TRUE) {
64 return $this->display();
65 }
66 $r.= HtmlInput::hidden($this->name, $this->value,$this->value_container);
67
68 $this->javascript=sprintf('toggle_onoff(\'%s\',\'%s\');%s;',$this->icon,$this->value_container,$this->javascript);
69
70 if ($this->value=='1') {
71 $r.=Icon_Action::iconon($this->icon, $this->javascript);
72 } else {
73 $r.=Icon_Action::iconoff($this->icon, $this->javascript);
74 }
75 return $r;
76 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
_("actif, passif,charge,...")
static hidden($p_name, $p_value, $p_id="")
$icard readOnly

References $r, _, display(), HtmlInput\hidden(), Icon_Action\iconoff(), Icon_Action\iconon(), javascript, name, readOnly, and value.

+ Here is the call graph for this function:

Field Documentation

◆ $icon

InputSwitch::$icon

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

◆ $value

InputSwitch::$value

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

Referenced by __construct().

◆ $value_container

InputSwitch::$value_container

Definition at line 38 of file input_switch.class.php.


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