noalyss Version-9
Public Member Functions | Static Public Member Functions | Data Fields
IPeriod Class Reference

Generate the form for the periode Data Members. More...

+ Inheritance diagram for IPeriod:
+ Collaboration diagram for IPeriod:

Public Member Functions

 __construct ($p_name="", $p_value="", $p_exercice='')
 
 display ()
 print in html the readonly value of the widget More...
 
 input ($p_name=null, $p_value=null)
 show the input html for a periode More...
 
- Public Member Functions inherited from HtmlInput
 __construct ($p_name="", $p_value="", $p_id="")
 
 __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. More...
 
 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"> More...
 
 get_value ()
 Return the value of input (IText, INum,...) More...
 
 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. More...
 
 set_attribute ($p_name, $p_value)
 set the extra javascript property for the INPUT field More...
 
 set_value ($p_string)
 Set the value of input (IText, INum,...) More...
 
 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 anchor 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. More...
 
static anchor_action ($action, $javascript, $id=NULL, $p_class="button", $p_symbole="")
 Anchor Html with javascript. More...
 
static anchor_close ($div, $p_js="")
 Return a html string with an anchor which close the inside popup. More...
 
static anchor_empty ($p_text, $p_id, $p_title="")
 let you create only a link and set an id on it. More...
 
static anchor_hide ($action, $javascript)
 Return a html string with an anchor to hide a div, put it in the right corner. More...
 
static array_to_hidden ($array, $global_array)
 transform request data to hidden More...
 
static array_to_string ($array, $global_array, $start="?")
 transform request data to string More...
 
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 More...
 
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 More...
 
static button_choice_ledger ($p_array)
 
static button_close ($div_name, $class='smallbutton')
 close button for the HTML popup More...
 
static button_hide ($div_name)
 Hide the HTML popup. More...
 
static button_image ($javascript, $id="xx", $p_class='class="button"', $p_image="")
 button Html image More...
 
static calendar_zoom ($obj)
 Zoom the calendar. More...
 
static card_detail ($p_qcode, $pname='', $p_style="", $p_nohistory=false, $nofollowup=false)
 show the detail of a card More...
 
static default_value ($ind, $default, $array)
 return default if the value if the value doesn't exist in the array More...
 
static default_value_get ($ind, $default)
 return default if the value if the value doesn't exist in $_GET use HttpInput instead More...
 
static default_value_post ($ind, $default)
 return default if the value if the value doesn't exist in $_POST use HttpInput instead More...
 
static default_value_request ($ind, $default)
 return default if the value if the value doesn't exist in $_REQUEST use HttpInput instead More...
 
static detail_action ($ag_id, $p_mesg, $p_modify=1)
 return an anchor to view the detail of an action More...
 
static detail_modele_document ($p_id, $p_mesg)
 return a string containing the html code for calling the modifyModeleDocument More...
 
static detail_op ($p_jr_id, $p_mesg)
 return a string containing the html code for calling the modifyOperation More...
 
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. More...
 
static filter_table ($p_table_id, $p_col, $start_row)
 filter the rows in a table and keep the colored row in alternance More...
 
static filter_table_form ($p_table_id, $p_col, $start_row, $p_name, $p_old_value)
 
static followup_card_button ($f_id, $p_mesg)
 display a div with the history of the card More...
 
static generate_id ($p_prefix)
 generate an unique id for a widget, More...
 
static get_to_hidden ($array)
 transform $_GET data to hidden More...
 
static get_to_string ($array, $start="?")
 transform $_GET data to string More...
 
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 More...
 
static history_anc_account ($p_account, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the analytic account More...
 
static history_card ($f_id, $p_mesg, $p_style="", $p_exercice="")
 display a div with the history of the card More...
 
static history_card_button ($f_id, $p_mesg, $p_exercice="")
 display a div with the history of the card More...
 
static image_click ($p_image, $p_js, $p_message, $p_class="")
 Image to click ,. More...
 
static json_to_hidden ($p_json)
 transform a json to hidden More...
 
static post_to_hidden ($array)
 transform $_POST data to hidden More...
 
static post_to_string ($array)
 transform $_POST data to string More...
 
static print_window ()
 Javascript to print the current window. More...
 
static remove_stock ($p_id, $p_mesg)
 return a string containing the html code for calling the removeStock More...
 
static request_to_hidden (array $array)
 transform $_REQUEST data to hidden More...
 
static request_to_string ($array, $start="?")
 transform $_REQUEST data to string More...
 
static reset ($p_value)
 
static select_cat ($array_cat)
 create a hidden plus button to select the cat of ledger More...
 
static select_stock ($p_cn, $p_name, $p_mode)
 Create an ISelect object containing the available repository for reading or writing. More...
 
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. More...
 
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;. More...
 
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')
 Title for boxes, you can customize the symbol thanks symbol with the mode "custom". More...
 
static warnbulle ($p_comment)
 

Data Fields

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

Detailed Description

Generate the form for the periode Data Members.

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

Constructor & Destructor Documentation

◆ __construct()

IPeriod::__construct (   $p_name = "",
  $p_value = "",
  $p_exercice = '' 
)

$user if a filter is required then we need who is the user (object User)

Reimplemented from HtmlInput.

Definition at line 42 of file iperiod.class.php.

43 {
44 $this->name=$p_name;
45 $this->readOnly=false;
46 $this->size=20;
47 $this->width=50;
48 $this->heigh=20;
49 $this->value=$p_value;
50 $this->selected="";
51 $this->table=0;
52 $this->disabled=false;
53 $this->javascript="";
54 $this->extra2="all";
55 $this->show_start_date=true;
56 $this->show_end_date=true;
57 $this->exercice=$p_exercice;
58 $this->id=$p_name;
59 }
$select selected
$ret javascript
$name size
$input_from show_end_date
Definition: balance.inc.php:64
$from_poste name
$input_to show_start_date
Definition: balance.inc.php:85
$all table
$icard readOnly
$all disabled
$p_exercice
$desc heigh
$desc width

References $p_exercice, disabled, heigh, javascript, name, readOnly, selected, show_end_date, show_start_date, size, table, value, and width.

Member Function Documentation

◆ display()

IPeriod::display ( )

print in html the readonly value of the widget

Definition at line 166 of file iperiod.class.php.

167 {
168 $r="not implemented ".__FILE__.":".__LINE__;
169 return $r;
170
171 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r

References $r.

Referenced by input().

◆ input()

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

show the input html for a periode

Parameters
$p_nameis the name of the widget
$p_valueis the default value
$p_exerciceis the exercice, if not set then the user preference is used
Returns
string containing html code for the HTML

Definition at line 69 of file iperiod.class.php.

70 {
71 foreach (array('type','cn') as $a)
72 {
73 if ( ! isset ($this->$a) ) throw new Exception('Variable non définie [ '.$a.']');
74 }
75 $this->name=($p_name==null)?$this->name:$p_name;
76 $this->value=($p_value==null)?$this->value:$p_value;
77 if ( $this->readOnly==true) return $this->display();
78
79 switch ($this->type)
80 {
81 case CLOSED:
82 $sql_closed="where p_closed=true and p_central = false ";
83 break;
84 case OPEN:
85 $sql_closed="where p_closed=false";
86 break;
87 case NOTCENTRALIZED:
88 $sql_closed="where p_closed=true and p_central = false ";
89 break;
90 case ALL:
91 $sql_closed="";
92 break;
93 default:
94 throw new Exception("invalide p_type in ".__FILE__.':'.__LINE__);
95 }
96 $sql="select p_id,to_char(p_start,'DD.MM.YYYY') as p_start_string,
97 to_char(p_end,'DD.MM.YYYY') as p_end_string
98 from parm_periode
99 $sql_closed ";
100
101 $cond="";
102
103
104 /* Create a filter on the current exercice */
105 if ( ! isset($this->filter_year) || (isset($this->filter_year) && $this->filter_year==true))
106 {
107 if ( $this->exercice=='')
108 {
109 if (! isset($this->user) ) throw new Exception (__FILE__.':'.__LINE__.' user is not set');
110 $this->exercice=$this->user->get_exercice();
111 }
112
113 $cond='';
114 if ( $sql_closed=="") $and=" where " ; else $and=" and ";
115 if ($this->type == 'all' ) $cond=$and.' true ';
116 $cond.=" $and p_exercice='".sql_string($this->exercice)."'";
117 }
118
119 $sql.=$cond." order by p_start,p_end";
120
121 $Res=$this->cn->exec_sql($sql);
122 $Max=$this->cn->size($Res);
123 if ( $Max == 0 ) throw new Exception(_('Aucune periode trouvée'),1);
124 $ret=sprintf('<SELECT NAME="%s" id="%s" %s>',
125 $this->name,
126 $this->id,
127 $this->javascript)
128 ;
129 for ( $i = 0; $i < $Max;$i++)
130 {
131 $l_line=$this->cn->fetch($i);
132 if ( $this->value==$l_line['p_id'] )
133 $sel="SELECTED";
134 else
135 $sel="";
136
137 if ( $this->show_start_date == true && $this->show_end_date==true )
138 {
139 $ret.=sprintf('<OPTION VALUE="%s" %s>%s - %s',$l_line['p_id']
140 ,$sel
141 ,$l_line['p_start_string']
142 ,$l_line['p_end_string']);
143 }
144 else if ($this->show_start_date == true )
145 {
146 $ret.=sprintf('<OPTION VALUE="%s" %s>%s ',$l_line['p_id']
147 ,$sel
148 ,$l_line['p_start_string']
149 );
150 }
151 else if ( $this->show_end_date == true )
152 {
153 $ret.=sprintf('<OPTION VALUE="%s" %s>%s ',$l_line['p_id']
154 ,$sel
155 ,$l_line['p_end_string']
156 );
157 }
158
159 }
160 $ret.="</SELECT>";
161 return $ret;
162
163
164 }
$input_from filter_year
Definition: balance.inc.php:67
$input_from user
Definition: balance.inc.php:68
$input_from cn
Definition: balance.inc.php:66
$input_from type
Definition: balance.inc.php:65
display()
print in html the readonly value of the widget
const OPEN
Definition: constant.php:201
const NOTCENTRALIZED
Definition: constant.php:203
const CLOSED
Definition: constant.php:202
const ALL
Definition: constant.php:204
$Res

References $a, $i, $Max, $Res, $ret, $sel, $sql, ALL, CLOSED, cn, display(), filter_year, javascript, name, NOTCENTRALIZED, OPEN, readOnly, show_end_date, show_start_date, type, user, and value.

+ Here is the call graph for this function:

◆ test_me()

static IPeriod::test_me ( )
static

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

173 {
174 }

Field Documentation

◆ $cn

IPeriod::$cn

$cn is the database connection

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

◆ $filter_year

IPeriod::$filter_year

$filter_year make a filter on the default exercice by default yes

Definition at line 40 of file iperiod.class.php.

◆ $show_end_date

IPeriod::$show_end_date

$show_end_date is not set or false, do not show the end date

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

◆ $show_start_date

IPeriod::$show_start_date

$show_start_date is not set or false, do not show the start date

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

◆ $type

IPeriod::$type

$type the type of the periode OPEN CLOSE NOTCENTRALIZED or ALL

Definition at line 36 of file iperiod.class.php.

◆ $user

IPeriod::$user

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


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