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

Contains some parameters to change appearance of noalyss, the colors are saved into the table parm_appearance. More...

+ Collaboration diagram for Noalyss_Appearance:

Public Member Functions

 __construct ()
 
 from_post ()
 retrieve data from POST and returns true, if nothing is retrieved , returns false
 
 get_color ($p_code)
 
 input_form ()
 Build the HTML string for inputing the color.
 
 input_reset ()
 
 load ()
 
 print_css ()
 
 reset ()
 
 save ()
 
 set_color ($p_code, $p_value)
 

Static Public Member Functions

static getACSSColor ()
 
static getACSSColorName ()
 
static setACSSColor (array $aCSSColor)
 
static setACSSColorName (array $aCSSColorName)
 

Private Member Functions

 build_input_row (string $p_key)
 Build a html string for each color.
 
 title ($p_string)
 

Private Attributes

 $aColor
 

Static Private Attributes

static $aCSSColor
 
static $aCSSColorName = array()
 

Detailed Description

Contains some parameters to change appearance of noalyss, the colors are saved into the table parm_appearance.

Definition at line 32 of file noalyss_appearance.class.php.

Constructor & Destructor Documentation

◆ __construct()

Noalyss_Appearance::__construct ( )

Definition at line 53 of file noalyss_appearance.class.php.

54 {
55 self::$aCSSColorName = ['H2' => _("Titre"),
56 'MENU1' => _("Fond"),
57 'BODY' => _("Fond"),
58 'MENU2' => _("Fond"),
59 'MENU1-SELECTED' => _("Fond item choisi"),
60 'TR-ODD'=>_("Ligne impaire"),
61 'TR-EVEN'=>_("Ligne paire"),
62 'INNER-BOX'=>_("Fond Boîte dialogue"),
63 'INNER-BOX-TITLE'=>_("Fond titre dialogue"),
64 'FOLDER' => _("Fond "),
65 'FONT-MENU1' => _("Caractère"),
66 'FONT-MENU2' => _("Caractère"),
67 'FONT-TABLE' => _("Caractère"),
68 'FONT-DEFAULT' => _("Caractère par défaut"),
69 'FONT-TABLE-HEADER' => _("Caractère en-tête"),
70 'FONT-FOLDER' => _("Caractère")];
71 $this->aColor=self::$aCSSColor;
72 }
_("actif, passif,charge,...")

References _.

Member Function Documentation

◆ build_input_row()

Noalyss_Appearance::build_input_row ( string $p_key)
private

Build a html string for each color.

Parameters
$p_keystring key of $this->aCSSColor
Returns
string

Definition at line 219 of file noalyss_appearance.class.php.

219 :string
220 {
221 $value = $this->aColor[$p_key];
222 $icolor = new IColor($p_key, $value);
223 $label = self::$aCSSColorName[$p_key];
224 $str_icolor = $icolor->input();
225 $str="";
226 $str .= <<<EOF
227<div class="form-group">
228 <label for="{$p_key}">
229 {$label}
230</label>
231 {$str_icolor}
232</div>
233EOF;
234 return $str;
235 }
$ret label

References $label, $str, $value, and label.

Referenced by input_form().

◆ from_post()

Noalyss_Appearance::from_post ( )

retrieve data from POST and returns true, if nothing is retrieved , returns false

Definition at line 321 of file noalyss_appearance.class.php.

322 {
323 $http=new \HttpInput();
324 if ( $http->post("reset_color","number",0) == 1 ) {
325 $this->reset();
326 return true;
327 }
328 foreach (self::$aCSSColorName as $key=>$value) {
329 $color=$http->post($key,'string',"");
330 if (empty($color) ) { return false;}
331 $this->set_color($key,$color);
332 }
333
334 return true;
335 }

References $color, $http, $value, reset(), and set_color().

+ Here is the call graph for this function:

◆ get_color()

Noalyss_Appearance::get_color ( $p_code)
Parameters
string[]$aColor

Definition at line 96 of file noalyss_appearance.class.php.

97 {
98 if (isset($this->aColor[$p_code])) {
99 return $this->aColor[$p_code];
100 }
101 throw new Exception('NAP100: INVALID CODE');
102 }

◆ getACSSColor()

static Noalyss_Appearance::getACSSColor ( )
static
Returns
string[]

Definition at line 285 of file noalyss_appearance.class.php.

285 : array
286 {
287 return self::$aCSSColor;
288 }

◆ getACSSColorName()

static Noalyss_Appearance::getACSSColorName ( )
static
Returns
array

Definition at line 301 of file noalyss_appearance.class.php.

301 : array
302 {
303 return self::$aCSSColorName;
304 }

◆ input_form()

