noalyss Version-9
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
Noalyss_Appearance Class Reference
+ Collaboration diagram for Noalyss_Appearance:

Public Member Functions

 __construct ()
 
 from_post ()
 retrieve data from POST and returns true, if nothing is retrieved , returns false More...
 
 get_color ($p_code)
 
 input_form ()
 Build the HTML string for inputing the color. More...
 
 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. More...
 
 title ($p_string)
 

Private Attributes

 $aColor
 

Static Private Attributes

static $aCSSColor
 
static $aCSSColorName = array()
 

Detailed Description

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 }

References $aCSSColor.

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

212 :string
213 {
214 $value = $this->aColor[$p_key];
215 $icolor = new IColor($p_key, $value);
216 $label = self::$aCSSColorName[$p_key];
217 $str_icolor = $icolor->input();
218 $str="";
219 $str .= <<<EOF
220<div class="form-group">
221 <label for="{$p_key}">
222 {$label}
223</label>
224 {$str_icolor}
225</div>
226EOF;
227 return $str;
228 }
$ret label
$str
Definition: fiche.inc.php:91

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

◆ from_post()

Noalyss_Appearance::from_post ( )

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

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

315 {
316 $http=new \HttpInput();
317 if ( $http->post("reset_color","number",0) == 1 ) {
318 $this->reset();
319 return true;
320 }
321 foreach (self::$aCSSColorName as $key=>$value) {
322 $color=$http->post($key,'string',"");
323 if (empty($color) ) { return false;}
324 $this->set_color($key,$color);
325 }
326
327 return true;
328 }
set_color($p_code, $p_value)

References $color, $http, and $value.

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

278 : array
279 {
280 return self::$aCSSColor;
281 }

◆ getACSSColorName()

static Noalyss_Appearance::getACSSColorName ( )
static
Returns
array

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

294 : array
295 {
297 }

◆ input_form()

Noalyss_Appearance::input_form ( )

Build the HTML string for inputing the color.

Returns
string

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

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

References $str, and title.

◆ input_reset()

Noalyss_Appearance::input_reset ( )

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

189 {
190 $r="";
191 $label=_("Cocher pour remettre les couleurs d'origine");
192 $chk=new ICheckBox("reset_color",1);
193
194 $str_reset=$chk->input();
195 $r.=<<<EOF
196<div class="form-group">
197 <label for="reset_color">
198 {$label}
199</label>
200 {$str_reset}
201</div>
202EOF;
203 return $r;
204
205 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
Html Input.
$chk

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

◆ 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, $value, and Dossier\connect().

Referenced by print_css().

+ Here is the call graph for this function:

◆ 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};
158 color: {$menu1_font};
159 }
160 .nav-level2 {
161 background-color: {$menu2};
162 color:{$menu2_font};
163 }
164 .nav-pills .nav-link.active {
165 background-color: {$menu1_selected} !important;
166 }
167 table.sortable, table.table_large, table.result ,table.resultfooter {
168 color:{$font_table} !important;
169 }
170 table.sortable th, table.table_large th, table.result th ,table.resultfooter th {
171 color:{$font_table_header};
172 }
173 tr.odd,div.inner_box tr.odd,div.box tr.odd {
174 background-color: {$tr_odd};
175 }
176 #calc1 , div.inner_box , div.box, #add_todo_list , div.add_todo_list,body.op_detail_frame, div.op_detail_frame {
177 background-color:{$inner_box};
178 }
179 tr.even {
180 background-color: {$tr_even} ;
181 }
182 </style>
183
184EOF;
185
186 }
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
$opd_description style
$all table

References load(), and style.

+ Here is the call graph for this function:

◆ reset()

Noalyss_Appearance::reset ( )

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

308 {
309 $this->aColor=self::$aCSSColor ;
310 }

◆ 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, $value, and Dossier\connect().

+ Here is the call graph for this function:

◆ 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 }

◆ setACSSColor()

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

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

286 : void
287 {
288 self::$aCSSColor = $aCSSColor;
289 }

◆ setACSSColorName()

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

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

302 : void
303 {
304 self::$aCSSColorName = $aCSSColorName;
305 }

◆ title()

Noalyss_Appearance::title (   $p_string)
private

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

230 {
231 return '<h3 class="">'.h($p_string).'</h3>';
232 }

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' => '#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' => '#ffffff',
'FONT-TABLE-HEADER' =>'#0C106D',
'FONT-FOLDER' => '#000074']

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

Referenced by __construct().

◆ $aCSSColorName

Noalyss_Appearance::$aCSSColorName = array()
staticprivate

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


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