noalyss Version-9
Public Member Functions
Profile_Menu Class Reference

Manage the menu of a profile. More...

+ Inheritance diagram for Profile_Menu:
+ Collaboration diagram for Profile_Menu:

Public Member Functions

 __construct ($p_cn, $p_id=-1)
 
 available_profile ()
 Show the available profile for the profile $p_id, it concerns only the action of management (action-gestion) More...
 
 available_repository ()
 Show the available repository for the profile $p_id. More...
 
 display_module ($ap_module)
 Display the module, with a javascript inside to show the menu contained in the module Used for setting the configuration. More...
 
 display_module_menu ($p_module_id, $p_level)
 Display all menu and submenu of a module. More...
 
 display_profile_menu_detail ()
 Show a table with all the menu and the type. More...
 
 mobile_device ()
 menu for device More...
 
 printing ()
 display all the accessible export of a profile $p_id More...
 
 sub_menu ($resource, $p_id)
 Display the content of a profile menu for printing. More...
 
- Public Member Functions inherited from Profile_Menu_sql
 __construct (&$p_cn, $p_id=-1)
 
- Public Member Functions inherited from Table_Data_SQL
 __construct ($p_cn, $p_id=-1)
 
 build_query ()
 Build the SQL select statement for querying the object and returns it. More...
 
 column_update ($column_expr, $value)
 update the value of a column with an expression for $value for the current record More...
 
 count ($p_where="", $p_array=null)
 return the number of count in the table corresponding to the where condition More...
 
 delete ()
 
 exist ()
 Count the number of record with the id ,. More...
 
 get_all_to_array ($p_key_col, $p_cond="", $p_array=NULL)
 Get all the row and use the p_key_code are the key value of array. More...
 
 insert ()
 
 load ()
 Load the current row return false if not found. More...
 
 seek ($cond='', $p_array=null)
 retrieve array of object thanks a condition More...
 
 update ()
 
- Public Member Functions inherited from Data_SQL
 __construct (DatabaseCore $p_cn, $p_id=-1)
 
 __toString ()
 
 collect_objects ($cond='', $p_array=null)
 return an array of objects. More...
 
 count ($p_where="", $p_array=null)
 
 delete ()
 
 exist ()
 Count the number of record with the id ,. More...
 
 from_array ($p_array)
 Transform an array into object. More...
 
 get ($p_string)
 get the value thanks the colum name and not the alias (name). More...
 
 get_cn ()
 
 get_info ()
 
 get_name ()
 
 get_object ($p_ret, $idx)
 
 get_pk_value ()
 
 get_primary_key ()
 
 get_type ()
 
 getp ($p_string)
 set the value thanks the alias name instead of the colum name More...
 
 insert ()
 
 load ()
 Load the current row return false if not found. More...
 
 next ($ret, $i)
 get_seek return the next object, the return of the query must have all the column of the object More...
 
 save ()
 Insert or update : if the row already exists, update otherwise insert. More...
 
 seek ($cond='', $p_array=null)
 retrieve array of object thanks a condition More...
 
 set ($p_string, $p_value)
 set the value thanks the colum name and not the alias (name) More...
 
 set_cn ($cn)
 
 set_name ($name)
 
 set_pk_value ($p_value)
 
 set_primary_key ($primary_key)
 
 set_type ($type)
 
 setp ($p_string, $p_value)
 set the value thanks the alias name instead of the colum name More...
 
 to_array ($prefix="")
 Turn an object (row) into an array, and the key could be prefixed with $prefix. More...
 
 to_row ($p_array)
 turns a row fetched from the DB into a SQL object in updating all his attribute More...
 
 update ()
 
 verify ()
 

Additional Inherited Members

- Data Fields inherited from Data_SQL
 $cn
 
 $date_format
 Type of the data. More...
 
 $default
 defaullt date format More...
 
 $name
 Database connection. More...
 
 $primary_key
 Array of logical and real name. More...
 
 $table
 
 $type
 Column name of the primary key. More...
 

Detailed Description

Manage the menu of a profile.

Definition at line 33 of file profile_menu.class.php.

Constructor & Destructor Documentation

◆ __construct()

Profile_Menu::__construct (   $p_cn,
  $p_id = -1 
)

Reimplemented from Table_Data_SQL.

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

38 {
39 $this->cn=$p_cn;
40 parent::__construct($p_cn, $p_id);
41 }
$input_from cn
Definition: balance.inc.php:66

References $p_id, and cn.

Member Function Documentation

◆ available_profile()

Profile_Menu::available_profile ( )

Show the available profile for the profile $p_id, it concerns only the action of management (action-gestion)

Parameters
$p_idis the profile p_id

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