Noalyss_Appearance::input_form ( )

Build the HTML string for inputing the color.

Returns
string

Definition at line 244 of file noalyss_appearance.class.php.

245 {
246 $str = "";
247 $str.=$this->title(_("(1) Général"));
248 $str .= $this->build_input_row('BODY');
249 $str .= $this->build_input_row('FONT-DEFAULT');
250
251 $str.=$this->title(_("(2) En-tête dossier"));
252 $str .= $this->build_input_row('FOLDER');
253 $str .= $this->build_input_row('FONT-FOLDER');
254
255 $str.=$this->title('(3)'._("Titre"));
256 $str .= $this->build_input_row('H2');
257
258 $str.=$this->title('(4)'._("Menu principal"));
259 $str .= $this->build_input_row('MENU1');
260 $str .= $this->build_input_row('FONT-MENU1');
261 $str .= $this->build_input_row('MENU1-SELECTED');
262
263 $str.=$this->title('(5)'._("Sous-Menu"));
264 $str .= $this->build_input_row('MENU2');
265 $str .= $this->build_input_row('FONT-MENU2');
266
267 $str.=$this->title('(6)'._("Tableau"));
268 $str .= $this->build_input_row('FONT-TABLE');
269 $str .= $this->build_input_row('TR-ODD');
270 $str .= $this->build_input_row('TR-EVEN');
271 $str .= $this->build_input_row('FONT-TABLE-HEADER');
272
273
274 $str.=$this->title('(7)'._("Boîte de dialogue"));
275 $str .= $this->build_input_row('INNER-BOX');
276 $str .= $this->build_input_row('INNER-BOX-TITLE');
277
278 $str.=$this->input_reset();
279 return $str;
280 }
build_input_row(string $p_key)
Build a html string for each color.
$anc_filter title

References $str, _, build_input_row(), input_reset(), and title.

+ Here is the call graph for this function:

◆ input_reset()

Noalyss_Appearance::input_reset ( )

Definition at line 195 of file noalyss_appearance.class.php.

196 {
197 $r="";
198 $label=_("Cocher pour remettre les couleurs d'origine");
199 $chk=new ICheckBox("reset_color",1);
200
201 $str_reset=$chk->input();
202 $r.=<<<EOF
203<div class="form-group">
204 <label for="reset_color">
205 {$label}
206</label>
207 {$str_reset}
208</div>
209EOF;
210 return $r;
211
212 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r

References $chk, $label, $r, _, and label.

Referenced by input_form().

◆ load()

Noalyss_Appearance::load ( )

Definition at line 74 of file noalyss_appearance.class.php.

74 :void
75 {
77 $aColor = $cn->get_array("select a_code,a_value from parm_appearance");
78 foreach ($aColor as $key => $value) {
79 $this->aColor[$value['a_code']] = $value['a_value'];
80 }
81
82 }
static connect()

References $aColor, $cn, and $value.

Referenced by print_css().

◆ print_css()

Noalyss_Appearance::print_css ( )

Definition at line 116 of file noalyss_appearance.class.php.

117 {
118 $this->load();
119 $body = $this->aColor['BODY'];
120 $h2 = $this->aColor['H2'];
121 $menu1 = $this->aColor['MENU1'];
122 $menu2 = $this->aColor['MENU2'];
123 $menu1_selected = $this->aColor['MENU1-SELECTED'];
124 $menu1_font = $this->aColor['FONT-MENU1'];
125 $menu2_font = $this->aColor['FONT-MENU2'];
126 $font_table = $this->aColor['FONT-TABLE'];
127 $font_default = $this->aColor['FONT-DEFAULT'];
128 $font_table_header = $this->aColor['FONT-TABLE-HEADER'];
129 $folder_font = $this->aColor['FONT-FOLDER'];
130 $folder = $this->aColor['FOLDER'];
131 $tr_odd=$this->aColor['TR-ODD'];
132 $tr_even=$this->aColor['TR-EVEN'];
133 $inner_box=$this->aColor['INNER-BOX'];
134 $inner_box_title=$this->aColor['INNER-BOX-TITLE'];
135
136 echo <<<EOF
137 <style>
138#top {
139 color:{$folder_font};
140 background-color: transparent;
141 }
142 #dossier,#module {
143 color:{$folder_font};
144 background-color: {$folder};
145 }
146 body {
147 background-color: {$body} !important;
148 color:{$font_default} !important;
149 }
150 h2 , hr {
151 background-color: {$h2} ;
152 }
153 h2.title {
154 background-color: {$inner_box_title} ;
155 }
156 .nav-fill .nav-item {
157 background: {$menu1} !important;
158 color: {$menu1_font} !important;
159 }
160 .nav-fill:hover {
161 color: {$menu1_font} !important;
162 }
163 .nav-level2 {
164 background-color: {$menu2};
165 color:{$menu2_font};
166 }
167 .nav-pills .nav-link.active {
168 background-color: {$menu1_selected} !important;
169 }
170 .nav-pills .nav-link {
171 color: {$menu1_font} !important;
172 }
173
174 table.sortable, table.table_large, table.result ,table.resultfooter {
175 color:{$font_table} !important;
176 }
177 table.sortable th, table.table_large th, table.result th ,table.resultfooter th {
178 color:{$font_table_header};
179 }
180 tr.odd,div.inner_box tr.odd,div.box tr.odd {
181 background-color: {$tr_odd};
182 }
183 #calc1 , div.inner_box , div.box, #add_todo_list , div.add_todo_list,body.op_detail_frame, div.op_detail_frame {
184 background-color:{$inner_box};
185 }
186 tr.even {
187 background-color: {$tr_even} ;
188 }
189 </style>
190
191EOF;
192
193 }
h2($p_string, $p_class="", $raw="")
Definition ac_common.php:68
th($p_string, $p_extra='', $raw='')
Definition ac_common.php:58
tr($p_string, $p_extra='')
Definition ac_common.php:88
return false Description background color
$opd_description style
$all table
$folder
Definition test.php:76

