noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
adm.inc.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00020 /*!\brief include from adm.inc.php and concerned only the customer card and
00021  * the customer category
00022  */
00023 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00024 require_once("class_iselect.php");
00025 require_once("class_ihidden.php");
00026 require_once("class_customer.php");
00027 require_once("class_ibutton.php");
00028 require_once('class_iaction.php');
00029 require_once('class_fiche_def.php');
00030 require_once('class_iaction.php');
00031 require_once('class_fiche_def.php');
00032 require_once('class_ipopup.php');
00033 require_once('class_admin.php');
00034 
00035 global $g_user;
00036 
00037 $low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
00038 /*! \file
00039  * \brief Called from the module "Gestion" to manage the customer
00040  */
00041 $href=basename($_SERVER['PHP_SELF']);
00042 
00043 // by default open liste
00044 if ( $low_action  == "" )
00045     $low_action="list";
00046 
00047 
00048 //-----------------------------------------------------
00049 // Remove a card
00050 //-----------------------------------------------------
00051 if ( isset($_POST['delete_card'] ) )
00052 {
00053     if ( $g_user->check_action(FICADD) == 0 )
00054     {
00055         alert('Vous  ne pouvez pas enlever de fiche');
00056         return;
00057     }
00058 
00059     $f_id=$_REQUEST['f_id'];
00060 
00061     $fiche=new Admin($cn,$f_id);
00062     $fiche->remove();
00063     $low_action="list";
00064 
00065 }
00066 
00067 //-----------------------------------------------------
00068 //    list of customer
00069 //-----------------------------------------------------
00070 if ( $low_action == "list" )
00071 {
00072 
00073     ?>
00074     <div class="content">
00075                            <div>
00076         <form method="get" action="<?php echo $href; ?>">
00077         <?php
00078         echo '<h2>' . "Exercice " . $g_user->get_exercice() . '</h2>';
00079         echo dossier::hidden();
00080     $a=(isset($_GET['query']))?$_GET['query']:"";
00081     printf (_('Recherche').' <input class="input_text" type="text" name="query" value="%s">',
00082             $a);
00083         echo HtmlInput::request_to_hidden(array('ac'));
00084     $sel_card=new ISelect('cat');
00085     $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
00086                                      ' where  frd_id='.FICHE_TYPE_ADM_TAX.
00087                                      ' order by fd_label ',1);
00088     $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
00089     $sel_card->javascript=' onchange="submit(this);"';
00090     echo _('Catégorie :').$sel_card->input();
00091 
00092     ?>
00093     <input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
00094          <input type="hidden" name="p_action" value="adm">
00095                                                                      </form>
00096                                                                      </div>
00097                                                                      <?php
00098                                                                      $adm=new Admin($cn);
00099     $search=(isset($_GET['query']))?$_GET['query']:"";
00100     $sql="";
00101     if ( isset($_GET['cat']))
00102         {
00103         if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
00104     }
00105 
00106     echo '<div class="content">';
00107     echo $adm->Summary($search,'adm',$sql);
00108 
00109 
00110     echo '<br>';
00111     echo '<br>';
00112     echo '<br>';
00113         if  ($g_user->check_action(FICADD)==1)
00114         {
00115                 /* Add button */
00116                 $f_add_button=new IButton('add_card');
00117                 $f_add_button->label=_('Créer une nouvelle fiche');
00118                 $f_add_button->set_attribute('ipopup','ipop_newcard');
00119                 $f_add_button->set_attribute('win_refresh','yes');
00120 
00121                 $f_add_button->set_attribute('type_cat',FICHE_TYPE_ADM_TAX);
00122                 $f_add_button->javascript=" select_card_type(this);";
00123                 echo $f_add_button->input();
00124 
00125                 $f_cat_button=new IButton('add_cat');
00126                 $f_cat_button->set_attribute('ipopup','ipop_cat');
00127                 $f_cat_button->set_attribute('type_cat',FICHE_TYPE_ADM_TAX);
00128                 $f_cat_button->label=_('Ajout d\'une catégorie');
00129                 $f_cat_button->javascript='add_category(this)';
00130                 echo $f_cat_button->input();
00131         }
00132     echo '</div>';
00133     echo '</div>';
00134 
00135 
00136 }
00137 /*----------------------------------------------------------------------
00138  * Detail for a card, Suivi, Contact, Operation,... *
00139  * cc stands for customer card
00140  *----------------------------------------------------------------------*/
00141 if ( $low_action == 'detail')
00142 {
00143     /* Menu */
00144     require_once('category_card.inc.php');
00145     exit();
00146 }
00147 
00148 
00149 
00150 html_page_stop();
00151 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations