Platform
3.1
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
createthefam.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
* Create a new family
9
*
10
* @author Anakeen 2006
11
* @version $Id: createthefam.php,v 1.1 2006/03/31 12:29:30 eric Exp $
12
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13
* @package FDL
14
* @subpackage GED
15
*/
16
/**
17
*/
18
19
include_once (
"FDL/Class.Doc.php"
);
20
include_once (
"FDL/Class.DocAttr.php"
);
21
include_once (
"FDL/Lib.Attr.php"
);
22
include_once (
"FDL/Class.DocFam.php"
);
23
include_once (
"FDL/freedom_util.php"
);
24
// -----------------------------------
25
function
createthefam
(&
$action
)
26
{
27
// Get all the params
28
$ftitle =
GetHttpVars
(
"ftitle"
, _(
"new familly document"
));
29
30
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
31
32
$bdfreedomattr =
new
DocAttr
(
$dbaccess
);
33
if
(
$docid
== 0) {
34
$doc
=
new
DocFam
(
$dbaccess
);
35
//---------------------------
36
// add new freedom familly
37
//---------------------------
38
$doc
->title = $ftitle;
39
$doc
->owner =
$action
->user->id;
40
$doc
->locked =
$action
->user->id;
// lock for next modification
41
$doc
->doctype =
'C'
;
// it is a new class document
42
$doc
->fromid =
GetHttpVars
(
"classid"
);
// inherit from
43
$doc
->profid =
"0"
;
// NO PROFILE ACCESS
44
if
(
GetHttpVars
(
"classid"
) > 0) {
45
$cdoc =
new_Doc
(
$dbaccess
,
GetHttpVars
(
"classid"
));
46
$doc
->classname =
""
;
47
$doc
->profid = $cdoc->cprofid;
// inherit father profile
48
49
}
50
$err
=
$doc
->Add();
51
if
(
$err
!=
""
)
$action
->exitError(
$err
);
52
}
53
54
$wsh =
getWshCmd
();
55
$cmd
= $wsh .
"--userid={$action->user->id} --api=fdl_adoc --docid="
.
$doc
->initid;
56
57
$err
= exec(
$cmd
,
$out
,
$ret
);
58
59
$doc
->unlock(
true
);
60
if
(
$ret
)
$action
->exitError(
$err
);
61
62
redirect(
$action
,
"FDL"
,
"FDL_CARD&id="
.
$doc
->id,
$action
->GetParam(
"CORE_STANDURL"
));
63
}
64
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase