/[openfoncier]/trunk/obj/om_logo.class.php
ViewVC logotype

Contents of /trunk/obj/om_logo.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1357 - (show annotations)
Mon Mar 11 14:20:48 2013 UTC (11 years, 10 months ago) by fmichon
File size: 2574 byte(s)
Mise à niveau openmairie-exemple 4.4.0-dev

1 <?php
2 /**
3 *
4 *
5 * @package openmairie
6 * @version SVN : $Id$
7 */
8
9 require_once "../gen/obj/om_logo.class.php";
10
11 class om_logo extends om_logo_gen {
12
13 function om_logo($id, &$db, $debug) {
14 $this->constructeur($id, $db, $debug);
15 }
16
17 function setType(&$form, $maj) {
18 //
19 parent::setType($form, $maj);
20 // ajouter et modifier
21 if ($maj == 0 || $maj == 1) {
22 //
23 if ($this->retourformulaire == 'om_collectivite') {
24 $form->setType('fichier', 'upload2');
25 } else {
26 $form->setType('fichier', 'upload');
27 }
28 }
29 }
30
31 function verifier($val = array(), &$db = NULL, $DEBUG = false) {
32 // On appelle la methode de la classe parent
33 parent::verifier($val, $db, $DEBUG);
34 // On verifie si il y a un autre id 'actif' pour la collectivite
35 if ($this->valF['actif'] == "Oui") {
36 //
37 if ($this->getParameter("maj") == 0) {
38 //
39 $this->verifieractif($db, $val, $DEBUG, "]");
40 } else {
41 //
42 $this->verifieractif($db, $val, $DEBUG, $val[$this->clePrimaire]);
43 }
44 }
45 }
46
47 /**
48 * verification sur existence d un etat deja actif pour la collectivite
49 */
50 function verifieractif(&$db, $val, $DEBUG, $id) {
51 //
52 $table = "om_logo";
53 $primary_key = "om_logo";
54 //
55 $sql = " SELECT ".$table.".".$primary_key." ";
56 $sql .= " FROM ".DB_PREFIXE."".$table." ";
57 $sql .= " WHERE ".$table.".id='".$val['id']."' ";
58 $sql .= " AND ".$table.".om_collectivite='".$val['om_collectivite']."' ";
59 $sql .= " AND ".$table.".actif IS TRUE ";
60 if ($id != "]") {
61 $sql .=" AND ".$table.".".$primary_key."<>'".$id."' ";
62 }
63 //
64 $res = $this->db->query($sql);
65 $this->addToLog("db->query(\"".$sql."\");", VERBOSE_MODE);
66 //
67 if (database::isError($res)) {
68 //
69 die($res->getMessage()." => Echec ".$sql);
70 } else {
71 //
72 $nbligne = $res->numrows();
73 if ($nbligne > 0) {
74 $this->correct = false;
75 $msg = $nbligne." ";
76 $msg .= _("logo(s) existant(s) dans l'etat actif. Il ".
77 "n'est pas possible d'avoir plus d'un logo");
78 $msg .= " \"".$val["id"]."\" "._("actif par collectivite.");
79 $this->addToMessage($msg);
80 }
81 }
82 }
83
84 }
85
86 ?>

Properties

Name Value
svn:executable *

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26