noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
cfgplugin.inc.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS isfree software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS isdistributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19// Copyright (2014) Author Dany De Bontridder <dany@alchimerys.be>
20
21if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
22
23/**
24 * @file
25 * @brief Automatic installation of plugins and activation
26 */
27global $cn;
28global $http;
29$dossier_id=Dossier::id();
30/******************************************************************************
31 * Scan the plugin folder and file in each subfolder a property file and
32 * store them into an array a_plugin
33 ******************************************************************************
34 */
35$dirscan=scandir(NOALYSS_PLUGIN);
37$a_plugin=array();
38for ($e=0;$e<$nb_dirscan;$e++) {
39 if ($dirscan[$e] != '.' && $dirscan[$e]!='..' && is_dir(NOALYSS_PLUGIN.'/'.$dirscan[$e])) {
40 $dir_plugin=$dirscan[$e];
41 if (file_exists(NOALYSS_PLUGIN.'/'.$dir_plugin.'/plugin.xml')) {
42
43 $extension=Extension::read_definition(NOALYSS_PLUGIN.'/'.$dir_plugin.'/plugin.xml');
44 for ($i=0;$i<count($extension);$i++)
45 {
46 $a_plugin[]=clone $extension[$i];
47 try {
48 $extension[$i]->save_plugin();
49
50 } catch (\Exception $e) {
51 echo_warning($e->getMessage());
52 }
53
54 }
55
56 }
57 }
58}
60
61/**
62 * available profiles
63 */
64$a_profile=$cn->get_array('select p_id,p_name from profile where p_id > 0 order by p_name');
66
67/******************************************************************************
68 * Display the Plugin and for each profile were it is installed or not
69 ******************************************************************************/
70
71
72?>
73<div class="content">
74 <?php echo _('Nombre de plugins trouvés')." ".$nb_plugin; ?>
75
76 <?php echo _('Filtre');echo " ";echo HtmlInput::filter_table("plugin_install_tb", '0,1,2,3', 1);?>
77 <table id="plugin_install_tb" class="result">
78 <tr>
79 <th><?php echo _('Extension')?></th>
80 <th><?php echo _('Menu')?></th>
81 <th><?php echo _('Description')?></th>
82 <th><?php echo _('Chemin')?></th>
83 <th><?php echo _('Disponible')?></th>
84 </tr>
85 <?php for ($e=0;$e<$nb_plugin;$e++) :
86 //-----
87 $a_profile=$cn->get_array("select distinct
88 p_id,p_name,
89 (select count(*) from profile_menu as a where a.p_id=b.p_id and me_code=$1 )+
90 (select count(*) from menu_ref as c join profile_menu as d on (d.me_code=c.me_code) where d.p_id=b.p_id and me_file=$2 ) as cnt
91 from profile as b
92 where p_id > 0
93 order by p_name",array($a_plugin[$e]->me_code,$a_plugin[$e]->me_file));
94
95 $class=($e%2==0)?'odd':'even';
96 ?>
97 <tr class="<?php echo $class?>">
98 <td>
99 <?php echo h($a_plugin[$e]->me_code); ?>
100 </td>
101 <td>
102 <?php echo h($a_plugin[$e]->me_menu); ?>
103 </td>
104 <td>
105 <?php echo h($a_plugin[$e]->me_description);?>
106 <span style="display:block; font-style: italic">
107 <?php
108 printf(_("Installé par défaut dans le menu <span class=\" cell highlight\">AD: %s </span>"),$a_plugin[$e]->depend);
109 ?>
110 </span>
111 </td>
112 <td>
113 <?php echo h($a_plugin[$e]->me_file); ?>
114 </td>
115 <td>
116 <?php
117
118 for ($w=0;$w<$nb_profile;$w++) :
119 ?>
120 <span style="display:block">
121
122 <?php
123 // $a=new ICheckBox('plugin['.$a_plugin[$e]->me_code.']['.$a_profile[$w]['p_id'].']');
124 $name=uniqid($a_plugin[$e]->me_code);
126
127 $ckpl->set_attribute("gDossier", $dossier_id);
128 $ckpl->set_attribute("me_code", $a_plugin[$e]->me_code);
129 $ckpl->set_attribute("pr_id", $a_profile[$w]['p_id']);
130 $ckpl->set_attribute("dep", $a_plugin[$e]->depend);
131 $ckpl->set_attribute("order", $a_plugin[$e]->order);
132 $ckpl->javascript=' onchange="activate_plugin(this)"';
133 if ($a_profile[$w]['cnt']>0) $ckpl->selected=true;
134 echo $ckpl->input();
135 echo $a_profile[$w]['p_name'];
136 ?>
137 </span>
138 <?php
140 ?>
141 </td>
142 </tr>
143
144 <?php endfor; ?>
145 </table>
146
147</div>
148
th($p_string, $p_extra='', $raw='')
Definition ac_common.php:58
span($p_string, $p_extra='')
Definition ac_common.php:43
echo_warning($p_string)
warns
tr($p_string, $p_extra='')
Definition ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition ac_common.php:83
$dossier_id
catch(\Exception $e) $extension
h( $row[ 'oa_description'])
$opd_description style
foreach($array as $idx=> $m) $w
_("actif, passif,charge,...")
$dirscan
$nb_dirscan
$a_profile
available profiles
$a_plugin
font $a_plugin[ $e] depend
$nb_profile
for($e=0;$e< $nb_dirscan;$e++) $nb_plugin
static read_definition($p_file)
Parse a XML file to complete an array of extension objects, in the plugin.xml file ,...
Html Input.
$all table