Core
3.2
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
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
* @package FDL
5
*/
6
/**
7
* Generated Header (not documented yet)
8
*
9
* @author Anakeen
10
* @version $Id: fdl_trigger.php,v 1.8 2007/05/22 16:06:29 eric Exp $
11
* @package FDL
12
* @subpackage
13
*/
14
/**
15
*/
16
// refreah for a classname
17
// use this only if you have changed title attributes
18
include_once (
"FDL/Lib.Attr.php"
);
19
20
$usage
=
new
ApiUsage
();
21
22
$usage
->setDefinitionText(
"Return sql code to inject trigget in base"
);
23
$docid
=
$usage
->addOptionalParameter(
"docid"
,
"special docid"
, null, 0);
24
$trigger
=
$usage
->addOptionalParameter(
"trigger"
,
"trigger"
, null,
"-"
);
25
$trig
= (
$trigger
!=
"-"
);
26
$drop
= (
$trigger
==
"N"
);
27
28
$usage
->verify();
29
30
$appl
=
new
Application
();
31
$appl
->Set(
"FDL"
,
$core
);
32
33
$dbaccess
=
$appl
->dbaccess;
34
if
(
$dbaccess
==
""
) {
35
print
"Database not found : appl->dbaccess"
;
36
exit
;
37
}
38
39
if
(
$docid
!= - 1) {
40
$query
=
new
QueryDb
(
$dbaccess
,
"Doc"
);
41
$query
->AddQuery(
"doctype='C'"
);
42
43
if
(
$docid
> 0)
$query
->AddQuery(
"id=$docid"
);
44
45
$table1
=
$query
->Query(0, 0,
"TABLE"
);
46
47
if
(
$query
->nb > 0) {
48
49
$pubdir
=
DEFAULT_PUBDIR
;
50
51
foreach
(
$table1
as $k => $v) {
52
$doc
=
createDoc
(
$dbaccess
, $v[
"id"
]);
53
54
if
(
$trig
)
print
$doc
->sqltrigger(
$drop
) .
"\n"
;
55
else
{
56
$triggers =
$doc
->sqltrigger(
false
,
true
);
57
58
if
(is_array($triggers)) {
59
print
implode(
";\n"
, $triggers);
60
}
else
{
61
print
$triggers .
"\n"
;
62
}
63
}
64
print
implode(
' '
,
$doc
->getSqlIndex()) .
"\n"
;
65
}
66
}
67
}
68
69
if
((
$docid
== - 1) || (
$docid
== 0)) {
70
71
include_once (
"FDL/Class.DocFam.php"
);
72
$doc
=
new
DocFam
(
$dbaccess
);
73
74
$doc
->doctype =
'C'
;
75
$doc
->fromid =
'fam'
;
76
if
(
$trig
)
print
$doc
->sqltrigger(
$drop
) .
"\n"
;
77
else
if
(!empty(
$doc
->sqltcreate)) {
78
if
(is_array(
$doc
->sqltcreate)) {
79
print
implode(
";\n"
,
$doc
->sqltcreate);
80
}
else
{
81
print
$doc
->sqltcreate .
"\n"
;
82
}
83
}
84
}
$trig
$trig
Definition:
fdl_trigger.php:25
$pubdir
global $pubdir
Definition:
vault_init.php:18
$table1
$table1
Definition:
refreshUserAccount.php:45
$usage
$usage
Definition:
fdl_trigger.php:20
$docid
$docid
Definition:
fdl_trigger.php:23
$trigger
$trigger
Definition:
fdl_trigger.php:24
$drop
$drop
Definition:
fdl_trigger.php:26
DEFAULT_PUBDIR
const DEFAULT_PUBDIR
Definition:
Lib.Prefix.php:28
$dbaccess
$dbaccess
Definition:
fdl_trigger.php:33
createDoc
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
Definition:
freedom_util.php:211
$appl
$appl
Definition:
fdl_trigger.php:30
print
print
Definition:
checklist.php:49
QueryDb
Definition:
Class.QueryDb.php:19
exit
switch($command) exit
Definition:
checkVault.php:46
Application
Definition:
Class.Application.php:30
$query
if(($docid!==0)&&(!is_numeric($docid))) $query
Definition:
generateDocumentClass.php:40
DocFam
Definition:
Class.DocFam.php:20
$doc
$doc
Definition:
SetDocVaultIndex.php:39
ApiUsage
Verify arguments for wsh programs.
Definition:
Class.ApiUsage.php:28
$core
$core
Definition:
chgpasswd.php:33
← centre documentaire
© anakeen