43require_once NOALYSS_INCLUDE.
'/database/menu_ref_sql.class.php';
44require_once NOALYSS_INCLUDE.
'/database/profile_sql.class.php';
50 array(
'AMORTIS',
'BACKNOADM',
'COPRO',
'IMPCARD',
51 'IMPORTBANK',
'INVOICING',
'LISTING',
52 'MODOP',
'RAPAV',
'SAV',
53 'TOOLPCMN',
'TOOLS',
'TRANSFORM',
59 if (trim($this->me_code)==
"")
60 throw new Exception(
'Le code ne peut pas être vide');
61 if (trim($this->me_menu)==
"")
62 throw new Exception(
'Le nom ne peut pas être vide');
63 if (trim($this->me_file)==
"")
64 throw new Exception(
'Chemin incorrect');
65 if (file_exists(NOALYSS_PLUGIN.
'/'.$this->me_file)==
false)
66 throw new Exception(
"$this->me_code $this->me_file".
'Extension non trouvée, le chemin est-il correct?');
73 $this->me_code=strtoupper($p_what);
74 if ($this->load()==
false)
87 $cnt=$this->
cn->get_value(
"select count(*) from menu_ref
88 join profile_menu using (me_code)
89 join profile_user using (p_id)
92 and user_name=$2", array($this->me_code, $p_login));
105 $sql=
"select DISTINCT me_code as value, me_menu as label from ".
106 " menu_ref join profile_menu using (me_code)
107 join profile_user using (p_id) where ".
108 " user_name=$1 and me_type='PL' ORDER BY ME_MENU";
109 $a=
$cn->get_array(
$sql, array($_SESSION[SESSION_KEY.
'g_user']));
125 alert(_(
'Cette extension ne fonctionne pas sur cette version de NOALYSS'.
126 ' Veuillez mettre votre programme a jour. Version minimum ').
$i);
143 $p_module=$this->depend;
148 throw new Exception(_(
'Profil inexistant'), 10);
155 throw new Exception(_(
'Module inexistant'), 20);
158 $dep_id=
$cn->get_array(
'select pm_id from profile_menu
161 and me_code = $2 ', array(
$p_id, $p_module));
165 throw new Exception(_(
'Pas de menu ').$p_module, 30);
174 $profil_menu->me_code_dep=$p_module;
175 $profil_menu->p_type_display=
'S';
176 $profil_menu->p_id=
$p_id;
177 $profil_menu->pm_id_dep=$dep_id[
$i][
'pm_id'];
178 $profil_menu->pm_default=0;
181 $cnt=$profil_menu->count(
' where pm_id_dep=$3 and p_id=$1 and me_code = $2',
182 array(
$p_id, $this->me_code, $dep_id[
$i][
'pm_id']));
185 $profil_menu->insert();
194 $cn->exec_sql(
'delete from profile_menu where (me_code = $1 or me_code in (select me_code from menu_ref where me_file=$2)) and p_id=$3',
195 array($this->me_code, $this->me_file,
$p_id));
211 $this->me_code=strtoupper($this->me_code);
212 $count=$this->
cn->get_value(
"select count(*) from menu_ref where me_code=$1", array($this->me_code));
214 throw new Exception(
"Doublon");
219 catch (Exception $exc)
221 echo
alert($exc->getMessage());
235 catch (Exception $exc)
237 echo
alert($exc->getMessage());
249 catch (Exception $exc)
251 echo
alert($exc->getMessage());
261 $a_ext=array(
"tva_belge",
"amortissement",
"impdol",
"coprop",
"importbank");
262 for (
$i=0;
$i<count($a_ext);
$i++)
266 $p_cn->
exec_sql(
"drop schema ".$a_ext[
$i].
" cascade");
279 global
$g_user, $version_plugin;
282 if ( in_array($p_plugin_code, self::aStandard_plugin) && SITE_UPDATE_PLUGIN!=
"")
284 $update=@file_get_contents(SITE_UPDATE_PLUGIN);
285 if ($update>$version_plugin)
287 echo
'<div id="version_plugin_div_id" class="inner_box" style="position:absolute;zindex:2;top:5px;left:37.5%;width:25%">';
288 echo
'<p class="notice">';
289 echo
"Mise à jour disponible des plugins pour NOALYSS, version actuelle : $update votre version $version_plugin";
291 echo
'<p style="text-align:center">'.
292 '<a id="version_plugin_button" class="button" onclick="$(\'version_plugin_div_id\').remove()">'.
312 if (!isset(
$xml->plugin))
313 throw new Exception(_(
'Manque plugin'), 1);
318 if (!isset(
$xml->plugin[
$i]->name))
319 throw new Exception(_(
'Manque nom'), 1);
320 if (!isset(
$xml->plugin[
$i]->description))
321 throw new Exception(_(
'Manque description'), 0);
322 if (!isset(
$xml->plugin[
$i]->code))
323 throw new Exception(_(
'Manque code'), 1);
324 if (!isset(
$xml->plugin[
$i]->author))
325 throw new Exception(_(
'Manque auteur'), 0);
326 if (!isset(
$xml->plugin[
$i]->root))
327 throw new Exception(_(
'Manque répertoire racine'), 1);
328 if (!isset(
$xml->plugin[
$i]->file))
329 throw new Exception(_(
'Manque fichier à inclure'), 1);
330 if (!isset(
$xml->plugin[
$i]->version))
331 throw new Exception(_(
"Manque version de l'extension"), 1);
333 if (!isset(
$xml->plugin[
$i]->depend))
334 $xml->plugin[
$i]->depend=
"EXT";
335 if (!isset(
$xml->plugin[
$i]->order))
336 $xml->plugin[
$i]->order=9000;
339 catch (Exception
$ex)
355 $dom=
new DomDocument(
'1.0');
359 $a_extension=array();
366 $extension->check_xml(
$xml);
368 catch (Exception
$ex)
371 if (
$ex->getCode()==1)
376 $extension->me_file=trim(
$xml->plugin[
$i]->root).
'/'.trim(
$xml->plugin[
$i]->file);
377 $extension->me_code=trim(
$xml->plugin[
$i]->code);
378 $extension->me_description=(isset(
$xml->plugin[
$i]->description))?trim(
$xml->plugin[
$i]->description):
"";
379 $extension->me_description_etendue=(trim(
$xml->plugin[
$i]->author))?trim(
$xml->plugin[
$i]->author):
"";
380 $extension->me_type=
'PL';
381 $extension->me_menu=trim(
$xml->plugin[
$i]->name);
382 $extension->me_parameter=
'plugin_code='.trim(
$xml->plugin[
$i]->code);
383 $extension->depend=(isset(
$xml->plugin[
$i]->depend))?trim(
$xml->plugin[
$i]->depend):
"EXT";
384 $extension->order=(isset(
$xml->plugin[
$i]->order))?trim(
$xml->plugin[
$i]->order):9000;
385 $extension->version=trim(
$xml->plugin[
$i]->version);
386 $extension->noalyss_version=(isset(
$xml->plugin[
$i]->noalyss_version))?trim(
$xml->plugin[
$i]->noalyss_version):8000;
387 $a_extension[]=clone $extension;
401 if (empty($a_me_code ) )
return null;
402 $nb_me_code=count($a_me_code);
404 foreach ($a_extension as $extension) {
405 if ($extension->me_code==
$me_code)
return $extension;
413 $r .=
" me_code " . $this->me_code.PHP_EOL;
414 $r .=
" me_menu.".$this->me_menu.PHP_EOL;
415 $r .=
" version".$this->version.PHP_EOL;
416 $r .=
" noalyss_version".$this->noalyss_version.PHP_EOL;
417 $r .=
" me_file" . $this->me_file.PHP_EOL;
418 $r .=
" me_url" . $this->me_url.PHP_EOL;
419 $r .=
" me_description" . $this->me_description.PHP_EOL;
420 $r .=
" me_parameter" . $this->me_parameter.PHP_EOL;
421 $r .=
" me_javascript" . $this->me_javascript.PHP_EOL;
422 $r .=
" me_type" . $this->me_type.PHP_EOL;
423 $r .=
" me_descrition_etendue" . $this->me_description_etendue.PHP_EOL;
424 return "Extension $r";
437 if ( empty($plugin_code))
return -1;
438 return $extension->version;
echo_warning($p_string)
warns
alert($p_msg, $buffer=false)
alert in javascript
global $g_user
if no group available , then stop
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
for($e=0;$e< $nb_dirscan;$e++) $nb_plugin
exec_sql($p_string, $p_array=null)
send a sql string to the database
contains the class for connecting to Noalyss
manage the extension, it involves the table extension
static check_plugin_version($p_plugin_code)
compare the version of the plugin and the last version , propose to update it if a new version exists
remove_from_profile_menu($p_id)
static clean(Database $p_cn)
remove all the standard plugins schema
static make_array($cn)
make an array of the available plugin for the current user
check_xml(SimpleXMLElement $xml)
Check that the xml contains all the needed information to change them into a extension,...
insert_profile_menu($p_id=1)
insert into the table profile_menu for the given profile id and depending of the module $p_module
insert_plugin()
Insert a plugin into the given profile, by default always insert into EXT.
can_request($p_login)
return 1 if the user given in parameter can access this extension otherwise returns 0
static find_extension_code($a_extension, $access_code)
find the extension with the me_code = last part of access_code
search($p_what)
search a extension, the what is the column (extends_code
static get_version($xml_file, $plugin_code)
retrieve the version of the current plugin
static read_definition($p_file)
Parse a XML file to complete an array of extension objects, in the plugin.xml file ,...
static check_version($i, $p_plugin_code=null)
check the version of the plugin , null stands for one of the standard plugins, it means self::aStanda...
static echo_var($n_level, $msg, $print=true)
Display the value of a var if DEBUGNOALYSS is greater than $n_level, the debugging info has a certain...
Manage the table public.profile.
foreach(array('magic_quotes_gpc', 'magic_quotes_runtime') as $a) $module