noalyss Version-9
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 221 of file noalyss_appearance.class.php.

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

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 323 of file noalyss_appearance.class.php.

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

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 287 of file noalyss_appearance.class.php.

287 : array
288 {
289 return self::$aCSSColor;
290 }

◆ getACSSColorName()

static Noalyss_Appearance::getACSSColorName ( )
static
Returns
array

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

303 : array
304 {
305 return self::$aCSSColorName;
306 }

◆ input_form()

Noalyss_Appearance::input_form ( )

Build the HTML string for inputing the color.

Returns
string

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

247 {
248 $str = "";
249 $str.=$this->title(_("(1) Général"));
250 $str .= $this->build_input_row('BODY');
251 $str .= $this->build_input_row('FONT-DEFAULT');
252
253 $str.=$this->title(_("(2) En-tête dossier"));
254 $str .= $this->build_input_row('FOLDER');
255 $str .= $this->build_input_row('FONT-FOLDER');
256
257 $str.=$this->title('(3)'._("Titre"));
258 $str .= $this->build_input_row('H2');
259
260 $str.=$this->title('(4)'._("Menu principal"));
261 $str .= $this->build_input_row('MENU1');
262 $str .= $this->build_input_row('FONT-MENU1');
263 $str .= $this->build_input_row('MENU1-SELECTED');
264
265 $str.=$this->title('(5)'._("Sous-Menu"));
266 $str .= $this->build_input_row('MENU2');
267 $str .= $this->build_input_row('FONT-MENU2');
268
269 $str.=$this->title('(6)'._("Tableau"));
270 $str .= $this->build_input_row('FONT-TABLE');
271 $str .= $this->build_input_row('TR-ODD');
272 $str .= $this->build_input_row('TR-EVEN');
273 $str .= $this->build_input_row('FONT-TABLE-HEADER');
274
275
276 $str.=$this->title('(7)'._("Boîte de dialogue"));
277 $str .= $this->build_input_row('INNER-BOX');
278 $str .= $this->build_input_row('INNER-BOX-TITLE');
279
280 $str.=$this->input_reset();
281 return $str;
282 }
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 197 of file noalyss_appearance.class.php.

198 {
199 $r="";
200 $label=_("Cocher pour remettre les couleurs d'origine");
201 $chk=new ICheckBox("reset_color",1);
202
203 $str_reset=$chk->input();
204 $r.=<<<EOF
205<div class="form-group">
206 <label for="reset_color">
207 {$label}
208</label>
209 {$str_reset}
210</div>
211EOF;
212 return $r;
213
214 }
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 .nav-link:hover {
174 background-color:{$menu1_selected};
175 }
176 table.sortable, table.table_large, table.result ,table.resultfooter {
177 color:{$font_table} !important;
178 }
179 table.sortable th, table.table_large th, table.result th ,table.resultfooter th {
180 color:{$font_table_header};
181 }
182 tr.odd,div.inner_box tr.odd,div.box tr.odd {
183 background-color: {$tr_odd};
184 }
185 #calc1 , div.inner_box , div.box, #add_todo_list , div.add_todo_list,body.op_detail_frame, div.op_detail_frame {
186 background-color:{$inner_box};
187 }
188 tr.even {
189 background-color: {$tr_even} ;
190 }
191 </style>
192
193EOF;
194
195 }
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

References color, load(), and style.

+ Here is the call graph for this function:

◆ reset()

Noalyss_Appearance::reset ( )

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

317 {
318 $this->aColor=self::$aCSSColor ;
319 }

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 295 of file noalyss_appearance.class.php.

295 : void
296 {
297 self::$aCSSColor = $aCSSColor;
298 }

References $aCSSColor.

◆ setACSSColorName()

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

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

311 : void
312 {
313 self::$aCSSColorName = $aCSSColorName;
314 }

References $aCSSColorName.

◆ title()

Noalyss_Appearance::title ( $p_string)
private

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

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

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' => '#ffffff',
'MENU2' => '#3d3d87',
'MENU1-SELECTED' => '#7191ea',
'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' => '#ffffff',
'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: