noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
ajax_add_menu.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00022 
00023 /**
00024  * @file
00025  * @brief show the form to add a menu
00026  */
00027 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00028 $type=$_GET['type'];
00029 if ( $type=='me')
00030 {
00031 $ame_code_dep=$cn->make_array("
00032         select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') from
00033         menu_ref
00034         where
00035         me_file is null and me_javascript is null and me_url is null and me_type<>'PR' and me_type <> 'SP'
00036         and me_code in (select me_code from profile_menu where p_id=".sql_string($p_id).")".
00037         "       UNION ALL
00038                 select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') from menu_ref
00039         where
00040                 me_code='EXT'
00041         order by 1
00042         ",1);
00043 $ame_code=$cn->make_array("
00044 select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')
00045         ||'('|| case when me_type='SP' then 'Special'
00046                 when me_type='PR' then 'Impression'
00047                 when me_type='PL' then 'Plugin'
00048                 when me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'
00049                 when me_type='ME' then 'Menu'
00050                 else
00051                 me_type
00052                 end||')'
00053         from
00054         menu_ref
00055         order by 1
00056         ");
00057 
00058 $p_order=new INum("p_order","10");
00059 $atype=$cn->make_array("select pm_type,pm_desc from profile_menu_type order by 1");
00060 
00061 $me_code=new ISelect('me_code');
00062 $me_code->value=$ame_code;
00063 
00064 $me_code_dep=new ISelect('me_code_dep');
00065 $me_code_dep->value=$ame_code_dep;
00066 
00067 $p_type=new ISelect('p_type');
00068 $p_type->value=$atype;
00069 $pm_default=new ICheckBox('pm_default');
00070 echo HtmlInput::title_box(_("Nouveau menu"), $ctl);
00071 ?>
00072 <form method="POST" onsubmit="return confirm('<?php echo _('Vous confirmez');?> ?')">
00073         <?php 
00074         echo HtmlInput::hidden('tab','profile_menu_div');
00075         ?>
00076         <?php echo HtmlInput::hidden('p_id',$p_id)?>
00077 <table>
00078 <tr>
00079         <td>Code</td>
00080         <td><?php echo $me_code->input()?></td>
00081 </tr>
00082 <tr>
00083         <td>Dépendant de <?php echo HtmlInput::infobulle(20)?></td>
00084         <td><?php echo $me_code_dep->input()?></td>
00085 </tr>
00086 
00087 <tr>
00088         <td>Ordre d'apparition</td>
00089         <td><?php echo $p_order->input()?></td>
00090 </tr>
00091 <tr>
00092         <td>Menu par défaut</td>
00093         <td><?php echo $pm_default->input()?></td>
00094 </tr>
00095 <tr>
00096         <td>Type de menu</td>
00097         <td><?php echo $p_type->input()?></td>
00098 </tr>
00099 </table>
00100 <?php 
00101 echo HtmlInput::submit('add_menu',"Valider");
00102 echo '</form>';
00103 }
00104 if ($type=='pr')
00105 {
00106 
00107 $ame_code=$cn->make_array("
00108 select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')
00109         from
00110         menu_ref
00111         where me_type='PR'
00112         and me_code not in (select me_code from profile_menu where p_id=".sql_string($p_id).")
00113         order by 1
00114         ");
00115 
00116 $me_code=new ISelect('me_code');
00117 $me_code->value=$ame_code;
00118 
00119         echo HtmlInput::title_box(_("Nouveau menu"), $ctl);
00120         if (count($ame_code)==0)
00121         {
00122                 echo h2(_("Aucune impression disponible à ajouter"),'class="notice"');
00123                 return;
00124         }
00125 ?>
00126 <form method="POST" onsubmit="return confirm('<?php echo _('Vous confirmez ?')?>">
00127         <?php 
00128         echo HtmlInput::hidden('tab','profile_print_div');
00129         ?>
00130         <?php echo HtmlInput::hidden('p_id',$p_id)?>
00131         <?php echo HtmlInput::hidden('p_order',10)?>
00132         <?php echo HtmlInput::hidden('me_code_dep','')?>
00133         <?php echo HtmlInput::hidden('p_type','PR')?>
00134 <table>
00135 <tr>
00136         <td>Code</td>
00137         <td><?php echo $me_code->input()?></td>
00138 </tr>
00139 
00140 </table>
00141 <?php 
00142 echo HtmlInput::submit('add_impress',_("Valider"));
00143 echo '</form>';
00144 }
00145 
00146 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations