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
fdl_getvalue.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
* View Document
9
*
10
* @author Anakeen 2000
11
* @version $Id: fdl_getvalue.php,v 1.1 2005/07/28 16:47:51 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.Dir.php"
);
20
/**
21
* View a document
22
* @param Action &$action current action
23
* @global docid Http var : document identificator to see
24
* @global latest Http var : (Y|N) if Y force view latest revision
25
* @global attrid Http var : the attribute id to see
26
* @global vid Http var : if set, view represention describe in view control (can be use only if doc has controlled view)
27
*/
28
function
fdl_getvalue
(&
$action
)
29
{
30
// -----------------------------------
31
$docid
=
GetHttpVars
(
"id"
);
32
$latest
=
GetHttpVars
(
"latest"
,
"Y"
);
33
$attrid =
GetHttpVars
(
"attrid"
);
34
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
35
36
if
(
$docid
==
""
)
$action
->exitError(_(
"no document reference"
));
37
if
(!is_numeric(
$docid
))
$docid
=
getIdFromName
(
$dbaccess
,
$docid
);
38
if
(intval(
$docid
) == 0)
$action
->exitError(sprintf(_(
"unknow logical reference '%s'"
) ,
GetHttpVars
(
"id"
)));
39
$doc
=
new_Doc
(
$dbaccess
,
$docid
);
40
if
(!
$doc
->isAffected())
$action
->exitError(sprintf(_(
"cannot see unknow reference %s"
) ,
$docid
));
41
42
if
((
$latest
==
"Y"
) && (
$doc
->locked == - 1)) {
43
// get latest revision
44
$docid
=
$doc
->latestId();
45
$doc
=
new_Doc
(
$dbaccess
,
$docid
);
46
}
47
$err
=
$doc
->control(
"view"
);
48
if
(
$err
!=
""
)
$action
->exitError(
$err
);
49
50
if
(($vid !=
""
) && (
$doc
->cvid > 0)) {
51
// special controlled view
52
$cvdoc =
new_Doc
(
$dbaccess
,
$doc
->cvid);
53
$cvdoc->set(
$doc
);
54
55
$err
= $cvdoc->control($vid);
// control special view
56
if
(
$err
!=
""
)
$action
->exitError(
$err
);
57
58
$tview = $cvdoc->getView($vid);
59
$doc
->setMask($tview[
"CV_MSKID"
]);
60
}
61
62
$a
=
$doc
->getAttribute($attrid);
63
if
(
$a
) {
64
if
(
$doc
->mvisibility !=
"I"
) $v =
$doc
->getValue($attrid);
65
else
$v = sprintf(
"no privilege to access attribute [%s] for document %s |%d]"
, $attrid,
$doc
->title,
$doc
->id);
66
}
else
{
67
$v = sprintf(
"unknown attribute [%s] for document %s |%d]"
, $attrid,
$doc
->title,
$doc
->id);
68
}
69
70
$action
->lay =
new
Layout
();
71
$action
->lay->set(
"OUT"
, $v);
72
}
73
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase