Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
fdl_trigger.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: fdl_trigger.php,v 1.8 2007/05/22 16:06:29 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 // refreah for a classname
19 // use this only if you have changed title attributes
20 include_once ("FDL/Lib.Attr.php");
21 
23 $appl->Set("FDL", $core);
24 
25 $dbaccess = $appl->GetParam("FREEDOM_DB");
26 if ($dbaccess == "") {
27  print "Database not found : param FREEDOM_DB";
28  exit;
29 }
30 
31 $docid = GetHttpVars("docid", 0); // special docid
32 $trig = (GetHttpVars("trigger", "-") != "-");
33 $drop = (GetHttpVars("trigger", "-") == "N");
34 
35 if ($docid != - 1) {
36  $query = new QueryDb($dbaccess, "Doc");
37  $query->AddQuery("doctype='C'");
38 
39  if ($docid > 0) $query->AddQuery("id=$docid");
40 
41  $table1 = $query->Query(0, 0, "TABLE");
42 
43  if ($query->nb > 0) {
44 
45  $pubdir = $appl->GetParam("CORE_PUBDIR");
46 
47  while (list($k, $v) = each($table1)) {
48  $doc = createDoc($dbaccess, $v["id"]);
49 
50  if ($trig) print $doc->sqltrigger($drop) . "\n";
51  else {
52  $triggers = $doc->sqltrigger(false, true);
53  if (is_array($triggers)) {
54  print implode(";\n", $triggers);
55  } else {
56  print $triggers . "\n";
57  }
58  }
59  print $doc->getSqlIndex();
60  }
61  }
62 }
63 
64 if (($docid == - 1) || ($docid == 0)) {
65 
66  include_once ("FDL/Class.DocFam.php");
67  $doc = new DocFam($dbaccess);
68 
69  $doc->doctype = 'C';
70  $doc->fromid = 'fam';
71  if ($trig) print $doc->sqltrigger($drop) . "\n";
72  else {
73  if (is_array($doc->sqltcreate)) {
74  print implode(";\n", $doc->sqltcreate);
75  } else {
76  print $doc->sqltcreate . "\n";
77  }
78  }
79 }
80 ?>
← centre documentaire © anakeen - published under CC License - Dynacase