237 {
238 $array=$this->cn->get_array("
239 select p.p_id,p.p_name,s.p_granted,s.ua_id,s.ua_right
240 from profile as p
241 join user_sec_action_profile as s on (s.p_granted=p.p_id)
242 where s.p_id=$1
243 union
244 select p2.p_id, p2.p_name,null,null,'X'
245 from profile as p2
246 where
247 p2.p_id not in (select p_granted from user_sec_action_profile where p_id = $1) order by p_name;
248 ", array($this->p_id));
249 $aright_value=array(
250 array('value'=>'R', 'label'=>_('Lecture')),
251 array('value'=>'W', 'label'=>_('Ecriture et suppression')),
252 array('value'=>'O', 'label'=>_('Ecriture')),
253 array('value'=>'X', 'label'=>_('Aucun accès'))
254 );
255 require_once NOALYSS_TEMPLATE.'/user_sec_profile.php';
256 }
$profile p_id

References $array, cn, and p_id.

◆ available_repository()

Profile_Menu::available_repository ( )

Show the available repository for the profile $p_id.

Parameters
$p_idis the profile p_id

Definition at line 262 of file profile_menu.class.php.

263 {
264 $array=$this->cn->get_array("
265 select p.r_id,p.r_name,s.ur_id,s.ur_right
266 from stock_repository as p
267 join profile_sec_repository as s on (s.r_id=p.r_id)
268 where s.p_id=$1
269 union
270 select p2.r_id, p2.r_name,null,'X'
271 from stock_repository as p2
272 where
273 p2.r_id not in (select r_id from profile_sec_repository where p_id = $1) order by r_name;
274 ", array($this->p_id));
275 $aright_value=array(
276 array('value'=>'R', 'label'=>_('Lecture')),
277 array('value'=>'W', 'label'=>_('Ecriture')),
278 array('value'=>'X', 'label'=>_('Aucun accès'))
279 );
280 require_once NOALYSS_TEMPLATE.'/profile_sec_repository.php';
281 }

References $array, cn, and p_id.

◆ display_module()

Profile_Menu::display_module (   $ap_module)

Display the module, with a javascript inside to show the menu contained in the module Used for setting the configuration.

Parameters
$ap_module$array of module received from display_profile_menu_detail
See also
Profile_menu::display_profile_menu_detail

Definition at line 167 of file profile_menu.class.php.

168 {
169 include NOALYSS_TEMPLATE.'/profile_menu_display_module.php';
170 }

Referenced by display_profile_menu_detail().

◆ display_module_menu()

Profile_Menu::display_module_menu (   $p_module_id,
  $p_level 
)

Display all menu and submenu of a module.

See also
display_profile_module

Definition at line 177 of file profile_menu.class.php.

178 {
179 // Get the submenu
180 $a_module=$this->cn->get_array('
181 SELECT pm_id,
182 me_code,
183 me_code_dep,
184 p_id,
185 p_order,
186 p_type_display,
187 pm_default,
188 me_menu,
189 me_file,
190 me_url,
191 me_javascript,
192 me_parameter,
193 me_description
194 FROM profile_menu
195 join menu_ref using (me_code)
196 where
197 p_id = $1 and
198 pm_id_dep = $2 order by p_order',
199 array($this->p_id, $p_module_id));
200 require NOALYSS_TEMPLATE.'/profile_menu_display_submenu.php';
201 }
$a_module[$i]['p_order']

References $a_module, cn, and p_id.

◆ display_profile_menu_detail()

Profile_Menu::display_profile_menu_detail ( )

Show a table with all the menu and the type.

Parameters
type$p_idprofile.p_id

Definition at line 109 of file profile_menu.class.php.

110 {
111 $a_module=$this->cn->get_array("
112 SELECT pm_id,
113 pm.me_code,
114 me_code_dep,
115 p_id,
116 p_order,
117 p_type_display,
118 pm_default,
119 pm_desc,
120 me_menu,
121 me_description,
122 me_url,
123 me_file,
124 me_javascript
125 FROM profile_menu as pm
126 join profile_menu_type on (p_type_display=pm_type)
127 join menu_ref as mr on (mr.me_code=pm.me_code)
128 where
129 p_id=$1 and p_type_display='M'
130 order by p_order asc
131 ", array($this->p_id));
132 ////////////////////////////////////////////////////////////
133 // With a module
134 ////////////////////////////////////////////////////////////
136
137 //*******************************************
138 // show also menu without a module
139 //*******************************************
140 $ret=$this->cn->exec_sql("
141 SELECT pm_id,
142 pm.me_code,
143 me_code_dep,
144 p_id,
145 p_order,
146 p_type_display,
147 pm_default,
148 pm_desc,
149 me_menu,
150 me_description
151 FROM profile_menu as pm
152 join profile_menu_type on (p_type_display=pm_type)
153 join menu_ref as mr on (mr.me_code=pm.me_code)
154 where
155 p_id=$1 and p_type_display not in ('M','P') and me_code_dep is null
156 order by p_order asc
157 ", array($this->p_id));
158 }
display_module($ap_module)
Display the module, with a javascript inside to show the menu contained in the module Used for settin...

References $a_module, $ret, cn, display_module(), and p_id.

+ Here is the call graph for this function:

◆ mobile_device()

Profile_Menu::mobile_device ( )

menu for device

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

285 {
287 $profile_mobile->display_table("where p_id=$1 order by pmo_order",[ $this->p_id ]);
288 echo create_script("profile_menu_mtable.param_add({profile_id:{$this->p_id}});");
289 }
static build($p_id, $profile_id)
create_script($p_string)
create the HTML for adding the script tags around of the script
$profile_mobile

References $profile_mobile, Mobile_Device_MTable\build(), create_script(), and p_id.

+ Here is the call graph for this function:

◆ printing()

Profile_Menu::printing ( )

display all the accessible export of a profile $p_id

Parameters
type$p_idprofile.p_id

Definition at line 207 of file profile_menu.class.php.

208 {
209 $ret=$this->cn->exec_sql("
210 SELECT pm_id,
211 pm.me_code,
212 me_code_dep,
213 p_id,
214 p_order,
215 p_type_display,
216 pm_default,
217 pm_desc,
218 me_menu,
219 me_description
220 FROM profile_menu as pm
221 join profile_menu_type on (p_type_display=pm_type)
222 join menu_ref as mr on (mr.me_code=pm.me_code)
223 where
224 p_id=$1 and me_type='PR'
225 order by p_order asc
226 ", array($this->p_id));
227 // Menu by module
229 $this->sub_menu($ret, $this->p_id);
230 }
static id()
return the 'gDossier' value after a check
sub_menu($resource, $p_id)
Display the content of a profile menu for printing.

References $gDossier, $ret, cn, Dossier\id(), p_id, and sub_menu().

+ Here is the call graph for this function:

◆ sub_menu()

Profile_Menu::sub_menu (   $resource,
  $p_id 
)

Display the content of a profile menu for printing.

Parameters
type$resource
type$p_id

Definition at line 48 of file profile_menu.class.php.

49 {
50 if (Database::num_row($resource)!=0)
51 {
52 ////
53 // If there are submenus
55 echo '<td>';
56 for ($e=0; $e<Database::num_row($resource); $e++)
57 {
58 $menu=Database::fetch_array($resource, $e);
59 $me_code=$menu['me_code'];
60
61 $me_code_dep=$menu['me_code_dep'];
62
63 $mp_type=$menu['p_type_display'];
64
65 $me_menu=$menu['me_menu'];
66 $me_desc=$menu['me_description'];
67 $me_def=($menu['pm_default']=='1')?'<span class="notice" style="display:inline">Défaut</span>':'';
68 ?>
69 <li id="sub<?php echo $menu['pm_id'] ?>">
70
71 <?php echo $me_code ?>
72 <?php echo $me_menu ?>
73 <?php echo $me_desc ?> <?php echo $me_def ?>
74 <?php $ret2=$this->cn->exec_sql("
75 SELECT pm_id,
76 pm.me_code,
77 me_code_dep,
78 p_id,
79 p_order,
80 p_type_display,
81 pm_default,
82 pm_desc,
83 me_menu,
84 me_description
85 FROM profile_menu as pm
86 join profile_menu_type on (p_type_display=pm_type)
87 join menu_ref as mr on (mr.me_code=pm.me_code)
88 where
89 p_id=$1 and me_code_dep=$2
90 order by p_order asc
91 ", array($p_id, $me_code)); ?>
92 <span>
93 <?php
94 echo Icon_Action::trash(uniqid(), sprintf (" remove_sub_menu(%d,%d)", Dossier::id(),
95 $menu['pm_id']))
96 ?>
97 </span>
98 <?php
99 echo "</li>";
100 } //end loop e
101 echo '</ul>';
102 } // end if
103 }
span($p_string, $p_extra='')
Definition: ac_common.php:43
$input_from id
Definition: balance.inc.php:63
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
static trash($p_id, $p_javascript)
Display the icon of a trashbin.

References $e, $gDossier, $me_code, $menu, $p_id, cn, DatabaseCore\fetch_array(), id, Dossier\id(), DatabaseCore\num_row(), span(), and Icon_Action\trash().

Referenced by printing().

+ Here is the call graph for this function:

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