Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00022 require_once 'class_extension.php';
00023
00024
00025
00026
00027
00028 global $cn;
00029
00030
00031
00032
00033
00034
00035 $dirscan=scandir('../include/ext/');
00036 $nb_dirscan=count($dirscan);
00037 $a_plugin=array();
00038 for ($e=0;$e<$nb_dirscan;$e++) {
00039 if ($dirscan[$e] != '.' && $dirscan[$e]!='..' && is_dir('../include/ext/'.$dirscan[$e])) {
00040 $dir_plugin=$dirscan[$e];
00041 if (file_exists('../include/ext/'.$dir_plugin.'/plugin.xml')) {
00042
00043 $extension=Extension::read_definition('../include/ext/'.$dir_plugin.'/plugin.xml');
00044 for ($i=0;$i<count($extension);$i++)
00045 {
00046 $a_plugin[]=clone $extension[$i];
00047 }
00048
00049 }
00050 }
00051 }
00052 $nb_plugin=count($a_plugin);
00053
00054
00055
00056
00057 $a_profile=$cn->get_array('select p_id,p_name from profile where p_id > 0 order by p_name');
00058 $nb_profile=count($a_profile);
00059
00060
00061
00062 if ( isset ($_POST['save_plugin'])){
00063
00064 $plugin=HtmlInput::default_value_post('plugin', array());
00065
00066 for ($i=0;$i<$nb_plugin;$i++) {
00067
00068 $code=$a_plugin[$i]->me_code;
00069
00070 for ($e=0;$e<$nb_profile;$e++)
00071 {
00072 $profile=$a_profile[$e]['p_id'];
00073 if ( isset ($plugin[$code][$profile])) {
00074
00075 $count = $cn->get_value("select count(*) from menu_ref where me_code=$1", array($code));
00076 if ( $count == 0 ) {
00077 $a_plugin[$i]->insert();
00078 }
00079 $a_plugin[$i]->insert_profile_menu($profile,'EXT');
00080 } else {
00081
00082 $a_plugin[$i]->remove_from_profile_menu ($profile);
00083 }
00084 }
00085 }
00086 }
00087
00088
00089
00090
00091
00092 ?>
00093 <div class="content">
00094 <?php echo _('Nombre de plugins trouvés')." ".$nb_plugin; ?>
00095 <form method="post">
00096 <table class="result">
00097 <tr>
00098 <th><?php echo _('Extension')?></th>
00099 <th><?php echo _('Menu')?></th>
00100 <th><?php echo _('Description')?></th>
00101 <th><?php echo _('Chemin')?></th>
00102 <th><?php echo _('Disponible')?></th>
00103 </tr>
00104 <?php for ($e=0;$e<$nb_plugin;$e++) :
00105
00106 $a_profile=$cn->get_array("select distinct
00107 p_id,p_name,
00108 (select count(*) from profile_menu as a where a.p_id=b.p_id and me_code=$1 )+
00109 (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
00110 from profile as b
00111 where p_id > 0
00112 order by p_name",array($a_plugin[$e]->me_code,$a_plugin[$e]->me_file));
00113
00114 $class=($e%2==0)?'odd':'even';
00115 ?>
00116 <tr class="<?php echo $class?>">
00117 <td>
00118 <?php echo h($a_plugin[$e]->me_code); ?>
00119 </td>
00120 <td>
00121 <?php echo h($a_plugin[$e]->me_menu); ?>
00122 </td>
00123 <td>
00124 <?php echo h($a_plugin[$e]->me_description); ?>
00125 </td>
00126 <td>
00127 <?php echo h($a_plugin[$e]->me_file); ?>
00128 </td>
00129 <td>
00130 <?php
00131
00132 for ($w=0;$w<$nb_profile;$w++) :
00133 ?>
00134 <span style="display:block">
00135
00136 <?php
00137 $a=new ICheckBox('plugin['.$a_plugin[$e]->me_code.']['.$a_profile[$w]['p_id'].']');
00138 if ($a_profile[$w]['cnt']>0) $a->selected=true;
00139 echo $a->input();
00140 echo $a_profile[$w]['p_name'];
00141 ?>
00142 </span>
00143 <?php
00144 endfor;
00145 ?>
00146 </td>
00147 </tr>
00148
00149 <?php endfor; ?>
00150 </table>
00151 <?php echo HtmlInput::submit('save_plugin', _('Valider')); ?>
00152 </form>
00153 </div>
00154