References $folder, color, load(), and style.

+ Here is the call graph for this function:

◆ reset()

Noalyss_Appearance::reset ( )

Definition at line 314 of file noalyss_appearance.class.php.

315 {
316 $this->aColor=self::$aCSSColor ;
317 }

Referenced by from_post().

◆ save()

Noalyss_Appearance::save ( )

Definition at line 84 of file noalyss_appearance.class.php.

85 {
87 foreach ($this->aColor as $key => $value) {
88 $cn->exec_sql("insert into parm_appearance values ($1,$2)
89 on conflict (a_code) do update set a_value =excluded.a_value", [$key, $value]);
90 }
91 }

References $cn, and $value.

◆ set_color()

Noalyss_Appearance::set_color ( $p_code,
$p_value )

Definition at line 103 of file noalyss_appearance.class.php.

104 {
105 $aKey = array_keys($this->aColor);
106 if (!in_array($p_code, $aKey)) {
107 throw new \Exception("NA63: Code invalide ");
108 }
109 if (!preg_match('/^#[a-f0-9]{6}$/i', $p_value)) //hex color is valid
110 {
111 throw new \Exception("NA67: Couleur invalide ");
112 }
113 $this->aColor[$p_code] = $p_value;
114 }

Referenced by from_post().

◆ setACSSColor()

static Noalyss_Appearance::setACSSColor ( array $aCSSColor)
static
Parameters
string[]$aCSSColor

Definition at line 293 of file noalyss_appearance.class.php.

293 : void
294 {
295 self::$aCSSColor = $aCSSColor;
296 }

References $aCSSColor.

◆ setACSSColorName()

static Noalyss_Appearance::setACSSColorName ( array $aCSSColorName)
static
Parameters
array$aCSSColorName

Definition at line 309 of file noalyss_appearance.class.php.

309 : void
310 {
311 self::$aCSSColorName = $aCSSColorName;
312 }

References $aCSSColorName.

◆ title()

Noalyss_Appearance::title ( $p_string)
private

Definition at line 236 of file noalyss_appearance.class.php.

237 {
238 return '<h3 class="">'.h($p_string).'</h3>';
239 }

Field Documentation

◆ $aColor

Noalyss_Appearance::$aColor
private

Definition at line 51 of file noalyss_appearance.class.php.

Referenced by load().

◆ $aCSSColor

Noalyss_Appearance::$aCSSColor
staticprivate
Initial value:
= ['H2' => '#9fbcd6',
'MENU1' => '#000074',
'BODY' => '#fafafa',
'MENU2' => '#3d3d87',
'MENU1-SELECTED' => '#506cb8',
'TR-ODD'=>'#DCE7F5',
'TR-EVEN'=>'#ffffff',
'INNER-BOX'=>'#DCE1EF',
'INNER-BOX-TITLE'=>'#023575',
'FONT-MENU1' => '#ffffff',
'FONT-MENU2' => '#ffffff',
'FONT-TABLE' => '#222bd0',
'FONT-DEFAULT' => '#000074',
'FOLDER' => '#fafafa',
'FONT-TABLE-HEADER' =>'#0C106D',
'FONT-FOLDER' => '#000074']

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

Referenced by setACSSColor().

◆ $aCSSColorName

Noalyss_Appearance::$aCSSColorName = array()
staticprivate

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

Referenced by setACSSColorName().


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