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
generic_del.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
* Suppress a link to a folder
9
*
10
* @author Anakeen 2000
11
* @version $Id: generic_del.php,v 1.13 2006/11/21 15:52:03 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
19
include_once (
"FDL/Class.Doc.php"
);
20
include_once (
"FDL/Class.DocAttr.php"
);
21
include_once (
"FDL/freedom_util.php"
);
22
/**
23
* Put a doc in trash
24
* @param Action &$action current action
25
* @global id Http var : document id to trash
26
* @global recursive Http var : if yes and it is a folder like family try to delete containt (primary relation) also
27
*/
28
function
generic_del
(&
$action
)
29
{
30
// -----------------------------------
31
// Get all the params
32
$docid
=
GetHttpVars
(
"id"
);
33
$recursive = (
GetHttpVars
(
"recursive"
) ==
"yes"
);
34
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
35
36
if
(
$docid
> 0) {
37
38
$doc
=
new_Doc
(
$dbaccess
,
$docid
);
39
40
$err
=
$doc
->PreDocDelete();
41
if
(
$err
!=
""
)
$action
->ExitError(
$err
);
42
// ------------------------------
43
// delete document
44
if
($recursive) {
45
if
(
$doc
->doctype ==
'D'
)
$err
=
$doc
->deleteRecursive();
46
else
$action
->ExitError(sprintf(_(
"%s document it is not a folder and cannot support recursive deletion"
) ,
$doc
->title));
47
}
else
{
48
$err
=
$doc
->Delete();
49
}
50
if
(
$err
!=
""
)
$action
->ExitError(
$err
);
51
52
$action
->AddActionDone(
"DELFILE"
,
$doc
->prelid);
53
$action
->AddActionDone(
"TRASHFILE"
,
$doc
->prelid);
54
redirect(
$action
,
"FDL"
,
"FDL_CARD&sole=Y&refreshfld=Y&id=$docid"
);
55
}
56
57
redirect(
$action
,
GetHttpVars
(
"app"
) ,
"GENERIC_LOGO"
);
58
}
59
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase