noalyss Version-9
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Default_Menu Class Reference

Description of class_default_menu. More...

+ Collaboration diagram for Default_Menu:

Public Member Functions

 __construct ()
 
 get ($p_string)
 
 input_value ()
 
 save ()
 
 set ($p_string, $p_value)
 
 verify ()
 

Static Public Member Functions

static test_me ()
 

Private Member Functions

 check_code ($p_string)
 

Private Attributes

 $a_menu_def
 $a_menu_def is an array of Default_Menu_SQL More...
 
 $code
 Possible value. More...
 

Detailed Description

Description of class_default_menu.

Author
dany

Definition at line 28 of file default_menu.class.php.

Constructor & Destructor Documentation

◆ __construct()

Default_Menu::__construct ( )

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

42 {
43 global $cn;
45 $ret = $menu->seek();
46 for ($i = 0; $i < Database::num_row($ret); $i++)
47 {
48 $tmenu = $menu->next($ret, $i);
49 $idx = $tmenu->getp('md_code');
50 $this->a_menu_def[$idx] = $tmenu->getp('me_code');
51 }
52 $this->code = explode(',', 'code_follow,code_invoice,code_feenote',);
53 }
$idx
static num_row($ret)
wrapper for the function pg_num_rows
Description of class_default_menu_sql.

References $cn, $i, $idx, $menu, $ret, and DatabaseCore\num_row().

+ Here is the call graph for this function:

Member Function Documentation

◆ check_code()

Default_Menu::check_code (   $p_string)
private

Definition at line 72 of file default_menu.class.php.

73 {
74 global $cn;
75 $count = $cn->get_value('select count(*) from v_menu_description_favori where '
76 . 'code = $1', array($p_string));
77 if ($count == 0)
78 {
79 throw new Exception('code_inexistant');
80 }
81 }
$count

References $cn, and $count.

Referenced by verify().

◆ get()

Default_Menu::get (   $p_string)

Definition at line 99 of file default_menu.class.php.

100 {
101 return $this->a_menu_def[$p_string];
102 }

◆ input_value()

Default_Menu::input_value ( )

Definition at line 55 of file default_menu.class.php.

56 {
57 $code_invoice = new IText('code_invoice', $this->a_menu_def['code_invoice']);
58 $code_follow = new IText('code_follow', $this->a_menu_def['code_follow']);
59 $code_feenote = new IText('code_feenote', $this->a_menu_def['code_feenote']);
60 echo '<div class="form-group">';
61 echo '<div class="form-text">' .'<label for="code_invoice">'._('Code AD pour création facture depuis gestion').
62 "</label>"."</div>". '<div class="form-text">' .$code_invoice->input() . '</div>';
63
64 echo '<div class="form-text">' .'<label for="code_follow">'._('Code AD pour appel gestion').
65 "</label>"."</div>". '<div class="form-text">' .$code_follow->input() . '</div>';
66
67 echo '<div class="form-text">' .'<label for="code_feenote">'._('Code AD pour création note de frais ou facture achat').
68 "</label>"."</div>". '<div class="form-text">' .$code_feenote->input() . '</div>';
69 echo '</div>';
70 }
Html Input.
Definition: itext.class.php:30

◆ save()

Default_Menu::save ( )

Definition at line 104 of file default_menu.class.php.

105 {
106 global $cn;
107 try
108 {
109 $this->verify();
110 foreach ($this->code as $key => $value)
111 {
112 $cn->exec_sql('update menu_default set me_code=$1 where
113 md_code =$2', array($value,$this->a_menu_def[$value]));
114 }
115 } catch (Exception $e)
116 {
117 record_log($e);
118 echo $e->getMessage();
119 throw $e;
120 }
121 }
record_log($p_message)
Record an error message into the log file of the server.
Definition: ac_common.php:1342

References $cn, $e, $value, record_log(), and verify().

+ Here is the call graph for this function:

◆ set()

Default_Menu::set (   $p_string,
  $p_value 
)

Definition at line 91 of file default_menu.class.php.

92 {
93 if (in_array($p_string, $this->code) == false)
94 {
95 throw new Exception("code_invalid");
96 }
97 $this->a_menu_def[$p_string] = $p_value;
98 }

◆ test_me()

static Default_Menu::test_me ( )
static

Definition at line 123 of file default_menu.class.php.

124 {
126
127 echo h2('Constructor', '');
128 $a = new Default_Menu();
129 echo $g_succeed . 'constructor';
130 if (count($a->a_menu_def) != 2)
131 echo $g_failed;
132 else
133 echo $g_succeed;
134 echo h2("input_value", "");
135 $a->input_value();
136 echo h2('verify');
137 $a->verify();
138 try {
139 echo h2('Verify must failed');
140 $a->set('code_follow', 'MEMNU/MEMEM/');
141 $a->verify();
142 } catch (Exception $e) {
143 echo $g_succeed. " OK ";
144 }
145 echo h2('Verify must succeed');
146 try {
147 $a->set('code_follow', 'GESTION/FOLLOW');
148 $a->verify();
149 echo $g_succeed. " OK ";
150 } catch (Exception $e)
151 {
152 echo $g_failed."NOK";
153 }
154 echo h2('Save');
155 $a->save();
156 echo h2('GET');
157 echo ( assert($a->get('code_follow')=='GESTION/FOLLOW') )?$g_succeed.$a->get('code_follow'):$g_failed.$a->get('code_follow');
158 echo ( assert($a->get('code_invoice')=='COMPTA/VENMENU/VEN') )?$g_succeed.$a->get('code_invoice'):$g_failed.$a->get('code_invoice');
159 echo $a->get('code_invoice');
160 }
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
global $g_user
if no group available , then stop
Description of class_default_menu.
global $g_failed
global $g_succeed

References $a, $cn, $e, $g_failed, $g_succeed, $g_user, and h2().

+ Here is the call graph for this function:

◆ verify()

Default_Menu::verify ( )

Definition at line 83 of file default_menu.class.php.

84 {
85 foreach ($this->code as $code)
86 {
87 $this->check_code($this->a_menu_def[$code]);
88 }
89 }
$code
Possible value.
check_code($p_string)

References $code, and check_code().

Referenced by save().

+ Here is the call graph for this function:

Field Documentation

◆ $a_menu_def

Default_Menu::$a_menu_def
private

$a_menu_def is an array of Default_Menu_SQL

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

◆ $code

Default_Menu::$code
private

Possible value.

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

Referenced by verify().


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