noalyss Version-9
menu_ref.class.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free 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 is distributed 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 Author Dany De Bontridder danydb@aevalys.eu
20/**
21 *@file
22 *@brief Menu_Ref let you manage the available menu
23 */
24/**
25 *@class Menu_Ref
26 *@brief Menu_Ref let you manage the available menu
27 */
28require_once NOALYSS_INCLUDE.'/database/menu_ref_sql.class.php';
30{
31 function format_code()
32 {
33 $this->me_code=strtoupper($this->me_code);
34 $this->me_code=trim($this->me_code);
35 $this->me_code=noalyss_str_replace('<','',$this->me_code);
36 $this->me_code=noalyss_str_replace('>','',$this->me_code);
37
38 }
39 function verify()
40 {
41 try
42 {
43 parent::verify();
44 if ( $this->me_code == -1)
45 {
46 throw new Exception(_("le code ne peut être vide"));
47 }
48 $this->format_code();
49 if ( $this->cn->get_value("select count(*) from menu_ref where me_code=$1",array($this->me_code)) > 0)
50 throw new Exception ('Doublon');
51 if (trim($this->me_code)=='')
52 throw new Exception ('Ce menu existe déjà');
53 if (empty($this->me_code) ) {
54 throw new Exception(_("le code ne peut être vide"));
55 }
56
57 if ( ! file_exists('../include/'.$this->me_file)) throw new Exception ('Ce menu fichier '.$this->me_file." n'existe pas");
58
59 return 0;
60 } catch (Exception $e)
61 {
62 alert($e->getMessage());
63 return -1;
64 }
65 }
66
67}
68
69?>
noalyss_str_replace($search, $replace, $string)
Definition: ac_common.php:1553
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
$input_from cn
Definition: balance.inc.php:66
ORM Manage the table public.menu_ref.
Menu_Ref let you manage the available menu.