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=HtmlInput::default_value_get('type','XX');
00029 if ($type == 'XX') {
00030      throw new Exception('invalid call');
00031     return;
00032 }
00033 if ( $type=='me')
00034 {
00035 $ame_code_dep=$cn->make_array("
00036         select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') from
00037         menu_ref
00038         where
00039         me_file is null and me_javascript is null and me_url is null and me_type<>'PR' and me_type <> 'SP'
00040         and me_code in (select me_code from profile_menu where p_id=$1)".
00041         "       UNION ALL
00042                 select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') from menu_ref
00043         where
00044                 me_code='EXT'
00045         order by 1
00046         ",1,array($p_id));
00047 $ame_code=$cn->make_array("
00048 select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')
00049         ||'('|| case when me_type='SP' then 'Special'
00050                 when me_type='PR' then 'Impression'
00051                 when me_type='PL' then 'Plugin'
00052                 when me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'
00053                 when me_type='ME' then 'Menu'
00054                 else
00055                 me_type
00056                 end||')'
00057         from
00058         menu_ref
00059         order by 1
00060         ");
00061 
00062 $p_order=new INum("p_order","10");
00063 $atype=$cn->make_array("select pm_type,pm_desc from profile_menu_type order by 1");
00064 
00065 $me_code=new ISelect('me_code');
00066 $me_code->value=$ame_code;
00067 
00068 $me_code_dep=new ISelect('me_code_dep');
00069 $me_code_dep->value=$ame_code_dep;
00070 
00071 $p_type=new ISelect('p_type');
00072 $p_type->value=$atype;
00073 $pm_default=new ICheckBox('pm_default');
00074 echo HtmlInput::title_box(_("Nouveau menu"), $ctl);
00075 ?>
00076 <form method="POST" onsubmit="return confirm('<?php echo _('Vous confirmez');?> ?')">
00077         <?php 
00078         echo HtmlInput::hidden('tab','profile_menu_div');
00079         ?>
00080         <?php echo HtmlInput::hidden('p_id',$p_id)?>
00081 <table>
00082 <tr>
00083         <td>Code</td>
00084         <td><?php echo $me_code->input()?></td>
00085 </tr>
00086 <tr>
00087         <td>Dépendant de <?php echo HtmlInput::infobulle(20)?></td>
00088         <td><?php echo $me_code_dep->input()?></td>
00089 </tr>
00090 
00091 <tr>
00092         <td>Ordre d'apparition</td>
00093         <td><?php echo $p_order->input()?></td>
00094 </tr>
00095 <tr>
00096         <td>Menu par défaut</td>
00097         <td><?php echo $pm_default->input()?></td>
00098 </tr>
00099 <tr>
00100         <td>Type de menu</td>
00101         <td><?php echo $p_type->input()?></td>
00102 </tr>
00103 </table>
00104 <?php 
00105 echo HtmlInput::submit('add_menu',"Valider");
00106 echo '</form>';
00107 }
00108 if ($type=='pr')
00109 {
00110 
00111 $ame_code=$cn->make_array("
00112 select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')
00113         from
00114         menu_ref
00115         where me_type='PR'
00116         and me_code not in (select me_code from profile_menu where p_id=$1)
00117         order by 1
00118         ",0,array($p_id));
00119 
00120 $me_code=new ISelect('me_code');
00121 $me_code->value=$ame_code;
00122 
00123         echo HtmlInput::title_box(_("Nouveau menu"), $ctl);
00124         if (count($ame_code)==0)
00125         {
00126                 echo h2(_("Aucune impression disponible à ajouter"),'class="notice"');
00127                 return;
00128         }
00129 ?>
00130 <form method="POST" onsubmit="return confirm('<?php echo _('Vous confirmez ?')?>">
00131         <?php 
00132         echo HtmlInput::hidden('tab','profile_print_div');
00133         ?>
00134         <?php echo HtmlInput::hidden('p_id',$p_id)?>
00135         <?php echo HtmlInput::hidden('p_order',10)?>
00136         <?php echo HtmlInput::hidden('me_code_dep','')?>
00137         <?php echo HtmlInput::hidden('p_type','PR')?>
00138 <table>
00139 <tr>
00140         <td>Code</td>
00141         <td><?php echo $me_code->input()?></td>
00142 </tr>
00143 
00144 </table>
00145 <?php 
00146 echo HtmlInput::submit('add_impress',_("Valider"));
00147 echo '</form>';
00148 }
00149 
00150 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations